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;
26 struct hapd_interfaces {
28 struct hostapd_iface **iface;
32 struct hostapd_probereq_cb {
33 int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid,
34 const u8 *ie, size_t ie_len);
38 #define HOSTAPD_RATE_BASIC 0x00000001
40 struct hostapd_rate_data {
41 int rate; /* rate in 100 kbps */
42 int flags; /* HOSTAPD_RATE_ flags */
45 struct hostapd_frame_info {
53 * struct hostapd_data - hostapd per-BSS data structure
56 struct hostapd_iface *iface;
57 struct hostapd_config *iconf;
58 struct hostapd_bss_config *conf;
59 int interface_added; /* virtual interface added for this BSS */
61 u8 own_addr[ETH_ALEN];
63 int num_sta; /* number of entries in sta_list */
64 struct sta_info *sta_list; /* STA info list head */
65 #define STA_HASH_SIZE 256
66 #define STA_HASH(sta) (sta[5])
67 struct sta_info *sta_hash[STA_HASH_SIZE];
70 * Bitfield for indicating which AIDs are allocated. Only AID values
71 * 1-2007 are used and as such, the bit at index 0 corresponds to AID
74 #define AID_WORDS ((2008 + 31) / 32)
75 u32 sta_aid[AID_WORDS];
77 const struct wpa_driver_ops *driver;
80 void (*new_assoc_sta_cb)(struct hostapd_data *hapd,
81 struct sta_info *sta, int reassoc);
83 void *msg_ctx; /* ctx for wpa_msg() calls */
84 void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */
86 struct radius_client_data *radius;
87 u32 acct_session_id_hi, acct_session_id_lo;
89 struct iapp_data *iapp;
91 struct hostapd_cached_radius_acl *acl_cache;
92 struct hostapd_acl_query_data *acl_queries;
94 struct wpa_authenticator *wpa_auth;
95 struct eapol_authenticator *eapol_auth;
97 struct rsn_preauth_interface *preauth_iface;
98 time_t michael_mic_failure;
99 int michael_mic_failures;
100 int tkip_countermeasures;
103 struct wpa_ctrl_dst *ctrl_dst;
106 void *eap_sim_db_priv;
107 struct radius_server_data *radius_srv;
109 int parameter_set_count;
111 /* Time Advertisement */
112 u8 time_update_counter;
113 struct wpabuf *time_adv;
115 #ifdef CONFIG_FULL_DYNAMIC_VLAN
116 struct full_dynamic_vlan *full_dynamic_vlan;
117 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
119 struct l2_packet_data *l2;
120 struct wps_context *wps;
123 struct wpabuf *wps_beacon_ie;
124 struct wpabuf *wps_probe_resp_ie;
126 unsigned int ap_pin_failures;
127 unsigned int ap_pin_failures_consecutive;
128 struct upnp_wps_device_sm *wps_upnp;
129 unsigned int ap_pin_lockout_time;
130 #endif /* CONFIG_WPS */
132 struct hostapd_probereq_cb *probereq_cb;
133 size_t num_probereq_cb;
135 void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
137 void *public_action_cb_ctx;
139 int (*vendor_action_cb)(void *ctx, const u8 *buf, size_t len,
141 void *vendor_action_cb_ctx;
143 void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
145 void *wps_reg_success_cb_ctx;
147 void (*wps_event_cb)(void *ctx, enum wps_event event,
148 union wps_event_data *data);
149 void *wps_event_cb_ctx;
151 void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr,
152 int authorized, const u8 *p2p_dev_addr);
153 void *sta_authorized_cb_ctx;
155 void (*setup_complete_cb)(void *ctx);
156 void *setup_complete_cb_ctx;
159 struct p2p_data *p2p;
160 struct p2p_group *p2p_group;
161 struct wpabuf *p2p_beacon_ie;
162 struct wpabuf *p2p_probe_resp_ie;
164 /* Number of non-P2P association stations */
167 /* Periodic NoA (used only when no non-P2P clients in the group) */
171 #endif /* CONFIG_P2P */
176 * struct hostapd_iface - hostapd per-interface data structure
178 struct hostapd_iface {
179 struct hapd_interfaces *interfaces;
181 int (*reload_config)(struct hostapd_iface *iface);
182 struct hostapd_config * (*config_read_cb)(const char *config_fname);
184 struct hostapd_config *conf;
187 struct hostapd_data **bss;
189 int num_ap; /* number of entries in ap_list */
190 struct ap_info *ap_list; /* AP info list head */
191 struct ap_info *ap_hash[STA_HASH_SIZE];
192 struct ap_info *ap_iter_list;
194 unsigned int drv_flags;
197 * A bitmap of supported protocols for probe response offload. See
198 * struct wpa_driver_capa in driver.h
200 unsigned int probe_resp_offloads;
202 struct hostapd_hw_modes *hw_features;
204 struct hostapd_hw_modes *current_mode;
205 /* Rates that are currently used (i.e., filtered copy of
206 * current_mode->channels */
208 struct hostapd_rate_data *current_rates;
214 /* Number of associated Non-ERP stations (i.e., stations using 802.11b
218 /* Number of associated stations that do not support Short Slot Time */
219 int num_sta_no_short_slot_time;
221 /* Number of associated stations that do not support Short Preamble */
222 int num_sta_no_short_preamble;
224 int olbc; /* Overlapping Legacy BSS Condition */
226 /* Number of HT associated stations that do not support greenfield */
227 int num_sta_ht_no_gf;
229 /* Number of associated non-HT stations */
232 /* Number of HT associated stations 20 MHz */
233 int num_sta_ht_20mhz;
235 /* Overlapping BSS information */
239 void (*scan_cb)(struct hostapd_iface *iface);
241 int (*ctrl_iface_init)(struct hostapd_data *hapd);
242 void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
244 int (*for_each_interface)(struct hapd_interfaces *interfaces,
245 int (*cb)(struct hostapd_iface *iface,
246 void *ctx), void *ctx);
250 int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
251 int (*cb)(struct hostapd_iface *iface,
252 void *ctx), void *ctx);
253 int hostapd_reload_config(struct hostapd_iface *iface);
254 struct hostapd_data *
255 hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
256 struct hostapd_config *conf,
257 struct hostapd_bss_config *bss);
258 int hostapd_setup_interface(struct hostapd_iface *iface);
259 int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
260 void hostapd_interface_deinit(struct hostapd_iface *iface);
261 void hostapd_interface_free(struct hostapd_iface *iface);
262 void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
266 int hostapd_register_probereq_cb(struct hostapd_data *hapd,
267 int (*cb)(void *ctx, const u8 *sa,
268 const u8 *da, const u8 *bssid,
269 const u8 *ie, size_t ie_len),
271 void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
273 /* drv_callbacks.c (TODO: move to somewhere else?) */
274 int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
275 const u8 *ie, size_t ielen, int reassoc);
276 void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
277 void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr);
278 int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
279 const u8 *bssid, const u8 *ie, size_t ie_len);
281 #endif /* HOSTAPD_H */