2 * hostapd / Initialization and configuration
3 * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
12 #include "common/defs.h"
14 struct wpa_driver_ops;
16 struct radius_server_data;
17 struct upnp_wps_device_sm;
20 struct hostap_sta_driver_data;
21 struct ieee80211_ht_capabilities;
22 struct full_dynamic_vlan;
28 struct hapd_interfaces {
29 int (*reload_config)(struct hostapd_iface *iface);
30 struct hostapd_config * (*config_read_cb)(const char *config_fname);
31 int (*ctrl_iface_init)(struct hostapd_data *hapd);
32 void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
33 int (*for_each_interface)(struct hapd_interfaces *interfaces,
34 int (*cb)(struct hostapd_iface *iface,
35 void *ctx), void *ctx);
38 struct hostapd_iface **iface;
42 struct hostapd_probereq_cb {
43 int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid,
44 const u8 *ie, size_t ie_len, int ssi_signal);
48 #define HOSTAPD_RATE_BASIC 0x00000001
50 struct hostapd_rate_data {
51 int rate; /* rate in 100 kbps */
52 int flags; /* HOSTAPD_RATE_ flags */
55 struct hostapd_frame_info {
58 int ssi_signal; /* dBm */
63 * struct hostapd_data - hostapd per-BSS data structure
66 struct hostapd_iface *iface;
67 struct hostapd_config *iconf;
68 struct hostapd_bss_config *conf;
69 int interface_added; /* virtual interface added for this BSS */
71 u8 own_addr[ETH_ALEN];
73 int num_sta; /* number of entries in sta_list */
74 struct sta_info *sta_list; /* STA info list head */
75 #define STA_HASH_SIZE 256
76 #define STA_HASH(sta) (sta[5])
77 struct sta_info *sta_hash[STA_HASH_SIZE];
80 * Bitfield for indicating which AIDs are allocated. Only AID values
81 * 1-2007 are used and as such, the bit at index 0 corresponds to AID
84 #define AID_WORDS ((2008 + 31) / 32)
85 u32 sta_aid[AID_WORDS];
87 const struct wpa_driver_ops *driver;
90 void (*new_assoc_sta_cb)(struct hostapd_data *hapd,
91 struct sta_info *sta, int reassoc);
93 void *msg_ctx; /* ctx for wpa_msg() calls */
94 void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */
96 struct radius_client_data *radius;
97 u32 acct_session_id_hi, acct_session_id_lo;
98 struct radius_das_data *radius_das;
100 struct iapp_data *iapp;
102 struct hostapd_cached_radius_acl *acl_cache;
103 struct hostapd_acl_query_data *acl_queries;
105 struct wpa_authenticator *wpa_auth;
106 struct eapol_authenticator *eapol_auth;
108 struct rsn_preauth_interface *preauth_iface;
109 time_t michael_mic_failure;
110 int michael_mic_failures;
111 int tkip_countermeasures;
114 struct wpa_ctrl_dst *ctrl_dst;
117 void *eap_sim_db_priv;
118 struct radius_server_data *radius_srv;
120 int parameter_set_count;
122 /* Time Advertisement */
123 u8 time_update_counter;
124 struct wpabuf *time_adv;
126 #ifdef CONFIG_FULL_DYNAMIC_VLAN
127 struct full_dynamic_vlan *full_dynamic_vlan;
128 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
130 struct l2_packet_data *l2;
131 struct wps_context *wps;
134 struct wpabuf *wps_beacon_ie;
135 struct wpabuf *wps_probe_resp_ie;
137 unsigned int ap_pin_failures;
138 unsigned int ap_pin_failures_consecutive;
139 struct upnp_wps_device_sm *wps_upnp;
140 unsigned int ap_pin_lockout_time;
141 #endif /* CONFIG_WPS */
143 struct hostapd_probereq_cb *probereq_cb;
144 size_t num_probereq_cb;
146 void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
148 void *public_action_cb_ctx;
150 int (*vendor_action_cb)(void *ctx, const u8 *buf, size_t len,
152 void *vendor_action_cb_ctx;
154 void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
156 void *wps_reg_success_cb_ctx;
158 void (*wps_event_cb)(void *ctx, enum wps_event event,
159 union wps_event_data *data);
160 void *wps_event_cb_ctx;
162 void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr,
163 int authorized, const u8 *p2p_dev_addr);
164 void *sta_authorized_cb_ctx;
166 void (*setup_complete_cb)(void *ctx);
167 void *setup_complete_cb_ctx;
170 struct p2p_data *p2p;
171 struct p2p_group *p2p_group;
172 struct wpabuf *p2p_beacon_ie;
173 struct wpabuf *p2p_probe_resp_ie;
175 /* Number of non-P2P association stations */
178 /* Periodic NoA (used only when no non-P2P clients in the group) */
182 #endif /* CONFIG_P2P */
183 #ifdef CONFIG_INTERWORKING
184 size_t gas_frag_limit;
185 #endif /* CONFIG_INTERWORKING */
190 * struct hostapd_iface - hostapd per-interface data structure
192 struct hostapd_iface {
193 struct hapd_interfaces *interfaces;
196 struct hostapd_config *conf;
199 struct hostapd_data **bss;
201 int num_ap; /* number of entries in ap_list */
202 struct ap_info *ap_list; /* AP info list head */
203 struct ap_info *ap_hash[STA_HASH_SIZE];
204 struct ap_info *ap_iter_list;
206 unsigned int drv_flags;
209 * A bitmap of supported protocols for probe response offload. See
210 * struct wpa_driver_capa in driver.h
212 unsigned int probe_resp_offloads;
214 struct hostapd_hw_modes *hw_features;
216 struct hostapd_hw_modes *current_mode;
217 /* Rates that are currently used (i.e., filtered copy of
218 * current_mode->channels */
220 struct hostapd_rate_data *current_rates;
226 /* Number of associated Non-ERP stations (i.e., stations using 802.11b
230 /* Number of associated stations that do not support Short Slot Time */
231 int num_sta_no_short_slot_time;
233 /* Number of associated stations that do not support Short Preamble */
234 int num_sta_no_short_preamble;
236 int olbc; /* Overlapping Legacy BSS Condition */
238 /* Number of HT associated stations that do not support greenfield */
239 int num_sta_ht_no_gf;
241 /* Number of associated non-HT stations */
244 /* Number of HT associated stations 20 MHz */
245 int num_sta_ht_20mhz;
247 /* Overlapping BSS information */
251 void (*scan_cb)(struct hostapd_iface *iface);
255 int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
256 int (*cb)(struct hostapd_iface *iface,
257 void *ctx), void *ctx);
258 int hostapd_reload_config(struct hostapd_iface *iface);
259 struct hostapd_data *
260 hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
261 struct hostapd_config *conf,
262 struct hostapd_bss_config *bss);
263 int hostapd_setup_interface(struct hostapd_iface *iface);
264 int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
265 void hostapd_interface_deinit(struct hostapd_iface *iface);
266 void hostapd_interface_free(struct hostapd_iface *iface);
267 void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
271 int hostapd_register_probereq_cb(struct hostapd_data *hapd,
272 int (*cb)(void *ctx, const u8 *sa,
273 const u8 *da, const u8 *bssid,
274 const u8 *ie, size_t ie_len,
277 void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
279 /* drv_callbacks.c (TODO: move to somewhere else?) */
280 int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
281 const u8 *ie, size_t ielen, int reassoc);
282 void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
283 void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr);
284 int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
285 const u8 *bssid, const u8 *ie, size_t ie_len,
287 void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
290 #endif /* HOSTAPD_H */