Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | * hostapd / Initialization and configuration |
Dmitry Shmidt | cce0666 | 2013-11-04 18:44:24 -0800 | [diff] [blame] | 3 | * Copyright (c) 2002-2013, Jouni Malinen <j@w1.fi> |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 4 | * |
Dmitry Shmidt | c5ec7f5 | 2012-03-06 16:33:24 -0800 | [diff] [blame] | 5 | * This software may be distributed under the terms of the BSD license. |
| 6 | * See README for more details. |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #ifndef HOSTAPD_H |
| 10 | #define HOSTAPD_H |
| 11 | |
| 12 | #include "common/defs.h" |
Dmitry Shmidt | d5e4923 | 2012-12-03 15:08:10 -0800 | [diff] [blame] | 13 | #include "ap_config.h" |
Dmitry Shmidt | fb79edc | 2014-01-10 10:45:54 -0800 | [diff] [blame] | 14 | #include "drivers/driver.h" |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 15 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 16 | struct wpa_ctrl_dst; |
| 17 | struct radius_server_data; |
| 18 | struct upnp_wps_device_sm; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 19 | struct hostapd_data; |
| 20 | struct sta_info; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 21 | struct ieee80211_ht_capabilities; |
| 22 | struct full_dynamic_vlan; |
| 23 | enum wps_event; |
| 24 | union wps_event_data; |
| 25 | |
Dmitry Shmidt | 61d9df3 | 2012-08-29 16:22:06 -0700 | [diff] [blame] | 26 | struct hostapd_iface; |
Dmitry Shmidt | 34af306 | 2013-07-11 10:46:32 -0700 | [diff] [blame] | 27 | struct hostapd_dynamic_iface; |
Dmitry Shmidt | 61d9df3 | 2012-08-29 16:22:06 -0700 | [diff] [blame] | 28 | |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 29 | struct hapd_interfaces { |
Dmitry Shmidt | 61d9df3 | 2012-08-29 16:22:06 -0700 | [diff] [blame] | 30 | int (*reload_config)(struct hostapd_iface *iface); |
| 31 | struct hostapd_config * (*config_read_cb)(const char *config_fname); |
| 32 | int (*ctrl_iface_init)(struct hostapd_data *hapd); |
| 33 | void (*ctrl_iface_deinit)(struct hostapd_data *hapd); |
| 34 | int (*for_each_interface)(struct hapd_interfaces *interfaces, |
| 35 | int (*cb)(struct hostapd_iface *iface, |
| 36 | void *ctx), void *ctx); |
| 37 | int (*driver_init)(struct hostapd_iface *iface); |
| 38 | |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 39 | size_t count; |
Dmitry Shmidt | 34af306 | 2013-07-11 10:46:32 -0700 | [diff] [blame] | 40 | size_t count_dynamic; |
Dmitry Shmidt | 61d9df3 | 2012-08-29 16:22:06 -0700 | [diff] [blame] | 41 | int global_ctrl_sock; |
| 42 | char *global_iface_path; |
| 43 | char *global_iface_name; |
Dmitry Shmidt | fa3fc4a | 2013-11-21 13:34:38 -0800 | [diff] [blame] | 44 | #ifndef CONFIG_NATIVE_WINDOWS |
Dmitry Shmidt | 0ccb66e | 2013-03-29 16:41:28 -0700 | [diff] [blame] | 45 | gid_t ctrl_iface_group; |
Dmitry Shmidt | fa3fc4a | 2013-11-21 13:34:38 -0800 | [diff] [blame] | 46 | #endif /* CONFIG_NATIVE_WINDOWS */ |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 47 | struct hostapd_iface **iface; |
Dmitry Shmidt | 34af306 | 2013-07-11 10:46:32 -0700 | [diff] [blame] | 48 | struct hostapd_dynamic_iface **dynamic_iface; |
Dmitry Shmidt | b96dad4 | 2013-11-05 10:07:29 -0800 | [diff] [blame] | 49 | |
| 50 | size_t terminate_on_error; |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 51 | }; |
| 52 | |
Dmitry Shmidt | b7b4d0e | 2013-08-26 12:09:05 -0700 | [diff] [blame] | 53 | enum hostapd_chan_status { |
| 54 | HOSTAPD_CHAN_VALID = 0, /* channel is ready */ |
| 55 | HOSTAPD_CHAN_INVALID = 1, /* no usable channel found */ |
| 56 | HOSTAPD_CHAN_ACS = 2, /* ACS work being performed */ |
| 57 | }; |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 58 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 59 | struct hostapd_probereq_cb { |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 60 | int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid, |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 61 | const u8 *ie, size_t ie_len, int ssi_signal); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 62 | void *ctx; |
| 63 | }; |
| 64 | |
| 65 | #define HOSTAPD_RATE_BASIC 0x00000001 |
| 66 | |
| 67 | struct hostapd_rate_data { |
| 68 | int rate; /* rate in 100 kbps */ |
| 69 | int flags; /* HOSTAPD_RATE_ flags */ |
| 70 | }; |
| 71 | |
| 72 | struct hostapd_frame_info { |
| 73 | u32 channel; |
| 74 | u32 datarate; |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 75 | int ssi_signal; /* dBm */ |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 76 | }; |
| 77 | |
Dmitry Shmidt | b7b4d0e | 2013-08-26 12:09:05 -0700 | [diff] [blame] | 78 | enum wps_status { |
| 79 | WPS_STATUS_SUCCESS = 1, |
| 80 | WPS_STATUS_FAILURE |
| 81 | }; |
| 82 | |
| 83 | enum pbc_status { |
| 84 | WPS_PBC_STATUS_DISABLE, |
| 85 | WPS_PBC_STATUS_ACTIVE, |
| 86 | WPS_PBC_STATUS_TIMEOUT, |
| 87 | WPS_PBC_STATUS_OVERLAP |
| 88 | }; |
| 89 | |
| 90 | struct wps_stat { |
| 91 | enum wps_status status; |
| 92 | enum wps_error_indication failure_reason; |
| 93 | enum pbc_status pbc_status; |
| 94 | u8 peer_addr[ETH_ALEN]; |
| 95 | }; |
| 96 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 97 | |
| 98 | /** |
| 99 | * struct hostapd_data - hostapd per-BSS data structure |
| 100 | */ |
| 101 | struct hostapd_data { |
| 102 | struct hostapd_iface *iface; |
| 103 | struct hostapd_config *iconf; |
| 104 | struct hostapd_bss_config *conf; |
Dmitry Shmidt | 5460547 | 2013-11-08 11:10:19 -0800 | [diff] [blame] | 105 | int interface_added; /* virtual interface added for this BSS */ |
| 106 | unsigned int started:1; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 107 | |
| 108 | u8 own_addr[ETH_ALEN]; |
| 109 | |
| 110 | int num_sta; /* number of entries in sta_list */ |
| 111 | struct sta_info *sta_list; /* STA info list head */ |
| 112 | #define STA_HASH_SIZE 256 |
| 113 | #define STA_HASH(sta) (sta[5]) |
| 114 | struct sta_info *sta_hash[STA_HASH_SIZE]; |
| 115 | |
| 116 | /* |
| 117 | * Bitfield for indicating which AIDs are allocated. Only AID values |
| 118 | * 1-2007 are used and as such, the bit at index 0 corresponds to AID |
| 119 | * 1. |
| 120 | */ |
| 121 | #define AID_WORDS ((2008 + 31) / 32) |
| 122 | u32 sta_aid[AID_WORDS]; |
| 123 | |
| 124 | const struct wpa_driver_ops *driver; |
| 125 | void *drv_priv; |
| 126 | |
| 127 | void (*new_assoc_sta_cb)(struct hostapd_data *hapd, |
| 128 | struct sta_info *sta, int reassoc); |
| 129 | |
| 130 | void *msg_ctx; /* ctx for wpa_msg() calls */ |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 131 | void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */ |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 132 | |
| 133 | struct radius_client_data *radius; |
| 134 | u32 acct_session_id_hi, acct_session_id_lo; |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 135 | struct radius_das_data *radius_das; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 136 | |
| 137 | struct iapp_data *iapp; |
| 138 | |
| 139 | struct hostapd_cached_radius_acl *acl_cache; |
| 140 | struct hostapd_acl_query_data *acl_queries; |
| 141 | |
| 142 | struct wpa_authenticator *wpa_auth; |
| 143 | struct eapol_authenticator *eapol_auth; |
| 144 | |
| 145 | struct rsn_preauth_interface *preauth_iface; |
Dmitry Shmidt | fb79edc | 2014-01-10 10:45:54 -0800 | [diff] [blame] | 146 | struct os_reltime michael_mic_failure; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 147 | int michael_mic_failures; |
| 148 | int tkip_countermeasures; |
| 149 | |
| 150 | int ctrl_sock; |
| 151 | struct wpa_ctrl_dst *ctrl_dst; |
| 152 | |
| 153 | void *ssl_ctx; |
| 154 | void *eap_sim_db_priv; |
| 155 | struct radius_server_data *radius_srv; |
| 156 | |
| 157 | int parameter_set_count; |
| 158 | |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 159 | /* Time Advertisement */ |
| 160 | u8 time_update_counter; |
| 161 | struct wpabuf *time_adv; |
| 162 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 163 | #ifdef CONFIG_FULL_DYNAMIC_VLAN |
| 164 | struct full_dynamic_vlan *full_dynamic_vlan; |
| 165 | #endif /* CONFIG_FULL_DYNAMIC_VLAN */ |
| 166 | |
| 167 | struct l2_packet_data *l2; |
| 168 | struct wps_context *wps; |
| 169 | |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 170 | int beacon_set_done; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 171 | struct wpabuf *wps_beacon_ie; |
| 172 | struct wpabuf *wps_probe_resp_ie; |
| 173 | #ifdef CONFIG_WPS |
| 174 | unsigned int ap_pin_failures; |
Dmitry Shmidt | c5ec7f5 | 2012-03-06 16:33:24 -0800 | [diff] [blame] | 175 | unsigned int ap_pin_failures_consecutive; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 176 | struct upnp_wps_device_sm *wps_upnp; |
| 177 | unsigned int ap_pin_lockout_time; |
Dmitry Shmidt | b7b4d0e | 2013-08-26 12:09:05 -0700 | [diff] [blame] | 178 | |
| 179 | struct wps_stat wps_stats; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 180 | #endif /* CONFIG_WPS */ |
| 181 | |
| 182 | struct hostapd_probereq_cb *probereq_cb; |
| 183 | size_t num_probereq_cb; |
| 184 | |
| 185 | void (*public_action_cb)(void *ctx, const u8 *buf, size_t len, |
| 186 | int freq); |
| 187 | void *public_action_cb_ctx; |
Dmitry Shmidt | 4b9d52f | 2013-02-05 17:44:43 -0800 | [diff] [blame] | 188 | void (*public_action_cb2)(void *ctx, const u8 *buf, size_t len, |
| 189 | int freq); |
| 190 | void *public_action_cb2_ctx; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 191 | |
| 192 | int (*vendor_action_cb)(void *ctx, const u8 *buf, size_t len, |
| 193 | int freq); |
| 194 | void *vendor_action_cb_ctx; |
| 195 | |
| 196 | void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr, |
| 197 | const u8 *uuid_e); |
| 198 | void *wps_reg_success_cb_ctx; |
| 199 | |
| 200 | void (*wps_event_cb)(void *ctx, enum wps_event event, |
| 201 | union wps_event_data *data); |
| 202 | void *wps_event_cb_ctx; |
| 203 | |
| 204 | void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr, |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 205 | int authorized, const u8 *p2p_dev_addr); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 206 | void *sta_authorized_cb_ctx; |
| 207 | |
| 208 | void (*setup_complete_cb)(void *ctx); |
| 209 | void *setup_complete_cb_ctx; |
| 210 | |
Dmitry Shmidt | 391c59f | 2013-09-03 12:16:28 -0700 | [diff] [blame] | 211 | void (*new_psk_cb)(void *ctx, const u8 *mac_addr, |
| 212 | const u8 *p2p_dev_addr, const u8 *psk, |
| 213 | size_t psk_len); |
| 214 | void *new_psk_cb_ctx; |
| 215 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 216 | #ifdef CONFIG_P2P |
| 217 | struct p2p_data *p2p; |
| 218 | struct p2p_group *p2p_group; |
| 219 | struct wpabuf *p2p_beacon_ie; |
| 220 | struct wpabuf *p2p_probe_resp_ie; |
| 221 | |
| 222 | /* Number of non-P2P association stations */ |
| 223 | int num_sta_no_p2p; |
| 224 | |
| 225 | /* Periodic NoA (used only when no non-P2P clients in the group) */ |
| 226 | int noa_enabled; |
| 227 | int noa_start; |
| 228 | int noa_duration; |
| 229 | #endif /* CONFIG_P2P */ |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 230 | #ifdef CONFIG_INTERWORKING |
| 231 | size_t gas_frag_limit; |
| 232 | #endif /* CONFIG_INTERWORKING */ |
Dmitry Shmidt | d5e4923 | 2012-12-03 15:08:10 -0800 | [diff] [blame] | 233 | |
| 234 | #ifdef CONFIG_SQLITE |
| 235 | struct hostapd_eap_user tmp_eap_user; |
| 236 | #endif /* CONFIG_SQLITE */ |
Dmitry Shmidt | a54fa5f | 2013-01-15 13:53:35 -0800 | [diff] [blame] | 237 | |
| 238 | #ifdef CONFIG_SAE |
| 239 | /** Key used for generating SAE anti-clogging tokens */ |
| 240 | u8 sae_token_key[8]; |
Dmitry Shmidt | 04f534e | 2013-12-09 15:50:16 -0800 | [diff] [blame] | 241 | struct os_reltime last_sae_token_key_update; |
Dmitry Shmidt | a54fa5f | 2013-01-15 13:53:35 -0800 | [diff] [blame] | 242 | #endif /* CONFIG_SAE */ |
Dmitry Shmidt | fb79edc | 2014-01-10 10:45:54 -0800 | [diff] [blame] | 243 | |
| 244 | #ifdef CONFIG_TESTING_OPTIONS |
| 245 | int ext_mgmt_frame_handling; |
| 246 | #endif /* CONFIG_TESTING_OPTIONS */ |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 247 | }; |
| 248 | |
| 249 | |
| 250 | /** |
| 251 | * struct hostapd_iface - hostapd per-interface data structure |
| 252 | */ |
| 253 | struct hostapd_iface { |
| 254 | struct hapd_interfaces *interfaces; |
| 255 | void *owner; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 256 | char *config_fname; |
| 257 | struct hostapd_config *conf; |
Dmitry Shmidt | cce0666 | 2013-11-04 18:44:24 -0800 | [diff] [blame] | 258 | char phy[16]; /* Name of the PHY (radio) */ |
| 259 | |
| 260 | enum hostapd_iface_state { |
| 261 | HAPD_IFACE_UNINITIALIZED, |
| 262 | HAPD_IFACE_DISABLED, |
| 263 | HAPD_IFACE_COUNTRY_UPDATE, |
| 264 | HAPD_IFACE_ACS, |
| 265 | HAPD_IFACE_HT_SCAN, |
| 266 | HAPD_IFACE_DFS, |
| 267 | HAPD_IFACE_ENABLED |
| 268 | } state; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 269 | |
| 270 | size_t num_bss; |
| 271 | struct hostapd_data **bss; |
| 272 | |
Dmitry Shmidt | cce0666 | 2013-11-04 18:44:24 -0800 | [diff] [blame] | 273 | unsigned int wait_channel_update:1; |
| 274 | unsigned int cac_started:1; |
| 275 | |
Dmitry Shmidt | a38abf9 | 2014-03-06 13:38:44 -0800 | [diff] [blame^] | 276 | /* |
| 277 | * When set, indicates that the driver will handle the AP |
| 278 | * teardown: delete global keys, station keys, and stations. |
| 279 | */ |
| 280 | unsigned int driver_ap_teardown:1; |
| 281 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 282 | int num_ap; /* number of entries in ap_list */ |
| 283 | struct ap_info *ap_list; /* AP info list head */ |
| 284 | struct ap_info *ap_hash[STA_HASH_SIZE]; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 285 | |
| 286 | unsigned int drv_flags; |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 287 | |
| 288 | /* |
| 289 | * A bitmap of supported protocols for probe response offload. See |
| 290 | * struct wpa_driver_capa in driver.h |
| 291 | */ |
| 292 | unsigned int probe_resp_offloads; |
| 293 | |
Dmitry Shmidt | 444d567 | 2013-04-01 13:08:44 -0700 | [diff] [blame] | 294 | /* extended capabilities supported by the driver */ |
| 295 | const u8 *extended_capa, *extended_capa_mask; |
| 296 | unsigned int extended_capa_len; |
| 297 | |
Dmitry Shmidt | 8bae413 | 2013-06-06 11:25:10 -0700 | [diff] [blame] | 298 | unsigned int drv_max_acl_mac_addrs; |
| 299 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 300 | struct hostapd_hw_modes *hw_features; |
| 301 | int num_hw_features; |
| 302 | struct hostapd_hw_modes *current_mode; |
| 303 | /* Rates that are currently used (i.e., filtered copy of |
| 304 | * current_mode->channels */ |
| 305 | int num_rates; |
| 306 | struct hostapd_rate_data *current_rates; |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 307 | int *basic_rates; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 308 | int freq; |
| 309 | |
| 310 | u16 hw_flags; |
| 311 | |
| 312 | /* Number of associated Non-ERP stations (i.e., stations using 802.11b |
| 313 | * in 802.11g BSS) */ |
| 314 | int num_sta_non_erp; |
| 315 | |
| 316 | /* Number of associated stations that do not support Short Slot Time */ |
| 317 | int num_sta_no_short_slot_time; |
| 318 | |
| 319 | /* Number of associated stations that do not support Short Preamble */ |
| 320 | int num_sta_no_short_preamble; |
| 321 | |
| 322 | int olbc; /* Overlapping Legacy BSS Condition */ |
| 323 | |
| 324 | /* Number of HT associated stations that do not support greenfield */ |
| 325 | int num_sta_ht_no_gf; |
| 326 | |
| 327 | /* Number of associated non-HT stations */ |
| 328 | int num_sta_no_ht; |
| 329 | |
| 330 | /* Number of HT associated stations 20 MHz */ |
| 331 | int num_sta_ht_20mhz; |
| 332 | |
| 333 | /* Overlapping BSS information */ |
| 334 | int olbc_ht; |
| 335 | |
| 336 | u16 ht_op_mode; |
Dmitry Shmidt | b7b4d0e | 2013-08-26 12:09:05 -0700 | [diff] [blame] | 337 | |
| 338 | /* surveying helpers */ |
| 339 | |
| 340 | /* number of channels surveyed */ |
| 341 | unsigned int chans_surveyed; |
| 342 | |
| 343 | /* lowest observed noise floor in dBm */ |
| 344 | s8 lowest_nf; |
| 345 | |
Dmitry Shmidt | e0e48dc | 2013-11-18 12:00:06 -0800 | [diff] [blame] | 346 | /* channel switch parameters */ |
Dmitry Shmidt | fb79edc | 2014-01-10 10:45:54 -0800 | [diff] [blame] | 347 | struct hostapd_freq_params cs_freq_params; |
Dmitry Shmidt | e0e48dc | 2013-11-18 12:00:06 -0800 | [diff] [blame] | 348 | u8 cs_count; |
| 349 | int cs_block_tx; |
| 350 | unsigned int cs_c_off_beacon; |
| 351 | unsigned int cs_c_off_proberesp; |
| 352 | int csa_in_progress; |
| 353 | |
Dmitry Shmidt | 391c59f | 2013-09-03 12:16:28 -0700 | [diff] [blame] | 354 | #ifdef CONFIG_ACS |
| 355 | unsigned int acs_num_completed_scans; |
| 356 | #endif /* CONFIG_ACS */ |
| 357 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 358 | void (*scan_cb)(struct hostapd_iface *iface); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 359 | }; |
| 360 | |
Dmitry Shmidt | 34af306 | 2013-07-11 10:46:32 -0700 | [diff] [blame] | 361 | /** |
| 362 | * struct hostapd_dynamic_iface - hostapd per dynamically allocated |
| 363 | * or added interface data structure |
| 364 | */ |
| 365 | struct hostapd_dynamic_iface { |
| 366 | char parent[IFNAMSIZ + 1]; |
| 367 | char iface[IFNAMSIZ + 1]; |
| 368 | unsigned int usage; |
| 369 | }; |
| 370 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 371 | /* hostapd.c */ |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 372 | int hostapd_for_each_interface(struct hapd_interfaces *interfaces, |
| 373 | int (*cb)(struct hostapd_iface *iface, |
| 374 | void *ctx), void *ctx); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 375 | int hostapd_reload_config(struct hostapd_iface *iface); |
| 376 | struct hostapd_data * |
| 377 | hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, |
| 378 | struct hostapd_config *conf, |
| 379 | struct hostapd_bss_config *bss); |
| 380 | int hostapd_setup_interface(struct hostapd_iface *iface); |
| 381 | int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err); |
| 382 | void hostapd_interface_deinit(struct hostapd_iface *iface); |
| 383 | void hostapd_interface_free(struct hostapd_iface *iface); |
Dmitry Shmidt | cce0666 | 2013-11-04 18:44:24 -0800 | [diff] [blame] | 384 | struct hostapd_iface * hostapd_init(struct hapd_interfaces *interfaces, |
| 385 | const char *config_file); |
| 386 | struct hostapd_iface * |
| 387 | hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy, |
| 388 | const char *config_fname, int debug); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 389 | void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, |
| 390 | int reassoc); |
Dmitry Shmidt | 61d9df3 | 2012-08-29 16:22:06 -0700 | [diff] [blame] | 391 | void hostapd_interface_deinit_free(struct hostapd_iface *iface); |
| 392 | int hostapd_enable_iface(struct hostapd_iface *hapd_iface); |
| 393 | int hostapd_reload_iface(struct hostapd_iface *hapd_iface); |
| 394 | int hostapd_disable_iface(struct hostapd_iface *hapd_iface); |
| 395 | int hostapd_add_iface(struct hapd_interfaces *ifaces, char *buf); |
| 396 | int hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf); |
Dmitry Shmidt | e0e48dc | 2013-11-18 12:00:06 -0800 | [diff] [blame] | 397 | void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator); |
Dmitry Shmidt | cce0666 | 2013-11-04 18:44:24 -0800 | [diff] [blame] | 398 | void hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s); |
| 399 | const char * hostapd_state_text(enum hostapd_iface_state s); |
Dmitry Shmidt | e0e48dc | 2013-11-18 12:00:06 -0800 | [diff] [blame] | 400 | int hostapd_switch_channel(struct hostapd_data *hapd, |
| 401 | struct csa_settings *settings); |
| 402 | void hostapd_cleanup_cs_params(struct hostapd_data *hapd); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 403 | |
| 404 | /* utils.c */ |
| 405 | int hostapd_register_probereq_cb(struct hostapd_data *hapd, |
| 406 | int (*cb)(void *ctx, const u8 *sa, |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 407 | const u8 *da, const u8 *bssid, |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 408 | const u8 *ie, size_t ie_len, |
| 409 | int ssi_signal), |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 410 | void *ctx); |
| 411 | void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr); |
| 412 | |
| 413 | /* drv_callbacks.c (TODO: move to somewhere else?) */ |
| 414 | int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr, |
| 415 | const u8 *ie, size_t ielen, int reassoc); |
| 416 | void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr); |
| 417 | void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr); |
Dmitry Shmidt | f862328 | 2013-02-20 14:34:59 -0800 | [diff] [blame] | 418 | void hostapd_event_connect_failed_reason(struct hostapd_data *hapd, |
| 419 | const u8 *addr, int reason_code); |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 420 | int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da, |
Dmitry Shmidt | 0494959 | 2012-07-19 12:16:46 -0700 | [diff] [blame] | 421 | const u8 *bssid, const u8 *ie, size_t ie_len, |
| 422 | int ssi_signal); |
| 423 | void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht, |
Dmitry Shmidt | 04f534e | 2013-12-09 15:50:16 -0800 | [diff] [blame] | 424 | int offset, int width, int cf1, int cf2); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 425 | |
Dmitry Shmidt | d5e4923 | 2012-12-03 15:08:10 -0800 | [diff] [blame] | 426 | const struct hostapd_eap_user * |
| 427 | hostapd_get_eap_user(struct hostapd_data *hapd, const u8 *identity, |
| 428 | size_t identity_len, int phase2); |
| 429 | |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 430 | #endif /* HOSTAPD_H */ |