hostapd.h revision 849734c8d1847920ed7042463f7480b1e0c1dfea
18d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/*
28d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * hostapd / Initialization and configuration
36c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt * Copyright (c) 2002-2014, Jouni Malinen <j@w1.fi>
48d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
5c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * This software may be distributed under the terms of the BSD license.
6c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * See README for more details.
78d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
88d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
98d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifndef HOSTAPD_H
108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define HOSTAPD_H
118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "common/defs.h"
136c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt#include "utils/list.h"
14d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt#include "ap_config.h"
15fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt#include "drivers/driver.h"
168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wpa_ctrl_dst;
188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct radius_server_data;
198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct upnp_wps_device_sm;
208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct hostapd_data;
218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct sta_info;
228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct ieee80211_ht_capabilities;
238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct full_dynamic_vlan;
248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum wps_event;
258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtunion wps_event_data;
266c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt#ifdef CONFIG_MESH
276c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidtstruct mesh_conf;
286c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt#endif /* CONFIG_MESH */
298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3061d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtstruct hostapd_iface;
3161d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt
3204949598a23f501be6eec21697465fd46a28840aDmitry Shmidtstruct hapd_interfaces {
3361d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	int (*reload_config)(struct hostapd_iface *iface);
3461d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	struct hostapd_config * (*config_read_cb)(const char *config_fname);
3561d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	int (*ctrl_iface_init)(struct hostapd_data *hapd);
3661d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
3761d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	int (*for_each_interface)(struct hapd_interfaces *interfaces,
3861d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt				  int (*cb)(struct hostapd_iface *iface,
3961d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt					    void *ctx), void *ctx);
4061d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	int (*driver_init)(struct hostapd_iface *iface);
4161d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt
4204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	size_t count;
4361d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	int global_ctrl_sock;
4431a29cc7ed87b62465c7e01f03484f4643d12309Dmitry Shmidt	struct dl_list global_ctrl_dst;
4561d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	char *global_iface_path;
4661d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt	char *global_iface_name;
47fa3fc4a1ac08ad14272301c7f6f01b362997c3e4Dmitry Shmidt#ifndef CONFIG_NATIVE_WINDOWS
480ccb66edb8d2a0a397320ace3ec2a03fb0d00d5fDmitry Shmidt	gid_t ctrl_iface_group;
49fa3fc4a1ac08ad14272301c7f6f01b362997c3e4Dmitry Shmidt#endif /* CONFIG_NATIVE_WINDOWS */
5004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	struct hostapd_iface **iface;
51b96dad47218788efffa3db0fe7f1b54a7d19e366Dmitry Shmidt
52b96dad47218788efffa3db0fe7f1b54a7d19e366Dmitry Shmidt	size_t terminate_on_error;
53a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt#ifndef CONFIG_NO_VLAN
54a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt	struct dynamic_iface *vlan_priv;
55a3dc30964aa24aea2b518246f6812663a1103490Dmitry Shmidt#endif /* CONFIG_NO_VLAN */
5604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt};
5704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt
58b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidtenum hostapd_chan_status {
59b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	HOSTAPD_CHAN_VALID = 0, /* channel is ready */
60b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	HOSTAPD_CHAN_INVALID = 1, /* no usable channel found */
61b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	HOSTAPD_CHAN_ACS = 2, /* ACS work being performed */
62b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt};
6304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt
648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct hostapd_probereq_cb {
651f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid,
6604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt		  const u8 *ie, size_t ie_len, int ssi_signal);
678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void *ctx;
688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define HOSTAPD_RATE_BASIC 0x00000001
718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct hostapd_rate_data {
738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int rate; /* rate in 100 kbps */
748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int flags; /* HOSTAPD_RATE_ flags */
758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct hostapd_frame_info {
788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u32 channel;
798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u32 datarate;
8004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	int ssi_signal; /* dBm */
818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
83b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidtenum wps_status {
84b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	WPS_STATUS_SUCCESS = 1,
85b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	WPS_STATUS_FAILURE
86b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt};
87b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt
88b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidtenum pbc_status {
89b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	WPS_PBC_STATUS_DISABLE,
90b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	WPS_PBC_STATUS_ACTIVE,
91b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	WPS_PBC_STATUS_TIMEOUT,
92b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	WPS_PBC_STATUS_OVERLAP
93b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt};
94b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt
95b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidtstruct wps_stat {
96b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	enum wps_status status;
97b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	enum wps_error_indication failure_reason;
98b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	enum pbc_status pbc_status;
99b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	u8 peer_addr[ETH_ALEN];
100b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt};
101b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt
102849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidtstruct hostapd_neighbor_entry {
103849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidt	struct dl_list list;
104849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidt	u8 bssid[ETH_ALEN];
105849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidt	struct wpa_ssid_value ssid;
106849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidt	struct wpabuf *nr;
107849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidt	struct wpabuf *lci;
108849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidt	struct wpabuf *civic;
109849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidt	/* LCI update time */
110849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidt	struct os_time lci_date;
111849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidt};
1128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
1148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct hostapd_data - hostapd per-BSS data structure
1158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
1168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct hostapd_data {
1178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct hostapd_iface *iface;
1188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct hostapd_config *iconf;
1198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct hostapd_bss_config *conf;
1205460547a121207cf7a99eac45e05fcdd83be3161Dmitry Shmidt	int interface_added; /* virtual interface added for this BSS */
1215460547a121207cf7a99eac45e05fcdd83be3161Dmitry Shmidt	unsigned int started:1;
1227f65602d49069f96a7bb44da8bd79ffe8d4c6a98Dmitry Shmidt	unsigned int disabled:1;
1237f65602d49069f96a7bb44da8bd79ffe8d4c6a98Dmitry Shmidt	unsigned int reenable_beacon:1;
1248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u8 own_addr[ETH_ALEN];
1268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int num_sta; /* number of entries in sta_list */
1288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct sta_info *sta_list; /* STA info list head */
1298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define STA_HASH_SIZE 256
1308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define STA_HASH(sta) (sta[5])
1318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct sta_info *sta_hash[STA_HASH_SIZE];
1328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/*
1348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * Bitfield for indicating which AIDs are allocated. Only AID values
1358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * 1-2007 are used and as such, the bit at index 0 corresponds to AID
1368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * 1.
1378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 */
1388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define AID_WORDS ((2008 + 31) / 32)
1398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u32 sta_aid[AID_WORDS];
1408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const struct wpa_driver_ops *driver;
1428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void *drv_priv;
1438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void (*new_assoc_sta_cb)(struct hostapd_data *hapd,
1458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				 struct sta_info *sta, int reassoc);
1468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void *msg_ctx; /* ctx for wpa_msg() calls */
1481f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */
1498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct radius_client_data *radius;
151b97e428f8acf1ecb93f38f8d0063d2f2fd0bc36eDmitry Shmidt	u64 acct_session_id;
15204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	struct radius_das_data *radius_das;
1538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct iapp_data *iapp;
1558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct hostapd_cached_radius_acl *acl_cache;
1578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct hostapd_acl_query_data *acl_queries;
1588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpa_authenticator *wpa_auth;
1608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct eapol_authenticator *eapol_auth;
1618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct rsn_preauth_interface *preauth_iface;
163fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt	struct os_reltime michael_mic_failure;
1648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int michael_mic_failures;
1658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int tkip_countermeasures;
1668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int ctrl_sock;
16831a29cc7ed87b62465c7e01f03484f4643d12309Dmitry Shmidt	struct dl_list ctrl_dst;
1698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void *ssl_ctx;
1718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void *eap_sim_db_priv;
1728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct radius_server_data *radius_srv;
1736c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	struct dl_list erp_keys; /* struct eap_server_erp_key */
1748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int parameter_set_count;
1768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1771f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	/* Time Advertisement */
1781f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	u8 time_update_counter;
1791f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	struct wpabuf *time_adv;
1801f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt
1818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef CONFIG_FULL_DYNAMIC_VLAN
1828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct full_dynamic_vlan *full_dynamic_vlan;
1838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* CONFIG_FULL_DYNAMIC_VLAN */
1848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct l2_packet_data *l2;
1868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wps_context *wps;
1878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1881f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	int beacon_set_done;
1898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpabuf *wps_beacon_ie;
1908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpabuf *wps_probe_resp_ie;
1918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef CONFIG_WPS
1928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int ap_pin_failures;
193c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt	unsigned int ap_pin_failures_consecutive;
1948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct upnp_wps_device_sm *wps_upnp;
1958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	unsigned int ap_pin_lockout_time;
196b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt
197b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	struct wps_stat wps_stats;
1988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* CONFIG_WPS */
1998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct hostapd_probereq_cb *probereq_cb;
2018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t num_probereq_cb;
2028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
2048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				 int freq);
2058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void *public_action_cb_ctx;
2064b9d52f502481b258fec743c03a5e957e5605afcDmitry Shmidt	void (*public_action_cb2)(void *ctx, const u8 *buf, size_t len,
2074b9d52f502481b258fec743c03a5e957e5605afcDmitry Shmidt				  int freq);
2084b9d52f502481b258fec743c03a5e957e5605afcDmitry Shmidt	void *public_action_cb2_ctx;
2098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int (*vendor_action_cb)(void *ctx, const u8 *buf, size_t len,
2118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				int freq);
2128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void *vendor_action_cb_ctx;
2138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
2158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				   const u8 *uuid_e);
2168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void *wps_reg_success_cb_ctx;
2178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void (*wps_event_cb)(void *ctx, enum wps_event event,
2198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			     union wps_event_data *data);
2208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void *wps_event_cb_ctx;
2218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr,
2231f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt				  int authorized, const u8 *p2p_dev_addr);
2248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void *sta_authorized_cb_ctx;
2258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void (*setup_complete_cb)(void *ctx);
2278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void *setup_complete_cb_ctx;
2288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
229391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt	void (*new_psk_cb)(void *ctx, const u8 *mac_addr,
230391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt			   const u8 *p2p_dev_addr, const u8 *psk,
231391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt			   size_t psk_len);
232391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt	void *new_psk_cb_ctx;
233391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt
234d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt	/* channel switch parameters */
235d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt	struct hostapd_freq_params cs_freq_params;
236d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt	u8 cs_count;
237d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt	int cs_block_tx;
238d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt	unsigned int cs_c_off_beacon;
239d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt	unsigned int cs_c_off_proberesp;
240d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt	int csa_in_progress;
241d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	unsigned int cs_c_off_ecsa_beacon;
242d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	unsigned int cs_c_off_ecsa_proberesp;
243d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt
2446c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	/* BSS Load */
2456c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	unsigned int bss_load_update_timeout;
2466c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt
2478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef CONFIG_P2P
2488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct p2p_data *p2p;
2498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct p2p_group *p2p_group;
2508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpabuf *p2p_beacon_ie;
2518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct wpabuf *p2p_probe_resp_ie;
2528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* Number of non-P2P association stations */
2548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int num_sta_no_p2p;
2558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* Periodic NoA (used only when no non-P2P clients in the group) */
2578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int noa_enabled;
2588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int noa_start;
2598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int noa_duration;
2608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* CONFIG_P2P */
26104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#ifdef CONFIG_INTERWORKING
26204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	size_t gas_frag_limit;
26304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#endif /* CONFIG_INTERWORKING */
2646c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt#ifdef CONFIG_PROXYARP
2656c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	struct l2_packet_data *sock_dhcp;
2666c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	struct l2_packet_data *sock_ndisc;
2676c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt#endif /* CONFIG_PROXYARP */
2686c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt#ifdef CONFIG_MESH
2696c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	int num_plinks;
2706c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	int max_plinks;
271b97e428f8acf1ecb93f38f8d0063d2f2fd0bc36eDmitry Shmidt	void (*mesh_sta_free_cb)(struct hostapd_data *hapd,
272b97e428f8acf1ecb93f38f8d0063d2f2fd0bc36eDmitry Shmidt				 struct sta_info *sta);
2736c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	struct wpabuf *mesh_pending_auth;
2746c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	struct os_reltime mesh_pending_auth_time;
275e4663044d3a689fb5458247e9bc0f8b58cf72fcaDmitry Shmidt	u8 mesh_required_peer[ETH_ALEN];
2766c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt#endif /* CONFIG_MESH */
277d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt
278d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt#ifdef CONFIG_SQLITE
279d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt	struct hostapd_eap_user tmp_eap_user;
280d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt#endif /* CONFIG_SQLITE */
281a54fa5fb807eaeff45464139b5a7759f060cec68Dmitry Shmidt
282a54fa5fb807eaeff45464139b5a7759f060cec68Dmitry Shmidt#ifdef CONFIG_SAE
283a54fa5fb807eaeff45464139b5a7759f060cec68Dmitry Shmidt	/** Key used for generating SAE anti-clogging tokens */
284a54fa5fb807eaeff45464139b5a7759f060cec68Dmitry Shmidt	u8 sae_token_key[8];
28504f534e89ed127da4077485376f24debc50d80d5Dmitry Shmidt	struct os_reltime last_sae_token_key_update;
286d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	int dot11RSNASAERetransPeriod; /* msec */
287a54fa5fb807eaeff45464139b5a7759f060cec68Dmitry Shmidt#endif /* CONFIG_SAE */
288fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt
289fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt#ifdef CONFIG_TESTING_OPTIONS
2906c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	unsigned int ext_mgmt_frame_handling:1;
2916c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	unsigned int ext_eapol_frame_io:1;
2926c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt
2936c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	struct l2_packet_data *l2_test;
294fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt#endif /* CONFIG_TESTING_OPTIONS */
29557c2d39d85825f38c5fdac9b73bb0088406ffc85Dmitry Shmidt
29657c2d39d85825f38c5fdac9b73bb0088406ffc85Dmitry Shmidt#ifdef CONFIG_MBO
29757c2d39d85825f38c5fdac9b73bb0088406ffc85Dmitry Shmidt	unsigned int mbo_assoc_disallow;
29857c2d39d85825f38c5fdac9b73bb0088406ffc85Dmitry Shmidt#endif /* CONFIG_MBO */
299849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidt
300849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidt	struct dl_list nr_db;
301849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidt
302849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidt	u8 lci_req_token;
303849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidt	u8 range_req_token;
304849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidt	unsigned int lci_req_active:1;
305849734c8d1847920ed7042463f7480b1e0c1dfeaDmitry Shmidt	unsigned int range_req_active:1;
3068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
3078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
309d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidtstruct hostapd_sta_info {
310d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	struct dl_list list;
311d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	u8 addr[ETH_ALEN];
312d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	struct os_reltime last_seen;
313d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt};
314d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt
3158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
3168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * struct hostapd_iface - hostapd per-interface data structure
3178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
3188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct hostapd_iface {
3198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct hapd_interfaces *interfaces;
3208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void *owner;
3218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	char *config_fname;
3228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct hostapd_config *conf;
323cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt	char phy[16]; /* Name of the PHY (radio) */
324cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt
325cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt	enum hostapd_iface_state {
326cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt		HAPD_IFACE_UNINITIALIZED,
327cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt		HAPD_IFACE_DISABLED,
328cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt		HAPD_IFACE_COUNTRY_UPDATE,
329cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt		HAPD_IFACE_ACS,
330cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt		HAPD_IFACE_HT_SCAN,
331cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt		HAPD_IFACE_DFS,
332cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt		HAPD_IFACE_ENABLED
333cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt	} state;
3348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3356c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt#ifdef CONFIG_MESH
3366c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	struct mesh_conf *mconf;
3376c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt#endif /* CONFIG_MESH */
3386c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt
3398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	size_t num_bss;
3408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct hostapd_data **bss;
3418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
342cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt	unsigned int wait_channel_update:1;
343cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt	unsigned int cac_started:1;
344d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt#ifdef CONFIG_FST
345d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	struct fst_iface *fst;
346d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	const struct wpabuf *fst_ies;
347d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt#endif /* CONFIG_FST */
348cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt
349a38abf9af7bec7e89dbfb39ac7bb77223fe47c72Dmitry Shmidt	/*
350a38abf9af7bec7e89dbfb39ac7bb77223fe47c72Dmitry Shmidt	 * When set, indicates that the driver will handle the AP
351a38abf9af7bec7e89dbfb39ac7bb77223fe47c72Dmitry Shmidt	 * teardown: delete global keys, station keys, and stations.
352a38abf9af7bec7e89dbfb39ac7bb77223fe47c72Dmitry Shmidt	 */
353a38abf9af7bec7e89dbfb39ac7bb77223fe47c72Dmitry Shmidt	unsigned int driver_ap_teardown:1;
354a38abf9af7bec7e89dbfb39ac7bb77223fe47c72Dmitry Shmidt
355d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	/*
356d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	 * When set, indicates that this interface is part of list of
357d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	 * interfaces that need to be started together (synchronously).
358d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	 */
359d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	unsigned int need_to_start_in_sync:1;
360d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt
361d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	/* Ready to start but waiting for other interfaces to become ready. */
362d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	unsigned int ready_to_start_in_sync:1;
363d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt
3648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int num_ap; /* number of entries in ap_list */
3658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct ap_info *ap_list; /* AP info list head */
3668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct ap_info *ap_hash[STA_HASH_SIZE];
3678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3686c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	u64 drv_flags;
3696c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt
3706c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	/* SMPS modes supported by the driver (WPA_DRIVER_SMPS_MODE_*) */
3716c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	unsigned int smps_modes;
3721f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt
3731f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	/*
3741f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 * A bitmap of supported protocols for probe response offload. See
3751f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 * struct wpa_driver_capa in driver.h
3761f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	 */
3771f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	unsigned int probe_resp_offloads;
3781f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt
379444d567b27731d8572ef37697dd12fd1c37c2f24Dmitry Shmidt	/* extended capabilities supported by the driver */
380444d567b27731d8572ef37697dd12fd1c37c2f24Dmitry Shmidt	const u8 *extended_capa, *extended_capa_mask;
381444d567b27731d8572ef37697dd12fd1c37c2f24Dmitry Shmidt	unsigned int extended_capa_len;
382444d567b27731d8572ef37697dd12fd1c37c2f24Dmitry Shmidt
3838bae4138a0356709720a96f3e50b4d734e532c12Dmitry Shmidt	unsigned int drv_max_acl_mac_addrs;
3848bae4138a0356709720a96f3e50b4d734e532c12Dmitry Shmidt
3858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct hostapd_hw_modes *hw_features;
3868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int num_hw_features;
3878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct hostapd_hw_modes *current_mode;
3888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* Rates that are currently used (i.e., filtered copy of
3898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * current_mode->channels */
3908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int num_rates;
3918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct hostapd_rate_data *current_rates;
3921f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	int *basic_rates;
3938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int freq;
3948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u16 hw_flags;
3968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* Number of associated Non-ERP stations (i.e., stations using 802.11b
3988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	 * in 802.11g BSS) */
3998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int num_sta_non_erp;
4008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* Number of associated stations that do not support Short Slot Time */
4028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int num_sta_no_short_slot_time;
4038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* Number of associated stations that do not support Short Preamble */
4058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int num_sta_no_short_preamble;
4068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int olbc; /* Overlapping Legacy BSS Condition */
4088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* Number of HT associated stations that do not support greenfield */
4108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int num_sta_ht_no_gf;
4118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* Number of associated non-HT stations */
4138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int num_sta_no_ht;
4148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* Number of HT associated stations 20 MHz */
4168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int num_sta_ht_20mhz;
4178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4187832adbbd72a1b784b7fb74a71a5d4085b0cb0d3Dmitry Shmidt	/* Number of HT40 intolerant stations */
4197832adbbd72a1b784b7fb74a71a5d4085b0cb0d3Dmitry Shmidt	int num_sta_ht40_intolerant;
4207832adbbd72a1b784b7fb74a71a5d4085b0cb0d3Dmitry Shmidt
4218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	/* Overlapping BSS information */
4228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	int olbc_ht;
4238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	u16 ht_op_mode;
425b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt
426b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	/* surveying helpers */
427b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt
428b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	/* number of channels surveyed */
429b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	unsigned int chans_surveyed;
430b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt
431b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	/* lowest observed noise floor in dBm */
432b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	s8 lowest_nf;
433b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt
4346c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	/* channel utilization calculation */
4356c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	u64 last_channel_time;
4366c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	u64 last_channel_time_busy;
4376c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt	u8 channel_utilization;
4386c0da2bb83f6915d8260912362692d1a742e057bDmitry Shmidt
439d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	/* eCSA IE will be added only if operating class is specified */
440d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	u8 cs_oper_class;
441d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt
442df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidt	unsigned int dfs_cac_ms;
443df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidt	struct os_reltime dfs_cac_start;
444df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidt
4457832adbbd72a1b784b7fb74a71a5d4085b0cb0d3Dmitry Shmidt	/* Latched with the actual secondary channel information and will be
4467832adbbd72a1b784b7fb74a71a5d4085b0cb0d3Dmitry Shmidt	 * used while juggling between HT20 and HT40 modes. */
4477832adbbd72a1b784b7fb74a71a5d4085b0cb0d3Dmitry Shmidt	int secondary_ch;
4487832adbbd72a1b784b7fb74a71a5d4085b0cb0d3Dmitry Shmidt
449391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt#ifdef CONFIG_ACS
450391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt	unsigned int acs_num_completed_scans;
451391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt#endif /* CONFIG_ACS */
452391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt
4538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	void (*scan_cb)(struct hostapd_iface *iface);
4547832adbbd72a1b784b7fb74a71a5d4085b0cb0d3Dmitry Shmidt	int num_ht40_scan_tries;
455d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt
456d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	struct dl_list sta_seen; /* struct hostapd_sta_info */
457d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt	unsigned int num_sta_seen;
4588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt};
4598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* hostapd.c */
46104949598a23f501be6eec21697465fd46a28840aDmitry Shmidtint hostapd_for_each_interface(struct hapd_interfaces *interfaces,
46204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt			       int (*cb)(struct hostapd_iface *iface,
46304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt					 void *ctx), void *ctx);
4648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_reload_config(struct hostapd_iface *iface);
4658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct hostapd_data *
4668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidthostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
4678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		       struct hostapd_config *conf,
4688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		       struct hostapd_bss_config *bss);
4698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_setup_interface(struct hostapd_iface *iface);
4708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
4718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid hostapd_interface_deinit(struct hostapd_iface *iface);
4728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid hostapd_interface_free(struct hostapd_iface *iface);
473cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidtstruct hostapd_iface * hostapd_init(struct hapd_interfaces *interfaces,
474cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt				    const char *config_file);
475cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidtstruct hostapd_iface *
476cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidthostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy,
477cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt			   const char *config_fname, int debug);
4788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
4798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			   int reassoc);
48061d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtvoid hostapd_interface_deinit_free(struct hostapd_iface *iface);
48161d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint hostapd_enable_iface(struct hostapd_iface *hapd_iface);
48261d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint hostapd_reload_iface(struct hostapd_iface *hapd_iface);
48361d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint hostapd_disable_iface(struct hostapd_iface *hapd_iface);
48461d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint hostapd_add_iface(struct hapd_interfaces *ifaces, char *buf);
48561d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf);
486e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidtvoid hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator);
487cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidtvoid hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s);
488cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidtconst char * hostapd_state_text(enum hostapd_iface_state s);
489d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidtint hostapd_csa_in_progress(struct hostapd_iface *iface);
490e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidtint hostapd_switch_channel(struct hostapd_data *hapd,
491e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt			   struct csa_settings *settings);
492d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidtvoid
493d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidthostapd_switch_channel_fallback(struct hostapd_iface *iface,
494d30ac604c9f6da71a0dd7f46d25be05a2a62cfbbDmitry Shmidt				const struct hostapd_freq_params *freq_params);
495e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidtvoid hostapd_cleanup_cs_params(struct hostapd_data *hapd);
496d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidtvoid hostapd_periodic_iface(struct hostapd_iface *iface);
4978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
4988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* utils.c */
4998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_register_probereq_cb(struct hostapd_data *hapd,
5008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				 int (*cb)(void *ctx, const u8 *sa,
5011f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt					   const u8 *da, const u8 *bssid,
50204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt					   const u8 *ie, size_t ie_len,
50304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt					   int ssi_signal),
5048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				 void *ctx);
5058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
5068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
5078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* drv_callbacks.c (TODO: move to somewhere else?) */
5088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
5098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			const u8 *ie, size_t ielen, int reassoc);
5108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
5118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr);
512f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidtvoid hostapd_event_connect_failed_reason(struct hostapd_data *hapd,
513f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt					 const u8 *addr, int reason_code);
5141f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
51504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt			 const u8 *bssid, const u8 *ie, size_t ie_len,
51604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt			 int ssi_signal);
51704949598a23f501be6eec21697465fd46a28840aDmitry Shmidtvoid hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
51804f534e89ed127da4077485376f24debc50d80d5Dmitry Shmidt			     int offset, int width, int cf1, int cf2);
519014a3ff83915745d57480e99b47e281a82143c79Dmitry Shmidtstruct survey_results;
520014a3ff83915745d57480e99b47e281a82143c79Dmitry Shmidtvoid hostapd_event_get_survey(struct hostapd_iface *iface,
521014a3ff83915745d57480e99b47e281a82143c79Dmitry Shmidt			      struct survey_results *survey_results);
522014a3ff83915745d57480e99b47e281a82143c79Dmitry Shmidtvoid hostapd_acs_channel_selected(struct hostapd_data *hapd,
523014a3ff83915745d57480e99b47e281a82143c79Dmitry Shmidt				  struct acs_selected_channels *acs_res);
5248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
525d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidtconst struct hostapd_eap_user *
526d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidthostapd_get_eap_user(struct hostapd_data *hapd, const u8 *identity,
527d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt		     size_t identity_len, int phase2);
528d5e4923d04122f81300fa68fb07d64ede28fd44dDmitry Shmidt
529d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidtstruct hostapd_data * hostapd_get_iface(struct hapd_interfaces *interfaces,
530d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt					const char *ifname);
531d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt
532d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt#ifdef CONFIG_FST
533d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidtvoid fst_hostapd_fill_iface_obj(struct hostapd_data *hapd,
534d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt				struct fst_wpa_obj *iface_obj);
535d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt#endif /* CONFIG_FST */
536d80a401aed31d06f261efd19223cf55d1a2a8228Dmitry Shmidt
5378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* HOSTAPD_H */
538