2 * hostapd / Initialization and configuration
3 * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
18 #include "common/defs.h"
20 struct wpa_driver_ops
;
22 struct radius_server_data
;
23 struct upnp_wps_device_sm
;
24 struct hapd_interfaces
;
27 struct hostap_sta_driver_data
;
28 struct ieee80211_ht_capabilities
;
29 struct full_dynamic_vlan
;
33 struct hostapd_probereq_cb
{
34 int (*cb
)(void *ctx
, const u8
*sa
, const u8
*da
, const u8
*bssid
,
35 const u8
*ie
, size_t ie_len
);
39 #define HOSTAPD_RATE_BASIC 0x00000001
41 struct hostapd_rate_data
{
42 int rate
; /* rate in 100 kbps */
43 int flags
; /* HOSTAPD_RATE_ flags */
46 struct hostapd_frame_info
{
54 * struct hostapd_data - hostapd per-BSS data structure
57 struct hostapd_iface
*iface
;
58 struct hostapd_config
*iconf
;
59 struct hostapd_bss_config
*conf
;
60 int interface_added
; /* virtual interface added for this BSS */
62 u8 own_addr
[ETH_ALEN
];
64 int num_sta
; /* number of entries in sta_list */
65 struct sta_info
*sta_list
; /* STA info list head */
66 #define STA_HASH_SIZE 256
67 #define STA_HASH(sta) (sta[5])
68 struct sta_info
*sta_hash
[STA_HASH_SIZE
];
71 * Bitfield for indicating which AIDs are allocated. Only AID values
72 * 1-2007 are used and as such, the bit at index 0 corresponds to AID
75 #define AID_WORDS ((2008 + 31) / 32)
76 u32 sta_aid
[AID_WORDS
];
78 const struct wpa_driver_ops
*driver
;
81 void (*new_assoc_sta_cb
)(struct hostapd_data
*hapd
,
82 struct sta_info
*sta
, int reassoc
);
84 void *msg_ctx
; /* ctx for wpa_msg() calls */
85 void *msg_ctx_parent
; /* parent interface ctx for wpa_msg() calls */
87 struct radius_client_data
*radius
;
88 u32 acct_session_id_hi
, acct_session_id_lo
;
90 struct iapp_data
*iapp
;
92 struct hostapd_cached_radius_acl
*acl_cache
;
93 struct hostapd_acl_query_data
*acl_queries
;
95 struct wpa_authenticator
*wpa_auth
;
96 struct eapol_authenticator
*eapol_auth
;
98 struct rsn_preauth_interface
*preauth_iface
;
99 time_t michael_mic_failure
;
100 int michael_mic_failures
;
101 int tkip_countermeasures
;
104 struct wpa_ctrl_dst
*ctrl_dst
;
107 void *eap_sim_db_priv
;
108 struct radius_server_data
*radius_srv
;
110 int parameter_set_count
;
112 /* Time Advertisement */
113 u8 time_update_counter
;
114 struct wpabuf
*time_adv
;
116 #ifdef CONFIG_FULL_DYNAMIC_VLAN
117 struct full_dynamic_vlan
*full_dynamic_vlan
;
118 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
120 struct l2_packet_data
*l2
;
121 struct wps_context
*wps
;
124 struct wpabuf
*wps_beacon_ie
;
125 struct wpabuf
*wps_probe_resp_ie
;
127 unsigned int ap_pin_failures
;
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
,
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
;
195 struct hostapd_hw_modes
*hw_features
;
197 struct hostapd_hw_modes
*current_mode
;
198 /* Rates that are currently used (i.e., filtered copy of
199 * current_mode->channels */
201 struct hostapd_rate_data
*current_rates
;
207 /* Number of associated Non-ERP stations (i.e., stations using 802.11b
211 /* Number of associated stations that do not support Short Slot Time */
212 int num_sta_no_short_slot_time
;
214 /* Number of associated stations that do not support Short Preamble */
215 int num_sta_no_short_preamble
;
217 int olbc
; /* Overlapping Legacy BSS Condition */
219 /* Number of HT associated stations that do not support greenfield */
220 int num_sta_ht_no_gf
;
222 /* Number of associated non-HT stations */
225 /* Number of HT associated stations 20 MHz */
226 int num_sta_ht_20mhz
;
228 /* Overlapping BSS information */
232 void (*scan_cb
)(struct hostapd_iface
*iface
);
234 int (*ctrl_iface_init
)(struct hostapd_data
*hapd
);
235 void (*ctrl_iface_deinit
)(struct hostapd_data
*hapd
);
237 int (*for_each_interface
)(struct hapd_interfaces
*interfaces
,
238 int (*cb
)(struct hostapd_iface
*iface
,
239 void *ctx
), void *ctx
);
243 int hostapd_reload_config(struct hostapd_iface
*iface
);
244 struct hostapd_data
*
245 hostapd_alloc_bss_data(struct hostapd_iface
*hapd_iface
,
246 struct hostapd_config
*conf
,
247 struct hostapd_bss_config
*bss
);
248 int hostapd_setup_interface(struct hostapd_iface
*iface
);
249 int hostapd_setup_interface_complete(struct hostapd_iface
*iface
, int err
);
250 void hostapd_interface_deinit(struct hostapd_iface
*iface
);
251 void hostapd_interface_free(struct hostapd_iface
*iface
);
252 void hostapd_new_assoc_sta(struct hostapd_data
*hapd
, struct sta_info
*sta
,
256 int hostapd_register_probereq_cb(struct hostapd_data
*hapd
,
257 int (*cb
)(void *ctx
, const u8
*sa
,
258 const u8
*da
, const u8
*bssid
,
259 const u8
*ie
, size_t ie_len
),
261 void hostapd_prune_associations(struct hostapd_data
*hapd
, const u8
*addr
);
263 /* drv_callbacks.c (TODO: move to somewhere else?) */
264 int hostapd_notif_assoc(struct hostapd_data
*hapd
, const u8
*addr
,
265 const u8
*ie
, size_t ielen
, int reassoc
);
266 void hostapd_notif_disassoc(struct hostapd_data
*hapd
, const u8
*addr
);
267 void hostapd_event_sta_low_ack(struct hostapd_data
*hapd
, const u8
*addr
);
268 int hostapd_probe_req_rx(struct hostapd_data
*hapd
, const u8
*sa
, const u8
*da
,
269 const u8
*bssid
, const u8
*ie
, size_t ie_len
);
271 #endif /* HOSTAPD_H */