]> git.ipfire.org Git - thirdparty/hostap.git/blame - src/drivers/driver.h
nl80211: Remove QCA vendor specific HE capability handling
[thirdparty/hostap.git] / src / drivers / driver.h
CommitLineData
6fc6879b 1/*
e0498677 2 * Driver interface definition
68855672 3 * Copyright (c) 2003-2017, Jouni Malinen <j@w1.fi>
6fc6879b 4 *
0f3d578e
JM
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
e0498677
JM
7 *
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.
6fc6879b
JM
15 */
16
17#ifndef DRIVER_H
18#define DRIVER_H
19
642187d6 20#define WPA_SUPPLICANT_DRIVER_VERSION 4
6fc6879b 21
90973fb2 22#include "common/defs.h"
d9d1b952 23#include "common/ieee802_11_defs.h"
f46c154c 24#include "common/wpa_common.h"
f75f6e2b
SD
25#ifdef CONFIG_MACSEC
26#include "pae/ieee802_1x_kay.h"
27#endif /* CONFIG_MACSEC */
0185007c 28#include "utils/list.h"
6fc6879b 29
c5121837 30#define HOSTAPD_CHAN_DISABLED 0x00000001
0a443580 31#define HOSTAPD_CHAN_NO_IR 0x00000002
c5121837 32#define HOSTAPD_CHAN_RADAR 0x00000008
d8e66e80
JM
33#define HOSTAPD_CHAN_HT40PLUS 0x00000010
34#define HOSTAPD_CHAN_HT40MINUS 0x00000020
35#define HOSTAPD_CHAN_HT40 0x00000040
50f4f2a0 36#define HOSTAPD_CHAN_SURVEY_LIST_INITIALIZED 0x00000080
c5121837 37
fc96522e
SW
38#define HOSTAPD_CHAN_DFS_UNKNOWN 0x00000000
39#define HOSTAPD_CHAN_DFS_USABLE 0x00000100
40#define HOSTAPD_CHAN_DFS_UNAVAILABLE 0x00000200
41#define HOSTAPD_CHAN_DFS_AVAILABLE 0x00000300
42#define HOSTAPD_CHAN_DFS_MASK 0x00000300
43
53cfad46
EP
44#define HOSTAPD_CHAN_VHT_10_70 0x00000800
45#define HOSTAPD_CHAN_VHT_30_50 0x00001000
46#define HOSTAPD_CHAN_VHT_50_30 0x00002000
47#define HOSTAPD_CHAN_VHT_70_10 0x00004000
48
ea6bf29e
IP
49#define HOSTAPD_CHAN_INDOOR_ONLY 0x00010000
50#define HOSTAPD_CHAN_GO_CONCURRENT 0x00020000
51
bee5d8e0
AK
52#define HOSTAPD_CHAN_VHT_10_150 0x00100000
53#define HOSTAPD_CHAN_VHT_30_130 0x00200000
54#define HOSTAPD_CHAN_VHT_50_110 0x00400000
55#define HOSTAPD_CHAN_VHT_70_90 0x00800000
56#define HOSTAPD_CHAN_VHT_90_70 0x01000000
57#define HOSTAPD_CHAN_VHT_110_50 0x02000000
58#define HOSTAPD_CHAN_VHT_130_30 0x04000000
59#define HOSTAPD_CHAN_VHT_150_10 0x08000000
60
4299ad82
DL
61/* Allowed bandwidth mask */
62enum hostapd_chan_width_attr {
63 HOSTAPD_CHAN_WIDTH_10 = BIT(0),
64 HOSTAPD_CHAN_WIDTH_20 = BIT(1),
65 HOSTAPD_CHAN_WIDTH_40P = BIT(2),
66 HOSTAPD_CHAN_WIDTH_40M = BIT(3),
67 HOSTAPD_CHAN_WIDTH_80 = BIT(4),
68 HOSTAPD_CHAN_WIDTH_160 = BIT(5),
69};
70
e42adb9a
MG
71/* Filter gratuitous ARP */
72#define WPA_DATA_FRAME_FILTER_FLAG_ARP BIT(0)
73/* Filter unsolicited Neighbor Advertisement */
74#define WPA_DATA_FRAME_FILTER_FLAG_NA BIT(1)
75/* Filter unicast IP packets encrypted using the GTK */
76#define WPA_DATA_FRAME_FILTER_FLAG_GTK BIT(2)
77
aa56e36d
VT
78#define HOSTAPD_DFS_REGION_FCC 1
79#define HOSTAPD_DFS_REGION_ETSI 2
80#define HOSTAPD_DFS_REGION_JP 3
81
4e8f31e2
JM
82/**
83 * enum reg_change_initiator - Regulatory change initiator
84 */
795baf77
AS
85enum reg_change_initiator {
86 REGDOM_SET_BY_CORE,
87 REGDOM_SET_BY_USER,
88 REGDOM_SET_BY_DRIVER,
89 REGDOM_SET_BY_COUNTRY_IE,
8597ebdb 90 REGDOM_BEACON_HINT,
795baf77
AS
91};
92
4e8f31e2
JM
93/**
94 * enum reg_type - Regulatory change types
95 */
142817b2
JM
96enum reg_type {
97 REGDOM_TYPE_UNKNOWN,
98 REGDOM_TYPE_COUNTRY,
99 REGDOM_TYPE_WORLD,
100 REGDOM_TYPE_CUSTOM_WORLD,
101 REGDOM_TYPE_INTERSECTION,
102};
103
e0498677
JM
104/**
105 * struct hostapd_channel_data - Channel information
106 */
c5121837 107struct hostapd_channel_data {
e0498677
JM
108 /**
109 * chan - Channel number (IEEE 802.11)
110 */
111 short chan;
112
113 /**
114 * freq - Frequency in MHz
115 */
c0976528 116 int freq;
e0498677
JM
117
118 /**
119 * flag - Channel flags (HOSTAPD_CHAN_*)
120 */
121 int flag;
122
4299ad82
DL
123 /**
124 * allowed_bw - Allowed channel width bitmask
125 *
126 * See enum hostapd_chan_width_attr.
127 */
128 u32 allowed_bw;
129
e0498677 130 /**
6651f1f9 131 * max_tx_power - Regulatory transmit power limit in dBm
e0498677
JM
132 */
133 u8 max_tx_power;
0185007c 134
4e8f31e2
JM
135 /**
136 * survey_list - Linked list of surveys (struct freq_survey)
0185007c
MK
137 */
138 struct dl_list survey_list;
139
140 /**
141 * min_nf - Minimum observed noise floor, in dBm, based on all
142 * surveyed channel data
143 */
144 s8 min_nf;
50f4f2a0
MK
145
146#ifdef CONFIG_ACS
147 /**
148 * interference_factor - Computed interference factor on this
149 * channel (used internally in src/ap/acs.c; driver wrappers do not
150 * need to set this)
151 */
152 long double interference_factor;
153#endif /* CONFIG_ACS */
bbbacbf2 154
4e8f31e2
JM
155 /**
156 * dfs_cac_ms - DFS CAC time in milliseconds
157 */
bbbacbf2 158 unsigned int dfs_cac_ms;
c5121837
JM
159};
160
94380cb4
PX
161#define HE_MAX_NUM_SS 8
162#define HE_MAX_PHY_CAPAB_SIZE 3
163
164/**
165 * struct he_ppe_threshold - IEEE 802.11ax HE PPE Threshold
166 */
167struct he_ppe_threshold {
168 u32 numss_m1;
169 u32 ru_count;
170 u32 ppet16_ppet8_ru3_ru0[HE_MAX_NUM_SS];
171};
172
173/**
174 * struct he_capabilities - IEEE 802.11ax HE capabilities
175 */
176struct he_capabilities {
177 u8 he_supported;
178 u32 phy_cap[HE_MAX_PHY_CAPAB_SIZE];
179 u32 mac_cap;
180 u32 mcs;
181 struct he_ppe_threshold ppet;
182};
183
e3b473eb 184#define HOSTAPD_MODE_FLAG_HT_INFO_KNOWN BIT(0)
c8ebeda4 185#define HOSTAPD_MODE_FLAG_VHT_INFO_KNOWN BIT(1)
e3b473eb 186
e0498677
JM
187/**
188 * struct hostapd_hw_modes - Supported hardware mode information
189 */
c5121837 190struct hostapd_hw_modes {
e0498677
JM
191 /**
192 * mode - Hardware mode
193 */
71934751 194 enum hostapd_hw_mode mode;
e0498677
JM
195
196 /**
197 * num_channels - Number of entries in the channels array
198 */
c5121837 199 int num_channels;
e0498677
JM
200
201 /**
202 * channels - Array of supported channels
203 */
c5121837 204 struct hostapd_channel_data *channels;
e0498677
JM
205
206 /**
207 * num_rates - Number of entries in the rates array
208 */
c5121837 209 int num_rates;
e0498677
JM
210
211 /**
212 * rates - Array of supported rates in 100 kbps units
213 */
214 int *rates;
215
216 /**
217 * ht_capab - HT (IEEE 802.11n) capabilities
218 */
c5121837 219 u16 ht_capab;
e0498677
JM
220
221 /**
222 * mcs_set - MCS (IEEE 802.11n) rate parameters
223 */
08eb154d 224 u8 mcs_set[16];
e0498677
JM
225
226 /**
227 * a_mpdu_params - A-MPDU (IEEE 802.11n) parameters
228 */
be8eb8ab 229 u8 a_mpdu_params;
e3b473eb 230
efe45d14
MP
231 /**
232 * vht_capab - VHT (IEEE 802.11ac) capabilities
233 */
234 u32 vht_capab;
235
236 /**
237 * vht_mcs_set - VHT MCS (IEEE 802.11ac) rate parameters
238 */
239 u8 vht_mcs_set[8];
240
e3b473eb 241 unsigned int flags; /* HOSTAPD_MODE_FLAG_* */
94380cb4
PX
242
243 /**
244 * he_capab - HE (IEEE 802.11ax) capabilities
245 */
246 struct he_capabilities he_capab;
c5121837
JM
247};
248
249
6fc6879b
JM
250#define IEEE80211_MODE_INFRA 0
251#define IEEE80211_MODE_IBSS 1
ad1e68e6 252#define IEEE80211_MODE_AP 2
476e6bb6 253#define IEEE80211_MODE_MESH 5
6fc6879b
JM
254
255#define IEEE80211_CAP_ESS 0x0001
256#define IEEE80211_CAP_IBSS 0x0002
257#define IEEE80211_CAP_PRIVACY 0x0010
0dc957b9 258#define IEEE80211_CAP_RRM 0x1000
6fc6879b 259
ff3ad3c5
VK
260/* DMG (60 GHz) IEEE 802.11ad */
261/* type - bits 0..1 */
262#define IEEE80211_CAP_DMG_MASK 0x0003
263#define IEEE80211_CAP_DMG_IBSS 0x0001 /* Tx by: STA */
264#define IEEE80211_CAP_DMG_PBSS 0x0002 /* Tx by: PCP */
265#define IEEE80211_CAP_DMG_AP 0x0003 /* Tx by: AP */
266
7c2849d2
JM
267#define WPA_SCAN_QUAL_INVALID BIT(0)
268#define WPA_SCAN_NOISE_INVALID BIT(1)
269#define WPA_SCAN_LEVEL_INVALID BIT(2)
270#define WPA_SCAN_LEVEL_DBM BIT(3)
e6b8efeb 271#define WPA_SCAN_ASSOCIATED BIT(5)
7c2849d2 272
6fc6879b
JM
273/**
274 * struct wpa_scan_res - Scan result for an BSS/IBSS
7c2849d2 275 * @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
6fc6879b
JM
276 * @bssid: BSSID
277 * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
278 * @beacon_int: beacon interval in TUs (host byte order)
279 * @caps: capability information field in host byte order
280 * @qual: signal quality
281 * @noise: noise level
282 * @level: signal level
283 * @tsf: Timestamp
b3ad11bb
JM
284 * @age: Age of the information in milliseconds (i.e., how many milliseconds
285 * ago the last Beacon or Probe Response frame was received)
a1b790eb
JM
286 * @est_throughput: Estimated throughput in kbps (this is calculated during
287 * scan result processing if left zero by the driver wrapper)
288 * @snr: Signal-to-noise ratio in dB (calculated during scan result processing)
c16b9f8d
AS
289 * @parent_tsf: Time when the Beacon/Probe Response frame was received in terms
290 * of TSF of the BSS specified by %tsf_bssid.
291 * @tsf_bssid: The BSS that %parent_tsf TSF time refers to.
6fc6879b 292 * @ie_len: length of the following IE field in octets
8c090654 293 * @beacon_ie_len: length of the following Beacon IE field in octets
6fc6879b
JM
294 *
295 * This structure is used as a generic format for scan results from the
296 * driver. Each driver interface implementation is responsible for converting
297 * the driver or OS specific scan results into this format.
298 *
299 * If the driver does not support reporting all IEs, the IE data structure is
300 * constructed of the IEs that are available. This field will also need to
301 * include SSID in IE format. All drivers are encouraged to be extended to
302 * report all IEs to make it easier to support future additions.
4e8f31e2
JM
303 *
304 * This structure data is followed by ie_len octets of IEs from Probe Response
305 * frame (or if the driver does not indicate source of IEs, these may also be
306 * from Beacon frame). After the first set of IEs, another set of IEs may follow
307 * (with beacon_ie_len octets of data) if the driver provides both IE sets.
6fc6879b
JM
308 */
309struct wpa_scan_res {
7c2849d2 310 unsigned int flags;
6fc6879b
JM
311 u8 bssid[ETH_ALEN];
312 int freq;
313 u16 beacon_int;
314 u16 caps;
315 int qual;
316 int noise;
317 int level;
318 u64 tsf;
b3ad11bb 319 unsigned int age;
a1b790eb
JM
320 unsigned int est_throughput;
321 int snr;
c16b9f8d
AS
322 u64 parent_tsf;
323 u8 tsf_bssid[ETH_ALEN];
6fc6879b 324 size_t ie_len;
8c090654 325 size_t beacon_ie_len;
4e8f31e2 326 /* Followed by ie_len + beacon_ie_len octets of IE data */
6fc6879b
JM
327};
328
329/**
330 * struct wpa_scan_results - Scan results
331 * @res: Array of pointers to allocated variable length scan result entries
332 * @num: Number of entries in the scan result array
c5f10e80 333 * @fetch_time: Time when the results were fetched from the driver
6fc6879b
JM
334 */
335struct wpa_scan_results {
336 struct wpa_scan_res **res;
337 size_t num;
acb69cec 338 struct os_reltime fetch_time;
6fc6879b
JM
339};
340
4b4a8ae5
JM
341/**
342 * struct wpa_interface_info - Network interface information
343 * @next: Pointer to the next interface or NULL if this is the last one
344 * @ifname: Interface name that can be used with init() or init2()
345 * @desc: Human readable adapter description (e.g., vendor/model) or NULL if
346 * not available
60ad2c7b 347 * @drv_name: struct wpa_driver_ops::name (note: unlike other strings, this one
4b4a8ae5
JM
348 * is not an allocated copy, i.e., get_interfaces() caller will not free
349 * this)
350 */
351struct wpa_interface_info {
352 struct wpa_interface_info *next;
353 char *ifname;
354 char *desc;
355 const char *drv_name;
356};
357
35b741fd 358#define WPAS_MAX_SCAN_SSIDS 16
fc2b7ed5 359
0ae86f90
RP
360/**
361 * struct wpa_driver_scan_ssid - SSIDs to scan for
362 * @ssid - specific SSID to scan for (ProbeReq)
363 * %NULL or zero-length SSID is used to indicate active scan
364 * with wildcard SSID.
365 * @ssid_len - Length of the SSID in octets
366 */
367struct wpa_driver_scan_ssid {
368 const u8 *ssid;
369 size_t ssid_len;
370};
371
fc2b7ed5
JM
372/**
373 * struct wpa_driver_scan_params - Scan parameters
374 * Data for struct wpa_driver_ops::scan2().
375 */
376struct wpa_driver_scan_params {
377 /**
378 * ssids - SSIDs to scan for
379 */
0ae86f90 380 struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
fc2b7ed5
JM
381
382 /**
383 * num_ssids - Number of entries in ssids array
384 * Zero indicates a request for a passive scan.
385 */
386 size_t num_ssids;
387
388 /**
389 * extra_ies - Extra IE(s) to add into Probe Request or %NULL
390 */
391 const u8 *extra_ies;
392
393 /**
394 * extra_ies_len - Length of extra_ies in octets
395 */
396 size_t extra_ies_len;
d3a98225
JM
397
398 /**
399 * freqs - Array of frequencies to scan or %NULL for all frequencies
400 *
401 * The frequency is set in MHz. The array is zero-terminated.
402 */
403 int *freqs;
3812464c
JM
404
405 /**
406 * filter_ssids - Filter for reporting SSIDs
407 *
408 * This optional parameter can be used to request the driver wrapper to
409 * filter scan results to include only the specified SSIDs. %NULL
410 * indicates that no filtering is to be done. This can be used to
411 * reduce memory needs for scan results in environments that have large
412 * number of APs with different SSIDs.
413 *
414 * The driver wrapper is allowed to take this allocated buffer into its
415 * own use by setting the pointer to %NULL. In that case, the driver
416 * wrapper is responsible for freeing the buffer with os_free() once it
417 * is not needed anymore.
418 */
419 struct wpa_driver_scan_filter {
d9d1b952 420 u8 ssid[SSID_MAX_LEN];
3812464c
JM
421 size_t ssid_len;
422 } *filter_ssids;
423
424 /**
425 * num_filter_ssids - Number of entries in filter_ssids array
426 */
427 size_t num_filter_ssids;
47185fc7 428
bf8d6d24
TP
429 /**
430 * filter_rssi - Filter by RSSI
431 *
432 * The driver may filter scan results in firmware to reduce host
433 * wakeups and thereby save power. Specify the RSSI threshold in s32
434 * dBm.
435 */
436 s32 filter_rssi;
437
47185fc7
RM
438 /**
439 * p2p_probe - Used to disable CCK (802.11b) rates for P2P probes
440 *
441 * When set, the driver is expected to remove rates 1, 2, 5.5, and 11
442 * Mbps from the support rates element(s) in the Probe Request frames
443 * and not to transmit the frames at any of those rates.
444 */
57a8f8af 445 unsigned int p2p_probe:1;
949938aa
JM
446
447 /**
448 * only_new_results - Request driver to report only new results
449 *
450 * This is used to request the driver to report only BSSes that have
451 * been detected after this scan request has been started, i.e., to
452 * flush old cached BSS entries.
453 */
57a8f8af
JB
454 unsigned int only_new_results:1;
455
456 /**
457 * low_priority - Requests driver to use a lower scan priority
458 *
459 * This is used to request the driver to use a lower scan priority
460 * if it supports such a thing.
461 */
462 unsigned int low_priority:1;
dd43aaa5 463
ff23ed22
IP
464 /**
465 * mac_addr_rand - Requests driver to randomize MAC address
466 */
467 unsigned int mac_addr_rand:1;
468
469 /**
470 * mac_addr - MAC address used with randomization. The address cannot be
471 * a multicast one, i.e., bit 0 of byte 0 should not be set.
472 */
473 const u8 *mac_addr;
474
475 /**
476 * mac_addr_mask - MAC address mask used with randomization.
477 *
478 * Bits that are 0 in the mask should be randomized. Bits that are 1 in
479 * the mask should be taken as is from mac_addr. The mask should not
480 * allow the generation of a multicast address, i.e., bit 0 of byte 0
481 * must be set.
482 */
483 const u8 *mac_addr_mask;
484
09ea4309
AS
485 /**
486 * sched_scan_plans - Scan plans for scheduled scan
487 *
488 * Each scan plan consists of the number of iterations to scan and the
489 * interval between scans. When a scan plan finishes (i.e., it was run
490 * for the specified number of iterations), the next scan plan is
491 * executed. The scan plans are executed in the order they appear in
492 * the array (lower index first). The last scan plan will run infinitely
493 * (until requested to stop), thus must not specify the number of
494 * iterations. All other scan plans must specify the number of
495 * iterations.
496 */
497 struct sched_scan_plan {
498 u32 interval; /* In seconds */
499 u32 iterations; /* Zero to run infinitely */
500 } *sched_scan_plans;
501
502 /**
503 * sched_scan_plans_num - Number of scan plans in sched_scan_plans array
504 */
505 unsigned int sched_scan_plans_num;
506
d0330d57
PK
507 /**
508 * sched_scan_start_delay - Delay to use before starting the first scan
509 *
510 * Delay (in seconds) before scheduling first scan plan cycle. The
511 * driver may ignore this parameter and start immediately (or at any
512 * other time), if this feature is not supported.
513 */
514 u32 sched_scan_start_delay;
515
eb20cea5
JM
516 /**
517 * bssid - Specific BSSID to scan for
518 *
519 * This optional parameter can be used to replace the default wildcard
520 * BSSID with a specific BSSID to scan for if results are needed from
521 * only a single BSS.
522 */
523 const u8 *bssid;
524
eeb34a43
SD
525 /**
526 * scan_cookie - Unique identification representing the scan request
527 *
528 * This scan_cookie carries a unique identification representing the
529 * scan request if the host driver/kernel supports concurrent scan
530 * requests. This cookie is returned from the corresponding driver
531 * interface.
532 *
533 * Note: Unlike other parameters in this structure, scan_cookie is used
534 * only to return information instead of setting parameters for the
535 * scan.
536 */
537 u64 scan_cookie;
538
c16b9f8d
AS
539 /**
540 * duration - Dwell time on each channel
541 *
542 * This optional parameter can be used to set the dwell time on each
543 * channel. In TUs.
544 */
545 u16 duration;
546
547 /**
548 * duration_mandatory - Whether the specified duration is mandatory
549 *
550 * If this is set, the duration specified by the %duration field is
551 * mandatory (and the driver should reject the scan request if it is
552 * unable to comply with the specified duration), otherwise it is the
553 * maximum duration and the actual duration may be shorter.
554 */
555 unsigned int duration_mandatory:1;
556
20c846d9 557 /**
558 * relative_rssi_set - Whether relative RSSI parameters are set
559 */
560 unsigned int relative_rssi_set:1;
561
562 /**
563 * relative_rssi - Relative RSSI for reporting better BSSs
564 *
565 * Amount of RSSI by which a BSS should be better than the current
566 * connected BSS to report the new BSS to user space.
567 */
568 s8 relative_rssi;
569
570 /**
571 * relative_adjust_band - Band to which RSSI should be adjusted
572 *
573 * The relative_adjust_rssi should be added to the band specified
574 * by relative_adjust_band.
575 */
576 enum set_band relative_adjust_band;
577
578 /**
579 * relative_adjust_rssi - RSSI to be added to relative_adjust_band
580 *
581 * An amount of relative_band_rssi should be added to the BSSs that
582 * belong to the band specified by relative_adjust_band while comparing
583 * with other bands for BSS reporting.
584 */
585 s8 relative_adjust_rssi;
586
938dd97a
RZ
587 /**
588 * oce_scan
589 *
590 * Enable the following OCE scan features: (WFA OCE TechSpec v1.0)
591 * - Accept broadcast Probe Response frame.
592 * - Probe Request frame deferral and suppression.
593 * - Max Channel Time - driver fills FILS request params IE with
594 * Maximum Channel Time.
595 * - Send 1st Probe Request frame in rate of minimum 5.5 Mbps.
596 */
597 unsigned int oce_scan:1;
598
dd43aaa5
JM
599 /*
600 * NOTE: Whenever adding new parameters here, please make sure
601 * wpa_scan_clone_params() and wpa_scan_free_params() get updated with
602 * matching changes.
603 */
fc2b7ed5
JM
604};
605
c2a04078
JM
606/**
607 * struct wpa_driver_auth_params - Authentication parameters
608 * Data for struct wpa_driver_ops::authenticate().
609 */
610struct wpa_driver_auth_params {
611 int freq;
612 const u8 *bssid;
613 const u8 *ssid;
614 size_t ssid_len;
615 int auth_alg;
616 const u8 *ie;
617 size_t ie_len;
a0b2f99b
JM
618 const u8 *wep_key[4];
619 size_t wep_key_len[4];
620 int wep_tx_keyidx;
2a7e7f4e 621 int local_state_change;
2f4f73b1
EP
622
623 /**
624 * p2p - Whether this connection is a P2P group
625 */
626 int p2p;
627
4e8f31e2 628 /**
ce16c489 629 * auth_data - Additional elements for Authentication frame
4e8f31e2
JM
630 *
631 * This buffer starts with the Authentication transaction sequence
ce16c489
JM
632 * number field. If no special handling of such elements is needed, this
633 * pointer is %NULL. This is used with SAE and FILS.
4e8f31e2 634 */
ce16c489 635 const u8 *auth_data;
c10347f2 636
4e8f31e2 637 /**
ce16c489 638 * auth_data_len - Length of auth_data buffer in octets
4e8f31e2 639 */
ce16c489 640 size_t auth_data_len;
c2a04078
JM
641};
642
4e8f31e2
JM
643/**
644 * enum wps_mode - WPS mode
645 */
0c80427d 646enum wps_mode {
4e8f31e2
JM
647 /**
648 * WPS_MODE_NONE - No WPS provisioning being used
649 */
650 WPS_MODE_NONE,
651
652 /**
653 * WPS_MODE_OPEN - WPS provisioning with AP that is in open mode
654 */
655 WPS_MODE_OPEN,
656
657 /**
658 * WPS_MODE_PRIVACY - WPS provisioning with AP that is using protection
659 */
660 WPS_MODE_PRIVACY
0c80427d
JM
661};
662
4e8f31e2
JM
663/**
664 * struct hostapd_freq_params - Channel parameters
665 */
4ec68377 666struct hostapd_freq_params {
4e8f31e2
JM
667 /**
668 * mode - Mode/band (HOSTAPD_MODE_IEEE80211A, ..)
669 */
670 enum hostapd_hw_mode mode;
671
672 /**
673 * freq - Primary channel center frequency in MHz
674 */
4ec68377 675 int freq;
4e8f31e2
JM
676
677 /**
678 * channel - Channel number
679 */
4ec68377 680 int channel;
4e8f31e2
JM
681
682 /**
683 * ht_enabled - Whether HT is enabled
684 */
4ec68377 685 int ht_enabled;
4ec68377 686
4e8f31e2
JM
687 /**
688 * sec_channel_offset - Secondary channel offset for HT40
689 *
690 * 0 = HT40 disabled,
691 * -1 = HT40 enabled, secondary channel below primary,
692 * 1 = HT40 enabled, secondary channel above primary
693 */
694 int sec_channel_offset;
695
696 /**
697 * vht_enabled - Whether VHT is enabled
698 */
4ec68377
JD
699 int vht_enabled;
700
4e8f31e2
JM
701 /**
702 * center_freq1 - Segment 0 center frequency in MHz
703 *
704 * Valid for both HT and VHT.
705 */
706 int center_freq1;
707
708 /**
709 * center_freq2 - Segment 1 center frequency in MHz
710 *
711 * Non-zero only for bandwidth 80 and an 80+80 channel
712 */
713 int center_freq2;
714
715 /**
716 * bandwidth - Channel bandwidth in MHz (20, 40, 80, 160)
717 */
4ec68377
JD
718 int bandwidth;
719};
720
6b128fb2
JM
721/**
722 * struct wpa_driver_sta_auth_params - Authentication parameters
723 * Data for struct wpa_driver_ops::sta_auth().
724 */
725struct wpa_driver_sta_auth_params {
726
727 /**
728 * own_addr - Source address and BSSID for authentication frame
729 */
730 const u8 *own_addr;
731
732 /**
733 * addr - MAC address of the station to associate
734 */
735 const u8 *addr;
736
737 /**
738 * seq - authentication sequence number
739 */
740 u16 seq;
741
742 /**
743 * status - authentication response status code
744 */
745 u16 status;
746
747 /**
748 * ie - authentication frame ie buffer
749 */
750 const u8 *ie;
751
752 /**
753 * len - ie buffer length
754 */
755 size_t len;
f46c154c
JM
756
757 /**
758 * fils_auth - Indicates whether FILS authentication is being performed
759 */
760 int fils_auth;
761
762 /**
763 * fils_anonce - ANonce (required for FILS)
764 */
765 u8 fils_anonce[WPA_NONCE_LEN];
766
767 /**
768 * fils_snonce - SNonce (required for FILS)
769 */
770 u8 fils_snonce[WPA_NONCE_LEN];
771
772 /**
773 * fils_kek - key for encryption (required for FILS)
774 */
775 u8 fils_kek[WPA_KEK_MAX_LEN];
776
777 /**
778 * fils_kek_len - Length of the fils_kek in octets (required for FILS)
779 */
780 size_t fils_kek_len;
6b128fb2
JM
781};
782
6fc6879b
JM
783/**
784 * struct wpa_driver_associate_params - Association parameters
785 * Data for struct wpa_driver_ops::associate().
786 */
787struct wpa_driver_associate_params {
788 /**
789 * bssid - BSSID of the selected AP
790 * This can be %NULL, if ap_scan=2 mode is used and the driver is
791 * responsible for selecting with which BSS to associate. */
792 const u8 *bssid;
793
7ac7fd43
DS
794 /**
795 * bssid_hint - BSSID of a proposed AP
796 *
797 * This indicates which BSS has been found a suitable candidate for
798 * initial association for drivers that use driver/firmwate-based BSS
799 * selection. Unlike the @bssid parameter, @bssid_hint does not limit
800 * the driver from selecting other BSSes in the ESS.
801 */
802 const u8 *bssid_hint;
803
6fc6879b
JM
804 /**
805 * ssid - The selected SSID
806 */
807 const u8 *ssid;
e0498677
JM
808
809 /**
810 * ssid_len - Length of the SSID (1..32)
811 */
6fc6879b
JM
812 size_t ssid_len;
813
814 /**
4ec68377 815 * freq - channel parameters
6fc6879b 816 */
4ec68377 817 struct hostapd_freq_params freq;
6fc6879b 818
7ac7fd43
DS
819 /**
820 * freq_hint - Frequency of the channel the proposed AP is using
821 *
822 * This provides a channel on which a suitable BSS has been found as a
823 * hint for the driver. Unlike the @freq parameter, @freq_hint does not
824 * limit the driver from selecting other channels for
825 * driver/firmware-based BSS selection.
826 */
827 int freq_hint;
828
1f6c0ab8
BS
829 /**
830 * bg_scan_period - Background scan period in seconds, 0 to disable
831 * background scan, or -1 to indicate no change to default driver
832 * configuration
833 */
834 int bg_scan_period;
835
8f05577d
JM
836 /**
837 * beacon_int - Beacon interval for IBSS or 0 to use driver default
838 */
839 int beacon_int;
840
6fc6879b
JM
841 /**
842 * wpa_ie - WPA information element for (Re)Association Request
843 * WPA information element to be included in (Re)Association
844 * Request (including information element id and length). Use
845 * of this WPA IE is optional. If the driver generates the WPA
61a56c14 846 * IE, it can use pairwise_suite, group_suite, group_mgmt_suite, and
6fc6879b
JM
847 * key_mgmt_suite to select proper algorithms. In this case,
848 * the driver has to notify wpa_supplicant about the used WPA
849 * IE by generating an event that the interface code will
850 * convert into EVENT_ASSOCINFO data (see below).
851 *
852 * When using WPA2/IEEE 802.11i, wpa_ie is used for RSN IE
853 * instead. The driver can determine which version is used by
854 * looking at the first byte of the IE (0xdd for WPA, 0x30 for
855 * WPA2/RSN).
ad08c363
JM
856 *
857 * When using WPS, wpa_ie is used for WPS IE instead of WPA/RSN IE.
6fc6879b
JM
858 */
859 const u8 *wpa_ie;
e0498677 860
6fc6879b
JM
861 /**
862 * wpa_ie_len - length of the wpa_ie
863 */
864 size_t wpa_ie_len;
865
64fa840a
JM
866 /**
867 * wpa_proto - Bitfield of WPA_PROTO_* values to indicate WPA/WPA2
868 */
869 unsigned int wpa_proto;
870
e0498677 871 /**
4848a38d 872 * pairwise_suite - Selected pairwise cipher suite (WPA_CIPHER_*)
e0498677
JM
873 *
874 * This is usually ignored if @wpa_ie is used.
875 */
4848a38d 876 unsigned int pairwise_suite;
e0498677
JM
877
878 /**
4848a38d 879 * group_suite - Selected group cipher suite (WPA_CIPHER_*)
e0498677
JM
880 *
881 * This is usually ignored if @wpa_ie is used.
882 */
4848a38d 883 unsigned int group_suite;
e0498677 884
61a56c14
JM
885 /**
886 * mgmt_group_suite - Selected group management cipher suite (WPA_CIPHER_*)
887 *
888 * This is usually ignored if @wpa_ie is used.
889 */
890 unsigned int mgmt_group_suite;
891
e0498677 892 /**
4848a38d 893 * key_mgmt_suite - Selected key management suite (WPA_KEY_MGMT_*)
e0498677
JM
894 *
895 * This is usually ignored if @wpa_ie is used.
896 */
4848a38d 897 unsigned int key_mgmt_suite;
6fc6879b
JM
898
899 /**
900 * auth_alg - Allowed authentication algorithms
abd9fafa 901 * Bit field of WPA_AUTH_ALG_*
6fc6879b
JM
902 */
903 int auth_alg;
904
905 /**
906 * mode - Operation mode (infra/ibss) IEEE80211_MODE_*
907 */
908 int mode;
909
910 /**
911 * wep_key - WEP keys for static WEP configuration
912 */
913 const u8 *wep_key[4];
914
915 /**
916 * wep_key_len - WEP key length for static WEP configuration
917 */
918 size_t wep_key_len[4];
919
920 /**
921 * wep_tx_keyidx - WEP TX key index for static WEP configuration
922 */
923 int wep_tx_keyidx;
924
925 /**
926 * mgmt_frame_protection - IEEE 802.11w management frame protection
927 */
70f8cc8e 928 enum mfp_options mgmt_frame_protection;
6fc6879b 929
6fc6879b
JM
930 /**
931 * passphrase - RSN passphrase for PSK
932 *
933 * This value is made available only for WPA/WPA2-Personal (PSK) and
436ee2fd
AS
934 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_PSK. This
935 * is the 8..63 character ASCII passphrase, if available. Please note
936 * that this can be %NULL if passphrase was not used to generate the
937 * PSK. In that case, the psk field must be used to fetch the PSK.
6fc6879b
JM
938 */
939 const char *passphrase;
940
941 /**
942 * psk - RSN PSK (alternative for passphrase for PSK)
943 *
944 * This value is made available only for WPA/WPA2-Personal (PSK) and
436ee2fd
AS
945 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_PSK. This
946 * is the 32-octet (256-bit) PSK, if available. The driver wrapper
947 * should be prepared to handle %NULL value as an error.
6fc6879b
JM
948 */
949 const u8 *psk;
36b15723
JM
950
951 /**
952 * drop_unencrypted - Enable/disable unencrypted frame filtering
953 *
954 * Configure the driver to drop all non-EAPOL frames (both receive and
955 * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
956 * still be allowed for key negotiation.
957 */
958 int drop_unencrypted;
62fa124c
JM
959
960 /**
961 * prev_bssid - Previously used BSSID in this ESS
962 *
963 * When not %NULL, this is a request to use reassociation instead of
964 * association.
965 */
966 const u8 *prev_bssid;
0c80427d
JM
967
968 /**
969 * wps - WPS mode
970 *
971 * If the driver needs to do special configuration for WPS association,
972 * this variable provides more information on what type of association
973 * is being requested. Most drivers should not need ot use this.
974 */
975 enum wps_mode wps;
75bde05d
JM
976
977 /**
978 * p2p - Whether this connection is a P2P group
979 */
980 int p2p;
eea2fd9e
JM
981
982 /**
983 * uapsd - UAPSD parameters for the network
984 * -1 = do not change defaults
985 * AP mode: 1 = enabled, 0 = disabled
986 * STA mode: bits 0..3 UAPSD enabled for VO,VI,BK,BE
987 */
988 int uapsd;
9e2af29f
NC
989
990 /**
991 * fixed_bssid - Whether to force this BSSID in IBSS mode
992 * 1 = Fix this BSSID and prevent merges.
993 * 0 = Do not fix BSSID.
994 */
995 int fixed_bssid;
80e8a5ee 996
4d9e6fba
JD
997 /**
998 * fixed_freq - Fix control channel in IBSS mode
999 * 0 = don't fix control channel (default)
1000 * 1 = fix control channel; this prevents IBSS merging with another
1001 * channel
1002 */
1003 int fixed_freq;
1004
80e8a5ee
BG
1005 /**
1006 * disable_ht - Disable HT (IEEE 802.11n) for this connection
1007 */
1008 int disable_ht;
1009
1010 /**
4e8f31e2
JM
1011 * htcaps - HT Capabilities over-rides
1012 *
1013 * Only bits set in the mask will be used, and not all values are used
1014 * by the kernel anyway. Currently, MCS, MPDU and MSDU fields are used.
1015 *
1016 * Pointer to struct ieee80211_ht_capabilities.
1017 */
1018 const u8 *htcaps;
1019
1020 /**
1021 * htcaps_mask - HT Capabilities over-rides mask
1022 *
1023 * Pointer to struct ieee80211_ht_capabilities.
80e8a5ee 1024 */
4e8f31e2 1025 const u8 *htcaps_mask;
e9ee8dc3
JB
1026
1027#ifdef CONFIG_VHT_OVERRIDES
1028 /**
1029 * disable_vht - Disable VHT for this connection
1030 */
1031 int disable_vht;
1032
1033 /**
1034 * VHT capability overrides.
1035 */
1036 const struct ieee80211_vht_capabilities *vhtcaps;
1037 const struct ieee80211_vht_capabilities *vhtcaps_mask;
1038#endif /* CONFIG_VHT_OVERRIDES */
b41f2684
CL
1039
1040 /**
1041 * req_key_mgmt_offload - Request key management offload for connection
1042 *
1043 * Request key management offload for this connection if the device
1044 * supports it.
1045 */
1046 int req_key_mgmt_offload;
0dc957b9
AK
1047
1048 /**
1049 * Flag for indicating whether this association includes support for
1050 * RRM (Radio Resource Measurements)
1051 */
1052 int rrm_used;
86b5c400
LD
1053
1054 /**
1055 * pbss - If set, connect to a PCP in a PBSS. Otherwise, connect to an
1056 * AP as usual. Valid for DMG network only.
1057 */
1058 int pbss;
ac56c395
JM
1059
1060 /**
1061 * fils_kek - KEK for FILS association frame protection (AES-SIV)
1062 */
1063 const u8 *fils_kek;
1064
1065 /**
1066 * fils_kek_len: Length of fils_kek in bytes
1067 */
1068 size_t fils_kek_len;
1069
1070 /**
1071 * fils_nonces - Nonces for FILS association frame protection
1072 * (AES-SIV AAD)
1073 */
1074 const u8 *fils_nonces;
1075
1076 /**
1077 * fils_nonces_len: Length of fils_nonce in bytes
1078 */
1079 size_t fils_nonces_len;
ad295f3b
VK
1080
1081 /**
1082 * fils_erp_username - Username part of keyName-NAI
1083 */
1084 const u8 *fils_erp_username;
1085
1086 /**
1087 * fils_erp_username_len - Length of fils_erp_username in bytes
1088 */
1089 size_t fils_erp_username_len;
1090
1091 /**
1092 * fils_erp_realm - Realm/domain name to use in FILS ERP
1093 */
1094 const u8 *fils_erp_realm;
1095
1096 /**
1097 * fils_erp_realm_len - Length of fils_erp_realm in bytes
1098 */
1099 size_t fils_erp_realm_len;
1100
1101 /**
1102 * fils_erp_next_seq_num - The next sequence number to use in FILS ERP
1103 * messages
1104 */
1105 u16 fils_erp_next_seq_num;
1106
1107 /**
1108 * fils_erp_rrk - Re-authentication root key (rRK) for the keyName-NAI
1109 * specified by fils_erp_username@fils_erp_realm.
1110 */
1111 const u8 *fils_erp_rrk;
1112
1113 /**
1114 * fils_erp_rrk_len - Length of fils_erp_rrk in bytes
1115 */
1116 size_t fils_erp_rrk_len;
6fc6879b
JM
1117};
1118
97a7a0b5
JM
1119enum hide_ssid {
1120 NO_SSID_HIDING,
1121 HIDDEN_SSID_ZERO_LEN,
1122 HIDDEN_SSID_ZERO_CONTENTS
1123};
1124
95f556f3
OD
1125enum ch_switch_state {
1126 CH_SW_STARTED,
1127 CH_SW_FINISHED
1128};
1129
e4fa8b12
EP
1130struct wowlan_triggers {
1131 u8 any;
1132 u8 disconnect;
1133 u8 magic_pkt;
1134 u8 gtk_rekey_failure;
1135 u8 eap_identity_req;
1136 u8 four_way_handshake;
1137 u8 rfkill_release;
1138};
1139
19c3b566
JM
1140struct wpa_driver_ap_params {
1141 /**
1142 * head - Beacon head from IEEE 802.11 header to IEs before TIM IE
1143 */
e44a384b 1144 u8 *head;
19c3b566
JM
1145
1146 /**
1147 * head_len - Length of the head buffer in octets
1148 */
1149 size_t head_len;
1150
1151 /**
1152 * tail - Beacon tail following TIM IE
1153 */
e44a384b 1154 u8 *tail;
19c3b566
JM
1155
1156 /**
1157 * tail_len - Length of the tail buffer in octets
1158 */
1159 size_t tail_len;
1160
1161 /**
1162 * dtim_period - DTIM period
1163 */
1164 int dtim_period;
1165
1166 /**
1167 * beacon_int - Beacon interval
1168 */
1169 int beacon_int;
ccb941e6 1170
e5693c47
JM
1171 /**
1172 * basic_rates: -1 terminated array of basic rates in 100 kbps
1173 *
1174 * This parameter can be used to set a specific basic rate set for the
1175 * BSS. If %NULL, default basic rate set is used.
1176 */
1177 int *basic_rates;
1178
29483a56
PK
1179 /**
1180 * beacon_rate: Beacon frame data rate
1181 *
1182 * This parameter can be used to set a specific Beacon frame data rate
1183 * for the BSS. The interpretation of this value depends on the
1184 * rate_type (legacy: in 100 kbps units, HT: HT-MCS, VHT: VHT-MCS). If
1185 * beacon_rate == 0 and rate_type == 0 (BEACON_RATE_LEGACY), the default
1186 * Beacon frame data rate is used.
1187 */
1188 unsigned int beacon_rate;
1189
1190 /**
1191 * beacon_rate_type: Beacon data rate type (legacy/HT/VHT)
1192 */
1193 enum beacon_rate_type rate_type;
1194
5b99e21a
AN
1195 /**
1196 * proberesp - Probe Response template
1197 *
1198 * This is used by drivers that reply to Probe Requests internally in
1199 * AP mode and require the full Probe Response template.
1200 */
e44a384b 1201 u8 *proberesp;
5b99e21a
AN
1202
1203 /**
1204 * proberesp_len - Length of the proberesp buffer in octets
1205 */
1206 size_t proberesp_len;
1207
ccb941e6
JM
1208 /**
1209 * ssid - The SSID to use in Beacon/Probe Response frames
1210 */
1211 const u8 *ssid;
1212
1213 /**
1214 * ssid_len - Length of the SSID (1..32)
1215 */
1216 size_t ssid_len;
b11d1d64 1217
97a7a0b5
JM
1218 /**
1219 * hide_ssid - Whether to hide the SSID
1220 */
1221 enum hide_ssid hide_ssid;
1222
b11d1d64
JM
1223 /**
1224 * pairwise_ciphers - WPA_CIPHER_* bitfield
1225 */
1226 unsigned int pairwise_ciphers;
1227
1228 /**
1229 * group_cipher - WPA_CIPHER_*
1230 */
1231 unsigned int group_cipher;
1232
1233 /**
1234 * key_mgmt_suites - WPA_KEY_MGMT_* bitfield
1235 */
1236 unsigned int key_mgmt_suites;
1237
1238 /**
1239 * auth_algs - WPA_AUTH_ALG_* bitfield
1240 */
1241 unsigned int auth_algs;
1242
1243 /**
1244 * wpa_version - WPA_PROTO_* bitfield
1245 */
1246 unsigned int wpa_version;
1247
1248 /**
1249 * privacy - Whether privacy is used in the BSS
1250 */
1251 int privacy;
fb91db56
JM
1252
1253 /**
1254 * beacon_ies - WPS/P2P IE(s) for Beacon frames
1255 *
dcd1eb5b
JM
1256 * This is used to add IEs like WPS IE and P2P IE by drivers that do
1257 * not use the full Beacon template.
fb91db56
JM
1258 */
1259 const struct wpabuf *beacon_ies;
1260
1261 /**
1262 * proberesp_ies - P2P/WPS IE(s) for Probe Response frames
1263 *
1264 * This is used to add IEs like WPS IE and P2P IE by drivers that
1265 * reply to Probe Request frames internally.
1266 */
1267 const struct wpabuf *proberesp_ies;
1268
1269 /**
1270 * assocresp_ies - WPS IE(s) for (Re)Association Response frames
062390ef
JM
1271 *
1272 * This is used to add IEs like WPS IE by drivers that reply to
1273 * (Re)Association Request frames internally.
fb91db56
JM
1274 */
1275 const struct wpabuf *assocresp_ies;
fd13a541
JM
1276
1277 /**
1278 * isolate - Whether to isolate frames between associated stations
1279 *
1280 * If this is non-zero, the AP is requested to disable forwarding of
e53a0c74 1281 * frames between associated stations.
fd13a541
JM
1282 */
1283 int isolate;
31357268
JM
1284
1285 /**
1286 * cts_protect - Whether CTS protection is enabled
1287 */
1288 int cts_protect;
1289
1290 /**
1291 * preamble - Whether short preamble is enabled
1292 */
1293 int preamble;
1294
1295 /**
1296 * short_slot_time - Whether short slot time is enabled
1297 *
1298 * 0 = short slot time disable, 1 = short slot time enabled, -1 = do
1299 * not set (e.g., when 802.11g mode is not in use)
1300 */
1301 int short_slot_time;
1302
1303 /**
1304 * ht_opmode - HT operation mode or -1 if HT not in use
1305 */
1306 int ht_opmode;
8a33a63f
JM
1307
1308 /**
1309 * interworking - Whether Interworking is enabled
1310 */
1311 int interworking;
1312
1313 /**
1314 * hessid - Homogeneous ESS identifier or %NULL if not set
1315 */
1316 const u8 *hessid;
16991cff
JM
1317
1318 /**
1319 * access_network_type - Access Network Type (0..15)
1320 *
1321 * This is used for filtering Probe Request frames when Interworking is
1322 * enabled.
1323 */
1324 u8 access_network_type;
a0133ee1
VT
1325
1326 /**
1327 * ap_max_inactivity - Timeout in seconds to detect STA's inactivity
1328 *
1329 * This is used by driver which advertises this capability.
1330 */
1331 int ap_max_inactivity;
83421850 1332
0b8bcaa5
EP
1333 /**
1334 * ctwindow - Client Traffic Window (in TUs)
1335 */
1336 u8 p2p_go_ctwindow;
1337
83421850 1338 /**
8f461b50
EP
1339 * smps_mode - SMPS mode
1340 *
1341 * SMPS mode to be used by the AP, specified as the relevant bits of
1342 * ht_capab (i.e. HT_CAP_INFO_SMPS_*).
1343 */
1344 unsigned int smps_mode;
1345
1346 /**
83421850
JM
1347 * disable_dgaf - Whether group-addressed frames are disabled
1348 */
1349 int disable_dgaf;
a14896e8
JM
1350
1351 /**
1352 * osen - Whether OSEN security is enabled
1353 */
1354 int osen;
196c9c7c
PX
1355
1356 /**
1357 * freq - Channel parameters for dynamic bandwidth changes
1358 */
1359 struct hostapd_freq_params *freq;
f33c8606
JM
1360
1361 /**
1362 * reenable - Whether this is to re-enable beaconing
1363 */
1364 int reenable;
86b5c400
LD
1365
1366 /**
1367 * pbss - Whether to start a PCP (in PBSS) instead of an AP in
1368 * infrastructure BSS. Valid only for DMG network.
1369 */
1370 int pbss;
34f7c699
MB
1371
1372 /**
1373 * multicast_to_unicast - Whether to use multicast_to_unicast
1374 *
1375 * If this is non-zero, the AP is requested to perform multicast to
1376 * unicast conversion for ARP, IPv4, and IPv6 frames (possibly within
1377 * 802.1Q). If enabled, such frames are to be sent to each station
1378 * separately, with the DA replaced by their own MAC address rather
1379 * than the group address.
1380 *
1381 * Note that this may break certain expectations of the receiver, such
1382 * as the ability to drop unicast IP packets received within multicast
1383 * L2 frames, or the ability to not send ICMP destination unreachable
1384 * messages for packets received in L2 multicast (which is required,
1385 * but the receiver can't tell the difference if this new option is
1386 * enabled.)
1387 *
1388 * This also doesn't implement the 802.11 DMS (directed multicast
1389 * service).
1390 */
1391 int multicast_to_unicast;
4cb618cf
AO
1392
1393 /**
1394 * ftm_responder - Whether FTM responder is enabled
1395 */
1396 int ftm_responder;
1397
1398 /**
1399 * lci - Binary data, the content of an LCI report IE with type 8 as
1400 * defined in IEEE Std 802.11-2016, 9.4.2.22.10
1401 */
1402 const struct wpabuf *lci;
1403
1404 /**
1405 * civic - Binary data, the content of a measurement report IE with
1406 * type 11 as defined in IEEE Std 802.11-2016, 9.4.2.22.13
1407 */
1408 const struct wpabuf *civic;
19c3b566
JM
1409};
1410
6c1664f6 1411struct wpa_driver_mesh_bss_params {
2bd62171
MH
1412#define WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS 0x00000001
1413#define WPA_DRIVER_MESH_CONF_FLAG_PEER_LINK_TIMEOUT 0x00000002
1414#define WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS 0x00000004
052b8d38 1415#define WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE 0x00000008
31a856a1 1416#define WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD 0x00000010
6c1664f6
BC
1417 /*
1418 * TODO: Other mesh configuration parameters would go here.
1419 * See NL80211_MESHCONF_* for all the mesh config parameters.
1420 */
1421 unsigned int flags;
2bd62171 1422 int auto_plinks;
5a2a6de6 1423 int peer_link_timeout;
a1431ef8 1424 int max_peer_links;
31a856a1 1425 int rssi_threshold;
052b8d38 1426 u16 ht_opmode;
6c1664f6
BC
1427};
1428
1429struct wpa_driver_mesh_join_params {
1430 const u8 *meshid;
1431 int meshid_len;
1432 const int *basic_rates;
1433 const u8 *ies;
1434 int ie_len;
f7e889fa 1435 struct hostapd_freq_params freq;
9c58c5f7 1436 int beacon_int;
4ac2ea57 1437 int dtim_period;
6c1664f6
BC
1438 struct wpa_driver_mesh_bss_params conf;
1439#define WPA_DRIVER_MESH_FLAG_USER_MPM 0x00000001
1440#define WPA_DRIVER_MESH_FLAG_DRIVER_MPM 0x00000002
1441#define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004
1442#define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008
1443 unsigned int flags;
1444};
1445
6fc6879b
JM
1446/**
1447 * struct wpa_driver_capa - Driver capability information
1448 */
1449struct wpa_driver_capa {
1450#define WPA_DRIVER_CAPA_KEY_MGMT_WPA 0x00000001
1451#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2 0x00000002
1452#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK 0x00000004
1453#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK 0x00000008
1454#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE 0x00000010
1455#define WPA_DRIVER_CAPA_KEY_MGMT_FT 0x00000020
1456#define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK 0x00000040
369c8d7b 1457#define WPA_DRIVER_CAPA_KEY_MGMT_WAPI_PSK 0x00000080
399e6135
JM
1458#define WPA_DRIVER_CAPA_KEY_MGMT_SUITE_B 0x00000100
1459#define WPA_DRIVER_CAPA_KEY_MGMT_SUITE_B_192 0x00000200
f9561868 1460#define WPA_DRIVER_CAPA_KEY_MGMT_OWE 0x00000400
567da5bb 1461#define WPA_DRIVER_CAPA_KEY_MGMT_DPP 0x00000800
fe3e0bac
VK
1462#define WPA_DRIVER_CAPA_KEY_MGMT_FILS_SHA256 0x00001000
1463#define WPA_DRIVER_CAPA_KEY_MGMT_FILS_SHA384 0x00002000
1464#define WPA_DRIVER_CAPA_KEY_MGMT_FT_FILS_SHA256 0x00004000
1465#define WPA_DRIVER_CAPA_KEY_MGMT_FT_FILS_SHA384 0x00008000
8ec7c99e 1466#define WPA_DRIVER_CAPA_KEY_MGMT_SAE 0x00010000
4e8f31e2 1467 /** Bitfield of supported key management suites */
6fc6879b
JM
1468 unsigned int key_mgmt;
1469
1470#define WPA_DRIVER_CAPA_ENC_WEP40 0x00000001
1471#define WPA_DRIVER_CAPA_ENC_WEP104 0x00000002
1472#define WPA_DRIVER_CAPA_ENC_TKIP 0x00000004
1473#define WPA_DRIVER_CAPA_ENC_CCMP 0x00000008
349493bd 1474#define WPA_DRIVER_CAPA_ENC_WEP128 0x00000010
eb7719ff 1475#define WPA_DRIVER_CAPA_ENC_GCMP 0x00000020
30675c34
JM
1476#define WPA_DRIVER_CAPA_ENC_GCMP_256 0x00000040
1477#define WPA_DRIVER_CAPA_ENC_CCMP_256 0x00000080
1478#define WPA_DRIVER_CAPA_ENC_BIP 0x00000100
1479#define WPA_DRIVER_CAPA_ENC_BIP_GMAC_128 0x00000200
1480#define WPA_DRIVER_CAPA_ENC_BIP_GMAC_256 0x00000400
1481#define WPA_DRIVER_CAPA_ENC_BIP_CMAC_256 0x00000800
ae6f9272 1482#define WPA_DRIVER_CAPA_ENC_GTK_NOT_USED 0x00001000
4e8f31e2 1483 /** Bitfield of supported cipher suites */
6fc6879b
JM
1484 unsigned int enc;
1485
1486#define WPA_DRIVER_AUTH_OPEN 0x00000001
1487#define WPA_DRIVER_AUTH_SHARED 0x00000002
1488#define WPA_DRIVER_AUTH_LEAP 0x00000004
4e8f31e2 1489 /** Bitfield of supported IEEE 802.11 authentication algorithms */
6fc6879b
JM
1490 unsigned int auth;
1491
4e8f31e2 1492/** Driver generated WPA/RSN IE */
6fc6879b 1493#define WPA_DRIVER_FLAGS_DRIVER_IE 0x00000001
4e8f31e2 1494/** Driver needs static WEP key setup after association command */
6fc6879b 1495#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
4e8f31e2 1496/** Driver takes care of all DFS operations */
65d645ce 1497#define WPA_DRIVER_FLAGS_DFS_OFFLOAD 0x00000004
4e8f31e2 1498/** Driver takes care of RSN 4-way handshake internally; PMK is configured with
6fc6879b 1499 * struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */
436ee2fd 1500#define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_8021X 0x00000008
4e8f31e2 1501/** Driver is for a wired Ethernet interface */
4ef1e644 1502#define WPA_DRIVER_FLAGS_WIRED 0x00000010
4e8f31e2 1503/** Driver provides separate commands for authentication and association (SME in
c2a04078
JM
1504 * wpa_supplicant). */
1505#define WPA_DRIVER_FLAGS_SME 0x00000020
4e8f31e2 1506/** Driver supports AP mode */
1581b38b 1507#define WPA_DRIVER_FLAGS_AP 0x00000040
4e8f31e2 1508/** Driver needs static WEP key setup after association has been completed */
0194fedb 1509#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE 0x00000080
4e8f31e2 1510/** Driver supports dynamic HT 20/40 MHz channel changes during BSS lifetime */
196c9c7c 1511#define WPA_DRIVER_FLAGS_HT_2040_COEX 0x00000100
4e8f31e2 1512/** Driver supports concurrent P2P operations */
75bde05d 1513#define WPA_DRIVER_FLAGS_P2P_CONCURRENT 0x00000200
4e8f31e2 1514/**
75bde05d 1515 * Driver uses the initial interface as a dedicated management interface, i.e.,
971e357f 1516 * it cannot be used for P2P group operations or non-P2P purposes.
75bde05d
JM
1517 */
1518#define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE 0x00000400
4e8f31e2 1519/** This interface is P2P capable (P2P GO or P2P Client) */
75bde05d 1520#define WPA_DRIVER_FLAGS_P2P_CAPABLE 0x00000800
4e8f31e2 1521/** Driver supports station and key removal when stopping an AP */
354c903f 1522#define WPA_DRIVER_FLAGS_AP_TEARDOWN_SUPPORT 0x00001000
4e8f31e2 1523/**
971e357f
JM
1524 * Driver uses the initial interface for P2P management interface and non-P2P
1525 * purposes (e.g., connect to infra AP), but this interface cannot be used for
1526 * P2P group operations.
1527 */
1528#define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P 0x00002000
4e8f31e2 1529/**
871f4dd0
JM
1530 * Driver is known to use sane error codes, i.e., when it indicates that
1531 * something (e.g., association) fails, there was indeed a failure and the
1532 * operation does not end up getting completed successfully later.
1533 */
1534#define WPA_DRIVER_FLAGS_SANE_ERROR_CODES 0x00004000
4e8f31e2 1535/** Driver supports off-channel TX */
190b9062 1536#define WPA_DRIVER_FLAGS_OFFCHANNEL_TX 0x00008000
4e8f31e2 1537/** Driver indicates TX status events for EAPOL Data frames */
2fee890a 1538#define WPA_DRIVER_FLAGS_EAPOL_TX_STATUS 0x00010000
4e8f31e2 1539/** Driver indicates TX status events for Deauth/Disassoc frames */
4dc03726 1540#define WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS 0x00020000
4e8f31e2 1541/** Driver supports roaming (BSS selection) in firmware */
004ba773 1542#define WPA_DRIVER_FLAGS_BSS_SELECTION 0x00040000
4e8f31e2 1543/** Driver supports operating as a TDLS peer */
03ea1786 1544#define WPA_DRIVER_FLAGS_TDLS_SUPPORT 0x00080000
4e8f31e2 1545/** Driver requires external TDLS setup/teardown/discovery */
03ea1786 1546#define WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP 0x00100000
4e8f31e2 1547/** Driver indicates support for Probe Response offloading in AP mode */
562c9d97 1548#define WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD 0x00200000
4e8f31e2 1549/** Driver supports U-APSD in AP mode */
70619a5d 1550#define WPA_DRIVER_FLAGS_AP_UAPSD 0x00400000
4e8f31e2 1551/** Driver supports inactivity timer in AP mode */
a0133ee1 1552#define WPA_DRIVER_FLAGS_INACTIVITY_TIMER 0x00800000
4e8f31e2 1553/** Driver expects user space implementation of MLME in AP mode */
e5091674 1554#define WPA_DRIVER_FLAGS_AP_MLME 0x01000000
4e8f31e2 1555/** Driver supports SAE with user space SME */
c10347f2 1556#define WPA_DRIVER_FLAGS_SAE 0x02000000
4e8f31e2 1557/** Driver makes use of OBSS scan mechanism in wpa_supplicant */
368b1957 1558#define WPA_DRIVER_FLAGS_OBSS_SCAN 0x04000000
4e8f31e2 1559/** Driver supports IBSS (Ad-hoc) mode */
65d52fc1 1560#define WPA_DRIVER_FLAGS_IBSS 0x08000000
4e8f31e2 1561/** Driver supports radar detection */
f295d0c8 1562#define WPA_DRIVER_FLAGS_RADAR 0x10000000
4e8f31e2 1563/** Driver supports a dedicated interface for P2P Device */
7aad838c 1564#define WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE 0x20000000
4e8f31e2 1565/** Driver supports QoS Mapping */
429dd9af 1566#define WPA_DRIVER_FLAGS_QOS_MAPPING 0x40000000
4e8f31e2 1567/** Driver supports CSA in AP mode */
991aa9c7 1568#define WPA_DRIVER_FLAGS_AP_CSA 0x80000000
4e8f31e2 1569/** Driver supports mesh */
24bd4e0b 1570#define WPA_DRIVER_FLAGS_MESH 0x0000000100000000ULL
4e8f31e2 1571/** Driver support ACS offload */
16689c7c 1572#define WPA_DRIVER_FLAGS_ACS_OFFLOAD 0x0000000200000000ULL
4e8f31e2 1573/** Driver supports key management offload */
15badebd 1574#define WPA_DRIVER_FLAGS_KEY_MGMT_OFFLOAD 0x0000000400000000ULL
4daa5729
AN
1575/** Driver supports TDLS channel switching */
1576#define WPA_DRIVER_FLAGS_TDLS_CHANNEL_SWITCH 0x0000000800000000ULL
1830817e
JD
1577/** Driver supports IBSS with HT datarates */
1578#define WPA_DRIVER_FLAGS_HT_IBSS 0x0000001000000000ULL
563ee183
JD
1579/** Driver supports IBSS with VHT datarates */
1580#define WPA_DRIVER_FLAGS_VHT_IBSS 0x0000002000000000ULL
3784c058
PX
1581/** Driver supports automatic band selection */
1582#define WPA_DRIVER_FLAGS_SUPPORT_HW_MODE_ANY 0x0000004000000000ULL
8e509745
KV
1583/** Driver supports simultaneous off-channel operations */
1584#define WPA_DRIVER_FLAGS_OFFCHANNEL_SIMULTANEOUS 0x0000008000000000ULL
dc55b6b6
AB
1585/** Driver supports full AP client state */
1586#define WPA_DRIVER_FLAGS_FULL_AP_CLIENT_STATE 0x0000010000000000ULL
a6f5b193
PX
1587/** Driver supports P2P Listen offload */
1588#define WPA_DRIVER_FLAGS_P2P_LISTEN_OFFLOAD 0x0000020000000000ULL
061dac1d
JM
1589/** Driver supports FILS */
1590#define WPA_DRIVER_FLAGS_SUPPORT_FILS 0x0000040000000000ULL
29483a56
PK
1591/** Driver supports Beacon frame TX rate configuration (legacy rates) */
1592#define WPA_DRIVER_FLAGS_BEACON_RATE_LEGACY 0x0000080000000000ULL
1593/** Driver supports Beacon frame TX rate configuration (HT rates) */
1594#define WPA_DRIVER_FLAGS_BEACON_RATE_HT 0x0000100000000000ULL
1595/** Driver supports Beacon frame TX rate configuration (VHT rates) */
1596#define WPA_DRIVER_FLAGS_BEACON_RATE_VHT 0x0000200000000000ULL
8331c9b3
VK
1597/** Driver supports mgmt_tx with random TX address in non-connected state */
1598#define WPA_DRIVER_FLAGS_MGMT_TX_RANDOM_TA 0x0000400000000000ULL
1599/** Driver supports mgmt_tx with random TX addr in connected state */
1600#define WPA_DRIVER_FLAGS_MGMT_TX_RANDOM_TA_CONNECTED 0x0000800000000000ULL
20c846d9 1601/** Driver supports better BSS reporting with sched_scan in connected mode */
1602#define WPA_DRIVER_FLAGS_SCHED_SCAN_RELATIVE_RSSI 0x0001000000000000ULL
94380cb4
PX
1603/** Driver supports HE capabilities */
1604#define WPA_DRIVER_FLAGS_HE_CAPABILITIES 0x0002000000000000ULL
ad295f3b
VK
1605/** Driver supports FILS shared key offload */
1606#define WPA_DRIVER_FLAGS_FILS_SK_OFFLOAD 0x0004000000000000ULL
fb718f94
AP
1607/** Driver supports all OCE STA specific mandatory features */
1608#define WPA_DRIVER_FLAGS_OCE_STA 0x0008000000000000ULL
1609/** Driver supports all OCE AP specific mandatory features */
1610#define WPA_DRIVER_FLAGS_OCE_AP 0x0010000000000000ULL
1611/**
1612 * Driver supports all OCE STA-CFON specific mandatory features only.
1613 * If a driver sets this bit but not the %WPA_DRIVER_FLAGS_OCE_AP, the
1614 * userspace shall assume that this driver may not support all OCE AP
1615 * functionality but can support only OCE STA-CFON functionality.
1616 */
1617#define WPA_DRIVER_FLAGS_OCE_STA_CFON 0x0020000000000000ULL
299d21e8
EG
1618/** Driver supports MFP-optional in the connect command */
1619#define WPA_DRIVER_FLAGS_MFP_OPTIONAL 0x0040000000000000ULL
8aa4d552
PX
1620/** Driver is a self-managed regulatory device */
1621#define WPA_DRIVER_FLAGS_SELF_MANAGED_REGULATORY 0x0080000000000000ULL
4cb618cf
AO
1622/** Driver supports FTM responder functionality */
1623#define WPA_DRIVER_FLAGS_FTM_RESPONDER 0x0100000000000000ULL
436ee2fd
AS
1624/** Driver support 4-way handshake offload for WPA-Personal */
1625#define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_PSK 0x0200000000000000ULL
24bd4e0b 1626 u64 flags;
80bc75f1 1627
dc55b6b6
AB
1628#define FULL_AP_CLIENT_STATE_SUPP(drv_flags) \
1629 (drv_flags & WPA_DRIVER_FLAGS_FULL_AP_CLIENT_STATE)
1630
04ee647d
EP
1631#define WPA_DRIVER_SMPS_MODE_STATIC 0x00000001
1632#define WPA_DRIVER_SMPS_MODE_DYNAMIC 0x00000002
1633 unsigned int smps_modes;
1634
471cd6e1
MB
1635 unsigned int wmm_ac_supported:1;
1636
ff23ed22
IP
1637 unsigned int mac_addr_rand_scan_supported:1;
1638 unsigned int mac_addr_rand_sched_scan_supported:1;
1639
4e8f31e2 1640 /** Maximum number of supported active probe SSIDs */
80bc75f1 1641 int max_scan_ssids;
4e8f31e2
JM
1642
1643 /** Maximum number of supported active probe SSIDs for sched_scan */
cbdf3507 1644 int max_sched_scan_ssids;
4e8f31e2 1645
09ea4309
AS
1646 /** Maximum number of supported scan plans for scheduled scan */
1647 unsigned int max_sched_scan_plans;
1648
1649 /** Maximum interval in a scan plan. In seconds */
1650 u32 max_sched_scan_plan_interval;
1651
1652 /** Maximum number of iterations in a single scan plan */
1653 u32 max_sched_scan_plan_iterations;
1654
4e8f31e2 1655 /** Whether sched_scan (offloaded scanning) is supported */
cbdf3507 1656 int sched_scan_supported;
4e8f31e2
JM
1657
1658 /** Maximum number of supported match sets for sched_scan */
b59e6f26 1659 int max_match_sets;
814782b9
JM
1660
1661 /**
1662 * max_remain_on_chan - Maximum remain-on-channel duration in msec
1663 */
1664 unsigned int max_remain_on_chan;
c4ea4c5c
JM
1665
1666 /**
1667 * max_stations - Maximum number of associated stations the driver
1668 * supports in AP mode
1669 */
1670 unsigned int max_stations;
562c9d97
AN
1671
1672 /**
1673 * probe_resp_offloads - Bitmap of supported protocols by the driver
1674 * for Probe Response offloading.
1675 */
4e8f31e2 1676/** Driver Probe Response offloading support for WPS ver. 1 */
562c9d97 1677#define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS 0x00000001
4e8f31e2 1678/** Driver Probe Response offloading support for WPS ver. 2 */
562c9d97 1679#define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS2 0x00000002
4e8f31e2 1680/** Driver Probe Response offloading support for P2P */
562c9d97 1681#define WPA_DRIVER_PROBE_RESP_OFFLOAD_P2P 0x00000004
4e8f31e2 1682/** Driver Probe Response offloading support for IEEE 802.11u (Interworking) */
562c9d97
AN
1683#define WPA_DRIVER_PROBE_RESP_OFFLOAD_INTERWORKING 0x00000008
1684 unsigned int probe_resp_offloads;
8cd6b7bc 1685
3c4ca363
VN
1686 unsigned int max_acl_mac_addrs;
1687
4752147d
IP
1688 /**
1689 * Number of supported concurrent channels
1690 */
1691 unsigned int num_multichan_concurrent;
1692
8cd6b7bc
JB
1693 /**
1694 * extended_capa - extended capabilities in driver/device
1695 *
1696 * Must be allocated and freed by driver and the pointers must be
1697 * valid for the lifetime of the driver, i.e., freed in deinit()
1698 */
1699 const u8 *extended_capa, *extended_capa_mask;
1700 unsigned int extended_capa_len;
e4fa8b12
EP
1701
1702 struct wowlan_triggers wowlan_triggers;
0dc957b9 1703
4e8f31e2 1704/** Driver adds the DS Params Set IE in Probe Request frames */
0dc957b9 1705#define WPA_DRIVER_FLAGS_DS_PARAM_SET_IE_IN_PROBES 0x00000001
4e8f31e2 1706/** Driver adds the WFA TPC IE in Probe Request frames */
0dc957b9 1707#define WPA_DRIVER_FLAGS_WFA_TPC_IE_IN_PROBES 0x00000002
4e8f31e2 1708/** Driver handles quiet period requests */
0dc957b9
AK
1709#define WPA_DRIVER_FLAGS_QUIET 0x00000004
1710/**
1711 * Driver is capable of inserting the current TX power value into the body of
1712 * transmitted frames.
1713 * Background: Some Action frames include a TPC Report IE. This IE contains a
1714 * TX power field, which has to be updated by lower layers. One such Action
1715 * frame is Link Measurement Report (part of RRM). Another is TPC Report (part
1716 * of spectrum management). Note that this insertion takes place at a fixed
1717 * offset, namely the 6th byte in the Action frame body.
1718 */
1719#define WPA_DRIVER_FLAGS_TX_POWER_INSERTION 0x00000008
a7f0bb70
BL
1720/**
1721 * Driver supports RRM. With this support, the driver will accept to use RRM in
1722 * (Re)Association Request frames, without supporting quiet period.
1723 */
1724#define WPA_DRIVER_FLAGS_SUPPORT_RRM 0x00000010
1725
c16b9f8d
AS
1726/** Driver supports setting the scan dwell time */
1727#define WPA_DRIVER_FLAGS_SUPPORT_SET_SCAN_DWELL 0x00000020
1728/** Driver supports Beacon Report Measurement */
1729#define WPA_DRIVER_FLAGS_SUPPORT_BEACON_REPORT 0x00000040
1730
0dc957b9 1731 u32 rrm_flags;
079a28f7
AK
1732
1733 /* Driver concurrency capabilities */
1734 unsigned int conc_capab;
1735 /* Maximum number of concurrent channels on 2.4 GHz */
1736 unsigned int max_conc_chan_2_4;
1737 /* Maximum number of concurrent channels on 5 GHz */
1738 unsigned int max_conc_chan_5_0;
366179d2
AO
1739
1740 /* Maximum number of supported CSA counters */
1741 u16 max_csa_counters;
6fc6879b
JM
1742};
1743
1744
c5121837
JM
1745struct hostapd_data;
1746
3567641e 1747#define STA_DRV_DATA_TX_MCS BIT(0)
1748#define STA_DRV_DATA_RX_MCS BIT(1)
1749#define STA_DRV_DATA_TX_VHT_MCS BIT(2)
1750#define STA_DRV_DATA_RX_VHT_MCS BIT(3)
1751#define STA_DRV_DATA_TX_VHT_NSS BIT(4)
1752#define STA_DRV_DATA_RX_VHT_NSS BIT(5)
1753#define STA_DRV_DATA_TX_SHORT_GI BIT(6)
1754#define STA_DRV_DATA_RX_SHORT_GI BIT(7)
72123a84 1755#define STA_DRV_DATA_LAST_ACK_RSSI BIT(8)
3567641e 1756
c5121837 1757struct hostap_sta_driver_data {
43022abd
NL
1758 unsigned long rx_packets, tx_packets;
1759 unsigned long long rx_bytes, tx_bytes;
1760 int bytes_64bit; /* whether 64-bit byte counters are supported */
c5121837 1761 unsigned long current_tx_rate;
3567641e 1762 unsigned long current_rx_rate;
c5121837 1763 unsigned long inactive_msec;
3567641e 1764 unsigned long flags; /* bitfield of STA_DRV_DATA_* */
c5121837
JM
1765 unsigned long num_ps_buf_frames;
1766 unsigned long tx_retry_failed;
1767 unsigned long tx_retry_count;
72123a84 1768 s8 last_ack_rssi;
3567641e 1769 s8 signal;
1770 u8 rx_vhtmcs;
1771 u8 tx_vhtmcs;
1772 u8 rx_mcs;
1773 u8 tx_mcs;
1774 u8 rx_vht_nss;
1775 u8 tx_vht_nss;
c5121837
JM
1776};
1777
1778struct hostapd_sta_add_params {
1779 const u8 *addr;
1780 u16 aid;
1781 u16 capability;
1782 const u8 *supp_rates;
1783 size_t supp_rates_len;
c5121837 1784 u16 listen_interval;
fc4e2d95 1785 const struct ieee80211_ht_capabilities *ht_capabilities;
a9a1d0f0 1786 const struct ieee80211_vht_capabilities *vht_capabilities;
8a458116
MK
1787 int vht_opmode_enabled;
1788 u8 vht_opmode;
d83ab1fe 1789 u32 flags; /* bitmask of WPA_STA_* flags */
7e31703e 1790 u32 flags_mask; /* unset bits in flags */
7c7e7877
BC
1791#ifdef CONFIG_MESH
1792 enum mesh_plink_state plink_state;
e347cafe 1793 u16 peer_aid;
7c7e7877 1794#endif /* CONFIG_MESH */
45b722f1 1795 int set; /* Set STA parameters instead of add */
5d061637 1796 u8 qosinfo;
d16531c4
SD
1797 const u8 *ext_capab;
1798 size_t ext_capab_len;
3ed97271
SD
1799 const u8 *supp_channels;
1800 size_t supp_channels_len;
1801 const u8 *supp_oper_classes;
1802 size_t supp_oper_classes_len;
ae33239c 1803 int support_p2p_ps;
c5121837
JM
1804};
1805
3c4ca363
VN
1806struct mac_address {
1807 u8 addr[ETH_ALEN];
1808};
1809
1810struct hostapd_acl_params {
1811 u8 acl_policy;
1812 unsigned int num_mac_acl;
1813 struct mac_address mac_acl[0];
1814};
1815
22a7c9d7
JM
1816enum wpa_driver_if_type {
1817 /**
1818 * WPA_IF_STATION - Station mode interface
1819 */
1820 WPA_IF_STATION,
1821
1822 /**
1823 * WPA_IF_AP_VLAN - AP mode VLAN interface
1824 *
1825 * This interface shares its address and Beacon frame with the main
1826 * BSS.
1827 */
1828 WPA_IF_AP_VLAN,
1829
1830 /**
1831 * WPA_IF_AP_BSS - AP mode BSS interface
1832 *
1833 * This interface has its own address and Beacon frame.
1834 */
1835 WPA_IF_AP_BSS,
75bde05d
JM
1836
1837 /**
1838 * WPA_IF_P2P_GO - P2P Group Owner
1839 */
1840 WPA_IF_P2P_GO,
1841
1842 /**
1843 * WPA_IF_P2P_CLIENT - P2P Client
1844 */
1845 WPA_IF_P2P_CLIENT,
1846
1847 /**
1848 * WPA_IF_P2P_GROUP - P2P Group interface (will become either
1849 * WPA_IF_P2P_GO or WPA_IF_P2P_CLIENT, but the role is not yet known)
1850 */
7aad838c
NS
1851 WPA_IF_P2P_GROUP,
1852
1853 /**
1854 * WPA_IF_P2P_DEVICE - P2P Device interface is used to indentify the
1855 * abstracted P2P Device function in the driver
1856 */
5b78493f
MH
1857 WPA_IF_P2P_DEVICE,
1858
1859 /*
1860 * WPA_IF_MESH - Mesh interface
1861 */
1862 WPA_IF_MESH,
98342208
AK
1863
1864 /*
1865 * WPA_IF_TDLS - TDLS offchannel interface (used for pref freq only)
1866 */
1867 WPA_IF_TDLS,
1868
1869 /*
1870 * WPA_IF_IBSS - IBSS interface (used for pref freq only)
1871 */
1872 WPA_IF_IBSS,
c5121837
JM
1873};
1874
92f475b4 1875struct wpa_init_params {
4b24282a 1876 void *global_priv;
92f475b4
JM
1877 const u8 *bssid;
1878 const char *ifname;
0ecff8d7 1879 const char *driver_params;
92f475b4 1880 int use_pae_group_addr;
92f475b4
JM
1881 char **bridge;
1882 size_t num_bridge;
412036f5
JM
1883
1884 u8 *own_addr; /* buffer for writing own MAC address */
92f475b4
JM
1885};
1886
c5121837 1887
e3bd3912
JM
1888struct wpa_bss_params {
1889 /** Interface name (for multi-SSID/VLAN support) */
1890 const char *ifname;
1891 /** Whether IEEE 802.1X or WPA/WPA2 is enabled */
1892 int enabled;
af586419
JM
1893
1894 int wpa;
1895 int ieee802_1x;
1896 int wpa_group;
1897 int wpa_pairwise;
1898 int wpa_key_mgmt;
1899 int rsn_preauth;
a1ca0292 1900 enum mfp_options ieee80211w;
e3bd3912
JM
1901};
1902
0de39516
JM
1903#define WPA_STA_AUTHORIZED BIT(0)
1904#define WPA_STA_WMM BIT(1)
1905#define WPA_STA_SHORT_PREAMBLE BIT(2)
1906#define WPA_STA_MFP BIT(3)
45b722f1 1907#define WPA_STA_TDLS_PEER BIT(4)
7a228b5c 1908#define WPA_STA_AUTHENTICATED BIT(5)
dc55b6b6 1909#define WPA_STA_ASSOCIATED BIT(6)
e3bd3912 1910
281ff0aa
GP
1911enum tdls_oper {
1912 TDLS_DISCOVERY_REQ,
1913 TDLS_SETUP,
1914 TDLS_TEARDOWN,
1915 TDLS_ENABLE_LINK,
b8f64582
JM
1916 TDLS_DISABLE_LINK,
1917 TDLS_ENABLE,
1918 TDLS_DISABLE
281ff0aa
GP
1919};
1920
a884be9d
XC
1921enum wnm_oper {
1922 WNM_SLEEP_ENTER_CONFIRM,
1923 WNM_SLEEP_ENTER_FAIL,
1924 WNM_SLEEP_EXIT_CONFIRM,
1925 WNM_SLEEP_EXIT_FAIL,
1926 WNM_SLEEP_TFS_REQ_IE_ADD, /* STA requests driver to add TFS req IE */
1927 WNM_SLEEP_TFS_REQ_IE_NONE, /* STA requests empty TFS req IE */
1928 WNM_SLEEP_TFS_REQ_IE_SET, /* AP requests driver to set TFS req IE for
1929 * a STA */
1930 WNM_SLEEP_TFS_RESP_IE_ADD, /* AP requests driver to add TFS resp IE
1931 * for a STA */
1932 WNM_SLEEP_TFS_RESP_IE_NONE, /* AP requests empty TFS resp IE */
1933 WNM_SLEEP_TFS_RESP_IE_SET, /* AP requests driver to set TFS resp IE
1934 * for a STA */
1935 WNM_SLEEP_TFS_IE_DEL /* AP delete the TFS IE */
1936};
1937
e8ada160
T
1938/* enum smps_mode - SMPS mode definitions */
1939enum smps_mode {
1940 SMPS_AUTOMATIC,
1941 SMPS_OFF,
1942 SMPS_DYNAMIC,
1943 SMPS_STATIC,
1944
1945 /* Keep last */
1946 SMPS_INVALID,
1947};
1948
941807f6
EG
1949#define WPA_INVALID_NOISE 9999
1950
1c5c7273
PS
1951/**
1952 * struct wpa_signal_info - Information about channel signal quality
941807f6
EG
1953 * @frequency: control frequency
1954 * @above_threshold: true if the above threshold was crossed
1955 * (relevant for a CQM event)
1956 * @current_signal: in dBm
1957 * @avg_signal: in dBm
1958 * @avg_beacon_signal: in dBm
1959 * @current_noise: %WPA_INVALID_NOISE if not supported
1960 * @current_txrate: current TX rate
1961 * @chanwidth: channel width
1962 * @center_frq1: center frequency for the first segment
1963 * @center_frq2: center frequency for the second segment (if relevant)
1c5c7273
PS
1964 */
1965struct wpa_signal_info {
1966 u32 frequency;
1967 int above_threshold;
1968 int current_signal;
95783298 1969 int avg_signal;
74fa78b2 1970 int avg_beacon_signal;
1c5c7273
PS
1971 int current_noise;
1972 int current_txrate;
2cc8d8f4
AO
1973 enum chan_width chanwidth;
1974 int center_frq1;
1975 int center_frq2;
1c5c7273
PS
1976};
1977
7f00dc6e
MV
1978/**
1979 * struct wpa_channel_info - Information about the current channel
1980 * @frequency: Center frequency of the primary 20 MHz channel
1981 * @chanwidth: Width of the current operating channel
1982 * @sec_channel: Location of the secondary 20 MHz channel (either +1 or -1).
1983 * This field is only filled in when using a 40 MHz channel.
1984 * @center_frq1: Center frequency of frequency segment 0
1985 * @center_frq2: Center frequency of frequency segment 1 (for 80+80 channels)
1986 * @seg1_idx: Frequency segment 1 index when using a 80+80 channel. This is
1987 * derived from center_frq2 for convenience.
1988 */
1989struct wpa_channel_info {
1990 u32 frequency;
1991 enum chan_width chanwidth;
1992 int sec_channel;
1993 int center_frq1;
1994 int center_frq2;
1995 u8 seg1_idx;
1996};
1997
dcca2219
AO
1998/**
1999 * struct beacon_data - Beacon data
2000 * @head: Head portion of Beacon frame (before TIM IE)
2001 * @tail: Tail portion of Beacon frame (after TIM IE)
2002 * @beacon_ies: Extra information element(s) to add into Beacon frames or %NULL
2003 * @proberesp_ies: Extra information element(s) to add into Probe Response
2004 * frames or %NULL
2005 * @assocresp_ies: Extra information element(s) to add into (Re)Association
2006 * Response frames or %NULL
2007 * @probe_resp: Probe Response frame template
2008 * @head_len: Length of @head
2009 * @tail_len: Length of @tail
2010 * @beacon_ies_len: Length of beacon_ies in octets
2011 * @proberesp_ies_len: Length of proberesp_ies in octets
2012 * @proberesp_ies_len: Length of proberesp_ies in octets
2013 * @probe_resp_len: Length of probe response template (@probe_resp)
2014 */
2015struct beacon_data {
2016 u8 *head, *tail;
2017 u8 *beacon_ies;
2018 u8 *proberesp_ies;
2019 u8 *assocresp_ies;
2020 u8 *probe_resp;
2021
2022 size_t head_len, tail_len;
2023 size_t beacon_ies_len;
2024 size_t proberesp_ies_len;
2025 size_t assocresp_ies_len;
2026 size_t probe_resp_len;
2027};
2028
2029/**
2030 * struct csa_settings - Settings for channel switch command
2031 * @cs_count: Count in Beacon frames (TBTT) to perform the switch
2032 * @block_tx: 1 - block transmission for CSA period
2033 * @freq_params: Next channel frequency parameter
2034 * @beacon_csa: Beacon/probe resp/asooc resp info for CSA period
2035 * @beacon_after: Next beacon/probe resp/asooc resp info
2036 * @counter_offset_beacon: Offset to the count field in beacon's tail
2037 * @counter_offset_presp: Offset to the count field in probe resp.
2038 */
2039struct csa_settings {
2040 u8 cs_count;
2041 u8 block_tx;
2042
2043 struct hostapd_freq_params freq_params;
2044 struct beacon_data beacon_csa;
2045 struct beacon_data beacon_after;
2046
366179d2
AO
2047 u16 counter_offset_beacon[2];
2048 u16 counter_offset_presp[2];
dcca2219
AO
2049};
2050
96ecea5e
SD
2051/* TDLS peer capabilities for send_tdls_mgmt() */
2052enum tdls_peer_capability {
2053 TDLS_PEER_HT = BIT(0),
2054 TDLS_PEER_VHT = BIT(1),
2055 TDLS_PEER_WMM = BIT(2),
2056};
2057
0f14a44e
EP
2058/* valid info in the wmm_params struct */
2059enum wmm_params_valid_info {
2060 WMM_PARAMS_UAPSD_QUEUES_INFO = BIT(0),
2061};
2062
2063/**
2064 * struct wmm_params - WMM parameterss configured for this association
2065 * @info_bitmap: Bitmap of valid wmm_params info; indicates what fields
2066 * of the struct contain valid information.
2067 * @uapsd_queues: Bitmap of ACs configured for uapsd (valid only if
2068 * %WMM_PARAMS_UAPSD_QUEUES_INFO is set)
2069 */
2070struct wmm_params {
2071 u8 info_bitmap;
2072 u8 uapsd_queues;
2073};
2074
7baec808
HW
2075#ifdef CONFIG_MACSEC
2076struct macsec_init_params {
2077 Boolean always_include_sci;
2078 Boolean use_es;
2079 Boolean use_scb;
2080};
2081#endif /* CONFIG_MACSEC */
2082
73d2294f
KP
2083enum drv_br_port_attr {
2084 DRV_BR_PORT_ATTR_PROXYARP,
2085 DRV_BR_PORT_ATTR_HAIRPIN_MODE,
2086};
2087
7565752d
KP
2088enum drv_br_net_param {
2089 DRV_BR_NET_PARAM_GARP_ACCEPT,
60eb9e17 2090 DRV_BR_MULTICAST_SNOOPING,
7565752d
KP
2091};
2092
16689c7c
PX
2093struct drv_acs_params {
2094 /* Selected mode (HOSTAPD_MODE_*) */
2095 enum hostapd_hw_mode hw_mode;
2096
2097 /* Indicates whether HT is enabled */
2098 int ht_enabled;
2099
2100 /* Indicates whether HT40 is enabled */
2101 int ht40_enabled;
857d9422
MM
2102
2103 /* Indicates whether VHT is enabled */
2104 int vht_enabled;
2105
2106 /* Configured ACS channel width */
2107 u16 ch_width;
2108
2109 /* ACS channel list info */
2110 unsigned int ch_list_len;
2111 const u8 *ch_list;
d0cdccd3 2112 const int *freq_list;
16689c7c
PX
2113};
2114
3ab48492
KV
2115struct wpa_bss_trans_info {
2116 u8 mbo_transition_reason;
2117 u8 n_candidates;
2118 u8 *bssid;
2119};
2120
2121struct wpa_bss_candidate_info {
2122 u8 num;
2123 struct candidate_list {
2124 u8 bssid[ETH_ALEN];
2125 u8 is_accept;
2126 u32 reject_reason;
2127 } *candidates;
2128};
7baec808 2129
6fbb5414
VK
2130struct wpa_pmkid_params {
2131 const u8 *bssid;
061a3d3d
VK
2132 const u8 *ssid;
2133 size_t ssid_len;
2134 const u8 *fils_cache_id;
6fbb5414 2135 const u8 *pmkid;
061a3d3d
VK
2136 const u8 *pmk;
2137 size_t pmk_len;
6fbb5414
VK
2138};
2139
3c67e977
VK
2140/* Mask used to specify which connection parameters have to be updated */
2141enum wpa_drv_update_connect_params_mask {
2142 WPA_DRV_UPDATE_ASSOC_IES = BIT(0),
2143 WPA_DRV_UPDATE_FILS_ERP_INFO = BIT(1),
2144 WPA_DRV_UPDATE_AUTH_TYPE = BIT(2),
2145};
2146
ba71cb82
SD
2147/**
2148 * struct external_auth - External authentication trigger parameters
2149 *
2150 * These are used across the external authentication request and event
2151 * interfaces.
2152 * @action: Action type / trigger for external authentication. Only significant
2153 * for the event interface.
2154 * @bssid: BSSID of the peer with which the authentication has to happen. Used
2155 * by both the request and event interface.
2156 * @ssid: SSID of the AP. Used by both the request and event interface.
2157 * @ssid_len: SSID length in octets.
2158 * @key_mgmt_suite: AKM suite of the respective authentication. Optional for
2159 * the request interface.
2160 * @status: Status code, %WLAN_STATUS_SUCCESS for successful authentication,
2161 * use %WLAN_STATUS_UNSPECIFIED_FAILURE if wpa_supplicant cannot give
2162 * the real status code for failures. Used only for the request interface
2163 * from user space to the driver.
236e793e 2164 * @pmkid: Generated PMKID as part of external auth exchange (e.g., SAE).
ba71cb82
SD
2165 */
2166struct external_auth {
2167 enum {
2168 EXT_AUTH_START,
2169 EXT_AUTH_ABORT,
2170 } action;
dd1a8cef
JM
2171 const u8 *bssid;
2172 const u8 *ssid;
ba71cb82
SD
2173 size_t ssid_len;
2174 unsigned int key_mgmt_suite;
2175 u16 status;
236e793e 2176 const u8 *pmkid;
ba71cb82
SD
2177};
2178
6fc6879b
JM
2179/**
2180 * struct wpa_driver_ops - Driver interface API definition
2181 *
2182 * This structure defines the API that each driver interface needs to implement
2183 * for core wpa_supplicant code. All driver specific functionality is captured
2184 * in this wrapper.
2185 */
2186struct wpa_driver_ops {
2187 /** Name of the driver interface */
2188 const char *name;
2189 /** One line description of the driver interface */
2190 const char *desc;
2191
2192 /**
2193 * get_bssid - Get the current BSSID
2194 * @priv: private driver interface data
2195 * @bssid: buffer for BSSID (ETH_ALEN = 6 bytes)
2196 *
2197 * Returns: 0 on success, -1 on failure
2198 *
2199 * Query kernel driver for the current BSSID and copy it to bssid.
2200 * Setting bssid to 00:00:00:00:00:00 is recommended if the STA is not
2201 * associated.
2202 */
2203 int (*get_bssid)(void *priv, u8 *bssid);
2204
2205 /**
2206 * get_ssid - Get the current SSID
2207 * @priv: private driver interface data
2208 * @ssid: buffer for SSID (at least 32 bytes)
2209 *
2210 * Returns: Length of the SSID on success, -1 on failure
2211 *
2212 * Query kernel driver for the current SSID and copy it to ssid.
2213 * Returning zero is recommended if the STA is not associated.
2214 *
2215 * Note: SSID is an array of octets, i.e., it is not nul terminated and
2216 * can, at least in theory, contain control characters (including nul)
2217 * and as such, should be processed as binary data, not a printable
2218 * string.
2219 */
2220 int (*get_ssid)(void *priv, u8 *ssid);
2221
6fc6879b
JM
2222 /**
2223 * set_key - Configure encryption key
642187d6 2224 * @ifname: Interface name (for multi-SSID/VLAN support)
6fc6879b
JM
2225 * @priv: private driver interface data
2226 * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
eb7719ff 2227 * %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK,
30675c34
JM
2228 * %WPA_ALG_GCMP, %WPA_ALG_GCMP_256, %WPA_ALG_CCMP_256,
2229 * %WPA_ALG_BIP_GMAC_128, %WPA_ALG_BIP_GMAC_256,
2230 * %WPA_ALG_BIP_CMAC_256);
6fc6879b 2231 * %WPA_ALG_NONE clears the key.
0382097e
JM
2232 * @addr: Address of the peer STA (BSSID of the current AP when setting
2233 * pairwise key in station mode), ff:ff:ff:ff:ff:ff for
2234 * broadcast keys, %NULL for default keys that are used both for
2235 * broadcast and unicast; when clearing keys, %NULL is used to
2236 * indicate that both the broadcast-only and default key of the
2237 * specified key index is to be cleared
6fc6879b
JM
2238 * @key_idx: key index (0..3), usually 0 for unicast keys; 0..4095 for
2239 * IGTK
2240 * @set_tx: configure this key as the default Tx key (only used when
2241 * driver does not support separate unicast/individual key
2242 * @seq: sequence number/packet number, seq_len octets, the next
2243 * packet number to be used for in replay protection; configured
2244 * for Rx keys (in most cases, this is only used with broadcast
da64c266 2245 * keys and set to zero for unicast keys); %NULL if not set
6fc6879b 2246 * @seq_len: length of the seq, depends on the algorithm:
eb7719ff 2247 * TKIP: 6 octets, CCMP/GCMP: 6 octets, IGTK: 6 octets
6fc6879b
JM
2248 * @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key,
2249 * 8-byte Rx Mic Key
2250 * @key_len: length of the key buffer in octets (WEP: 5 or 13,
eb7719ff 2251 * TKIP: 32, CCMP/GCMP: 16, IGTK: 16)
6fc6879b
JM
2252 *
2253 * Returns: 0 on success, -1 on failure
2254 *
2255 * Configure the given key for the kernel driver. If the driver
2256 * supports separate individual keys (4 default keys + 1 individual),
2257 * addr can be used to determine whether the key is default or
2258 * individual. If only 4 keys are supported, the default key with key
2259 * index 0 is used as the individual key. STA must be configured to use
2260 * it as the default Tx key (set_tx is set) and accept Rx for all the
2261 * key indexes. In most cases, WPA uses only key indexes 1 and 2 for
2262 * broadcast keys, so key index 0 is available for this kind of
2263 * configuration.
2264 *
2265 * Please note that TKIP keys include separate TX and RX MIC keys and
2266 * some drivers may expect them in different order than wpa_supplicant
2267 * is using. If the TX/RX keys are swapped, all TKIP encrypted packets
61fbd3df 2268 * will trigger Michael MIC errors. This can be fixed by changing the
6fc6879b
JM
2269 * order of MIC keys by swapping te bytes 16..23 and 24..31 of the key
2270 * in driver_*.c set_key() implementation, see driver_ndis.c for an
2271 * example on how this can be done.
2272 */
71934751 2273 int (*set_key)(const char *ifname, void *priv, enum wpa_alg alg,
642187d6
JM
2274 const u8 *addr, int key_idx, int set_tx,
2275 const u8 *seq, size_t seq_len,
6fc6879b
JM
2276 const u8 *key, size_t key_len);
2277
2278 /**
2279 * init - Initialize driver interface
2280 * @ctx: context to be used when calling wpa_supplicant functions,
2281 * e.g., wpa_supplicant_event()
2282 * @ifname: interface name, e.g., wlan0
2283 *
2284 * Returns: Pointer to private data, %NULL on failure
2285 *
2286 * Initialize driver interface, including event processing for kernel
2287 * driver events (e.g., associated, scan results, Michael MIC failure).
2288 * This function can allocate a private configuration data area for
2289 * @ctx, file descriptor, interface name, etc. information that may be
2290 * needed in future driver operations. If this is not used, non-NULL
2291 * value will need to be returned because %NULL is used to indicate
2292 * failure. The returned value will be used as 'void *priv' data for
2293 * all other driver_ops functions.
2294 *
2295 * The main event loop (eloop.c) of wpa_supplicant can be used to
2296 * register callback for read sockets (eloop_register_read_sock()).
2297 *
2298 * See below for more information about events and
2299 * wpa_supplicant_event() function.
2300 */
2301 void * (*init)(void *ctx, const char *ifname);
2302
2303 /**
2304 * deinit - Deinitialize driver interface
2305 * @priv: private driver interface data from init()
2306 *
2307 * Shut down driver interface and processing of driver events. Free
2308 * private data buffer if one was allocated in init() handler.
2309 */
2310 void (*deinit)(void *priv);
2311
2312 /**
2313 * set_param - Set driver configuration parameters
2314 * @priv: private driver interface data from init()
2315 * @param: driver specific configuration parameters
2316 *
2317 * Returns: 0 on success, -1 on failure
2318 *
2319 * Optional handler for notifying driver interface about configuration
2320 * parameters (driver_param).
2321 */
2322 int (*set_param)(void *priv, const char *param);
2323
2324 /**
2325 * set_countermeasures - Enable/disable TKIP countermeasures
2326 * @priv: private driver interface data
2327 * @enabled: 1 = countermeasures enabled, 0 = disabled
2328 *
2329 * Returns: 0 on success, -1 on failure
2330 *
2331 * Configure TKIP countermeasures. When these are enabled, the driver
2332 * should drop all received and queued frames that are using TKIP.
2333 */
2334 int (*set_countermeasures)(void *priv, int enabled);
2335
6fc6879b
JM
2336 /**
2337 * deauthenticate - Request driver to deauthenticate
2338 * @priv: private driver interface data
2339 * @addr: peer address (BSSID of the AP)
2340 * @reason_code: 16-bit reason code to be sent in the deauthentication
2341 * frame
2342 *
2343 * Returns: 0 on success, -1 on failure
2344 */
4be17ffb 2345 int (*deauthenticate)(void *priv, const u8 *addr, u16 reason_code);
6fc6879b 2346
6fc6879b
JM
2347 /**
2348 * associate - Request driver to associate
2349 * @priv: private driver interface data
2350 * @params: association parameters
2351 *
2352 * Returns: 0 on success, -1 on failure
2353 */
2354 int (*associate)(void *priv,
2355 struct wpa_driver_associate_params *params);
2356
6fc6879b
JM
2357 /**
2358 * add_pmkid - Add PMKSA cache entry to the driver
2359 * @priv: private driver interface data
6fbb5414 2360 * @params: PMKSA parameters
6fc6879b
JM
2361 *
2362 * Returns: 0 on success, -1 on failure
2363 *
2364 * This function is called when a new PMK is received, as a result of
061a3d3d
VK
2365 * either normal authentication or RSN pre-authentication. The PMKSA
2366 * parameters are either a set of bssid, pmkid, and pmk; or a set of
2367 * ssid, fils_cache_id, pmkid, and pmk.
6fc6879b
JM
2368 *
2369 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
2370 * associate(), add_pmkid() can be used to add new PMKSA cache entries
2371 * in the driver. If the driver uses wpa_ie from wpa_supplicant, this
2372 * driver_ops function does not need to be implemented. Likewise, if
2373 * the driver does not support WPA, this function is not needed.
2374 */
6fbb5414 2375 int (*add_pmkid)(void *priv, struct wpa_pmkid_params *params);
6fc6879b
JM
2376
2377 /**
2378 * remove_pmkid - Remove PMKSA cache entry to the driver
2379 * @priv: private driver interface data
6fbb5414 2380 * @params: PMKSA parameters
6fc6879b
JM
2381 *
2382 * Returns: 0 on success, -1 on failure
2383 *
2384 * This function is called when the supplicant drops a PMKSA cache
061a3d3d
VK
2385 * entry for any reason. The PMKSA parameters are either a set of
2386 * bssid and pmkid; or a set of ssid, fils_cache_id, and pmkid.
6fc6879b
JM
2387 *
2388 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
2389 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
2390 * between the driver and wpa_supplicant. If the driver uses wpa_ie
2391 * from wpa_supplicant, this driver_ops function does not need to be
2392 * implemented. Likewise, if the driver does not support WPA, this
2393 * function is not needed.
2394 */
6fbb5414 2395 int (*remove_pmkid)(void *priv, struct wpa_pmkid_params *params);
6fc6879b
JM
2396
2397 /**
2398 * flush_pmkid - Flush PMKSA cache
2399 * @priv: private driver interface data
2400 *
2401 * Returns: 0 on success, -1 on failure
2402 *
2403 * This function is called when the supplicant drops all PMKSA cache
2404 * entries for any reason.
2405 *
2406 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
2407 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
2408 * between the driver and wpa_supplicant. If the driver uses wpa_ie
2409 * from wpa_supplicant, this driver_ops function does not need to be
2410 * implemented. Likewise, if the driver does not support WPA, this
2411 * function is not needed.
2412 */
2413 int (*flush_pmkid)(void *priv);
2414
2415 /**
6179d2fd 2416 * get_capa - Get driver capabilities
6fc6879b
JM
2417 * @priv: private driver interface data
2418 *
2419 * Returns: 0 on success, -1 on failure
2420 *
2421 * Get driver/firmware/hardware capabilities.
2422 */
2423 int (*get_capa)(void *priv, struct wpa_driver_capa *capa);
2424
2425 /**
2426 * poll - Poll driver for association information
2427 * @priv: private driver interface data
2428 *
2429 * This is an option callback that can be used when the driver does not
2430 * provide event mechanism for association events. This is called when
2431 * receiving WPA EAPOL-Key messages that require association
2432 * information. The driver interface is supposed to generate associnfo
2433 * event before returning from this callback function. In addition, the
2434 * driver interface should generate an association event after having
2435 * sent out associnfo.
2436 */
2437 void (*poll)(void *priv);
2438
45e3fc72
RM
2439 /**
2440 * get_ifindex - Get interface index
2441 * @priv: private driver interface data
2442 *
2443 * Returns: Interface index
2444 */
2445 unsigned int (*get_ifindex)(void *priv);
2446
6fc6879b
JM
2447 /**
2448 * get_ifname - Get interface name
2449 * @priv: private driver interface data
2450 *
2451 * Returns: Pointer to the interface name. This can differ from the
e519314e 2452 * interface name used in init() call. Init() is called first.
6fc6879b
JM
2453 *
2454 * This optional function can be used to allow the driver interface to
2455 * replace the interface name with something else, e.g., based on an
2456 * interface mapping from a more descriptive name.
2457 */
2458 const char * (*get_ifname)(void *priv);
2459
2460 /**
2461 * get_mac_addr - Get own MAC address
2462 * @priv: private driver interface data
2463 *
2464 * Returns: Pointer to own MAC address or %NULL on failure
2465 *
2466 * This optional function can be used to get the own MAC address of the
2467 * device from the driver interface code. This is only needed if the
2468 * l2_packet implementation for the OS does not provide easy access to
2469 * a MAC address. */
2470 const u8 * (*get_mac_addr)(void *priv);
2471
6fc6879b
JM
2472 /**
2473 * set_operstate - Sets device operating state to DORMANT or UP
2474 * @priv: private driver interface data
2475 * @state: 0 = dormant, 1 = up
2476 * Returns: 0 on success, -1 on failure
2477 *
2478 * This is an optional function that can be used on operating systems
2479 * that support a concept of controlling network device state from user
2480 * space applications. This function, if set, gets called with
2481 * state = 1 when authentication has been completed and with state = 0
2482 * when connection is lost.
2483 */
2484 int (*set_operstate)(void *priv, int state);
2485
2486 /**
2487 * mlme_setprotection - MLME-SETPROTECTION.request primitive
2488 * @priv: Private driver interface data
2489 * @addr: Address of the station for which to set protection (may be
2490 * %NULL for group keys)
2491 * @protect_type: MLME_SETPROTECTION_PROTECT_TYPE_*
2492 * @key_type: MLME_SETPROTECTION_KEY_TYPE_*
2493 * Returns: 0 on success, -1 on failure
2494 *
2495 * This is an optional function that can be used to set the driver to
2496 * require protection for Tx and/or Rx frames. This uses the layer
2497 * interface defined in IEEE 802.11i-2004 clause 10.3.22.1
2498 * (MLME-SETPROTECTION.request). Many drivers do not use explicit
2499 * set protection operation; instead, they set protection implicitly
2500 * based on configured keys.
2501 */
2502 int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type,
2503 int key_type);
2504
2505 /**
2506 * get_hw_feature_data - Get hardware support data (channels and rates)
2507 * @priv: Private driver interface data
2508 * @num_modes: Variable for returning the number of returned modes
2509 * flags: Variable for returning hardware feature flags
aa56e36d 2510 * @dfs: Variable for returning DFS region (HOSTAPD_DFS_REGION_*)
6fc6879b
JM
2511 * Returns: Pointer to allocated hardware data on success or %NULL on
2512 * failure. Caller is responsible for freeing this.
6fc6879b 2513 */
6caf9ca6
JM
2514 struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
2515 u16 *num_modes,
aa56e36d 2516 u16 *flags, u8 *dfs);
6fc6879b 2517
6fc6879b
JM
2518 /**
2519 * send_mlme - Send management frame from MLME
2520 * @priv: Private driver interface data
2521 * @data: IEEE 802.11 management frame with IEEE 802.11 header
2522 * @data_len: Size of the management frame
8cfa3527 2523 * @noack: Do not wait for this frame to be acked (disable retries)
5d180a77
AO
2524 * @freq: Frequency (in MHz) to send the frame on, or 0 to let the
2525 * driver decide
2d3943ce
AO
2526 * @csa_offs: Array of CSA offsets or %NULL
2527 * @csa_offs_len: Number of elements in csa_offs
6fc6879b 2528 * Returns: 0 on success, -1 on failure
6fc6879b 2529 */
8cfa3527 2530 int (*send_mlme)(void *priv, const u8 *data, size_t data_len,
2d3943ce
AO
2531 int noack, unsigned int freq, const u16 *csa_offs,
2532 size_t csa_offs_len);
6fc6879b 2533
6fc6879b
JM
2534 /**
2535 * update_ft_ies - Update FT (IEEE 802.11r) IEs
2536 * @priv: Private driver interface data
2537 * @md: Mobility domain (2 octets) (also included inside ies)
2538 * @ies: FT IEs (MDIE, FTIE, ...) or %NULL to remove IEs
2539 * @ies_len: Length of FT IEs in bytes
2540 * Returns: 0 on success, -1 on failure
2541 *
2542 * The supplicant uses this callback to let the driver know that keying
2543 * material for FT is available and that the driver can use the
2544 * provided IEs in the next message in FT authentication sequence.
2545 *
2546 * This function is only needed for driver that support IEEE 802.11r
2547 * (Fast BSS Transition).
2548 */
2549 int (*update_ft_ies)(void *priv, const u8 *md, const u8 *ies,
2550 size_t ies_len);
2551
6fc6879b
JM
2552 /**
2553 * get_scan_results2 - Fetch the latest scan results
2554 * @priv: private driver interface data
2555 *
2556 * Returns: Allocated buffer of scan results (caller is responsible for
2557 * freeing the data structure) on success, NULL on failure
2558 */
2559 struct wpa_scan_results * (*get_scan_results2)(void *priv);
2560
6d158490
LR
2561 /**
2562 * set_country - Set country
2563 * @priv: Private driver interface data
2564 * @alpha2: country to which to switch to
2565 * Returns: 0 on success, -1 on failure
2566 *
2567 * This function is for drivers which support some form
2568 * of setting a regulatory domain.
2569 */
2570 int (*set_country)(void *priv, const char *alpha2);
ac305589 2571
f0793bf1
JM
2572 /**
2573 * get_country - Get country
2574 * @priv: Private driver interface data
2575 * @alpha2: Buffer for returning country code (at least 3 octets)
2576 * Returns: 0 on success, -1 on failure
2577 */
2578 int (*get_country)(void *priv, char *alpha2);
2579
ac305589
JM
2580 /**
2581 * global_init - Global driver initialization
45e3fc72 2582 * @ctx: wpa_global pointer
ac305589
JM
2583 * Returns: Pointer to private data (global), %NULL on failure
2584 *
2585 * This optional function is called to initialize the driver wrapper
2586 * for global data, i.e., data that applies to all interfaces. If this
2587 * function is implemented, global_deinit() will also need to be
2588 * implemented to free the private data. The driver will also likely
2589 * use init2() function instead of init() to get the pointer to global
2590 * data available to per-interface initializer.
2591 */
45e3fc72 2592 void * (*global_init)(void *ctx);
ac305589
JM
2593
2594 /**
2595 * global_deinit - Global driver deinitialization
2596 * @priv: private driver global data from global_init()
2597 *
2598 * Terminate any global driver related functionality and free the
2599 * global data structure.
2600 */
2601 void (*global_deinit)(void *priv);
2602
2603 /**
2604 * init2 - Initialize driver interface (with global data)
2605 * @ctx: context to be used when calling wpa_supplicant functions,
2606 * e.g., wpa_supplicant_event()
2607 * @ifname: interface name, e.g., wlan0
2608 * @global_priv: private driver global data from global_init()
2609 * Returns: Pointer to private data, %NULL on failure
2610 *
2611 * This function can be used instead of init() if the driver wrapper
2612 * uses global data.
2613 */
2614 void * (*init2)(void *ctx, const char *ifname, void *global_priv);
4b4a8ae5
JM
2615
2616 /**
2617 * get_interfaces - Get information about available interfaces
2618 * @global_priv: private driver global data from global_init()
2619 * Returns: Allocated buffer of interface information (caller is
2620 * responsible for freeing the data structure) on success, NULL on
2621 * failure
2622 */
2623 struct wpa_interface_info * (*get_interfaces)(void *global_priv);
fc2b7ed5
JM
2624
2625 /**
2626 * scan2 - Request the driver to initiate scan
2627 * @priv: private driver interface data
2628 * @params: Scan parameters
2629 *
2630 * Returns: 0 on success, -1 on failure
2631 *
2632 * Once the scan results are ready, the driver should report scan
2633 * results event for wpa_supplicant which will eventually request the
2634 * results with wpa_driver_get_scan_results2().
2635 */
2636 int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
c2a04078
JM
2637
2638 /**
2639 * authenticate - Request driver to authenticate
2640 * @priv: private driver interface data
2641 * @params: authentication parameters
2642 * Returns: 0 on success, -1 on failure
2643 *
2644 * This is an optional function that can be used with drivers that
2645 * support separate authentication and association steps, i.e., when
2646 * wpa_supplicant can act as the SME. If not implemented, associate()
2647 * function is expected to take care of IEEE 802.11 authentication,
2648 * too.
2649 */
d2440ba0
JM
2650 int (*authenticate)(void *priv,
2651 struct wpa_driver_auth_params *params);
2652
15333707 2653 /**
19c3b566 2654 * set_ap - Set Beacon and Probe Response information for AP mode
15333707 2655 * @priv: Private driver interface data
19c3b566 2656 * @params: Parameters to use in AP mode
15333707 2657 *
19c3b566
JM
2658 * This function is used to configure Beacon template and/or extra IEs
2659 * to add for Beacon and Probe Response frames for the driver in
15333707
JM
2660 * AP mode. The driver is responsible for building the full Beacon
2661 * frame by concatenating the head part with TIM IE generated by the
19c3b566
JM
2662 * driver/firmware and finishing with the tail part. Depending on the
2663 * driver architectue, this can be done either by using the full
2664 * template or the set of additional IEs (e.g., WPS and P2P IE).
2665 * Similarly, Probe Response processing depends on the driver design.
2666 * If the driver (or firmware) takes care of replying to Probe Request
2667 * frames, the extra IEs provided here needs to be added to the Probe
2668 * Response frames.
2669 *
2670 * Returns: 0 on success, -1 on failure
15333707 2671 */
19c3b566 2672 int (*set_ap)(void *priv, struct wpa_driver_ap_params *params);
c5121837 2673
3c4ca363
VN
2674 /**
2675 * set_acl - Set ACL in AP mode
2676 * @priv: Private driver interface data
2677 * @params: Parameters to configure ACL
2678 * Returns: 0 on success, -1 on failure
2679 *
2680 * This is used only for the drivers which support MAC address ACL.
2681 */
2682 int (*set_acl)(void *priv, struct hostapd_acl_params *params);
2683
15333707
JM
2684 /**
2685 * hapd_init - Initialize driver interface (hostapd only)
2686 * @hapd: Pointer to hostapd context
2687 * @params: Configuration for the driver wrapper
2688 * Returns: Pointer to private data, %NULL on failure
2689 *
2690 * This function is used instead of init() or init2() when the driver
ffbf1eaa 2691 * wrapper is used with hostapd.
15333707 2692 */
92f475b4
JM
2693 void * (*hapd_init)(struct hostapd_data *hapd,
2694 struct wpa_init_params *params);
15333707
JM
2695
2696 /**
2697 * hapd_deinit - Deinitialize driver interface (hostapd only)
2698 * @priv: Private driver interface data from hapd_init()
2699 */
c5121837
JM
2700 void (*hapd_deinit)(void *priv);
2701
2702 /**
15333707 2703 * set_ieee8021x - Enable/disable IEEE 802.1X support (AP only)
15333707 2704 * @priv: Private driver interface data
e3bd3912 2705 * @params: BSS parameters
c5121837
JM
2706 * Returns: 0 on success, -1 on failure
2707 *
15333707 2708 * This is an optional function to configure the kernel driver to
e3bd3912
JM
2709 * enable/disable IEEE 802.1X support and set WPA/WPA2 parameters. This
2710 * can be left undefined (set to %NULL) if IEEE 802.1X support is
dcd1eb5b 2711 * always enabled and the driver uses set_ap() to set WPA/RSN IE
e3bd3912 2712 * for Beacon frames.
062390ef
JM
2713 *
2714 * DEPRECATED - use set_ap() instead
c5121837 2715 */
e3bd3912 2716 int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
c5121837
JM
2717
2718 /**
15333707
JM
2719 * set_privacy - Enable/disable privacy (AP only)
2720 * @priv: Private driver interface data
c5121837 2721 * @enabled: 1 = privacy enabled, 0 = disabled
15333707 2722 * Returns: 0 on success, -1 on failure
c5121837 2723 *
15333707
JM
2724 * This is an optional function to configure privacy field in the
2725 * kernel driver for Beacon frames. This can be left undefined (set to
dcd1eb5b 2726 * %NULL) if the driver uses the Beacon template from set_ap().
062390ef
JM
2727 *
2728 * DEPRECATED - use set_ap() instead
c5121837 2729 */
d5dd016a 2730 int (*set_privacy)(void *priv, int enabled);
c5121837 2731
15333707
JM
2732 /**
2733 * get_seqnum - Fetch the current TSC/packet number (AP only)
2734 * @ifname: The interface name (main or virtual)
2735 * @priv: Private driver interface data
2736 * @addr: MAC address of the station or %NULL for group keys
2737 * @idx: Key index
2738 * @seq: Buffer for returning the latest used TSC/packet number
2739 * Returns: 0 on success, -1 on failure
2740 *
2741 * This function is used to fetch the last used TSC/packet number for
eb7719ff
JM
2742 * a TKIP, CCMP, GCMP, or BIP/IGTK key. It is mainly used with group
2743 * keys, so there is no strict requirement on implementing support for
2744 * unicast keys (i.e., addr != %NULL).
15333707 2745 */
c5121837
JM
2746 int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
2747 int idx, u8 *seq);
15333707 2748
15333707
JM
2749 /**
2750 * flush - Flush all association stations (AP only)
2751 * @priv: Private driver interface data
2752 * Returns: 0 on success, -1 on failure
2753 *
2754 * This function requests the driver to disassociate all associated
2755 * stations. This function does not need to be implemented if the
2756 * driver does not process association frames internally.
2757 */
c5121837 2758 int (*flush)(void *priv);
15333707
JM
2759
2760 /**
2761 * set_generic_elem - Add IEs into Beacon/Probe Response frames (AP)
15333707
JM
2762 * @priv: Private driver interface data
2763 * @elem: Information elements
2764 * @elem_len: Length of the elem buffer in octets
2765 * Returns: 0 on success, -1 on failure
2766 *
2767 * This is an optional function to add information elements in the
2768 * kernel driver for Beacon and Probe Response frames. This can be left
2769 * undefined (set to %NULL) if the driver uses the Beacon template from
dcd1eb5b 2770 * set_ap().
062390ef
JM
2771 *
2772 * DEPRECATED - use set_ap() instead
15333707 2773 */
aa484516 2774 int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len);
c5121837 2775
15333707 2776 /**
d732463c 2777 * read_sta_data - Fetch station data
15333707
JM
2778 * @priv: Private driver interface data
2779 * @data: Buffer for returning station information
2780 * @addr: MAC address of the station
2781 * Returns: 0 on success, -1 on failure
2782 */
c5121837
JM
2783 int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
2784 const u8 *addr);
15333707
JM
2785
2786 /**
2787 * hapd_send_eapol - Send an EAPOL packet (AP only)
2788 * @priv: private driver interface data
2789 * @addr: Destination MAC address
2790 * @data: EAPOL packet starting with IEEE 802.1X header
2791 * @data_len: Length of the EAPOL packet in octets
2792 * @encrypt: Whether the frame should be encrypted
2793 * @own_addr: Source MAC address
4378fc14 2794 * @flags: WPA_STA_* flags for the destination station
15333707
JM
2795 *
2796 * Returns: 0 on success, -1 on failure
2797 */
c5121837
JM
2798 int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
2799 size_t data_len, int encrypt,
4378fc14 2800 const u8 *own_addr, u32 flags);
15333707 2801
90b8c4c5
JM
2802 /**
2803 * sta_deauth - Deauthenticate a station (AP only)
2804 * @priv: Private driver interface data
2805 * @own_addr: Source address and BSSID for the Deauthentication frame
2806 * @addr: MAC address of the station to deauthenticate
2807 * @reason: Reason code for the Deauthentiation frame
2808 * Returns: 0 on success, -1 on failure
2809 *
2810 * This function requests a specific station to be deauthenticated and
2811 * a Deauthentication frame to be sent to it.
2812 */
731723a5 2813 int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
4be17ffb 2814 u16 reason);
90b8c4c5
JM
2815
2816 /**
2817 * sta_disassoc - Disassociate a station (AP only)
2818 * @priv: Private driver interface data
2819 * @own_addr: Source address and BSSID for the Disassociation frame
2820 * @addr: MAC address of the station to disassociate
2821 * @reason: Reason code for the Disassociation frame
2822 * Returns: 0 on success, -1 on failure
2823 *
2824 * This function requests a specific station to be disassociated and
2825 * a Disassociation frame to be sent to it.
2826 */
731723a5 2827 int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
4be17ffb 2828 u16 reason);
90b8c4c5
JM
2829
2830 /**
2831 * sta_remove - Remove a station entry (AP only)
2832 * @priv: Private driver interface data
2833 * @addr: MAC address of the station to be removed
2834 * Returns: 0 on success, -1 on failure
2835 */
c5121837 2836 int (*sta_remove)(void *priv, const u8 *addr);
90b8c4c5
JM
2837
2838 /**
2839 * hapd_get_ssid - Get the current SSID (AP only)
90b8c4c5
JM
2840 * @priv: Private driver interface data
2841 * @buf: Buffer for returning the SSID
2842 * @len: Maximum length of the buffer
2843 * Returns: Length of the SSID on success, -1 on failure
2844 *
2845 * This function need not be implemented if the driver uses Beacon
dcd1eb5b 2846 * template from set_ap() and does not reply to Probe Request frames.
90b8c4c5 2847 */
8709de1a 2848 int (*hapd_get_ssid)(void *priv, u8 *buf, int len);
90b8c4c5
JM
2849
2850 /**
2851 * hapd_set_ssid - Set SSID (AP only)
90b8c4c5
JM
2852 * @priv: Private driver interface data
2853 * @buf: SSID
2854 * @len: Length of the SSID in octets
2855 * Returns: 0 on success, -1 on failure
062390ef
JM
2856 *
2857 * DEPRECATED - use set_ap() instead
90b8c4c5 2858 */
8709de1a
JM
2859 int (*hapd_set_ssid)(void *priv, const u8 *buf, int len);
2860
90b8c4c5
JM
2861 /**
2862 * hapd_set_countermeasures - Enable/disable TKIP countermeasures (AP)
2863 * @priv: Private driver interface data
2864 * @enabled: 1 = countermeasures enabled, 0 = disabled
2865 * Returns: 0 on success, -1 on failure
2866 *
2867 * This need not be implemented if the driver does not take care of
2868 * association processing.
2869 */
c5121837 2870 int (*hapd_set_countermeasures)(void *priv, int enabled);
90b8c4c5
JM
2871
2872 /**
2873 * sta_add - Add a station entry
90b8c4c5
JM
2874 * @priv: Private driver interface data
2875 * @params: Station parameters
2876 * Returns: 0 on success, -1 on failure
2877 *
dc55b6b6
AB
2878 * This function is used to add or set (params->set 1) a station
2879 * entry in the driver. Adding STA entries is used only if the driver
90b8c4c5 2880 * does not take care of association processing.
45b722f1 2881 *
dc55b6b6
AB
2882 * With drivers that don't support full AP client state, this function
2883 * is used to add a station entry to the driver once the station has
2884 * completed association.
2885 *
2886 * With TDLS, this function is used to add or set (params->set 1)
2887 * TDLS peer entries (even with drivers that do not support full AP
2888 * client state).
90b8c4c5 2889 */
62847751 2890 int (*sta_add)(void *priv, struct hostapd_sta_add_params *params);
90b8c4c5
JM
2891
2892 /**
2893 * get_inact_sec - Get station inactivity duration (AP only)
2894 * @priv: Private driver interface data
2895 * @addr: Station address
2896 * Returns: Number of seconds station has been inactive, -1 on failure
2897 */
c5121837 2898 int (*get_inact_sec)(void *priv, const u8 *addr);
90b8c4c5
JM
2899
2900 /**
2901 * sta_clear_stats - Clear station statistics (AP only)
2902 * @priv: Private driver interface data
2903 * @addr: Station address
2904 * Returns: 0 on success, -1 on failure
2905 */
c5121837
JM
2906 int (*sta_clear_stats)(void *priv, const u8 *addr);
2907
90b8c4c5
JM
2908 /**
2909 * set_freq - Set channel/frequency (AP only)
2910 * @priv: Private driver interface data
2911 * @freq: Channel parameters
2912 * Returns: 0 on success, -1 on failure
2913 */
c5121837 2914 int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
90b8c4c5
JM
2915
2916 /**
2917 * set_rts - Set RTS threshold
2918 * @priv: Private driver interface data
2919 * @rts: RTS threshold in octets
2920 * Returns: 0 on success, -1 on failure
2921 */
c5121837 2922 int (*set_rts)(void *priv, int rts);
90b8c4c5
JM
2923
2924 /**
2925 * set_frag - Set fragmentation threshold
2926 * @priv: Private driver interface data
2927 * @frag: Fragmentation threshold in octets
2928 * Returns: 0 on success, -1 on failure
2929 */
c5121837 2930 int (*set_frag)(void *priv, int frag);
c5121837 2931
90b8c4c5
JM
2932 /**
2933 * sta_set_flags - Set station flags (AP only)
2934 * @priv: Private driver interface data
2935 * @addr: Station address
0de39516
JM
2936 * @total_flags: Bitmap of all WPA_STA_* flags currently set
2937 * @flags_or: Bitmap of WPA_STA_* flags to add
2938 * @flags_and: Bitmap of WPA_STA_* flags to us as a mask
90b8c4c5
JM
2939 * Returns: 0 on success, -1 on failure
2940 */
3234cba4 2941 int (*sta_set_flags)(void *priv, const u8 *addr,
f97e3ce4
JM
2942 unsigned int total_flags, unsigned int flags_or,
2943 unsigned int flags_and);
90b8c4c5 2944
90b8c4c5
JM
2945 /**
2946 * set_tx_queue_params - Set TX queue parameters
2947 * @priv: Private driver interface data
7e3c1781 2948 * @queue: Queue number (0 = VO, 1 = VI, 2 = BE, 3 = BK)
90b8c4c5
JM
2949 * @aifs: AIFS
2950 * @cw_min: cwMin
2951 * @cw_max: cwMax
2952 * @burst_time: Maximum length for bursting in 0.1 msec units
2953 */
c5121837
JM
2954 int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
2955 int cw_max, int burst_time);
90b8c4c5 2956
22a7c9d7
JM
2957 /**
2958 * if_add - Add a virtual interface
15333707 2959 * @priv: Private driver interface data
22a7c9d7
JM
2960 * @type: Interface type
2961 * @ifname: Interface name for the new virtual interface
2962 * @addr: Local address to use for the interface or %NULL to use the
2963 * parent interface address
8043e725 2964 * @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces
a2e40bb6
FF
2965 * @drv_priv: Pointer for overwriting the driver context or %NULL if
2966 * not allowed (applies only to %WPA_IF_AP_BSS type)
f3585c8a
JM
2967 * @force_ifname: Buffer for returning an interface name that the
2968 * driver ended up using if it differs from the requested ifname
2969 * @if_addr: Buffer for returning the allocated interface address
2970 * (this may differ from the requested addr if the driver cannot
2971 * change interface address)
e17a2477 2972 * @bridge: Bridge interface to use or %NULL if no bridge configured
2aec4f3c 2973 * @use_existing: Whether to allow existing interface to be used
d8a3b66d 2974 * @setup_ap: Whether to setup AP for %WPA_IF_AP_BSS interfaces
22a7c9d7
JM
2975 * Returns: 0 on success, -1 on failure
2976 */
7ab68865
JM
2977 int (*if_add)(void *priv, enum wpa_driver_if_type type,
2978 const char *ifname, const u8 *addr, void *bss_ctx,
e17a2477 2979 void **drv_priv, char *force_ifname, u8 *if_addr,
d8a3b66d 2980 const char *bridge, int use_existing, int setup_ap);
22a7c9d7
JM
2981
2982 /**
2983 * if_remove - Remove a virtual interface
2984 * @priv: Private driver interface data
2985 * @type: Interface type
2986 * @ifname: Interface name of the virtual interface to be removed
2987 * Returns: 0 on success, -1 on failure
2988 */
2989 int (*if_remove)(void *priv, enum wpa_driver_if_type type,
2990 const char *ifname);
90b8c4c5 2991
15333707
JM
2992 /**
2993 * set_sta_vlan - Bind a station into a specific interface (AP only)
2994 * @priv: Private driver interface data
2995 * @ifname: Interface (main or virtual BSS or VLAN)
2996 * @addr: MAC address of the associated station
2997 * @vlan_id: VLAN ID
2998 * Returns: 0 on success, -1 on failure
2999 *
3000 * This function is used to bind a station to a specific virtual
3001 * interface. It is only used if when virtual interfaces are supported,
3002 * e.g., to assign stations to different VLAN interfaces based on
3003 * information from a RADIUS server. This allows separate broadcast
3004 * domains to be used with a single BSS.
3005 */
c5121837
JM
3006 int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
3007 int vlan_id);
15333707 3008
c5121837 3009 /**
15333707 3010 * commit - Optional commit changes handler (AP only)
c5121837
JM
3011 * @priv: driver private data
3012 * Returns: 0 on success, -1 on failure
3013 *
3014 * This optional handler function can be registered if the driver
3015 * interface implementation needs to commit changes (e.g., by setting
3016 * network interface up) at the end of initial configuration. If set,
3017 * this handler will be called after initial setup has been completed.
3018 */
3019 int (*commit)(void *priv);
3020
90b8c4c5
JM
3021 /**
3022 * send_ether - Send an ethernet packet (AP only)
3023 * @priv: private driver interface data
3024 * @dst: Destination MAC address
3025 * @src: Source MAC address
3026 * @proto: Ethertype
3027 * @data: EAPOL packet starting with IEEE 802.1X header
3028 * @data_len: Length of the EAPOL packet in octets
3029 * Returns: 0 on success, -1 on failure
3030 */
c5121837
JM
3031 int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto,
3032 const u8 *data, size_t data_len);
3033
90b8c4c5
JM
3034 /**
3035 * set_radius_acl_auth - Notification of RADIUS ACL change
3036 * @priv: Private driver interface data
3037 * @mac: MAC address of the station
3038 * @accepted: Whether the station was accepted
3039 * @session_timeout: Session timeout for the station
3040 * Returns: 0 on success, -1 on failure
3041 */
0e80ea2c 3042 int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted,
c5121837 3043 u32 session_timeout);
90b8c4c5
JM
3044
3045 /**
3046 * set_radius_acl_expire - Notification of RADIUS ACL expiration
3047 * @priv: Private driver interface data
3048 * @mac: MAC address of the station
3049 * Returns: 0 on success, -1 on failure
3050 */
c5121837
JM
3051 int (*set_radius_acl_expire)(void *priv, const u8 *mac);
3052
15333707 3053 /**
b3db190f 3054 * set_ap_wps_ie - Add WPS IE(s) into Beacon/Probe Response frames (AP)
15333707 3055 * @priv: Private driver interface data
b3db190f
JM
3056 * @beacon: WPS IE(s) for Beacon frames or %NULL to remove extra IE(s)
3057 * @proberesp: WPS IE(s) for Probe Response frames or %NULL to remove
3058 * extra IE(s)
0e2e565a
JM
3059 * @assocresp: WPS IE(s) for (Re)Association Response frames or %NULL
3060 * to remove extra IE(s)
15333707
JM
3061 * Returns: 0 on success, -1 on failure
3062 *
3063 * This is an optional function to add WPS IE in the kernel driver for
14f79386 3064 * Beacon and Probe Response frames. This can be left undefined (set
dcd1eb5b 3065 * to %NULL) if the driver uses the Beacon template from set_ap()
0e2e565a
JM
3066 * and does not process Probe Request frames. If the driver takes care
3067 * of (Re)Association frame processing, the assocresp buffer includes
3068 * WPS IE(s) that need to be added to (Re)Association Response frames
3069 * whenever a (Re)Association Request frame indicated use of WPS.
75bde05d
JM
3070 *
3071 * This will also be used to add P2P IE(s) into Beacon/Probe Response
3072 * frames when operating as a GO. The driver is responsible for adding
3073 * timing related attributes (e.g., NoA) in addition to the IEs
3074 * included here by appending them after these buffers. This call is
3075 * also used to provide Probe Response IEs for P2P Listen state
3076 * operations for drivers that generate the Probe Response frames
3077 * internally.
062390ef
JM
3078 *
3079 * DEPRECATED - use set_ap() instead
15333707 3080 */
0ebdf627 3081 int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon,
0e2e565a
JM
3082 const struct wpabuf *proberesp,
3083 const struct wpabuf *assocresp);
4bc181ec
JM
3084
3085 /**
3086 * set_supp_port - Set IEEE 802.1X Supplicant Port status
3087 * @priv: Private driver interface data
3088 * @authorized: Whether the port is authorized
3089 * Returns: 0 on success, -1 on failure
3090 */
3091 int (*set_supp_port)(void *priv, int authorized);
fbbfcbac
FF
3092
3093 /**
3094 * set_wds_sta - Bind a station into a 4-address WDS (AP only)
3095 * @priv: Private driver interface data
3096 * @addr: MAC address of the associated station
3097 * @aid: Association ID
3098 * @val: 1 = bind to 4-address WDS; 0 = unbind
d38ae2ea
FF
3099 * @bridge_ifname: Bridge interface to use for the WDS station or %NULL
3100 * to indicate that bridge is not to be used
69dd2967
SM
3101 * @ifname_wds: Buffer to return the interface name for the new WDS
3102 * station or %NULL to indicate name is not returned.
fbbfcbac
FF
3103 * Returns: 0 on success, -1 on failure
3104 */
d38ae2ea 3105 int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val,
0e80ea2c 3106 const char *bridge_ifname, char *ifname_wds);
504e905c 3107
55777702
JM
3108 /**
3109 * send_action - Transmit an Action frame
3110 * @priv: Private driver interface data
3111 * @freq: Frequency (in MHz) of the channel
190b9062 3112 * @wait: Time to wait off-channel for a response (in ms), or zero
e8828999
JM
3113 * @dst: Destination MAC address (Address 1)
3114 * @src: Source MAC address (Address 2)
3115 * @bssid: BSSID (Address 3)
55777702
JM
3116 * @data: Frame body
3117 * @data_len: data length in octets
b106173a 3118 @ @no_cck: Whether CCK rates must not be used to transmit this frame
55777702
JM
3119 * Returns: 0 on success, -1 on failure
3120 *
3121 * This command can be used to request the driver to transmit an action
190b9062
JB
3122 * frame to the specified destination.
3123 *
3124 * If the %WPA_DRIVER_FLAGS_OFFCHANNEL_TX flag is set, the frame will
3125 * be transmitted on the given channel and the device will wait for a
3126 * response on that channel for the given wait time.
3127 *
3128 * If the flag is not set, the wait time will be ignored. In this case,
3129 * if a remain-on-channel duration is in progress, the frame must be
3130 * transmitted on that channel; alternatively the frame may be sent on
3131 * the current operational channel (if in associated state in station
3132 * mode or while operating as an AP.)
8331c9b3
VK
3133 *
3134 * If @src differs from the device MAC address, use of a random
3135 * transmitter address is requested for this message exchange.
55777702 3136 */
190b9062 3137 int (*send_action)(void *priv, unsigned int freq, unsigned int wait,
e8828999 3138 const u8 *dst, const u8 *src, const u8 *bssid,
b106173a 3139 const u8 *data, size_t data_len, int no_cck);
55777702 3140
190b9062
JB
3141 /**
3142 * send_action_cancel_wait - Cancel action frame TX wait
3143 * @priv: Private driver interface data
3144 *
3145 * This command cancels the wait time associated with sending an action
3146 * frame. It is only available when %WPA_DRIVER_FLAGS_OFFCHANNEL_TX is
3147 * set in the driver flags.
3148 */
3149 void (*send_action_cancel_wait)(void *priv);
3150
55777702
JM
3151 /**
3152 * remain_on_channel - Remain awake on a channel
3153 * @priv: Private driver interface data
3154 * @freq: Frequency (in MHz) of the channel
3155 * @duration: Duration in milliseconds
3156 * Returns: 0 on success, -1 on failure
3157 *
3158 * This command is used to request the driver to remain awake on the
3159 * specified channel for the specified duration and report received
dbfb8e82 3160 * Action frames with EVENT_RX_MGMT events. Optionally, received
55777702
JM
3161 * Probe Request frames may also be requested to be reported by calling
3162 * probe_req_report(). These will be reported with EVENT_RX_PROBE_REQ.
3163 *
3164 * The driver may not be at the requested channel when this function
3165 * returns, i.e., the return code is only indicating whether the
3166 * request was accepted. The caller will need to wait until the
3167 * EVENT_REMAIN_ON_CHANNEL event indicates that the driver has
3168 * completed the channel change. This may take some time due to other
3169 * need for the radio and the caller should be prepared to timing out
3170 * its wait since there are no guarantees on when this request can be
3171 * executed.
3172 */
3173 int (*remain_on_channel)(void *priv, unsigned int freq,
3174 unsigned int duration);
3175
3176 /**
3177 * cancel_remain_on_channel - Cancel remain-on-channel operation
3178 * @priv: Private driver interface data
3179 *
3180 * This command can be used to cancel a remain-on-channel operation
3181 * before its originally requested duration has passed. This could be
3182 * used, e.g., when remain_on_channel() is used to request extra time
3183 * to receive a response to an Action frame and the response is
3184 * received when there is still unneeded time remaining on the
3185 * remain-on-channel operation.
3186 */
3187 int (*cancel_remain_on_channel)(void *priv);
3188
504e905c
JM
3189 /**
3190 * probe_req_report - Request Probe Request frames to be indicated
3191 * @priv: Private driver interface data
3192 * @report: Whether to report received Probe Request frames
3193 * Returns: 0 on success, -1 on failure (or if not supported)
3194 *
3195 * This command can be used to request the driver to indicate when
3196 * Probe Request frames are received with EVENT_RX_PROBE_REQ events.
3197 * Since this operation may require extra resources, e.g., due to less
3198 * optimal hardware/firmware RX filtering, many drivers may disable
3199 * Probe Request reporting at least in station mode. This command is
3200 * used to notify the driver when the Probe Request frames need to be
3201 * reported, e.g., during remain-on-channel operations.
3202 */
3203 int (*probe_req_report)(void *priv, int report);
4e5cb1a3 3204
af473088
JM
3205 /**
3206 * deinit_ap - Deinitialize AP mode
3207 * @priv: Private driver interface data
3208 * Returns: 0 on success, -1 on failure (or if not supported)
3209 *
3210 * This optional function can be used to disable AP mode related
60b13c20
IP
3211 * configuration. If the interface was not dynamically added,
3212 * change the driver mode to station mode to allow normal station
3213 * operations like scanning to be completed.
af473088
JM
3214 */
3215 int (*deinit_ap)(void *priv);
207ef3fb 3216
3c29244e
EP
3217 /**
3218 * deinit_p2p_cli - Deinitialize P2P client mode
3219 * @priv: Private driver interface data
3220 * Returns: 0 on success, -1 on failure (or if not supported)
3221 *
60b13c20
IP
3222 * This optional function can be used to disable P2P client mode. If the
3223 * interface was not dynamically added, change the interface type back
3224 * to station mode.
3c29244e
EP
3225 */
3226 int (*deinit_p2p_cli)(void *priv);
3227
207ef3fb
JM
3228 /**
3229 * suspend - Notification on system suspend/hibernate event
3230 * @priv: Private driver interface data
3231 */
3232 void (*suspend)(void *priv);
3233
3234 /**
3235 * resume - Notification on system resume/thaw event
3236 * @priv: Private driver interface data
3237 */
3238 void (*resume)(void *priv);
b625473c
JM
3239
3240 /**
3241 * signal_monitor - Set signal monitoring parameters
3242 * @priv: Private driver interface data
3243 * @threshold: Threshold value for signal change events; 0 = disabled
3244 * @hysteresis: Minimum change in signal strength before indicating a
3245 * new event
3246 * Returns: 0 on success, -1 on failure (or if not supported)
3247 *
3248 * This function can be used to configure monitoring of signal strength
3249 * with the current AP. Whenever signal strength drops below the
3250 * %threshold value or increases above it, EVENT_SIGNAL_CHANGE event
3251 * should be generated assuming the signal strength has changed at
3252 * least %hysteresis from the previously indicated signal change event.
3253 */
3254 int (*signal_monitor)(void *priv, int threshold, int hysteresis);
b91ab76e
JM
3255
3256 /**
3257 * send_frame - Send IEEE 802.11 frame (testing use only)
3258 * @priv: Private driver interface data
3259 * @data: IEEE 802.11 frame with IEEE 802.11 header
3260 * @data_len: Size of the frame
3261 * @encrypt: Whether to encrypt the frame (if keys are set)
3262 * Returns: 0 on success, -1 on failure
3263 *
3264 * This function is only used for debugging purposes and is not
3265 * required to be implemented for normal operations.
3266 */
3267 int (*send_frame)(void *priv, const u8 *data, size_t data_len,
3268 int encrypt);
75bde05d 3269
75bde05d
JM
3270 /**
3271 * get_noa - Get current Notice of Absence attribute payload
3272 * @priv: Private driver interface data
3273 * @buf: Buffer for returning NoA
3274 * @buf_len: Buffer length in octets
3275 * Returns: Number of octets used in buf, 0 to indicate no NoA is being
3276 * advertized, or -1 on failure
3277 *
3278 * This function is used to fetch the current Notice of Absence
3279 * attribute value from GO.
3280 */
3281 int (*get_noa)(void *priv, u8 *buf, size_t buf_len);
3282
3283 /**
3284 * set_noa - Set Notice of Absence parameters for GO (testing)
3285 * @priv: Private driver interface data
3286 * @count: Count
3287 * @start: Start time in ms from next TBTT
3288 * @duration: Duration in ms
3289 * Returns: 0 on success or -1 on failure
3290 *
3291 * This function is used to set Notice of Absence parameters for GO. It
3292 * is used only for testing. To disable NoA, all parameters are set to
3293 * 0.
3294 */
3295 int (*set_noa)(void *priv, u8 count, int start, int duration);
c381508d
JM
3296
3297 /**
3298 * set_p2p_powersave - Set P2P power save options
3299 * @priv: Private driver interface data
3300 * @legacy_ps: 0 = disable, 1 = enable, 2 = maximum PS, -1 = no change
3301 * @opp_ps: 0 = disable, 1 = enable, -1 = no change
3302 * @ctwindow: 0.. = change (msec), -1 = no change
3303 * Returns: 0 on success or -1 on failure
3304 */
3305 int (*set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps,
3306 int ctwindow);
b6c79a99
JM
3307
3308 /**
3309 * ampdu - Enable/disable aggregation
3310 * @priv: Private driver interface data
3311 * @ampdu: 1/0 = enable/disable A-MPDU aggregation
3312 * Returns: 0 on success or -1 on failure
3313 */
3314 int (*ampdu)(void *priv, int ampdu);
0f66abd2 3315
6859f1cb
BG
3316 /**
3317 * get_radio_name - Get physical radio name for the device
3318 * @priv: Private driver interface data
3319 * Returns: Radio name or %NULL if not known
3320 *
3321 * The returned data must not be modified by the caller. It is assumed
3322 * that any interface that has the same radio name as another is
3323 * sharing the same physical radio. This information can be used to
3324 * share scan results etc. information between the virtual interfaces
3325 * to speed up various operations.
3326 */
3327 const char * (*get_radio_name)(void *priv);
3ac17eba 3328
281ff0aa
GP
3329 /**
3330 * send_tdls_mgmt - for sending TDLS management packets
3331 * @priv: private driver interface data
3332 * @dst: Destination (peer) MAC address
3333 * @action_code: TDLS action code for the mssage
3334 * @dialog_token: Dialog Token to use in the message (if needed)
3335 * @status_code: Status Code or Reason Code to use (if needed)
96ecea5e 3336 * @peer_capab: TDLS peer capability (TDLS_PEER_* bitfield)
984dadc2 3337 * @initiator: Is the current end the TDLS link initiator
281ff0aa
GP
3338 * @buf: TDLS IEs to add to the message
3339 * @len: Length of buf in octets
45b722f1 3340 * Returns: 0 on success, negative (<0) on failure
281ff0aa
GP
3341 *
3342 * This optional function can be used to send packet to driver which is
3343 * responsible for receiving and sending all TDLS packets.
3344 */
3345 int (*send_tdls_mgmt)(void *priv, const u8 *dst, u8 action_code,
96ecea5e 3346 u8 dialog_token, u16 status_code, u32 peer_capab,
984dadc2 3347 int initiator, const u8 *buf, size_t len);
281ff0aa 3348
45b722f1
AN
3349 /**
3350 * tdls_oper - Ask the driver to perform high-level TDLS operations
3351 * @priv: Private driver interface data
3352 * @oper: TDLS high-level operation. See %enum tdls_oper
3353 * @peer: Destination (peer) MAC address
3354 * Returns: 0 on success, negative (<0) on failure
3355 *
3356 * This optional function can be used to send high-level TDLS commands
3357 * to the driver.
3358 */
281ff0aa 3359 int (*tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer);
1c5c7273 3360
a884be9d
XC
3361 /**
3362 * wnm_oper - Notify driver of the WNM frame reception
3363 * @priv: Private driver interface data
3364 * @oper: WNM operation. See %enum wnm_oper
3365 * @peer: Destination (peer) MAC address
3366 * @buf: Buffer for the driver to fill in (for getting IE)
3367 * @buf_len: Return the len of buf
3368 * Returns: 0 on success, negative (<0) on failure
3369 */
3370 int (*wnm_oper)(void *priv, enum wnm_oper oper, const u8 *peer,
3371 u8 *buf, u16 *buf_len);
3372
c551700f
KP
3373 /**
3374 * set_qos_map - Set QoS Map
3375 * @priv: Private driver interface data
3376 * @qos_map_set: QoS Map
3377 * @qos_map_set_len: Length of QoS Map
3378 */
3379 int (*set_qos_map)(void *priv, const u8 *qos_map_set,
3380 u8 qos_map_set_len);
3381
71103bed
KP
3382 /**
3383 * br_add_ip_neigh - Add a neigh to the bridge ip neigh table
3384 * @priv: Private driver interface data
ed4ddb6d
KP
3385 * @version: IP version of the IP address, 4 or 6
3386 * @ipaddr: IP address for the neigh entry
3387 * @prefixlen: IP address prefix length
71103bed
KP
3388 * @addr: Corresponding MAC address
3389 * Returns: 0 on success, negative (<0) on failure
3390 */
ed4ddb6d
KP
3391 int (*br_add_ip_neigh)(void *priv, u8 version, const u8 *ipaddr,
3392 int prefixlen, const u8 *addr);
71103bed
KP
3393
3394 /**
3395 * br_delete_ip_neigh - Remove a neigh from the bridge ip neigh table
3396 * @priv: Private driver interface data
ed4ddb6d
KP
3397 * @version: IP version of the IP address, 4 or 6
3398 * @ipaddr: IP address for the neigh entry
71103bed
KP
3399 * Returns: 0 on success, negative (<0) on failure
3400 */
ed4ddb6d 3401 int (*br_delete_ip_neigh)(void *priv, u8 version, const u8 *ipaddr);
71103bed 3402
73d2294f
KP
3403 /**
3404 * br_port_set_attr - Set a bridge port attribute
3405 * @attr: Bridge port attribute to set
3406 * @val: Value to be set
3407 * Returns: 0 on success, negative (<0) on failure
3408 */
3409 int (*br_port_set_attr)(void *priv, enum drv_br_port_attr attr,
3410 unsigned int val);
3411
7565752d
KP
3412 /**
3413 * br_port_set_attr - Set a bridge network parameter
3414 * @param: Bridge parameter to set
3415 * @val: Value to be set
3416 * Returns: 0 on success, negative (<0) on failure
3417 */
3418 int (*br_set_net_param)(void *priv, enum drv_br_net_param param,
3419 unsigned int val);
3420
e4fa8b12
EP
3421 /**
3422 * set_wowlan - Set wake-on-wireless triggers
3423 * @priv: Private driver interface data
3424 * @triggers: wowlan triggers
3425 */
3426 int (*set_wowlan)(void *priv, const struct wowlan_triggers *triggers);
3427
1c5c7273
PS
3428 /**
3429 * signal_poll - Get current connection information
3430 * @priv: Private driver interface data
3431 * @signal_info: Connection info structure
0e80ea2c 3432 */
1c5c7273 3433 int (*signal_poll)(void *priv, struct wpa_signal_info *signal_info);
41fd1d9e 3434
7f00dc6e
MV
3435 /**
3436 * channel_info - Get parameters of the current operating channel
3437 * @priv: Private driver interface data
3438 * @channel_info: Channel info structure
3439 * Returns: 0 on success, negative (<0) on failure
3440 */
3441 int (*channel_info)(void *priv, struct wpa_channel_info *channel_info);
3442
41fd1d9e
KZ
3443 /**
3444 * set_authmode - Set authentication algorithm(s) for static WEP
3445 * @priv: Private driver interface data
3446 * @authmode: 1=Open System, 2=Shared Key, 3=both
3447 * Returns: 0 on success, -1 on failure
3448 *
3449 * This function can be used to set authentication algorithms for AP
3450 * mode when static WEP is used. If the driver uses user space MLME/SME
3451 * implementation, there is no need to implement this function.
062390ef
JM
3452 *
3453 * DEPRECATED - use set_ap() instead
41fd1d9e
KZ
3454 */
3455 int (*set_authmode)(void *priv, int authmode);
b14a210c 3456
5e2c3490
JM
3457#ifdef ANDROID
3458 /**
3459 * driver_cmd - Execute driver-specific command
3460 * @priv: Private driver interface data
3461 * @cmd: Command to execute
3462 * @buf: Return buffer
3463 * @buf_len: Buffer length
3464 * Returns: 0 on success, -1 on failure
3465 */
3466 int (*driver_cmd)(void *priv, char *cmd, char *buf, size_t buf_len);
3467#endif /* ANDROID */
3468
adef8948
BL
3469 /**
3470 * vendor_cmd - Execute vendor specific command
3471 * @priv: Private driver interface data
3472 * @vendor_id: Vendor id
3473 * @subcmd: Vendor command id
3474 * @data: Vendor command parameters (%NULL if no parameters)
3475 * @data_len: Data length
3476 * @buf: Return buffer (%NULL to ignore reply)
3477 * Returns: 0 on success, negative (<0) on failure
3478 *
3479 * This function handles vendor specific commands that are passed to
3480 * the driver/device. The command is identified by vendor id and
3481 * command id. Parameters can be passed as argument to the command
3482 * in the data buffer. Reply (if any) will be filled in the supplied
3483 * return buffer.
3484 *
3485 * The exact driver behavior is driver interface and vendor specific. As
3486 * an example, this will be converted to a vendor specific cfg80211
3487 * command in case of the nl80211 driver interface.
3488 */
3489 int (*vendor_cmd)(void *priv, unsigned int vendor_id,
3490 unsigned int subcmd, const u8 *data, size_t data_len,
3491 struct wpabuf *buf);
3492
b14a210c
JB
3493 /**
3494 * set_rekey_info - Set rekey information
3495 * @priv: Private driver interface data
3496 * @kek: Current KEK
98cd3d1c 3497 * @kek_len: KEK length in octets
b14a210c 3498 * @kck: Current KCK
98cd3d1c 3499 * @kck_len: KCK length in octets
b14a210c
JB
3500 * @replay_ctr: Current EAPOL-Key Replay Counter
3501 *
3502 * This optional function can be used to provide information for the
3503 * driver/firmware to process EAPOL-Key frames in Group Key Handshake
3504 * while the host (including wpa_supplicant) is sleeping.
3505 */
98cd3d1c
JM
3506 void (*set_rekey_info)(void *priv, const u8 *kek, size_t kek_len,
3507 const u8 *kck, size_t kck_len,
b14a210c 3508 const u8 *replay_ctr);
a52eba0f
SP
3509
3510 /**
3511 * sta_assoc - Station association indication
3512 * @priv: Private driver interface data
3513 * @own_addr: Source address and BSSID for association frame
3514 * @addr: MAC address of the station to associate
3515 * @reassoc: flag to indicate re-association
3516 * @status: association response status code
3517 * @ie: assoc response ie buffer
3518 * @len: ie buffer length
3519 * Returns: 0 on success, -1 on failure
3520 *
3521 * This function indicates the driver to send (Re)Association
3522 * Response frame to the station.
3523 */
3524 int (*sta_assoc)(void *priv, const u8 *own_addr, const u8 *addr,
3525 int reassoc, u16 status, const u8 *ie, size_t len);
3526
3527 /**
3528 * sta_auth - Station authentication indication
6b128fb2
JM
3529 * @priv: private driver interface data
3530 * @params: Station authentication parameters
a52eba0f 3531 *
6b128fb2 3532 * Returns: 0 on success, -1 on failure
a52eba0f 3533 */
6b128fb2
JM
3534 int (*sta_auth)(void *priv,
3535 struct wpa_driver_sta_auth_params *params);
a52eba0f
SP
3536
3537 /**
3538 * add_tspec - Add traffic stream
3539 * @priv: Private driver interface data
3540 * @addr: MAC address of the station to associate
3541 * @tspec_ie: tspec ie buffer
3542 * @tspec_ielen: tspec ie length
3543 * Returns: 0 on success, -1 on failure
3544 *
3545 * This function adds the traffic steam for the station
3546 * and fills the medium_time in tspec_ie.
3547 */
3548 int (*add_tspec)(void *priv, const u8 *addr, u8 *tspec_ie,
3549 size_t tspec_ielen);
3550
3551 /**
3552 * add_sta_node - Add a station node in the driver
3553 * @priv: Private driver interface data
3554 * @addr: MAC address of the station to add
3555 * @auth_alg: authentication algorithm used by the station
3556 * Returns: 0 on success, -1 on failure
3557 *
3558 * This function adds the station node in the driver, when
3559 * the station gets added by FT-over-DS.
3560 */
3561 int (*add_sta_node)(void *priv, const u8 *addr, u16 auth_alg);
cbdf3507
LC
3562
3563 /**
3564 * sched_scan - Request the driver to initiate scheduled scan
3565 * @priv: Private driver interface data
3566 * @params: Scan parameters
cbdf3507
LC
3567 * Returns: 0 on success, -1 on failure
3568 *
3569 * This operation should be used for scheduled scan offload to
3570 * the hardware. Every time scan results are available, the
3571 * driver should report scan results event for wpa_supplicant
3572 * which will eventually request the results with
3573 * wpa_driver_get_scan_results2(). This operation is optional
3574 * and if not provided or if it returns -1, we fall back to
3575 * normal host-scheduled scans.
3576 */
09ea4309 3577 int (*sched_scan)(void *priv, struct wpa_driver_scan_params *params);
cbdf3507
LC
3578
3579 /**
3580 * stop_sched_scan - Request the driver to stop a scheduled scan
3581 * @priv: Private driver interface data
3582 * Returns: 0 on success, -1 on failure
3583 *
3584 * This should cause the scheduled scan to be stopped and
3585 * results should stop being sent. Must be supported if
3586 * sched_scan is supported.
3587 */
3588 int (*stop_sched_scan)(void *priv);
bcf24348
JB
3589
3590 /**
3591 * poll_client - Probe (null data or such) the given station
3592 * @priv: Private driver interface data
3593 * @own_addr: MAC address of sending interface
3594 * @addr: MAC address of the station to probe
3595 * @qos: Indicates whether station is QoS station
3596 *
3597 * This function is used to verify whether an associated station is
3598 * still present. This function does not need to be implemented if the
3599 * driver provides such inactivity polling mechanism.
3600 */
3601 void (*poll_client)(void *priv, const u8 *own_addr,
3602 const u8 *addr, int qos);
8b9d0bfa
JM
3603
3604 /**
3605 * radio_disable - Disable/enable radio
3606 * @priv: Private driver interface data
3607 * @disabled: 1=disable 0=enable radio
3608 * Returns: 0 on success, -1 on failure
3609 *
3610 * This optional command is for testing purposes. It can be used to
3611 * disable the radio on a testbed device to simulate out-of-radio-range
3612 * conditions.
3613 */
3614 int (*radio_disable)(void *priv, int disabled);
ef35f5a0
JJ
3615
3616 /**
3617 * switch_channel - Announce channel switch and migrate the GO to the
3618 * given frequency
3619 * @priv: Private driver interface data
dcca2219 3620 * @settings: Settings for CSA period and new channel
ef35f5a0
JJ
3621 * Returns: 0 on success, -1 on failure
3622 *
3623 * This function is used to move the GO to the legacy STA channel to
3624 * avoid frequency conflict in single channel concurrency.
3625 */
dcca2219 3626 int (*switch_channel)(void *priv, struct csa_settings *settings);
f90e9c1c 3627
471cd6e1
MB
3628 /**
3629 * add_tx_ts - Add traffic stream
3630 * @priv: Private driver interface data
3631 * @tsid: Traffic stream ID
3632 * @addr: Receiver address
3633 * @user_prio: User priority of the traffic stream
3634 * @admitted_time: Admitted time for this TS in units of
3635 * 32 microsecond periods (per second).
3636 * Returns: 0 on success, -1 on failure
3637 */
3638 int (*add_tx_ts)(void *priv, u8 tsid, const u8 *addr, u8 user_prio,
3639 u16 admitted_time);
3640
3641 /**
3642 * del_tx_ts - Delete traffic stream
3643 * @priv: Private driver interface data
3644 * @tsid: Traffic stream ID
3645 * @addr: Receiver address
3646 * Returns: 0 on success, -1 on failure
3647 */
3648 int (*del_tx_ts)(void *priv, u8 tsid, const u8 *addr);
3649
6b90deae
AN
3650 /**
3651 * Enable channel-switching with TDLS peer
3652 * @priv: Private driver interface data
3653 * @addr: MAC address of the TDLS peer
3654 * @oper_class: Operating class of the switch channel
3655 * @params: Channel specification
3656 * Returns: 0 on success, -1 on failure
3657 *
3658 * The function indicates to driver that it can start switching to a
3659 * different channel with a specified TDLS peer. The switching is
3660 * assumed on until canceled with tdls_disable_channel_switch().
3661 */
3662 int (*tdls_enable_channel_switch)(
3663 void *priv, const u8 *addr, u8 oper_class,
3664 const struct hostapd_freq_params *params);
3665
3666 /**
3667 * Disable channel switching with TDLS peer
3668 * @priv: Private driver interface data
3669 * @addr: MAC address of the TDLS peer
3670 * Returns: 0 on success, -1 on failure
3671 *
3672 * This function indicates to the driver that it should stop switching
3673 * with a given TDLS peer.
3674 */
3675 int (*tdls_disable_channel_switch)(void *priv, const u8 *addr);
3676
f90e9c1c
SW
3677 /**
3678 * start_dfs_cac - Listen for radar interference on the channel
3679 * @priv: Private driver interface data
04e8003c 3680 * @freq: Channel parameters
f90e9c1c
SW
3681 * Returns: 0 on success, -1 on failure
3682 */
04e8003c 3683 int (*start_dfs_cac)(void *priv, struct hostapd_freq_params *freq);
695c7038
SW
3684
3685 /**
3686 * stop_ap - Removes beacon from AP
3687 * @priv: Private driver interface data
3688 * Returns: 0 on success, -1 on failure (or if not supported)
3689 *
3690 * This optional function can be used to disable AP mode related
3691 * configuration. Unlike deinit_ap, it does not change to station
3692 * mode.
3693 */
3694 int (*stop_ap)(void *priv);
0185007c
MK
3695
3696 /**
3697 * get_survey - Retrieve survey data
3698 * @priv: Private driver interface data
3699 * @freq: If set, survey data for the specified frequency is only
3700 * being requested. If not set, all survey data is requested.
3701 * Returns: 0 on success, -1 on failure
3702 *
3703 * Use this to retrieve:
3704 *
3705 * - the observed channel noise floor
3706 * - the amount of time we have spent on the channel
3707 * - the amount of time during which we have spent on the channel that
3708 * the radio has determined the medium is busy and we cannot
3709 * transmit
3710 * - the amount of time we have spent receiving data
3711 * - the amount of time we have spent transmitting data
3712 *
3713 * This data can be used for spectrum heuristics. One example is
3714 * Automatic Channel Selection (ACS). The channel survey data is
3715 * kept on a linked list on the channel data, one entry is added
3716 * for each survey. The min_nf of the channel is updated for each
3717 * survey.
3718 */
3719 int (*get_survey)(void *priv, unsigned int freq);
a771c07d
JM
3720
3721 /**
3722 * status - Get driver interface status information
3723 * @priv: Private driver interface data
d0dde080 3724 * @buf: Buffer for printing the status information
a771c07d
JM
3725 * @buflen: Maximum length of the buffer
3726 * Returns: Length of written status information or -1 on failure
3727 */
3728 int (*status)(void *priv, char *buf, size_t buflen);
7baec808 3729
0ef023e4
JM
3730 /**
3731 * roaming - Set roaming policy for driver-based BSS selection
3732 * @priv: Private driver interface data
3733 * @allowed: Whether roaming within ESS is allowed
3734 * @bssid: Forced BSSID if roaming is disabled or %NULL if not set
3735 * Returns: Length of written status information or -1 on failure
3736 *
3737 * This optional callback can be used to update roaming policy from the
3738 * associate() command (bssid being set there indicates that the driver
3739 * should not roam before getting this roaming() call to allow roaming.
3740 * If the driver does not indicate WPA_DRIVER_FLAGS_BSS_SELECTION
3741 * capability, roaming policy is handled within wpa_supplicant and there
3742 * is no need to implement or react to this callback.
3743 */
3744 int (*roaming)(void *priv, int allowed, const u8 *bssid);
3745
d98038bb 3746 /**
3747 * disable_fils - Enable/disable FILS feature
3748 * @priv: Private driver interface data
3749 * @disable: 0-enable and 1-disable FILS feature
3750 * Returns: 0 on success, -1 on failure
3751 *
3752 * This callback can be used to configure driver and below layers to
3753 * enable/disable all FILS features.
3754 */
3755 int (*disable_fils)(void *priv, int disable);
3756
fee354c7
JM
3757 /**
3758 * set_mac_addr - Set MAC address
3759 * @priv: Private driver interface data
3760 * @addr: MAC address to use or %NULL for setting back to permanent
3761 * Returns: 0 on success, -1 on failure
3762 */
3763 int (*set_mac_addr)(void *priv, const u8 *addr);
3764
7baec808
HW
3765#ifdef CONFIG_MACSEC
3766 int (*macsec_init)(void *priv, struct macsec_init_params *params);
3767
3768 int (*macsec_deinit)(void *priv);
3769
a25e4efc
SD
3770 /**
3771 * macsec_get_capability - Inform MKA of this driver's capability
3772 * @priv: Private driver interface data
3773 * @cap: Driver's capability
3774 * Returns: 0 on success, -1 on failure
3775 */
3776 int (*macsec_get_capability)(void *priv, enum macsec_cap *cap);
3777
7baec808
HW
3778 /**
3779 * enable_protect_frames - Set protect frames status
3780 * @priv: Private driver interface data
3781 * @enabled: TRUE = protect frames enabled
3782 * FALSE = protect frames disabled
3783 * Returns: 0 on success, -1 on failure (or if not supported)
3784 */
3785 int (*enable_protect_frames)(void *priv, Boolean enabled);
3786
1d3d0666
SD
3787 /**
3788 * enable_encrypt - Set encryption status
3789 * @priv: Private driver interface data
3790 * @enabled: TRUE = encrypt outgoing traffic
3791 * FALSE = integrity-only protection on outgoing traffic
3792 * Returns: 0 on success, -1 on failure (or if not supported)
3793 */
3794 int (*enable_encrypt)(void *priv, Boolean enabled);
3795
7baec808
HW
3796 /**
3797 * set_replay_protect - Set replay protect status and window size
3798 * @priv: Private driver interface data
3799 * @enabled: TRUE = replay protect enabled
3800 * FALSE = replay protect disabled
3801 * @window: replay window size, valid only when replay protect enabled
3802 * Returns: 0 on success, -1 on failure (or if not supported)
3803 */
3804 int (*set_replay_protect)(void *priv, Boolean enabled, u32 window);
3805
3806 /**
3807 * set_current_cipher_suite - Set current cipher suite
3808 * @priv: Private driver interface data
3809 * @cs: EUI64 identifier
7baec808
HW
3810 * Returns: 0 on success, -1 on failure (or if not supported)
3811 */
07a6bfe1 3812 int (*set_current_cipher_suite)(void *priv, u64 cs);
7baec808
HW
3813
3814 /**
3815 * enable_controlled_port - Set controlled port status
3816 * @priv: Private driver interface data
3817 * @enabled: TRUE = controlled port enabled
3818 * FALSE = controlled port disabled
3819 * Returns: 0 on success, -1 on failure (or if not supported)
3820 */
3821 int (*enable_controlled_port)(void *priv, Boolean enabled);
3822
3823 /**
3824 * get_receive_lowest_pn - Get receive lowest pn
3825 * @priv: Private driver interface data
7fa5eff8 3826 * @sa: secure association
7baec808
HW
3827 * Returns: 0 on success, -1 on failure (or if not supported)
3828 */
7fa5eff8 3829 int (*get_receive_lowest_pn)(void *priv, struct receive_sa *sa);
7baec808
HW
3830
3831 /**
3832 * get_transmit_next_pn - Get transmit next pn
3833 * @priv: Private driver interface data
7fa5eff8 3834 * @sa: secure association
7baec808
HW
3835 * Returns: 0 on success, -1 on failure (or if not supported)
3836 */
7fa5eff8 3837 int (*get_transmit_next_pn)(void *priv, struct transmit_sa *sa);
7baec808
HW
3838
3839 /**
3840 * set_transmit_next_pn - Set transmit next pn
3841 * @priv: Private driver interface data
7fa5eff8 3842 * @sa: secure association
7baec808
HW
3843 * Returns: 0 on success, -1 on failure (or if not supported)
3844 */
7fa5eff8 3845 int (*set_transmit_next_pn)(void *priv, struct transmit_sa *sa);
7baec808 3846
2fc06756
MS
3847 /**
3848 * set_receive_lowest_pn - Set receive lowest PN
3849 * @priv: Private driver interface data
3850 * @sa: secure association
3851 * Returns: 0 on success, -1 on failure (or if not supported)
3852 */
3853 int (*set_receive_lowest_pn)(void *priv, struct receive_sa *sa);
3854
7baec808
HW
3855 /**
3856 * create_receive_sc - create secure channel for receiving
3857 * @priv: Private driver interface data
5f5ca284 3858 * @sc: secure channel
7baec808
HW
3859 * @conf_offset: confidentiality offset (0, 30, or 50)
3860 * @validation: frame validation policy (0 = Disabled, 1 = Checked,
3861 * 2 = Strict)
3862 * Returns: 0 on success, -1 on failure (or if not supported)
3863 */
5f5ca284
SD
3864 int (*create_receive_sc)(void *priv, struct receive_sc *sc,
3865 unsigned int conf_offset,
7baec808
HW
3866 int validation);
3867
3868 /**
3869 * delete_receive_sc - delete secure connection for receiving
3870 * @priv: private driver interface data from init()
5f5ca284 3871 * @sc: secure channel
7baec808
HW
3872 * Returns: 0 on success, -1 on failure
3873 */
5f5ca284 3874 int (*delete_receive_sc)(void *priv, struct receive_sc *sc);
7baec808
HW
3875
3876 /**
3877 * create_receive_sa - create secure association for receive
3878 * @priv: private driver interface data from init()
cecdecdb 3879 * @sa: secure association
7baec808
HW
3880 * Returns: 0 on success, -1 on failure
3881 */
cecdecdb 3882 int (*create_receive_sa)(void *priv, struct receive_sa *sa);
7baec808 3883
23c3528a
SD
3884 /**
3885 * delete_receive_sa - Delete secure association for receive
3886 * @priv: Private driver interface data from init()
3887 * @sa: Secure association
3888 * Returns: 0 on success, -1 on failure
3889 */
3890 int (*delete_receive_sa)(void *priv, struct receive_sa *sa);
3891
7baec808
HW
3892 /**
3893 * enable_receive_sa - enable the SA for receive
3894 * @priv: private driver interface data from init()
cecdecdb 3895 * @sa: secure association
7baec808
HW
3896 * Returns: 0 on success, -1 on failure
3897 */
cecdecdb 3898 int (*enable_receive_sa)(void *priv, struct receive_sa *sa);
7baec808
HW
3899
3900 /**
3901 * disable_receive_sa - disable SA for receive
3902 * @priv: private driver interface data from init()
cecdecdb 3903 * @sa: secure association
7baec808
HW
3904 * Returns: 0 on success, -1 on failure
3905 */
cecdecdb 3906 int (*disable_receive_sa)(void *priv, struct receive_sa *sa);
7baec808 3907
7baec808
HW
3908 /**
3909 * create_transmit_sc - create secure connection for transmit
3910 * @priv: private driver interface data from init()
8ebfc7c2
SD
3911 * @sc: secure channel
3912 * @conf_offset: confidentiality offset (0, 30, or 50)
7baec808
HW
3913 * Returns: 0 on success, -1 on failure
3914 */
8ebfc7c2
SD
3915 int (*create_transmit_sc)(void *priv, struct transmit_sc *sc,
3916 unsigned int conf_offset);
7baec808
HW
3917
3918 /**
3919 * delete_transmit_sc - delete secure connection for transmit
3920 * @priv: private driver interface data from init()
8ebfc7c2 3921 * @sc: secure channel
7baec808
HW
3922 * Returns: 0 on success, -1 on failure
3923 */
8ebfc7c2 3924 int (*delete_transmit_sc)(void *priv, struct transmit_sc *sc);
7baec808
HW
3925
3926 /**
3927 * create_transmit_sa - create secure association for transmit
3928 * @priv: private driver interface data from init()
909c1b98 3929 * @sa: secure association
7baec808
HW
3930 * Returns: 0 on success, -1 on failure
3931 */
909c1b98 3932 int (*create_transmit_sa)(void *priv, struct transmit_sa *sa);
7baec808 3933
23c3528a
SD
3934 /**
3935 * delete_transmit_sa - Delete secure association for transmit
3936 * @priv: Private driver interface data from init()
3937 * @sa: Secure association
3938 * Returns: 0 on success, -1 on failure
3939 */
3940 int (*delete_transmit_sa)(void *priv, struct transmit_sa *sa);
3941
7baec808
HW
3942 /**
3943 * enable_transmit_sa - enable SA for transmit
3944 * @priv: private driver interface data from init()
909c1b98 3945 * @sa: secure association
7baec808
HW
3946 * Returns: 0 on success, -1 on failure
3947 */
909c1b98 3948 int (*enable_transmit_sa)(void *priv, struct transmit_sa *sa);
7baec808
HW
3949
3950 /**
3951 * disable_transmit_sa - disable SA for transmit
3952 * @priv: private driver interface data from init()
909c1b98 3953 * @sa: secure association
7baec808
HW
3954 * Returns: 0 on success, -1 on failure
3955 */
909c1b98 3956 int (*disable_transmit_sa)(void *priv, struct transmit_sa *sa);
7baec808 3957#endif /* CONFIG_MACSEC */
6c1664f6
BC
3958
3959 /**
3960 * init_mesh - Driver specific initialization for mesh
3961 * @priv: Private driver interface data
3962 * Returns: 0 on success, -1 on failure
3963 */
3964 int (*init_mesh)(void *priv);
3965
3966 /**
3967 * join_mesh - Join a mesh network
3968 * @priv: Private driver interface data
3969 * @params: Mesh configuration parameters
3970 * Returns: 0 on success, -1 on failure
3971 */
3972 int (*join_mesh)(void *priv,
3973 struct wpa_driver_mesh_join_params *params);
3974
3975 /**
3976 * leave_mesh - Leave a mesh network
3977 * @priv: Private driver interface data
3978 * Returns 0 on success, -1 on failure
3979 */
3980 int (*leave_mesh)(void *priv);
16689c7c
PX
3981
3982 /**
3983 * do_acs - Automatically select channel
3984 * @priv: Private driver interface data
3985 * @params: Parameters for ACS
3986 * Returns 0 on success, -1 on failure
3987 *
3988 * This command can be used to offload ACS to the driver if the driver
3989 * indicates support for such offloading (WPA_DRIVER_FLAGS_ACS_OFFLOAD).
3990 */
3991 int (*do_acs)(void *priv, struct drv_acs_params *params);
844dfeb8
SD
3992
3993 /**
3994 * set_band - Notify driver of band selection
3995 * @priv: Private driver interface data
3996 * @band: The selected band(s)
3997 * Returns 0 on success, -1 on failure
3998 */
3999 int (*set_band)(void *priv, enum set_band band);
7c813acf 4000
98342208
AK
4001 /**
4002 * get_pref_freq_list - Get preferred frequency list for an interface
4003 * @priv: Private driver interface data
4004 * @if_type: Interface type
4005 * @num: Number of channels
4006 * @freq_list: Preferred channel frequency list encoded in MHz values
4007 * Returns 0 on success, -1 on failure
4008 *
4009 * This command can be used to query the preferred frequency list from
4010 * the driver specific to a particular interface type.
4011 */
4012 int (*get_pref_freq_list)(void *priv, enum wpa_driver_if_type if_type,
4013 unsigned int *num, unsigned int *freq_list);
4014
7c813acf
AK
4015 /**
4016 * set_prob_oper_freq - Indicate probable P2P operating channel
4017 * @priv: Private driver interface data
4018 * @freq: Channel frequency in MHz
4019 * Returns 0 on success, -1 on failure
4020 *
4021 * This command can be used to inform the driver of the operating
4022 * frequency that an ongoing P2P group formation is likely to come up
4023 * on. Local device is assuming P2P Client role.
4024 */
4025 int (*set_prob_oper_freq)(void *priv, unsigned int freq);
4f30addb
KV
4026
4027 /**
4028 * abort_scan - Request the driver to abort an ongoing scan
4029 * @priv: Private driver interface data
eeb34a43
SD
4030 * @scan_cookie: Cookie identifying the scan request. This is used only
4031 * when the vendor interface QCA_NL80211_VENDOR_SUBCMD_TRIGGER_SCAN
4032 * was used to trigger scan. Otherwise, 0 is used.
4f30addb
KV
4033 * Returns 0 on success, -1 on failure
4034 */
eeb34a43 4035 int (*abort_scan)(void *priv, u64 scan_cookie);
e42adb9a
MG
4036
4037 /**
4038 * configure_data_frame_filters - Request to configure frame filters
4039 * @priv: Private driver interface data
4040 * @filter_flags: The type of frames to filter (bitfield of
4041 * WPA_DATA_FRAME_FILTER_FLAG_*)
4042 * Returns: 0 on success or -1 on failure
4043 */
4044 int (*configure_data_frame_filters)(void *priv, u32 filter_flags);
cc9a2575
KV
4045
4046 /**
4047 * get_ext_capab - Get extended capabilities for the specified interface
4048 * @priv: Private driver interface data
4049 * @type: Interface type for which to get extended capabilities
4050 * @ext_capab: Extended capabilities fetched
4051 * @ext_capab_mask: Extended capabilities mask
4052 * @ext_capab_len: Length of the extended capabilities
4053 * Returns: 0 on success or -1 on failure
4054 */
4055 int (*get_ext_capab)(void *priv, enum wpa_driver_if_type type,
4056 const u8 **ext_capab, const u8 **ext_capab_mask,
4057 unsigned int *ext_capab_len);
a6f5b193
PX
4058
4059 /**
4060 * p2p_lo_start - Start offloading P2P listen to device
4061 * @priv: Private driver interface data
4062 * @freq: Listening frequency (MHz) for P2P listen
4063 * @period: Length of the listen operation in milliseconds
4064 * @interval: Interval for running the listen operation in milliseconds
4065 * @count: Number of times to run the listen operation
4066 * @device_types: Device primary and secondary types
4067 * @dev_types_len: Number of bytes for device_types
4068 * @ies: P2P IE and WSC IE for Probe Response frames
4069 * @ies_len: Length of ies in bytes
4070 * Returns: 0 on success or -1 on failure
4071 */
4072 int (*p2p_lo_start)(void *priv, unsigned int freq,
4073 unsigned int period, unsigned int interval,
4074 unsigned int count,
4075 const u8 *device_types, size_t dev_types_len,
4076 const u8 *ies, size_t ies_len);
4077
4078 /**
4079 * p2p_lo_stop - Stop P2P listen offload
4080 * @priv: Private driver interface data
4081 * Returns: 0 on success or -1 on failure
4082 */
4083 int (*p2p_lo_stop)(void *priv);
cc9985d1 4084
4085 /**
4086 * set_default_scan_ies - Set default scan IEs
4087 * @priv: Private driver interface data
4088 * @ies: Scan default IEs buffer
4089 * @ies_len: Length of IEs in bytes
4090 * Returns: 0 on success or -1 on failure
4091 *
4092 * The driver can use these by default when there are no scan IEs coming
4093 * in the subsequent scan requests. Also in case of one or more of IEs
4094 * given in set_default_scan_ies() are missing in the subsequent scan
4095 * request, the driver should merge the missing scan IEs in the scan
4096 * request from the IEs set by set_default_scan_ies() in the Probe
4097 * Request frames sent.
4098 */
4099 int (*set_default_scan_ies)(void *priv, const u8 *ies, size_t ies_len);
4100
2e4e4fb7
SD
4101 /**
4102 * set_tdls_mode - Set TDLS trigger mode to the host driver
4103 * @priv: Private driver interface data
4104 * @tdls_external_control: Represents if TDLS external trigger control
4105 * mode is enabled/disabled.
4106 *
4107 * This optional callback can be used to configure the TDLS external
4108 * trigger control mode to the host driver.
4109 */
4110 int (*set_tdls_mode)(void *priv, int tdls_external_control);
6fc6879b 4111
3ab48492
KV
4112 /**
4113 * get_bss_transition_status - Get candidate BSS's transition status
4114 * @priv: Private driver interface data
4115 * @params: Candidate BSS list
4116 *
4117 * Get the accept or reject reason code for a list of BSS transition
4118 * candidates.
4119 */
4120 struct wpa_bss_candidate_info *
4121 (*get_bss_transition_status)(void *priv,
4122 struct wpa_bss_trans_info *params);
178553b7
VK
4123 /**
4124 * ignore_assoc_disallow - Configure driver to ignore assoc_disallow
4125 * @priv: Private driver interface data
4126 * @ignore_disallow: 0 to not ignore, 1 to ignore
4127 * Returns: 0 on success, -1 on failure
4128 */
4129 int (*ignore_assoc_disallow)(void *priv, int ignore_disallow);
b04854ce
AP
4130
4131 /**
4132 * set_bssid_blacklist - Set blacklist of BSSIDs to the driver
4133 * @priv: Private driver interface data
4134 * @num_bssid: Number of blacklist BSSIDs
4135 * @bssids: List of blacklisted BSSIDs
4136 */
4137 int (*set_bssid_blacklist)(void *priv, unsigned int num_bssid,
4138 const u8 *bssid);
3c67e977
VK
4139
4140 /**
4141 * update_connect_params - Update the connection parameters
4142 * @priv: Private driver interface data
4143 * @params: Association parameters
4144 * @mask: Bit mask indicating which parameters in @params have to be
4145 * updated
4146 * Returns: 0 on success, -1 on failure
4147 *
4148 * Update the connection parameters when in connected state so that the
4149 * driver uses the updated parameters for subsequent roaming. This is
4150 * used only with drivers that implement internal BSS selection and
4151 * roaming.
4152 */
4153 int (*update_connect_params)(
4154 void *priv, struct wpa_driver_associate_params *params,
4155 enum wpa_drv_update_connect_params_mask mask);
ba71cb82
SD
4156
4157 /**
4158 * send_external_auth_status - Indicate the status of external
4159 * authentication processing to the host driver.
4160 * @priv: Private driver interface data
4161 * @params: Status of authentication processing.
4162 * Returns: 0 on success, -1 on failure
4163 */
4164 int (*send_external_auth_status)(void *priv,
4165 struct external_auth *params);
5abc7823
VN
4166
4167 /**
4168 * set_4addr_mode - Set 4-address mode
4169 * @priv: Private driver interface data
4170 * @bridge_ifname: Bridge interface name
4171 * @val: 0 - disable 4addr mode, 1 - enable 4addr mode
4172 * Returns: 0 on success, < 0 on failure
4173 */
4174 int (*set_4addr_mode)(void *priv, const char *bridge_ifname, int val);
3ab48492 4175};
e0498677 4176
6fc6879b
JM
4177/**
4178 * enum wpa_event_type - Event type for wpa_supplicant_event() calls
4179 */
9646a8ab 4180enum wpa_event_type {
6fc6879b
JM
4181 /**
4182 * EVENT_ASSOC - Association completed
4183 *
4184 * This event needs to be delivered when the driver completes IEEE
4185 * 802.11 association or reassociation successfully.
4186 * wpa_driver_ops::get_bssid() is expected to provide the current BSSID
4187 * after this event has been generated. In addition, optional
4188 * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
4189 * more information about the association. If the driver interface gets
4190 * both of these events at the same time, it can also include the
4191 * assoc_info data in EVENT_ASSOC call.
4192 */
4193 EVENT_ASSOC,
4194
4195 /**
4196 * EVENT_DISASSOC - Association lost
4197 *
4198 * This event should be called when association is lost either due to
4199 * receiving deauthenticate or disassociate frame from the AP or when
c2a04078
JM
4200 * sending either of these frames to the current AP. If the driver
4201 * supports separate deauthentication event, EVENT_DISASSOC should only
4202 * be used for disassociation and EVENT_DEAUTH for deauthentication.
1d041bec 4203 * In AP mode, union wpa_event_data::disassoc_info is required.
6fc6879b
JM
4204 */
4205 EVENT_DISASSOC,
4206
4207 /**
4208 * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
4209 *
4210 * This event must be delivered when a Michael MIC error is detected by
4211 * the local driver. Additional data for event processing is
4212 * provided with union wpa_event_data::michael_mic_failure. This
4213 * information is used to request new encyption key and to initiate
4214 * TKIP countermeasures if needed.
4215 */
4216 EVENT_MICHAEL_MIC_FAILURE,
4217
4218 /**
4219 * EVENT_SCAN_RESULTS - Scan results available
4220 *
4221 * This event must be called whenever scan results are available to be
4222 * fetched with struct wpa_driver_ops::get_scan_results(). This event
4223 * is expected to be used some time after struct wpa_driver_ops::scan()
4224 * is called. If the driver provides an unsolicited event when the scan
4225 * has been completed, this event can be used to trigger
4226 * EVENT_SCAN_RESULTS call. If such event is not available from the
4227 * driver, the driver wrapper code is expected to use a registered
4228 * timeout to generate EVENT_SCAN_RESULTS call after the time that the
8d923a4a
JM
4229 * scan is expected to be completed. Optional information about
4230 * completed scan can be provided with union wpa_event_data::scan_info.
6fc6879b
JM
4231 */
4232 EVENT_SCAN_RESULTS,
4233
4234 /**
4235 * EVENT_ASSOCINFO - Report optional extra information for association
4236 *
4237 * This event can be used to report extra association information for
4238 * EVENT_ASSOC processing. This extra information includes IEs from
4239 * association frames and Beacon/Probe Response frames in union
4240 * wpa_event_data::assoc_info. EVENT_ASSOCINFO must be send just before
4241 * EVENT_ASSOC. Alternatively, the driver interface can include
4242 * assoc_info data in the EVENT_ASSOC call if it has all the
4243 * information available at the same point.
4244 */
4245 EVENT_ASSOCINFO,
4246
4247 /**
4248 * EVENT_INTERFACE_STATUS - Report interface status changes
4249 *
4250 * This optional event can be used to report changes in interface
4251 * status (interface added/removed) using union
4252 * wpa_event_data::interface_status. This can be used to trigger
4253 * wpa_supplicant to stop and re-start processing for the interface,
4254 * e.g., when a cardbus card is ejected/inserted.
4255 */
4256 EVENT_INTERFACE_STATUS,
4257
4258 /**
4259 * EVENT_PMKID_CANDIDATE - Report a candidate AP for pre-authentication
4260 *
4261 * This event can be used to inform wpa_supplicant about candidates for
4262 * RSN (WPA2) pre-authentication. If wpa_supplicant is not responsible
4263 * for scan request (ap_scan=2 mode), this event is required for
4264 * pre-authentication. If wpa_supplicant is performing scan request
4265 * (ap_scan=1), this event is optional since scan results can be used
4266 * to add pre-authentication candidates. union
4267 * wpa_event_data::pmkid_candidate is used to report the BSSID of the
4268 * candidate and priority of the candidate, e.g., based on the signal
4269 * strength, in order to try to pre-authenticate first with candidates
4270 * that are most likely targets for re-association.
4271 *
4272 * EVENT_PMKID_CANDIDATE can be called whenever the driver has updates
4273 * on the candidate list. In addition, it can be called for the current
4274 * AP and APs that have existing PMKSA cache entries. wpa_supplicant
4275 * will automatically skip pre-authentication in cases where a valid
4276 * PMKSA exists. When more than one candidate exists, this event should
4277 * be generated once for each candidate.
4278 *
4279 * Driver will be notified about successful pre-authentication with
4280 * struct wpa_driver_ops::add_pmkid() calls.
4281 */
4282 EVENT_PMKID_CANDIDATE,
4283
281ff0aa
GP
4284 /**
4285 * EVENT_TDLS - Request TDLS operation
4286 *
4287 * This event can be used to request a TDLS operation to be performed.
4288 */
4289 EVENT_TDLS,
4290
6fc6879b
JM
4291 /**
4292 * EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs
4293 *
4294 * The driver is expected to report the received FT IEs from
4295 * FT authentication sequence from the AP. The FT IEs are included in
4296 * the extra information in union wpa_event_data::ft_ies.
4297 */
11ef8d35
JM
4298 EVENT_FT_RESPONSE,
4299
4300 /**
4301 * EVENT_IBSS_RSN_START - Request RSN authentication in IBSS
4302 *
4303 * The driver can use this event to inform wpa_supplicant about a STA
4304 * in an IBSS with which protected frames could be exchanged. This
4305 * event starts RSN authentication with the other STA to authenticate
4306 * the STA and set up encryption keys with it.
4307 */
c2a04078
JM
4308 EVENT_IBSS_RSN_START,
4309
4310 /**
4311 * EVENT_AUTH - Authentication result
4312 *
4313 * This event should be called when authentication attempt has been
4314 * completed. This is only used if the driver supports separate
4315 * authentication step (struct wpa_driver_ops::authenticate).
4316 * Information about authentication result is included in
4317 * union wpa_event_data::auth.
4318 */
4319 EVENT_AUTH,
4320
4321 /**
4322 * EVENT_DEAUTH - Authentication lost
4323 *
4324 * This event should be called when authentication is lost either due
4325 * to receiving deauthenticate frame from the AP or when sending that
4326 * frame to the current AP.
1d041bec 4327 * In AP mode, union wpa_event_data::deauth_info is required.
c2a04078 4328 */
efa46078
JM
4329 EVENT_DEAUTH,
4330
4331 /**
4332 * EVENT_ASSOC_REJECT - Association rejected
4333 *
4334 * This event should be called when (re)association attempt has been
59ddf221 4335 * rejected by the AP. Information about the association response is
efa46078
JM
4336 * included in union wpa_event_data::assoc_reject.
4337 */
da1fb17c
JM
4338 EVENT_ASSOC_REJECT,
4339
4340 /**
4341 * EVENT_AUTH_TIMED_OUT - Authentication timed out
4342 */
4343 EVENT_AUTH_TIMED_OUT,
4344
4345 /**
4346 * EVENT_ASSOC_TIMED_OUT - Association timed out
4347 */
08fd8c15
JM
4348 EVENT_ASSOC_TIMED_OUT,
4349
fcf0f87d
JM
4350 /**
4351 * EVENT_WPS_BUTTON_PUSHED - Report hardware push button press for WPS
4352 */
f8b1f695
JM
4353 EVENT_WPS_BUTTON_PUSHED,
4354
4355 /**
4356 * EVENT_TX_STATUS - Report TX status
4357 */
4358 EVENT_TX_STATUS,
4359
4360 /**
4361 * EVENT_RX_FROM_UNKNOWN - Report RX from unknown STA
4362 */
4363 EVENT_RX_FROM_UNKNOWN,
4364
4365 /**
4366 * EVENT_RX_MGMT - Report RX of a management frame
4367 */
245519e0
JM
4368 EVENT_RX_MGMT,
4369
55777702
JM
4370 /**
4371 * EVENT_REMAIN_ON_CHANNEL - Remain-on-channel duration started
4372 *
4373 * This event is used to indicate when the driver has started the
4374 * requested remain-on-channel duration. Information about the
4375 * operation is included in union wpa_event_data::remain_on_channel.
4376 */
4377 EVENT_REMAIN_ON_CHANNEL,
4378
4379 /**
4380 * EVENT_CANCEL_REMAIN_ON_CHANNEL - Remain-on-channel timed out
4381 *
4382 * This event is used to indicate when the driver has completed
4383 * remain-on-channel duration, i.e., may noot be available on the
4384 * requested channel anymore. Information about the
4385 * operation is included in union wpa_event_data::remain_on_channel.
4386 */
4387 EVENT_CANCEL_REMAIN_ON_CHANNEL,
4388
a0e0d3bb
JM
4389 /**
4390 * EVENT_RX_PROBE_REQ - Indicate received Probe Request frame
4391 *
4392 * This event is used to indicate when a Probe Request frame has been
4393 * received. Information about the received frame is included in
504e905c
JM
4394 * union wpa_event_data::rx_probe_req. The driver is required to report
4395 * these events only after successfully completed probe_req_report()
4396 * commands to request the events (i.e., report parameter is non-zero)
4397 * in station mode. In AP mode, Probe Request frames should always be
4398 * reported.
a0e0d3bb 4399 */
a70a5d6d
JM
4400 EVENT_RX_PROBE_REQ,
4401
4402 /**
4403 * EVENT_NEW_STA - New wired device noticed
4404 *
4405 * This event is used to indicate that a new device has been detected
4406 * in a network that does not use association-like functionality (i.e.,
4407 * mainly wired Ethernet). This can be used to start EAPOL
4408 * authenticator when receiving a frame from a device. The address of
4409 * the device is included in union wpa_event_data::new_sta.
4410 */
a8e0505b
JM
4411 EVENT_NEW_STA,
4412
4413 /**
4414 * EVENT_EAPOL_RX - Report received EAPOL frame
4415 *
4416 * When in AP mode with hostapd, this event is required to be used to
2961bfa8 4417 * deliver the receive EAPOL frames from the driver.
a8e0505b 4418 */
b625473c
JM
4419 EVENT_EAPOL_RX,
4420
4421 /**
4422 * EVENT_SIGNAL_CHANGE - Indicate change in signal strength
4423 *
4424 * This event is used to indicate changes in the signal strength
4425 * observed in frames received from the current AP if signal strength
4426 * monitoring has been enabled with signal_monitor().
4427 */
8401a6b0
JM
4428 EVENT_SIGNAL_CHANGE,
4429
4430 /**
4431 * EVENT_INTERFACE_ENABLED - Notify that interface was enabled
4432 *
4433 * This event is used to indicate that the interface was enabled after
4434 * having been previously disabled, e.g., due to rfkill.
4435 */
4436 EVENT_INTERFACE_ENABLED,
4437
4438 /**
4439 * EVENT_INTERFACE_DISABLED - Notify that interface was disabled
4440 *
4441 * This event is used to indicate that the interface was disabled,
4442 * e.g., due to rfkill.
4443 */
b5c9da8d
JM
4444 EVENT_INTERFACE_DISABLED,
4445
4446 /**
4447 * EVENT_CHANNEL_LIST_CHANGED - Channel list changed
4448 *
4449 * This event is used to indicate that the channel list has changed,
4450 * e.g., because of a regulatory domain change triggered by scan
4451 * results including an AP advertising a country code.
4452 */
c973f386
JM
4453 EVENT_CHANNEL_LIST_CHANGED,
4454
4455 /**
4456 * EVENT_INTERFACE_UNAVAILABLE - Notify that interface is unavailable
4457 *
4458 * This event is used to indicate that the driver cannot maintain this
4459 * interface in its operation mode anymore. The most likely use for
4460 * this is to indicate that AP mode operation is not available due to
4461 * operating channel would need to be changed to a DFS channel when
4462 * the driver does not support radar detection and another virtual
4463 * interfaces caused the operating channel to change. Other similar
4464 * resource conflicts could also trigger this for station mode
5841958f
MK
4465 * interfaces. This event can be propagated when channel switching
4466 * fails.
c973f386 4467 */
7cfc4ac3
AGS
4468 EVENT_INTERFACE_UNAVAILABLE,
4469
4470 /**
4471 * EVENT_BEST_CHANNEL
4472 *
4473 * Driver generates this event whenever it detects a better channel
4474 * (e.g., based on RSSI or channel use). This information can be used
4475 * to improve channel selection for a new AP/P2P group.
4476 */
7d878ca7
JM
4477 EVENT_BEST_CHANNEL,
4478
4479 /**
4480 * EVENT_UNPROT_DEAUTH - Unprotected Deauthentication frame received
4481 *
4482 * This event should be called when a Deauthentication frame is dropped
4483 * due to it not being protected (MFP/IEEE 802.11w).
4484 * union wpa_event_data::unprot_deauth is required to provide more
4485 * details of the frame.
4486 */
4487 EVENT_UNPROT_DEAUTH,
4488
4489 /**
4490 * EVENT_UNPROT_DISASSOC - Unprotected Disassociation frame received
4491 *
4492 * This event should be called when a Disassociation frame is dropped
4493 * due to it not being protected (MFP/IEEE 802.11w).
4494 * union wpa_event_data::unprot_disassoc is required to provide more
4495 * details of the frame.
4496 */
4497 EVENT_UNPROT_DISASSOC,
0d7e5a3a
JB
4498
4499 /**
4500 * EVENT_STATION_LOW_ACK
4501 *
4502 * Driver generates this event whenever it detected that a particular
4503 * station was lost. Detection can be through massive transmission
4504 * failures for example.
4505 */
3ac17eba
JM
4506 EVENT_STATION_LOW_ACK,
4507
ea244d21
XC
4508 /**
4509 * EVENT_IBSS_PEER_LOST - IBSS peer not reachable anymore
4510 */
b14a210c
JB
4511 EVENT_IBSS_PEER_LOST,
4512
4513 /**
4514 * EVENT_DRIVER_GTK_REKEY - Device/driver did GTK rekey
4515 *
4516 * This event carries the new replay counter to notify wpa_supplicant
4517 * of the current EAPOL-Key Replay Counter in case the driver/firmware
4518 * completed Group Key Handshake while the host (including
4519 * wpa_supplicant was sleeping).
4520 */
cbdf3507
LC
4521 EVENT_DRIVER_GTK_REKEY,
4522
4523 /**
4524 * EVENT_SCHED_SCAN_STOPPED - Scheduled scan was stopped
4525 */
bcf24348
JB
4526 EVENT_SCHED_SCAN_STOPPED,
4527
4528 /**
4529 * EVENT_DRIVER_CLIENT_POLL_OK - Station responded to poll
4530 *
4531 * This event indicates that the station responded to the poll
4532 * initiated with @poll_client.
4533 */
dd840f79
JB
4534 EVENT_DRIVER_CLIENT_POLL_OK,
4535
4536 /**
4537 * EVENT_EAPOL_TX_STATUS - notify of EAPOL TX status
4538 */
1b487b8b
TP
4539 EVENT_EAPOL_TX_STATUS,
4540
4541 /**
4542 * EVENT_CH_SWITCH - AP or GO decided to switch channels
4543 *
4544 * Described in wpa_event_data.ch_switch
4545 * */
a884be9d
XC
4546 EVENT_CH_SWITCH,
4547
4548 /**
95f556f3
OD
4549 * EVENT_CH_SWITCH_STARTED - AP or GO started to switch channels
4550 *
4551 * This is a pre-switch event indicating the shortly following switch
4552 * of operating channels.
4553 *
4554 * Described in wpa_event_data.ch_switch
4555 */
4556 EVENT_CH_SWITCH_STARTED,
4557 /**
a884be9d
XC
4558 * EVENT_WNM - Request WNM operation
4559 *
4560 * This event can be used to request a WNM operation to be performed.
4561 */
3140803b
RM
4562 EVENT_WNM,
4563
4564 /**
4565 * EVENT_CONNECT_FAILED_REASON - Connection failure reason in AP mode
4566 *
4567 * This event indicates that the driver reported a connection failure
4568 * with the specified client (for example, max client reached, etc.) in
4569 * AP mode.
4570 */
04be54fa
SW
4571 EVENT_CONNECT_FAILED_REASON,
4572
4573 /**
480994da 4574 * EVENT_DFS_RADAR_DETECTED - Notify of radar detection
04be54fa
SW
4575 *
4576 * A radar has been detected on the supplied frequency, hostapd should
4577 * react accordingly (e.g., change channel).
4578 */
4579 EVENT_DFS_RADAR_DETECTED,
4580
4581 /**
480994da 4582 * EVENT_DFS_CAC_FINISHED - Notify that channel availability check has been completed
04be54fa
SW
4583 *
4584 * After a successful CAC, the channel can be marked clear and used.
4585 */
4586 EVENT_DFS_CAC_FINISHED,
4587
4588 /**
480994da 4589 * EVENT_DFS_CAC_ABORTED - Notify that channel availability check has been aborted
04be54fa
SW
4590 *
4591 * The CAC was not successful, and the channel remains in the previous
641c73f8 4592 * state. This may happen due to a radar being detected or other
04be54fa
SW
4593 * external influences.
4594 */
4595 EVENT_DFS_CAC_ABORTED,
4596
4597 /**
480994da 4598 * EVENT_DFS_NOP_FINISHED - Notify that non-occupancy period is over
04be54fa
SW
4599 *
4600 * The channel which was previously unavailable is now available again.
4601 */
0185007c
MK
4602 EVENT_DFS_NOP_FINISHED,
4603
18ae2377
JM
4604 /**
4605 * EVENT_SURVEY - Received survey data
4606 *
4607 * This event gets triggered when a driver query is issued for survey
4608 * data and the requested data becomes available. The returned data is
4609 * stored in struct survey_results. The results provide at most one
4610 * survey entry for each frequency and at minimum will provide one
4611 * survey entry for one frequency. The survey data can be os_malloc()'d
4612 * and then os_free()'d, so the event callback must only copy data.
4613 */
a5f40eff
JM
4614 EVENT_SURVEY,
4615
4616 /**
4617 * EVENT_SCAN_STARTED - Scan started
4618 *
4619 * This indicates that driver has started a scan operation either based
4620 * on a request from wpa_supplicant/hostapd or from another application.
4621 * EVENT_SCAN_RESULTS is used to indicate when the scan has been
4622 * completed (either successfully or by getting cancelled).
4623 */
253f2e37
AH
4624 EVENT_SCAN_STARTED,
4625
4626 /**
4627 * EVENT_AVOID_FREQUENCIES - Received avoid frequency range
4628 *
4629 * This event indicates a set of frequency ranges that should be avoided
4630 * to reduce issues due to interference or internal co-existence
4631 * information in the driver.
4632 */
a52024c9
BC
4633 EVENT_AVOID_FREQUENCIES,
4634
4635 /**
4636 * EVENT_NEW_PEER_CANDIDATE - new (unknown) mesh peer notification
4637 */
16689c7c 4638 EVENT_NEW_PEER_CANDIDATE,
a52024c9 4639
16689c7c
PX
4640 /**
4641 * EVENT_ACS_CHANNEL_SELECTED - Received selected channels by ACS
4642 *
4643 * Indicates a pair of primary and secondary channels chosen by ACS
4644 * in device.
4645 */
4646 EVENT_ACS_CHANNEL_SELECTED,
480994da
AK
4647
4648 /**
4649 * EVENT_DFS_CAC_STARTED - Notify that channel availability check has
4650 * been started.
4651 *
4652 * This event indicates that channel availability check has been started
4653 * on a DFS frequency by a driver that supports DFS Offload.
4654 */
4655 EVENT_DFS_CAC_STARTED,
a6f5b193
PX
4656
4657 /**
4658 * EVENT_P2P_LO_STOP - Notify that P2P listen offload is stopped
4659 */
4660 EVENT_P2P_LO_STOP,
68855672
JM
4661
4662 /**
4663 * EVENT_BEACON_LOSS - Beacon loss detected
4664 *
4665 * This event indicates that no Beacon frames has been received from
4666 * the current AP. This may indicate that the AP is not anymore in
4667 * range.
4668 */
4669 EVENT_BEACON_LOSS,
62c8c7f7
VT
4670
4671 /**
4672 * EVENT_DFS_PRE_CAC_EXPIRED - Notify that channel availability check
4673 * done previously (Pre-CAC) on the channel has expired. This would
4674 * normally be on a non-ETSI DFS regulatory domain. DFS state of the
4675 * channel will be moved from available to usable. A new CAC has to be
4676 * performed before start operating on this channel.
4677 */
4678 EVENT_DFS_PRE_CAC_EXPIRED,
ba71cb82
SD
4679
4680 /**
4681 * EVENT_EXTERNAL_AUTH - This event interface is used by host drivers
4682 * that do not define separate commands for authentication and
4683 * association (~WPA_DRIVER_FLAGS_SME) but offload the 802.11
4684 * authentication to wpa_supplicant. This event carries all the
4685 * necessary information from the host driver for the authentication to
4686 * happen.
4687 */
4688 EVENT_EXTERNAL_AUTH,
0a20bd7d
AS
4689
4690 /**
4691 * EVENT_PORT_AUTHORIZED - Notification that a connection is authorized
4692 *
4693 * This event should be indicated when the driver completes the 4-way
4694 * handshake. This event should be preceded by an EVENT_ASSOC that
4695 * indicates the completion of IEEE 802.11 association.
4696 */
4697 EVENT_PORT_AUTHORIZED,
e8ada160
T
4698
4699 /**
4700 * EVENT_STATION_OPMODE_CHANGED - Notify STA's HT/VHT operation mode
4701 * change event.
4702 */
4703 EVENT_STATION_OPMODE_CHANGED,
77a020a1
BG
4704
4705 /**
4706 * EVENT_INTERFACE_MAC_CHANGED - Notify that interface MAC changed
4707 *
4708 * This event is emitted when the MAC changes while the interface is
4709 * enabled. When an interface was disabled and becomes enabled, it
4710 * must be always assumed that the MAC possibly changed.
4711 */
4712 EVENT_INTERFACE_MAC_CHANGED,
1952b626
BP
4713
4714 /**
4715 * EVENT_WDS_STA_INTERFACE_STATUS - Notify WDS STA interface status
4716 *
4717 * This event is emitted when an interface is added/removed for WDS STA.
4718 */
4719 EVENT_WDS_STA_INTERFACE_STATUS,
9646a8ab 4720};
6fc6879b
JM
4721
4722
0185007c
MK
4723/**
4724 * struct freq_survey - Channel survey info
4725 *
4726 * @ifidx: Interface index in which this survey was observed
4727 * @freq: Center of frequency of the surveyed channel
4728 * @nf: Channel noise floor in dBm
4729 * @channel_time: Amount of time in ms the radio spent on the channel
4730 * @channel_time_busy: Amount of time in ms the radio detected some signal
4731 * that indicated to the radio the channel was not clear
4732 * @channel_time_rx: Amount of time the radio spent receiving data
4733 * @channel_time_tx: Amount of time the radio spent transmitting data
4734 * @filled: bitmask indicating which fields have been reported, see
4735 * SURVEY_HAS_* defines.
4736 * @list: Internal list pointers
4737 */
4738struct freq_survey {
4739 u32 ifidx;
4740 unsigned int freq;
4741 s8 nf;
4742 u64 channel_time;
4743 u64 channel_time_busy;
4744 u64 channel_time_rx;
4745 u64 channel_time_tx;
4746 unsigned int filled;
4747 struct dl_list list;
4748};
4749
4750#define SURVEY_HAS_NF BIT(0)
4751#define SURVEY_HAS_CHAN_TIME BIT(1)
4752#define SURVEY_HAS_CHAN_TIME_BUSY BIT(2)
4753#define SURVEY_HAS_CHAN_TIME_RX BIT(3)
4754#define SURVEY_HAS_CHAN_TIME_TX BIT(4)
4755
4756
6fc6879b
JM
4757/**
4758 * union wpa_event_data - Additional data for wpa_supplicant_event() calls
4759 */
4760union wpa_event_data {
4761 /**
4762 * struct assoc_info - Data for EVENT_ASSOC and EVENT_ASSOCINFO events
4763 *
4764 * This structure is optional for EVENT_ASSOC calls and required for
4765 * EVENT_ASSOCINFO calls. By using EVENT_ASSOC with this data, the
4766 * driver interface does not need to generate separate EVENT_ASSOCINFO
4767 * calls.
4768 */
4769 struct assoc_info {
39b08b5f
SP
4770 /**
4771 * reassoc - Flag to indicate association or reassociation
4772 */
4773 int reassoc;
4774
6fc6879b
JM
4775 /**
4776 * req_ies - (Re)Association Request IEs
4777 *
4778 * If the driver generates WPA/RSN IE, this event data must be
4779 * returned for WPA handshake to have needed information. If
4780 * wpa_supplicant-generated WPA/RSN IE is used, this
4781 * information event is optional.
4782 *
4783 * This should start with the first IE (fixed fields before IEs
4784 * are not included).
4785 */
1d041bec 4786 const u8 *req_ies;
6fc6879b
JM
4787
4788 /**
4789 * req_ies_len - Length of req_ies in bytes
4790 */
4791 size_t req_ies_len;
4792
4793 /**
4794 * resp_ies - (Re)Association Response IEs
4795 *
4796 * Optional association data from the driver. This data is not
4797 * required WPA, but may be useful for some protocols and as
4798 * such, should be reported if this is available to the driver
4799 * interface.
4800 *
4801 * This should start with the first IE (fixed fields before IEs
4802 * are not included).
4803 */
1d041bec 4804 const u8 *resp_ies;
6fc6879b
JM
4805
4806 /**
4807 * resp_ies_len - Length of resp_ies in bytes
4808 */
4809 size_t resp_ies_len;
4810
5b092fb6
JM
4811 /**
4812 * resp_frame - (Re)Association Response frame
4813 */
4814 const u8 *resp_frame;
4815
4816 /**
4817 * resp_frame_len - (Re)Association Response frame length
4818 */
4819 size_t resp_frame_len;
4820
6fc6879b
JM
4821 /**
4822 * beacon_ies - Beacon or Probe Response IEs
4823 *
4824 * Optional Beacon/ProbeResp data: IEs included in Beacon or
4825 * Probe Response frames from the current AP (i.e., the one
4826 * that the client just associated with). This information is
4827 * used to update WPA/RSN IE for the AP. If this field is not
4828 * set, the results from previous scan will be used. If no
4829 * data for the new AP is found, scan results will be requested
4830 * again (without scan request). At this point, the driver is
4831 * expected to provide WPA/RSN IE for the AP (if WPA/WPA2 is
4832 * used).
4833 *
4834 * This should start with the first IE (fixed fields before IEs
4835 * are not included).
4836 */
1d041bec 4837 const u8 *beacon_ies;
6fc6879b
JM
4838
4839 /**
4840 * beacon_ies_len - Length of beacon_ies */
4841 size_t beacon_ies_len;
4832ecd7
JM
4842
4843 /**
4844 * freq - Frequency of the operational channel in MHz
4845 */
4846 unsigned int freq;
1d041bec 4847
0f14a44e
EP
4848 /**
4849 * wmm_params - WMM parameters used in this association.
4850 */
4851 struct wmm_params wmm_params;
4852
1d041bec
JM
4853 /**
4854 * addr - Station address (for AP mode)
4855 */
4856 const u8 *addr;
b41f2684
CL
4857
4858 /**
4859 * The following is the key management offload information
4860 * @authorized
4861 * @key_replay_ctr
4862 * @key_replay_ctr_len
4863 * @ptk_kck
4864 * @ptk_kek_len
4865 * @ptk_kek
4866 * @ptk_kek_len
4867 */
4868
4869 /**
4870 * authorized - Status of key management offload,
4871 * 1 = successful
4872 */
4873 int authorized;
4874
4875 /**
4876 * key_replay_ctr - Key replay counter value last used
4877 * in a valid EAPOL-Key frame
4878 */
4879 const u8 *key_replay_ctr;
4880
4881 /**
4882 * key_replay_ctr_len - The length of key_replay_ctr
4883 */
4884 size_t key_replay_ctr_len;
4885
4886 /**
4887 * ptk_kck - The derived PTK KCK
4888 */
4889 const u8 *ptk_kck;
4890
4891 /**
4892 * ptk_kek_len - The length of ptk_kck
4893 */
4894 size_t ptk_kck_len;
4895
4896 /**
4897 * ptk_kek - The derived PTK KEK
ad295f3b
VK
4898 * This is used in key management offload and also in FILS SK
4899 * offload.
b41f2684
CL
4900 */
4901 const u8 *ptk_kek;
4902
4903 /**
4904 * ptk_kek_len - The length of ptk_kek
4905 */
4906 size_t ptk_kek_len;
f32227ed
RJ
4907
4908 /**
4909 * subnet_status - The subnet status:
4910 * 0 = unknown, 1 = unchanged, 2 = changed
4911 */
4912 u8 subnet_status;
ad295f3b
VK
4913
4914 /**
4915 * The following information is used in FILS SK offload
4916 * @fils_erp_next_seq_num
4917 * @fils_pmk
4918 * @fils_pmk_len
4919 * @fils_pmkid
4920 */
4921
4922 /**
4923 * fils_erp_next_seq_num - The next sequence number to use in
4924 * FILS ERP messages
4925 */
4926 u16 fils_erp_next_seq_num;
4927
4928 /**
4929 * fils_pmk - A new PMK if generated in case of FILS
4930 * authentication
4931 */
4932 const u8 *fils_pmk;
4933
4934 /**
4935 * fils_pmk_len - Length of fils_pmk
4936 */
4937 size_t fils_pmk_len;
4938
4939 /**
4940 * fils_pmkid - PMKID used or generated in FILS authentication
4941 */
4942 const u8 *fils_pmkid;
6fc6879b
JM
4943 } assoc_info;
4944
1d041bec
JM
4945 /**
4946 * struct disassoc_info - Data for EVENT_DISASSOC events
4947 */
4948 struct disassoc_info {
4949 /**
4950 * addr - Station address (for AP mode)
4951 */
4952 const u8 *addr;
0544b242
JM
4953
4954 /**
4955 * reason_code - Reason Code (host byte order) used in
4956 * Deauthentication frame
4957 */
4958 u16 reason_code;
75bde05d
JM
4959
4960 /**
4961 * ie - Optional IE(s) in Disassociation frame
4962 */
4963 const u8 *ie;
4964
4965 /**
4966 * ie_len - Length of ie buffer in octets
4967 */
4968 size_t ie_len;
3d9975d5
JM
4969
4970 /**
4971 * locally_generated - Whether the frame was locally generated
4972 */
4973 int locally_generated;
1d041bec
JM
4974 } disassoc_info;
4975
4976 /**
4977 * struct deauth_info - Data for EVENT_DEAUTH events
4978 */
4979 struct deauth_info {
4980 /**
4981 * addr - Station address (for AP mode)
4982 */
4983 const u8 *addr;
0544b242
JM
4984
4985 /**
4986 * reason_code - Reason Code (host byte order) used in
4987 * Deauthentication frame
4988 */
4989 u16 reason_code;
75bde05d
JM
4990
4991 /**
4992 * ie - Optional IE(s) in Deauthentication frame
4993 */
4994 const u8 *ie;
4995
4996 /**
4997 * ie_len - Length of ie buffer in octets
4998 */
4999 size_t ie_len;
3d9975d5
JM
5000
5001 /**
5002 * locally_generated - Whether the frame was locally generated
5003 */
5004 int locally_generated;
1d041bec
JM
5005 } deauth_info;
5006
6fc6879b
JM
5007 /**
5008 * struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE
5009 */
5010 struct michael_mic_failure {
5011 int unicast;
ad1e68e6 5012 const u8 *src;
6fc6879b
JM
5013 } michael_mic_failure;
5014
5015 /**
5016 * struct interface_status - Data for EVENT_INTERFACE_STATUS
5017 */
5018 struct interface_status {
45e3fc72 5019 unsigned int ifindex;
6fc6879b
JM
5020 char ifname[100];
5021 enum {
5022 EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED
5023 } ievent;
5024 } interface_status;
5025
5026 /**
5027 * struct pmkid_candidate - Data for EVENT_PMKID_CANDIDATE
5028 */
5029 struct pmkid_candidate {
5030 /** BSSID of the PMKID candidate */
5031 u8 bssid[ETH_ALEN];
5032 /** Smaller the index, higher the priority */
5033 int index;
5034 /** Whether RSN IE includes pre-authenticate flag */
5035 int preauth;
5036 } pmkid_candidate;
5037
281ff0aa
GP
5038 /**
5039 * struct tdls - Data for EVENT_TDLS
5040 */
5041 struct tdls {
5042 u8 peer[ETH_ALEN];
5043 enum {
5044 TDLS_REQUEST_SETUP,
c10ca2a6
SD
5045 TDLS_REQUEST_TEARDOWN,
5046 TDLS_REQUEST_DISCOVER,
281ff0aa
GP
5047 } oper;
5048 u16 reason_code; /* for teardown */
5049 } tdls;
5050
a884be9d
XC
5051 /**
5052 * struct wnm - Data for EVENT_WNM
5053 */
5054 struct wnm {
5055 u8 addr[ETH_ALEN];
5056 enum {
5057 WNM_OPER_SLEEP,
5058 } oper;
5059 enum {
5060 WNM_SLEEP_ENTER,
5061 WNM_SLEEP_EXIT
5062 } sleep_action;
5063 int sleep_intval;
5064 u16 reason_code;
5065 u8 *buf;
5066 u16 buf_len;
5067 } wnm;
5068
6fc6879b
JM
5069 /**
5070 * struct ft_ies - FT information elements (EVENT_FT_RESPONSE)
5071 *
5072 * During FT (IEEE 802.11r) authentication sequence, the driver is
5073 * expected to use this event to report received FT IEs (MDIE, FTIE,
5074 * RSN IE, TIE, possible resource request) to the supplicant. The FT
5075 * IEs for the next message will be delivered through the
5076 * struct wpa_driver_ops::update_ft_ies() callback.
5077 */
5078 struct ft_ies {
5079 const u8 *ies;
5080 size_t ies_len;
5081 int ft_action;
5082 u8 target_ap[ETH_ALEN];
babfbf15
JM
5083 /** Optional IE(s), e.g., WMM TSPEC(s), for RIC-Request */
5084 const u8 *ric_ies;
5085 /** Length of ric_ies buffer in octets */
5086 size_t ric_ies_len;
6fc6879b 5087 } ft_ies;
11ef8d35
JM
5088
5089 /**
5090 * struct ibss_rsn_start - Data for EVENT_IBSS_RSN_START
5091 */
5092 struct ibss_rsn_start {
5093 u8 peer[ETH_ALEN];
5094 } ibss_rsn_start;
c2a04078
JM
5095
5096 /**
5097 * struct auth_info - Data for EVENT_AUTH events
5098 */
5099 struct auth_info {
5100 u8 peer[ETH_ALEN];
a52eba0f 5101 u8 bssid[ETH_ALEN];
c2a04078 5102 u16 auth_type;
a52eba0f 5103 u16 auth_transaction;
c2a04078
JM
5104 u16 status_code;
5105 const u8 *ies;
5106 size_t ies_len;
5107 } auth;
efa46078
JM
5108
5109 /**
5110 * struct assoc_reject - Data for EVENT_ASSOC_REJECT events
5111 */
5112 struct assoc_reject {
59ddf221
JM
5113 /**
5114 * bssid - BSSID of the AP that rejected association
5115 */
5116 const u8 *bssid;
5117
efa46078
JM
5118 /**
5119 * resp_ies - (Re)Association Response IEs
5120 *
5121 * Optional association data from the driver. This data is not
5122 * required WPA, but may be useful for some protocols and as
5123 * such, should be reported if this is available to the driver
5124 * interface.
5125 *
5126 * This should start with the first IE (fixed fields before IEs
5127 * are not included).
5128 */
59ddf221 5129 const u8 *resp_ies;
efa46078
JM
5130
5131 /**
5132 * resp_ies_len - Length of resp_ies in bytes
5133 */
5134 size_t resp_ies_len;
5135
5136 /**
5137 * status_code - Status Code from (Re)association Response
5138 */
5139 u16 status_code;
9a5160f5
JM
5140
5141 /**
5142 * timed_out - Whether failure is due to timeout (etc.) rather
5143 * than explicit rejection response from the AP.
5144 */
5145 int timed_out;
3f23260d
PK
5146
5147 /**
5148 * timeout_reason - Reason for the timeout
5149 */
5150 const char *timeout_reason;
ad295f3b
VK
5151
5152 /**
5153 * fils_erp_next_seq_num - The next sequence number to use in
5154 * FILS ERP messages
5155 */
5156 u16 fils_erp_next_seq_num;
efa46078 5157 } assoc_reject;
da1fb17c
JM
5158
5159 struct timeout_event {
5160 u8 addr[ETH_ALEN];
5161 } timeout_event;
08fd8c15 5162
f8b1f695
JM
5163 /**
5164 * struct tx_status - Data for EVENT_TX_STATUS events
5165 */
5166 struct tx_status {
5167 u16 type;
5168 u16 stype;
5169 const u8 *dst;
5170 const u8 *data;
5171 size_t data_len;
5172 int ack;
5173 } tx_status;
5174
5175 /**
5176 * struct rx_from_unknown - Data for EVENT_RX_FROM_UNKNOWN events
5177 */
5178 struct rx_from_unknown {
9b90955e
JB
5179 const u8 *bssid;
5180 const u8 *addr;
5181 int wds;
f8b1f695
JM
5182 } rx_from_unknown;
5183
5184 /**
5185 * struct rx_mgmt - Data for EVENT_RX_MGMT events
5186 */
5187 struct rx_mgmt {
b57e086c 5188 const u8 *frame;
f8b1f695 5189 size_t frame_len;
2a8b7416 5190 u32 datarate;
55777702 5191
1d91f504
SW
5192 /**
5193 * drv_priv - Pointer to store driver private BSS information
5194 *
5195 * If not set to NULL, this is used for comparison with
5196 * hostapd_data->drv_priv to determine which BSS should process
5197 * the frame.
5198 */
5199 void *drv_priv;
5200
55777702
JM
5201 /**
5202 * freq - Frequency (in MHz) on which the frame was received
5203 */
5204 int freq;
2d2ecf51
JM
5205
5206 /**
5207 * ssi_signal - Signal strength in dBm (or 0 if not available)
5208 */
5209 int ssi_signal;
dbfb8e82 5210 } rx_mgmt;
55777702
JM
5211
5212 /**
5213 * struct remain_on_channel - Data for EVENT_REMAIN_ON_CHANNEL events
5214 *
5215 * This is also used with EVENT_CANCEL_REMAIN_ON_CHANNEL events.
5216 */
5217 struct remain_on_channel {
5218 /**
5219 * freq - Channel frequency in MHz
5220 */
5221 unsigned int freq;
5222
5223 /**
5224 * duration - Duration to remain on the channel in milliseconds
5225 */
5226 unsigned int duration;
5227 } remain_on_channel;
5228
8d923a4a
JM
5229 /**
5230 * struct scan_info - Optional data for EVENT_SCAN_RESULTS events
5231 * @aborted: Whether the scan was aborted
5232 * @freqs: Scanned frequencies in MHz (%NULL = all channels scanned)
5233 * @num_freqs: Number of entries in freqs array
5234 * @ssids: Scanned SSIDs (%NULL or zero-length SSID indicates wildcard
5235 * SSID)
5236 * @num_ssids: Number of entries in ssids array
adcd7c4b
KV
5237 * @external_scan: Whether the scan info is for an external scan
5238 * @nl_scan_event: 1 if the source of this scan event is a normal scan,
5239 * 0 if the source of the scan event is a vendor scan
c16b9f8d
AS
5240 * @scan_start_tsf: Time when the scan started in terms of TSF of the
5241 * BSS that the interface that requested the scan is connected to
5242 * (if available).
5243 * @scan_start_tsf_bssid: The BSSID according to which %scan_start_tsf
5244 * is set.
8d923a4a
JM
5245 */
5246 struct scan_info {
5247 int aborted;
5248 const int *freqs;
5249 size_t num_freqs;
5250 struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
5251 size_t num_ssids;
adcd7c4b
KV
5252 int external_scan;
5253 int nl_scan_event;
c16b9f8d
AS
5254 u64 scan_start_tsf;
5255 u8 scan_start_tsf_bssid[ETH_ALEN];
8d923a4a 5256 } scan_info;
245519e0 5257
a0e0d3bb
JM
5258 /**
5259 * struct rx_probe_req - Data for EVENT_RX_PROBE_REQ events
5260 */
5261 struct rx_probe_req {
5262 /**
5263 * sa - Source address of the received Probe Request frame
5264 */
5265 const u8 *sa;
5266
04a85e44
JM
5267 /**
5268 * da - Destination address of the received Probe Request frame
5269 * or %NULL if not available
5270 */
5271 const u8 *da;
5272
5273 /**
5274 * bssid - BSSID of the received Probe Request frame or %NULL
5275 * if not available
5276 */
5277 const u8 *bssid;
5278
a0e0d3bb
JM
5279 /**
5280 * ie - IEs from the Probe Request body
5281 */
5282 const u8 *ie;
5283
5284 /**
5285 * ie_len - Length of ie buffer in octets
5286 */
5287 size_t ie_len;
baf513d6
JB
5288
5289 /**
5290 * signal - signal strength in dBm (or 0 if not available)
5291 */
5292 int ssi_signal;
a0e0d3bb 5293 } rx_probe_req;
a70a5d6d
JM
5294
5295 /**
5296 * struct new_sta - Data for EVENT_NEW_STA events
5297 */
5298 struct new_sta {
5299 const u8 *addr;
5300 } new_sta;
a8e0505b
JM
5301
5302 /**
5303 * struct eapol_rx - Data for EVENT_EAPOL_RX events
5304 */
5305 struct eapol_rx {
5306 const u8 *src;
5307 const u8 *data;
5308 size_t data_len;
5309 } eapol_rx;
b625473c
JM
5310
5311 /**
1c5c7273 5312 * signal_change - Data for EVENT_SIGNAL_CHANGE events
b625473c 5313 */
1c5c7273 5314 struct wpa_signal_info signal_change;
7cfc4ac3
AGS
5315
5316 /**
5317 * struct best_channel - Data for EVENT_BEST_CHANNEL events
5318 * @freq_24: Best 2.4 GHz band channel frequency in MHz
5319 * @freq_5: Best 5 GHz band channel frequency in MHz
5320 * @freq_overall: Best channel frequency in MHz
5321 *
5322 * 0 can be used to indicate no preference in either band.
5323 */
5324 struct best_channel {
5325 int freq_24;
5326 int freq_5;
5327 int freq_overall;
5328 } best_chan;
7d878ca7
JM
5329
5330 struct unprot_deauth {
5331 const u8 *sa;
5332 const u8 *da;
5333 u16 reason_code;
5334 } unprot_deauth;
5335
5336 struct unprot_disassoc {
5337 const u8 *sa;
5338 const u8 *da;
5339 u16 reason_code;
5340 } unprot_disassoc;
0d7e5a3a
JB
5341
5342 /**
5343 * struct low_ack - Data for EVENT_STATION_LOW_ACK events
5344 * @addr: station address
68855672
JM
5345 * @num_packets: Number of packets lost (consecutive packets not
5346 * acknowledged)
0d7e5a3a
JB
5347 */
5348 struct low_ack {
5349 u8 addr[ETH_ALEN];
68855672 5350 u32 num_packets;
0d7e5a3a 5351 } low_ack;
3ac17eba 5352
ea244d21
XC
5353 /**
5354 * struct ibss_peer_lost - Data for EVENT_IBSS_PEER_LOST
5355 */
5356 struct ibss_peer_lost {
5357 u8 peer[ETH_ALEN];
5358 } ibss_peer_lost;
b14a210c
JB
5359
5360 /**
5361 * struct driver_gtk_rekey - Data for EVENT_DRIVER_GTK_REKEY
5362 */
5363 struct driver_gtk_rekey {
5364 const u8 *bssid;
5365 const u8 *replay_ctr;
5366 } driver_gtk_rekey;
bcf24348
JB
5367
5368 /**
5369 * struct client_poll - Data for EVENT_DRIVER_CLIENT_POLL_OK events
5370 * @addr: station address
5371 */
5372 struct client_poll {
5373 u8 addr[ETH_ALEN];
5374 } client_poll;
dd840f79
JB
5375
5376 /**
5377 * struct eapol_tx_status
5378 * @dst: Original destination
5379 * @data: Data starting with IEEE 802.1X header (!)
5380 * @data_len: Length of data
5381 * @ack: Indicates ack or lost frame
5382 *
5383 * This corresponds to hapd_send_eapol if the frame sent
5384 * there isn't just reported as EVENT_TX_STATUS.
5385 */
5386 struct eapol_tx_status {
5387 const u8 *dst;
5388 const u8 *data;
5389 int data_len;
5390 int ack;
5391 } eapol_tx_status;
1b487b8b
TP
5392
5393 /**
5394 * struct ch_switch
5395 * @freq: Frequency of new channel in MHz
5396 * @ht_enabled: Whether this is an HT channel
5397 * @ch_offset: Secondary channel offset
8d1fdde7
JD
5398 * @ch_width: Channel width
5399 * @cf1: Center frequency 1
5400 * @cf2: Center frequency 2
1b487b8b
TP
5401 */
5402 struct ch_switch {
5403 int freq;
5404 int ht_enabled;
5405 int ch_offset;
8d1fdde7
JD
5406 enum chan_width ch_width;
5407 int cf1;
5408 int cf2;
1b487b8b 5409 } ch_switch;
3140803b
RM
5410
5411 /**
5412 * struct connect_failed - Data for EVENT_CONNECT_FAILED_REASON
5413 * @addr: Remote client address
5414 * @code: Reason code for connection failure
5415 */
5416 struct connect_failed_reason {
5417 u8 addr[ETH_ALEN];
5418 enum {
5419 MAX_CLIENT_REACHED,
5420 BLOCKED_CLIENT
5421 } code;
5422 } connect_failed_reason;
04be54fa
SW
5423
5424 /**
5425 * struct dfs_event - Data for radar detected events
5426 * @freq: Frequency of the channel in MHz
5427 */
5428 struct dfs_event {
5429 int freq;
846de15d
JD
5430 int ht_enabled;
5431 int chan_offset;
5432 enum chan_width chan_width;
5433 int cf1;
5434 int cf2;
04be54fa 5435 } dfs_event;
0185007c
MK
5436
5437 /**
5438 * survey_results - Survey result data for EVENT_SURVEY
5439 * @freq_filter: Requested frequency survey filter, 0 if request
5440 * was for all survey data
4e8f31e2 5441 * @survey_list: Linked list of survey data (struct freq_survey)
0185007c
MK
5442 */
5443 struct survey_results {
5444 unsigned int freq_filter;
5445 struct dl_list survey_list; /* struct freq_survey */
5446 } survey_results;
795baf77
AS
5447
5448 /**
5449 * channel_list_changed - Data for EVENT_CHANNEL_LIST_CHANGED
5450 * @initiator: Initiator of the regulatory change
142817b2
JM
5451 * @type: Regulatory change type
5452 * @alpha2: Country code (or "" if not available)
795baf77
AS
5453 */
5454 struct channel_list_changed {
5455 enum reg_change_initiator initiator;
142817b2
JM
5456 enum reg_type type;
5457 char alpha2[3];
795baf77 5458 } channel_list_changed;
253f2e37
AH
5459
5460 /**
5461 * freq_range - List of frequency ranges
5462 *
5463 * This is used as the data with EVENT_AVOID_FREQUENCIES.
5464 */
5465 struct wpa_freq_range_list freq_range;
a52024c9
BC
5466
5467 /**
5468 * struct mesh_peer
5469 *
5470 * @peer: Peer address
5471 * @ies: Beacon IEs
5472 * @ie_len: Length of @ies
5473 *
5474 * Notification of new candidate mesh peer.
5475 */
5476 struct mesh_peer {
5477 const u8 *peer;
5478 const u8 *ies;
5479 size_t ie_len;
5480 } mesh_peer;
5481
16689c7c
PX
5482 /**
5483 * struct acs_selected_channels - Data for EVENT_ACS_CHANNEL_SELECTED
5484 * @pri_channel: Selected primary channel
5485 * @sec_channel: Selected secondary channel
857d9422
MM
5486 * @vht_seg0_center_ch: VHT mode Segment0 center channel
5487 * @vht_seg1_center_ch: VHT mode Segment1 center channel
5488 * @ch_width: Selected Channel width by driver. Driver may choose to
5489 * change hostapd configured ACS channel width due driver internal
5490 * channel restrictions.
3784c058 5491 * hw_mode: Selected band (used with hw_mode=any)
16689c7c
PX
5492 */
5493 struct acs_selected_channels {
5494 u8 pri_channel;
5495 u8 sec_channel;
857d9422
MM
5496 u8 vht_seg0_center_ch;
5497 u8 vht_seg1_center_ch;
5498 u16 ch_width;
3784c058 5499 enum hostapd_hw_mode hw_mode;
16689c7c 5500 } acs_selected_channels;
a6f5b193
PX
5501
5502 /**
5503 * struct p2p_lo_stop - Reason code for P2P Listen offload stop event
5504 * @reason_code: Reason for stopping offload
5505 * P2P_LO_STOPPED_REASON_COMPLETE: Listen offload finished as
5506 * scheduled.
5507 * P2P_LO_STOPPED_REASON_RECV_STOP_CMD: Host requested offload to
5508 * be stopped.
5509 * P2P_LO_STOPPED_REASON_INVALID_PARAM: Invalid listen offload
5510 * parameters.
5511 * P2P_LO_STOPPED_REASON_NOT_SUPPORTED: Listen offload not
5512 * supported by device.
5513 */
5514 struct p2p_lo_stop {
5515 enum {
5516 P2P_LO_STOPPED_REASON_COMPLETE = 0,
5517 P2P_LO_STOPPED_REASON_RECV_STOP_CMD,
5518 P2P_LO_STOPPED_REASON_INVALID_PARAM,
5519 P2P_LO_STOPPED_REASON_NOT_SUPPORTED,
5520 } reason_code;
5521 } p2p_lo_stop;
ba71cb82
SD
5522
5523 /* For EVENT_EXTERNAL_AUTH */
5524 struct external_auth external_auth;
e8ada160
T
5525
5526 /**
5527 * struct sta_opmode - Station's operation mode change event
5528 * @addr: The station MAC address
5529 * @smps_mode: SMPS mode of the station
5530 * @chan_width: Channel width of the station
5531 * @rx_nss: RX_NSS of the station
5532 *
5533 * This is used as data with EVENT_STATION_OPMODE_CHANGED.
5534 */
5535 struct sta_opmode {
5536 const u8 *addr;
5537 enum smps_mode smps_mode;
5538 enum chan_width chan_width;
5539 u8 rx_nss;
5540 } sta_opmode;
1952b626
BP
5541
5542 /**
5543 * struct wds_sta_interface - Data for EVENT_WDS_STA_INTERFACE_STATUS.
5544 */
5545 struct wds_sta_interface {
5546 const u8 *sta_addr;
5547 const char *ifname;
5548 enum {
5549 INTERFACE_ADDED,
5550 INTERFACE_REMOVED
5551 } istatus;
5552 } wds_sta_interface;
6fc6879b
JM
5553};
5554
5555/**
5556 * wpa_supplicant_event - Report a driver event for wpa_supplicant
5557 * @ctx: Context pointer (wpa_s); this is the ctx variable registered
5558 * with struct wpa_driver_ops::init()
5559 * @event: event type (defined above)
5560 * @data: possible extra data for the event
5561 *
5562 * Driver wrapper code should call this function whenever an event is received
5563 * from the driver.
5564 */
9646a8ab 5565void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
6fc6879b
JM
5566 union wpa_event_data *data);
5567
45e3fc72
RM
5568/**
5569 * wpa_supplicant_event_global - Report a driver event for wpa_supplicant
5570 * @ctx: Context pointer (wpa_s); this is the ctx variable registered
5571 * with struct wpa_driver_ops::init()
5572 * @event: event type (defined above)
5573 * @data: possible extra data for the event
5574 *
5575 * Same as wpa_supplicant_event(), but we search for the interface in
5576 * wpa_global.
5577 */
5578void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
5579 union wpa_event_data *data);
c5121837 5580
1d041bec
JM
5581/*
5582 * The following inline functions are provided for convenience to simplify
5583 * event indication for some of the common events.
5584 */
5585
5586static inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie,
39b08b5f 5587 size_t ielen, int reassoc)
1d041bec
JM
5588{
5589 union wpa_event_data event;
5590 os_memset(&event, 0, sizeof(event));
39b08b5f 5591 event.assoc_info.reassoc = reassoc;
1d041bec
JM
5592 event.assoc_info.req_ies = ie;
5593 event.assoc_info.req_ies_len = ielen;
5594 event.assoc_info.addr = addr;
5595 wpa_supplicant_event(ctx, EVENT_ASSOC, &event);
5596}
5597
5598static inline void drv_event_disassoc(void *ctx, const u8 *addr)
5599{
5600 union wpa_event_data event;
5601 os_memset(&event, 0, sizeof(event));
5602 event.disassoc_info.addr = addr;
5603 wpa_supplicant_event(ctx, EVENT_DISASSOC, &event);
5604}
c5121837 5605
baac6490
JM
5606static inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data,
5607 size_t data_len)
5608{
5609 union wpa_event_data event;
5610 os_memset(&event, 0, sizeof(event));
5611 event.eapol_rx.src = src;
5612 event.eapol_rx.data = data;
5613 event.eapol_rx.data_len = data_len;
5614 wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);
5615}
5616
aea855d7
JM
5617/* driver_common.c */
5618void wpa_scan_results_free(struct wpa_scan_results *res);
9e0e6902 5619
6c3771d7
BG
5620/* Convert wpa_event_type to a string for logging */
5621const char * event_to_string(enum wpa_event_type event);
5622
7a4a93b9
DW
5623/* Convert chan_width to a string for logging and control interfaces */
5624const char * channel_width_to_string(enum chan_width width);
5625
d706e0d7
MV
5626int channel_width_to_int(enum chan_width width);
5627
3eafc494
JM
5628int ht_supported(const struct hostapd_hw_modes *mode);
5629int vht_supported(const struct hostapd_hw_modes *mode);
5630
88cb27c7
DS
5631struct wowlan_triggers *
5632wpa_get_wowlan_triggers(const char *wowlan_triggers,
5633 const struct wpa_driver_capa *capa);
4d7aab78
EL
5634/* Convert driver flag to string */
5635const char * driver_flag_to_string(u64 flag);
88cb27c7 5636
fcc61230 5637/* NULL terminated array of linked in driver wrappers */
8b423edb 5638extern const struct wpa_driver_ops *const wpa_drivers[];
fcc61230 5639
39ab6a5d
JM
5640
5641/* Available drivers */
5642
5643#ifdef CONFIG_DRIVER_WEXT
5644extern const struct wpa_driver_ops wpa_driver_wext_ops; /* driver_wext.c */
5645#endif /* CONFIG_DRIVER_WEXT */
5646#ifdef CONFIG_DRIVER_NL80211
5647/* driver_nl80211.c */
5648extern const struct wpa_driver_ops wpa_driver_nl80211_ops;
5649#endif /* CONFIG_DRIVER_NL80211 */
5650#ifdef CONFIG_DRIVER_HOSTAP
5651extern const struct wpa_driver_ops wpa_driver_hostap_ops; /* driver_hostap.c */
5652#endif /* CONFIG_DRIVER_HOSTAP */
5653#ifdef CONFIG_DRIVER_BSD
5654extern const struct wpa_driver_ops wpa_driver_bsd_ops; /* driver_bsd.c */
5655#endif /* CONFIG_DRIVER_BSD */
5656#ifdef CONFIG_DRIVER_OPENBSD
5657/* driver_openbsd.c */
5658extern const struct wpa_driver_ops wpa_driver_openbsd_ops;
5659#endif /* CONFIG_DRIVER_OPENBSD */
5660#ifdef CONFIG_DRIVER_NDIS
5661extern struct wpa_driver_ops wpa_driver_ndis_ops; /* driver_ndis.c */
5662#endif /* CONFIG_DRIVER_NDIS */
5663#ifdef CONFIG_DRIVER_WIRED
5664extern const struct wpa_driver_ops wpa_driver_wired_ops; /* driver_wired.c */
5665#endif /* CONFIG_DRIVER_WIRED */
5666#ifdef CONFIG_DRIVER_MACSEC_QCA
5667/* driver_macsec_qca.c */
5668extern const struct wpa_driver_ops wpa_driver_macsec_qca_ops;
5669#endif /* CONFIG_DRIVER_MACSEC_QCA */
f014d9db
SD
5670#ifdef CONFIG_DRIVER_MACSEC_LINUX
5671/* driver_macsec_linux.c */
5672extern const struct wpa_driver_ops wpa_driver_macsec_linux_ops;
5673#endif /* CONFIG_DRIVER_MACSEC_LINUX */
39ab6a5d
JM
5674#ifdef CONFIG_DRIVER_ROBOSWITCH
5675/* driver_roboswitch.c */
5676extern const struct wpa_driver_ops wpa_driver_roboswitch_ops;
5677#endif /* CONFIG_DRIVER_ROBOSWITCH */
5678#ifdef CONFIG_DRIVER_ATHEROS
5679/* driver_atheros.c */
5680extern const struct wpa_driver_ops wpa_driver_atheros_ops;
5681#endif /* CONFIG_DRIVER_ATHEROS */
5682#ifdef CONFIG_DRIVER_NONE
5683extern const struct wpa_driver_ops wpa_driver_none_ops; /* driver_none.c */
5684#endif /* CONFIG_DRIVER_NONE */
5685
6fc6879b 5686#endif /* DRIVER_H */