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;
18 struct hapd_interfaces;
21 struct hostap_sta_driver_data;
22 struct ieee80211_ht_capabilities;
23 struct full_dynamic_vlan;
27 struct hostapd_probereq_cb {
28 int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid,
29 const u8 *ie, size_t ie_len);
33 #define HOSTAPD_RATE_BASIC 0x00000001
35 struct hostapd_rate_data {
36 int rate; /* rate in 100 kbps */
37 int flags; /* HOSTAPD_RATE_ flags */
40 struct hostapd_frame_info {
48 * struct hostapd_data - hostapd per-BSS data structure
51 struct hostapd_iface *iface;
52 struct hostapd_config *iconf;
53 struct hostapd_bss_config *conf;
54 int interface_added; /* virtual interface added for this BSS */
56 u8 own_addr[ETH_ALEN];
58 int num_sta; /* number of entries in sta_list */
59 struct sta_info *sta_list; /* STA info list head */
60 #define STA_HASH_SIZE 256
61 #define STA_HASH(sta) (sta[5])
62 struct sta_info *sta_hash[STA_HASH_SIZE];
65 * Bitfield for indicating which AIDs are allocated. Only AID values
66 * 1-2007 are used and as such, the bit at index 0 corresponds to AID
69 #define AID_WORDS ((2008 + 31) / 32)
70 u32 sta_aid[AID_WORDS];
72 const struct wpa_driver_ops *driver;
75 void (*new_assoc_sta_cb)(struct hostapd_data *hapd,
76 struct sta_info *sta, int reassoc);
78 void *msg_ctx; /* ctx for wpa_msg() calls */
79 void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */
81 struct radius_client_data *radius;
82 u32 acct_session_id_hi, acct_session_id_lo;
84 struct iapp_data *iapp;
86 struct hostapd_cached_radius_acl *acl_cache;
87 struct hostapd_acl_query_data *acl_queries;
89 struct wpa_authenticator *wpa_auth;
90 struct eapol_authenticator *eapol_auth;
92 struct rsn_preauth_interface *preauth_iface;
93 time_t michael_mic_failure;
94 int michael_mic_failures;
95 int tkip_countermeasures;
98 struct wpa_ctrl_dst *ctrl_dst;
101 void *eap_sim_db_priv;
102 struct radius_server_data *radius_srv;
104 int parameter_set_count;
106 /* Time Advertisement */
107 u8 time_update_counter;
108 struct wpabuf *time_adv;
110 #ifdef CONFIG_FULL_DYNAMIC_VLAN
111 struct full_dynamic_vlan *full_dynamic_vlan;
112 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
114 struct l2_packet_data *l2;
115 struct wps_context *wps;
118 struct wpabuf *wps_beacon_ie;
119 struct wpabuf *wps_probe_resp_ie;
121 unsigned int ap_pin_failures;
122 unsigned int ap_pin_failures_consecutive;
123 struct upnp_wps_device_sm *wps_upnp;
124 unsigned int ap_pin_lockout_time;
125 #endif /* CONFIG_WPS */
127 struct hostapd_probereq_cb *probereq_cb;
128 size_t num_probereq_cb;
130 void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
132 void *public_action_cb_ctx;
134 int (*vendor_action_cb)(void *ctx, const u8 *buf, size_t len,
136 void *vendor_action_cb_ctx;
138 void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
140 void *wps_reg_success_cb_ctx;
142 void (*wps_event_cb)(void *ctx, enum wps_event event,
143 union wps_event_data *data);
144 void *wps_event_cb_ctx;
146 void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr,
147 int authorized, const u8 *p2p_dev_addr);
148 void *sta_authorized_cb_ctx;
150 void (*setup_complete_cb)(void *ctx);
151 void *setup_complete_cb_ctx;
154 struct p2p_data *p2p;
155 struct p2p_group *p2p_group;
156 struct wpabuf *p2p_beacon_ie;
157 struct wpabuf *p2p_probe_resp_ie;
159 /* Number of non-P2P association stations */
162 /* Periodic NoA (used only when no non-P2P clients in the group) */
166 #endif /* CONFIG_P2P */
171 * struct hostapd_iface - hostapd per-interface data structure
173 struct hostapd_iface {
174 struct hapd_interfaces *interfaces;
176 int (*reload_config)(struct hostapd_iface *iface);
177 struct hostapd_config * (*config_read_cb)(const char *config_fname);
179 struct hostapd_config *conf;
182 struct hostapd_data **bss;
184 int num_ap; /* number of entries in ap_list */
185 struct ap_info *ap_list; /* AP info list head */
186 struct ap_info *ap_hash[STA_HASH_SIZE];
187 struct ap_info *ap_iter_list;
189 unsigned int drv_flags;
192 * A bitmap of supported protocols for probe response offload. See
193 * struct wpa_driver_capa in driver.h
195 unsigned int probe_resp_offloads;
197 struct hostapd_hw_modes *hw_features;
199 struct hostapd_hw_modes *current_mode;
200 /* Rates that are currently used (i.e., filtered copy of
201 * current_mode->channels */
203 struct hostapd_rate_data *current_rates;
209 /* Number of associated Non-ERP stations (i.e., stations using 802.11b
213 /* Number of associated stations that do not support Short Slot Time */
214 int num_sta_no_short_slot_time;
216 /* Number of associated stations that do not support Short Preamble */
217 int num_sta_no_short_preamble;
219 int olbc; /* Overlapping Legacy BSS Condition */
221 /* Number of HT associated stations that do not support greenfield */
222 int num_sta_ht_no_gf;
224 /* Number of associated non-HT stations */
227 /* Number of HT associated stations 20 MHz */
228 int num_sta_ht_20mhz;
230 /* Overlapping BSS information */
234 void (*scan_cb)(struct hostapd_iface *iface);
236 int (*ctrl_iface_init)(struct hostapd_data *hapd);
237 void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
239 int (*for_each_interface)(struct hapd_interfaces *interfaces,
240 int (*cb)(struct hostapd_iface *iface,
241 void *ctx), void *ctx);
245 int hostapd_reload_config(struct hostapd_iface *iface);
246 struct hostapd_data *
247 hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
248 struct hostapd_config *conf,
249 struct hostapd_bss_config *bss);
250 int hostapd_setup_interface(struct hostapd_iface *iface);
251 int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
252 void hostapd_interface_deinit(struct hostapd_iface *iface);
253 void hostapd_interface_free(struct hostapd_iface *iface);
254 void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
258 int hostapd_register_probereq_cb(struct hostapd_data *hapd,
259 int (*cb)(void *ctx, const u8 *sa,
260 const u8 *da, const u8 *bssid,
261 const u8 *ie, size_t ie_len),
263 void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
265 /* drv_callbacks.c (TODO: move to somewhere else?) */
266 int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
267 const u8 *ie, size_t ielen, int reassoc);
268 void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
269 void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr);
270 int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
271 const u8 *bssid, const u8 *ie, size_t ie_len);
273 #endif /* HOSTAPD_H */