xref: /freebsd/contrib/wpa/src/ap/hostapd.h (revision 325151a32e114f02699a301c1e74080e7c1f1a26)
1e28a4053SRui Paulo /*
2e28a4053SRui Paulo  * hostapd / Initialization and configuration
35b9c547cSRui Paulo  * Copyright (c) 2002-2014, Jouni Malinen <j@w1.fi>
4e28a4053SRui Paulo  *
5f05cddf9SRui Paulo  * This software may be distributed under the terms of the BSD license.
6f05cddf9SRui Paulo  * See README for more details.
7e28a4053SRui Paulo  */
8e28a4053SRui Paulo 
9e28a4053SRui Paulo #ifndef HOSTAPD_H
10e28a4053SRui Paulo #define HOSTAPD_H
11e28a4053SRui Paulo 
12e28a4053SRui Paulo #include "common/defs.h"
135b9c547cSRui Paulo #include "utils/list.h"
14f05cddf9SRui Paulo #include "ap_config.h"
155b9c547cSRui Paulo #include "drivers/driver.h"
16e28a4053SRui Paulo 
17e28a4053SRui Paulo struct wpa_ctrl_dst;
18e28a4053SRui Paulo struct radius_server_data;
19e28a4053SRui Paulo struct upnp_wps_device_sm;
20e28a4053SRui Paulo struct hostapd_data;
21e28a4053SRui Paulo struct sta_info;
22e28a4053SRui Paulo struct ieee80211_ht_capabilities;
23e28a4053SRui Paulo struct full_dynamic_vlan;
24f05cddf9SRui Paulo enum wps_event;
25f05cddf9SRui Paulo union wps_event_data;
265b9c547cSRui Paulo #ifdef CONFIG_MESH
275b9c547cSRui Paulo struct mesh_conf;
285b9c547cSRui Paulo #endif /* CONFIG_MESH */
29f05cddf9SRui Paulo 
30f05cddf9SRui Paulo struct hostapd_iface;
31f05cddf9SRui Paulo 
32f05cddf9SRui Paulo struct hapd_interfaces {
33f05cddf9SRui Paulo 	int (*reload_config)(struct hostapd_iface *iface);
34f05cddf9SRui Paulo 	struct hostapd_config * (*config_read_cb)(const char *config_fname);
35f05cddf9SRui Paulo 	int (*ctrl_iface_init)(struct hostapd_data *hapd);
36f05cddf9SRui Paulo 	void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
37f05cddf9SRui Paulo 	int (*for_each_interface)(struct hapd_interfaces *interfaces,
38f05cddf9SRui Paulo 				  int (*cb)(struct hostapd_iface *iface,
39f05cddf9SRui Paulo 					    void *ctx), void *ctx);
40f05cddf9SRui Paulo 	int (*driver_init)(struct hostapd_iface *iface);
41f05cddf9SRui Paulo 
42f05cddf9SRui Paulo 	size_t count;
43f05cddf9SRui Paulo 	int global_ctrl_sock;
44*325151a3SRui Paulo 	struct wpa_ctrl_dst *global_ctrl_dst;
45f05cddf9SRui Paulo 	char *global_iface_path;
46f05cddf9SRui Paulo 	char *global_iface_name;
475b9c547cSRui Paulo #ifndef CONFIG_NATIVE_WINDOWS
485b9c547cSRui Paulo 	gid_t ctrl_iface_group;
495b9c547cSRui Paulo #endif /* CONFIG_NATIVE_WINDOWS */
50f05cddf9SRui Paulo 	struct hostapd_iface **iface;
515b9c547cSRui Paulo 
525b9c547cSRui Paulo 	size_t terminate_on_error;
53*325151a3SRui Paulo #ifndef CONFIG_NO_VLAN
54*325151a3SRui Paulo 	struct dynamic_iface *vlan_priv;
55*325151a3SRui Paulo #endif /* CONFIG_NO_VLAN */
56f05cddf9SRui Paulo };
57f05cddf9SRui Paulo 
585b9c547cSRui Paulo enum hostapd_chan_status {
595b9c547cSRui Paulo 	HOSTAPD_CHAN_VALID = 0, /* channel is ready */
605b9c547cSRui Paulo 	HOSTAPD_CHAN_INVALID = 1, /* no usable channel found */
615b9c547cSRui Paulo 	HOSTAPD_CHAN_ACS = 2, /* ACS work being performed */
625b9c547cSRui Paulo };
63e28a4053SRui Paulo 
64e28a4053SRui Paulo struct hostapd_probereq_cb {
65f05cddf9SRui Paulo 	int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid,
66f05cddf9SRui Paulo 		  const u8 *ie, size_t ie_len, int ssi_signal);
67e28a4053SRui Paulo 	void *ctx;
68e28a4053SRui Paulo };
69e28a4053SRui Paulo 
70e28a4053SRui Paulo #define HOSTAPD_RATE_BASIC 0x00000001
71e28a4053SRui Paulo 
72e28a4053SRui Paulo struct hostapd_rate_data {
73e28a4053SRui Paulo 	int rate; /* rate in 100 kbps */
74e28a4053SRui Paulo 	int flags; /* HOSTAPD_RATE_ flags */
75e28a4053SRui Paulo };
76e28a4053SRui Paulo 
77e28a4053SRui Paulo struct hostapd_frame_info {
78e28a4053SRui Paulo 	u32 channel;
79e28a4053SRui Paulo 	u32 datarate;
80f05cddf9SRui Paulo 	int ssi_signal; /* dBm */
81e28a4053SRui Paulo };
82e28a4053SRui Paulo 
835b9c547cSRui Paulo enum wps_status {
845b9c547cSRui Paulo 	WPS_STATUS_SUCCESS = 1,
855b9c547cSRui Paulo 	WPS_STATUS_FAILURE
865b9c547cSRui Paulo };
875b9c547cSRui Paulo 
885b9c547cSRui Paulo enum pbc_status {
895b9c547cSRui Paulo 	WPS_PBC_STATUS_DISABLE,
905b9c547cSRui Paulo 	WPS_PBC_STATUS_ACTIVE,
915b9c547cSRui Paulo 	WPS_PBC_STATUS_TIMEOUT,
925b9c547cSRui Paulo 	WPS_PBC_STATUS_OVERLAP
935b9c547cSRui Paulo };
945b9c547cSRui Paulo 
955b9c547cSRui Paulo struct wps_stat {
965b9c547cSRui Paulo 	enum wps_status status;
975b9c547cSRui Paulo 	enum wps_error_indication failure_reason;
985b9c547cSRui Paulo 	enum pbc_status pbc_status;
995b9c547cSRui Paulo 	u8 peer_addr[ETH_ALEN];
1005b9c547cSRui Paulo };
1015b9c547cSRui Paulo 
102e28a4053SRui Paulo 
103e28a4053SRui Paulo /**
104e28a4053SRui Paulo  * struct hostapd_data - hostapd per-BSS data structure
105e28a4053SRui Paulo  */
106e28a4053SRui Paulo struct hostapd_data {
107e28a4053SRui Paulo 	struct hostapd_iface *iface;
108e28a4053SRui Paulo 	struct hostapd_config *iconf;
109e28a4053SRui Paulo 	struct hostapd_bss_config *conf;
110e28a4053SRui Paulo 	int interface_added; /* virtual interface added for this BSS */
1115b9c547cSRui Paulo 	unsigned int started:1;
1125b9c547cSRui Paulo 	unsigned int disabled:1;
1135b9c547cSRui Paulo 	unsigned int reenable_beacon:1;
114e28a4053SRui Paulo 
115e28a4053SRui Paulo 	u8 own_addr[ETH_ALEN];
116e28a4053SRui Paulo 
117e28a4053SRui Paulo 	int num_sta; /* number of entries in sta_list */
118e28a4053SRui Paulo 	struct sta_info *sta_list; /* STA info list head */
119e28a4053SRui Paulo #define STA_HASH_SIZE 256
120e28a4053SRui Paulo #define STA_HASH(sta) (sta[5])
121e28a4053SRui Paulo 	struct sta_info *sta_hash[STA_HASH_SIZE];
122e28a4053SRui Paulo 
123e28a4053SRui Paulo 	/*
124e28a4053SRui Paulo 	 * Bitfield for indicating which AIDs are allocated. Only AID values
125e28a4053SRui Paulo 	 * 1-2007 are used and as such, the bit at index 0 corresponds to AID
126e28a4053SRui Paulo 	 * 1.
127e28a4053SRui Paulo 	 */
128e28a4053SRui Paulo #define AID_WORDS ((2008 + 31) / 32)
129e28a4053SRui Paulo 	u32 sta_aid[AID_WORDS];
130e28a4053SRui Paulo 
131e28a4053SRui Paulo 	const struct wpa_driver_ops *driver;
132e28a4053SRui Paulo 	void *drv_priv;
133e28a4053SRui Paulo 
134e28a4053SRui Paulo 	void (*new_assoc_sta_cb)(struct hostapd_data *hapd,
135e28a4053SRui Paulo 				 struct sta_info *sta, int reassoc);
136e28a4053SRui Paulo 
137e28a4053SRui Paulo 	void *msg_ctx; /* ctx for wpa_msg() calls */
138f05cddf9SRui Paulo 	void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */
139e28a4053SRui Paulo 
140e28a4053SRui Paulo 	struct radius_client_data *radius;
141e28a4053SRui Paulo 	u32 acct_session_id_hi, acct_session_id_lo;
142f05cddf9SRui Paulo 	struct radius_das_data *radius_das;
143e28a4053SRui Paulo 
144e28a4053SRui Paulo 	struct iapp_data *iapp;
145e28a4053SRui Paulo 
146e28a4053SRui Paulo 	struct hostapd_cached_radius_acl *acl_cache;
147e28a4053SRui Paulo 	struct hostapd_acl_query_data *acl_queries;
148e28a4053SRui Paulo 
149e28a4053SRui Paulo 	struct wpa_authenticator *wpa_auth;
150e28a4053SRui Paulo 	struct eapol_authenticator *eapol_auth;
151e28a4053SRui Paulo 
152e28a4053SRui Paulo 	struct rsn_preauth_interface *preauth_iface;
1535b9c547cSRui Paulo 	struct os_reltime michael_mic_failure;
154e28a4053SRui Paulo 	int michael_mic_failures;
155e28a4053SRui Paulo 	int tkip_countermeasures;
156e28a4053SRui Paulo 
157e28a4053SRui Paulo 	int ctrl_sock;
158e28a4053SRui Paulo 	struct wpa_ctrl_dst *ctrl_dst;
159e28a4053SRui Paulo 
160e28a4053SRui Paulo 	void *ssl_ctx;
161e28a4053SRui Paulo 	void *eap_sim_db_priv;
162e28a4053SRui Paulo 	struct radius_server_data *radius_srv;
1635b9c547cSRui Paulo 	struct dl_list erp_keys; /* struct eap_server_erp_key */
164e28a4053SRui Paulo 
165e28a4053SRui Paulo 	int parameter_set_count;
166e28a4053SRui Paulo 
167f05cddf9SRui Paulo 	/* Time Advertisement */
168f05cddf9SRui Paulo 	u8 time_update_counter;
169f05cddf9SRui Paulo 	struct wpabuf *time_adv;
170f05cddf9SRui Paulo 
171e28a4053SRui Paulo #ifdef CONFIG_FULL_DYNAMIC_VLAN
172e28a4053SRui Paulo 	struct full_dynamic_vlan *full_dynamic_vlan;
173e28a4053SRui Paulo #endif /* CONFIG_FULL_DYNAMIC_VLAN */
174e28a4053SRui Paulo 
175e28a4053SRui Paulo 	struct l2_packet_data *l2;
176e28a4053SRui Paulo 	struct wps_context *wps;
177e28a4053SRui Paulo 
178f05cddf9SRui Paulo 	int beacon_set_done;
179e28a4053SRui Paulo 	struct wpabuf *wps_beacon_ie;
180e28a4053SRui Paulo 	struct wpabuf *wps_probe_resp_ie;
181e28a4053SRui Paulo #ifdef CONFIG_WPS
182e28a4053SRui Paulo 	unsigned int ap_pin_failures;
183f05cddf9SRui Paulo 	unsigned int ap_pin_failures_consecutive;
184e28a4053SRui Paulo 	struct upnp_wps_device_sm *wps_upnp;
185e28a4053SRui Paulo 	unsigned int ap_pin_lockout_time;
1865b9c547cSRui Paulo 
1875b9c547cSRui Paulo 	struct wps_stat wps_stats;
188e28a4053SRui Paulo #endif /* CONFIG_WPS */
189e28a4053SRui Paulo 
190e28a4053SRui Paulo 	struct hostapd_probereq_cb *probereq_cb;
191e28a4053SRui Paulo 	size_t num_probereq_cb;
192e28a4053SRui Paulo 
193e28a4053SRui Paulo 	void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
194e28a4053SRui Paulo 				 int freq);
195e28a4053SRui Paulo 	void *public_action_cb_ctx;
1965b9c547cSRui Paulo 	void (*public_action_cb2)(void *ctx, const u8 *buf, size_t len,
1975b9c547cSRui Paulo 				  int freq);
1985b9c547cSRui Paulo 	void *public_action_cb2_ctx;
199e28a4053SRui Paulo 
200f05cddf9SRui Paulo 	int (*vendor_action_cb)(void *ctx, const u8 *buf, size_t len,
201f05cddf9SRui Paulo 				int freq);
202f05cddf9SRui Paulo 	void *vendor_action_cb_ctx;
203f05cddf9SRui Paulo 
204e28a4053SRui Paulo 	void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
205e28a4053SRui Paulo 				   const u8 *uuid_e);
206e28a4053SRui Paulo 	void *wps_reg_success_cb_ctx;
207f05cddf9SRui Paulo 
208f05cddf9SRui Paulo 	void (*wps_event_cb)(void *ctx, enum wps_event event,
209f05cddf9SRui Paulo 			     union wps_event_data *data);
210f05cddf9SRui Paulo 	void *wps_event_cb_ctx;
211f05cddf9SRui Paulo 
212f05cddf9SRui Paulo 	void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr,
213f05cddf9SRui Paulo 				  int authorized, const u8 *p2p_dev_addr);
214f05cddf9SRui Paulo 	void *sta_authorized_cb_ctx;
215f05cddf9SRui Paulo 
216f05cddf9SRui Paulo 	void (*setup_complete_cb)(void *ctx);
217f05cddf9SRui Paulo 	void *setup_complete_cb_ctx;
218f05cddf9SRui Paulo 
2195b9c547cSRui Paulo 	void (*new_psk_cb)(void *ctx, const u8 *mac_addr,
2205b9c547cSRui Paulo 			   const u8 *p2p_dev_addr, const u8 *psk,
2215b9c547cSRui Paulo 			   size_t psk_len);
2225b9c547cSRui Paulo 	void *new_psk_cb_ctx;
2235b9c547cSRui Paulo 
2245b9c547cSRui Paulo 	/* channel switch parameters */
2255b9c547cSRui Paulo 	struct hostapd_freq_params cs_freq_params;
2265b9c547cSRui Paulo 	u8 cs_count;
2275b9c547cSRui Paulo 	int cs_block_tx;
2285b9c547cSRui Paulo 	unsigned int cs_c_off_beacon;
2295b9c547cSRui Paulo 	unsigned int cs_c_off_proberesp;
2305b9c547cSRui Paulo 	int csa_in_progress;
2315b9c547cSRui Paulo 
2325b9c547cSRui Paulo 	/* BSS Load */
2335b9c547cSRui Paulo 	unsigned int bss_load_update_timeout;
2345b9c547cSRui Paulo 
235f05cddf9SRui Paulo #ifdef CONFIG_P2P
236f05cddf9SRui Paulo 	struct p2p_data *p2p;
237f05cddf9SRui Paulo 	struct p2p_group *p2p_group;
238f05cddf9SRui Paulo 	struct wpabuf *p2p_beacon_ie;
239f05cddf9SRui Paulo 	struct wpabuf *p2p_probe_resp_ie;
240f05cddf9SRui Paulo 
241f05cddf9SRui Paulo 	/* Number of non-P2P association stations */
242f05cddf9SRui Paulo 	int num_sta_no_p2p;
243f05cddf9SRui Paulo 
244f05cddf9SRui Paulo 	/* Periodic NoA (used only when no non-P2P clients in the group) */
245f05cddf9SRui Paulo 	int noa_enabled;
246f05cddf9SRui Paulo 	int noa_start;
247f05cddf9SRui Paulo 	int noa_duration;
248f05cddf9SRui Paulo #endif /* CONFIG_P2P */
249f05cddf9SRui Paulo #ifdef CONFIG_INTERWORKING
250f05cddf9SRui Paulo 	size_t gas_frag_limit;
251f05cddf9SRui Paulo #endif /* CONFIG_INTERWORKING */
2525b9c547cSRui Paulo #ifdef CONFIG_PROXYARP
2535b9c547cSRui Paulo 	struct l2_packet_data *sock_dhcp;
2545b9c547cSRui Paulo 	struct l2_packet_data *sock_ndisc;
2555b9c547cSRui Paulo #endif /* CONFIG_PROXYARP */
2565b9c547cSRui Paulo #ifdef CONFIG_MESH
2575b9c547cSRui Paulo 	int num_plinks;
2585b9c547cSRui Paulo 	int max_plinks;
2595b9c547cSRui Paulo 	void (*mesh_sta_free_cb)(struct sta_info *sta);
2605b9c547cSRui Paulo 	struct wpabuf *mesh_pending_auth;
2615b9c547cSRui Paulo 	struct os_reltime mesh_pending_auth_time;
2625b9c547cSRui Paulo #endif /* CONFIG_MESH */
263f05cddf9SRui Paulo 
264f05cddf9SRui Paulo #ifdef CONFIG_SQLITE
265f05cddf9SRui Paulo 	struct hostapd_eap_user tmp_eap_user;
266f05cddf9SRui Paulo #endif /* CONFIG_SQLITE */
2675b9c547cSRui Paulo 
2685b9c547cSRui Paulo #ifdef CONFIG_SAE
2695b9c547cSRui Paulo 	/** Key used for generating SAE anti-clogging tokens */
2705b9c547cSRui Paulo 	u8 sae_token_key[8];
2715b9c547cSRui Paulo 	struct os_reltime last_sae_token_key_update;
272*325151a3SRui Paulo 	int dot11RSNASAERetransPeriod; /* msec */
2735b9c547cSRui Paulo #endif /* CONFIG_SAE */
2745b9c547cSRui Paulo 
2755b9c547cSRui Paulo #ifdef CONFIG_TESTING_OPTIONS
2765b9c547cSRui Paulo 	unsigned int ext_mgmt_frame_handling:1;
2775b9c547cSRui Paulo 	unsigned int ext_eapol_frame_io:1;
2785b9c547cSRui Paulo 
2795b9c547cSRui Paulo 	struct l2_packet_data *l2_test;
2805b9c547cSRui Paulo #endif /* CONFIG_TESTING_OPTIONS */
281e28a4053SRui Paulo };
282e28a4053SRui Paulo 
283e28a4053SRui Paulo 
284*325151a3SRui Paulo struct hostapd_sta_info {
285*325151a3SRui Paulo 	struct dl_list list;
286*325151a3SRui Paulo 	u8 addr[ETH_ALEN];
287*325151a3SRui Paulo 	struct os_reltime last_seen;
288*325151a3SRui Paulo };
289*325151a3SRui Paulo 
290e28a4053SRui Paulo /**
291e28a4053SRui Paulo  * struct hostapd_iface - hostapd per-interface data structure
292e28a4053SRui Paulo  */
293e28a4053SRui Paulo struct hostapd_iface {
294e28a4053SRui Paulo 	struct hapd_interfaces *interfaces;
295e28a4053SRui Paulo 	void *owner;
296e28a4053SRui Paulo 	char *config_fname;
297e28a4053SRui Paulo 	struct hostapd_config *conf;
2985b9c547cSRui Paulo 	char phy[16]; /* Name of the PHY (radio) */
2995b9c547cSRui Paulo 
3005b9c547cSRui Paulo 	enum hostapd_iface_state {
3015b9c547cSRui Paulo 		HAPD_IFACE_UNINITIALIZED,
3025b9c547cSRui Paulo 		HAPD_IFACE_DISABLED,
3035b9c547cSRui Paulo 		HAPD_IFACE_COUNTRY_UPDATE,
3045b9c547cSRui Paulo 		HAPD_IFACE_ACS,
3055b9c547cSRui Paulo 		HAPD_IFACE_HT_SCAN,
3065b9c547cSRui Paulo 		HAPD_IFACE_DFS,
3075b9c547cSRui Paulo 		HAPD_IFACE_ENABLED
3085b9c547cSRui Paulo 	} state;
3095b9c547cSRui Paulo 
3105b9c547cSRui Paulo #ifdef CONFIG_MESH
3115b9c547cSRui Paulo 	struct mesh_conf *mconf;
3125b9c547cSRui Paulo #endif /* CONFIG_MESH */
313e28a4053SRui Paulo 
314e28a4053SRui Paulo 	size_t num_bss;
315e28a4053SRui Paulo 	struct hostapd_data **bss;
316e28a4053SRui Paulo 
3175b9c547cSRui Paulo 	unsigned int wait_channel_update:1;
3185b9c547cSRui Paulo 	unsigned int cac_started:1;
319*325151a3SRui Paulo #ifdef CONFIG_FST
320*325151a3SRui Paulo 	struct fst_iface *fst;
321*325151a3SRui Paulo 	const struct wpabuf *fst_ies;
322*325151a3SRui Paulo #endif /* CONFIG_FST */
3235b9c547cSRui Paulo 
3245b9c547cSRui Paulo 	/*
3255b9c547cSRui Paulo 	 * When set, indicates that the driver will handle the AP
3265b9c547cSRui Paulo 	 * teardown: delete global keys, station keys, and stations.
3275b9c547cSRui Paulo 	 */
3285b9c547cSRui Paulo 	unsigned int driver_ap_teardown:1;
3295b9c547cSRui Paulo 
330e28a4053SRui Paulo 	int num_ap; /* number of entries in ap_list */
331e28a4053SRui Paulo 	struct ap_info *ap_list; /* AP info list head */
332e28a4053SRui Paulo 	struct ap_info *ap_hash[STA_HASH_SIZE];
333e28a4053SRui Paulo 
3345b9c547cSRui Paulo 	u64 drv_flags;
3355b9c547cSRui Paulo 
3365b9c547cSRui Paulo 	/* SMPS modes supported by the driver (WPA_DRIVER_SMPS_MODE_*) */
3375b9c547cSRui Paulo 	unsigned int smps_modes;
338f05cddf9SRui Paulo 
339f05cddf9SRui Paulo 	/*
340f05cddf9SRui Paulo 	 * A bitmap of supported protocols for probe response offload. See
341f05cddf9SRui Paulo 	 * struct wpa_driver_capa in driver.h
342f05cddf9SRui Paulo 	 */
343f05cddf9SRui Paulo 	unsigned int probe_resp_offloads;
344f05cddf9SRui Paulo 
3455b9c547cSRui Paulo 	/* extended capabilities supported by the driver */
3465b9c547cSRui Paulo 	const u8 *extended_capa, *extended_capa_mask;
3475b9c547cSRui Paulo 	unsigned int extended_capa_len;
3485b9c547cSRui Paulo 
3495b9c547cSRui Paulo 	unsigned int drv_max_acl_mac_addrs;
3505b9c547cSRui Paulo 
351e28a4053SRui Paulo 	struct hostapd_hw_modes *hw_features;
352e28a4053SRui Paulo 	int num_hw_features;
353e28a4053SRui Paulo 	struct hostapd_hw_modes *current_mode;
354e28a4053SRui Paulo 	/* Rates that are currently used (i.e., filtered copy of
355e28a4053SRui Paulo 	 * current_mode->channels */
356e28a4053SRui Paulo 	int num_rates;
357e28a4053SRui Paulo 	struct hostapd_rate_data *current_rates;
358f05cddf9SRui Paulo 	int *basic_rates;
359e28a4053SRui Paulo 	int freq;
360e28a4053SRui Paulo 
361e28a4053SRui Paulo 	u16 hw_flags;
362e28a4053SRui Paulo 
363e28a4053SRui Paulo 	/* Number of associated Non-ERP stations (i.e., stations using 802.11b
364e28a4053SRui Paulo 	 * in 802.11g BSS) */
365e28a4053SRui Paulo 	int num_sta_non_erp;
366e28a4053SRui Paulo 
367e28a4053SRui Paulo 	/* Number of associated stations that do not support Short Slot Time */
368e28a4053SRui Paulo 	int num_sta_no_short_slot_time;
369e28a4053SRui Paulo 
370e28a4053SRui Paulo 	/* Number of associated stations that do not support Short Preamble */
371e28a4053SRui Paulo 	int num_sta_no_short_preamble;
372e28a4053SRui Paulo 
373e28a4053SRui Paulo 	int olbc; /* Overlapping Legacy BSS Condition */
374e28a4053SRui Paulo 
375e28a4053SRui Paulo 	/* Number of HT associated stations that do not support greenfield */
376e28a4053SRui Paulo 	int num_sta_ht_no_gf;
377e28a4053SRui Paulo 
378e28a4053SRui Paulo 	/* Number of associated non-HT stations */
379e28a4053SRui Paulo 	int num_sta_no_ht;
380e28a4053SRui Paulo 
381e28a4053SRui Paulo 	/* Number of HT associated stations 20 MHz */
382e28a4053SRui Paulo 	int num_sta_ht_20mhz;
383e28a4053SRui Paulo 
3845b9c547cSRui Paulo 	/* Number of HT40 intolerant stations */
3855b9c547cSRui Paulo 	int num_sta_ht40_intolerant;
3865b9c547cSRui Paulo 
387e28a4053SRui Paulo 	/* Overlapping BSS information */
388e28a4053SRui Paulo 	int olbc_ht;
389e28a4053SRui Paulo 
390e28a4053SRui Paulo 	u16 ht_op_mode;
3915b9c547cSRui Paulo 
3925b9c547cSRui Paulo 	/* surveying helpers */
3935b9c547cSRui Paulo 
3945b9c547cSRui Paulo 	/* number of channels surveyed */
3955b9c547cSRui Paulo 	unsigned int chans_surveyed;
3965b9c547cSRui Paulo 
3975b9c547cSRui Paulo 	/* lowest observed noise floor in dBm */
3985b9c547cSRui Paulo 	s8 lowest_nf;
3995b9c547cSRui Paulo 
4005b9c547cSRui Paulo 	/* channel utilization calculation */
4015b9c547cSRui Paulo 	u64 last_channel_time;
4025b9c547cSRui Paulo 	u64 last_channel_time_busy;
4035b9c547cSRui Paulo 	u8 channel_utilization;
4045b9c547cSRui Paulo 
4055b9c547cSRui Paulo 	unsigned int dfs_cac_ms;
4065b9c547cSRui Paulo 	struct os_reltime dfs_cac_start;
4075b9c547cSRui Paulo 
4085b9c547cSRui Paulo 	/* Latched with the actual secondary channel information and will be
4095b9c547cSRui Paulo 	 * used while juggling between HT20 and HT40 modes. */
4105b9c547cSRui Paulo 	int secondary_ch;
4115b9c547cSRui Paulo 
4125b9c547cSRui Paulo #ifdef CONFIG_ACS
4135b9c547cSRui Paulo 	unsigned int acs_num_completed_scans;
4145b9c547cSRui Paulo #endif /* CONFIG_ACS */
4155b9c547cSRui Paulo 
416e28a4053SRui Paulo 	void (*scan_cb)(struct hostapd_iface *iface);
4175b9c547cSRui Paulo 	int num_ht40_scan_tries;
418*325151a3SRui Paulo 
419*325151a3SRui Paulo 	struct dl_list sta_seen; /* struct hostapd_sta_info */
420*325151a3SRui Paulo 	unsigned int num_sta_seen;
421e28a4053SRui Paulo };
422e28a4053SRui Paulo 
423e28a4053SRui Paulo /* hostapd.c */
424f05cddf9SRui Paulo int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
425f05cddf9SRui Paulo 			       int (*cb)(struct hostapd_iface *iface,
426f05cddf9SRui Paulo 					 void *ctx), void *ctx);
427e28a4053SRui Paulo int hostapd_reload_config(struct hostapd_iface *iface);
428e28a4053SRui Paulo struct hostapd_data *
429e28a4053SRui Paulo hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
430e28a4053SRui Paulo 		       struct hostapd_config *conf,
431e28a4053SRui Paulo 		       struct hostapd_bss_config *bss);
432e28a4053SRui Paulo int hostapd_setup_interface(struct hostapd_iface *iface);
433e28a4053SRui Paulo int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
434e28a4053SRui Paulo void hostapd_interface_deinit(struct hostapd_iface *iface);
435e28a4053SRui Paulo void hostapd_interface_free(struct hostapd_iface *iface);
4365b9c547cSRui Paulo struct hostapd_iface * hostapd_init(struct hapd_interfaces *interfaces,
4375b9c547cSRui Paulo 				    const char *config_file);
4385b9c547cSRui Paulo struct hostapd_iface *
4395b9c547cSRui Paulo hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy,
4405b9c547cSRui Paulo 			   const char *config_fname, int debug);
441e28a4053SRui Paulo void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
442e28a4053SRui Paulo 			   int reassoc);
443f05cddf9SRui Paulo void hostapd_interface_deinit_free(struct hostapd_iface *iface);
444f05cddf9SRui Paulo int hostapd_enable_iface(struct hostapd_iface *hapd_iface);
445f05cddf9SRui Paulo int hostapd_reload_iface(struct hostapd_iface *hapd_iface);
446f05cddf9SRui Paulo int hostapd_disable_iface(struct hostapd_iface *hapd_iface);
447f05cddf9SRui Paulo int hostapd_add_iface(struct hapd_interfaces *ifaces, char *buf);
448f05cddf9SRui Paulo int hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf);
4495b9c547cSRui Paulo void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator);
4505b9c547cSRui Paulo void hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s);
4515b9c547cSRui Paulo const char * hostapd_state_text(enum hostapd_iface_state s);
4525b9c547cSRui Paulo int hostapd_switch_channel(struct hostapd_data *hapd,
4535b9c547cSRui Paulo 			   struct csa_settings *settings);
4545b9c547cSRui Paulo void
4555b9c547cSRui Paulo hostapd_switch_channel_fallback(struct hostapd_iface *iface,
4565b9c547cSRui Paulo 				const struct hostapd_freq_params *freq_params);
4575b9c547cSRui Paulo void hostapd_cleanup_cs_params(struct hostapd_data *hapd);
458*325151a3SRui Paulo void hostapd_periodic_iface(struct hostapd_iface *iface);
459e28a4053SRui Paulo 
460e28a4053SRui Paulo /* utils.c */
461e28a4053SRui Paulo int hostapd_register_probereq_cb(struct hostapd_data *hapd,
462e28a4053SRui Paulo 				 int (*cb)(void *ctx, const u8 *sa,
463f05cddf9SRui Paulo 					   const u8 *da, const u8 *bssid,
464f05cddf9SRui Paulo 					   const u8 *ie, size_t ie_len,
465f05cddf9SRui Paulo 					   int ssi_signal),
466e28a4053SRui Paulo 				 void *ctx);
467e28a4053SRui Paulo void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
468e28a4053SRui Paulo 
469e28a4053SRui Paulo /* drv_callbacks.c (TODO: move to somewhere else?) */
470e28a4053SRui Paulo int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
471f05cddf9SRui Paulo 			const u8 *ie, size_t ielen, int reassoc);
472e28a4053SRui Paulo void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
473f05cddf9SRui Paulo void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr);
4745b9c547cSRui Paulo void hostapd_event_connect_failed_reason(struct hostapd_data *hapd,
4755b9c547cSRui Paulo 					 const u8 *addr, int reason_code);
476f05cddf9SRui Paulo int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
477f05cddf9SRui Paulo 			 const u8 *bssid, const u8 *ie, size_t ie_len,
478f05cddf9SRui Paulo 			 int ssi_signal);
479f05cddf9SRui Paulo void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
4805b9c547cSRui Paulo 			     int offset, int width, int cf1, int cf2);
481f05cddf9SRui Paulo 
482f05cddf9SRui Paulo const struct hostapd_eap_user *
483f05cddf9SRui Paulo hostapd_get_eap_user(struct hostapd_data *hapd, const u8 *identity,
484f05cddf9SRui Paulo 		     size_t identity_len, int phase2);
485e28a4053SRui Paulo 
486*325151a3SRui Paulo struct hostapd_data * hostapd_get_iface(struct hapd_interfaces *interfaces,
487*325151a3SRui Paulo 					const char *ifname);
488*325151a3SRui Paulo 
489*325151a3SRui Paulo #ifdef CONFIG_FST
490*325151a3SRui Paulo void fst_hostapd_fill_iface_obj(struct hostapd_data *hapd,
491*325151a3SRui Paulo 				struct fst_wpa_obj *iface_obj);
492*325151a3SRui Paulo #endif /* CONFIG_FST */
493*325151a3SRui Paulo 
494e28a4053SRui Paulo #endif /* HOSTAPD_H */
495