hostapd.h revision 351611
1119418Sobrien/* 269953Smsmith * hostapd / Initialization and configuration 369953Smsmith * Copyright (c) 2002-2014, Jouni Malinen <j@w1.fi> 469953Smsmith * 569953Smsmith * This software may be distributed under the terms of the BSD license. 669953Smsmith * See README for more details. 769953Smsmith */ 869953Smsmith 969953Smsmith#ifndef HOSTAPD_H 1069953Smsmith#define HOSTAPD_H 1169953Smsmith 1269953Smsmith#ifdef CONFIG_SQLITE 1369953Smsmith#include <sqlite3.h> 1469953Smsmith#endif /* CONFIG_SQLITE */ 1569953Smsmith 1669953Smsmith#include "common/defs.h" 1769953Smsmith#include "utils/list.h" 1869953Smsmith#include "ap_config.h" 1969953Smsmith#include "drivers/driver.h" 2069953Smsmith 2169953Smsmith#define OCE_STA_CFON_ENABLED(hapd) \ 2269953Smsmith ((hapd->conf->oce & OCE_STA_CFON) && \ 2369953Smsmith (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_OCE_STA_CFON)) 2469953Smsmith#define OCE_AP_ENABLED(hapd) \ 2569953Smsmith ((hapd->conf->oce & OCE_AP) && \ 2669953Smsmith (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_OCE_AP)) 27119418Sobrien 28119418Sobrienstruct wpa_ctrl_dst; 29119418Sobrienstruct radius_server_data; 3069953Smsmithstruct upnp_wps_device_sm; 31149478Spsstruct hostapd_data; 3269953Smsmithstruct sta_info; 3369953Smsmithstruct ieee80211_ht_capabilities; 3469953Smsmithstruct full_dynamic_vlan; 3569953Smsmithenum wps_event; 3669953Smsmithunion wps_event_data; 3769953Smsmith#ifdef CONFIG_MESH 3869953Smsmithstruct mesh_conf; 3969953Smsmith#endif /* CONFIG_MESH */ 4069953Smsmith 4183975Srwatsonstruct hostapd_iface; 4269953Smsmith 4369953Smsmithstruct hapd_interfaces { 4469953Smsmith int (*reload_config)(struct hostapd_iface *iface); 4569953Smsmith struct hostapd_config * (*config_read_cb)(const char *config_fname); 4669953Smsmith int (*ctrl_iface_init)(struct hostapd_data *hapd); 4769953Smsmith void (*ctrl_iface_deinit)(struct hostapd_data *hapd); 4869953Smsmith int (*for_each_interface)(struct hapd_interfaces *interfaces, 4969953Smsmith int (*cb)(struct hostapd_iface *iface, 5069953Smsmith void *ctx), void *ctx); 5169953Smsmith int (*driver_init)(struct hostapd_iface *iface); 5269953Smsmith 5369953Smsmith size_t count; 5469953Smsmith int global_ctrl_sock; 55119285Simp struct dl_list global_ctrl_dst; 56119285Simp char *global_iface_path; 5769953Smsmith char *global_iface_name; 5869953Smsmith#ifndef CONFIG_NATIVE_WINDOWS 5969953Smsmith gid_t ctrl_iface_group; 6069953Smsmith#endif /* CONFIG_NATIVE_WINDOWS */ 6169953Smsmith struct hostapd_iface **iface; 6269953Smsmith 6369953Smsmith size_t terminate_on_error; 6469953Smsmith#ifndef CONFIG_NO_VLAN 6583366Sjulian struct dynamic_iface *vlan_priv; 6683366Sjulian#endif /* CONFIG_NO_VLAN */ 6769953Smsmith#ifdef CONFIG_ETH_P_OUI 6869953Smsmith struct dl_list eth_p_oui; /* OUI Extended EtherType handlers */ 6983366Sjulian#endif /* CONFIG_ETH_P_OUI */ 7069953Smsmith int eloop_initialized; 7169953Smsmith 72126080Sphk#ifdef CONFIG_DPP 73126080Sphk struct dpp_global *dpp; 74111815Sphk#endif /* CONFIG_DPP */ 75111815Sphk}; 76111815Sphk 77111815Sphkenum hostapd_chan_status { 7869953Smsmith HOSTAPD_CHAN_VALID = 0, /* channel is ready */ 7969953Smsmith HOSTAPD_CHAN_INVALID = 1, /* no usable channel found */ 8069953Smsmith HOSTAPD_CHAN_ACS = 2, /* ACS work being performed */ 81130585Sphk}; 8269953Smsmith 8383975Srwatsonstruct hostapd_probereq_cb { 8483975Srwatson int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid, 8583975Srwatson const u8 *ie, size_t ie_len, int ssi_signal); 8691406Sjhb void *ctx; 8783975Srwatson}; 8883975Srwatson 8969953Smsmith#define HOSTAPD_RATE_BASIC 0x00000001 9083975Srwatson 9183975Srwatsonstruct hostapd_rate_data { 9269953Smsmith int rate; /* rate in 100 kbps */ 9369953Smsmith int flags; /* HOSTAPD_RATE_ flags */ 9469953Smsmith}; 95130585Sphk 9669953Smsmithstruct hostapd_frame_info { 9769953Smsmith unsigned int freq; 9869953Smsmith u32 channel; 9969953Smsmith u32 datarate; 10069953Smsmith int ssi_signal; /* dBm */ 10169953Smsmith}; 10269953Smsmith 10369953Smsmithenum wps_status { 10469953Smsmith WPS_STATUS_SUCCESS = 1, 10569953Smsmith WPS_STATUS_FAILURE 10669953Smsmith}; 10769953Smsmith 10869953Smsmithenum pbc_status { 10969953Smsmith WPS_PBC_STATUS_DISABLE, 11069953Smsmith WPS_PBC_STATUS_ACTIVE, 11169953Smsmith WPS_PBC_STATUS_TIMEOUT, 11269953Smsmith WPS_PBC_STATUS_OVERLAP 11369953Smsmith}; 11469953Smsmith 11569953Smsmithstruct wps_stat { 11669953Smsmith enum wps_status status; 11769953Smsmith enum wps_error_indication failure_reason; 11869953Smsmith enum pbc_status pbc_status; 11969953Smsmith u8 peer_addr[ETH_ALEN]; 12069953Smsmith}; 12169953Smsmith 12269953Smsmithstruct hostapd_neighbor_entry { 12369953Smsmith struct dl_list list; 12469953Smsmith u8 bssid[ETH_ALEN]; 12569953Smsmith struct wpa_ssid_value ssid; 12669953Smsmith struct wpabuf *nr; 12769953Smsmith struct wpabuf *lci; 128172394Smarius struct wpabuf *civic; 129172394Smarius /* LCI update time */ 130172394Smarius struct os_time lci_date; 131172394Smarius int stationary; 132172394Smarius}; 13369953Smsmith 13469953Smsmithstruct hostapd_sae_commit_queue { 13569953Smsmith struct dl_list list; 13669953Smsmith int rssi; 13769953Smsmith size_t len; 13869953Smsmith u8 msg[]; 13969953Smsmith}; 14069953Smsmith 14169953Smsmith/** 14269953Smsmith * struct hostapd_data - hostapd per-BSS data structure 14369953Smsmith */ 14469953Smsmithstruct hostapd_data { 14569953Smsmith struct hostapd_iface *iface; 14669953Smsmith struct hostapd_config *iconf; 14769953Smsmith struct hostapd_bss_config *conf; 14869953Smsmith int interface_added; /* virtual interface added for this BSS */ 14969953Smsmith unsigned int started:1; 15069953Smsmith unsigned int disabled:1; 15169953Smsmith unsigned int reenable_beacon:1; 15269953Smsmith 15369953Smsmith u8 own_addr[ETH_ALEN]; 15469953Smsmith 15569953Smsmith int num_sta; /* number of entries in sta_list */ 15669953Smsmith struct sta_info *sta_list; /* STA info list head */ 15769953Smsmith#define STA_HASH_SIZE 256 15869953Smsmith#define STA_HASH(sta) (sta[5]) 15969953Smsmith struct sta_info *sta_hash[STA_HASH_SIZE]; 16069953Smsmith 16169953Smsmith /* 16269953Smsmith * Bitfield for indicating which AIDs are allocated. Only AID values 16369953Smsmith * 1-2007 are used and as such, the bit at index 0 corresponds to AID 16469953Smsmith * 1. 16569953Smsmith */ 16669953Smsmith#define AID_WORDS ((2008 + 31) / 32) 16769953Smsmith u32 sta_aid[AID_WORDS]; 16869953Smsmith 16969953Smsmith const struct wpa_driver_ops *driver; 17069953Smsmith void *drv_priv; 17169953Smsmith 172172932Smarius void (*new_assoc_sta_cb)(struct hostapd_data *hapd, 173172932Smarius struct sta_info *sta, int reassoc); 174172999Simp 175172932Smarius void *msg_ctx; /* ctx for wpa_msg() calls */ 176172932Smarius void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */ 177172932Smarius 178172932Smarius struct radius_client_data *radius; 179172932Smarius u64 acct_session_id; 180172932Smarius struct radius_das_data *radius_das; 181172932Smarius 182172932Smarius struct iapp_data *iapp; 183172932Smarius 184172932Smarius struct hostapd_cached_radius_acl *acl_cache; 185172932Smarius struct hostapd_acl_query_data *acl_queries; 186172932Smarius 187172932Smarius struct wpa_authenticator *wpa_auth; 188172932Smarius struct eapol_authenticator *eapol_auth; 189172932Smarius 190172932Smarius struct rsn_preauth_interface *preauth_iface; 191172932Smarius struct os_reltime michael_mic_failure; 192172932Smarius int michael_mic_failures; 193172932Smarius int tkip_countermeasures; 194172932Smarius 195172932Smarius int ctrl_sock; 196172932Smarius struct dl_list ctrl_dst; 197172932Smarius 198172932Smarius void *ssl_ctx; 199172932Smarius void *eap_sim_db_priv; 200172932Smarius struct radius_server_data *radius_srv; 201172932Smarius struct dl_list erp_keys; /* struct eap_server_erp_key */ 202172932Smarius 203172932Smarius int parameter_set_count; 204172932Smarius 205172932Smarius /* Time Advertisement */ 206172932Smarius u8 time_update_counter; 207172932Smarius struct wpabuf *time_adv; 208172932Smarius 209172932Smarius#ifdef CONFIG_FULL_DYNAMIC_VLAN 210172932Smarius struct full_dynamic_vlan *full_dynamic_vlan; 211172932Smarius#endif /* CONFIG_FULL_DYNAMIC_VLAN */ 212172932Smarius 213172932Smarius struct l2_packet_data *l2; 214172932Smarius 215172932Smarius#ifdef CONFIG_IEEE80211R_AP 216172932Smarius struct dl_list l2_queue; 217172932Smarius struct dl_list l2_oui_queue; 218174932Smarius struct eth_p_oui_ctx *oui_pull; 219172932Smarius struct eth_p_oui_ctx *oui_resp; 220172932Smarius struct eth_p_oui_ctx *oui_push; 221172932Smarius struct eth_p_oui_ctx *oui_sreq; 222172932Smarius struct eth_p_oui_ctx *oui_sresp; 223172932Smarius#endif /* CONFIG_IEEE80211R_AP */ 224172932Smarius 225172932Smarius struct wps_context *wps; 226172932Smarius 227172932Smarius int beacon_set_done; 228172932Smarius struct wpabuf *wps_beacon_ie; 229172932Smarius struct wpabuf *wps_probe_resp_ie; 230172932Smarius#ifdef CONFIG_WPS 231172932Smarius unsigned int ap_pin_failures; 232172932Smarius unsigned int ap_pin_failures_consecutive; 233172932Smarius struct upnp_wps_device_sm *wps_upnp; 234172932Smarius unsigned int ap_pin_lockout_time; 23569953Smsmith 236172932Smarius struct wps_stat wps_stats; 237172932Smarius#endif /* CONFIG_WPS */ 238172932Smarius 239172932Smarius#ifdef CONFIG_MACSEC 240172932Smarius struct ieee802_1x_kay *kay; 241172932Smarius#endif /* CONFIG_MACSEC */ 242172932Smarius 243172932Smarius struct hostapd_probereq_cb *probereq_cb; 244172932Smarius size_t num_probereq_cb; 245172932Smarius 246172932Smarius void (*public_action_cb)(void *ctx, const u8 *buf, size_t len, 247172932Smarius int freq); 248172932Smarius void *public_action_cb_ctx; 249172932Smarius void (*public_action_cb2)(void *ctx, const u8 *buf, size_t len, 250172932Smarius int freq); 251172932Smarius void *public_action_cb2_ctx; 252172932Smarius 253172932Smarius int (*vendor_action_cb)(void *ctx, const u8 *buf, size_t len, 254172932Smarius int freq); 255172932Smarius void *vendor_action_cb_ctx; 256172932Smarius 257172932Smarius void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr, 258172932Smarius const u8 *uuid_e); 259172932Smarius void *wps_reg_success_cb_ctx; 260172932Smarius 261172932Smarius void (*wps_event_cb)(void *ctx, enum wps_event event, 262172932Smarius union wps_event_data *data); 263172932Smarius void *wps_event_cb_ctx; 264172932Smarius 265172932Smarius void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr, 266172932Smarius int authorized, const u8 *p2p_dev_addr); 267172932Smarius void *sta_authorized_cb_ctx; 268172932Smarius 269172932Smarius void (*setup_complete_cb)(void *ctx); 270172932Smarius void *setup_complete_cb_ctx; 271172932Smarius 272172932Smarius void (*new_psk_cb)(void *ctx, const u8 *mac_addr, 273172932Smarius const u8 *p2p_dev_addr, const u8 *psk, 274172932Smarius size_t psk_len); 275172932Smarius void *new_psk_cb_ctx; 276172932Smarius 277172932Smarius /* channel switch parameters */ 278172932Smarius struct hostapd_freq_params cs_freq_params; 279172932Smarius u8 cs_count; 280172932Smarius int cs_block_tx; 281172932Smarius unsigned int cs_c_off_beacon; 282172932Smarius unsigned int cs_c_off_proberesp; 283172932Smarius int csa_in_progress; 284172932Smarius unsigned int cs_c_off_ecsa_beacon; 285172932Smarius unsigned int cs_c_off_ecsa_proberesp; 286172932Smarius 287172932Smarius#ifdef CONFIG_P2P 288172932Smarius struct p2p_data *p2p; 289172932Smarius struct p2p_group *p2p_group; 290172932Smarius struct wpabuf *p2p_beacon_ie; 291172932Smarius struct wpabuf *p2p_probe_resp_ie; 292172932Smarius 293172932Smarius /* Number of non-P2P association stations */ 294172932Smarius int num_sta_no_p2p; 295172932Smarius 296172932Smarius /* Periodic NoA (used only when no non-P2P clients in the group) */ 297172932Smarius int noa_enabled; 298172932Smarius int noa_start; 299172932Smarius int noa_duration; 300172932Smarius#endif /* CONFIG_P2P */ 301130585Sphk#ifdef CONFIG_PROXYARP 30269953Smsmith struct l2_packet_data *sock_dhcp; 303172932Smarius struct l2_packet_data *sock_ndisc; 304172932Smarius#endif /* CONFIG_PROXYARP */ 305172932Smarius#ifdef CONFIG_MESH 306172932Smarius int num_plinks; 307172932Smarius int max_plinks; 308172932Smarius void (*mesh_sta_free_cb)(struct hostapd_data *hapd, 30969953Smsmith struct sta_info *sta); 310188018Sjhb struct wpabuf *mesh_pending_auth; 311172932Smarius struct os_reltime mesh_pending_auth_time; 312188018Sjhb u8 mesh_required_peer[ETH_ALEN]; 313188018Sjhb#endif /* CONFIG_MESH */ 314172932Smarius 315172932Smarius#ifdef CONFIG_SQLITE 316172999Simp struct hostapd_eap_user tmp_eap_user; 317172932Smarius#endif /* CONFIG_SQLITE */ 318172932Smarius 319172932Smarius#ifdef CONFIG_SAE 320172932Smarius /** Key used for generating SAE anti-clogging tokens */ 32169953Smsmith u8 sae_token_key[8]; 322172932Smarius struct os_reltime last_sae_token_key_update; 323172932Smarius u16 sae_token_idx; 324172932Smarius u16 sae_pending_token_idx[256]; 325188018Sjhb int dot11RSNASAERetransPeriod; /* msec */ 326188018Sjhb struct dl_list sae_commit_queue; /* struct hostapd_sae_commit_queue */ 327172932Smarius#endif /* CONFIG_SAE */ 328172932Smarius 329188018Sjhb#ifdef CONFIG_TESTING_OPTIONS 33069953Smsmith unsigned int ext_mgmt_frame_handling:1; 331172932Smarius unsigned int ext_eapol_frame_io:1; 33269953Smsmith 33369953Smsmith struct l2_packet_data *l2_test; 334172999Simp 335172932Smarius enum wpa_alg last_gtk_alg; 336172932Smarius int last_gtk_key_idx; 337172932Smarius u8 last_gtk[WPA_GTK_MAX_LEN]; 33869953Smsmith size_t last_gtk_len; 33969953Smsmith 34069953Smsmith#ifdef CONFIG_IEEE80211W 341172932Smarius enum wpa_alg last_igtk_alg; 34269953Smsmith int last_igtk_key_idx; 34369953Smsmith u8 last_igtk[WPA_IGTK_MAX_LEN]; 34469953Smsmith size_t last_igtk_len; 345172932Smarius#endif /* CONFIG_IEEE80211W */ 346172932Smarius#endif /* CONFIG_TESTING_OPTIONS */ 34769953Smsmith 34869953Smsmith#ifdef CONFIG_MBO 34969953Smsmith unsigned int mbo_assoc_disallow; 35069953Smsmith#endif /* CONFIG_MBO */ 35169953Smsmith 35269953Smsmith struct dl_list nr_db; 35369953Smsmith 35469953Smsmith u8 beacon_req_token; 35569953Smsmith u8 lci_req_token; 35669953Smsmith u8 range_req_token; 35769953Smsmith unsigned int lci_req_active:1; 35869953Smsmith unsigned int range_req_active:1; 35969953Smsmith 36069953Smsmith int dhcp_sock; /* UDP socket used with the DHCP server */ 36169953Smsmith 36269953Smsmith#ifdef CONFIG_DPP 36369953Smsmith int dpp_init_done; 36469953Smsmith struct dpp_authentication *dpp_auth; 36569953Smsmith u8 dpp_allowed_roles; 36669953Smsmith int dpp_qr_mutual; 36769953Smsmith int dpp_auth_ok_on_ack; 36869953Smsmith int dpp_in_response_listen; 36969953Smsmith struct gas_query_ap *gas; 37069953Smsmith struct dpp_pkex *dpp_pkex; 37169953Smsmith struct dpp_bootstrap_info *dpp_pkex_bi; 37269953Smsmith char *dpp_pkex_code; 37369953Smsmith char *dpp_pkex_identifier; 37469953Smsmith char *dpp_pkex_auth_cmd; 37569953Smsmith char *dpp_configurator_params; 37669953Smsmith struct os_reltime dpp_last_init; 37769953Smsmith struct os_reltime dpp_init_iter_start; 37869953Smsmith unsigned int dpp_init_max_tries; 379172999Simp unsigned int dpp_init_retry_time; 380172932Smarius unsigned int dpp_resp_wait_time; 381172932Smarius unsigned int dpp_resp_max_tries; 382172932Smarius unsigned int dpp_resp_retry_time; 383172932Smarius#ifdef CONFIG_TESTING_OPTIONS 384172932Smarius char *dpp_config_obj_override; 385172932Smarius char *dpp_discovery_override; 386172932Smarius char *dpp_groups_override; 38769953Smsmith unsigned int dpp_ignore_netaccesskey_mismatch:1; 38869953Smsmith#endif /* CONFIG_TESTING_OPTIONS */ 38969953Smsmith#endif /* CONFIG_DPP */ 39069953Smsmith 39169953Smsmith#ifdef CONFIG_AIRTIME_POLICY 392172932Smarius unsigned int num_backlogged_sta; 39369953Smsmith unsigned int airtime_weight; 39469953Smsmith#endif /* CONFIG_AIRTIME_POLICY */ 39569953Smsmith 39669953Smsmith u8 last_1x_eapol_key_replay_counter[8]; 39769953Smsmith 398116704Sjmg#ifdef CONFIG_SQLITE 39969953Smsmith sqlite3 *rad_attr_db; 40069953Smsmith#endif /* CONFIG_SQLITE */ 40169953Smsmith}; 40269953Smsmith 40369953Smsmith 40469953Smsmithstruct hostapd_sta_info { 40569953Smsmith struct dl_list list; 40669953Smsmith u8 addr[ETH_ALEN]; 40769953Smsmith struct os_reltime last_seen; 40869953Smsmith int ssi_signal; 40969953Smsmith#ifdef CONFIG_TAXONOMY 41069953Smsmith struct wpabuf *probe_ie_taxonomy; 41169953Smsmith#endif /* CONFIG_TAXONOMY */ 41269953Smsmith}; 413172999Simp 414172932Smarius/** 415172932Smarius * struct hostapd_iface - hostapd per-interface data structure 416172932Smarius */ 417172932Smariusstruct hostapd_iface { 418172932Smarius struct hapd_interfaces *interfaces; 419172932Smarius void *owner; 420172932Smarius char *config_fname; 42169953Smsmith struct hostapd_config *conf; 42269953Smsmith char phy[16]; /* Name of the PHY (radio) */ 42369953Smsmith 42469953Smsmith enum hostapd_iface_state { 42569953Smsmith HAPD_IFACE_UNINITIALIZED, 42669953Smsmith HAPD_IFACE_DISABLED, 42769953Smsmith HAPD_IFACE_COUNTRY_UPDATE, 42869953Smsmith HAPD_IFACE_ACS, 429172999Simp HAPD_IFACE_HT_SCAN, 430172932Smarius HAPD_IFACE_DFS, 431172932Smarius HAPD_IFACE_ENABLED 432172932Smarius } state; 433172932Smarius 434172932Smarius#ifdef CONFIG_MESH 435172932Smarius struct mesh_conf *mconf; 436172932Smarius#endif /* CONFIG_MESH */ 437172932Smarius 438172932Smarius size_t num_bss; 439172932Smarius struct hostapd_data **bss; 440172932Smarius 441172932Smarius unsigned int wait_channel_update:1; 442172932Smarius unsigned int cac_started:1; 443116702Sjmg#ifdef CONFIG_FST 444116702Sjmg struct fst_iface *fst; 445116702Sjmg const struct wpabuf *fst_ies; 446116702Sjmg#endif /* CONFIG_FST */ 44769953Smsmith 44869953Smsmith /* 44969953Smsmith * When set, indicates that the driver will handle the AP 45069953Smsmith * teardown: delete global keys, station keys, and stations. 45169953Smsmith */ 45269953Smsmith unsigned int driver_ap_teardown:1; 45369953Smsmith 45469953Smsmith /* 45569953Smsmith * When set, indicates that this interface is part of list of 456172932Smarius * interfaces that need to be started together (synchronously). 45769953Smsmith */ 45869953Smsmith unsigned int need_to_start_in_sync:1; 45969953Smsmith 46069953Smsmith /* Ready to start but waiting for other interfaces to become ready. */ 46169953Smsmith unsigned int ready_to_start_in_sync:1; 46269953Smsmith 46369953Smsmith int num_ap; /* number of entries in ap_list */ 46469953Smsmith struct ap_info *ap_list; /* AP info list head */ 465116702Sjmg struct ap_info *ap_hash[STA_HASH_SIZE]; 46669953Smsmith 46769953Smsmith u64 drv_flags; 46869953Smsmith 46969953Smsmith /* SMPS modes supported by the driver (WPA_DRIVER_SMPS_MODE_*) */ 47069953Smsmith unsigned int smps_modes; 47169953Smsmith 47269953Smsmith /* 473175368Sjhb * A bitmap of supported protocols for probe response offload. See 47469953Smsmith * struct wpa_driver_capa in driver.h 47569953Smsmith */ 47669953Smsmith unsigned int probe_resp_offloads; 47769953Smsmith 47869953Smsmith /* extended capabilities supported by the driver */ 47969953Smsmith const u8 *extended_capa, *extended_capa_mask; 48069953Smsmith unsigned int extended_capa_len; 481175368Sjhb 482175368Sjhb unsigned int drv_max_acl_mac_addrs; 483175368Sjhb 48469953Smsmith struct hostapd_hw_modes *hw_features; 48569953Smsmith int num_hw_features; 486172999Simp struct hostapd_hw_modes *current_mode; 487172932Smarius /* Rates that are currently used (i.e., filtered copy of 488172932Smarius * current_mode->channels */ 489172932Smarius int num_rates; 490172932Smarius struct hostapd_rate_data *current_rates; 491172932Smarius int *basic_rates; 492172932Smarius int freq; 493172932Smarius 494172932Smarius u16 hw_flags; 495172932Smarius 496172932Smarius /* Number of associated Non-ERP stations (i.e., stations using 802.11b 497172932Smarius * in 802.11g BSS) */ 498172932Smarius int num_sta_non_erp; 499172932Smarius 50069953Smsmith /* Number of associated stations that do not support Short Slot Time */ 50169953Smsmith int num_sta_no_short_slot_time; 50269953Smsmith 50369953Smsmith /* Number of associated stations that do not support Short Preamble */ 50469953Smsmith int num_sta_no_short_preamble; 50569953Smsmith 50669953Smsmith int olbc; /* Overlapping Legacy BSS Condition */ 50769953Smsmith 50869953Smsmith /* Number of HT associated stations that do not support greenfield */ 50969953Smsmith int num_sta_ht_no_gf; 51069953Smsmith 511172999Simp /* Number of associated non-HT stations */ 512172932Smarius int num_sta_no_ht; 513172932Smarius 514172932Smarius /* Number of HT associated stations 20 MHz */ 515172932Smarius int num_sta_ht_20mhz; 516172932Smarius 517172932Smarius /* Number of HT40 intolerant stations */ 518172932Smarius int num_sta_ht40_intolerant; 519172932Smarius 520172932Smarius /* Overlapping BSS information */ 521172932Smarius int olbc_ht; 522172932Smarius 523172932Smarius u16 ht_op_mode; 524172932Smarius 525172932Smarius /* surveying helpers */ 526172932Smarius 527172932Smarius /* number of channels surveyed */ 528172932Smarius unsigned int chans_surveyed; 529172932Smarius 530172932Smarius /* lowest observed noise floor in dBm */ 531172932Smarius s8 lowest_nf; 532172932Smarius 533172932Smarius /* channel utilization calculation */ 534172932Smarius u64 last_channel_time; 535172932Smarius u64 last_channel_time_busy; 536174932Smarius u8 channel_utilization; 537174932Smarius 538174932Smarius unsigned int chan_util_samples_sum; 539174932Smarius unsigned int chan_util_num_sample_periods; 540174932Smarius unsigned int chan_util_average; 541174932Smarius 542172932Smarius /* eCSA IE will be added only if operating class is specified */ 543172932Smarius u8 cs_oper_class; 544172932Smarius 545172932Smarius unsigned int dfs_cac_ms; 546172932Smarius struct os_reltime dfs_cac_start; 547172932Smarius 548174932Smarius /* Latched with the actual secondary channel information and will be 549174932Smarius * used while juggling between HT20 and HT40 modes. */ 550116702Sjmg int secondary_ch; 55169953Smsmith 55269953Smsmith#ifdef CONFIG_ACS 55369953Smsmith unsigned int acs_num_completed_scans; 55469953Smsmith#endif /* CONFIG_ACS */ 55569953Smsmith 55669953Smsmith void (*scan_cb)(struct hostapd_iface *iface); 55769953Smsmith int num_ht40_scan_tries; 55869953Smsmith 55969953Smsmith struct dl_list sta_seen; /* struct hostapd_sta_info */ 56069953Smsmith unsigned int num_sta_seen; 56169953Smsmith 56269953Smsmith u8 dfs_domain; 56369953Smsmith#ifdef CONFIG_AIRTIME_POLICY 56469953Smsmith unsigned int airtime_quantum; 565172932Smarius#endif /* CONFIG_AIRTIME_POLICY */ 56669953Smsmith 56769953Smsmith /* Previous WMM element information */ 56869953Smsmith struct hostapd_wmm_ac_params prev_wmm[WMM_AC_NUM]; 56969953Smsmith}; 57069953Smsmith 57169953Smsmith/* hostapd.c */ 57269953Smsmithint hostapd_for_each_interface(struct hapd_interfaces *interfaces, 57369953Smsmith int (*cb)(struct hostapd_iface *iface, 57469953Smsmith void *ctx), void *ctx); 57569953Smsmithint hostapd_reload_config(struct hostapd_iface *iface); 57669953Smsmithvoid hostapd_reconfig_encryption(struct hostapd_data *hapd); 577116702Sjmgstruct hostapd_data * 57869953Smsmithhostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, 57969953Smsmith struct hostapd_config *conf, 580172999Simp struct hostapd_bss_config *bss); 581172932Smariusint hostapd_setup_interface(struct hostapd_iface *iface); 582172932Smariusint hostapd_setup_interface_complete(struct hostapd_iface *iface, int err); 583172932Smariusvoid hostapd_interface_deinit(struct hostapd_iface *iface); 58469953Smsmithvoid hostapd_interface_free(struct hostapd_iface *iface); 58569953Smsmithstruct hostapd_iface * hostapd_alloc_iface(void); 586121013Ssestruct hostapd_iface * hostapd_init(struct hapd_interfaces *interfaces, 587172999Simp const char *config_file); 588172932Smariusstruct hostapd_iface * 589172932Smariushostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy, 590172932Smarius const char *config_fname, int debug); 591172932Smariusvoid hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, 592172932Smarius int reassoc); 593172932Smariusvoid hostapd_interface_deinit_free(struct hostapd_iface *iface); 594172932Smariusint hostapd_enable_iface(struct hostapd_iface *hapd_iface); 595172932Smariusint hostapd_reload_iface(struct hostapd_iface *hapd_iface); 596172932Smariusint hostapd_disable_iface(struct hostapd_iface *hapd_iface); 597172932Smariusint hostapd_add_iface(struct hapd_interfaces *ifaces, char *buf); 598172932Smariusint hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf); 599172932Smariusvoid hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator); 600172932Smariusvoid hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s); 60169953Smsmithconst char * hostapd_state_text(enum hostapd_iface_state s); 602121013Sseint hostapd_csa_in_progress(struct hostapd_iface *iface); 60369953Smsmithvoid hostapd_chan_switch_vht_config(struct hostapd_data *hapd, int vht_enabled); 60469953Smsmithint hostapd_switch_channel(struct hostapd_data *hapd, 60569953Smsmith struct csa_settings *settings); 60669953Smsmithvoid 60769953Smsmithhostapd_switch_channel_fallback(struct hostapd_iface *iface, 608197099Savg const struct hostapd_freq_params *freq_params); 609172932Smariusvoid hostapd_cleanup_cs_params(struct hostapd_data *hapd); 610172932Smariusvoid hostapd_periodic_iface(struct hostapd_iface *iface); 611163055Sruint hostapd_owe_trans_get_info(struct hostapd_data *hapd); 612163055Sru 613163055Sru/* utils.c */ 61469953Smsmithint hostapd_register_probereq_cb(struct hostapd_data *hapd, 61569953Smsmith int (*cb)(void *ctx, const u8 *sa, 616145022Sbms const u8 *da, const u8 *bssid, 617145022Sbms const u8 *ie, size_t ie_len, 618145022Sbms int ssi_signal), 61969953Smsmith void *ctx); 620172394Smariusvoid hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr); 621172394Smarius 622172394Smarius/* drv_callbacks.c (TODO: move to somewhere else?) */ 623145022Sbmsvoid hostapd_notify_assoc_fils_finish(struct hostapd_data *hapd, 624172932Smarius struct sta_info *sta); 625172932Smariusint hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr, 626145022Sbms const u8 *ie, size_t ielen, int reassoc); 627172999Simpvoid hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr); 628172932Smariusvoid hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr); 629172932Smariusvoid hostapd_event_connect_failed_reason(struct hostapd_data *hapd, 630121013Sse const u8 *addr, int reason_code); 631172932Smariusint hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da, 632145022Sbms const u8 *bssid, const u8 *ie, size_t ie_len, 633145022Sbms int ssi_signal); 634121013Ssevoid hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht, 635121013Sse int offset, int width, int cf1, int cf2, 636121013Sse int finished); 637121013Ssestruct survey_results; 638121013Ssevoid hostapd_event_get_survey(struct hostapd_iface *iface, 639172999Simp struct survey_results *survey_results); 640172932Smariusvoid hostapd_acs_channel_selected(struct hostapd_data *hapd, 641172932Smarius struct acs_selected_channels *acs_res); 642172932Smarius 643172932Smariusconst struct hostapd_eap_user * 644172932Smariushostapd_get_eap_user(struct hostapd_data *hapd, const u8 *identity, 645172932Smarius size_t identity_len, int phase2); 646172932Smarius 647172932Smariusstruct hostapd_data * hostapd_get_iface(struct hapd_interfaces *interfaces, 648172932Smarius const char *ifname); 649121013Ssevoid hostapd_event_sta_opmode_changed(struct hostapd_data *hapd, const u8 *addr, 650121013Sse enum smps_mode smps_mode, 651145022Sbms enum chan_width chan_width, u8 rx_nss); 652145022Sbms 653121013Sse#ifdef CONFIG_FST 654121013Ssevoid fst_hostapd_fill_iface_obj(struct hostapd_data *hapd, 655121013Sse struct fst_wpa_obj *iface_obj); 656121013Sse#endif /* CONFIG_FST */ 65769953Smsmith 65869953Smsmith#endif /* HOSTAPD_H */ 659149478Sps