blob: c9e860f8ac87dcebee0b0a43d26be3ce830582a8 [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * Driver interface definition
Dmitry Shmidt807291d2015-01-27 13:40:23 -08003 * Copyright (c) 2003-2015, 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 * This file defines a driver interface used by both %wpa_supplicant and
9 * hostapd. The first part of the file defines data structures used in various
10 * driver operations. This is followed by the struct wpa_driver_ops that each
11 * driver wrapper will beed to define with callback functions for requesting
12 * driver operations. After this, there are definitions for driver event
13 * reporting with wpa_supplicant_event() and some convenience helper functions
14 * that can be used to report events.
15 */
16
17#ifndef DRIVER_H
18#define DRIVER_H
19
20#define WPA_SUPPLICANT_DRIVER_VERSION 4
21
22#include "common/defs.h"
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -070023#include "utils/list.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070024
25#define HOSTAPD_CHAN_DISABLED 0x00000001
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080026#define HOSTAPD_CHAN_NO_IR 0x00000002
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070027#define HOSTAPD_CHAN_RADAR 0x00000008
28#define HOSTAPD_CHAN_HT40PLUS 0x00000010
29#define HOSTAPD_CHAN_HT40MINUS 0x00000020
30#define HOSTAPD_CHAN_HT40 0x00000040
Dmitry Shmidt391c59f2013-09-03 12:16:28 -070031#define HOSTAPD_CHAN_SURVEY_LIST_INITIALIZED 0x00000080
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070032
Dmitry Shmidtea69e842013-05-13 14:52:28 -070033#define HOSTAPD_CHAN_DFS_UNKNOWN 0x00000000
34#define HOSTAPD_CHAN_DFS_USABLE 0x00000100
35#define HOSTAPD_CHAN_DFS_UNAVAILABLE 0x00000200
36#define HOSTAPD_CHAN_DFS_AVAILABLE 0x00000300
37#define HOSTAPD_CHAN_DFS_MASK 0x00000300
38
Dmitry Shmidt68d0e3e2013-10-28 17:59:21 -070039#define HOSTAPD_CHAN_VHT_10_70 0x00000800
40#define HOSTAPD_CHAN_VHT_30_50 0x00001000
41#define HOSTAPD_CHAN_VHT_50_30 0x00002000
42#define HOSTAPD_CHAN_VHT_70_10 0x00004000
43
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080044#define HOSTAPD_CHAN_INDOOR_ONLY 0x00010000
45#define HOSTAPD_CHAN_GO_CONCURRENT 0x00020000
46
47/**
48 * enum reg_change_initiator - Regulatory change initiator
49 */
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -080050enum reg_change_initiator {
51 REGDOM_SET_BY_CORE,
52 REGDOM_SET_BY_USER,
53 REGDOM_SET_BY_DRIVER,
54 REGDOM_SET_BY_COUNTRY_IE,
Dmitry Shmidt97672262014-02-03 13:02:54 -080055 REGDOM_BEACON_HINT,
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -080056};
57
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080058/**
59 * enum reg_type - Regulatory change types
60 */
Dmitry Shmidt7dba0e52014-04-14 10:49:15 -070061enum reg_type {
62 REGDOM_TYPE_UNKNOWN,
63 REGDOM_TYPE_COUNTRY,
64 REGDOM_TYPE_WORLD,
65 REGDOM_TYPE_CUSTOM_WORLD,
66 REGDOM_TYPE_INTERSECTION,
67};
68
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070069/**
70 * struct hostapd_channel_data - Channel information
71 */
72struct hostapd_channel_data {
73 /**
74 * chan - Channel number (IEEE 802.11)
75 */
76 short chan;
77
78 /**
79 * freq - Frequency in MHz
80 */
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080081 int freq;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070082
83 /**
84 * flag - Channel flags (HOSTAPD_CHAN_*)
85 */
86 int flag;
87
88 /**
Dmitry Shmidt68d0e3e2013-10-28 17:59:21 -070089 * max_tx_power - Regulatory transmit power limit in dBm
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070090 */
91 u8 max_tx_power;
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -070092
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080093 /**
94 * survey_list - Linked list of surveys (struct freq_survey)
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -070095 */
96 struct dl_list survey_list;
97
98 /**
99 * min_nf - Minimum observed noise floor, in dBm, based on all
100 * surveyed channel data
101 */
102 s8 min_nf;
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700103
104#ifdef CONFIG_ACS
105 /**
106 * interference_factor - Computed interference factor on this
107 * channel (used internally in src/ap/acs.c; driver wrappers do not
108 * need to set this)
109 */
110 long double interference_factor;
111#endif /* CONFIG_ACS */
Dmitry Shmidtdf5a7e42014-04-02 12:59:59 -0700112
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800113 /**
114 * dfs_cac_ms - DFS CAC time in milliseconds
115 */
Dmitry Shmidtdf5a7e42014-04-02 12:59:59 -0700116 unsigned int dfs_cac_ms;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700117};
118
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800119#define HOSTAPD_MODE_FLAG_HT_INFO_KNOWN BIT(0)
Dmitry Shmidtc2ebb4b2013-07-24 12:57:51 -0700120#define HOSTAPD_MODE_FLAG_VHT_INFO_KNOWN BIT(1)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800121
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700122/**
123 * struct hostapd_hw_modes - Supported hardware mode information
124 */
125struct hostapd_hw_modes {
126 /**
127 * mode - Hardware mode
128 */
129 enum hostapd_hw_mode mode;
130
131 /**
132 * num_channels - Number of entries in the channels array
133 */
134 int num_channels;
135
136 /**
137 * channels - Array of supported channels
138 */
139 struct hostapd_channel_data *channels;
140
141 /**
142 * num_rates - Number of entries in the rates array
143 */
144 int num_rates;
145
146 /**
147 * rates - Array of supported rates in 100 kbps units
148 */
149 int *rates;
150
151 /**
152 * ht_capab - HT (IEEE 802.11n) capabilities
153 */
154 u16 ht_capab;
155
156 /**
157 * mcs_set - MCS (IEEE 802.11n) rate parameters
158 */
159 u8 mcs_set[16];
160
161 /**
162 * a_mpdu_params - A-MPDU (IEEE 802.11n) parameters
163 */
164 u8 a_mpdu_params;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800165
Dmitry Shmidt04949592012-07-19 12:16:46 -0700166 /**
167 * vht_capab - VHT (IEEE 802.11ac) capabilities
168 */
169 u32 vht_capab;
170
171 /**
172 * vht_mcs_set - VHT MCS (IEEE 802.11ac) rate parameters
173 */
174 u8 vht_mcs_set[8];
175
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800176 unsigned int flags; /* HOSTAPD_MODE_FLAG_* */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700177};
178
179
180#define IEEE80211_MODE_INFRA 0
181#define IEEE80211_MODE_IBSS 1
182#define IEEE80211_MODE_AP 2
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800183#define IEEE80211_MODE_MESH 5
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700184
185#define IEEE80211_CAP_ESS 0x0001
186#define IEEE80211_CAP_IBSS 0x0002
187#define IEEE80211_CAP_PRIVACY 0x0010
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800188#define IEEE80211_CAP_RRM 0x1000
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700189
Dmitry Shmidtf8623282013-02-20 14:34:59 -0800190/* DMG (60 GHz) IEEE 802.11ad */
191/* type - bits 0..1 */
192#define IEEE80211_CAP_DMG_MASK 0x0003
193#define IEEE80211_CAP_DMG_IBSS 0x0001 /* Tx by: STA */
194#define IEEE80211_CAP_DMG_PBSS 0x0002 /* Tx by: PCP */
195#define IEEE80211_CAP_DMG_AP 0x0003 /* Tx by: AP */
196
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700197#define WPA_SCAN_QUAL_INVALID BIT(0)
198#define WPA_SCAN_NOISE_INVALID BIT(1)
199#define WPA_SCAN_LEVEL_INVALID BIT(2)
200#define WPA_SCAN_LEVEL_DBM BIT(3)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700201#define WPA_SCAN_ASSOCIATED BIT(5)
202
203/**
204 * struct wpa_scan_res - Scan result for an BSS/IBSS
205 * @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
206 * @bssid: BSSID
207 * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
208 * @beacon_int: beacon interval in TUs (host byte order)
209 * @caps: capability information field in host byte order
210 * @qual: signal quality
211 * @noise: noise level
212 * @level: signal level
213 * @tsf: Timestamp
214 * @age: Age of the information in milliseconds (i.e., how many milliseconds
215 * ago the last Beacon or Probe Response frame was received)
216 * @ie_len: length of the following IE field in octets
217 * @beacon_ie_len: length of the following Beacon IE field in octets
218 *
219 * This structure is used as a generic format for scan results from the
220 * driver. Each driver interface implementation is responsible for converting
221 * the driver or OS specific scan results into this format.
222 *
223 * If the driver does not support reporting all IEs, the IE data structure is
224 * constructed of the IEs that are available. This field will also need to
225 * include SSID in IE format. All drivers are encouraged to be extended to
226 * report all IEs to make it easier to support future additions.
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800227 *
228 * This structure data is followed by ie_len octets of IEs from Probe Response
229 * frame (or if the driver does not indicate source of IEs, these may also be
230 * from Beacon frame). After the first set of IEs, another set of IEs may follow
231 * (with beacon_ie_len octets of data) if the driver provides both IE sets.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700232 */
233struct wpa_scan_res {
234 unsigned int flags;
235 u8 bssid[ETH_ALEN];
236 int freq;
237 u16 beacon_int;
238 u16 caps;
239 int qual;
240 int noise;
241 int level;
242 u64 tsf;
243 unsigned int age;
244 size_t ie_len;
245 size_t beacon_ie_len;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800246 /* Followed by ie_len + beacon_ie_len octets of IE data */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700247};
248
249/**
250 * struct wpa_scan_results - Scan results
251 * @res: Array of pointers to allocated variable length scan result entries
252 * @num: Number of entries in the scan result array
Dmitry Shmidtf8623282013-02-20 14:34:59 -0800253 * @fetch_time: Time when the results were fetched from the driver
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700254 */
255struct wpa_scan_results {
256 struct wpa_scan_res **res;
257 size_t num;
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800258 struct os_reltime fetch_time;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700259};
260
261/**
262 * struct wpa_interface_info - Network interface information
263 * @next: Pointer to the next interface or NULL if this is the last one
264 * @ifname: Interface name that can be used with init() or init2()
265 * @desc: Human readable adapter description (e.g., vendor/model) or NULL if
266 * not available
267 * @drv_name: struct wpa_driver_ops::name (note: unlike other strings, this one
268 * is not an allocated copy, i.e., get_interfaces() caller will not free
269 * this)
270 */
271struct wpa_interface_info {
272 struct wpa_interface_info *next;
273 char *ifname;
274 char *desc;
275 const char *drv_name;
276};
277
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800278#define WPAS_MAX_SCAN_SSIDS 16
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700279
280/**
281 * struct wpa_driver_scan_params - Scan parameters
282 * Data for struct wpa_driver_ops::scan2().
283 */
284struct wpa_driver_scan_params {
285 /**
286 * ssids - SSIDs to scan for
287 */
288 struct wpa_driver_scan_ssid {
289 /**
290 * ssid - specific SSID to scan for (ProbeReq)
291 * %NULL or zero-length SSID is used to indicate active scan
292 * with wildcard SSID.
293 */
294 const u8 *ssid;
295 /**
296 * ssid_len: Length of the SSID in octets
297 */
298 size_t ssid_len;
299 } ssids[WPAS_MAX_SCAN_SSIDS];
300
301 /**
302 * num_ssids - Number of entries in ssids array
303 * Zero indicates a request for a passive scan.
304 */
305 size_t num_ssids;
306
307 /**
308 * extra_ies - Extra IE(s) to add into Probe Request or %NULL
309 */
310 const u8 *extra_ies;
311
312 /**
313 * extra_ies_len - Length of extra_ies in octets
314 */
315 size_t extra_ies_len;
316
317 /**
318 * freqs - Array of frequencies to scan or %NULL for all frequencies
319 *
320 * The frequency is set in MHz. The array is zero-terminated.
321 */
322 int *freqs;
323
324 /**
325 * filter_ssids - Filter for reporting SSIDs
326 *
327 * This optional parameter can be used to request the driver wrapper to
328 * filter scan results to include only the specified SSIDs. %NULL
329 * indicates that no filtering is to be done. This can be used to
330 * reduce memory needs for scan results in environments that have large
331 * number of APs with different SSIDs.
332 *
333 * The driver wrapper is allowed to take this allocated buffer into its
334 * own use by setting the pointer to %NULL. In that case, the driver
335 * wrapper is responsible for freeing the buffer with os_free() once it
336 * is not needed anymore.
337 */
338 struct wpa_driver_scan_filter {
339 u8 ssid[32];
340 size_t ssid_len;
341 } *filter_ssids;
342
343 /**
344 * num_filter_ssids - Number of entries in filter_ssids array
345 */
346 size_t num_filter_ssids;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800347
348 /**
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700349 * filter_rssi - Filter by RSSI
350 *
351 * The driver may filter scan results in firmware to reduce host
352 * wakeups and thereby save power. Specify the RSSI threshold in s32
353 * dBm.
354 */
355 s32 filter_rssi;
356
357 /**
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800358 * p2p_probe - Used to disable CCK (802.11b) rates for P2P probes
359 *
360 * When set, the driver is expected to remove rates 1, 2, 5.5, and 11
361 * Mbps from the support rates element(s) in the Probe Request frames
362 * and not to transmit the frames at any of those rates.
363 */
Dmitry Shmidt2271d3f2014-06-23 12:16:31 -0700364 unsigned int p2p_probe:1;
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800365
366 /**
367 * only_new_results - Request driver to report only new results
368 *
369 * This is used to request the driver to report only BSSes that have
370 * been detected after this scan request has been started, i.e., to
371 * flush old cached BSS entries.
372 */
Dmitry Shmidt2271d3f2014-06-23 12:16:31 -0700373 unsigned int only_new_results:1;
374
375 /**
376 * low_priority - Requests driver to use a lower scan priority
377 *
378 * This is used to request the driver to use a lower scan priority
379 * if it supports such a thing.
380 */
381 unsigned int low_priority:1;
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800382
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800383 /**
384 * mac_addr_rand - Requests driver to randomize MAC address
385 */
386 unsigned int mac_addr_rand:1;
387
388 /**
389 * mac_addr - MAC address used with randomization. The address cannot be
390 * a multicast one, i.e., bit 0 of byte 0 should not be set.
391 */
392 const u8 *mac_addr;
393
394 /**
395 * mac_addr_mask - MAC address mask used with randomization.
396 *
397 * Bits that are 0 in the mask should be randomized. Bits that are 1 in
398 * the mask should be taken as is from mac_addr. The mask should not
399 * allow the generation of a multicast address, i.e., bit 0 of byte 0
400 * must be set.
401 */
402 const u8 *mac_addr_mask;
403
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800404 /*
405 * NOTE: Whenever adding new parameters here, please make sure
406 * wpa_scan_clone_params() and wpa_scan_free_params() get updated with
407 * matching changes.
408 */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700409};
410
411/**
412 * struct wpa_driver_auth_params - Authentication parameters
413 * Data for struct wpa_driver_ops::authenticate().
414 */
415struct wpa_driver_auth_params {
416 int freq;
417 const u8 *bssid;
418 const u8 *ssid;
419 size_t ssid_len;
420 int auth_alg;
421 const u8 *ie;
422 size_t ie_len;
423 const u8 *wep_key[4];
424 size_t wep_key_len[4];
425 int wep_tx_keyidx;
426 int local_state_change;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800427
428 /**
429 * p2p - Whether this connection is a P2P group
430 */
431 int p2p;
432
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800433 /**
434 * sae_data - SAE elements for Authentication frame
435 *
436 * This buffer starts with the Authentication transaction sequence
437 * number field. If SAE is not used, this pointer is %NULL.
438 */
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800439 const u8 *sae_data;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800440
441 /**
442 * sae_data_len - Length of sae_data buffer in octets
443 */
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800444 size_t sae_data_len;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700445};
446
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800447/**
448 * enum wps_mode - WPS mode
449 */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700450enum wps_mode {
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800451 /**
452 * WPS_MODE_NONE - No WPS provisioning being used
453 */
454 WPS_MODE_NONE,
455
456 /**
457 * WPS_MODE_OPEN - WPS provisioning with AP that is in open mode
458 */
459 WPS_MODE_OPEN,
460
461 /**
462 * WPS_MODE_PRIVACY - WPS provisioning with AP that is using protection
463 */
464 WPS_MODE_PRIVACY
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700465};
466
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800467/**
468 * struct hostapd_freq_params - Channel parameters
469 */
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -0700470struct hostapd_freq_params {
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800471 /**
472 * mode - Mode/band (HOSTAPD_MODE_IEEE80211A, ..)
473 */
474 enum hostapd_hw_mode mode;
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -0700475
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800476 /**
477 * freq - Primary channel center frequency in MHz
478 */
479 int freq;
480
481 /**
482 * channel - Channel number
483 */
484 int channel;
485
486 /**
487 * ht_enabled - Whether HT is enabled
488 */
489 int ht_enabled;
490
491 /**
492 * sec_channel_offset - Secondary channel offset for HT40
493 *
494 * 0 = HT40 disabled,
495 * -1 = HT40 enabled, secondary channel below primary,
496 * 1 = HT40 enabled, secondary channel above primary
497 */
498 int sec_channel_offset;
499
500 /**
501 * vht_enabled - Whether VHT is enabled
502 */
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -0700503 int vht_enabled;
504
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800505 /**
506 * center_freq1 - Segment 0 center frequency in MHz
507 *
508 * Valid for both HT and VHT.
509 */
510 int center_freq1;
511
512 /**
513 * center_freq2 - Segment 1 center frequency in MHz
514 *
515 * Non-zero only for bandwidth 80 and an 80+80 channel
516 */
517 int center_freq2;
518
519 /**
520 * bandwidth - Channel bandwidth in MHz (20, 40, 80, 160)
521 */
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -0700522 int bandwidth;
523};
524
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700525/**
526 * struct wpa_driver_associate_params - Association parameters
527 * Data for struct wpa_driver_ops::associate().
528 */
529struct wpa_driver_associate_params {
530 /**
531 * bssid - BSSID of the selected AP
532 * This can be %NULL, if ap_scan=2 mode is used and the driver is
533 * responsible for selecting with which BSS to associate. */
534 const u8 *bssid;
535
536 /**
Dmitry Shmidt96be6222014-02-13 10:16:51 -0800537 * bssid_hint - BSSID of a proposed AP
538 *
539 * This indicates which BSS has been found a suitable candidate for
540 * initial association for drivers that use driver/firmwate-based BSS
541 * selection. Unlike the @bssid parameter, @bssid_hint does not limit
542 * the driver from selecting other BSSes in the ESS.
543 */
544 const u8 *bssid_hint;
545
546 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700547 * ssid - The selected SSID
548 */
549 const u8 *ssid;
550
551 /**
552 * ssid_len - Length of the SSID (1..32)
553 */
554 size_t ssid_len;
555
556 /**
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -0700557 * freq - channel parameters
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700558 */
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -0700559 struct hostapd_freq_params freq;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700560
561 /**
Dmitry Shmidt96be6222014-02-13 10:16:51 -0800562 * freq_hint - Frequency of the channel the proposed AP is using
563 *
564 * This provides a channel on which a suitable BSS has been found as a
565 * hint for the driver. Unlike the @freq parameter, @freq_hint does not
566 * limit the driver from selecting other channels for
567 * driver/firmware-based BSS selection.
568 */
569 int freq_hint;
570
571 /**
Dmitry Shmidt04949592012-07-19 12:16:46 -0700572 * bg_scan_period - Background scan period in seconds, 0 to disable
573 * background scan, or -1 to indicate no change to default driver
574 * configuration
575 */
576 int bg_scan_period;
577
578 /**
Dmitry Shmidt2ac5f602014-03-07 10:08:21 -0800579 * beacon_int - Beacon interval for IBSS or 0 to use driver default
580 */
581 int beacon_int;
582
583 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700584 * wpa_ie - WPA information element for (Re)Association Request
585 * WPA information element to be included in (Re)Association
586 * Request (including information element id and length). Use
587 * of this WPA IE is optional. If the driver generates the WPA
588 * IE, it can use pairwise_suite, group_suite, and
589 * key_mgmt_suite to select proper algorithms. In this case,
590 * the driver has to notify wpa_supplicant about the used WPA
591 * IE by generating an event that the interface code will
592 * convert into EVENT_ASSOCINFO data (see below).
593 *
594 * When using WPA2/IEEE 802.11i, wpa_ie is used for RSN IE
595 * instead. The driver can determine which version is used by
596 * looking at the first byte of the IE (0xdd for WPA, 0x30 for
597 * WPA2/RSN).
598 *
599 * When using WPS, wpa_ie is used for WPS IE instead of WPA/RSN IE.
600 */
601 const u8 *wpa_ie;
602
603 /**
604 * wpa_ie_len - length of the wpa_ie
605 */
606 size_t wpa_ie_len;
607
608 /**
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800609 * wpa_proto - Bitfield of WPA_PROTO_* values to indicate WPA/WPA2
610 */
611 unsigned int wpa_proto;
612
613 /**
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800614 * pairwise_suite - Selected pairwise cipher suite (WPA_CIPHER_*)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700615 *
616 * This is usually ignored if @wpa_ie is used.
617 */
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800618 unsigned int pairwise_suite;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700619
620 /**
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800621 * group_suite - Selected group cipher suite (WPA_CIPHER_*)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700622 *
623 * This is usually ignored if @wpa_ie is used.
624 */
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800625 unsigned int group_suite;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700626
627 /**
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800628 * key_mgmt_suite - Selected key management suite (WPA_KEY_MGMT_*)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700629 *
630 * This is usually ignored if @wpa_ie is used.
631 */
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800632 unsigned int key_mgmt_suite;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700633
634 /**
635 * auth_alg - Allowed authentication algorithms
636 * Bit field of WPA_AUTH_ALG_*
637 */
638 int auth_alg;
639
640 /**
641 * mode - Operation mode (infra/ibss) IEEE80211_MODE_*
642 */
643 int mode;
644
645 /**
646 * wep_key - WEP keys for static WEP configuration
647 */
648 const u8 *wep_key[4];
649
650 /**
651 * wep_key_len - WEP key length for static WEP configuration
652 */
653 size_t wep_key_len[4];
654
655 /**
656 * wep_tx_keyidx - WEP TX key index for static WEP configuration
657 */
658 int wep_tx_keyidx;
659
660 /**
661 * mgmt_frame_protection - IEEE 802.11w management frame protection
662 */
663 enum mfp_options mgmt_frame_protection;
664
665 /**
666 * ft_ies - IEEE 802.11r / FT information elements
667 * If the supplicant is using IEEE 802.11r (FT) and has the needed keys
668 * for fast transition, this parameter is set to include the IEs that
669 * are to be sent in the next FT Authentication Request message.
670 * update_ft_ies() handler is called to update the IEs for further
671 * FT messages in the sequence.
672 *
673 * The driver should use these IEs only if the target AP is advertising
674 * the same mobility domain as the one included in the MDIE here.
675 *
676 * In ap_scan=2 mode, the driver can use these IEs when moving to a new
677 * AP after the initial association. These IEs can only be used if the
678 * target AP is advertising support for FT and is using the same MDIE
679 * and SSID as the current AP.
680 *
681 * The driver is responsible for reporting the FT IEs received from the
682 * AP's response using wpa_supplicant_event() with EVENT_FT_RESPONSE
683 * type. update_ft_ies() handler will then be called with the FT IEs to
684 * include in the next frame in the authentication sequence.
685 */
686 const u8 *ft_ies;
687
688 /**
689 * ft_ies_len - Length of ft_ies in bytes
690 */
691 size_t ft_ies_len;
692
693 /**
694 * ft_md - FT Mobility domain (6 octets) (also included inside ft_ies)
695 *
696 * This value is provided to allow the driver interface easier access
697 * to the current mobility domain. This value is set to %NULL if no
698 * mobility domain is currently active.
699 */
700 const u8 *ft_md;
701
702 /**
703 * passphrase - RSN passphrase for PSK
704 *
705 * This value is made available only for WPA/WPA2-Personal (PSK) and
706 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
707 * the 8..63 character ASCII passphrase, if available. Please note that
708 * this can be %NULL if passphrase was not used to generate the PSK. In
709 * that case, the psk field must be used to fetch the PSK.
710 */
711 const char *passphrase;
712
713 /**
714 * psk - RSN PSK (alternative for passphrase for PSK)
715 *
716 * This value is made available only for WPA/WPA2-Personal (PSK) and
717 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
718 * the 32-octet (256-bit) PSK, if available. The driver wrapper should
719 * be prepared to handle %NULL value as an error.
720 */
721 const u8 *psk;
722
723 /**
724 * drop_unencrypted - Enable/disable unencrypted frame filtering
725 *
726 * Configure the driver to drop all non-EAPOL frames (both receive and
727 * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
728 * still be allowed for key negotiation.
729 */
730 int drop_unencrypted;
731
732 /**
733 * prev_bssid - Previously used BSSID in this ESS
734 *
735 * When not %NULL, this is a request to use reassociation instead of
736 * association.
737 */
738 const u8 *prev_bssid;
739
740 /**
741 * wps - WPS mode
742 *
743 * If the driver needs to do special configuration for WPS association,
744 * this variable provides more information on what type of association
745 * is being requested. Most drivers should not need ot use this.
746 */
747 enum wps_mode wps;
748
749 /**
750 * p2p - Whether this connection is a P2P group
751 */
752 int p2p;
753
754 /**
755 * uapsd - UAPSD parameters for the network
756 * -1 = do not change defaults
757 * AP mode: 1 = enabled, 0 = disabled
758 * STA mode: bits 0..3 UAPSD enabled for VO,VI,BK,BE
759 */
760 int uapsd;
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -0800761
762 /**
763 * fixed_bssid - Whether to force this BSSID in IBSS mode
764 * 1 = Fix this BSSID and prevent merges.
765 * 0 = Do not fix BSSID.
766 */
767 int fixed_bssid;
768
769 /**
770 * disable_ht - Disable HT (IEEE 802.11n) for this connection
771 */
772 int disable_ht;
773
774 /**
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800775 * htcaps - HT Capabilities over-rides
776 *
777 * Only bits set in the mask will be used, and not all values are used
778 * by the kernel anyway. Currently, MCS, MPDU and MSDU fields are used.
779 *
780 * Pointer to struct ieee80211_ht_capabilities.
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -0800781 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800782 const u8 *htcaps;
783
784 /**
785 * htcaps_mask - HT Capabilities over-rides mask
786 *
787 * Pointer to struct ieee80211_ht_capabilities.
788 */
789 const u8 *htcaps_mask;
Dmitry Shmidt2f023192013-03-12 12:44:17 -0700790
791#ifdef CONFIG_VHT_OVERRIDES
792 /**
793 * disable_vht - Disable VHT for this connection
794 */
795 int disable_vht;
796
797 /**
798 * VHT capability overrides.
799 */
800 const struct ieee80211_vht_capabilities *vhtcaps;
801 const struct ieee80211_vht_capabilities *vhtcaps_mask;
802#endif /* CONFIG_VHT_OVERRIDES */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800803
804 /**
805 * req_key_mgmt_offload - Request key management offload for connection
806 *
807 * Request key management offload for this connection if the device
808 * supports it.
809 */
810 int req_key_mgmt_offload;
811
812 /**
813 * Flag for indicating whether this association includes support for
814 * RRM (Radio Resource Measurements)
815 */
816 int rrm_used;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700817};
818
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800819enum hide_ssid {
820 NO_SSID_HIDING,
821 HIDDEN_SSID_ZERO_LEN,
822 HIDDEN_SSID_ZERO_CONTENTS
823};
824
Dmitry Shmidtb58836e2014-04-29 14:35:56 -0700825struct wowlan_triggers {
826 u8 any;
827 u8 disconnect;
828 u8 magic_pkt;
829 u8 gtk_rekey_failure;
830 u8 eap_identity_req;
831 u8 four_way_handshake;
832 u8 rfkill_release;
833};
834
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800835struct wpa_driver_ap_params {
836 /**
837 * head - Beacon head from IEEE 802.11 header to IEs before TIM IE
838 */
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800839 u8 *head;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800840
841 /**
842 * head_len - Length of the head buffer in octets
843 */
844 size_t head_len;
845
846 /**
847 * tail - Beacon tail following TIM IE
848 */
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800849 u8 *tail;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800850
851 /**
852 * tail_len - Length of the tail buffer in octets
853 */
854 size_t tail_len;
855
856 /**
857 * dtim_period - DTIM period
858 */
859 int dtim_period;
860
861 /**
862 * beacon_int - Beacon interval
863 */
864 int beacon_int;
865
866 /**
867 * basic_rates: -1 terminated array of basic rates in 100 kbps
868 *
869 * This parameter can be used to set a specific basic rate set for the
870 * BSS. If %NULL, default basic rate set is used.
871 */
872 int *basic_rates;
873
874 /**
875 * proberesp - Probe Response template
876 *
877 * This is used by drivers that reply to Probe Requests internally in
878 * AP mode and require the full Probe Response template.
879 */
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800880 u8 *proberesp;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800881
882 /**
883 * proberesp_len - Length of the proberesp buffer in octets
884 */
885 size_t proberesp_len;
886
887 /**
888 * ssid - The SSID to use in Beacon/Probe Response frames
889 */
890 const u8 *ssid;
891
892 /**
893 * ssid_len - Length of the SSID (1..32)
894 */
895 size_t ssid_len;
896
897 /**
898 * hide_ssid - Whether to hide the SSID
899 */
900 enum hide_ssid hide_ssid;
901
902 /**
903 * pairwise_ciphers - WPA_CIPHER_* bitfield
904 */
905 unsigned int pairwise_ciphers;
906
907 /**
908 * group_cipher - WPA_CIPHER_*
909 */
910 unsigned int group_cipher;
911
912 /**
913 * key_mgmt_suites - WPA_KEY_MGMT_* bitfield
914 */
915 unsigned int key_mgmt_suites;
916
917 /**
918 * auth_algs - WPA_AUTH_ALG_* bitfield
919 */
920 unsigned int auth_algs;
921
922 /**
923 * wpa_version - WPA_PROTO_* bitfield
924 */
925 unsigned int wpa_version;
926
927 /**
928 * privacy - Whether privacy is used in the BSS
929 */
930 int privacy;
931
932 /**
933 * beacon_ies - WPS/P2P IE(s) for Beacon frames
934 *
935 * This is used to add IEs like WPS IE and P2P IE by drivers that do
936 * not use the full Beacon template.
937 */
938 const struct wpabuf *beacon_ies;
939
940 /**
941 * proberesp_ies - P2P/WPS IE(s) for Probe Response frames
942 *
943 * This is used to add IEs like WPS IE and P2P IE by drivers that
944 * reply to Probe Request frames internally.
945 */
946 const struct wpabuf *proberesp_ies;
947
948 /**
949 * assocresp_ies - WPS IE(s) for (Re)Association Response frames
950 *
951 * This is used to add IEs like WPS IE by drivers that reply to
952 * (Re)Association Request frames internally.
953 */
954 const struct wpabuf *assocresp_ies;
955
956 /**
957 * isolate - Whether to isolate frames between associated stations
958 *
959 * If this is non-zero, the AP is requested to disable forwarding of
960 * frames between associated stations.
961 */
962 int isolate;
963
964 /**
965 * cts_protect - Whether CTS protection is enabled
966 */
967 int cts_protect;
968
969 /**
970 * preamble - Whether short preamble is enabled
971 */
972 int preamble;
973
974 /**
975 * short_slot_time - Whether short slot time is enabled
976 *
977 * 0 = short slot time disable, 1 = short slot time enabled, -1 = do
978 * not set (e.g., when 802.11g mode is not in use)
979 */
980 int short_slot_time;
981
982 /**
983 * ht_opmode - HT operation mode or -1 if HT not in use
984 */
985 int ht_opmode;
986
987 /**
988 * interworking - Whether Interworking is enabled
989 */
990 int interworking;
991
992 /**
993 * hessid - Homogeneous ESS identifier or %NULL if not set
994 */
995 const u8 *hessid;
996
997 /**
998 * access_network_type - Access Network Type (0..15)
999 *
1000 * This is used for filtering Probe Request frames when Interworking is
1001 * enabled.
1002 */
1003 u8 access_network_type;
Dmitry Shmidt04949592012-07-19 12:16:46 -07001004
1005 /**
1006 * ap_max_inactivity - Timeout in seconds to detect STA's inactivity
1007 *
1008 * This is used by driver which advertises this capability.
1009 */
1010 int ap_max_inactivity;
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07001011
1012 /**
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001013 * smps_mode - SMPS mode
1014 *
1015 * SMPS mode to be used by the AP, specified as the relevant bits of
1016 * ht_capab (i.e. HT_CAP_INFO_SMPS_*).
1017 */
1018 unsigned int smps_mode;
1019
1020 /**
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07001021 * disable_dgaf - Whether group-addressed frames are disabled
1022 */
1023 int disable_dgaf;
Dmitry Shmidtf21452a2014-02-26 10:55:25 -08001024
1025 /**
1026 * osen - Whether OSEN security is enabled
1027 */
1028 int osen;
Dmitry Shmidt7832adb2014-04-29 10:53:02 -07001029
1030 /**
1031 * freq - Channel parameters for dynamic bandwidth changes
1032 */
1033 struct hostapd_freq_params *freq;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001034};
1035
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001036struct wpa_driver_mesh_bss_params {
1037#define WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS 0x00000001
1038 /*
1039 * TODO: Other mesh configuration parameters would go here.
1040 * See NL80211_MESHCONF_* for all the mesh config parameters.
1041 */
1042 unsigned int flags;
Dmitry Shmidt2f74e362015-01-21 13:19:05 -08001043 int peer_link_timeout;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001044};
1045
1046struct wpa_driver_mesh_join_params {
1047 const u8 *meshid;
1048 int meshid_len;
1049 const int *basic_rates;
1050 const u8 *ies;
1051 int ie_len;
Dmitry Shmidtff787d52015-01-12 13:01:47 -08001052 struct hostapd_freq_params freq;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001053 int beacon_int;
1054 int max_peer_links;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001055 struct wpa_driver_mesh_bss_params conf;
1056#define WPA_DRIVER_MESH_FLAG_USER_MPM 0x00000001
1057#define WPA_DRIVER_MESH_FLAG_DRIVER_MPM 0x00000002
1058#define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004
1059#define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008
1060 unsigned int flags;
1061};
1062
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001063/**
1064 * struct wpa_driver_capa - Driver capability information
1065 */
1066struct wpa_driver_capa {
1067#define WPA_DRIVER_CAPA_KEY_MGMT_WPA 0x00000001
1068#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2 0x00000002
1069#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK 0x00000004
1070#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK 0x00000008
1071#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE 0x00000010
1072#define WPA_DRIVER_CAPA_KEY_MGMT_FT 0x00000020
1073#define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK 0x00000040
Dmitry Shmidtd5e49232012-12-03 15:08:10 -08001074#define WPA_DRIVER_CAPA_KEY_MGMT_WAPI_PSK 0x00000080
Dmitry Shmidt807291d2015-01-27 13:40:23 -08001075#define WPA_DRIVER_CAPA_KEY_MGMT_SUITE_B 0x00000100
1076#define WPA_DRIVER_CAPA_KEY_MGMT_SUITE_B_192 0x00000200
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001077 /** Bitfield of supported key management suites */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001078 unsigned int key_mgmt;
1079
1080#define WPA_DRIVER_CAPA_ENC_WEP40 0x00000001
1081#define WPA_DRIVER_CAPA_ENC_WEP104 0x00000002
1082#define WPA_DRIVER_CAPA_ENC_TKIP 0x00000004
1083#define WPA_DRIVER_CAPA_ENC_CCMP 0x00000008
Dmitry Shmidt04949592012-07-19 12:16:46 -07001084#define WPA_DRIVER_CAPA_ENC_WEP128 0x00000010
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07001085#define WPA_DRIVER_CAPA_ENC_GCMP 0x00000020
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08001086#define WPA_DRIVER_CAPA_ENC_GCMP_256 0x00000040
1087#define WPA_DRIVER_CAPA_ENC_CCMP_256 0x00000080
1088#define WPA_DRIVER_CAPA_ENC_BIP 0x00000100
1089#define WPA_DRIVER_CAPA_ENC_BIP_GMAC_128 0x00000200
1090#define WPA_DRIVER_CAPA_ENC_BIP_GMAC_256 0x00000400
1091#define WPA_DRIVER_CAPA_ENC_BIP_CMAC_256 0x00000800
Dmitry Shmidtf21452a2014-02-26 10:55:25 -08001092#define WPA_DRIVER_CAPA_ENC_GTK_NOT_USED 0x00001000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001093 /** Bitfield of supported cipher suites */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001094 unsigned int enc;
1095
1096#define WPA_DRIVER_AUTH_OPEN 0x00000001
1097#define WPA_DRIVER_AUTH_SHARED 0x00000002
1098#define WPA_DRIVER_AUTH_LEAP 0x00000004
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001099 /** Bitfield of supported IEEE 802.11 authentication algorithms */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001100 unsigned int auth;
1101
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001102/** Driver generated WPA/RSN IE */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001103#define WPA_DRIVER_FLAGS_DRIVER_IE 0x00000001
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001104/** Driver needs static WEP key setup after association command */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001105#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001106/** Driver takes care of all DFS operations */
Dmitry Shmidtd11f0192014-03-24 12:09:47 -07001107#define WPA_DRIVER_FLAGS_DFS_OFFLOAD 0x00000004
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001108/** Driver takes care of RSN 4-way handshake internally; PMK is configured with
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001109 * struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */
1110#define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE 0x00000008
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001111/** Driver is for a wired Ethernet interface */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001112#define WPA_DRIVER_FLAGS_WIRED 0x00000010
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001113/** Driver provides separate commands for authentication and association (SME in
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001114 * wpa_supplicant). */
1115#define WPA_DRIVER_FLAGS_SME 0x00000020
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001116/** Driver supports AP mode */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001117#define WPA_DRIVER_FLAGS_AP 0x00000040
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001118/** Driver needs static WEP key setup after association has been completed */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001119#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE 0x00000080
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001120/** Driver supports dynamic HT 20/40 MHz channel changes during BSS lifetime */
Dmitry Shmidt7832adb2014-04-29 10:53:02 -07001121#define WPA_DRIVER_FLAGS_HT_2040_COEX 0x00000100
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001122/** Driver supports concurrent P2P operations */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001123#define WPA_DRIVER_FLAGS_P2P_CONCURRENT 0x00000200
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001124/**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001125 * Driver uses the initial interface as a dedicated management interface, i.e.,
1126 * it cannot be used for P2P group operations or non-P2P purposes.
1127 */
1128#define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE 0x00000400
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001129/** This interface is P2P capable (P2P GO or P2P Client) */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001130#define WPA_DRIVER_FLAGS_P2P_CAPABLE 0x00000800
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001131/** Driver supports station and key removal when stopping an AP */
Dmitry Shmidta38abf92014-03-06 13:38:44 -08001132#define WPA_DRIVER_FLAGS_AP_TEARDOWN_SUPPORT 0x00001000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001133/**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001134 * Driver uses the initial interface for P2P management interface and non-P2P
1135 * purposes (e.g., connect to infra AP), but this interface cannot be used for
1136 * P2P group operations.
1137 */
1138#define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P 0x00002000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001139/**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001140 * Driver is known to use sane error codes, i.e., when it indicates that
1141 * something (e.g., association) fails, there was indeed a failure and the
1142 * operation does not end up getting completed successfully later.
1143 */
1144#define WPA_DRIVER_FLAGS_SANE_ERROR_CODES 0x00004000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001145/** Driver supports off-channel TX */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001146#define WPA_DRIVER_FLAGS_OFFCHANNEL_TX 0x00008000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001147/** Driver indicates TX status events for EAPOL Data frames */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001148#define WPA_DRIVER_FLAGS_EAPOL_TX_STATUS 0x00010000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001149/** Driver indicates TX status events for Deauth/Disassoc frames */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001150#define WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS 0x00020000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001151/** Driver supports roaming (BSS selection) in firmware */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001152#define WPA_DRIVER_FLAGS_BSS_SELECTION 0x00040000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001153/** Driver supports operating as a TDLS peer */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001154#define WPA_DRIVER_FLAGS_TDLS_SUPPORT 0x00080000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001155/** Driver requires external TDLS setup/teardown/discovery */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001156#define WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP 0x00100000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001157/** Driver indicates support for Probe Response offloading in AP mode */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001158#define WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD 0x00200000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001159/** Driver supports U-APSD in AP mode */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001160#define WPA_DRIVER_FLAGS_AP_UAPSD 0x00400000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001161/** Driver supports inactivity timer in AP mode */
Dmitry Shmidt04949592012-07-19 12:16:46 -07001162#define WPA_DRIVER_FLAGS_INACTIVITY_TIMER 0x00800000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001163/** Driver expects user space implementation of MLME in AP mode */
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07001164#define WPA_DRIVER_FLAGS_AP_MLME 0x01000000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001165/** Driver supports SAE with user space SME */
Dmitry Shmidtd5e49232012-12-03 15:08:10 -08001166#define WPA_DRIVER_FLAGS_SAE 0x02000000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001167/** Driver makes use of OBSS scan mechanism in wpa_supplicant */
Dmitry Shmidtd5e49232012-12-03 15:08:10 -08001168#define WPA_DRIVER_FLAGS_OBSS_SCAN 0x04000000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001169/** Driver supports IBSS (Ad-hoc) mode */
Dmitry Shmidt700a1372013-03-15 14:14:44 -07001170#define WPA_DRIVER_FLAGS_IBSS 0x08000000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001171/** Driver supports radar detection */
Dmitry Shmidtea69e842013-05-13 14:52:28 -07001172#define WPA_DRIVER_FLAGS_RADAR 0x10000000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001173/** Driver supports a dedicated interface for P2P Device */
Dmitry Shmidt34af3062013-07-11 10:46:32 -07001174#define WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE 0x20000000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001175/** Driver supports QoS Mapping */
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08001176#define WPA_DRIVER_FLAGS_QOS_MAPPING 0x40000000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001177/** Driver supports CSA in AP mode */
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08001178#define WPA_DRIVER_FLAGS_AP_CSA 0x80000000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001179/** Driver supports mesh */
1180#define WPA_DRIVER_FLAGS_MESH 0x0000000100000000ULL
1181/** Driver support ACS offload */
1182#define WPA_DRIVER_FLAGS_ACS_OFFLOAD 0x0000000200000000ULL
1183/** Driver supports key management offload */
1184#define WPA_DRIVER_FLAGS_KEY_MGMT_OFFLOAD 0x0000000400000000ULL
1185/** Driver supports TDLS channel switching */
1186#define WPA_DRIVER_FLAGS_TDLS_CHANNEL_SWITCH 0x0000000800000000ULL
Dmitry Shmidtff787d52015-01-12 13:01:47 -08001187/** Driver supports IBSS with HT datarates */
1188#define WPA_DRIVER_FLAGS_HT_IBSS 0x0000001000000000ULL
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001189 u64 flags;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001190
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001191#define WPA_DRIVER_SMPS_MODE_STATIC 0x00000001
1192#define WPA_DRIVER_SMPS_MODE_DYNAMIC 0x00000002
1193 unsigned int smps_modes;
1194
1195 unsigned int wmm_ac_supported:1;
1196
1197 unsigned int mac_addr_rand_scan_supported:1;
1198 unsigned int mac_addr_rand_sched_scan_supported:1;
1199
1200 /** Maximum number of supported active probe SSIDs */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001201 int max_scan_ssids;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001202
1203 /** Maximum number of supported active probe SSIDs for sched_scan */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001204 int max_sched_scan_ssids;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001205
1206 /** Whether sched_scan (offloaded scanning) is supported */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001207 int sched_scan_supported;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001208
1209 /** Maximum number of supported match sets for sched_scan */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001210 int max_match_sets;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001211
1212 /**
1213 * max_remain_on_chan - Maximum remain-on-channel duration in msec
1214 */
1215 unsigned int max_remain_on_chan;
1216
1217 /**
1218 * max_stations - Maximum number of associated stations the driver
1219 * supports in AP mode
1220 */
1221 unsigned int max_stations;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001222
1223 /**
1224 * probe_resp_offloads - Bitmap of supported protocols by the driver
1225 * for Probe Response offloading.
1226 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001227/** Driver Probe Response offloading support for WPS ver. 1 */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001228#define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS 0x00000001
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001229/** Driver Probe Response offloading support for WPS ver. 2 */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001230#define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS2 0x00000002
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001231/** Driver Probe Response offloading support for P2P */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001232#define WPA_DRIVER_PROBE_RESP_OFFLOAD_P2P 0x00000004
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001233/** Driver Probe Response offloading support for IEEE 802.11u (Interworking) */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001234#define WPA_DRIVER_PROBE_RESP_OFFLOAD_INTERWORKING 0x00000008
1235 unsigned int probe_resp_offloads;
Dmitry Shmidt444d5672013-04-01 13:08:44 -07001236
Dmitry Shmidt8bae4132013-06-06 11:25:10 -07001237 unsigned int max_acl_mac_addrs;
1238
Dmitry Shmidt444d5672013-04-01 13:08:44 -07001239 /**
Dmitry Shmidtc2ebb4b2013-07-24 12:57:51 -07001240 * Number of supported concurrent channels
1241 */
1242 unsigned int num_multichan_concurrent;
1243
1244 /**
Dmitry Shmidt444d5672013-04-01 13:08:44 -07001245 * extended_capa - extended capabilities in driver/device
1246 *
1247 * Must be allocated and freed by driver and the pointers must be
1248 * valid for the lifetime of the driver, i.e., freed in deinit()
1249 */
1250 const u8 *extended_capa, *extended_capa_mask;
1251 unsigned int extended_capa_len;
Dmitry Shmidtb58836e2014-04-29 14:35:56 -07001252
1253 struct wowlan_triggers wowlan_triggers;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001254
1255/** Driver adds the DS Params Set IE in Probe Request frames */
1256#define WPA_DRIVER_FLAGS_DS_PARAM_SET_IE_IN_PROBES 0x00000001
1257/** Driver adds the WFA TPC IE in Probe Request frames */
1258#define WPA_DRIVER_FLAGS_WFA_TPC_IE_IN_PROBES 0x00000002
1259/** Driver handles quiet period requests */
1260#define WPA_DRIVER_FLAGS_QUIET 0x00000004
1261/**
1262 * Driver is capable of inserting the current TX power value into the body of
1263 * transmitted frames.
1264 * Background: Some Action frames include a TPC Report IE. This IE contains a
1265 * TX power field, which has to be updated by lower layers. One such Action
1266 * frame is Link Measurement Report (part of RRM). Another is TPC Report (part
1267 * of spectrum management). Note that this insertion takes place at a fixed
1268 * offset, namely the 6th byte in the Action frame body.
1269 */
1270#define WPA_DRIVER_FLAGS_TX_POWER_INSERTION 0x00000008
1271 u32 rrm_flags;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001272};
1273
1274
1275struct hostapd_data;
1276
1277struct hostap_sta_driver_data {
1278 unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
1279 unsigned long current_tx_rate;
1280 unsigned long inactive_msec;
1281 unsigned long flags;
1282 unsigned long num_ps_buf_frames;
1283 unsigned long tx_retry_failed;
1284 unsigned long tx_retry_count;
1285 int last_rssi;
1286 int last_ack_rssi;
1287};
1288
1289struct hostapd_sta_add_params {
1290 const u8 *addr;
1291 u16 aid;
1292 u16 capability;
1293 const u8 *supp_rates;
1294 size_t supp_rates_len;
1295 u16 listen_interval;
1296 const struct ieee80211_ht_capabilities *ht_capabilities;
Dmitry Shmidta54fa5f2013-01-15 13:53:35 -08001297 const struct ieee80211_vht_capabilities *vht_capabilities;
Dmitry Shmidtbd14a572014-02-18 10:33:49 -08001298 int vht_opmode_enabled;
1299 u8 vht_opmode;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001300 u32 flags; /* bitmask of WPA_STA_* flags */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001301 u32 flags_mask; /* unset bits in flags */
1302#ifdef CONFIG_MESH
1303 enum mesh_plink_state plink_state;
1304#endif /* CONFIG_MESH */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001305 int set; /* Set STA parameters instead of add */
1306 u8 qosinfo;
Dmitry Shmidtf8623282013-02-20 14:34:59 -08001307 const u8 *ext_capab;
1308 size_t ext_capab_len;
Dmitry Shmidt344abd32014-01-14 13:17:00 -08001309 const u8 *supp_channels;
1310 size_t supp_channels_len;
1311 const u8 *supp_oper_classes;
1312 size_t supp_oper_classes_len;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001313};
1314
Dmitry Shmidt8bae4132013-06-06 11:25:10 -07001315struct mac_address {
1316 u8 addr[ETH_ALEN];
1317};
1318
1319struct hostapd_acl_params {
1320 u8 acl_policy;
1321 unsigned int num_mac_acl;
1322 struct mac_address mac_acl[0];
1323};
1324
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001325enum wpa_driver_if_type {
1326 /**
1327 * WPA_IF_STATION - Station mode interface
1328 */
1329 WPA_IF_STATION,
1330
1331 /**
1332 * WPA_IF_AP_VLAN - AP mode VLAN interface
1333 *
1334 * This interface shares its address and Beacon frame with the main
1335 * BSS.
1336 */
1337 WPA_IF_AP_VLAN,
1338
1339 /**
1340 * WPA_IF_AP_BSS - AP mode BSS interface
1341 *
1342 * This interface has its own address and Beacon frame.
1343 */
1344 WPA_IF_AP_BSS,
1345
1346 /**
1347 * WPA_IF_P2P_GO - P2P Group Owner
1348 */
1349 WPA_IF_P2P_GO,
1350
1351 /**
1352 * WPA_IF_P2P_CLIENT - P2P Client
1353 */
1354 WPA_IF_P2P_CLIENT,
1355
1356 /**
1357 * WPA_IF_P2P_GROUP - P2P Group interface (will become either
1358 * WPA_IF_P2P_GO or WPA_IF_P2P_CLIENT, but the role is not yet known)
1359 */
Dmitry Shmidt34af3062013-07-11 10:46:32 -07001360 WPA_IF_P2P_GROUP,
1361
1362 /**
1363 * WPA_IF_P2P_DEVICE - P2P Device interface is used to indentify the
1364 * abstracted P2P Device function in the driver
1365 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001366 WPA_IF_P2P_DEVICE,
1367
1368 /*
1369 * WPA_IF_MESH - Mesh interface
1370 */
1371 WPA_IF_MESH,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001372};
1373
1374struct wpa_init_params {
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001375 void *global_priv;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001376 const u8 *bssid;
1377 const char *ifname;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001378 const char *driver_params;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001379 int use_pae_group_addr;
1380 char **bridge;
1381 size_t num_bridge;
1382
1383 u8 *own_addr; /* buffer for writing own MAC address */
1384};
1385
1386
1387struct wpa_bss_params {
1388 /** Interface name (for multi-SSID/VLAN support) */
1389 const char *ifname;
1390 /** Whether IEEE 802.1X or WPA/WPA2 is enabled */
1391 int enabled;
1392
1393 int wpa;
1394 int ieee802_1x;
1395 int wpa_group;
1396 int wpa_pairwise;
1397 int wpa_key_mgmt;
1398 int rsn_preauth;
1399 enum mfp_options ieee80211w;
1400};
1401
1402#define WPA_STA_AUTHORIZED BIT(0)
1403#define WPA_STA_WMM BIT(1)
1404#define WPA_STA_SHORT_PREAMBLE BIT(2)
1405#define WPA_STA_MFP BIT(3)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001406#define WPA_STA_TDLS_PEER BIT(4)
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001407#define WPA_STA_AUTHENTICATED BIT(5)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001408
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001409enum tdls_oper {
1410 TDLS_DISCOVERY_REQ,
1411 TDLS_SETUP,
1412 TDLS_TEARDOWN,
1413 TDLS_ENABLE_LINK,
1414 TDLS_DISABLE_LINK,
1415 TDLS_ENABLE,
1416 TDLS_DISABLE
1417};
1418
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07001419enum wnm_oper {
1420 WNM_SLEEP_ENTER_CONFIRM,
1421 WNM_SLEEP_ENTER_FAIL,
1422 WNM_SLEEP_EXIT_CONFIRM,
1423 WNM_SLEEP_EXIT_FAIL,
1424 WNM_SLEEP_TFS_REQ_IE_ADD, /* STA requests driver to add TFS req IE */
1425 WNM_SLEEP_TFS_REQ_IE_NONE, /* STA requests empty TFS req IE */
1426 WNM_SLEEP_TFS_REQ_IE_SET, /* AP requests driver to set TFS req IE for
1427 * a STA */
1428 WNM_SLEEP_TFS_RESP_IE_ADD, /* AP requests driver to add TFS resp IE
1429 * for a STA */
1430 WNM_SLEEP_TFS_RESP_IE_NONE, /* AP requests empty TFS resp IE */
1431 WNM_SLEEP_TFS_RESP_IE_SET, /* AP requests driver to set TFS resp IE
1432 * for a STA */
1433 WNM_SLEEP_TFS_IE_DEL /* AP delete the TFS IE */
1434};
1435
Dmitry Shmidt34af3062013-07-11 10:46:32 -07001436/* enum chan_width - Channel width definitions */
1437enum chan_width {
1438 CHAN_WIDTH_20_NOHT,
1439 CHAN_WIDTH_20,
1440 CHAN_WIDTH_40,
1441 CHAN_WIDTH_80,
1442 CHAN_WIDTH_80P80,
1443 CHAN_WIDTH_160,
1444 CHAN_WIDTH_UNKNOWN
1445};
1446
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001447/**
1448 * struct wpa_signal_info - Information about channel signal quality
1449 */
1450struct wpa_signal_info {
1451 u32 frequency;
1452 int above_threshold;
1453 int current_signal;
Dmitry Shmidt34af3062013-07-11 10:46:32 -07001454 int avg_signal;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001455 int current_noise;
1456 int current_txrate;
Dmitry Shmidt34af3062013-07-11 10:46:32 -07001457 enum chan_width chanwidth;
1458 int center_frq1;
1459 int center_frq2;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001460};
1461
1462/**
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08001463 * struct beacon_data - Beacon data
1464 * @head: Head portion of Beacon frame (before TIM IE)
1465 * @tail: Tail portion of Beacon frame (after TIM IE)
1466 * @beacon_ies: Extra information element(s) to add into Beacon frames or %NULL
1467 * @proberesp_ies: Extra information element(s) to add into Probe Response
1468 * frames or %NULL
1469 * @assocresp_ies: Extra information element(s) to add into (Re)Association
1470 * Response frames or %NULL
1471 * @probe_resp: Probe Response frame template
1472 * @head_len: Length of @head
1473 * @tail_len: Length of @tail
1474 * @beacon_ies_len: Length of beacon_ies in octets
1475 * @proberesp_ies_len: Length of proberesp_ies in octets
1476 * @proberesp_ies_len: Length of proberesp_ies in octets
1477 * @probe_resp_len: Length of probe response template (@probe_resp)
1478 */
1479struct beacon_data {
1480 u8 *head, *tail;
1481 u8 *beacon_ies;
1482 u8 *proberesp_ies;
1483 u8 *assocresp_ies;
1484 u8 *probe_resp;
1485
1486 size_t head_len, tail_len;
1487 size_t beacon_ies_len;
1488 size_t proberesp_ies_len;
1489 size_t assocresp_ies_len;
1490 size_t probe_resp_len;
1491};
1492
1493/**
1494 * struct csa_settings - Settings for channel switch command
1495 * @cs_count: Count in Beacon frames (TBTT) to perform the switch
1496 * @block_tx: 1 - block transmission for CSA period
1497 * @freq_params: Next channel frequency parameter
1498 * @beacon_csa: Beacon/probe resp/asooc resp info for CSA period
1499 * @beacon_after: Next beacon/probe resp/asooc resp info
1500 * @counter_offset_beacon: Offset to the count field in beacon's tail
1501 * @counter_offset_presp: Offset to the count field in probe resp.
1502 */
1503struct csa_settings {
1504 u8 cs_count;
1505 u8 block_tx;
1506
1507 struct hostapd_freq_params freq_params;
1508 struct beacon_data beacon_csa;
1509 struct beacon_data beacon_after;
1510
1511 u16 counter_offset_beacon;
1512 u16 counter_offset_presp;
1513};
1514
Dmitry Shmidtdf5a7e42014-04-02 12:59:59 -07001515/* TDLS peer capabilities for send_tdls_mgmt() */
1516enum tdls_peer_capability {
1517 TDLS_PEER_HT = BIT(0),
1518 TDLS_PEER_VHT = BIT(1),
1519 TDLS_PEER_WMM = BIT(2),
1520};
1521
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001522/* valid info in the wmm_params struct */
1523enum wmm_params_valid_info {
1524 WMM_PARAMS_UAPSD_QUEUES_INFO = BIT(0),
1525};
1526
1527/**
1528 * struct wmm_params - WMM parameterss configured for this association
1529 * @info_bitmap: Bitmap of valid wmm_params info; indicates what fields
1530 * of the struct contain valid information.
1531 * @uapsd_queues: Bitmap of ACs configured for uapsd (valid only if
1532 * %WMM_PARAMS_UAPSD_QUEUES_INFO is set)
1533 */
1534struct wmm_params {
1535 u8 info_bitmap;
1536 u8 uapsd_queues;
1537};
1538
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07001539#ifdef CONFIG_MACSEC
1540struct macsec_init_params {
1541 Boolean always_include_sci;
1542 Boolean use_es;
1543 Boolean use_scb;
1544};
1545#endif /* CONFIG_MACSEC */
1546
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001547enum drv_br_port_attr {
1548 DRV_BR_PORT_ATTR_PROXYARP,
1549 DRV_BR_PORT_ATTR_HAIRPIN_MODE,
1550};
1551
1552enum drv_br_net_param {
1553 DRV_BR_NET_PARAM_GARP_ACCEPT,
1554};
1555
1556struct drv_acs_params {
1557 /* Selected mode (HOSTAPD_MODE_*) */
1558 enum hostapd_hw_mode hw_mode;
1559
1560 /* Indicates whether HT is enabled */
1561 int ht_enabled;
1562
1563 /* Indicates whether HT40 is enabled */
1564 int ht40_enabled;
1565};
1566
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07001567
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08001568/**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001569 * struct wpa_driver_ops - Driver interface API definition
1570 *
1571 * This structure defines the API that each driver interface needs to implement
1572 * for core wpa_supplicant code. All driver specific functionality is captured
1573 * in this wrapper.
1574 */
1575struct wpa_driver_ops {
1576 /** Name of the driver interface */
1577 const char *name;
1578 /** One line description of the driver interface */
1579 const char *desc;
1580
1581 /**
1582 * get_bssid - Get the current BSSID
1583 * @priv: private driver interface data
1584 * @bssid: buffer for BSSID (ETH_ALEN = 6 bytes)
1585 *
1586 * Returns: 0 on success, -1 on failure
1587 *
1588 * Query kernel driver for the current BSSID and copy it to bssid.
1589 * Setting bssid to 00:00:00:00:00:00 is recommended if the STA is not
1590 * associated.
1591 */
1592 int (*get_bssid)(void *priv, u8 *bssid);
1593
1594 /**
1595 * get_ssid - Get the current SSID
1596 * @priv: private driver interface data
1597 * @ssid: buffer for SSID (at least 32 bytes)
1598 *
1599 * Returns: Length of the SSID on success, -1 on failure
1600 *
1601 * Query kernel driver for the current SSID and copy it to ssid.
1602 * Returning zero is recommended if the STA is not associated.
1603 *
1604 * Note: SSID is an array of octets, i.e., it is not nul terminated and
1605 * can, at least in theory, contain control characters (including nul)
1606 * and as such, should be processed as binary data, not a printable
1607 * string.
1608 */
1609 int (*get_ssid)(void *priv, u8 *ssid);
1610
1611 /**
1612 * set_key - Configure encryption key
1613 * @ifname: Interface name (for multi-SSID/VLAN support)
1614 * @priv: private driver interface data
1615 * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07001616 * %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK,
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08001617 * %WPA_ALG_GCMP, %WPA_ALG_GCMP_256, %WPA_ALG_CCMP_256,
1618 * %WPA_ALG_BIP_GMAC_128, %WPA_ALG_BIP_GMAC_256,
1619 * %WPA_ALG_BIP_CMAC_256);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001620 * %WPA_ALG_NONE clears the key.
1621 * @addr: Address of the peer STA (BSSID of the current AP when setting
1622 * pairwise key in station mode), ff:ff:ff:ff:ff:ff for
1623 * broadcast keys, %NULL for default keys that are used both for
1624 * broadcast and unicast; when clearing keys, %NULL is used to
1625 * indicate that both the broadcast-only and default key of the
1626 * specified key index is to be cleared
1627 * @key_idx: key index (0..3), usually 0 for unicast keys; 0..4095 for
1628 * IGTK
1629 * @set_tx: configure this key as the default Tx key (only used when
1630 * driver does not support separate unicast/individual key
1631 * @seq: sequence number/packet number, seq_len octets, the next
1632 * packet number to be used for in replay protection; configured
1633 * for Rx keys (in most cases, this is only used with broadcast
1634 * keys and set to zero for unicast keys); %NULL if not set
1635 * @seq_len: length of the seq, depends on the algorithm:
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07001636 * TKIP: 6 octets, CCMP/GCMP: 6 octets, IGTK: 6 octets
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001637 * @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key,
1638 * 8-byte Rx Mic Key
1639 * @key_len: length of the key buffer in octets (WEP: 5 or 13,
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07001640 * TKIP: 32, CCMP/GCMP: 16, IGTK: 16)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001641 *
1642 * Returns: 0 on success, -1 on failure
1643 *
1644 * Configure the given key for the kernel driver. If the driver
1645 * supports separate individual keys (4 default keys + 1 individual),
1646 * addr can be used to determine whether the key is default or
1647 * individual. If only 4 keys are supported, the default key with key
1648 * index 0 is used as the individual key. STA must be configured to use
1649 * it as the default Tx key (set_tx is set) and accept Rx for all the
1650 * key indexes. In most cases, WPA uses only key indexes 1 and 2 for
1651 * broadcast keys, so key index 0 is available for this kind of
1652 * configuration.
1653 *
1654 * Please note that TKIP keys include separate TX and RX MIC keys and
1655 * some drivers may expect them in different order than wpa_supplicant
1656 * is using. If the TX/RX keys are swapped, all TKIP encrypted packets
1657 * will trigger Michael MIC errors. This can be fixed by changing the
1658 * order of MIC keys by swapping te bytes 16..23 and 24..31 of the key
1659 * in driver_*.c set_key() implementation, see driver_ndis.c for an
1660 * example on how this can be done.
1661 */
1662 int (*set_key)(const char *ifname, void *priv, enum wpa_alg alg,
1663 const u8 *addr, int key_idx, int set_tx,
1664 const u8 *seq, size_t seq_len,
1665 const u8 *key, size_t key_len);
1666
1667 /**
1668 * init - Initialize driver interface
1669 * @ctx: context to be used when calling wpa_supplicant functions,
1670 * e.g., wpa_supplicant_event()
1671 * @ifname: interface name, e.g., wlan0
1672 *
1673 * Returns: Pointer to private data, %NULL on failure
1674 *
1675 * Initialize driver interface, including event processing for kernel
1676 * driver events (e.g., associated, scan results, Michael MIC failure).
1677 * This function can allocate a private configuration data area for
1678 * @ctx, file descriptor, interface name, etc. information that may be
1679 * needed in future driver operations. If this is not used, non-NULL
1680 * value will need to be returned because %NULL is used to indicate
1681 * failure. The returned value will be used as 'void *priv' data for
1682 * all other driver_ops functions.
1683 *
1684 * The main event loop (eloop.c) of wpa_supplicant can be used to
1685 * register callback for read sockets (eloop_register_read_sock()).
1686 *
1687 * See below for more information about events and
1688 * wpa_supplicant_event() function.
1689 */
1690 void * (*init)(void *ctx, const char *ifname);
1691
1692 /**
1693 * deinit - Deinitialize driver interface
1694 * @priv: private driver interface data from init()
1695 *
1696 * Shut down driver interface and processing of driver events. Free
1697 * private data buffer if one was allocated in init() handler.
1698 */
1699 void (*deinit)(void *priv);
1700
1701 /**
1702 * set_param - Set driver configuration parameters
1703 * @priv: private driver interface data from init()
1704 * @param: driver specific configuration parameters
1705 *
1706 * Returns: 0 on success, -1 on failure
1707 *
1708 * Optional handler for notifying driver interface about configuration
1709 * parameters (driver_param).
1710 */
1711 int (*set_param)(void *priv, const char *param);
1712
1713 /**
1714 * set_countermeasures - Enable/disable TKIP countermeasures
1715 * @priv: private driver interface data
1716 * @enabled: 1 = countermeasures enabled, 0 = disabled
1717 *
1718 * Returns: 0 on success, -1 on failure
1719 *
1720 * Configure TKIP countermeasures. When these are enabled, the driver
1721 * should drop all received and queued frames that are using TKIP.
1722 */
1723 int (*set_countermeasures)(void *priv, int enabled);
1724
1725 /**
1726 * deauthenticate - Request driver to deauthenticate
1727 * @priv: private driver interface data
1728 * @addr: peer address (BSSID of the AP)
1729 * @reason_code: 16-bit reason code to be sent in the deauthentication
1730 * frame
1731 *
1732 * Returns: 0 on success, -1 on failure
1733 */
1734 int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
1735
1736 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001737 * associate - Request driver to associate
1738 * @priv: private driver interface data
1739 * @params: association parameters
1740 *
1741 * Returns: 0 on success, -1 on failure
1742 */
1743 int (*associate)(void *priv,
1744 struct wpa_driver_associate_params *params);
1745
1746 /**
1747 * add_pmkid - Add PMKSA cache entry to the driver
1748 * @priv: private driver interface data
1749 * @bssid: BSSID for the PMKSA cache entry
1750 * @pmkid: PMKID for the PMKSA cache entry
1751 *
1752 * Returns: 0 on success, -1 on failure
1753 *
1754 * This function is called when a new PMK is received, as a result of
1755 * either normal authentication or RSN pre-authentication.
1756 *
1757 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
1758 * associate(), add_pmkid() can be used to add new PMKSA cache entries
1759 * in the driver. If the driver uses wpa_ie from wpa_supplicant, this
1760 * driver_ops function does not need to be implemented. Likewise, if
1761 * the driver does not support WPA, this function is not needed.
1762 */
1763 int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
1764
1765 /**
1766 * remove_pmkid - Remove PMKSA cache entry to the driver
1767 * @priv: private driver interface data
1768 * @bssid: BSSID for the PMKSA cache entry
1769 * @pmkid: PMKID for the PMKSA cache entry
1770 *
1771 * Returns: 0 on success, -1 on failure
1772 *
1773 * This function is called when the supplicant drops a PMKSA cache
1774 * entry for any reason.
1775 *
1776 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
1777 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
1778 * between the driver and wpa_supplicant. If the driver uses wpa_ie
1779 * from wpa_supplicant, this driver_ops function does not need to be
1780 * implemented. Likewise, if the driver does not support WPA, this
1781 * function is not needed.
1782 */
1783 int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
1784
1785 /**
1786 * flush_pmkid - Flush PMKSA cache
1787 * @priv: private driver interface data
1788 *
1789 * Returns: 0 on success, -1 on failure
1790 *
1791 * This function is called when the supplicant drops all PMKSA cache
1792 * entries for any reason.
1793 *
1794 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
1795 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
1796 * between the driver and wpa_supplicant. If the driver uses wpa_ie
1797 * from wpa_supplicant, this driver_ops function does not need to be
1798 * implemented. Likewise, if the driver does not support WPA, this
1799 * function is not needed.
1800 */
1801 int (*flush_pmkid)(void *priv);
1802
1803 /**
1804 * get_capa - Get driver capabilities
1805 * @priv: private driver interface data
1806 *
1807 * Returns: 0 on success, -1 on failure
1808 *
1809 * Get driver/firmware/hardware capabilities.
1810 */
1811 int (*get_capa)(void *priv, struct wpa_driver_capa *capa);
1812
1813 /**
1814 * poll - Poll driver for association information
1815 * @priv: private driver interface data
1816 *
1817 * This is an option callback that can be used when the driver does not
1818 * provide event mechanism for association events. This is called when
1819 * receiving WPA EAPOL-Key messages that require association
1820 * information. The driver interface is supposed to generate associnfo
1821 * event before returning from this callback function. In addition, the
1822 * driver interface should generate an association event after having
1823 * sent out associnfo.
1824 */
1825 void (*poll)(void *priv);
1826
1827 /**
1828 * get_ifname - Get interface name
1829 * @priv: private driver interface data
1830 *
1831 * Returns: Pointer to the interface name. This can differ from the
1832 * interface name used in init() call. Init() is called first.
1833 *
1834 * This optional function can be used to allow the driver interface to
1835 * replace the interface name with something else, e.g., based on an
1836 * interface mapping from a more descriptive name.
1837 */
1838 const char * (*get_ifname)(void *priv);
1839
1840 /**
1841 * get_mac_addr - Get own MAC address
1842 * @priv: private driver interface data
1843 *
1844 * Returns: Pointer to own MAC address or %NULL on failure
1845 *
1846 * This optional function can be used to get the own MAC address of the
1847 * device from the driver interface code. This is only needed if the
1848 * l2_packet implementation for the OS does not provide easy access to
1849 * a MAC address. */
1850 const u8 * (*get_mac_addr)(void *priv);
1851
1852 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001853 * set_operstate - Sets device operating state to DORMANT or UP
1854 * @priv: private driver interface data
1855 * @state: 0 = dormant, 1 = up
1856 * Returns: 0 on success, -1 on failure
1857 *
1858 * This is an optional function that can be used on operating systems
1859 * that support a concept of controlling network device state from user
1860 * space applications. This function, if set, gets called with
1861 * state = 1 when authentication has been completed and with state = 0
1862 * when connection is lost.
1863 */
1864 int (*set_operstate)(void *priv, int state);
1865
1866 /**
1867 * mlme_setprotection - MLME-SETPROTECTION.request primitive
1868 * @priv: Private driver interface data
1869 * @addr: Address of the station for which to set protection (may be
1870 * %NULL for group keys)
1871 * @protect_type: MLME_SETPROTECTION_PROTECT_TYPE_*
1872 * @key_type: MLME_SETPROTECTION_KEY_TYPE_*
1873 * Returns: 0 on success, -1 on failure
1874 *
1875 * This is an optional function that can be used to set the driver to
1876 * require protection for Tx and/or Rx frames. This uses the layer
1877 * interface defined in IEEE 802.11i-2004 clause 10.3.22.1
1878 * (MLME-SETPROTECTION.request). Many drivers do not use explicit
1879 * set protection operation; instead, they set protection implicitly
1880 * based on configured keys.
1881 */
1882 int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type,
1883 int key_type);
1884
1885 /**
1886 * get_hw_feature_data - Get hardware support data (channels and rates)
1887 * @priv: Private driver interface data
1888 * @num_modes: Variable for returning the number of returned modes
1889 * flags: Variable for returning hardware feature flags
1890 * Returns: Pointer to allocated hardware data on success or %NULL on
1891 * failure. Caller is responsible for freeing this.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001892 */
1893 struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
1894 u16 *num_modes,
1895 u16 *flags);
1896
1897 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001898 * send_mlme - Send management frame from MLME
1899 * @priv: Private driver interface data
1900 * @data: IEEE 802.11 management frame with IEEE 802.11 header
1901 * @data_len: Size of the management frame
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001902 * @noack: Do not wait for this frame to be acked (disable retries)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001903 * Returns: 0 on success, -1 on failure
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001904 */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001905 int (*send_mlme)(void *priv, const u8 *data, size_t data_len,
1906 int noack);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001907
1908 /**
1909 * update_ft_ies - Update FT (IEEE 802.11r) IEs
1910 * @priv: Private driver interface data
1911 * @md: Mobility domain (2 octets) (also included inside ies)
1912 * @ies: FT IEs (MDIE, FTIE, ...) or %NULL to remove IEs
1913 * @ies_len: Length of FT IEs in bytes
1914 * Returns: 0 on success, -1 on failure
1915 *
1916 * The supplicant uses this callback to let the driver know that keying
1917 * material for FT is available and that the driver can use the
1918 * provided IEs in the next message in FT authentication sequence.
1919 *
1920 * This function is only needed for driver that support IEEE 802.11r
1921 * (Fast BSS Transition).
1922 */
1923 int (*update_ft_ies)(void *priv, const u8 *md, const u8 *ies,
1924 size_t ies_len);
1925
1926 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001927 * get_scan_results2 - Fetch the latest scan results
1928 * @priv: private driver interface data
1929 *
1930 * Returns: Allocated buffer of scan results (caller is responsible for
1931 * freeing the data structure) on success, NULL on failure
1932 */
1933 struct wpa_scan_results * (*get_scan_results2)(void *priv);
1934
1935 /**
1936 * set_country - Set country
1937 * @priv: Private driver interface data
1938 * @alpha2: country to which to switch to
1939 * Returns: 0 on success, -1 on failure
1940 *
1941 * This function is for drivers which support some form
1942 * of setting a regulatory domain.
1943 */
1944 int (*set_country)(void *priv, const char *alpha2);
1945
1946 /**
Dmitry Shmidtcce06662013-11-04 18:44:24 -08001947 * get_country - Get country
1948 * @priv: Private driver interface data
1949 * @alpha2: Buffer for returning country code (at least 3 octets)
1950 * Returns: 0 on success, -1 on failure
1951 */
1952 int (*get_country)(void *priv, char *alpha2);
1953
1954 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001955 * global_init - Global driver initialization
1956 * Returns: Pointer to private data (global), %NULL on failure
1957 *
1958 * This optional function is called to initialize the driver wrapper
1959 * for global data, i.e., data that applies to all interfaces. If this
1960 * function is implemented, global_deinit() will also need to be
1961 * implemented to free the private data. The driver will also likely
1962 * use init2() function instead of init() to get the pointer to global
1963 * data available to per-interface initializer.
1964 */
1965 void * (*global_init)(void);
1966
1967 /**
1968 * global_deinit - Global driver deinitialization
1969 * @priv: private driver global data from global_init()
1970 *
1971 * Terminate any global driver related functionality and free the
1972 * global data structure.
1973 */
1974 void (*global_deinit)(void *priv);
1975
1976 /**
1977 * init2 - Initialize driver interface (with global data)
1978 * @ctx: context to be used when calling wpa_supplicant functions,
1979 * e.g., wpa_supplicant_event()
1980 * @ifname: interface name, e.g., wlan0
1981 * @global_priv: private driver global data from global_init()
1982 * Returns: Pointer to private data, %NULL on failure
1983 *
1984 * This function can be used instead of init() if the driver wrapper
1985 * uses global data.
1986 */
1987 void * (*init2)(void *ctx, const char *ifname, void *global_priv);
1988
1989 /**
1990 * get_interfaces - Get information about available interfaces
1991 * @global_priv: private driver global data from global_init()
1992 * Returns: Allocated buffer of interface information (caller is
1993 * responsible for freeing the data structure) on success, NULL on
1994 * failure
1995 */
1996 struct wpa_interface_info * (*get_interfaces)(void *global_priv);
1997
1998 /**
1999 * scan2 - Request the driver to initiate scan
2000 * @priv: private driver interface data
2001 * @params: Scan parameters
2002 *
2003 * Returns: 0 on success, -1 on failure
2004 *
2005 * Once the scan results are ready, the driver should report scan
2006 * results event for wpa_supplicant which will eventually request the
2007 * results with wpa_driver_get_scan_results2().
2008 */
2009 int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
2010
2011 /**
2012 * authenticate - Request driver to authenticate
2013 * @priv: private driver interface data
2014 * @params: authentication parameters
2015 * Returns: 0 on success, -1 on failure
2016 *
2017 * This is an optional function that can be used with drivers that
2018 * support separate authentication and association steps, i.e., when
2019 * wpa_supplicant can act as the SME. If not implemented, associate()
2020 * function is expected to take care of IEEE 802.11 authentication,
2021 * too.
2022 */
2023 int (*authenticate)(void *priv,
2024 struct wpa_driver_auth_params *params);
2025
2026 /**
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002027 * set_ap - Set Beacon and Probe Response information for AP mode
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002028 * @priv: Private driver interface data
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002029 * @params: Parameters to use in AP mode
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002030 *
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002031 * This function is used to configure Beacon template and/or extra IEs
2032 * to add for Beacon and Probe Response frames for the driver in
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002033 * AP mode. The driver is responsible for building the full Beacon
2034 * frame by concatenating the head part with TIM IE generated by the
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002035 * driver/firmware and finishing with the tail part. Depending on the
2036 * driver architectue, this can be done either by using the full
2037 * template or the set of additional IEs (e.g., WPS and P2P IE).
2038 * Similarly, Probe Response processing depends on the driver design.
2039 * If the driver (or firmware) takes care of replying to Probe Request
2040 * frames, the extra IEs provided here needs to be added to the Probe
2041 * Response frames.
2042 *
2043 * Returns: 0 on success, -1 on failure
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002044 */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002045 int (*set_ap)(void *priv, struct wpa_driver_ap_params *params);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002046
2047 /**
Dmitry Shmidt8bae4132013-06-06 11:25:10 -07002048 * set_acl - Set ACL in AP mode
2049 * @priv: Private driver interface data
2050 * @params: Parameters to configure ACL
2051 * Returns: 0 on success, -1 on failure
2052 *
2053 * This is used only for the drivers which support MAC address ACL.
2054 */
2055 int (*set_acl)(void *priv, struct hostapd_acl_params *params);
2056
2057 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002058 * hapd_init - Initialize driver interface (hostapd only)
2059 * @hapd: Pointer to hostapd context
2060 * @params: Configuration for the driver wrapper
2061 * Returns: Pointer to private data, %NULL on failure
2062 *
2063 * This function is used instead of init() or init2() when the driver
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002064 * wrapper is used with hostapd.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002065 */
2066 void * (*hapd_init)(struct hostapd_data *hapd,
2067 struct wpa_init_params *params);
2068
2069 /**
2070 * hapd_deinit - Deinitialize driver interface (hostapd only)
2071 * @priv: Private driver interface data from hapd_init()
2072 */
2073 void (*hapd_deinit)(void *priv);
2074
2075 /**
2076 * set_ieee8021x - Enable/disable IEEE 802.1X support (AP only)
2077 * @priv: Private driver interface data
2078 * @params: BSS parameters
2079 * Returns: 0 on success, -1 on failure
2080 *
2081 * This is an optional function to configure the kernel driver to
2082 * enable/disable IEEE 802.1X support and set WPA/WPA2 parameters. This
2083 * can be left undefined (set to %NULL) if IEEE 802.1X support is
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002084 * always enabled and the driver uses set_ap() to set WPA/RSN IE
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002085 * for Beacon frames.
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002086 *
2087 * DEPRECATED - use set_ap() instead
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002088 */
2089 int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
2090
2091 /**
2092 * set_privacy - Enable/disable privacy (AP only)
2093 * @priv: Private driver interface data
2094 * @enabled: 1 = privacy enabled, 0 = disabled
2095 * Returns: 0 on success, -1 on failure
2096 *
2097 * This is an optional function to configure privacy field in the
2098 * kernel driver for Beacon frames. This can be left undefined (set to
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002099 * %NULL) if the driver uses the Beacon template from set_ap().
2100 *
2101 * DEPRECATED - use set_ap() instead
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002102 */
2103 int (*set_privacy)(void *priv, int enabled);
2104
2105 /**
2106 * get_seqnum - Fetch the current TSC/packet number (AP only)
2107 * @ifname: The interface name (main or virtual)
2108 * @priv: Private driver interface data
2109 * @addr: MAC address of the station or %NULL for group keys
2110 * @idx: Key index
2111 * @seq: Buffer for returning the latest used TSC/packet number
2112 * Returns: 0 on success, -1 on failure
2113 *
2114 * This function is used to fetch the last used TSC/packet number for
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07002115 * a TKIP, CCMP, GCMP, or BIP/IGTK key. It is mainly used with group
2116 * keys, so there is no strict requirement on implementing support for
2117 * unicast keys (i.e., addr != %NULL).
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002118 */
2119 int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
2120 int idx, u8 *seq);
2121
2122 /**
2123 * flush - Flush all association stations (AP only)
2124 * @priv: Private driver interface data
2125 * Returns: 0 on success, -1 on failure
2126 *
2127 * This function requests the driver to disassociate all associated
2128 * stations. This function does not need to be implemented if the
2129 * driver does not process association frames internally.
2130 */
2131 int (*flush)(void *priv);
2132
2133 /**
2134 * set_generic_elem - Add IEs into Beacon/Probe Response frames (AP)
2135 * @priv: Private driver interface data
2136 * @elem: Information elements
2137 * @elem_len: Length of the elem buffer in octets
2138 * Returns: 0 on success, -1 on failure
2139 *
2140 * This is an optional function to add information elements in the
2141 * kernel driver for Beacon and Probe Response frames. This can be left
2142 * undefined (set to %NULL) if the driver uses the Beacon template from
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002143 * set_ap().
2144 *
2145 * DEPRECATED - use set_ap() instead
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002146 */
2147 int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len);
2148
2149 /**
Jouni Malinen1e6c57f2012-09-05 17:07:03 +03002150 * read_sta_data - Fetch station data
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002151 * @priv: Private driver interface data
2152 * @data: Buffer for returning station information
2153 * @addr: MAC address of the station
2154 * Returns: 0 on success, -1 on failure
2155 */
2156 int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
2157 const u8 *addr);
2158
2159 /**
2160 * hapd_send_eapol - Send an EAPOL packet (AP only)
2161 * @priv: private driver interface data
2162 * @addr: Destination MAC address
2163 * @data: EAPOL packet starting with IEEE 802.1X header
2164 * @data_len: Length of the EAPOL packet in octets
2165 * @encrypt: Whether the frame should be encrypted
2166 * @own_addr: Source MAC address
2167 * @flags: WPA_STA_* flags for the destination station
2168 *
2169 * Returns: 0 on success, -1 on failure
2170 */
2171 int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
2172 size_t data_len, int encrypt,
2173 const u8 *own_addr, u32 flags);
2174
2175 /**
2176 * sta_deauth - Deauthenticate a station (AP only)
2177 * @priv: Private driver interface data
2178 * @own_addr: Source address and BSSID for the Deauthentication frame
2179 * @addr: MAC address of the station to deauthenticate
2180 * @reason: Reason code for the Deauthentiation frame
2181 * Returns: 0 on success, -1 on failure
2182 *
2183 * This function requests a specific station to be deauthenticated and
2184 * a Deauthentication frame to be sent to it.
2185 */
2186 int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
2187 int reason);
2188
2189 /**
2190 * sta_disassoc - Disassociate a station (AP only)
2191 * @priv: Private driver interface data
2192 * @own_addr: Source address and BSSID for the Disassociation frame
2193 * @addr: MAC address of the station to disassociate
2194 * @reason: Reason code for the Disassociation frame
2195 * Returns: 0 on success, -1 on failure
2196 *
2197 * This function requests a specific station to be disassociated and
2198 * a Disassociation frame to be sent to it.
2199 */
2200 int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
2201 int reason);
2202
2203 /**
2204 * sta_remove - Remove a station entry (AP only)
2205 * @priv: Private driver interface data
2206 * @addr: MAC address of the station to be removed
2207 * Returns: 0 on success, -1 on failure
2208 */
2209 int (*sta_remove)(void *priv, const u8 *addr);
2210
2211 /**
2212 * hapd_get_ssid - Get the current SSID (AP only)
2213 * @priv: Private driver interface data
2214 * @buf: Buffer for returning the SSID
2215 * @len: Maximum length of the buffer
2216 * Returns: Length of the SSID on success, -1 on failure
2217 *
2218 * This function need not be implemented if the driver uses Beacon
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002219 * template from set_ap() and does not reply to Probe Request frames.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002220 */
2221 int (*hapd_get_ssid)(void *priv, u8 *buf, int len);
2222
2223 /**
2224 * hapd_set_ssid - Set SSID (AP only)
2225 * @priv: Private driver interface data
2226 * @buf: SSID
2227 * @len: Length of the SSID in octets
2228 * Returns: 0 on success, -1 on failure
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002229 *
2230 * DEPRECATED - use set_ap() instead
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002231 */
2232 int (*hapd_set_ssid)(void *priv, const u8 *buf, int len);
2233
2234 /**
2235 * hapd_set_countermeasures - Enable/disable TKIP countermeasures (AP)
2236 * @priv: Private driver interface data
2237 * @enabled: 1 = countermeasures enabled, 0 = disabled
2238 * Returns: 0 on success, -1 on failure
2239 *
2240 * This need not be implemented if the driver does not take care of
2241 * association processing.
2242 */
2243 int (*hapd_set_countermeasures)(void *priv, int enabled);
2244
2245 /**
2246 * sta_add - Add a station entry
2247 * @priv: Private driver interface data
2248 * @params: Station parameters
2249 * Returns: 0 on success, -1 on failure
2250 *
2251 * This function is used to add a station entry to the driver once the
2252 * station has completed association. This is only used if the driver
2253 * does not take care of association processing.
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002254 *
2255 * With TDLS, this function is also used to add or set (params->set 1)
2256 * TDLS peer entries.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002257 */
2258 int (*sta_add)(void *priv, struct hostapd_sta_add_params *params);
2259
2260 /**
2261 * get_inact_sec - Get station inactivity duration (AP only)
2262 * @priv: Private driver interface data
2263 * @addr: Station address
2264 * Returns: Number of seconds station has been inactive, -1 on failure
2265 */
2266 int (*get_inact_sec)(void *priv, const u8 *addr);
2267
2268 /**
2269 * sta_clear_stats - Clear station statistics (AP only)
2270 * @priv: Private driver interface data
2271 * @addr: Station address
2272 * Returns: 0 on success, -1 on failure
2273 */
2274 int (*sta_clear_stats)(void *priv, const u8 *addr);
2275
2276 /**
2277 * set_freq - Set channel/frequency (AP only)
2278 * @priv: Private driver interface data
2279 * @freq: Channel parameters
2280 * Returns: 0 on success, -1 on failure
2281 */
2282 int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
2283
2284 /**
2285 * set_rts - Set RTS threshold
2286 * @priv: Private driver interface data
2287 * @rts: RTS threshold in octets
2288 * Returns: 0 on success, -1 on failure
2289 */
2290 int (*set_rts)(void *priv, int rts);
2291
2292 /**
2293 * set_frag - Set fragmentation threshold
2294 * @priv: Private driver interface data
2295 * @frag: Fragmentation threshold in octets
2296 * Returns: 0 on success, -1 on failure
2297 */
2298 int (*set_frag)(void *priv, int frag);
2299
2300 /**
2301 * sta_set_flags - Set station flags (AP only)
2302 * @priv: Private driver interface data
2303 * @addr: Station address
2304 * @total_flags: Bitmap of all WPA_STA_* flags currently set
2305 * @flags_or: Bitmap of WPA_STA_* flags to add
2306 * @flags_and: Bitmap of WPA_STA_* flags to us as a mask
2307 * Returns: 0 on success, -1 on failure
2308 */
2309 int (*sta_set_flags)(void *priv, const u8 *addr,
2310 int total_flags, int flags_or, int flags_and);
2311
2312 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002313 * set_tx_queue_params - Set TX queue parameters
2314 * @priv: Private driver interface data
2315 * @queue: Queue number (0 = VO, 1 = VI, 2 = BE, 3 = BK)
2316 * @aifs: AIFS
2317 * @cw_min: cwMin
2318 * @cw_max: cwMax
2319 * @burst_time: Maximum length for bursting in 0.1 msec units
2320 */
2321 int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
2322 int cw_max, int burst_time);
2323
2324 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002325 * if_add - Add a virtual interface
2326 * @priv: Private driver interface data
2327 * @type: Interface type
2328 * @ifname: Interface name for the new virtual interface
2329 * @addr: Local address to use for the interface or %NULL to use the
2330 * parent interface address
2331 * @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces
2332 * @drv_priv: Pointer for overwriting the driver context or %NULL if
2333 * not allowed (applies only to %WPA_IF_AP_BSS type)
2334 * @force_ifname: Buffer for returning an interface name that the
2335 * driver ended up using if it differs from the requested ifname
2336 * @if_addr: Buffer for returning the allocated interface address
2337 * (this may differ from the requested addr if the driver cannot
2338 * change interface address)
2339 * @bridge: Bridge interface to use or %NULL if no bridge configured
Dmitry Shmidtcce06662013-11-04 18:44:24 -08002340 * @use_existing: Whether to allow existing interface to be used
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002341 * Returns: 0 on success, -1 on failure
2342 */
2343 int (*if_add)(void *priv, enum wpa_driver_if_type type,
2344 const char *ifname, const u8 *addr, void *bss_ctx,
2345 void **drv_priv, char *force_ifname, u8 *if_addr,
Dmitry Shmidtcce06662013-11-04 18:44:24 -08002346 const char *bridge, int use_existing);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002347
2348 /**
2349 * if_remove - Remove a virtual interface
2350 * @priv: Private driver interface data
2351 * @type: Interface type
2352 * @ifname: Interface name of the virtual interface to be removed
2353 * Returns: 0 on success, -1 on failure
2354 */
2355 int (*if_remove)(void *priv, enum wpa_driver_if_type type,
2356 const char *ifname);
2357
2358 /**
2359 * set_sta_vlan - Bind a station into a specific interface (AP only)
2360 * @priv: Private driver interface data
2361 * @ifname: Interface (main or virtual BSS or VLAN)
2362 * @addr: MAC address of the associated station
2363 * @vlan_id: VLAN ID
2364 * Returns: 0 on success, -1 on failure
2365 *
2366 * This function is used to bind a station to a specific virtual
2367 * interface. It is only used if when virtual interfaces are supported,
2368 * e.g., to assign stations to different VLAN interfaces based on
2369 * information from a RADIUS server. This allows separate broadcast
2370 * domains to be used with a single BSS.
2371 */
2372 int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
2373 int vlan_id);
2374
2375 /**
2376 * commit - Optional commit changes handler (AP only)
2377 * @priv: driver private data
2378 * Returns: 0 on success, -1 on failure
2379 *
2380 * This optional handler function can be registered if the driver
2381 * interface implementation needs to commit changes (e.g., by setting
2382 * network interface up) at the end of initial configuration. If set,
2383 * this handler will be called after initial setup has been completed.
2384 */
2385 int (*commit)(void *priv);
2386
2387 /**
2388 * send_ether - Send an ethernet packet (AP only)
2389 * @priv: private driver interface data
2390 * @dst: Destination MAC address
2391 * @src: Source MAC address
2392 * @proto: Ethertype
2393 * @data: EAPOL packet starting with IEEE 802.1X header
2394 * @data_len: Length of the EAPOL packet in octets
2395 * Returns: 0 on success, -1 on failure
2396 */
2397 int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto,
2398 const u8 *data, size_t data_len);
2399
2400 /**
2401 * set_radius_acl_auth - Notification of RADIUS ACL change
2402 * @priv: Private driver interface data
2403 * @mac: MAC address of the station
2404 * @accepted: Whether the station was accepted
2405 * @session_timeout: Session timeout for the station
2406 * Returns: 0 on success, -1 on failure
2407 */
Dmitry Shmidt7832adb2014-04-29 10:53:02 -07002408 int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002409 u32 session_timeout);
2410
2411 /**
2412 * set_radius_acl_expire - Notification of RADIUS ACL expiration
2413 * @priv: Private driver interface data
2414 * @mac: MAC address of the station
2415 * Returns: 0 on success, -1 on failure
2416 */
2417 int (*set_radius_acl_expire)(void *priv, const u8 *mac);
2418
2419 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002420 * set_ap_wps_ie - Add WPS IE(s) into Beacon/Probe Response frames (AP)
2421 * @priv: Private driver interface data
2422 * @beacon: WPS IE(s) for Beacon frames or %NULL to remove extra IE(s)
2423 * @proberesp: WPS IE(s) for Probe Response frames or %NULL to remove
2424 * extra IE(s)
2425 * @assocresp: WPS IE(s) for (Re)Association Response frames or %NULL
2426 * to remove extra IE(s)
2427 * Returns: 0 on success, -1 on failure
2428 *
2429 * This is an optional function to add WPS IE in the kernel driver for
2430 * Beacon and Probe Response frames. This can be left undefined (set
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002431 * to %NULL) if the driver uses the Beacon template from set_ap()
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002432 * and does not process Probe Request frames. If the driver takes care
2433 * of (Re)Association frame processing, the assocresp buffer includes
2434 * WPS IE(s) that need to be added to (Re)Association Response frames
2435 * whenever a (Re)Association Request frame indicated use of WPS.
2436 *
2437 * This will also be used to add P2P IE(s) into Beacon/Probe Response
2438 * frames when operating as a GO. The driver is responsible for adding
2439 * timing related attributes (e.g., NoA) in addition to the IEs
2440 * included here by appending them after these buffers. This call is
2441 * also used to provide Probe Response IEs for P2P Listen state
2442 * operations for drivers that generate the Probe Response frames
2443 * internally.
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002444 *
2445 * DEPRECATED - use set_ap() instead
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002446 */
2447 int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon,
2448 const struct wpabuf *proberesp,
2449 const struct wpabuf *assocresp);
2450
2451 /**
2452 * set_supp_port - Set IEEE 802.1X Supplicant Port status
2453 * @priv: Private driver interface data
2454 * @authorized: Whether the port is authorized
2455 * Returns: 0 on success, -1 on failure
2456 */
2457 int (*set_supp_port)(void *priv, int authorized);
2458
2459 /**
2460 * set_wds_sta - Bind a station into a 4-address WDS (AP only)
2461 * @priv: Private driver interface data
2462 * @addr: MAC address of the associated station
2463 * @aid: Association ID
2464 * @val: 1 = bind to 4-address WDS; 0 = unbind
2465 * @bridge_ifname: Bridge interface to use for the WDS station or %NULL
2466 * to indicate that bridge is not to be used
Dmitry Shmidtc2ebb4b2013-07-24 12:57:51 -07002467 * @ifname_wds: Buffer to return the interface name for the new WDS
2468 * station or %NULL to indicate name is not returned.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002469 * Returns: 0 on success, -1 on failure
2470 */
2471 int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val,
Dmitry Shmidt7832adb2014-04-29 10:53:02 -07002472 const char *bridge_ifname, char *ifname_wds);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002473
2474 /**
2475 * send_action - Transmit an Action frame
2476 * @priv: Private driver interface data
2477 * @freq: Frequency (in MHz) of the channel
2478 * @wait: Time to wait off-channel for a response (in ms), or zero
2479 * @dst: Destination MAC address (Address 1)
2480 * @src: Source MAC address (Address 2)
2481 * @bssid: BSSID (Address 3)
2482 * @data: Frame body
2483 * @data_len: data length in octets
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002484 @ @no_cck: Whether CCK rates must not be used to transmit this frame
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002485 * Returns: 0 on success, -1 on failure
2486 *
2487 * This command can be used to request the driver to transmit an action
2488 * frame to the specified destination.
2489 *
2490 * If the %WPA_DRIVER_FLAGS_OFFCHANNEL_TX flag is set, the frame will
2491 * be transmitted on the given channel and the device will wait for a
2492 * response on that channel for the given wait time.
2493 *
2494 * If the flag is not set, the wait time will be ignored. In this case,
2495 * if a remain-on-channel duration is in progress, the frame must be
2496 * transmitted on that channel; alternatively the frame may be sent on
2497 * the current operational channel (if in associated state in station
2498 * mode or while operating as an AP.)
2499 */
2500 int (*send_action)(void *priv, unsigned int freq, unsigned int wait,
2501 const u8 *dst, const u8 *src, const u8 *bssid,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002502 const u8 *data, size_t data_len, int no_cck);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002503
2504 /**
2505 * send_action_cancel_wait - Cancel action frame TX wait
2506 * @priv: Private driver interface data
2507 *
2508 * This command cancels the wait time associated with sending an action
2509 * frame. It is only available when %WPA_DRIVER_FLAGS_OFFCHANNEL_TX is
2510 * set in the driver flags.
2511 */
2512 void (*send_action_cancel_wait)(void *priv);
2513
2514 /**
2515 * remain_on_channel - Remain awake on a channel
2516 * @priv: Private driver interface data
2517 * @freq: Frequency (in MHz) of the channel
2518 * @duration: Duration in milliseconds
2519 * Returns: 0 on success, -1 on failure
2520 *
2521 * This command is used to request the driver to remain awake on the
2522 * specified channel for the specified duration and report received
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08002523 * Action frames with EVENT_RX_MGMT events. Optionally, received
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002524 * Probe Request frames may also be requested to be reported by calling
2525 * probe_req_report(). These will be reported with EVENT_RX_PROBE_REQ.
2526 *
2527 * The driver may not be at the requested channel when this function
2528 * returns, i.e., the return code is only indicating whether the
2529 * request was accepted. The caller will need to wait until the
2530 * EVENT_REMAIN_ON_CHANNEL event indicates that the driver has
2531 * completed the channel change. This may take some time due to other
2532 * need for the radio and the caller should be prepared to timing out
2533 * its wait since there are no guarantees on when this request can be
2534 * executed.
2535 */
2536 int (*remain_on_channel)(void *priv, unsigned int freq,
2537 unsigned int duration);
2538
2539 /**
2540 * cancel_remain_on_channel - Cancel remain-on-channel operation
2541 * @priv: Private driver interface data
2542 *
2543 * This command can be used to cancel a remain-on-channel operation
2544 * before its originally requested duration has passed. This could be
2545 * used, e.g., when remain_on_channel() is used to request extra time
2546 * to receive a response to an Action frame and the response is
2547 * received when there is still unneeded time remaining on the
2548 * remain-on-channel operation.
2549 */
2550 int (*cancel_remain_on_channel)(void *priv);
2551
2552 /**
2553 * probe_req_report - Request Probe Request frames to be indicated
2554 * @priv: Private driver interface data
2555 * @report: Whether to report received Probe Request frames
2556 * Returns: 0 on success, -1 on failure (or if not supported)
2557 *
2558 * This command can be used to request the driver to indicate when
2559 * Probe Request frames are received with EVENT_RX_PROBE_REQ events.
2560 * Since this operation may require extra resources, e.g., due to less
2561 * optimal hardware/firmware RX filtering, many drivers may disable
2562 * Probe Request reporting at least in station mode. This command is
2563 * used to notify the driver when the Probe Request frames need to be
2564 * reported, e.g., during remain-on-channel operations.
2565 */
2566 int (*probe_req_report)(void *priv, int report);
2567
2568 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002569 * deinit_ap - Deinitialize AP mode
2570 * @priv: Private driver interface data
2571 * Returns: 0 on success, -1 on failure (or if not supported)
2572 *
2573 * This optional function can be used to disable AP mode related
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -07002574 * configuration. If the interface was not dynamically added,
2575 * change the driver mode to station mode to allow normal station
2576 * operations like scanning to be completed.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002577 */
2578 int (*deinit_ap)(void *priv);
2579
2580 /**
Dmitry Shmidt04949592012-07-19 12:16:46 -07002581 * deinit_p2p_cli - Deinitialize P2P client mode
2582 * @priv: Private driver interface data
2583 * Returns: 0 on success, -1 on failure (or if not supported)
2584 *
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -07002585 * This optional function can be used to disable P2P client mode. If the
2586 * interface was not dynamically added, change the interface type back
2587 * to station mode.
Dmitry Shmidt04949592012-07-19 12:16:46 -07002588 */
2589 int (*deinit_p2p_cli)(void *priv);
2590
2591 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002592 * suspend - Notification on system suspend/hibernate event
2593 * @priv: Private driver interface data
2594 */
2595 void (*suspend)(void *priv);
2596
2597 /**
2598 * resume - Notification on system resume/thaw event
2599 * @priv: Private driver interface data
2600 */
2601 void (*resume)(void *priv);
2602
2603 /**
2604 * signal_monitor - Set signal monitoring parameters
2605 * @priv: Private driver interface data
2606 * @threshold: Threshold value for signal change events; 0 = disabled
2607 * @hysteresis: Minimum change in signal strength before indicating a
2608 * new event
2609 * Returns: 0 on success, -1 on failure (or if not supported)
2610 *
2611 * This function can be used to configure monitoring of signal strength
2612 * with the current AP. Whenever signal strength drops below the
2613 * %threshold value or increases above it, EVENT_SIGNAL_CHANGE event
2614 * should be generated assuming the signal strength has changed at
2615 * least %hysteresis from the previously indicated signal change event.
2616 */
2617 int (*signal_monitor)(void *priv, int threshold, int hysteresis);
2618
2619 /**
2620 * send_frame - Send IEEE 802.11 frame (testing use only)
2621 * @priv: Private driver interface data
2622 * @data: IEEE 802.11 frame with IEEE 802.11 header
2623 * @data_len: Size of the frame
2624 * @encrypt: Whether to encrypt the frame (if keys are set)
2625 * Returns: 0 on success, -1 on failure
2626 *
2627 * This function is only used for debugging purposes and is not
2628 * required to be implemented for normal operations.
2629 */
2630 int (*send_frame)(void *priv, const u8 *data, size_t data_len,
2631 int encrypt);
2632
2633 /**
2634 * shared_freq - Get operating frequency of shared interface(s)
2635 * @priv: Private driver interface data
2636 * Returns: Operating frequency in MHz, 0 if no shared operation in
2637 * use, or -1 on failure
2638 *
2639 * This command can be used to request the current operating frequency
2640 * of any virtual interface that shares the same radio to provide
2641 * information for channel selection for other virtual interfaces.
2642 */
2643 int (*shared_freq)(void *priv);
2644
2645 /**
2646 * get_noa - Get current Notice of Absence attribute payload
2647 * @priv: Private driver interface data
2648 * @buf: Buffer for returning NoA
2649 * @buf_len: Buffer length in octets
2650 * Returns: Number of octets used in buf, 0 to indicate no NoA is being
2651 * advertized, or -1 on failure
2652 *
2653 * This function is used to fetch the current Notice of Absence
2654 * attribute value from GO.
2655 */
2656 int (*get_noa)(void *priv, u8 *buf, size_t buf_len);
2657
2658 /**
2659 * set_noa - Set Notice of Absence parameters for GO (testing)
2660 * @priv: Private driver interface data
2661 * @count: Count
2662 * @start: Start time in ms from next TBTT
2663 * @duration: Duration in ms
2664 * Returns: 0 on success or -1 on failure
2665 *
2666 * This function is used to set Notice of Absence parameters for GO. It
2667 * is used only for testing. To disable NoA, all parameters are set to
2668 * 0.
2669 */
2670 int (*set_noa)(void *priv, u8 count, int start, int duration);
2671
2672 /**
2673 * set_p2p_powersave - Set P2P power save options
2674 * @priv: Private driver interface data
2675 * @legacy_ps: 0 = disable, 1 = enable, 2 = maximum PS, -1 = no change
2676 * @opp_ps: 0 = disable, 1 = enable, -1 = no change
2677 * @ctwindow: 0.. = change (msec), -1 = no change
2678 * Returns: 0 on success or -1 on failure
2679 */
2680 int (*set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps,
2681 int ctwindow);
2682
2683 /**
2684 * ampdu - Enable/disable aggregation
2685 * @priv: Private driver interface data
2686 * @ampdu: 1/0 = enable/disable A-MPDU aggregation
2687 * Returns: 0 on success or -1 on failure
2688 */
2689 int (*ampdu)(void *priv, int ampdu);
2690
2691 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002692 * get_radio_name - Get physical radio name for the device
2693 * @priv: Private driver interface data
2694 * Returns: Radio name or %NULL if not known
2695 *
2696 * The returned data must not be modified by the caller. It is assumed
2697 * that any interface that has the same radio name as another is
2698 * sharing the same physical radio. This information can be used to
2699 * share scan results etc. information between the virtual interfaces
2700 * to speed up various operations.
2701 */
2702 const char * (*get_radio_name)(void *priv);
2703
2704 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002705 * send_tdls_mgmt - for sending TDLS management packets
2706 * @priv: private driver interface data
2707 * @dst: Destination (peer) MAC address
2708 * @action_code: TDLS action code for the mssage
2709 * @dialog_token: Dialog Token to use in the message (if needed)
2710 * @status_code: Status Code or Reason Code to use (if needed)
Dmitry Shmidtdf5a7e42014-04-02 12:59:59 -07002711 * @peer_capab: TDLS peer capability (TDLS_PEER_* bitfield)
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -07002712 * @initiator: Is the current end the TDLS link initiator
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002713 * @buf: TDLS IEs to add to the message
2714 * @len: Length of buf in octets
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002715 * Returns: 0 on success, negative (<0) on failure
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002716 *
2717 * This optional function can be used to send packet to driver which is
2718 * responsible for receiving and sending all TDLS packets.
2719 */
2720 int (*send_tdls_mgmt)(void *priv, const u8 *dst, u8 action_code,
Dmitry Shmidtdf5a7e42014-04-02 12:59:59 -07002721 u8 dialog_token, u16 status_code, u32 peer_capab,
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -07002722 int initiator, const u8 *buf, size_t len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002723
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002724 /**
2725 * tdls_oper - Ask the driver to perform high-level TDLS operations
2726 * @priv: Private driver interface data
2727 * @oper: TDLS high-level operation. See %enum tdls_oper
2728 * @peer: Destination (peer) MAC address
2729 * Returns: 0 on success, negative (<0) on failure
2730 *
2731 * This optional function can be used to send high-level TDLS commands
2732 * to the driver.
2733 */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002734 int (*tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer);
2735
2736 /**
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07002737 * wnm_oper - Notify driver of the WNM frame reception
2738 * @priv: Private driver interface data
2739 * @oper: WNM operation. See %enum wnm_oper
2740 * @peer: Destination (peer) MAC address
2741 * @buf: Buffer for the driver to fill in (for getting IE)
2742 * @buf_len: Return the len of buf
2743 * Returns: 0 on success, negative (<0) on failure
2744 */
2745 int (*wnm_oper)(void *priv, enum wnm_oper oper, const u8 *peer,
2746 u8 *buf, u16 *buf_len);
2747
2748 /**
Dmitry Shmidt051af732013-10-22 13:52:46 -07002749 * set_qos_map - Set QoS Map
2750 * @priv: Private driver interface data
2751 * @qos_map_set: QoS Map
2752 * @qos_map_set_len: Length of QoS Map
2753 */
2754 int (*set_qos_map)(void *priv, const u8 *qos_map_set,
2755 u8 qos_map_set_len);
2756
2757 /**
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002758 * br_add_ip_neigh - Add a neigh to the bridge ip neigh table
2759 * @priv: Private driver interface data
2760 * @version: IP version of the IP address, 4 or 6
2761 * @ipaddr: IP address for the neigh entry
2762 * @prefixlen: IP address prefix length
2763 * @addr: Corresponding MAC address
2764 * Returns: 0 on success, negative (<0) on failure
2765 */
2766 int (*br_add_ip_neigh)(void *priv, u8 version, const u8 *ipaddr,
2767 int prefixlen, const u8 *addr);
2768
2769 /**
2770 * br_delete_ip_neigh - Remove a neigh from the bridge ip neigh table
2771 * @priv: Private driver interface data
2772 * @version: IP version of the IP address, 4 or 6
2773 * @ipaddr: IP address for the neigh entry
2774 * Returns: 0 on success, negative (<0) on failure
2775 */
2776 int (*br_delete_ip_neigh)(void *priv, u8 version, const u8 *ipaddr);
2777
2778 /**
2779 * br_port_set_attr - Set a bridge port attribute
2780 * @attr: Bridge port attribute to set
2781 * @val: Value to be set
2782 * Returns: 0 on success, negative (<0) on failure
2783 */
2784 int (*br_port_set_attr)(void *priv, enum drv_br_port_attr attr,
2785 unsigned int val);
2786
2787 /**
2788 * br_port_set_attr - Set a bridge network parameter
2789 * @param: Bridge parameter to set
2790 * @val: Value to be set
2791 * Returns: 0 on success, negative (<0) on failure
2792 */
2793 int (*br_set_net_param)(void *priv, enum drv_br_net_param param,
2794 unsigned int val);
2795
2796 /**
Dmitry Shmidtb58836e2014-04-29 14:35:56 -07002797 * set_wowlan - Set wake-on-wireless triggers
2798 * @priv: Private driver interface data
2799 * @triggers: wowlan triggers
2800 */
2801 int (*set_wowlan)(void *priv, const struct wowlan_triggers *triggers);
2802
2803 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002804 * signal_poll - Get current connection information
2805 * @priv: Private driver interface data
2806 * @signal_info: Connection info structure
Dmitry Shmidt7832adb2014-04-29 10:53:02 -07002807 */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002808 int (*signal_poll)(void *priv, struct wpa_signal_info *signal_info);
Dmitry Shmidtbd567ad2011-05-09 14:17:09 -07002809
2810 /**
Jouni Malinen75ecf522011-06-27 15:19:46 -07002811 * set_authmode - Set authentication algorithm(s) for static WEP
2812 * @priv: Private driver interface data
2813 * @authmode: 1=Open System, 2=Shared Key, 3=both
2814 * Returns: 0 on success, -1 on failure
2815 *
2816 * This function can be used to set authentication algorithms for AP
2817 * mode when static WEP is used. If the driver uses user space MLME/SME
2818 * implementation, there is no need to implement this function.
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002819 *
2820 * DEPRECATED - use set_ap() instead
Jouni Malinen75ecf522011-06-27 15:19:46 -07002821 */
2822 int (*set_authmode)(void *priv, int authmode);
Dmitry Shmidt292b0c32013-11-22 12:54:42 -08002823
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002824#ifdef ANDROID
Jouni Malinen75ecf522011-06-27 15:19:46 -07002825 /**
Dmitry Shmidt292b0c32013-11-22 12:54:42 -08002826 * driver_cmd - Execute driver-specific command
2827 * @priv: Private driver interface data
2828 * @cmd: Command to execute
2829 * @buf: Return buffer
2830 * @buf_len: Buffer length
Dmitry Shmidtbd567ad2011-05-09 14:17:09 -07002831 * Returns: 0 on success, -1 on failure
2832 */
Dmitry Shmidt292b0c32013-11-22 12:54:42 -08002833 int (*driver_cmd)(void *priv, char *cmd, char *buf, size_t buf_len);
2834#endif /* ANDROID */
2835
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002836 /**
Dmitry Shmidta38abf92014-03-06 13:38:44 -08002837 * vendor_cmd - Execute vendor specific command
2838 * @priv: Private driver interface data
2839 * @vendor_id: Vendor id
2840 * @subcmd: Vendor command id
2841 * @data: Vendor command parameters (%NULL if no parameters)
2842 * @data_len: Data length
2843 * @buf: Return buffer (%NULL to ignore reply)
2844 * Returns: 0 on success, negative (<0) on failure
2845 *
2846 * This function handles vendor specific commands that are passed to
2847 * the driver/device. The command is identified by vendor id and
2848 * command id. Parameters can be passed as argument to the command
2849 * in the data buffer. Reply (if any) will be filled in the supplied
2850 * return buffer.
2851 *
2852 * The exact driver behavior is driver interface and vendor specific. As
2853 * an example, this will be converted to a vendor specific cfg80211
2854 * command in case of the nl80211 driver interface.
2855 */
2856 int (*vendor_cmd)(void *priv, unsigned int vendor_id,
2857 unsigned int subcmd, const u8 *data, size_t data_len,
2858 struct wpabuf *buf);
2859
2860 /**
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002861 * set_rekey_info - Set rekey information
2862 * @priv: Private driver interface data
2863 * @kek: Current KEK
Dmitry Shmidt807291d2015-01-27 13:40:23 -08002864 * @kek_len: KEK length in octets
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002865 * @kck: Current KCK
Dmitry Shmidt807291d2015-01-27 13:40:23 -08002866 * @kck_len: KCK length in octets
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002867 * @replay_ctr: Current EAPOL-Key Replay Counter
2868 *
2869 * This optional function can be used to provide information for the
2870 * driver/firmware to process EAPOL-Key frames in Group Key Handshake
2871 * while the host (including wpa_supplicant) is sleeping.
2872 */
Dmitry Shmidt807291d2015-01-27 13:40:23 -08002873 void (*set_rekey_info)(void *priv, const u8 *kek, size_t kek_len,
2874 const u8 *kck, size_t kck_len,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002875 const u8 *replay_ctr);
2876
2877 /**
2878 * sta_assoc - Station association indication
2879 * @priv: Private driver interface data
2880 * @own_addr: Source address and BSSID for association frame
2881 * @addr: MAC address of the station to associate
2882 * @reassoc: flag to indicate re-association
2883 * @status: association response status code
2884 * @ie: assoc response ie buffer
2885 * @len: ie buffer length
2886 * Returns: 0 on success, -1 on failure
2887 *
2888 * This function indicates the driver to send (Re)Association
2889 * Response frame to the station.
2890 */
2891 int (*sta_assoc)(void *priv, const u8 *own_addr, const u8 *addr,
2892 int reassoc, u16 status, const u8 *ie, size_t len);
2893
2894 /**
2895 * sta_auth - Station authentication indication
2896 * @priv: Private driver interface data
2897 * @own_addr: Source address and BSSID for authentication frame
2898 * @addr: MAC address of the station to associate
2899 * @seq: authentication sequence number
2900 * @status: authentication response status code
2901 * @ie: authentication frame ie buffer
2902 * @len: ie buffer length
2903 *
2904 * This function indicates the driver to send Authentication frame
2905 * to the station.
2906 */
2907 int (*sta_auth)(void *priv, const u8 *own_addr, const u8 *addr,
2908 u16 seq, u16 status, const u8 *ie, size_t len);
2909
2910 /**
2911 * add_tspec - Add traffic stream
2912 * @priv: Private driver interface data
2913 * @addr: MAC address of the station to associate
2914 * @tspec_ie: tspec ie buffer
2915 * @tspec_ielen: tspec ie length
2916 * Returns: 0 on success, -1 on failure
2917 *
2918 * This function adds the traffic steam for the station
2919 * and fills the medium_time in tspec_ie.
2920 */
2921 int (*add_tspec)(void *priv, const u8 *addr, u8 *tspec_ie,
2922 size_t tspec_ielen);
2923
2924 /**
2925 * add_sta_node - Add a station node in the driver
2926 * @priv: Private driver interface data
2927 * @addr: MAC address of the station to add
2928 * @auth_alg: authentication algorithm used by the station
2929 * Returns: 0 on success, -1 on failure
2930 *
2931 * This function adds the station node in the driver, when
2932 * the station gets added by FT-over-DS.
2933 */
2934 int (*add_sta_node)(void *priv, const u8 *addr, u16 auth_alg);
2935
2936 /**
2937 * sched_scan - Request the driver to initiate scheduled scan
2938 * @priv: Private driver interface data
2939 * @params: Scan parameters
2940 * @interval: Interval between scan cycles in milliseconds
2941 * Returns: 0 on success, -1 on failure
2942 *
2943 * This operation should be used for scheduled scan offload to
2944 * the hardware. Every time scan results are available, the
2945 * driver should report scan results event for wpa_supplicant
2946 * which will eventually request the results with
2947 * wpa_driver_get_scan_results2(). This operation is optional
2948 * and if not provided or if it returns -1, we fall back to
2949 * normal host-scheduled scans.
2950 */
2951 int (*sched_scan)(void *priv, struct wpa_driver_scan_params *params,
2952 u32 interval);
2953
2954 /**
2955 * stop_sched_scan - Request the driver to stop a scheduled scan
2956 * @priv: Private driver interface data
2957 * Returns: 0 on success, -1 on failure
2958 *
2959 * This should cause the scheduled scan to be stopped and
2960 * results should stop being sent. Must be supported if
2961 * sched_scan is supported.
2962 */
2963 int (*stop_sched_scan)(void *priv);
2964
2965 /**
2966 * poll_client - Probe (null data or such) the given station
2967 * @priv: Private driver interface data
2968 * @own_addr: MAC address of sending interface
2969 * @addr: MAC address of the station to probe
2970 * @qos: Indicates whether station is QoS station
2971 *
2972 * This function is used to verify whether an associated station is
2973 * still present. This function does not need to be implemented if the
2974 * driver provides such inactivity polling mechanism.
2975 */
2976 void (*poll_client)(void *priv, const u8 *own_addr,
2977 const u8 *addr, int qos);
Dmitry Shmidt04949592012-07-19 12:16:46 -07002978
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002979 /**
Dmitry Shmidt04949592012-07-19 12:16:46 -07002980 * radio_disable - Disable/enable radio
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002981 * @priv: Private driver interface data
Dmitry Shmidt04949592012-07-19 12:16:46 -07002982 * @disabled: 1=disable 0=enable radio
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002983 * Returns: 0 on success, -1 on failure
2984 *
Dmitry Shmidt04949592012-07-19 12:16:46 -07002985 * This optional command is for testing purposes. It can be used to
2986 * disable the radio on a testbed device to simulate out-of-radio-range
2987 * conditions.
2988 */
2989 int (*radio_disable)(void *priv, int disabled);
2990
2991 /**
2992 * switch_channel - Announce channel switch and migrate the GO to the
2993 * given frequency
2994 * @priv: Private driver interface data
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08002995 * @settings: Settings for CSA period and new channel
Dmitry Shmidt04949592012-07-19 12:16:46 -07002996 * Returns: 0 on success, -1 on failure
2997 *
2998 * This function is used to move the GO to the legacy STA channel to
2999 * avoid frequency conflict in single channel concurrency.
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003000 */
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08003001 int (*switch_channel)(void *priv, struct csa_settings *settings);
Dmitry Shmidtea69e842013-05-13 14:52:28 -07003002
3003 /**
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08003004 * add_tx_ts - Add traffic stream
3005 * @priv: Private driver interface data
3006 * @tsid: Traffic stream ID
3007 * @addr: Receiver address
3008 * @user_prio: User priority of the traffic stream
3009 * @admitted_time: Admitted time for this TS in units of
3010 * 32 microsecond periods (per second).
3011 * Returns: 0 on success, -1 on failure
3012 */
3013 int (*add_tx_ts)(void *priv, u8 tsid, const u8 *addr, u8 user_prio,
3014 u16 admitted_time);
3015
3016 /**
3017 * del_tx_ts - Delete traffic stream
3018 * @priv: Private driver interface data
3019 * @tsid: Traffic stream ID
3020 * @addr: Receiver address
3021 * Returns: 0 on success, -1 on failure
3022 */
3023 int (*del_tx_ts)(void *priv, u8 tsid, const u8 *addr);
3024
3025 /**
3026 * Enable channel-switching with TDLS peer
3027 * @priv: Private driver interface data
3028 * @addr: MAC address of the TDLS peer
3029 * @oper_class: Operating class of the switch channel
3030 * @params: Channel specification
3031 * Returns: 0 on success, -1 on failure
3032 *
3033 * The function indicates to driver that it can start switching to a
3034 * different channel with a specified TDLS peer. The switching is
3035 * assumed on until canceled with tdls_disable_channel_switch().
3036 */
3037 int (*tdls_enable_channel_switch)(
3038 void *priv, const u8 *addr, u8 oper_class,
3039 const struct hostapd_freq_params *params);
3040
3041 /**
3042 * Disable channel switching with TDLS peer
3043 * @priv: Private driver interface data
3044 * @addr: MAC address of the TDLS peer
3045 * Returns: 0 on success, -1 on failure
3046 *
3047 * This function indicates to the driver that it should stop switching
3048 * with a given TDLS peer.
3049 */
3050 int (*tdls_disable_channel_switch)(void *priv, const u8 *addr);
3051
3052 /**
Dmitry Shmidtea69e842013-05-13 14:52:28 -07003053 * start_dfs_cac - Listen for radar interference on the channel
3054 * @priv: Private driver interface data
Dmitry Shmidt051af732013-10-22 13:52:46 -07003055 * @freq: Channel parameters
Dmitry Shmidtea69e842013-05-13 14:52:28 -07003056 * Returns: 0 on success, -1 on failure
3057 */
Dmitry Shmidt051af732013-10-22 13:52:46 -07003058 int (*start_dfs_cac)(void *priv, struct hostapd_freq_params *freq);
Dmitry Shmidtea69e842013-05-13 14:52:28 -07003059
3060 /**
3061 * stop_ap - Removes beacon from AP
3062 * @priv: Private driver interface data
3063 * Returns: 0 on success, -1 on failure (or if not supported)
3064 *
3065 * This optional function can be used to disable AP mode related
3066 * configuration. Unlike deinit_ap, it does not change to station
3067 * mode.
3068 */
3069 int (*stop_ap)(void *priv);
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -07003070
3071 /**
3072 * get_survey - Retrieve survey data
3073 * @priv: Private driver interface data
3074 * @freq: If set, survey data for the specified frequency is only
3075 * being requested. If not set, all survey data is requested.
3076 * Returns: 0 on success, -1 on failure
3077 *
3078 * Use this to retrieve:
3079 *
3080 * - the observed channel noise floor
3081 * - the amount of time we have spent on the channel
3082 * - the amount of time during which we have spent on the channel that
3083 * the radio has determined the medium is busy and we cannot
3084 * transmit
3085 * - the amount of time we have spent receiving data
3086 * - the amount of time we have spent transmitting data
3087 *
3088 * This data can be used for spectrum heuristics. One example is
3089 * Automatic Channel Selection (ACS). The channel survey data is
3090 * kept on a linked list on the channel data, one entry is added
3091 * for each survey. The min_nf of the channel is updated for each
3092 * survey.
3093 */
3094 int (*get_survey)(void *priv, unsigned int freq);
Dmitry Shmidt56052862013-10-04 10:23:25 -07003095
3096 /**
3097 * status - Get driver interface status information
3098 * @priv: Private driver interface data
3099 * @buf: Buffer for printing tou the status information
3100 * @buflen: Maximum length of the buffer
3101 * Returns: Length of written status information or -1 on failure
3102 */
3103 int (*status)(void *priv, char *buf, size_t buflen);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07003104
Dmitry Shmidt661b4f72014-09-29 14:58:27 -07003105 /**
3106 * roaming - Set roaming policy for driver-based BSS selection
3107 * @priv: Private driver interface data
3108 * @allowed: Whether roaming within ESS is allowed
3109 * @bssid: Forced BSSID if roaming is disabled or %NULL if not set
3110 * Returns: Length of written status information or -1 on failure
3111 *
3112 * This optional callback can be used to update roaming policy from the
3113 * associate() command (bssid being set there indicates that the driver
3114 * should not roam before getting this roaming() call to allow roaming.
3115 * If the driver does not indicate WPA_DRIVER_FLAGS_BSS_SELECTION
3116 * capability, roaming policy is handled within wpa_supplicant and there
3117 * is no need to implement or react to this callback.
3118 */
3119 int (*roaming)(void *priv, int allowed, const u8 *bssid);
3120
3121 /**
3122 * set_mac_addr - Set MAC address
3123 * @priv: Private driver interface data
3124 * @addr: MAC address to use or %NULL for setting back to permanent
3125 * Returns: 0 on success, -1 on failure
3126 */
3127 int (*set_mac_addr)(void *priv, const u8 *addr);
3128
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07003129#ifdef CONFIG_MACSEC
3130 int (*macsec_init)(void *priv, struct macsec_init_params *params);
3131
3132 int (*macsec_deinit)(void *priv);
3133
3134 /**
3135 * enable_protect_frames - Set protect frames status
3136 * @priv: Private driver interface data
3137 * @enabled: TRUE = protect frames enabled
3138 * FALSE = protect frames disabled
3139 * Returns: 0 on success, -1 on failure (or if not supported)
3140 */
3141 int (*enable_protect_frames)(void *priv, Boolean enabled);
3142
3143 /**
3144 * set_replay_protect - Set replay protect status and window size
3145 * @priv: Private driver interface data
3146 * @enabled: TRUE = replay protect enabled
3147 * FALSE = replay protect disabled
3148 * @window: replay window size, valid only when replay protect enabled
3149 * Returns: 0 on success, -1 on failure (or if not supported)
3150 */
3151 int (*set_replay_protect)(void *priv, Boolean enabled, u32 window);
3152
3153 /**
3154 * set_current_cipher_suite - Set current cipher suite
3155 * @priv: Private driver interface data
3156 * @cs: EUI64 identifier
3157 * @cs_len: Length of the cs buffer in octets
3158 * Returns: 0 on success, -1 on failure (or if not supported)
3159 */
3160 int (*set_current_cipher_suite)(void *priv, const u8 *cs,
3161 size_t cs_len);
3162
3163 /**
3164 * enable_controlled_port - Set controlled port status
3165 * @priv: Private driver interface data
3166 * @enabled: TRUE = controlled port enabled
3167 * FALSE = controlled port disabled
3168 * Returns: 0 on success, -1 on failure (or if not supported)
3169 */
3170 int (*enable_controlled_port)(void *priv, Boolean enabled);
3171
3172 /**
3173 * get_receive_lowest_pn - Get receive lowest pn
3174 * @priv: Private driver interface data
3175 * @channel: secure channel
3176 * @an: association number
3177 * @lowest_pn: lowest accept pn
3178 * Returns: 0 on success, -1 on failure (or if not supported)
3179 */
3180 int (*get_receive_lowest_pn)(void *priv, u32 channel, u8 an,
3181 u32 *lowest_pn);
3182
3183 /**
3184 * get_transmit_next_pn - Get transmit next pn
3185 * @priv: Private driver interface data
3186 * @channel: secure channel
3187 * @an: association number
3188 * @next_pn: next pn
3189 * Returns: 0 on success, -1 on failure (or if not supported)
3190 */
3191 int (*get_transmit_next_pn)(void *priv, u32 channel, u8 an,
3192 u32 *next_pn);
3193
3194 /**
3195 * set_transmit_next_pn - Set transmit next pn
3196 * @priv: Private driver interface data
3197 * @channel: secure channel
3198 * @an: association number
3199 * @next_pn: next pn
3200 * Returns: 0 on success, -1 on failure (or if not supported)
3201 */
3202 int (*set_transmit_next_pn)(void *priv, u32 channel, u8 an,
3203 u32 next_pn);
3204
3205 /**
3206 * get_available_receive_sc - get available receive channel
3207 * @priv: Private driver interface data
3208 * @channel: secure channel
3209 * Returns: 0 on success, -1 on failure (or if not supported)
3210 */
3211 int (*get_available_receive_sc)(void *priv, u32 *channel);
3212
3213 /**
3214 * create_receive_sc - create secure channel for receiving
3215 * @priv: Private driver interface data
3216 * @channel: secure channel
3217 * @sci_addr: secure channel identifier - address
3218 * @sci_port: secure channel identifier - port
3219 * @conf_offset: confidentiality offset (0, 30, or 50)
3220 * @validation: frame validation policy (0 = Disabled, 1 = Checked,
3221 * 2 = Strict)
3222 * Returns: 0 on success, -1 on failure (or if not supported)
3223 */
3224 int (*create_receive_sc)(void *priv, u32 channel, const u8 *sci_addr,
3225 u16 sci_port, unsigned int conf_offset,
3226 int validation);
3227
3228 /**
3229 * delete_receive_sc - delete secure connection for receiving
3230 * @priv: private driver interface data from init()
3231 * @channel: secure channel
3232 * Returns: 0 on success, -1 on failure
3233 */
3234 int (*delete_receive_sc)(void *priv, u32 channel);
3235
3236 /**
3237 * create_receive_sa - create secure association for receive
3238 * @priv: private driver interface data from init()
3239 * @channel: secure channel
3240 * @an: association number
3241 * @lowest_pn: the lowest packet number can be received
3242 * @sak: the secure association key
3243 * Returns: 0 on success, -1 on failure
3244 */
3245 int (*create_receive_sa)(void *priv, u32 channel, u8 an,
3246 u32 lowest_pn, const u8 *sak);
3247
3248 /**
3249 * enable_receive_sa - enable the SA for receive
3250 * @priv: private driver interface data from init()
3251 * @channel: secure channel
3252 * @an: association number
3253 * Returns: 0 on success, -1 on failure
3254 */
3255 int (*enable_receive_sa)(void *priv, u32 channel, u8 an);
3256
3257 /**
3258 * disable_receive_sa - disable SA for receive
3259 * @priv: private driver interface data from init()
3260 * @channel: secure channel index
3261 * @an: association number
3262 * Returns: 0 on success, -1 on failure
3263 */
3264 int (*disable_receive_sa)(void *priv, u32 channel, u8 an);
3265
3266 /**
3267 * get_available_transmit_sc - get available transmit channel
3268 * @priv: Private driver interface data
3269 * @channel: secure channel
3270 * Returns: 0 on success, -1 on failure (or if not supported)
3271 */
3272 int (*get_available_transmit_sc)(void *priv, u32 *channel);
3273
3274 /**
3275 * create_transmit_sc - create secure connection for transmit
3276 * @priv: private driver interface data from init()
3277 * @channel: secure channel
3278 * @sci_addr: secure channel identifier - address
3279 * @sci_port: secure channel identifier - port
3280 * Returns: 0 on success, -1 on failure
3281 */
3282 int (*create_transmit_sc)(void *priv, u32 channel, const u8 *sci_addr,
3283 u16 sci_port, unsigned int conf_offset);
3284
3285 /**
3286 * delete_transmit_sc - delete secure connection for transmit
3287 * @priv: private driver interface data from init()
3288 * @channel: secure channel
3289 * Returns: 0 on success, -1 on failure
3290 */
3291 int (*delete_transmit_sc)(void *priv, u32 channel);
3292
3293 /**
3294 * create_transmit_sa - create secure association for transmit
3295 * @priv: private driver interface data from init()
3296 * @channel: secure channel index
3297 * @an: association number
3298 * @next_pn: the packet number used as next transmit packet
3299 * @confidentiality: True if the SA is to provide confidentiality
3300 * as well as integrity
3301 * @sak: the secure association key
3302 * Returns: 0 on success, -1 on failure
3303 */
3304 int (*create_transmit_sa)(void *priv, u32 channel, u8 an, u32 next_pn,
3305 Boolean confidentiality, const u8 *sak);
3306
3307 /**
3308 * enable_transmit_sa - enable SA for transmit
3309 * @priv: private driver interface data from init()
3310 * @channel: secure channel
3311 * @an: association number
3312 * Returns: 0 on success, -1 on failure
3313 */
3314 int (*enable_transmit_sa)(void *priv, u32 channel, u8 an);
3315
3316 /**
3317 * disable_transmit_sa - disable SA for transmit
3318 * @priv: private driver interface data from init()
3319 * @channel: secure channel
3320 * @an: association number
3321 * Returns: 0 on success, -1 on failure
3322 */
3323 int (*disable_transmit_sa)(void *priv, u32 channel, u8 an);
3324#endif /* CONFIG_MACSEC */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08003325
3326 /**
3327 * init_mesh - Driver specific initialization for mesh
3328 * @priv: Private driver interface data
3329 * Returns: 0 on success, -1 on failure
3330 */
3331 int (*init_mesh)(void *priv);
3332
3333 /**
3334 * join_mesh - Join a mesh network
3335 * @priv: Private driver interface data
3336 * @params: Mesh configuration parameters
3337 * Returns: 0 on success, -1 on failure
3338 */
3339 int (*join_mesh)(void *priv,
3340 struct wpa_driver_mesh_join_params *params);
3341
3342 /**
3343 * leave_mesh - Leave a mesh network
3344 * @priv: Private driver interface data
3345 * Returns 0 on success, -1 on failure
3346 */
3347 int (*leave_mesh)(void *priv);
3348
3349 /**
3350 * do_acs - Automatically select channel
3351 * @priv: Private driver interface data
3352 * @params: Parameters for ACS
3353 * Returns 0 on success, -1 on failure
3354 *
3355 * This command can be used to offload ACS to the driver if the driver
3356 * indicates support for such offloading (WPA_DRIVER_FLAGS_ACS_OFFLOAD).
3357 */
3358 int (*do_acs)(void *priv, struct drv_acs_params *params);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003359};
3360
3361
3362/**
3363 * enum wpa_event_type - Event type for wpa_supplicant_event() calls
3364 */
3365enum wpa_event_type {
3366 /**
3367 * EVENT_ASSOC - Association completed
3368 *
3369 * This event needs to be delivered when the driver completes IEEE
3370 * 802.11 association or reassociation successfully.
3371 * wpa_driver_ops::get_bssid() is expected to provide the current BSSID
3372 * after this event has been generated. In addition, optional
3373 * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
3374 * more information about the association. If the driver interface gets
3375 * both of these events at the same time, it can also include the
3376 * assoc_info data in EVENT_ASSOC call.
3377 */
3378 EVENT_ASSOC,
3379
3380 /**
3381 * EVENT_DISASSOC - Association lost
3382 *
3383 * This event should be called when association is lost either due to
3384 * receiving deauthenticate or disassociate frame from the AP or when
3385 * sending either of these frames to the current AP. If the driver
3386 * supports separate deauthentication event, EVENT_DISASSOC should only
3387 * be used for disassociation and EVENT_DEAUTH for deauthentication.
3388 * In AP mode, union wpa_event_data::disassoc_info is required.
3389 */
3390 EVENT_DISASSOC,
3391
3392 /**
3393 * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
3394 *
3395 * This event must be delivered when a Michael MIC error is detected by
3396 * the local driver. Additional data for event processing is
3397 * provided with union wpa_event_data::michael_mic_failure. This
3398 * information is used to request new encyption key and to initiate
3399 * TKIP countermeasures if needed.
3400 */
3401 EVENT_MICHAEL_MIC_FAILURE,
3402
3403 /**
3404 * EVENT_SCAN_RESULTS - Scan results available
3405 *
3406 * This event must be called whenever scan results are available to be
3407 * fetched with struct wpa_driver_ops::get_scan_results(). This event
3408 * is expected to be used some time after struct wpa_driver_ops::scan()
3409 * is called. If the driver provides an unsolicited event when the scan
3410 * has been completed, this event can be used to trigger
3411 * EVENT_SCAN_RESULTS call. If such event is not available from the
3412 * driver, the driver wrapper code is expected to use a registered
3413 * timeout to generate EVENT_SCAN_RESULTS call after the time that the
3414 * scan is expected to be completed. Optional information about
3415 * completed scan can be provided with union wpa_event_data::scan_info.
3416 */
3417 EVENT_SCAN_RESULTS,
3418
3419 /**
3420 * EVENT_ASSOCINFO - Report optional extra information for association
3421 *
3422 * This event can be used to report extra association information for
3423 * EVENT_ASSOC processing. This extra information includes IEs from
3424 * association frames and Beacon/Probe Response frames in union
3425 * wpa_event_data::assoc_info. EVENT_ASSOCINFO must be send just before
3426 * EVENT_ASSOC. Alternatively, the driver interface can include
3427 * assoc_info data in the EVENT_ASSOC call if it has all the
3428 * information available at the same point.
3429 */
3430 EVENT_ASSOCINFO,
3431
3432 /**
3433 * EVENT_INTERFACE_STATUS - Report interface status changes
3434 *
3435 * This optional event can be used to report changes in interface
3436 * status (interface added/removed) using union
3437 * wpa_event_data::interface_status. This can be used to trigger
3438 * wpa_supplicant to stop and re-start processing for the interface,
3439 * e.g., when a cardbus card is ejected/inserted.
3440 */
3441 EVENT_INTERFACE_STATUS,
3442
3443 /**
3444 * EVENT_PMKID_CANDIDATE - Report a candidate AP for pre-authentication
3445 *
3446 * This event can be used to inform wpa_supplicant about candidates for
3447 * RSN (WPA2) pre-authentication. If wpa_supplicant is not responsible
3448 * for scan request (ap_scan=2 mode), this event is required for
3449 * pre-authentication. If wpa_supplicant is performing scan request
3450 * (ap_scan=1), this event is optional since scan results can be used
3451 * to add pre-authentication candidates. union
3452 * wpa_event_data::pmkid_candidate is used to report the BSSID of the
3453 * candidate and priority of the candidate, e.g., based on the signal
3454 * strength, in order to try to pre-authenticate first with candidates
3455 * that are most likely targets for re-association.
3456 *
3457 * EVENT_PMKID_CANDIDATE can be called whenever the driver has updates
3458 * on the candidate list. In addition, it can be called for the current
3459 * AP and APs that have existing PMKSA cache entries. wpa_supplicant
3460 * will automatically skip pre-authentication in cases where a valid
3461 * PMKSA exists. When more than one candidate exists, this event should
3462 * be generated once for each candidate.
3463 *
3464 * Driver will be notified about successful pre-authentication with
3465 * struct wpa_driver_ops::add_pmkid() calls.
3466 */
3467 EVENT_PMKID_CANDIDATE,
3468
3469 /**
3470 * EVENT_STKSTART - Request STK handshake (MLME-STKSTART.request)
3471 *
3472 * This event can be used to inform wpa_supplicant about desire to set
3473 * up secure direct link connection between two stations as defined in
3474 * IEEE 802.11e with a new PeerKey mechanism that replaced the original
3475 * STAKey negotiation. The caller will need to set peer address for the
3476 * event.
3477 */
3478 EVENT_STKSTART,
3479
3480 /**
3481 * EVENT_TDLS - Request TDLS operation
3482 *
3483 * This event can be used to request a TDLS operation to be performed.
3484 */
3485 EVENT_TDLS,
3486
3487 /**
3488 * EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs
3489 *
3490 * The driver is expected to report the received FT IEs from
3491 * FT authentication sequence from the AP. The FT IEs are included in
3492 * the extra information in union wpa_event_data::ft_ies.
3493 */
3494 EVENT_FT_RESPONSE,
3495
3496 /**
3497 * EVENT_IBSS_RSN_START - Request RSN authentication in IBSS
3498 *
3499 * The driver can use this event to inform wpa_supplicant about a STA
3500 * in an IBSS with which protected frames could be exchanged. This
3501 * event starts RSN authentication with the other STA to authenticate
3502 * the STA and set up encryption keys with it.
3503 */
3504 EVENT_IBSS_RSN_START,
3505
3506 /**
3507 * EVENT_AUTH - Authentication result
3508 *
3509 * This event should be called when authentication attempt has been
3510 * completed. This is only used if the driver supports separate
3511 * authentication step (struct wpa_driver_ops::authenticate).
3512 * Information about authentication result is included in
3513 * union wpa_event_data::auth.
3514 */
3515 EVENT_AUTH,
3516
3517 /**
3518 * EVENT_DEAUTH - Authentication lost
3519 *
3520 * This event should be called when authentication is lost either due
3521 * to receiving deauthenticate frame from the AP or when sending that
3522 * frame to the current AP.
3523 * In AP mode, union wpa_event_data::deauth_info is required.
3524 */
3525 EVENT_DEAUTH,
3526
3527 /**
3528 * EVENT_ASSOC_REJECT - Association rejected
3529 *
3530 * This event should be called when (re)association attempt has been
3531 * rejected by the AP. Information about the association response is
3532 * included in union wpa_event_data::assoc_reject.
3533 */
3534 EVENT_ASSOC_REJECT,
3535
3536 /**
3537 * EVENT_AUTH_TIMED_OUT - Authentication timed out
3538 */
3539 EVENT_AUTH_TIMED_OUT,
3540
3541 /**
3542 * EVENT_ASSOC_TIMED_OUT - Association timed out
3543 */
3544 EVENT_ASSOC_TIMED_OUT,
3545
3546 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003547 * EVENT_WPS_BUTTON_PUSHED - Report hardware push button press for WPS
3548 */
3549 EVENT_WPS_BUTTON_PUSHED,
3550
3551 /**
3552 * EVENT_TX_STATUS - Report TX status
3553 */
3554 EVENT_TX_STATUS,
3555
3556 /**
3557 * EVENT_RX_FROM_UNKNOWN - Report RX from unknown STA
3558 */
3559 EVENT_RX_FROM_UNKNOWN,
3560
3561 /**
3562 * EVENT_RX_MGMT - Report RX of a management frame
3563 */
3564 EVENT_RX_MGMT,
3565
3566 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003567 * EVENT_REMAIN_ON_CHANNEL - Remain-on-channel duration started
3568 *
3569 * This event is used to indicate when the driver has started the
3570 * requested remain-on-channel duration. Information about the
3571 * operation is included in union wpa_event_data::remain_on_channel.
3572 */
3573 EVENT_REMAIN_ON_CHANNEL,
3574
3575 /**
3576 * EVENT_CANCEL_REMAIN_ON_CHANNEL - Remain-on-channel timed out
3577 *
3578 * This event is used to indicate when the driver has completed
3579 * remain-on-channel duration, i.e., may noot be available on the
3580 * requested channel anymore. Information about the
3581 * operation is included in union wpa_event_data::remain_on_channel.
3582 */
3583 EVENT_CANCEL_REMAIN_ON_CHANNEL,
3584
3585 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003586 * EVENT_RX_PROBE_REQ - Indicate received Probe Request frame
3587 *
3588 * This event is used to indicate when a Probe Request frame has been
3589 * received. Information about the received frame is included in
3590 * union wpa_event_data::rx_probe_req. The driver is required to report
3591 * these events only after successfully completed probe_req_report()
3592 * commands to request the events (i.e., report parameter is non-zero)
3593 * in station mode. In AP mode, Probe Request frames should always be
3594 * reported.
3595 */
3596 EVENT_RX_PROBE_REQ,
3597
3598 /**
3599 * EVENT_NEW_STA - New wired device noticed
3600 *
3601 * This event is used to indicate that a new device has been detected
3602 * in a network that does not use association-like functionality (i.e.,
3603 * mainly wired Ethernet). This can be used to start EAPOL
3604 * authenticator when receiving a frame from a device. The address of
3605 * the device is included in union wpa_event_data::new_sta.
3606 */
3607 EVENT_NEW_STA,
3608
3609 /**
3610 * EVENT_EAPOL_RX - Report received EAPOL frame
3611 *
3612 * When in AP mode with hostapd, this event is required to be used to
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08003613 * deliver the receive EAPOL frames from the driver.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003614 */
3615 EVENT_EAPOL_RX,
3616
3617 /**
3618 * EVENT_SIGNAL_CHANGE - Indicate change in signal strength
3619 *
3620 * This event is used to indicate changes in the signal strength
3621 * observed in frames received from the current AP if signal strength
3622 * monitoring has been enabled with signal_monitor().
3623 */
3624 EVENT_SIGNAL_CHANGE,
3625
3626 /**
3627 * EVENT_INTERFACE_ENABLED - Notify that interface was enabled
3628 *
3629 * This event is used to indicate that the interface was enabled after
3630 * having been previously disabled, e.g., due to rfkill.
3631 */
3632 EVENT_INTERFACE_ENABLED,
3633
3634 /**
3635 * EVENT_INTERFACE_DISABLED - Notify that interface was disabled
3636 *
3637 * This event is used to indicate that the interface was disabled,
3638 * e.g., due to rfkill.
3639 */
3640 EVENT_INTERFACE_DISABLED,
3641
3642 /**
3643 * EVENT_CHANNEL_LIST_CHANGED - Channel list changed
3644 *
3645 * This event is used to indicate that the channel list has changed,
3646 * e.g., because of a regulatory domain change triggered by scan
3647 * results including an AP advertising a country code.
3648 */
3649 EVENT_CHANNEL_LIST_CHANGED,
3650
3651 /**
3652 * EVENT_INTERFACE_UNAVAILABLE - Notify that interface is unavailable
3653 *
3654 * This event is used to indicate that the driver cannot maintain this
3655 * interface in its operation mode anymore. The most likely use for
3656 * this is to indicate that AP mode operation is not available due to
3657 * operating channel would need to be changed to a DFS channel when
3658 * the driver does not support radar detection and another virtual
3659 * interfaces caused the operating channel to change. Other similar
3660 * resource conflicts could also trigger this for station mode
Dmitry Shmidtd30ac602014-06-30 09:54:22 -07003661 * interfaces. This event can be propagated when channel switching
3662 * fails.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003663 */
3664 EVENT_INTERFACE_UNAVAILABLE,
3665
3666 /**
3667 * EVENT_BEST_CHANNEL
3668 *
3669 * Driver generates this event whenever it detects a better channel
3670 * (e.g., based on RSSI or channel use). This information can be used
3671 * to improve channel selection for a new AP/P2P group.
3672 */
3673 EVENT_BEST_CHANNEL,
3674
3675 /**
3676 * EVENT_UNPROT_DEAUTH - Unprotected Deauthentication frame received
3677 *
3678 * This event should be called when a Deauthentication frame is dropped
3679 * due to it not being protected (MFP/IEEE 802.11w).
3680 * union wpa_event_data::unprot_deauth is required to provide more
3681 * details of the frame.
3682 */
3683 EVENT_UNPROT_DEAUTH,
3684
3685 /**
3686 * EVENT_UNPROT_DISASSOC - Unprotected Disassociation frame received
3687 *
3688 * This event should be called when a Disassociation frame is dropped
3689 * due to it not being protected (MFP/IEEE 802.11w).
3690 * union wpa_event_data::unprot_disassoc is required to provide more
3691 * details of the frame.
3692 */
3693 EVENT_UNPROT_DISASSOC,
3694
3695 /**
3696 * EVENT_STATION_LOW_ACK
3697 *
3698 * Driver generates this event whenever it detected that a particular
3699 * station was lost. Detection can be through massive transmission
3700 * failures for example.
3701 */
3702 EVENT_STATION_LOW_ACK,
3703
3704 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003705 * EVENT_IBSS_PEER_LOST - IBSS peer not reachable anymore
3706 */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003707 EVENT_IBSS_PEER_LOST,
3708
3709 /**
3710 * EVENT_DRIVER_GTK_REKEY - Device/driver did GTK rekey
3711 *
3712 * This event carries the new replay counter to notify wpa_supplicant
3713 * of the current EAPOL-Key Replay Counter in case the driver/firmware
3714 * completed Group Key Handshake while the host (including
3715 * wpa_supplicant was sleeping).
3716 */
3717 EVENT_DRIVER_GTK_REKEY,
3718
3719 /**
3720 * EVENT_SCHED_SCAN_STOPPED - Scheduled scan was stopped
3721 */
3722 EVENT_SCHED_SCAN_STOPPED,
3723
3724 /**
3725 * EVENT_DRIVER_CLIENT_POLL_OK - Station responded to poll
3726 *
3727 * This event indicates that the station responded to the poll
3728 * initiated with @poll_client.
3729 */
3730 EVENT_DRIVER_CLIENT_POLL_OK,
3731
3732 /**
3733 * EVENT_EAPOL_TX_STATUS - notify of EAPOL TX status
3734 */
Dmitry Shmidt04949592012-07-19 12:16:46 -07003735 EVENT_EAPOL_TX_STATUS,
3736
3737 /**
3738 * EVENT_CH_SWITCH - AP or GO decided to switch channels
3739 *
3740 * Described in wpa_event_data.ch_switch
3741 * */
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07003742 EVENT_CH_SWITCH,
3743
3744 /**
3745 * EVENT_WNM - Request WNM operation
3746 *
3747 * This event can be used to request a WNM operation to be performed.
3748 */
Dmitry Shmidtf8623282013-02-20 14:34:59 -08003749 EVENT_WNM,
3750
3751 /**
3752 * EVENT_CONNECT_FAILED_REASON - Connection failure reason in AP mode
3753 *
3754 * This event indicates that the driver reported a connection failure
3755 * with the specified client (for example, max client reached, etc.) in
3756 * AP mode.
3757 */
Dmitry Shmidtea69e842013-05-13 14:52:28 -07003758 EVENT_CONNECT_FAILED_REASON,
3759
3760 /**
3761 * EVENT_RADAR_DETECTED - Notify of radar detection
3762 *
3763 * A radar has been detected on the supplied frequency, hostapd should
3764 * react accordingly (e.g., change channel).
3765 */
3766 EVENT_DFS_RADAR_DETECTED,
3767
3768 /**
3769 * EVENT_CAC_FINISHED - Notify that channel availability check has been completed
3770 *
3771 * After a successful CAC, the channel can be marked clear and used.
3772 */
3773 EVENT_DFS_CAC_FINISHED,
3774
3775 /**
3776 * EVENT_CAC_ABORTED - Notify that channel availability check has been aborted
3777 *
3778 * The CAC was not successful, and the channel remains in the previous
3779 * state. This may happen due to a radar beeing detected or other
3780 * external influences.
3781 */
3782 EVENT_DFS_CAC_ABORTED,
3783
3784 /**
3785 * EVENT_DFS_CAC_NOP_FINISHED - Notify that non-occupancy period is over
3786 *
3787 * The channel which was previously unavailable is now available again.
3788 */
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -07003789 EVENT_DFS_NOP_FINISHED,
3790
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08003791 /**
3792 * EVENT_SURVEY - Received survey data
3793 *
3794 * This event gets triggered when a driver query is issued for survey
3795 * data and the requested data becomes available. The returned data is
3796 * stored in struct survey_results. The results provide at most one
3797 * survey entry for each frequency and at minimum will provide one
3798 * survey entry for one frequency. The survey data can be os_malloc()'d
3799 * and then os_free()'d, so the event callback must only copy data.
3800 */
3801 EVENT_SURVEY,
3802
3803 /**
3804 * EVENT_SCAN_STARTED - Scan started
3805 *
3806 * This indicates that driver has started a scan operation either based
3807 * on a request from wpa_supplicant/hostapd or from another application.
3808 * EVENT_SCAN_RESULTS is used to indicate when the scan has been
3809 * completed (either successfully or by getting cancelled).
3810 */
Dmitry Shmidtcf32e602014-01-28 10:57:39 -08003811 EVENT_SCAN_STARTED,
3812
3813 /**
3814 * EVENT_AVOID_FREQUENCIES - Received avoid frequency range
3815 *
3816 * This event indicates a set of frequency ranges that should be avoided
3817 * to reduce issues due to interference or internal co-existence
3818 * information in the driver.
3819 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08003820 EVENT_AVOID_FREQUENCIES,
3821
3822 /**
3823 * EVENT_NEW_PEER_CANDIDATE - new (unknown) mesh peer notification
3824 */
3825 EVENT_NEW_PEER_CANDIDATE,
3826
3827 /**
3828 * EVENT_ACS_CHANNEL_SELECTED - Received selected channels by ACS
3829 *
3830 * Indicates a pair of primary and secondary channels chosen by ACS
3831 * in device.
3832 */
3833 EVENT_ACS_CHANNEL_SELECTED,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003834};
3835
3836
3837/**
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -07003838 * struct freq_survey - Channel survey info
3839 *
3840 * @ifidx: Interface index in which this survey was observed
3841 * @freq: Center of frequency of the surveyed channel
3842 * @nf: Channel noise floor in dBm
3843 * @channel_time: Amount of time in ms the radio spent on the channel
3844 * @channel_time_busy: Amount of time in ms the radio detected some signal
3845 * that indicated to the radio the channel was not clear
3846 * @channel_time_rx: Amount of time the radio spent receiving data
3847 * @channel_time_tx: Amount of time the radio spent transmitting data
3848 * @filled: bitmask indicating which fields have been reported, see
3849 * SURVEY_HAS_* defines.
3850 * @list: Internal list pointers
3851 */
3852struct freq_survey {
3853 u32 ifidx;
3854 unsigned int freq;
3855 s8 nf;
3856 u64 channel_time;
3857 u64 channel_time_busy;
3858 u64 channel_time_rx;
3859 u64 channel_time_tx;
3860 unsigned int filled;
3861 struct dl_list list;
3862};
3863
3864#define SURVEY_HAS_NF BIT(0)
3865#define SURVEY_HAS_CHAN_TIME BIT(1)
3866#define SURVEY_HAS_CHAN_TIME_BUSY BIT(2)
3867#define SURVEY_HAS_CHAN_TIME_RX BIT(3)
3868#define SURVEY_HAS_CHAN_TIME_TX BIT(4)
3869
3870
3871/**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003872 * union wpa_event_data - Additional data for wpa_supplicant_event() calls
3873 */
3874union wpa_event_data {
3875 /**
3876 * struct assoc_info - Data for EVENT_ASSOC and EVENT_ASSOCINFO events
3877 *
3878 * This structure is optional for EVENT_ASSOC calls and required for
3879 * EVENT_ASSOCINFO calls. By using EVENT_ASSOC with this data, the
3880 * driver interface does not need to generate separate EVENT_ASSOCINFO
3881 * calls.
3882 */
3883 struct assoc_info {
3884 /**
3885 * reassoc - Flag to indicate association or reassociation
3886 */
3887 int reassoc;
3888
3889 /**
3890 * req_ies - (Re)Association Request IEs
3891 *
3892 * If the driver generates WPA/RSN IE, this event data must be
3893 * returned for WPA handshake to have needed information. If
3894 * wpa_supplicant-generated WPA/RSN IE is used, this
3895 * information event is optional.
3896 *
3897 * This should start with the first IE (fixed fields before IEs
3898 * are not included).
3899 */
3900 const u8 *req_ies;
3901
3902 /**
3903 * req_ies_len - Length of req_ies in bytes
3904 */
3905 size_t req_ies_len;
3906
3907 /**
3908 * resp_ies - (Re)Association Response IEs
3909 *
3910 * Optional association data from the driver. This data is not
3911 * required WPA, but may be useful for some protocols and as
3912 * such, should be reported if this is available to the driver
3913 * interface.
3914 *
3915 * This should start with the first IE (fixed fields before IEs
3916 * are not included).
3917 */
3918 const u8 *resp_ies;
3919
3920 /**
3921 * resp_ies_len - Length of resp_ies in bytes
3922 */
3923 size_t resp_ies_len;
3924
3925 /**
3926 * beacon_ies - Beacon or Probe Response IEs
3927 *
3928 * Optional Beacon/ProbeResp data: IEs included in Beacon or
3929 * Probe Response frames from the current AP (i.e., the one
3930 * that the client just associated with). This information is
3931 * used to update WPA/RSN IE for the AP. If this field is not
3932 * set, the results from previous scan will be used. If no
3933 * data for the new AP is found, scan results will be requested
3934 * again (without scan request). At this point, the driver is
3935 * expected to provide WPA/RSN IE for the AP (if WPA/WPA2 is
3936 * used).
3937 *
3938 * This should start with the first IE (fixed fields before IEs
3939 * are not included).
3940 */
3941 const u8 *beacon_ies;
3942
3943 /**
3944 * beacon_ies_len - Length of beacon_ies */
3945 size_t beacon_ies_len;
3946
3947 /**
3948 * freq - Frequency of the operational channel in MHz
3949 */
3950 unsigned int freq;
3951
3952 /**
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08003953 * wmm_params - WMM parameters used in this association.
3954 */
3955 struct wmm_params wmm_params;
3956
3957 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003958 * addr - Station address (for AP mode)
3959 */
3960 const u8 *addr;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08003961
3962 /**
3963 * The following is the key management offload information
3964 * @authorized
3965 * @key_replay_ctr
3966 * @key_replay_ctr_len
3967 * @ptk_kck
3968 * @ptk_kek_len
3969 * @ptk_kek
3970 * @ptk_kek_len
3971 */
3972
3973 /**
3974 * authorized - Status of key management offload,
3975 * 1 = successful
3976 */
3977 int authorized;
3978
3979 /**
3980 * key_replay_ctr - Key replay counter value last used
3981 * in a valid EAPOL-Key frame
3982 */
3983 const u8 *key_replay_ctr;
3984
3985 /**
3986 * key_replay_ctr_len - The length of key_replay_ctr
3987 */
3988 size_t key_replay_ctr_len;
3989
3990 /**
3991 * ptk_kck - The derived PTK KCK
3992 */
3993 const u8 *ptk_kck;
3994
3995 /**
3996 * ptk_kek_len - The length of ptk_kck
3997 */
3998 size_t ptk_kck_len;
3999
4000 /**
4001 * ptk_kek - The derived PTK KEK
4002 */
4003 const u8 *ptk_kek;
4004
4005 /**
4006 * ptk_kek_len - The length of ptk_kek
4007 */
4008 size_t ptk_kek_len;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004009 } assoc_info;
4010
4011 /**
4012 * struct disassoc_info - Data for EVENT_DISASSOC events
4013 */
4014 struct disassoc_info {
4015 /**
4016 * addr - Station address (for AP mode)
4017 */
4018 const u8 *addr;
4019
4020 /**
4021 * reason_code - Reason Code (host byte order) used in
4022 * Deauthentication frame
4023 */
4024 u16 reason_code;
4025
4026 /**
4027 * ie - Optional IE(s) in Disassociation frame
4028 */
4029 const u8 *ie;
4030
4031 /**
4032 * ie_len - Length of ie buffer in octets
4033 */
4034 size_t ie_len;
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08004035
4036 /**
4037 * locally_generated - Whether the frame was locally generated
4038 */
4039 int locally_generated;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004040 } disassoc_info;
4041
4042 /**
4043 * struct deauth_info - Data for EVENT_DEAUTH events
4044 */
4045 struct deauth_info {
4046 /**
4047 * addr - Station address (for AP mode)
4048 */
4049 const u8 *addr;
4050
4051 /**
4052 * reason_code - Reason Code (host byte order) used in
4053 * Deauthentication frame
4054 */
4055 u16 reason_code;
4056
4057 /**
4058 * ie - Optional IE(s) in Deauthentication frame
4059 */
4060 const u8 *ie;
4061
4062 /**
4063 * ie_len - Length of ie buffer in octets
4064 */
4065 size_t ie_len;
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08004066
4067 /**
4068 * locally_generated - Whether the frame was locally generated
4069 */
4070 int locally_generated;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004071 } deauth_info;
4072
4073 /**
4074 * struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE
4075 */
4076 struct michael_mic_failure {
4077 int unicast;
4078 const u8 *src;
4079 } michael_mic_failure;
4080
4081 /**
4082 * struct interface_status - Data for EVENT_INTERFACE_STATUS
4083 */
4084 struct interface_status {
4085 char ifname[100];
4086 enum {
4087 EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED
4088 } ievent;
4089 } interface_status;
4090
4091 /**
4092 * struct pmkid_candidate - Data for EVENT_PMKID_CANDIDATE
4093 */
4094 struct pmkid_candidate {
4095 /** BSSID of the PMKID candidate */
4096 u8 bssid[ETH_ALEN];
4097 /** Smaller the index, higher the priority */
4098 int index;
4099 /** Whether RSN IE includes pre-authenticate flag */
4100 int preauth;
4101 } pmkid_candidate;
4102
4103 /**
4104 * struct stkstart - Data for EVENT_STKSTART
4105 */
4106 struct stkstart {
4107 u8 peer[ETH_ALEN];
4108 } stkstart;
4109
4110 /**
4111 * struct tdls - Data for EVENT_TDLS
4112 */
4113 struct tdls {
4114 u8 peer[ETH_ALEN];
4115 enum {
4116 TDLS_REQUEST_SETUP,
4117 TDLS_REQUEST_TEARDOWN
4118 } oper;
4119 u16 reason_code; /* for teardown */
4120 } tdls;
4121
4122 /**
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07004123 * struct wnm - Data for EVENT_WNM
4124 */
4125 struct wnm {
4126 u8 addr[ETH_ALEN];
4127 enum {
4128 WNM_OPER_SLEEP,
4129 } oper;
4130 enum {
4131 WNM_SLEEP_ENTER,
4132 WNM_SLEEP_EXIT
4133 } sleep_action;
4134 int sleep_intval;
4135 u16 reason_code;
4136 u8 *buf;
4137 u16 buf_len;
4138 } wnm;
4139
4140 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004141 * struct ft_ies - FT information elements (EVENT_FT_RESPONSE)
4142 *
4143 * During FT (IEEE 802.11r) authentication sequence, the driver is
4144 * expected to use this event to report received FT IEs (MDIE, FTIE,
4145 * RSN IE, TIE, possible resource request) to the supplicant. The FT
4146 * IEs for the next message will be delivered through the
4147 * struct wpa_driver_ops::update_ft_ies() callback.
4148 */
4149 struct ft_ies {
4150 const u8 *ies;
4151 size_t ies_len;
4152 int ft_action;
4153 u8 target_ap[ETH_ALEN];
4154 /** Optional IE(s), e.g., WMM TSPEC(s), for RIC-Request */
4155 const u8 *ric_ies;
4156 /** Length of ric_ies buffer in octets */
4157 size_t ric_ies_len;
4158 } ft_ies;
4159
4160 /**
4161 * struct ibss_rsn_start - Data for EVENT_IBSS_RSN_START
4162 */
4163 struct ibss_rsn_start {
4164 u8 peer[ETH_ALEN];
4165 } ibss_rsn_start;
4166
4167 /**
4168 * struct auth_info - Data for EVENT_AUTH events
4169 */
4170 struct auth_info {
4171 u8 peer[ETH_ALEN];
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08004172 u8 bssid[ETH_ALEN];
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004173 u16 auth_type;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08004174 u16 auth_transaction;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004175 u16 status_code;
4176 const u8 *ies;
4177 size_t ies_len;
4178 } auth;
4179
4180 /**
4181 * struct assoc_reject - Data for EVENT_ASSOC_REJECT events
4182 */
4183 struct assoc_reject {
4184 /**
4185 * bssid - BSSID of the AP that rejected association
4186 */
4187 const u8 *bssid;
4188
4189 /**
4190 * resp_ies - (Re)Association Response IEs
4191 *
4192 * Optional association data from the driver. This data is not
4193 * required WPA, but may be useful for some protocols and as
4194 * such, should be reported if this is available to the driver
4195 * interface.
4196 *
4197 * This should start with the first IE (fixed fields before IEs
4198 * are not included).
4199 */
4200 const u8 *resp_ies;
4201
4202 /**
4203 * resp_ies_len - Length of resp_ies in bytes
4204 */
4205 size_t resp_ies_len;
4206
4207 /**
4208 * status_code - Status Code from (Re)association Response
4209 */
4210 u16 status_code;
4211 } assoc_reject;
4212
4213 struct timeout_event {
4214 u8 addr[ETH_ALEN];
4215 } timeout_event;
4216
4217 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004218 * struct tx_status - Data for EVENT_TX_STATUS events
4219 */
4220 struct tx_status {
4221 u16 type;
4222 u16 stype;
4223 const u8 *dst;
4224 const u8 *data;
4225 size_t data_len;
4226 int ack;
4227 } tx_status;
4228
4229 /**
4230 * struct rx_from_unknown - Data for EVENT_RX_FROM_UNKNOWN events
4231 */
4232 struct rx_from_unknown {
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08004233 const u8 *bssid;
4234 const u8 *addr;
4235 int wds;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004236 } rx_from_unknown;
4237
4238 /**
4239 * struct rx_mgmt - Data for EVENT_RX_MGMT events
4240 */
4241 struct rx_mgmt {
4242 const u8 *frame;
4243 size_t frame_len;
4244 u32 datarate;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004245
4246 /**
Dmitry Shmidt98660862014-03-11 17:26:21 -07004247 * drv_priv - Pointer to store driver private BSS information
4248 *
4249 * If not set to NULL, this is used for comparison with
4250 * hostapd_data->drv_priv to determine which BSS should process
4251 * the frame.
4252 */
4253 void *drv_priv;
4254
4255 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004256 * freq - Frequency (in MHz) on which the frame was received
4257 */
4258 int freq;
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08004259
4260 /**
4261 * ssi_signal - Signal strength in dBm (or 0 if not available)
4262 */
4263 int ssi_signal;
4264 } rx_mgmt;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004265
4266 /**
4267 * struct remain_on_channel - Data for EVENT_REMAIN_ON_CHANNEL events
4268 *
4269 * This is also used with EVENT_CANCEL_REMAIN_ON_CHANNEL events.
4270 */
4271 struct remain_on_channel {
4272 /**
4273 * freq - Channel frequency in MHz
4274 */
4275 unsigned int freq;
4276
4277 /**
4278 * duration - Duration to remain on the channel in milliseconds
4279 */
4280 unsigned int duration;
4281 } remain_on_channel;
4282
4283 /**
4284 * struct scan_info - Optional data for EVENT_SCAN_RESULTS events
4285 * @aborted: Whether the scan was aborted
4286 * @freqs: Scanned frequencies in MHz (%NULL = all channels scanned)
4287 * @num_freqs: Number of entries in freqs array
4288 * @ssids: Scanned SSIDs (%NULL or zero-length SSID indicates wildcard
4289 * SSID)
4290 * @num_ssids: Number of entries in ssids array
4291 */
4292 struct scan_info {
4293 int aborted;
4294 const int *freqs;
4295 size_t num_freqs;
4296 struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
4297 size_t num_ssids;
4298 } scan_info;
4299
4300 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004301 * struct rx_probe_req - Data for EVENT_RX_PROBE_REQ events
4302 */
4303 struct rx_probe_req {
4304 /**
4305 * sa - Source address of the received Probe Request frame
4306 */
4307 const u8 *sa;
4308
4309 /**
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08004310 * da - Destination address of the received Probe Request frame
4311 * or %NULL if not available
4312 */
4313 const u8 *da;
4314
4315 /**
4316 * bssid - BSSID of the received Probe Request frame or %NULL
4317 * if not available
4318 */
4319 const u8 *bssid;
4320
4321 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004322 * ie - IEs from the Probe Request body
4323 */
4324 const u8 *ie;
4325
4326 /**
4327 * ie_len - Length of ie buffer in octets
4328 */
4329 size_t ie_len;
Dmitry Shmidt04949592012-07-19 12:16:46 -07004330
4331 /**
4332 * signal - signal strength in dBm (or 0 if not available)
4333 */
4334 int ssi_signal;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004335 } rx_probe_req;
4336
4337 /**
4338 * struct new_sta - Data for EVENT_NEW_STA events
4339 */
4340 struct new_sta {
4341 const u8 *addr;
4342 } new_sta;
4343
4344 /**
4345 * struct eapol_rx - Data for EVENT_EAPOL_RX events
4346 */
4347 struct eapol_rx {
4348 const u8 *src;
4349 const u8 *data;
4350 size_t data_len;
4351 } eapol_rx;
4352
4353 /**
4354 * signal_change - Data for EVENT_SIGNAL_CHANGE events
4355 */
4356 struct wpa_signal_info signal_change;
4357
4358 /**
4359 * struct best_channel - Data for EVENT_BEST_CHANNEL events
4360 * @freq_24: Best 2.4 GHz band channel frequency in MHz
4361 * @freq_5: Best 5 GHz band channel frequency in MHz
4362 * @freq_overall: Best channel frequency in MHz
4363 *
4364 * 0 can be used to indicate no preference in either band.
4365 */
4366 struct best_channel {
4367 int freq_24;
4368 int freq_5;
4369 int freq_overall;
4370 } best_chan;
4371
4372 struct unprot_deauth {
4373 const u8 *sa;
4374 const u8 *da;
4375 u16 reason_code;
4376 } unprot_deauth;
4377
4378 struct unprot_disassoc {
4379 const u8 *sa;
4380 const u8 *da;
4381 u16 reason_code;
4382 } unprot_disassoc;
4383
4384 /**
4385 * struct low_ack - Data for EVENT_STATION_LOW_ACK events
4386 * @addr: station address
4387 */
4388 struct low_ack {
4389 u8 addr[ETH_ALEN];
4390 } low_ack;
4391
4392 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004393 * struct ibss_peer_lost - Data for EVENT_IBSS_PEER_LOST
4394 */
4395 struct ibss_peer_lost {
4396 u8 peer[ETH_ALEN];
4397 } ibss_peer_lost;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08004398
4399 /**
4400 * struct driver_gtk_rekey - Data for EVENT_DRIVER_GTK_REKEY
4401 */
4402 struct driver_gtk_rekey {
4403 const u8 *bssid;
4404 const u8 *replay_ctr;
4405 } driver_gtk_rekey;
4406
4407 /**
4408 * struct client_poll - Data for EVENT_DRIVER_CLIENT_POLL_OK events
4409 * @addr: station address
4410 */
4411 struct client_poll {
4412 u8 addr[ETH_ALEN];
4413 } client_poll;
4414
4415 /**
4416 * struct eapol_tx_status
4417 * @dst: Original destination
4418 * @data: Data starting with IEEE 802.1X header (!)
4419 * @data_len: Length of data
4420 * @ack: Indicates ack or lost frame
4421 *
4422 * This corresponds to hapd_send_eapol if the frame sent
4423 * there isn't just reported as EVENT_TX_STATUS.
4424 */
4425 struct eapol_tx_status {
4426 const u8 *dst;
4427 const u8 *data;
4428 int data_len;
4429 int ack;
4430 } eapol_tx_status;
Dmitry Shmidt04949592012-07-19 12:16:46 -07004431
4432 /**
4433 * struct ch_switch
4434 * @freq: Frequency of new channel in MHz
4435 * @ht_enabled: Whether this is an HT channel
4436 * @ch_offset: Secondary channel offset
Dmitry Shmidt04f534e2013-12-09 15:50:16 -08004437 * @ch_width: Channel width
4438 * @cf1: Center frequency 1
4439 * @cf2: Center frequency 2
Dmitry Shmidt04949592012-07-19 12:16:46 -07004440 */
4441 struct ch_switch {
4442 int freq;
4443 int ht_enabled;
4444 int ch_offset;
Dmitry Shmidt04f534e2013-12-09 15:50:16 -08004445 enum chan_width ch_width;
4446 int cf1;
4447 int cf2;
Dmitry Shmidt04949592012-07-19 12:16:46 -07004448 } ch_switch;
Dmitry Shmidtf8623282013-02-20 14:34:59 -08004449
4450 /**
4451 * struct connect_failed - Data for EVENT_CONNECT_FAILED_REASON
4452 * @addr: Remote client address
4453 * @code: Reason code for connection failure
4454 */
4455 struct connect_failed_reason {
4456 u8 addr[ETH_ALEN];
4457 enum {
4458 MAX_CLIENT_REACHED,
4459 BLOCKED_CLIENT
4460 } code;
4461 } connect_failed_reason;
Dmitry Shmidtea69e842013-05-13 14:52:28 -07004462
4463 /**
4464 * struct dfs_event - Data for radar detected events
4465 * @freq: Frequency of the channel in MHz
4466 */
4467 struct dfs_event {
4468 int freq;
Dmitry Shmidt051af732013-10-22 13:52:46 -07004469 int ht_enabled;
4470 int chan_offset;
4471 enum chan_width chan_width;
4472 int cf1;
4473 int cf2;
Dmitry Shmidtea69e842013-05-13 14:52:28 -07004474 } dfs_event;
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -07004475
4476 /**
4477 * survey_results - Survey result data for EVENT_SURVEY
4478 * @freq_filter: Requested frequency survey filter, 0 if request
4479 * was for all survey data
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08004480 * @survey_list: Linked list of survey data (struct freq_survey)
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -07004481 */
4482 struct survey_results {
4483 unsigned int freq_filter;
4484 struct dl_list survey_list; /* struct freq_survey */
4485 } survey_results;
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08004486
4487 /**
4488 * channel_list_changed - Data for EVENT_CHANNEL_LIST_CHANGED
4489 * @initiator: Initiator of the regulatory change
Dmitry Shmidt7dba0e52014-04-14 10:49:15 -07004490 * @type: Regulatory change type
4491 * @alpha2: Country code (or "" if not available)
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08004492 */
4493 struct channel_list_changed {
4494 enum reg_change_initiator initiator;
Dmitry Shmidt7dba0e52014-04-14 10:49:15 -07004495 enum reg_type type;
4496 char alpha2[3];
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08004497 } channel_list_changed;
Dmitry Shmidtcf32e602014-01-28 10:57:39 -08004498
4499 /**
4500 * freq_range - List of frequency ranges
4501 *
4502 * This is used as the data with EVENT_AVOID_FREQUENCIES.
4503 */
4504 struct wpa_freq_range_list freq_range;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08004505
4506 /**
4507 * struct mesh_peer
4508 *
4509 * @peer: Peer address
4510 * @ies: Beacon IEs
4511 * @ie_len: Length of @ies
4512 *
4513 * Notification of new candidate mesh peer.
4514 */
4515 struct mesh_peer {
4516 const u8 *peer;
4517 const u8 *ies;
4518 size_t ie_len;
4519 } mesh_peer;
4520
4521 /**
4522 * struct acs_selected_channels - Data for EVENT_ACS_CHANNEL_SELECTED
4523 * @pri_channel: Selected primary channel
4524 * @sec_channel: Selected secondary channel
4525 */
4526 struct acs_selected_channels {
4527 u8 pri_channel;
4528 u8 sec_channel;
4529 } acs_selected_channels;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004530};
4531
4532/**
4533 * wpa_supplicant_event - Report a driver event for wpa_supplicant
4534 * @ctx: Context pointer (wpa_s); this is the ctx variable registered
4535 * with struct wpa_driver_ops::init()
4536 * @event: event type (defined above)
4537 * @data: possible extra data for the event
4538 *
4539 * Driver wrapper code should call this function whenever an event is received
4540 * from the driver.
4541 */
4542void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
4543 union wpa_event_data *data);
4544
4545
4546/*
4547 * The following inline functions are provided for convenience to simplify
4548 * event indication for some of the common events.
4549 */
4550
4551static inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie,
4552 size_t ielen, int reassoc)
4553{
4554 union wpa_event_data event;
4555 os_memset(&event, 0, sizeof(event));
4556 event.assoc_info.reassoc = reassoc;
4557 event.assoc_info.req_ies = ie;
4558 event.assoc_info.req_ies_len = ielen;
4559 event.assoc_info.addr = addr;
4560 wpa_supplicant_event(ctx, EVENT_ASSOC, &event);
4561}
4562
4563static inline void drv_event_disassoc(void *ctx, const u8 *addr)
4564{
4565 union wpa_event_data event;
4566 os_memset(&event, 0, sizeof(event));
4567 event.disassoc_info.addr = addr;
4568 wpa_supplicant_event(ctx, EVENT_DISASSOC, &event);
4569}
4570
4571static inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data,
4572 size_t data_len)
4573{
4574 union wpa_event_data event;
4575 os_memset(&event, 0, sizeof(event));
4576 event.eapol_rx.src = src;
4577 event.eapol_rx.data = data;
4578 event.eapol_rx.data_len = data_len;
4579 wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);
4580}
4581
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08004582/* driver_common.c */
4583void wpa_scan_results_free(struct wpa_scan_results *res);
4584
4585/* Convert wpa_event_type to a string for logging */
4586const char * event_to_string(enum wpa_event_type event);
4587
Dmitry Shmidt661b4f72014-09-29 14:58:27 -07004588/* Convert chan_width to a string for logging and control interfaces */
4589const char * channel_width_to_string(enum chan_width width);
4590
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08004591int ht_supported(const struct hostapd_hw_modes *mode);
4592int vht_supported(const struct hostapd_hw_modes *mode);
4593
4594struct wowlan_triggers *
4595wpa_get_wowlan_triggers(const char *wowlan_triggers,
4596 const struct wpa_driver_capa *capa);
4597
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08004598/* NULL terminated array of linked in driver wrappers */
4599extern struct wpa_driver_ops *wpa_drivers[];
4600
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004601#endif /* DRIVER_H */