blob: 4dba8cb3606e02524df7a0667e182a7b8c770f4b [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * hostapd / Initialization and configuration
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08003 * Copyright (c) 2002-2014, Jouni Malinen <j@w1.fi>
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07007 */
8
9#ifndef HOSTAPD_H
10#define HOSTAPD_H
11
12#include "common/defs.h"
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080013#include "utils/list.h"
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080014#include "ap_config.h"
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -080015#include "drivers/driver.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070016
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070017struct wpa_ctrl_dst;
18struct radius_server_data;
19struct upnp_wps_device_sm;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070020struct hostapd_data;
21struct sta_info;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070022struct ieee80211_ht_capabilities;
23struct full_dynamic_vlan;
24enum wps_event;
25union wps_event_data;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080026#ifdef CONFIG_MESH
27struct mesh_conf;
28#endif /* CONFIG_MESH */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070029
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070030struct hostapd_iface;
31
Dmitry Shmidt04949592012-07-19 12:16:46 -070032struct hapd_interfaces {
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070033 int (*reload_config)(struct hostapd_iface *iface);
34 struct hostapd_config * (*config_read_cb)(const char *config_fname);
35 int (*ctrl_iface_init)(struct hostapd_data *hapd);
36 void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
37 int (*for_each_interface)(struct hapd_interfaces *interfaces,
38 int (*cb)(struct hostapd_iface *iface,
39 void *ctx), void *ctx);
40 int (*driver_init)(struct hostapd_iface *iface);
41
Dmitry Shmidt04949592012-07-19 12:16:46 -070042 size_t count;
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070043 int global_ctrl_sock;
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -080044 struct dl_list global_ctrl_dst;
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070045 char *global_iface_path;
46 char *global_iface_name;
Dmitry Shmidtfa3fc4a2013-11-21 13:34:38 -080047#ifndef CONFIG_NATIVE_WINDOWS
Dmitry Shmidt0ccb66e2013-03-29 16:41:28 -070048 gid_t ctrl_iface_group;
Dmitry Shmidtfa3fc4a2013-11-21 13:34:38 -080049#endif /* CONFIG_NATIVE_WINDOWS */
Dmitry Shmidt04949592012-07-19 12:16:46 -070050 struct hostapd_iface **iface;
Dmitry Shmidtb96dad42013-11-05 10:07:29 -080051
52 size_t terminate_on_error;
Dmitry Shmidta3dc3092015-06-23 11:21:28 -070053#ifndef CONFIG_NO_VLAN
54 struct dynamic_iface *vlan_priv;
55#endif /* CONFIG_NO_VLAN */
Dmitry Shmidt04949592012-07-19 12:16:46 -070056};
57
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -070058enum hostapd_chan_status {
59 HOSTAPD_CHAN_VALID = 0, /* channel is ready */
60 HOSTAPD_CHAN_INVALID = 1, /* no usable channel found */
61 HOSTAPD_CHAN_ACS = 2, /* ACS work being performed */
62};
Dmitry Shmidt04949592012-07-19 12:16:46 -070063
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070064struct hostapd_probereq_cb {
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -080065 int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid,
Dmitry Shmidt04949592012-07-19 12:16:46 -070066 const u8 *ie, size_t ie_len, int ssi_signal);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070067 void *ctx;
68};
69
70#define HOSTAPD_RATE_BASIC 0x00000001
71
72struct hostapd_rate_data {
73 int rate; /* rate in 100 kbps */
74 int flags; /* HOSTAPD_RATE_ flags */
75};
76
77struct hostapd_frame_info {
78 u32 channel;
79 u32 datarate;
Dmitry Shmidt04949592012-07-19 12:16:46 -070080 int ssi_signal; /* dBm */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070081};
82
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -070083enum wps_status {
84 WPS_STATUS_SUCCESS = 1,
85 WPS_STATUS_FAILURE
86};
87
88enum pbc_status {
89 WPS_PBC_STATUS_DISABLE,
90 WPS_PBC_STATUS_ACTIVE,
91 WPS_PBC_STATUS_TIMEOUT,
92 WPS_PBC_STATUS_OVERLAP
93};
94
95struct wps_stat {
96 enum wps_status status;
97 enum wps_error_indication failure_reason;
98 enum pbc_status pbc_status;
99 u8 peer_addr[ETH_ALEN];
100};
101
Dmitry Shmidt849734c2016-05-27 09:59:01 -0700102struct hostapd_neighbor_entry {
103 struct dl_list list;
104 u8 bssid[ETH_ALEN];
105 struct wpa_ssid_value ssid;
106 struct wpabuf *nr;
107 struct wpabuf *lci;
108 struct wpabuf *civic;
109 /* LCI update time */
110 struct os_time lci_date;
111};
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700112
113/**
114 * struct hostapd_data - hostapd per-BSS data structure
115 */
116struct hostapd_data {
117 struct hostapd_iface *iface;
118 struct hostapd_config *iconf;
119 struct hostapd_bss_config *conf;
Dmitry Shmidt54605472013-11-08 11:10:19 -0800120 int interface_added; /* virtual interface added for this BSS */
121 unsigned int started:1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800122 unsigned int disabled:1;
123 unsigned int reenable_beacon:1;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700124
125 u8 own_addr[ETH_ALEN];
126
127 int num_sta; /* number of entries in sta_list */
128 struct sta_info *sta_list; /* STA info list head */
129#define STA_HASH_SIZE 256
130#define STA_HASH(sta) (sta[5])
131 struct sta_info *sta_hash[STA_HASH_SIZE];
132
133 /*
134 * Bitfield for indicating which AIDs are allocated. Only AID values
135 * 1-2007 are used and as such, the bit at index 0 corresponds to AID
136 * 1.
137 */
138#define AID_WORDS ((2008 + 31) / 32)
139 u32 sta_aid[AID_WORDS];
140
141 const struct wpa_driver_ops *driver;
142 void *drv_priv;
143
144 void (*new_assoc_sta_cb)(struct hostapd_data *hapd,
145 struct sta_info *sta, int reassoc);
146
147 void *msg_ctx; /* ctx for wpa_msg() calls */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800148 void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700149
150 struct radius_client_data *radius;
Dmitry Shmidtb97e4282016-02-08 10:16:07 -0800151 u64 acct_session_id;
Dmitry Shmidt04949592012-07-19 12:16:46 -0700152 struct radius_das_data *radius_das;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700153
154 struct iapp_data *iapp;
155
156 struct hostapd_cached_radius_acl *acl_cache;
157 struct hostapd_acl_query_data *acl_queries;
158
159 struct wpa_authenticator *wpa_auth;
160 struct eapol_authenticator *eapol_auth;
161
162 struct rsn_preauth_interface *preauth_iface;
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800163 struct os_reltime michael_mic_failure;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700164 int michael_mic_failures;
165 int tkip_countermeasures;
166
167 int ctrl_sock;
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800168 struct dl_list ctrl_dst;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700169
170 void *ssl_ctx;
171 void *eap_sim_db_priv;
172 struct radius_server_data *radius_srv;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800173 struct dl_list erp_keys; /* struct eap_server_erp_key */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700174
175 int parameter_set_count;
176
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800177 /* Time Advertisement */
178 u8 time_update_counter;
179 struct wpabuf *time_adv;
180
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700181#ifdef CONFIG_FULL_DYNAMIC_VLAN
182 struct full_dynamic_vlan *full_dynamic_vlan;
183#endif /* CONFIG_FULL_DYNAMIC_VLAN */
184
185 struct l2_packet_data *l2;
186 struct wps_context *wps;
187
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800188 int beacon_set_done;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700189 struct wpabuf *wps_beacon_ie;
190 struct wpabuf *wps_probe_resp_ie;
191#ifdef CONFIG_WPS
192 unsigned int ap_pin_failures;
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -0800193 unsigned int ap_pin_failures_consecutive;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700194 struct upnp_wps_device_sm *wps_upnp;
195 unsigned int ap_pin_lockout_time;
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -0700196
197 struct wps_stat wps_stats;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700198#endif /* CONFIG_WPS */
199
200 struct hostapd_probereq_cb *probereq_cb;
201 size_t num_probereq_cb;
202
203 void (*public_action_cb)(void *ctx, const u8 *buf, size_t len,
204 int freq);
205 void *public_action_cb_ctx;
Dmitry Shmidt4b9d52f2013-02-05 17:44:43 -0800206 void (*public_action_cb2)(void *ctx, const u8 *buf, size_t len,
207 int freq);
208 void *public_action_cb2_ctx;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700209
210 int (*vendor_action_cb)(void *ctx, const u8 *buf, size_t len,
211 int freq);
212 void *vendor_action_cb_ctx;
213
214 void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
215 const u8 *uuid_e);
216 void *wps_reg_success_cb_ctx;
217
218 void (*wps_event_cb)(void *ctx, enum wps_event event,
219 union wps_event_data *data);
220 void *wps_event_cb_ctx;
221
222 void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800223 int authorized, const u8 *p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700224 void *sta_authorized_cb_ctx;
225
226 void (*setup_complete_cb)(void *ctx);
227 void *setup_complete_cb_ctx;
228
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700229 void (*new_psk_cb)(void *ctx, const u8 *mac_addr,
230 const u8 *p2p_dev_addr, const u8 *psk,
231 size_t psk_len);
232 void *new_psk_cb_ctx;
233
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700234 /* channel switch parameters */
235 struct hostapd_freq_params cs_freq_params;
236 u8 cs_count;
237 int cs_block_tx;
238 unsigned int cs_c_off_beacon;
239 unsigned int cs_c_off_proberesp;
240 int csa_in_progress;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800241 unsigned int cs_c_off_ecsa_beacon;
242 unsigned int cs_c_off_ecsa_proberesp;
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700243
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800244 /* BSS Load */
245 unsigned int bss_load_update_timeout;
246
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700247#ifdef CONFIG_P2P
248 struct p2p_data *p2p;
249 struct p2p_group *p2p_group;
250 struct wpabuf *p2p_beacon_ie;
251 struct wpabuf *p2p_probe_resp_ie;
252
253 /* Number of non-P2P association stations */
254 int num_sta_no_p2p;
255
256 /* Periodic NoA (used only when no non-P2P clients in the group) */
257 int noa_enabled;
258 int noa_start;
259 int noa_duration;
260#endif /* CONFIG_P2P */
Dmitry Shmidt04949592012-07-19 12:16:46 -0700261#ifdef CONFIG_INTERWORKING
262 size_t gas_frag_limit;
263#endif /* CONFIG_INTERWORKING */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800264#ifdef CONFIG_PROXYARP
265 struct l2_packet_data *sock_dhcp;
266 struct l2_packet_data *sock_ndisc;
267#endif /* CONFIG_PROXYARP */
268#ifdef CONFIG_MESH
269 int num_plinks;
270 int max_plinks;
Dmitry Shmidtb97e4282016-02-08 10:16:07 -0800271 void (*mesh_sta_free_cb)(struct hostapd_data *hapd,
272 struct sta_info *sta);
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800273 struct wpabuf *mesh_pending_auth;
274 struct os_reltime mesh_pending_auth_time;
Dmitry Shmidte4663042016-04-04 10:07:49 -0700275 u8 mesh_required_peer[ETH_ALEN];
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800276#endif /* CONFIG_MESH */
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800277
278#ifdef CONFIG_SQLITE
279 struct hostapd_eap_user tmp_eap_user;
280#endif /* CONFIG_SQLITE */
Dmitry Shmidta54fa5f2013-01-15 13:53:35 -0800281
282#ifdef CONFIG_SAE
283 /** Key used for generating SAE anti-clogging tokens */
284 u8 sae_token_key[8];
Dmitry Shmidt04f534e2013-12-09 15:50:16 -0800285 struct os_reltime last_sae_token_key_update;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800286 int dot11RSNASAERetransPeriod; /* msec */
Dmitry Shmidta54fa5f2013-01-15 13:53:35 -0800287#endif /* CONFIG_SAE */
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800288
289#ifdef CONFIG_TESTING_OPTIONS
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800290 unsigned int ext_mgmt_frame_handling:1;
291 unsigned int ext_eapol_frame_io:1;
292
293 struct l2_packet_data *l2_test;
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800294#endif /* CONFIG_TESTING_OPTIONS */
Dmitry Shmidt57c2d392016-02-23 13:40:19 -0800295
296#ifdef CONFIG_MBO
297 unsigned int mbo_assoc_disallow;
298#endif /* CONFIG_MBO */
Dmitry Shmidt849734c2016-05-27 09:59:01 -0700299
300 struct dl_list nr_db;
301
302 u8 lci_req_token;
303 u8 range_req_token;
304 unsigned int lci_req_active:1;
305 unsigned int range_req_active:1;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700306};
307
308
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800309struct hostapd_sta_info {
310 struct dl_list list;
311 u8 addr[ETH_ALEN];
312 struct os_reltime last_seen;
313};
314
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700315/**
316 * struct hostapd_iface - hostapd per-interface data structure
317 */
318struct hostapd_iface {
319 struct hapd_interfaces *interfaces;
320 void *owner;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700321 char *config_fname;
322 struct hostapd_config *conf;
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800323 char phy[16]; /* Name of the PHY (radio) */
324
325 enum hostapd_iface_state {
326 HAPD_IFACE_UNINITIALIZED,
327 HAPD_IFACE_DISABLED,
328 HAPD_IFACE_COUNTRY_UPDATE,
329 HAPD_IFACE_ACS,
330 HAPD_IFACE_HT_SCAN,
331 HAPD_IFACE_DFS,
332 HAPD_IFACE_ENABLED
333 } state;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700334
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800335#ifdef CONFIG_MESH
336 struct mesh_conf *mconf;
337#endif /* CONFIG_MESH */
338
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700339 size_t num_bss;
340 struct hostapd_data **bss;
341
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800342 unsigned int wait_channel_update:1;
343 unsigned int cac_started:1;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800344#ifdef CONFIG_FST
345 struct fst_iface *fst;
346 const struct wpabuf *fst_ies;
347#endif /* CONFIG_FST */
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800348
Dmitry Shmidta38abf92014-03-06 13:38:44 -0800349 /*
350 * When set, indicates that the driver will handle the AP
351 * teardown: delete global keys, station keys, and stations.
352 */
353 unsigned int driver_ap_teardown:1;
354
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800355 /*
356 * When set, indicates that this interface is part of list of
357 * interfaces that need to be started together (synchronously).
358 */
359 unsigned int need_to_start_in_sync:1;
360
361 /* Ready to start but waiting for other interfaces to become ready. */
362 unsigned int ready_to_start_in_sync:1;
363
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700364 int num_ap; /* number of entries in ap_list */
365 struct ap_info *ap_list; /* AP info list head */
366 struct ap_info *ap_hash[STA_HASH_SIZE];
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700367
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800368 u64 drv_flags;
369
370 /* SMPS modes supported by the driver (WPA_DRIVER_SMPS_MODE_*) */
371 unsigned int smps_modes;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800372
373 /*
374 * A bitmap of supported protocols for probe response offload. See
375 * struct wpa_driver_capa in driver.h
376 */
377 unsigned int probe_resp_offloads;
378
Dmitry Shmidt444d5672013-04-01 13:08:44 -0700379 /* extended capabilities supported by the driver */
380 const u8 *extended_capa, *extended_capa_mask;
381 unsigned int extended_capa_len;
382
Dmitry Shmidt8bae4132013-06-06 11:25:10 -0700383 unsigned int drv_max_acl_mac_addrs;
384
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700385 struct hostapd_hw_modes *hw_features;
386 int num_hw_features;
387 struct hostapd_hw_modes *current_mode;
388 /* Rates that are currently used (i.e., filtered copy of
389 * current_mode->channels */
390 int num_rates;
391 struct hostapd_rate_data *current_rates;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800392 int *basic_rates;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700393 int freq;
394
395 u16 hw_flags;
396
397 /* Number of associated Non-ERP stations (i.e., stations using 802.11b
398 * in 802.11g BSS) */
399 int num_sta_non_erp;
400
401 /* Number of associated stations that do not support Short Slot Time */
402 int num_sta_no_short_slot_time;
403
404 /* Number of associated stations that do not support Short Preamble */
405 int num_sta_no_short_preamble;
406
407 int olbc; /* Overlapping Legacy BSS Condition */
408
409 /* Number of HT associated stations that do not support greenfield */
410 int num_sta_ht_no_gf;
411
412 /* Number of associated non-HT stations */
413 int num_sta_no_ht;
414
415 /* Number of HT associated stations 20 MHz */
416 int num_sta_ht_20mhz;
417
Dmitry Shmidt7832adb2014-04-29 10:53:02 -0700418 /* Number of HT40 intolerant stations */
419 int num_sta_ht40_intolerant;
420
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700421 /* Overlapping BSS information */
422 int olbc_ht;
423
424 u16 ht_op_mode;
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -0700425
426 /* surveying helpers */
427
428 /* number of channels surveyed */
429 unsigned int chans_surveyed;
430
431 /* lowest observed noise floor in dBm */
432 s8 lowest_nf;
433
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800434 /* channel utilization calculation */
435 u64 last_channel_time;
436 u64 last_channel_time_busy;
437 u8 channel_utilization;
438
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800439 /* eCSA IE will be added only if operating class is specified */
440 u8 cs_oper_class;
441
Dmitry Shmidtdf5a7e42014-04-02 12:59:59 -0700442 unsigned int dfs_cac_ms;
443 struct os_reltime dfs_cac_start;
444
Dmitry Shmidt7832adb2014-04-29 10:53:02 -0700445 /* Latched with the actual secondary channel information and will be
446 * used while juggling between HT20 and HT40 modes. */
447 int secondary_ch;
448
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700449#ifdef CONFIG_ACS
450 unsigned int acs_num_completed_scans;
451#endif /* CONFIG_ACS */
452
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700453 void (*scan_cb)(struct hostapd_iface *iface);
Dmitry Shmidt7832adb2014-04-29 10:53:02 -0700454 int num_ht40_scan_tries;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800455
456 struct dl_list sta_seen; /* struct hostapd_sta_info */
457 unsigned int num_sta_seen;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700458};
459
460/* hostapd.c */
Dmitry Shmidt04949592012-07-19 12:16:46 -0700461int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
462 int (*cb)(struct hostapd_iface *iface,
463 void *ctx), void *ctx);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700464int hostapd_reload_config(struct hostapd_iface *iface);
465struct hostapd_data *
466hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
467 struct hostapd_config *conf,
468 struct hostapd_bss_config *bss);
469int hostapd_setup_interface(struct hostapd_iface *iface);
470int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
471void hostapd_interface_deinit(struct hostapd_iface *iface);
472void hostapd_interface_free(struct hostapd_iface *iface);
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800473struct hostapd_iface * hostapd_init(struct hapd_interfaces *interfaces,
474 const char *config_file);
475struct hostapd_iface *
476hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy,
477 const char *config_fname, int debug);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700478void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
479 int reassoc);
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700480void hostapd_interface_deinit_free(struct hostapd_iface *iface);
481int hostapd_enable_iface(struct hostapd_iface *hapd_iface);
482int hostapd_reload_iface(struct hostapd_iface *hapd_iface);
483int hostapd_disable_iface(struct hostapd_iface *hapd_iface);
484int hostapd_add_iface(struct hapd_interfaces *ifaces, char *buf);
485int hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf);
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800486void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator);
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800487void hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s);
488const char * hostapd_state_text(enum hostapd_iface_state s);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800489int hostapd_csa_in_progress(struct hostapd_iface *iface);
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800490int hostapd_switch_channel(struct hostapd_data *hapd,
491 struct csa_settings *settings);
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700492void
493hostapd_switch_channel_fallback(struct hostapd_iface *iface,
494 const struct hostapd_freq_params *freq_params);
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800495void hostapd_cleanup_cs_params(struct hostapd_data *hapd);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800496void hostapd_periodic_iface(struct hostapd_iface *iface);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700497
498/* utils.c */
499int hostapd_register_probereq_cb(struct hostapd_data *hapd,
500 int (*cb)(void *ctx, const u8 *sa,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800501 const u8 *da, const u8 *bssid,
Dmitry Shmidt04949592012-07-19 12:16:46 -0700502 const u8 *ie, size_t ie_len,
503 int ssi_signal),
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700504 void *ctx);
505void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
506
507/* drv_callbacks.c (TODO: move to somewhere else?) */
508int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
509 const u8 *ie, size_t ielen, int reassoc);
510void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
511void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr);
Dmitry Shmidtf8623282013-02-20 14:34:59 -0800512void hostapd_event_connect_failed_reason(struct hostapd_data *hapd,
513 const u8 *addr, int reason_code);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800514int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
Dmitry Shmidt04949592012-07-19 12:16:46 -0700515 const u8 *bssid, const u8 *ie, size_t ie_len,
516 int ssi_signal);
517void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
Dmitry Shmidt04f534e2013-12-09 15:50:16 -0800518 int offset, int width, int cf1, int cf2);
Dmitry Shmidt014a3ff2015-12-28 13:27:49 -0800519struct survey_results;
520void hostapd_event_get_survey(struct hostapd_iface *iface,
521 struct survey_results *survey_results);
522void hostapd_acs_channel_selected(struct hostapd_data *hapd,
523 struct acs_selected_channels *acs_res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700524
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800525const struct hostapd_eap_user *
526hostapd_get_eap_user(struct hostapd_data *hapd, const u8 *identity,
527 size_t identity_len, int phase2);
528
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800529struct hostapd_data * hostapd_get_iface(struct hapd_interfaces *interfaces,
530 const char *ifname);
531
532#ifdef CONFIG_FST
533void fst_hostapd_fill_iface_obj(struct hostapd_data *hapd,
534 struct fst_wpa_obj *iface_obj);
535#endif /* CONFIG_FST */
536
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700537#endif /* HOSTAPD_H */