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);
36 int (*driver_init)(struct hostapd_iface *iface);
40 char *global_iface_path;
41 char *global_iface_name;
42 struct hostapd_iface **iface;
46 struct hostapd_probereq_cb {
47 int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid,
48 const u8 *ie, size_t ie_len, int ssi_signal);
52 #define HOSTAPD_RATE_BASIC 0x00000001
54 struct hostapd_rate_data {
55 int rate; /* rate in 100 kbps */
56 int flags; /* HOSTAPD_RATE_ flags */
59 struct hostapd_frame_info {
62 int ssi_signal; /* dBm */
67 * struct hostapd_data - hostapd per-BSS data structure
70 struct hostapd_iface *iface;
71 struct hostapd_config *iconf;
72 struct hostapd_bss_config *conf;
73 int interface_added; /* virtual interface added for this BSS */
75 u8 own_addr[ETH_ALEN];
77 int num_sta; /* number of entries in sta_list */
78 struct sta_info *sta_list; /* STA info list head */
79 #define STA_HASH_SIZE 256
80 #define STA_HASH(sta) (sta[5])
81 struct sta_info *sta_hash[STA_HASH_SIZE];
84 * Bitfield for indicating which AIDs are allocated. Only AID values
85 * 1-2007 are used and as such, the bit at index 0 corresponds to AID
88 #define AID_WORDS ((2008 + 31) / 32)
89 u32 sta_aid[AID_WORDS];
91 const struct wpa_driver_ops *driver;
94 void (*new_assoc_sta_cb)(struct hostapd_data *hapd,
95 struct sta_info *sta, int reassoc);
97 void *msg_ctx; /* ctx for wpa_msg() calls */
98 void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */
100 struct radius_client_data *radius;
101 u32 acct_session_id_hi, acct_session_id_lo;
102 struct radius_das_data *radius_das;
104 struct iapp_data *iapp;
106 struct hostapd_cached_radius_acl *acl_cache;
107 struct hostapd_acl_query_data *acl_queries;
109 struct wpa_authenticator *wpa_auth;
110 struct eapol_authenticator *eapol_auth;
112 struct rsn_preauth_interface *preauth_iface;
113 time_t michael_mic_failure;
114 int michael_mic_failures;
115 int tkip_countermeasures;
118 struct wpa_ctrl_dst *ctrl_dst;
121 void *eap_sim_db_priv;
122 struct radius_server_data *radius_srv;
124 int parameter_set_count;
126 /* Time Advertisement */
127 u8 time_update_counter;
128 struct wpabuf *time_adv;
130 #ifdef CONFIG_FULL_DYNAMIC_VLAN
131 struct full_dynamic_vlan *full_dynamic_vlan;
132 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
134 struct l2_packet_data *l2;
135 struct wps_context *wps;
138 struct wpabuf *wps_beacon_ie;
139 struct wpabuf *wps_probe_resp_ie;
141 unsigned int ap_pin_failures;
142 unsigned int ap_pin_failures_consecutive;
143 struct upnp_wps_device_sm *wps_upnp;
144 unsigned int ap_pin_lockout_time;
145 #endif /* CONFIG_WPS */
147 struct hostapd_probereq_cb *probereq_cb;
148 size_t num_probereq_cb;
150 void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
152 void *public_action_cb_ctx;
154 int (*vendor_action_cb)(void *ctx, const u8 *buf, size_t len,
156 void *vendor_action_cb_ctx;
158 void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
160 void *wps_reg_success_cb_ctx;
162 void (*wps_event_cb)(void *ctx, enum wps_event event,
163 union wps_event_data *data);
164 void *wps_event_cb_ctx;
166 void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr,
167 int authorized, const u8 *p2p_dev_addr);
168 void *sta_authorized_cb_ctx;
170 void (*setup_complete_cb)(void *ctx);
171 void *setup_complete_cb_ctx;
174 struct p2p_data *p2p;
175 struct p2p_group *p2p_group;
176 struct wpabuf *p2p_beacon_ie;
177 struct wpabuf *p2p_probe_resp_ie;
179 /* Number of non-P2P association stations */
182 /* Periodic NoA (used only when no non-P2P clients in the group) */
186 #endif /* CONFIG_P2P */
187 #ifdef CONFIG_INTERWORKING
188 size_t gas_frag_limit;
189 #endif /* CONFIG_INTERWORKING */
194 * struct hostapd_iface - hostapd per-interface data structure
196 struct hostapd_iface {
197 struct hapd_interfaces *interfaces;
200 struct hostapd_config *conf;
203 struct hostapd_data **bss;
205 int num_ap; /* number of entries in ap_list */
206 struct ap_info *ap_list; /* AP info list head */
207 struct ap_info *ap_hash[STA_HASH_SIZE];
208 struct ap_info *ap_iter_list;
210 unsigned int drv_flags;
213 * A bitmap of supported protocols for probe response offload. See
214 * struct wpa_driver_capa in driver.h
216 unsigned int probe_resp_offloads;
218 struct hostapd_hw_modes *hw_features;
220 struct hostapd_hw_modes *current_mode;
221 /* Rates that are currently used (i.e., filtered copy of
222 * current_mode->channels */
224 struct hostapd_rate_data *current_rates;
230 /* Number of associated Non-ERP stations (i.e., stations using 802.11b
234 /* Number of associated stations that do not support Short Slot Time */
235 int num_sta_no_short_slot_time;
237 /* Number of associated stations that do not support Short Preamble */
238 int num_sta_no_short_preamble;
240 int olbc; /* Overlapping Legacy BSS Condition */
242 /* Number of HT associated stations that do not support greenfield */
243 int num_sta_ht_no_gf;
245 /* Number of associated non-HT stations */
248 /* Number of HT associated stations 20 MHz */
249 int num_sta_ht_20mhz;
251 /* Overlapping BSS information */
255 void (*scan_cb)(struct hostapd_iface *iface);
259 int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
260 int (*cb)(struct hostapd_iface *iface,
261 void *ctx), void *ctx);
262 int hostapd_reload_config(struct hostapd_iface *iface);
263 struct hostapd_data *
264 hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
265 struct hostapd_config *conf,
266 struct hostapd_bss_config *bss);
267 int hostapd_setup_interface(struct hostapd_iface *iface);
268 int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
269 void hostapd_interface_deinit(struct hostapd_iface *iface);
270 void hostapd_interface_free(struct hostapd_iface *iface);
271 void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
273 void hostapd_interface_deinit_free(struct hostapd_iface *iface);
274 int hostapd_enable_iface(struct hostapd_iface *hapd_iface);
275 int hostapd_reload_iface(struct hostapd_iface *hapd_iface);
276 int hostapd_disable_iface(struct hostapd_iface *hapd_iface);
279 int hostapd_register_probereq_cb(struct hostapd_data *hapd,
280 int (*cb)(void *ctx, const u8 *sa,
281 const u8 *da, const u8 *bssid,
282 const u8 *ie, size_t ie_len,
285 void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
287 /* drv_callbacks.c (TODO: move to somewhere else?) */
288 int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
289 const u8 *ie, size_t ielen, int reassoc);
290 void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
291 void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr);
292 int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
293 const u8 *bssid, const u8 *ie, size_t ie_len,
295 void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
298 #endif /* HOSTAPD_H */