]> git.ipfire.org Git - thirdparty/hostap.git/blame - src/drivers/driver.h
Replace set_beacon() driver op with set_ap()
[thirdparty/hostap.git] / src / drivers / driver.h
CommitLineData
6fc6879b 1/*
e0498677 2 * Driver interface definition
8d923a4a 3 * Copyright (c) 2003-2010, Jouni Malinen <j@w1.fi>
6fc6879b
JM
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
11 *
12 * See README and COPYING for more details.
e0498677
JM
13 *
14 * This file defines a driver interface used by both %wpa_supplicant and
15 * hostapd. The first part of the file defines data structures used in various
16 * driver operations. This is followed by the struct wpa_driver_ops that each
17 * driver wrapper will beed to define with callback functions for requesting
18 * driver operations. After this, there are definitions for driver event
19 * reporting with wpa_supplicant_event() and some convenience helper functions
20 * that can be used to report events.
6fc6879b
JM
21 */
22
23#ifndef DRIVER_H
24#define DRIVER_H
25
642187d6 26#define WPA_SUPPLICANT_DRIVER_VERSION 4
6fc6879b 27
90973fb2 28#include "common/defs.h"
6fc6879b 29
c5121837
JM
30#define HOSTAPD_CHAN_DISABLED 0x00000001
31#define HOSTAPD_CHAN_PASSIVE_SCAN 0x00000002
32#define HOSTAPD_CHAN_NO_IBSS 0x00000004
33#define HOSTAPD_CHAN_RADAR 0x00000008
d8e66e80
JM
34#define HOSTAPD_CHAN_HT40PLUS 0x00000010
35#define HOSTAPD_CHAN_HT40MINUS 0x00000020
36#define HOSTAPD_CHAN_HT40 0x00000040
c5121837 37
e0498677
JM
38/**
39 * struct hostapd_channel_data - Channel information
40 */
c5121837 41struct hostapd_channel_data {
e0498677
JM
42 /**
43 * chan - Channel number (IEEE 802.11)
44 */
45 short chan;
46
47 /**
48 * freq - Frequency in MHz
49 */
50 short freq;
51
52 /**
53 * flag - Channel flags (HOSTAPD_CHAN_*)
54 */
55 int flag;
56
57 /**
58 * max_tx_power - maximum transmit power in dBm
59 */
60 u8 max_tx_power;
c5121837
JM
61};
62
e0498677
JM
63/**
64 * struct hostapd_hw_modes - Supported hardware mode information
65 */
c5121837 66struct hostapd_hw_modes {
e0498677
JM
67 /**
68 * mode - Hardware mode
69 */
71934751 70 enum hostapd_hw_mode mode;
e0498677
JM
71
72 /**
73 * num_channels - Number of entries in the channels array
74 */
c5121837 75 int num_channels;
e0498677
JM
76
77 /**
78 * channels - Array of supported channels
79 */
c5121837 80 struct hostapd_channel_data *channels;
e0498677
JM
81
82 /**
83 * num_rates - Number of entries in the rates array
84 */
c5121837 85 int num_rates;
e0498677
JM
86
87 /**
88 * rates - Array of supported rates in 100 kbps units
89 */
90 int *rates;
91
92 /**
93 * ht_capab - HT (IEEE 802.11n) capabilities
94 */
c5121837 95 u16 ht_capab;
e0498677
JM
96
97 /**
98 * mcs_set - MCS (IEEE 802.11n) rate parameters
99 */
08eb154d 100 u8 mcs_set[16];
e0498677
JM
101
102 /**
103 * a_mpdu_params - A-MPDU (IEEE 802.11n) parameters
104 */
be8eb8ab 105 u8 a_mpdu_params;
c5121837
JM
106};
107
108
6fc6879b
JM
109#define IEEE80211_MODE_INFRA 0
110#define IEEE80211_MODE_IBSS 1
ad1e68e6 111#define IEEE80211_MODE_AP 2
6fc6879b
JM
112
113#define IEEE80211_CAP_ESS 0x0001
114#define IEEE80211_CAP_IBSS 0x0002
115#define IEEE80211_CAP_PRIVACY 0x0010
116
7c2849d2
JM
117#define WPA_SCAN_QUAL_INVALID BIT(0)
118#define WPA_SCAN_NOISE_INVALID BIT(1)
119#define WPA_SCAN_LEVEL_INVALID BIT(2)
120#define WPA_SCAN_LEVEL_DBM BIT(3)
e6b8efeb
JM
121#define WPA_SCAN_AUTHENTICATED BIT(4)
122#define WPA_SCAN_ASSOCIATED BIT(5)
7c2849d2 123
6fc6879b
JM
124/**
125 * struct wpa_scan_res - Scan result for an BSS/IBSS
7c2849d2 126 * @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
6fc6879b
JM
127 * @bssid: BSSID
128 * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
129 * @beacon_int: beacon interval in TUs (host byte order)
130 * @caps: capability information field in host byte order
131 * @qual: signal quality
132 * @noise: noise level
133 * @level: signal level
134 * @tsf: Timestamp
b3ad11bb
JM
135 * @age: Age of the information in milliseconds (i.e., how many milliseconds
136 * ago the last Beacon or Probe Response frame was received)
6fc6879b 137 * @ie_len: length of the following IE field in octets
8c090654 138 * @beacon_ie_len: length of the following Beacon IE field in octets
6fc6879b
JM
139 *
140 * This structure is used as a generic format for scan results from the
141 * driver. Each driver interface implementation is responsible for converting
142 * the driver or OS specific scan results into this format.
143 *
144 * If the driver does not support reporting all IEs, the IE data structure is
145 * constructed of the IEs that are available. This field will also need to
146 * include SSID in IE format. All drivers are encouraged to be extended to
147 * report all IEs to make it easier to support future additions.
148 */
149struct wpa_scan_res {
7c2849d2 150 unsigned int flags;
6fc6879b
JM
151 u8 bssid[ETH_ALEN];
152 int freq;
153 u16 beacon_int;
154 u16 caps;
155 int qual;
156 int noise;
157 int level;
158 u64 tsf;
b3ad11bb 159 unsigned int age;
6fc6879b 160 size_t ie_len;
8c090654
JM
161 size_t beacon_ie_len;
162 /*
163 * Followed by ie_len octets of IEs from Probe Response frame (or if
164 * the driver does not indicate source of IEs, these may also be from
165 * Beacon frame). After the first set of IEs, another set of IEs may
166 * follow (with beacon_ie_len octets of data) if the driver provides
167 * both IE sets.
168 */
6fc6879b
JM
169};
170
171/**
172 * struct wpa_scan_results - Scan results
173 * @res: Array of pointers to allocated variable length scan result entries
174 * @num: Number of entries in the scan result array
175 */
176struct wpa_scan_results {
177 struct wpa_scan_res **res;
178 size_t num;
179};
180
4b4a8ae5
JM
181/**
182 * struct wpa_interface_info - Network interface information
183 * @next: Pointer to the next interface or NULL if this is the last one
184 * @ifname: Interface name that can be used with init() or init2()
185 * @desc: Human readable adapter description (e.g., vendor/model) or NULL if
186 * not available
60ad2c7b 187 * @drv_name: struct wpa_driver_ops::name (note: unlike other strings, this one
4b4a8ae5
JM
188 * is not an allocated copy, i.e., get_interfaces() caller will not free
189 * this)
190 */
191struct wpa_interface_info {
192 struct wpa_interface_info *next;
193 char *ifname;
194 char *desc;
195 const char *drv_name;
196};
197
a79d5479 198#define WPAS_MAX_SCAN_SSIDS 10
fc2b7ed5
JM
199
200/**
201 * struct wpa_driver_scan_params - Scan parameters
202 * Data for struct wpa_driver_ops::scan2().
203 */
204struct wpa_driver_scan_params {
205 /**
206 * ssids - SSIDs to scan for
207 */
208 struct wpa_driver_scan_ssid {
209 /**
210 * ssid - specific SSID to scan for (ProbeReq)
211 * %NULL or zero-length SSID is used to indicate active scan
ba2a573c 212 * with wildcard SSID.
fc2b7ed5
JM
213 */
214 const u8 *ssid;
215 /**
216 * ssid_len: Length of the SSID in octets
217 */
218 size_t ssid_len;
219 } ssids[WPAS_MAX_SCAN_SSIDS];
220
221 /**
222 * num_ssids - Number of entries in ssids array
223 * Zero indicates a request for a passive scan.
224 */
225 size_t num_ssids;
226
227 /**
228 * extra_ies - Extra IE(s) to add into Probe Request or %NULL
229 */
230 const u8 *extra_ies;
231
232 /**
233 * extra_ies_len - Length of extra_ies in octets
234 */
235 size_t extra_ies_len;
d3a98225
JM
236
237 /**
238 * freqs - Array of frequencies to scan or %NULL for all frequencies
239 *
240 * The frequency is set in MHz. The array is zero-terminated.
241 */
242 int *freqs;
3812464c
JM
243
244 /**
245 * filter_ssids - Filter for reporting SSIDs
246 *
247 * This optional parameter can be used to request the driver wrapper to
248 * filter scan results to include only the specified SSIDs. %NULL
249 * indicates that no filtering is to be done. This can be used to
250 * reduce memory needs for scan results in environments that have large
251 * number of APs with different SSIDs.
252 *
253 * The driver wrapper is allowed to take this allocated buffer into its
254 * own use by setting the pointer to %NULL. In that case, the driver
255 * wrapper is responsible for freeing the buffer with os_free() once it
256 * is not needed anymore.
257 */
258 struct wpa_driver_scan_filter {
259 u8 ssid[32];
260 size_t ssid_len;
261 } *filter_ssids;
262
263 /**
264 * num_filter_ssids - Number of entries in filter_ssids array
265 */
266 size_t num_filter_ssids;
fc2b7ed5
JM
267};
268
c2a04078
JM
269/**
270 * struct wpa_driver_auth_params - Authentication parameters
271 * Data for struct wpa_driver_ops::authenticate().
272 */
273struct wpa_driver_auth_params {
274 int freq;
275 const u8 *bssid;
276 const u8 *ssid;
277 size_t ssid_len;
278 int auth_alg;
279 const u8 *ie;
280 size_t ie_len;
a0b2f99b
JM
281 const u8 *wep_key[4];
282 size_t wep_key_len[4];
283 int wep_tx_keyidx;
2a7e7f4e 284 int local_state_change;
2f4f73b1
EP
285
286 /**
287 * p2p - Whether this connection is a P2P group
288 */
289 int p2p;
290
c2a04078
JM
291};
292
0c80427d
JM
293enum wps_mode {
294 WPS_MODE_NONE /* no WPS provisioning being used */,
295 WPS_MODE_OPEN /* WPS provisioning with AP that is in open mode */,
296 WPS_MODE_PRIVACY /* WPS provisioning with AP that is using protection
297 */
298};
299
6fc6879b
JM
300/**
301 * struct wpa_driver_associate_params - Association parameters
302 * Data for struct wpa_driver_ops::associate().
303 */
304struct wpa_driver_associate_params {
305 /**
306 * bssid - BSSID of the selected AP
307 * This can be %NULL, if ap_scan=2 mode is used and the driver is
308 * responsible for selecting with which BSS to associate. */
309 const u8 *bssid;
310
311 /**
312 * ssid - The selected SSID
313 */
314 const u8 *ssid;
e0498677
JM
315
316 /**
317 * ssid_len - Length of the SSID (1..32)
318 */
6fc6879b
JM
319 size_t ssid_len;
320
321 /**
322 * freq - Frequency of the channel the selected AP is using
323 * Frequency that the selected AP is using (in MHz as
324 * reported in the scan results)
325 */
326 int freq;
327
328 /**
329 * wpa_ie - WPA information element for (Re)Association Request
330 * WPA information element to be included in (Re)Association
331 * Request (including information element id and length). Use
332 * of this WPA IE is optional. If the driver generates the WPA
333 * IE, it can use pairwise_suite, group_suite, and
334 * key_mgmt_suite to select proper algorithms. In this case,
335 * the driver has to notify wpa_supplicant about the used WPA
336 * IE by generating an event that the interface code will
337 * convert into EVENT_ASSOCINFO data (see below).
338 *
339 * When using WPA2/IEEE 802.11i, wpa_ie is used for RSN IE
340 * instead. The driver can determine which version is used by
341 * looking at the first byte of the IE (0xdd for WPA, 0x30 for
342 * WPA2/RSN).
ad08c363
JM
343 *
344 * When using WPS, wpa_ie is used for WPS IE instead of WPA/RSN IE.
6fc6879b
JM
345 */
346 const u8 *wpa_ie;
e0498677 347
6fc6879b
JM
348 /**
349 * wpa_ie_len - length of the wpa_ie
350 */
351 size_t wpa_ie_len;
352
e0498677
JM
353 /**
354 * pairwise_suite - Selected pairwise cipher suite
355 *
356 * This is usually ignored if @wpa_ie is used.
357 */
71934751 358 enum wpa_cipher pairwise_suite;
e0498677
JM
359
360 /**
361 * group_suite - Selected group cipher suite
362 *
363 * This is usually ignored if @wpa_ie is used.
364 */
71934751 365 enum wpa_cipher group_suite;
e0498677
JM
366
367 /**
368 * key_mgmt_suite - Selected key management suite
369 *
370 * This is usually ignored if @wpa_ie is used.
371 */
71934751 372 enum wpa_key_mgmt key_mgmt_suite;
6fc6879b
JM
373
374 /**
375 * auth_alg - Allowed authentication algorithms
abd9fafa 376 * Bit field of WPA_AUTH_ALG_*
6fc6879b
JM
377 */
378 int auth_alg;
379
380 /**
381 * mode - Operation mode (infra/ibss) IEEE80211_MODE_*
382 */
383 int mode;
384
385 /**
386 * wep_key - WEP keys for static WEP configuration
387 */
388 const u8 *wep_key[4];
389
390 /**
391 * wep_key_len - WEP key length for static WEP configuration
392 */
393 size_t wep_key_len[4];
394
395 /**
396 * wep_tx_keyidx - WEP TX key index for static WEP configuration
397 */
398 int wep_tx_keyidx;
399
400 /**
401 * mgmt_frame_protection - IEEE 802.11w management frame protection
402 */
70f8cc8e 403 enum mfp_options mgmt_frame_protection;
6fc6879b
JM
404
405 /**
406 * ft_ies - IEEE 802.11r / FT information elements
407 * If the supplicant is using IEEE 802.11r (FT) and has the needed keys
408 * for fast transition, this parameter is set to include the IEs that
409 * are to be sent in the next FT Authentication Request message.
410 * update_ft_ies() handler is called to update the IEs for further
411 * FT messages in the sequence.
412 *
413 * The driver should use these IEs only if the target AP is advertising
414 * the same mobility domain as the one included in the MDIE here.
415 *
416 * In ap_scan=2 mode, the driver can use these IEs when moving to a new
417 * AP after the initial association. These IEs can only be used if the
418 * target AP is advertising support for FT and is using the same MDIE
419 * and SSID as the current AP.
420 *
421 * The driver is responsible for reporting the FT IEs received from the
422 * AP's response using wpa_supplicant_event() with EVENT_FT_RESPONSE
423 * type. update_ft_ies() handler will then be called with the FT IEs to
424 * include in the next frame in the authentication sequence.
425 */
426 const u8 *ft_ies;
427
428 /**
429 * ft_ies_len - Length of ft_ies in bytes
430 */
431 size_t ft_ies_len;
432
433 /**
434 * ft_md - FT Mobility domain (6 octets) (also included inside ft_ies)
435 *
436 * This value is provided to allow the driver interface easier access
437 * to the current mobility domain. This value is set to %NULL if no
438 * mobility domain is currently active.
439 */
440 const u8 *ft_md;
441
442 /**
443 * passphrase - RSN passphrase for PSK
444 *
445 * This value is made available only for WPA/WPA2-Personal (PSK) and
446 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
447 * the 8..63 character ASCII passphrase, if available. Please note that
448 * this can be %NULL if passphrase was not used to generate the PSK. In
449 * that case, the psk field must be used to fetch the PSK.
450 */
451 const char *passphrase;
452
453 /**
454 * psk - RSN PSK (alternative for passphrase for PSK)
455 *
456 * This value is made available only for WPA/WPA2-Personal (PSK) and
457 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
458 * the 32-octet (256-bit) PSK, if available. The driver wrapper should
459 * be prepared to handle %NULL value as an error.
460 */
461 const u8 *psk;
36b15723
JM
462
463 /**
464 * drop_unencrypted - Enable/disable unencrypted frame filtering
465 *
466 * Configure the driver to drop all non-EAPOL frames (both receive and
467 * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
468 * still be allowed for key negotiation.
469 */
470 int drop_unencrypted;
62fa124c
JM
471
472 /**
473 * prev_bssid - Previously used BSSID in this ESS
474 *
475 * When not %NULL, this is a request to use reassociation instead of
476 * association.
477 */
478 const u8 *prev_bssid;
0c80427d
JM
479
480 /**
481 * wps - WPS mode
482 *
483 * If the driver needs to do special configuration for WPS association,
484 * this variable provides more information on what type of association
485 * is being requested. Most drivers should not need ot use this.
486 */
487 enum wps_mode wps;
75bde05d
JM
488
489 /**
490 * p2p - Whether this connection is a P2P group
491 */
492 int p2p;
eea2fd9e
JM
493
494 /**
495 * uapsd - UAPSD parameters for the network
496 * -1 = do not change defaults
497 * AP mode: 1 = enabled, 0 = disabled
498 * STA mode: bits 0..3 UAPSD enabled for VO,VI,BK,BE
499 */
500 int uapsd;
6fc6879b
JM
501};
502
19c3b566
JM
503struct wpa_driver_ap_params {
504 /**
505 * head - Beacon head from IEEE 802.11 header to IEs before TIM IE
506 */
507 const u8 *head;
508
509 /**
510 * head_len - Length of the head buffer in octets
511 */
512 size_t head_len;
513
514 /**
515 * tail - Beacon tail following TIM IE
516 */
517 const u8 *tail;
518
519 /**
520 * tail_len - Length of the tail buffer in octets
521 */
522 size_t tail_len;
523
524 /**
525 * dtim_period - DTIM period
526 */
527 int dtim_period;
528
529 /**
530 * beacon_int - Beacon interval
531 */
532 int beacon_int;
533};
534
6fc6879b
JM
535/**
536 * struct wpa_driver_capa - Driver capability information
537 */
538struct wpa_driver_capa {
539#define WPA_DRIVER_CAPA_KEY_MGMT_WPA 0x00000001
540#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2 0x00000002
541#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK 0x00000004
542#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK 0x00000008
543#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE 0x00000010
544#define WPA_DRIVER_CAPA_KEY_MGMT_FT 0x00000020
545#define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK 0x00000040
546 unsigned int key_mgmt;
547
548#define WPA_DRIVER_CAPA_ENC_WEP40 0x00000001
549#define WPA_DRIVER_CAPA_ENC_WEP104 0x00000002
550#define WPA_DRIVER_CAPA_ENC_TKIP 0x00000004
551#define WPA_DRIVER_CAPA_ENC_CCMP 0x00000008
552 unsigned int enc;
553
554#define WPA_DRIVER_AUTH_OPEN 0x00000001
555#define WPA_DRIVER_AUTH_SHARED 0x00000002
556#define WPA_DRIVER_AUTH_LEAP 0x00000004
557 unsigned int auth;
558
559/* Driver generated WPA/RSN IE */
560#define WPA_DRIVER_FLAGS_DRIVER_IE 0x00000001
0194fedb 561/* Driver needs static WEP key setup after association command */
6fc6879b
JM
562#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
563#define WPA_DRIVER_FLAGS_USER_SPACE_MLME 0x00000004
564/* Driver takes care of RSN 4-way handshake internally; PMK is configured with
565 * struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */
566#define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE 0x00000008
4ef1e644 567#define WPA_DRIVER_FLAGS_WIRED 0x00000010
c2a04078
JM
568/* Driver provides separate commands for authentication and association (SME in
569 * wpa_supplicant). */
570#define WPA_DRIVER_FLAGS_SME 0x00000020
1581b38b
JM
571/* Driver supports AP mode */
572#define WPA_DRIVER_FLAGS_AP 0x00000040
0194fedb
JB
573/* Driver needs static WEP key setup after association has been completed */
574#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE 0x00000080
75bde05d
JM
575/* Driver takes care of P2P management operations */
576#define WPA_DRIVER_FLAGS_P2P_MGMT 0x00000100
577/* Driver supports concurrent P2P operations */
578#define WPA_DRIVER_FLAGS_P2P_CONCURRENT 0x00000200
579/*
580 * Driver uses the initial interface as a dedicated management interface, i.e.,
971e357f 581 * it cannot be used for P2P group operations or non-P2P purposes.
75bde05d
JM
582 */
583#define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE 0x00000400
584/* This interface is P2P capable (P2P Device, GO, or P2P Client */
585#define WPA_DRIVER_FLAGS_P2P_CAPABLE 0x00000800
d054a462
JM
586/* Driver supports concurrent operations on multiple channels */
587#define WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT 0x00001000
971e357f
JM
588/*
589 * Driver uses the initial interface for P2P management interface and non-P2P
590 * purposes (e.g., connect to infra AP), but this interface cannot be used for
591 * P2P group operations.
592 */
593#define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P 0x00002000
871f4dd0
JM
594/*
595 * Driver is known to use sane error codes, i.e., when it indicates that
596 * something (e.g., association) fails, there was indeed a failure and the
597 * operation does not end up getting completed successfully later.
598 */
599#define WPA_DRIVER_FLAGS_SANE_ERROR_CODES 0x00004000
190b9062
JB
600/* Driver supports off-channel TX */
601#define WPA_DRIVER_FLAGS_OFFCHANNEL_TX 0x00008000
2fee890a
JM
602/* Driver indicates TX status events for EAPOL Data frames */
603#define WPA_DRIVER_FLAGS_EAPOL_TX_STATUS 0x00010000
6fc6879b 604 unsigned int flags;
80bc75f1
JM
605
606 int max_scan_ssids;
814782b9
JM
607
608 /**
609 * max_remain_on_chan - Maximum remain-on-channel duration in msec
610 */
611 unsigned int max_remain_on_chan;
c4ea4c5c
JM
612
613 /**
614 * max_stations - Maximum number of associated stations the driver
615 * supports in AP mode
616 */
617 unsigned int max_stations;
6fc6879b
JM
618};
619
620
c5121837
JM
621struct hostapd_data;
622
623struct hostap_sta_driver_data {
624 unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
625 unsigned long current_tx_rate;
626 unsigned long inactive_msec;
627 unsigned long flags;
628 unsigned long num_ps_buf_frames;
629 unsigned long tx_retry_failed;
630 unsigned long tx_retry_count;
631 int last_rssi;
632 int last_ack_rssi;
633};
634
635struct hostapd_sta_add_params {
636 const u8 *addr;
637 u16 aid;
638 u16 capability;
639 const u8 *supp_rates;
640 size_t supp_rates_len;
c5121837 641 u16 listen_interval;
fc4e2d95 642 const struct ieee80211_ht_capabilities *ht_capabilities;
d83ab1fe 643 u32 flags; /* bitmask of WPA_STA_* flags */
c5121837
JM
644};
645
646struct hostapd_freq_params {
647 int mode;
648 int freq;
649 int channel;
650 int ht_enabled;
651 int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled,
652 * secondary channel below primary, 1 = HT40
653 * enabled, secondary channel above primary */
654};
655
22a7c9d7
JM
656enum wpa_driver_if_type {
657 /**
658 * WPA_IF_STATION - Station mode interface
659 */
660 WPA_IF_STATION,
661
662 /**
663 * WPA_IF_AP_VLAN - AP mode VLAN interface
664 *
665 * This interface shares its address and Beacon frame with the main
666 * BSS.
667 */
668 WPA_IF_AP_VLAN,
669
670 /**
671 * WPA_IF_AP_BSS - AP mode BSS interface
672 *
673 * This interface has its own address and Beacon frame.
674 */
675 WPA_IF_AP_BSS,
75bde05d
JM
676
677 /**
678 * WPA_IF_P2P_GO - P2P Group Owner
679 */
680 WPA_IF_P2P_GO,
681
682 /**
683 * WPA_IF_P2P_CLIENT - P2P Client
684 */
685 WPA_IF_P2P_CLIENT,
686
687 /**
688 * WPA_IF_P2P_GROUP - P2P Group interface (will become either
689 * WPA_IF_P2P_GO or WPA_IF_P2P_CLIENT, but the role is not yet known)
690 */
691 WPA_IF_P2P_GROUP
c5121837
JM
692};
693
92f475b4
JM
694struct wpa_init_params {
695 const u8 *bssid;
696 const char *ifname;
697 const u8 *ssid;
698 size_t ssid_len;
699 const char *test_socket;
700 int use_pae_group_addr;
92f475b4
JM
701 char **bridge;
702 size_t num_bridge;
412036f5
JM
703
704 u8 *own_addr; /* buffer for writing own MAC address */
92f475b4
JM
705};
706
c5121837 707
e3bd3912
JM
708struct wpa_bss_params {
709 /** Interface name (for multi-SSID/VLAN support) */
710 const char *ifname;
711 /** Whether IEEE 802.1X or WPA/WPA2 is enabled */
712 int enabled;
af586419
JM
713
714 int wpa;
715 int ieee802_1x;
716 int wpa_group;
717 int wpa_pairwise;
718 int wpa_key_mgmt;
719 int rsn_preauth;
a1ca0292 720 enum mfp_options ieee80211w;
e3bd3912
JM
721};
722
0de39516
JM
723#define WPA_STA_AUTHORIZED BIT(0)
724#define WPA_STA_WMM BIT(1)
725#define WPA_STA_SHORT_PREAMBLE BIT(2)
726#define WPA_STA_MFP BIT(3)
e3bd3912 727
3ac17eba
JM
728/**
729 * struct p2p_params - P2P parameters for driver-based P2P management
730 */
731struct p2p_params {
732 const char *dev_name;
733 u8 pri_dev_type[8];
734#define DRV_MAX_SEC_DEV_TYPES 5
735 u8 sec_dev_type[DRV_MAX_SEC_DEV_TYPES][8];
736 size_t num_sec_dev_types;
737};
738
281ff0aa
GP
739enum tdls_oper {
740 TDLS_DISCOVERY_REQ,
741 TDLS_SETUP,
742 TDLS_TEARDOWN,
743 TDLS_ENABLE_LINK,
b8f64582
JM
744 TDLS_DISABLE_LINK,
745 TDLS_ENABLE,
746 TDLS_DISABLE
281ff0aa
GP
747};
748
1c5c7273
PS
749/**
750 * struct wpa_signal_info - Information about channel signal quality
751 */
752struct wpa_signal_info {
753 u32 frequency;
754 int above_threshold;
755 int current_signal;
756 int current_noise;
757 int current_txrate;
758};
759
6fc6879b
JM
760/**
761 * struct wpa_driver_ops - Driver interface API definition
762 *
763 * This structure defines the API that each driver interface needs to implement
764 * for core wpa_supplicant code. All driver specific functionality is captured
765 * in this wrapper.
766 */
767struct wpa_driver_ops {
768 /** Name of the driver interface */
769 const char *name;
770 /** One line description of the driver interface */
771 const char *desc;
772
773 /**
774 * get_bssid - Get the current BSSID
775 * @priv: private driver interface data
776 * @bssid: buffer for BSSID (ETH_ALEN = 6 bytes)
777 *
778 * Returns: 0 on success, -1 on failure
779 *
780 * Query kernel driver for the current BSSID and copy it to bssid.
781 * Setting bssid to 00:00:00:00:00:00 is recommended if the STA is not
782 * associated.
783 */
784 int (*get_bssid)(void *priv, u8 *bssid);
785
786 /**
787 * get_ssid - Get the current SSID
788 * @priv: private driver interface data
789 * @ssid: buffer for SSID (at least 32 bytes)
790 *
791 * Returns: Length of the SSID on success, -1 on failure
792 *
793 * Query kernel driver for the current SSID and copy it to ssid.
794 * Returning zero is recommended if the STA is not associated.
795 *
796 * Note: SSID is an array of octets, i.e., it is not nul terminated and
797 * can, at least in theory, contain control characters (including nul)
798 * and as such, should be processed as binary data, not a printable
799 * string.
800 */
801 int (*get_ssid)(void *priv, u8 *ssid);
802
6fc6879b
JM
803 /**
804 * set_key - Configure encryption key
642187d6 805 * @ifname: Interface name (for multi-SSID/VLAN support)
6fc6879b
JM
806 * @priv: private driver interface data
807 * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
808 * %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK);
809 * %WPA_ALG_NONE clears the key.
0382097e
JM
810 * @addr: Address of the peer STA (BSSID of the current AP when setting
811 * pairwise key in station mode), ff:ff:ff:ff:ff:ff for
812 * broadcast keys, %NULL for default keys that are used both for
813 * broadcast and unicast; when clearing keys, %NULL is used to
814 * indicate that both the broadcast-only and default key of the
815 * specified key index is to be cleared
6fc6879b
JM
816 * @key_idx: key index (0..3), usually 0 for unicast keys; 0..4095 for
817 * IGTK
818 * @set_tx: configure this key as the default Tx key (only used when
819 * driver does not support separate unicast/individual key
820 * @seq: sequence number/packet number, seq_len octets, the next
821 * packet number to be used for in replay protection; configured
822 * for Rx keys (in most cases, this is only used with broadcast
da64c266 823 * keys and set to zero for unicast keys); %NULL if not set
6fc6879b
JM
824 * @seq_len: length of the seq, depends on the algorithm:
825 * TKIP: 6 octets, CCMP: 6 octets, IGTK: 6 octets
826 * @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key,
827 * 8-byte Rx Mic Key
828 * @key_len: length of the key buffer in octets (WEP: 5 or 13,
829 * TKIP: 32, CCMP: 16, IGTK: 16)
830 *
831 * Returns: 0 on success, -1 on failure
832 *
833 * Configure the given key for the kernel driver. If the driver
834 * supports separate individual keys (4 default keys + 1 individual),
835 * addr can be used to determine whether the key is default or
836 * individual. If only 4 keys are supported, the default key with key
837 * index 0 is used as the individual key. STA must be configured to use
838 * it as the default Tx key (set_tx is set) and accept Rx for all the
839 * key indexes. In most cases, WPA uses only key indexes 1 and 2 for
840 * broadcast keys, so key index 0 is available for this kind of
841 * configuration.
842 *
843 * Please note that TKIP keys include separate TX and RX MIC keys and
844 * some drivers may expect them in different order than wpa_supplicant
845 * is using. If the TX/RX keys are swapped, all TKIP encrypted packets
61fbd3df 846 * will trigger Michael MIC errors. This can be fixed by changing the
6fc6879b
JM
847 * order of MIC keys by swapping te bytes 16..23 and 24..31 of the key
848 * in driver_*.c set_key() implementation, see driver_ndis.c for an
849 * example on how this can be done.
850 */
71934751 851 int (*set_key)(const char *ifname, void *priv, enum wpa_alg alg,
642187d6
JM
852 const u8 *addr, int key_idx, int set_tx,
853 const u8 *seq, size_t seq_len,
6fc6879b
JM
854 const u8 *key, size_t key_len);
855
856 /**
857 * init - Initialize driver interface
858 * @ctx: context to be used when calling wpa_supplicant functions,
859 * e.g., wpa_supplicant_event()
860 * @ifname: interface name, e.g., wlan0
861 *
862 * Returns: Pointer to private data, %NULL on failure
863 *
864 * Initialize driver interface, including event processing for kernel
865 * driver events (e.g., associated, scan results, Michael MIC failure).
866 * This function can allocate a private configuration data area for
867 * @ctx, file descriptor, interface name, etc. information that may be
868 * needed in future driver operations. If this is not used, non-NULL
869 * value will need to be returned because %NULL is used to indicate
870 * failure. The returned value will be used as 'void *priv' data for
871 * all other driver_ops functions.
872 *
873 * The main event loop (eloop.c) of wpa_supplicant can be used to
874 * register callback for read sockets (eloop_register_read_sock()).
875 *
876 * See below for more information about events and
877 * wpa_supplicant_event() function.
878 */
879 void * (*init)(void *ctx, const char *ifname);
880
881 /**
882 * deinit - Deinitialize driver interface
883 * @priv: private driver interface data from init()
884 *
885 * Shut down driver interface and processing of driver events. Free
886 * private data buffer if one was allocated in init() handler.
887 */
888 void (*deinit)(void *priv);
889
890 /**
891 * set_param - Set driver configuration parameters
892 * @priv: private driver interface data from init()
893 * @param: driver specific configuration parameters
894 *
895 * Returns: 0 on success, -1 on failure
896 *
897 * Optional handler for notifying driver interface about configuration
898 * parameters (driver_param).
899 */
900 int (*set_param)(void *priv, const char *param);
901
902 /**
903 * set_countermeasures - Enable/disable TKIP countermeasures
904 * @priv: private driver interface data
905 * @enabled: 1 = countermeasures enabled, 0 = disabled
906 *
907 * Returns: 0 on success, -1 on failure
908 *
909 * Configure TKIP countermeasures. When these are enabled, the driver
910 * should drop all received and queued frames that are using TKIP.
911 */
912 int (*set_countermeasures)(void *priv, int enabled);
913
6fc6879b
JM
914 /**
915 * deauthenticate - Request driver to deauthenticate
916 * @priv: private driver interface data
917 * @addr: peer address (BSSID of the AP)
918 * @reason_code: 16-bit reason code to be sent in the deauthentication
919 * frame
920 *
921 * Returns: 0 on success, -1 on failure
922 */
923 int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
924
925 /**
926 * disassociate - Request driver to disassociate
927 * @priv: private driver interface data
928 * @addr: peer address (BSSID of the AP)
929 * @reason_code: 16-bit reason code to be sent in the disassociation
930 * frame
931 *
932 * Returns: 0 on success, -1 on failure
933 */
934 int (*disassociate)(void *priv, const u8 *addr, int reason_code);
935
936 /**
937 * associate - Request driver to associate
938 * @priv: private driver interface data
939 * @params: association parameters
940 *
941 * Returns: 0 on success, -1 on failure
942 */
943 int (*associate)(void *priv,
944 struct wpa_driver_associate_params *params);
945
6fc6879b
JM
946 /**
947 * add_pmkid - Add PMKSA cache entry to the driver
948 * @priv: private driver interface data
949 * @bssid: BSSID for the PMKSA cache entry
950 * @pmkid: PMKID for the PMKSA cache entry
951 *
952 * Returns: 0 on success, -1 on failure
953 *
954 * This function is called when a new PMK is received, as a result of
955 * either normal authentication or RSN pre-authentication.
956 *
957 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
958 * associate(), add_pmkid() can be used to add new PMKSA cache entries
959 * in the driver. If the driver uses wpa_ie from wpa_supplicant, this
960 * driver_ops function does not need to be implemented. Likewise, if
961 * the driver does not support WPA, this function is not needed.
962 */
963 int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
964
965 /**
966 * remove_pmkid - Remove PMKSA cache entry to the driver
967 * @priv: private driver interface data
968 * @bssid: BSSID for the PMKSA cache entry
969 * @pmkid: PMKID for the PMKSA cache entry
970 *
971 * Returns: 0 on success, -1 on failure
972 *
973 * This function is called when the supplicant drops a PMKSA cache
974 * entry for any reason.
975 *
976 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
977 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
978 * between the driver and wpa_supplicant. If the driver uses wpa_ie
979 * from wpa_supplicant, this driver_ops function does not need to be
980 * implemented. Likewise, if the driver does not support WPA, this
981 * function is not needed.
982 */
983 int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
984
985 /**
986 * flush_pmkid - Flush PMKSA cache
987 * @priv: private driver interface data
988 *
989 * Returns: 0 on success, -1 on failure
990 *
991 * This function is called when the supplicant drops all PMKSA cache
992 * entries for any reason.
993 *
994 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
995 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
996 * between the driver and wpa_supplicant. If the driver uses wpa_ie
997 * from wpa_supplicant, this driver_ops function does not need to be
998 * implemented. Likewise, if the driver does not support WPA, this
999 * function is not needed.
1000 */
1001 int (*flush_pmkid)(void *priv);
1002
1003 /**
6179d2fd 1004 * get_capa - Get driver capabilities
6fc6879b
JM
1005 * @priv: private driver interface data
1006 *
1007 * Returns: 0 on success, -1 on failure
1008 *
1009 * Get driver/firmware/hardware capabilities.
1010 */
1011 int (*get_capa)(void *priv, struct wpa_driver_capa *capa);
1012
1013 /**
1014 * poll - Poll driver for association information
1015 * @priv: private driver interface data
1016 *
1017 * This is an option callback that can be used when the driver does not
1018 * provide event mechanism for association events. This is called when
1019 * receiving WPA EAPOL-Key messages that require association
1020 * information. The driver interface is supposed to generate associnfo
1021 * event before returning from this callback function. In addition, the
1022 * driver interface should generate an association event after having
1023 * sent out associnfo.
1024 */
1025 void (*poll)(void *priv);
1026
1027 /**
1028 * get_ifname - Get interface name
1029 * @priv: private driver interface data
1030 *
1031 * Returns: Pointer to the interface name. This can differ from the
e519314e 1032 * interface name used in init() call. Init() is called first.
6fc6879b
JM
1033 *
1034 * This optional function can be used to allow the driver interface to
1035 * replace the interface name with something else, e.g., based on an
1036 * interface mapping from a more descriptive name.
1037 */
1038 const char * (*get_ifname)(void *priv);
1039
1040 /**
1041 * get_mac_addr - Get own MAC address
1042 * @priv: private driver interface data
1043 *
1044 * Returns: Pointer to own MAC address or %NULL on failure
1045 *
1046 * This optional function can be used to get the own MAC address of the
1047 * device from the driver interface code. This is only needed if the
1048 * l2_packet implementation for the OS does not provide easy access to
1049 * a MAC address. */
1050 const u8 * (*get_mac_addr)(void *priv);
1051
1052 /**
1053 * send_eapol - Optional function for sending EAPOL packets
1054 * @priv: private driver interface data
1055 * @dest: Destination MAC address
1056 * @proto: Ethertype
1057 * @data: EAPOL packet starting with IEEE 802.1X header
1058 * @data_len: Size of the EAPOL packet
1059 *
1060 * Returns: 0 on success, -1 on failure
1061 *
1062 * This optional function can be used to override l2_packet operations
1063 * with driver specific functionality. If this function pointer is set,
1064 * l2_packet module is not used at all and the driver interface code is
1065 * responsible for receiving and sending all EAPOL packets. The
a8e0505b
JM
1066 * received EAPOL packets are sent to core code with EVENT_EAPOL_RX
1067 * event. The driver interface is required to implement get_mac_addr()
1068 * handler if send_eapol() is used.
6fc6879b
JM
1069 */
1070 int (*send_eapol)(void *priv, const u8 *dest, u16 proto,
1071 const u8 *data, size_t data_len);
1072
1073 /**
1074 * set_operstate - Sets device operating state to DORMANT or UP
1075 * @priv: private driver interface data
1076 * @state: 0 = dormant, 1 = up
1077 * Returns: 0 on success, -1 on failure
1078 *
1079 * This is an optional function that can be used on operating systems
1080 * that support a concept of controlling network device state from user
1081 * space applications. This function, if set, gets called with
1082 * state = 1 when authentication has been completed and with state = 0
1083 * when connection is lost.
1084 */
1085 int (*set_operstate)(void *priv, int state);
1086
1087 /**
1088 * mlme_setprotection - MLME-SETPROTECTION.request primitive
1089 * @priv: Private driver interface data
1090 * @addr: Address of the station for which to set protection (may be
1091 * %NULL for group keys)
1092 * @protect_type: MLME_SETPROTECTION_PROTECT_TYPE_*
1093 * @key_type: MLME_SETPROTECTION_KEY_TYPE_*
1094 * Returns: 0 on success, -1 on failure
1095 *
1096 * This is an optional function that can be used to set the driver to
1097 * require protection for Tx and/or Rx frames. This uses the layer
1098 * interface defined in IEEE 802.11i-2004 clause 10.3.22.1
1099 * (MLME-SETPROTECTION.request). Many drivers do not use explicit
1100 * set protection operation; instead, they set protection implicitly
1101 * based on configured keys.
1102 */
1103 int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type,
1104 int key_type);
1105
1106 /**
1107 * get_hw_feature_data - Get hardware support data (channels and rates)
1108 * @priv: Private driver interface data
1109 * @num_modes: Variable for returning the number of returned modes
1110 * flags: Variable for returning hardware feature flags
1111 * Returns: Pointer to allocated hardware data on success or %NULL on
1112 * failure. Caller is responsible for freeing this.
1113 *
1114 * This function is only needed for drivers that export MLME
e0498677 1115 * (management frame processing) to %wpa_supplicant or hostapd.
6fc6879b 1116 */
6caf9ca6
JM
1117 struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
1118 u16 *num_modes,
1119 u16 *flags);
6fc6879b
JM
1120
1121 /**
1122 * set_channel - Set channel
1123 * @priv: Private driver interface data
6caf9ca6 1124 * @phymode: HOSTAPD_MODE_IEEE80211B, ..
6fc6879b
JM
1125 * @chan: IEEE 802.11 channel number
1126 * @freq: Frequency of the channel in MHz
1127 * Returns: 0 on success, -1 on failure
1128 *
1129 * This function is only needed for drivers that export MLME
1130 * (management frame processing) to wpa_supplicant.
1131 */
71934751 1132 int (*set_channel)(void *priv, enum hostapd_hw_mode phymode, int chan,
6fc6879b
JM
1133 int freq);
1134
1135 /**
1136 * set_ssid - Set SSID
1137 * @priv: Private driver interface data
1138 * @ssid: SSID
1139 * @ssid_len: SSID length
1140 * Returns: 0 on success, -1 on failure
1141 *
1142 * This function is only needed for drivers that export MLME
1143 * (management frame processing) to wpa_supplicant.
1144 */
1145 int (*set_ssid)(void *priv, const u8 *ssid, size_t ssid_len);
1146
1147 /**
1148 * set_bssid - Set BSSID
1149 * @priv: Private driver interface data
1150 * @bssid: BSSID
1151 * Returns: 0 on success, -1 on failure
1152 *
1153 * This function is only needed for drivers that export MLME
1154 * (management frame processing) to wpa_supplicant.
1155 */
1156 int (*set_bssid)(void *priv, const u8 *bssid);
1157
1158 /**
1159 * send_mlme - Send management frame from MLME
1160 * @priv: Private driver interface data
1161 * @data: IEEE 802.11 management frame with IEEE 802.11 header
1162 * @data_len: Size of the management frame
1163 * Returns: 0 on success, -1 on failure
1164 *
1165 * This function is only needed for drivers that export MLME
1166 * (management frame processing) to wpa_supplicant.
1167 */
1168 int (*send_mlme)(void *priv, const u8 *data, size_t data_len);
1169
1170 /**
1171 * mlme_add_sta - Add a STA entry into the driver/netstack
1172 * @priv: Private driver interface data
1173 * @addr: MAC address of the STA (e.g., BSSID of the AP)
1174 * @supp_rates: Supported rate set (from (Re)AssocResp); in IEEE 802.11
1175 * format (one octet per rate, 1 = 0.5 Mbps)
1176 * @supp_rates_len: Number of entries in supp_rates
1177 * Returns: 0 on success, -1 on failure
1178 *
1179 * This function is only needed for drivers that export MLME
1180 * (management frame processing) to wpa_supplicant. When the MLME code
1181 * completes association with an AP, this function is called to
1182 * configure the driver/netstack with a STA entry for data frame
1183 * processing (TX rate control, encryption/decryption).
1184 */
1185 int (*mlme_add_sta)(void *priv, const u8 *addr, const u8 *supp_rates,
1186 size_t supp_rates_len);
1187
1188 /**
1189 * mlme_remove_sta - Remove a STA entry from the driver/netstack
1190 * @priv: Private driver interface data
1191 * @addr: MAC address of the STA (e.g., BSSID of the AP)
1192 * Returns: 0 on success, -1 on failure
1193 *
1194 * This function is only needed for drivers that export MLME
1195 * (management frame processing) to wpa_supplicant.
1196 */
1197 int (*mlme_remove_sta)(void *priv, const u8 *addr);
1198
1199 /**
1200 * update_ft_ies - Update FT (IEEE 802.11r) IEs
1201 * @priv: Private driver interface data
1202 * @md: Mobility domain (2 octets) (also included inside ies)
1203 * @ies: FT IEs (MDIE, FTIE, ...) or %NULL to remove IEs
1204 * @ies_len: Length of FT IEs in bytes
1205 * Returns: 0 on success, -1 on failure
1206 *
1207 * The supplicant uses this callback to let the driver know that keying
1208 * material for FT is available and that the driver can use the
1209 * provided IEs in the next message in FT authentication sequence.
1210 *
1211 * This function is only needed for driver that support IEEE 802.11r
1212 * (Fast BSS Transition).
1213 */
1214 int (*update_ft_ies)(void *priv, const u8 *md, const u8 *ies,
1215 size_t ies_len);
1216
1217 /**
1218 * send_ft_action - Send FT Action frame (IEEE 802.11r)
1219 * @priv: Private driver interface data
1220 * @action: Action field value
1221 * @target_ap: Target AP address
1222 * @ies: FT IEs (MDIE, FTIE, ...) (FT Request action frame body)
1223 * @ies_len: Length of FT IEs in bytes
1224 * Returns: 0 on success, -1 on failure
1225 *
1226 * The supplicant uses this callback to request the driver to transmit
1227 * an FT Action frame (action category 6) for over-the-DS fast BSS
1228 * transition.
1229 */
1230 int (*send_ft_action)(void *priv, u8 action, const u8 *target_ap,
1231 const u8 *ies, size_t ies_len);
1232
1233 /**
1234 * get_scan_results2 - Fetch the latest scan results
1235 * @priv: private driver interface data
1236 *
1237 * Returns: Allocated buffer of scan results (caller is responsible for
1238 * freeing the data structure) on success, NULL on failure
1239 */
1240 struct wpa_scan_results * (*get_scan_results2)(void *priv);
1241
6d158490
LR
1242 /**
1243 * set_country - Set country
1244 * @priv: Private driver interface data
1245 * @alpha2: country to which to switch to
1246 * Returns: 0 on success, -1 on failure
1247 *
1248 * This function is for drivers which support some form
1249 * of setting a regulatory domain.
1250 */
1251 int (*set_country)(void *priv, const char *alpha2);
ac305589
JM
1252
1253 /**
1254 * global_init - Global driver initialization
1255 * Returns: Pointer to private data (global), %NULL on failure
1256 *
1257 * This optional function is called to initialize the driver wrapper
1258 * for global data, i.e., data that applies to all interfaces. If this
1259 * function is implemented, global_deinit() will also need to be
1260 * implemented to free the private data. The driver will also likely
1261 * use init2() function instead of init() to get the pointer to global
1262 * data available to per-interface initializer.
1263 */
1264 void * (*global_init)(void);
1265
1266 /**
1267 * global_deinit - Global driver deinitialization
1268 * @priv: private driver global data from global_init()
1269 *
1270 * Terminate any global driver related functionality and free the
1271 * global data structure.
1272 */
1273 void (*global_deinit)(void *priv);
1274
1275 /**
1276 * init2 - Initialize driver interface (with global data)
1277 * @ctx: context to be used when calling wpa_supplicant functions,
1278 * e.g., wpa_supplicant_event()
1279 * @ifname: interface name, e.g., wlan0
1280 * @global_priv: private driver global data from global_init()
1281 * Returns: Pointer to private data, %NULL on failure
1282 *
1283 * This function can be used instead of init() if the driver wrapper
1284 * uses global data.
1285 */
1286 void * (*init2)(void *ctx, const char *ifname, void *global_priv);
4b4a8ae5
JM
1287
1288 /**
1289 * get_interfaces - Get information about available interfaces
1290 * @global_priv: private driver global data from global_init()
1291 * Returns: Allocated buffer of interface information (caller is
1292 * responsible for freeing the data structure) on success, NULL on
1293 * failure
1294 */
1295 struct wpa_interface_info * (*get_interfaces)(void *global_priv);
fc2b7ed5
JM
1296
1297 /**
1298 * scan2 - Request the driver to initiate scan
1299 * @priv: private driver interface data
1300 * @params: Scan parameters
1301 *
1302 * Returns: 0 on success, -1 on failure
1303 *
1304 * Once the scan results are ready, the driver should report scan
1305 * results event for wpa_supplicant which will eventually request the
1306 * results with wpa_driver_get_scan_results2().
1307 */
1308 int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
c2a04078
JM
1309
1310 /**
1311 * authenticate - Request driver to authenticate
1312 * @priv: private driver interface data
1313 * @params: authentication parameters
1314 * Returns: 0 on success, -1 on failure
1315 *
1316 * This is an optional function that can be used with drivers that
1317 * support separate authentication and association steps, i.e., when
1318 * wpa_supplicant can act as the SME. If not implemented, associate()
1319 * function is expected to take care of IEEE 802.11 authentication,
1320 * too.
1321 */
d2440ba0
JM
1322 int (*authenticate)(void *priv,
1323 struct wpa_driver_auth_params *params);
1324
15333707 1325 /**
19c3b566 1326 * set_ap - Set Beacon and Probe Response information for AP mode
15333707 1327 * @priv: Private driver interface data
19c3b566 1328 * @params: Parameters to use in AP mode
15333707 1329 *
19c3b566
JM
1330 * This function is used to configure Beacon template and/or extra IEs
1331 * to add for Beacon and Probe Response frames for the driver in
15333707
JM
1332 * AP mode. The driver is responsible for building the full Beacon
1333 * frame by concatenating the head part with TIM IE generated by the
19c3b566
JM
1334 * driver/firmware and finishing with the tail part. Depending on the
1335 * driver architectue, this can be done either by using the full
1336 * template or the set of additional IEs (e.g., WPS and P2P IE).
1337 * Similarly, Probe Response processing depends on the driver design.
1338 * If the driver (or firmware) takes care of replying to Probe Request
1339 * frames, the extra IEs provided here needs to be added to the Probe
1340 * Response frames.
1341 *
1342 * Returns: 0 on success, -1 on failure
15333707 1343 */
19c3b566 1344 int (*set_ap)(void *priv, struct wpa_driver_ap_params *params);
c5121837 1345
15333707
JM
1346 /**
1347 * hapd_init - Initialize driver interface (hostapd only)
1348 * @hapd: Pointer to hostapd context
1349 * @params: Configuration for the driver wrapper
1350 * Returns: Pointer to private data, %NULL on failure
1351 *
1352 * This function is used instead of init() or init2() when the driver
1353 * wrapper is used withh hostapd.
1354 */
92f475b4
JM
1355 void * (*hapd_init)(struct hostapd_data *hapd,
1356 struct wpa_init_params *params);
15333707
JM
1357
1358 /**
1359 * hapd_deinit - Deinitialize driver interface (hostapd only)
1360 * @priv: Private driver interface data from hapd_init()
1361 */
c5121837
JM
1362 void (*hapd_deinit)(void *priv);
1363
1364 /**
15333707 1365 * set_ieee8021x - Enable/disable IEEE 802.1X support (AP only)
15333707 1366 * @priv: Private driver interface data
e3bd3912 1367 * @params: BSS parameters
c5121837
JM
1368 * Returns: 0 on success, -1 on failure
1369 *
15333707 1370 * This is an optional function to configure the kernel driver to
e3bd3912
JM
1371 * enable/disable IEEE 802.1X support and set WPA/WPA2 parameters. This
1372 * can be left undefined (set to %NULL) if IEEE 802.1X support is
1373 * always enabled and the driver uses set_beacon() to set WPA/RSN IE
1374 * for Beacon frames.
c5121837 1375 */
e3bd3912 1376 int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
c5121837
JM
1377
1378 /**
15333707
JM
1379 * set_privacy - Enable/disable privacy (AP only)
1380 * @priv: Private driver interface data
c5121837 1381 * @enabled: 1 = privacy enabled, 0 = disabled
15333707 1382 * Returns: 0 on success, -1 on failure
c5121837 1383 *
15333707
JM
1384 * This is an optional function to configure privacy field in the
1385 * kernel driver for Beacon frames. This can be left undefined (set to
1386 * %NULL) if the driver uses the Beacon template from set_beacon().
c5121837 1387 */
d5dd016a 1388 int (*set_privacy)(void *priv, int enabled);
c5121837 1389
15333707
JM
1390 /**
1391 * get_seqnum - Fetch the current TSC/packet number (AP only)
1392 * @ifname: The interface name (main or virtual)
1393 * @priv: Private driver interface data
1394 * @addr: MAC address of the station or %NULL for group keys
1395 * @idx: Key index
1396 * @seq: Buffer for returning the latest used TSC/packet number
1397 * Returns: 0 on success, -1 on failure
1398 *
1399 * This function is used to fetch the last used TSC/packet number for
9008a3e4
JM
1400 * a TKIP, CCMP, or BIP/IGTK key. It is mainly used with group keys, so
1401 * there is no strict requirement on implementing support for unicast
1402 * keys (i.e., addr != %NULL).
15333707 1403 */
c5121837
JM
1404 int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
1405 int idx, u8 *seq);
15333707 1406
15333707
JM
1407 /**
1408 * flush - Flush all association stations (AP only)
1409 * @priv: Private driver interface data
1410 * Returns: 0 on success, -1 on failure
1411 *
1412 * This function requests the driver to disassociate all associated
1413 * stations. This function does not need to be implemented if the
1414 * driver does not process association frames internally.
1415 */
c5121837 1416 int (*flush)(void *priv);
15333707
JM
1417
1418 /**
1419 * set_generic_elem - Add IEs into Beacon/Probe Response frames (AP)
15333707
JM
1420 * @priv: Private driver interface data
1421 * @elem: Information elements
1422 * @elem_len: Length of the elem buffer in octets
1423 * Returns: 0 on success, -1 on failure
1424 *
1425 * This is an optional function to add information elements in the
1426 * kernel driver for Beacon and Probe Response frames. This can be left
1427 * undefined (set to %NULL) if the driver uses the Beacon template from
1428 * set_beacon().
1429 */
aa484516 1430 int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len);
c5121837 1431
15333707
JM
1432 /**
1433 * read_sta_data - Fetch station data (AP only)
1434 * @priv: Private driver interface data
1435 * @data: Buffer for returning station information
1436 * @addr: MAC address of the station
1437 * Returns: 0 on success, -1 on failure
1438 */
c5121837
JM
1439 int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
1440 const u8 *addr);
15333707
JM
1441
1442 /**
1443 * hapd_send_eapol - Send an EAPOL packet (AP only)
1444 * @priv: private driver interface data
1445 * @addr: Destination MAC address
1446 * @data: EAPOL packet starting with IEEE 802.1X header
1447 * @data_len: Length of the EAPOL packet in octets
1448 * @encrypt: Whether the frame should be encrypted
1449 * @own_addr: Source MAC address
4378fc14 1450 * @flags: WPA_STA_* flags for the destination station
15333707
JM
1451 *
1452 * Returns: 0 on success, -1 on failure
1453 */
c5121837
JM
1454 int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
1455 size_t data_len, int encrypt,
4378fc14 1456 const u8 *own_addr, u32 flags);
15333707 1457
90b8c4c5
JM
1458 /**
1459 * sta_deauth - Deauthenticate a station (AP only)
1460 * @priv: Private driver interface data
1461 * @own_addr: Source address and BSSID for the Deauthentication frame
1462 * @addr: MAC address of the station to deauthenticate
1463 * @reason: Reason code for the Deauthentiation frame
1464 * Returns: 0 on success, -1 on failure
1465 *
1466 * This function requests a specific station to be deauthenticated and
1467 * a Deauthentication frame to be sent to it.
1468 */
731723a5
JM
1469 int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
1470 int reason);
90b8c4c5
JM
1471
1472 /**
1473 * sta_disassoc - Disassociate a station (AP only)
1474 * @priv: Private driver interface data
1475 * @own_addr: Source address and BSSID for the Disassociation frame
1476 * @addr: MAC address of the station to disassociate
1477 * @reason: Reason code for the Disassociation frame
1478 * Returns: 0 on success, -1 on failure
1479 *
1480 * This function requests a specific station to be disassociated and
1481 * a Disassociation frame to be sent to it.
1482 */
731723a5
JM
1483 int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
1484 int reason);
90b8c4c5
JM
1485
1486 /**
1487 * sta_remove - Remove a station entry (AP only)
1488 * @priv: Private driver interface data
1489 * @addr: MAC address of the station to be removed
1490 * Returns: 0 on success, -1 on failure
1491 */
c5121837 1492 int (*sta_remove)(void *priv, const u8 *addr);
90b8c4c5
JM
1493
1494 /**
1495 * hapd_get_ssid - Get the current SSID (AP only)
90b8c4c5
JM
1496 * @priv: Private driver interface data
1497 * @buf: Buffer for returning the SSID
1498 * @len: Maximum length of the buffer
1499 * Returns: Length of the SSID on success, -1 on failure
1500 *
1501 * This function need not be implemented if the driver uses Beacon
1502 * template from set_beacon() and does not reply to Probe Request
1503 * frames.
1504 */
8709de1a 1505 int (*hapd_get_ssid)(void *priv, u8 *buf, int len);
90b8c4c5
JM
1506
1507 /**
1508 * hapd_set_ssid - Set SSID (AP only)
90b8c4c5
JM
1509 * @priv: Private driver interface data
1510 * @buf: SSID
1511 * @len: Length of the SSID in octets
1512 * Returns: 0 on success, -1 on failure
1513 */
8709de1a
JM
1514 int (*hapd_set_ssid)(void *priv, const u8 *buf, int len);
1515
90b8c4c5
JM
1516 /**
1517 * hapd_set_countermeasures - Enable/disable TKIP countermeasures (AP)
1518 * @priv: Private driver interface data
1519 * @enabled: 1 = countermeasures enabled, 0 = disabled
1520 * Returns: 0 on success, -1 on failure
1521 *
1522 * This need not be implemented if the driver does not take care of
1523 * association processing.
1524 */
c5121837 1525 int (*hapd_set_countermeasures)(void *priv, int enabled);
90b8c4c5
JM
1526
1527 /**
1528 * sta_add - Add a station entry
90b8c4c5
JM
1529 * @priv: Private driver interface data
1530 * @params: Station parameters
1531 * Returns: 0 on success, -1 on failure
1532 *
1533 * This function is used to add a station entry to the driver once the
1534 * station has completed association. This is only used if the driver
1535 * does not take care of association processing.
1536 */
62847751 1537 int (*sta_add)(void *priv, struct hostapd_sta_add_params *params);
90b8c4c5
JM
1538
1539 /**
1540 * get_inact_sec - Get station inactivity duration (AP only)
1541 * @priv: Private driver interface data
1542 * @addr: Station address
1543 * Returns: Number of seconds station has been inactive, -1 on failure
1544 */
c5121837 1545 int (*get_inact_sec)(void *priv, const u8 *addr);
90b8c4c5
JM
1546
1547 /**
1548 * sta_clear_stats - Clear station statistics (AP only)
1549 * @priv: Private driver interface data
1550 * @addr: Station address
1551 * Returns: 0 on success, -1 on failure
1552 */
c5121837
JM
1553 int (*sta_clear_stats)(void *priv, const u8 *addr);
1554
90b8c4c5
JM
1555 /**
1556 * set_freq - Set channel/frequency (AP only)
1557 * @priv: Private driver interface data
1558 * @freq: Channel parameters
1559 * Returns: 0 on success, -1 on failure
1560 */
c5121837 1561 int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
90b8c4c5
JM
1562
1563 /**
1564 * set_rts - Set RTS threshold
1565 * @priv: Private driver interface data
1566 * @rts: RTS threshold in octets
1567 * Returns: 0 on success, -1 on failure
1568 */
c5121837 1569 int (*set_rts)(void *priv, int rts);
90b8c4c5
JM
1570
1571 /**
1572 * set_frag - Set fragmentation threshold
1573 * @priv: Private driver interface data
1574 * @frag: Fragmentation threshold in octets
1575 * Returns: 0 on success, -1 on failure
1576 */
c5121837 1577 int (*set_frag)(void *priv, int frag);
c5121837 1578
90b8c4c5
JM
1579 /**
1580 * sta_set_flags - Set station flags (AP only)
1581 * @priv: Private driver interface data
1582 * @addr: Station address
0de39516
JM
1583 * @total_flags: Bitmap of all WPA_STA_* flags currently set
1584 * @flags_or: Bitmap of WPA_STA_* flags to add
1585 * @flags_and: Bitmap of WPA_STA_* flags to us as a mask
90b8c4c5
JM
1586 * Returns: 0 on success, -1 on failure
1587 */
3234cba4 1588 int (*sta_set_flags)(void *priv, const u8 *addr,
c5121837 1589 int total_flags, int flags_or, int flags_and);
90b8c4c5
JM
1590
1591 /**
1592 * set_rate_sets - Set supported and basic rate sets (AP only)
1593 * @priv: Private driver interface data
1594 * @supp_rates: -1 terminated array of supported rates in 100 kbps
1595 * @basic_rates: -1 terminated array of basic rates in 100 kbps
1596 * @mode: hardware mode (HOSTAPD_MODE_*)
1597 * Returns: 0 on success, -1 on failure
1598 */
c5121837
JM
1599 int (*set_rate_sets)(void *priv, int *supp_rates, int *basic_rates,
1600 int mode);
c5121837 1601
90b8c4c5
JM
1602 /**
1603 * set_cts_protect - Set CTS protection mode (AP only)
1604 * @priv: Private driver interface data
1605 * @value: Whether CTS protection is enabled
1606 * Returns: 0 on success, -1 on failure
1607 */
c5121837 1608 int (*set_cts_protect)(void *priv, int value);
90b8c4c5
JM
1609
1610 /**
1611 * set_preamble - Set preamble mode (AP only)
1612 * @priv: Private driver interface data
1613 * @value: Whether short preamble is enabled
1614 * Returns: 0 on success, -1 on failure
1615 */
c5121837 1616 int (*set_preamble)(void *priv, int value);
90b8c4c5
JM
1617
1618 /**
1619 * set_short_slot_time - Set short slot time (AP only)
1620 * @priv: Private driver interface data
1621 * @value: Whether short slot time is enabled
1622 * Returns: 0 on success, -1 on failure
1623 */
c5121837 1624 int (*set_short_slot_time)(void *priv, int value);
90b8c4c5
JM
1625
1626 /**
1627 * set_tx_queue_params - Set TX queue parameters
1628 * @priv: Private driver interface data
7e3c1781 1629 * @queue: Queue number (0 = VO, 1 = VI, 2 = BE, 3 = BK)
90b8c4c5
JM
1630 * @aifs: AIFS
1631 * @cw_min: cwMin
1632 * @cw_max: cwMax
1633 * @burst_time: Maximum length for bursting in 0.1 msec units
1634 */
c5121837
JM
1635 int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
1636 int cw_max, int burst_time);
90b8c4c5
JM
1637
1638 /**
1639 * valid_bss_mask - Validate BSSID mask
1640 * @priv: Private driver interface data
1641 * @addr: Address
1642 * @mask: Mask
1643 * Returns: 0 if mask is valid, -1 if mask is not valid, 1 if mask can
1644 * be used, but the main interface address must be the first address in
1645 * the block if mask is applied
1646 */
c5121837 1647 int (*valid_bss_mask)(void *priv, const u8 *addr, const u8 *mask);
22a7c9d7
JM
1648
1649 /**
1650 * if_add - Add a virtual interface
15333707 1651 * @priv: Private driver interface data
22a7c9d7
JM
1652 * @type: Interface type
1653 * @ifname: Interface name for the new virtual interface
1654 * @addr: Local address to use for the interface or %NULL to use the
1655 * parent interface address
8043e725 1656 * @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces
a2e40bb6
FF
1657 * @drv_priv: Pointer for overwriting the driver context or %NULL if
1658 * not allowed (applies only to %WPA_IF_AP_BSS type)
f3585c8a
JM
1659 * @force_ifname: Buffer for returning an interface name that the
1660 * driver ended up using if it differs from the requested ifname
1661 * @if_addr: Buffer for returning the allocated interface address
1662 * (this may differ from the requested addr if the driver cannot
1663 * change interface address)
e17a2477 1664 * @bridge: Bridge interface to use or %NULL if no bridge configured
22a7c9d7
JM
1665 * Returns: 0 on success, -1 on failure
1666 */
7ab68865
JM
1667 int (*if_add)(void *priv, enum wpa_driver_if_type type,
1668 const char *ifname, const u8 *addr, void *bss_ctx,
e17a2477
JM
1669 void **drv_priv, char *force_ifname, u8 *if_addr,
1670 const char *bridge);
22a7c9d7
JM
1671
1672 /**
1673 * if_remove - Remove a virtual interface
1674 * @priv: Private driver interface data
1675 * @type: Interface type
1676 * @ifname: Interface name of the virtual interface to be removed
1677 * Returns: 0 on success, -1 on failure
1678 */
1679 int (*if_remove)(void *priv, enum wpa_driver_if_type type,
1680 const char *ifname);
90b8c4c5 1681
15333707
JM
1682 /**
1683 * set_sta_vlan - Bind a station into a specific interface (AP only)
1684 * @priv: Private driver interface data
1685 * @ifname: Interface (main or virtual BSS or VLAN)
1686 * @addr: MAC address of the associated station
1687 * @vlan_id: VLAN ID
1688 * Returns: 0 on success, -1 on failure
1689 *
1690 * This function is used to bind a station to a specific virtual
1691 * interface. It is only used if when virtual interfaces are supported,
1692 * e.g., to assign stations to different VLAN interfaces based on
1693 * information from a RADIUS server. This allows separate broadcast
1694 * domains to be used with a single BSS.
1695 */
c5121837
JM
1696 int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
1697 int vlan_id);
15333707 1698
c5121837 1699 /**
15333707 1700 * commit - Optional commit changes handler (AP only)
c5121837
JM
1701 * @priv: driver private data
1702 * Returns: 0 on success, -1 on failure
1703 *
1704 * This optional handler function can be registered if the driver
1705 * interface implementation needs to commit changes (e.g., by setting
1706 * network interface up) at the end of initial configuration. If set,
1707 * this handler will be called after initial setup has been completed.
1708 */
1709 int (*commit)(void *priv);
1710
90b8c4c5
JM
1711 /**
1712 * send_ether - Send an ethernet packet (AP only)
1713 * @priv: private driver interface data
1714 * @dst: Destination MAC address
1715 * @src: Source MAC address
1716 * @proto: Ethertype
1717 * @data: EAPOL packet starting with IEEE 802.1X header
1718 * @data_len: Length of the EAPOL packet in octets
1719 * Returns: 0 on success, -1 on failure
1720 */
c5121837
JM
1721 int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto,
1722 const u8 *data, size_t data_len);
1723
90b8c4c5
JM
1724 /**
1725 * set_radius_acl_auth - Notification of RADIUS ACL change
1726 * @priv: Private driver interface data
1727 * @mac: MAC address of the station
1728 * @accepted: Whether the station was accepted
1729 * @session_timeout: Session timeout for the station
1730 * Returns: 0 on success, -1 on failure
1731 */
c5121837
JM
1732 int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted,
1733 u32 session_timeout);
90b8c4c5
JM
1734
1735 /**
1736 * set_radius_acl_expire - Notification of RADIUS ACL expiration
1737 * @priv: Private driver interface data
1738 * @mac: MAC address of the station
1739 * Returns: 0 on success, -1 on failure
1740 */
c5121837
JM
1741 int (*set_radius_acl_expire)(void *priv, const u8 *mac);
1742
90b8c4c5
JM
1743 /**
1744 * set_ht_params - Set HT parameters (AP only)
90b8c4c5
JM
1745 * @priv: Private driver interface data
1746 * @ht_capab: HT Capabilities IE
1747 * @ht_capab_len: Length of ht_capab in octets
1748 * @ht_oper: HT Operation IE
1749 * @ht_oper_len: Length of ht_oper in octets
1750 * Returns: 0 on success, -1 on failure
1751 */
d3e3a205 1752 int (*set_ht_params)(void *priv,
c5121837
JM
1753 const u8 *ht_capab, size_t ht_capab_len,
1754 const u8 *ht_oper, size_t ht_oper_len);
1755
15333707 1756 /**
b3db190f 1757 * set_ap_wps_ie - Add WPS IE(s) into Beacon/Probe Response frames (AP)
15333707 1758 * @priv: Private driver interface data
b3db190f
JM
1759 * @beacon: WPS IE(s) for Beacon frames or %NULL to remove extra IE(s)
1760 * @proberesp: WPS IE(s) for Probe Response frames or %NULL to remove
1761 * extra IE(s)
0e2e565a
JM
1762 * @assocresp: WPS IE(s) for (Re)Association Response frames or %NULL
1763 * to remove extra IE(s)
15333707
JM
1764 * Returns: 0 on success, -1 on failure
1765 *
1766 * This is an optional function to add WPS IE in the kernel driver for
14f79386
JM
1767 * Beacon and Probe Response frames. This can be left undefined (set
1768 * to %NULL) if the driver uses the Beacon template from set_beacon()
0e2e565a
JM
1769 * and does not process Probe Request frames. If the driver takes care
1770 * of (Re)Association frame processing, the assocresp buffer includes
1771 * WPS IE(s) that need to be added to (Re)Association Response frames
1772 * whenever a (Re)Association Request frame indicated use of WPS.
75bde05d
JM
1773 *
1774 * This will also be used to add P2P IE(s) into Beacon/Probe Response
1775 * frames when operating as a GO. The driver is responsible for adding
1776 * timing related attributes (e.g., NoA) in addition to the IEs
1777 * included here by appending them after these buffers. This call is
1778 * also used to provide Probe Response IEs for P2P Listen state
1779 * operations for drivers that generate the Probe Response frames
1780 * internally.
15333707 1781 */
0ebdf627 1782 int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon,
0e2e565a
JM
1783 const struct wpabuf *proberesp,
1784 const struct wpabuf *assocresp);
4bc181ec
JM
1785
1786 /**
1787 * set_supp_port - Set IEEE 802.1X Supplicant Port status
1788 * @priv: Private driver interface data
1789 * @authorized: Whether the port is authorized
1790 * Returns: 0 on success, -1 on failure
1791 */
1792 int (*set_supp_port)(void *priv, int authorized);
fbbfcbac
FF
1793
1794 /**
1795 * set_wds_sta - Bind a station into a 4-address WDS (AP only)
1796 * @priv: Private driver interface data
1797 * @addr: MAC address of the associated station
1798 * @aid: Association ID
1799 * @val: 1 = bind to 4-address WDS; 0 = unbind
d38ae2ea
FF
1800 * @bridge_ifname: Bridge interface to use for the WDS station or %NULL
1801 * to indicate that bridge is not to be used
fbbfcbac
FF
1802 * Returns: 0 on success, -1 on failure
1803 */
d38ae2ea
FF
1804 int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val,
1805 const char *bridge_ifname);
504e905c 1806
55777702
JM
1807 /**
1808 * send_action - Transmit an Action frame
1809 * @priv: Private driver interface data
1810 * @freq: Frequency (in MHz) of the channel
190b9062 1811 * @wait: Time to wait off-channel for a response (in ms), or zero
e8828999
JM
1812 * @dst: Destination MAC address (Address 1)
1813 * @src: Source MAC address (Address 2)
1814 * @bssid: BSSID (Address 3)
55777702
JM
1815 * @data: Frame body
1816 * @data_len: data length in octets
1817 * Returns: 0 on success, -1 on failure
1818 *
1819 * This command can be used to request the driver to transmit an action
190b9062
JB
1820 * frame to the specified destination.
1821 *
1822 * If the %WPA_DRIVER_FLAGS_OFFCHANNEL_TX flag is set, the frame will
1823 * be transmitted on the given channel and the device will wait for a
1824 * response on that channel for the given wait time.
1825 *
1826 * If the flag is not set, the wait time will be ignored. In this case,
1827 * if a remain-on-channel duration is in progress, the frame must be
1828 * transmitted on that channel; alternatively the frame may be sent on
1829 * the current operational channel (if in associated state in station
1830 * mode or while operating as an AP.)
55777702 1831 */
190b9062 1832 int (*send_action)(void *priv, unsigned int freq, unsigned int wait,
e8828999 1833 const u8 *dst, const u8 *src, const u8 *bssid,
55777702
JM
1834 const u8 *data, size_t data_len);
1835
190b9062
JB
1836 /**
1837 * send_action_cancel_wait - Cancel action frame TX wait
1838 * @priv: Private driver interface data
1839 *
1840 * This command cancels the wait time associated with sending an action
1841 * frame. It is only available when %WPA_DRIVER_FLAGS_OFFCHANNEL_TX is
1842 * set in the driver flags.
1843 */
1844 void (*send_action_cancel_wait)(void *priv);
1845
55777702
JM
1846 /**
1847 * remain_on_channel - Remain awake on a channel
1848 * @priv: Private driver interface data
1849 * @freq: Frequency (in MHz) of the channel
1850 * @duration: Duration in milliseconds
1851 * Returns: 0 on success, -1 on failure
1852 *
1853 * This command is used to request the driver to remain awake on the
1854 * specified channel for the specified duration and report received
1855 * Action frames with EVENT_RX_ACTION events. Optionally, received
1856 * Probe Request frames may also be requested to be reported by calling
1857 * probe_req_report(). These will be reported with EVENT_RX_PROBE_REQ.
1858 *
1859 * The driver may not be at the requested channel when this function
1860 * returns, i.e., the return code is only indicating whether the
1861 * request was accepted. The caller will need to wait until the
1862 * EVENT_REMAIN_ON_CHANNEL event indicates that the driver has
1863 * completed the channel change. This may take some time due to other
1864 * need for the radio and the caller should be prepared to timing out
1865 * its wait since there are no guarantees on when this request can be
1866 * executed.
1867 */
1868 int (*remain_on_channel)(void *priv, unsigned int freq,
1869 unsigned int duration);
1870
1871 /**
1872 * cancel_remain_on_channel - Cancel remain-on-channel operation
1873 * @priv: Private driver interface data
1874 *
1875 * This command can be used to cancel a remain-on-channel operation
1876 * before its originally requested duration has passed. This could be
1877 * used, e.g., when remain_on_channel() is used to request extra time
1878 * to receive a response to an Action frame and the response is
1879 * received when there is still unneeded time remaining on the
1880 * remain-on-channel operation.
1881 */
1882 int (*cancel_remain_on_channel)(void *priv);
1883
504e905c
JM
1884 /**
1885 * probe_req_report - Request Probe Request frames to be indicated
1886 * @priv: Private driver interface data
1887 * @report: Whether to report received Probe Request frames
1888 * Returns: 0 on success, -1 on failure (or if not supported)
1889 *
1890 * This command can be used to request the driver to indicate when
1891 * Probe Request frames are received with EVENT_RX_PROBE_REQ events.
1892 * Since this operation may require extra resources, e.g., due to less
1893 * optimal hardware/firmware RX filtering, many drivers may disable
1894 * Probe Request reporting at least in station mode. This command is
1895 * used to notify the driver when the Probe Request frames need to be
1896 * reported, e.g., during remain-on-channel operations.
1897 */
1898 int (*probe_req_report)(void *priv, int report);
4e5cb1a3
JM
1899
1900 /**
1901 * disable_11b_rates - Set whether IEEE 802.11b rates are used for TX
1902 * @priv: Private driver interface data
1903 * @disabled: Whether IEEE 802.11b rates are disabled
1904 * Returns: 0 on success, -1 on failure (or if not supported)
1905 *
1906 * This command is used to disable IEEE 802.11b rates (1, 2, 5.5, and
1907 * 11 Mbps) as TX rates for data and management frames. This can be
1908 * used to optimize channel use when there is no need to support IEEE
1909 * 802.11b-only devices.
1910 */
1911 int (*disable_11b_rates)(void *priv, int disabled);
af473088
JM
1912
1913 /**
1914 * deinit_ap - Deinitialize AP mode
1915 * @priv: Private driver interface data
1916 * Returns: 0 on success, -1 on failure (or if not supported)
1917 *
1918 * This optional function can be used to disable AP mode related
1919 * configuration and change the driver mode to station mode to allow
1920 * normal station operations like scanning to be completed.
1921 */
1922 int (*deinit_ap)(void *priv);
207ef3fb
JM
1923
1924 /**
1925 * suspend - Notification on system suspend/hibernate event
1926 * @priv: Private driver interface data
1927 */
1928 void (*suspend)(void *priv);
1929
1930 /**
1931 * resume - Notification on system resume/thaw event
1932 * @priv: Private driver interface data
1933 */
1934 void (*resume)(void *priv);
b625473c
JM
1935
1936 /**
1937 * signal_monitor - Set signal monitoring parameters
1938 * @priv: Private driver interface data
1939 * @threshold: Threshold value for signal change events; 0 = disabled
1940 * @hysteresis: Minimum change in signal strength before indicating a
1941 * new event
1942 * Returns: 0 on success, -1 on failure (or if not supported)
1943 *
1944 * This function can be used to configure monitoring of signal strength
1945 * with the current AP. Whenever signal strength drops below the
1946 * %threshold value or increases above it, EVENT_SIGNAL_CHANGE event
1947 * should be generated assuming the signal strength has changed at
1948 * least %hysteresis from the previously indicated signal change event.
1949 */
1950 int (*signal_monitor)(void *priv, int threshold, int hysteresis);
b91ab76e
JM
1951
1952 /**
1953 * send_frame - Send IEEE 802.11 frame (testing use only)
1954 * @priv: Private driver interface data
1955 * @data: IEEE 802.11 frame with IEEE 802.11 header
1956 * @data_len: Size of the frame
1957 * @encrypt: Whether to encrypt the frame (if keys are set)
1958 * Returns: 0 on success, -1 on failure
1959 *
1960 * This function is only used for debugging purposes and is not
1961 * required to be implemented for normal operations.
1962 */
1963 int (*send_frame)(void *priv, const u8 *data, size_t data_len,
1964 int encrypt);
75bde05d
JM
1965
1966 /**
1967 * shared_freq - Get operating frequency of shared interface(s)
1968 * @priv: Private driver interface data
1969 * Returns: Operating frequency in MHz, 0 if no shared operation in
1970 * use, or -1 on failure
1971 *
1972 * This command can be used to request the current operating frequency
1973 * of any virtual interface that shares the same radio to provide
1974 * information for channel selection for other virtual interfaces.
1975 */
1976 int (*shared_freq)(void *priv);
1977
1978 /**
1979 * get_noa - Get current Notice of Absence attribute payload
1980 * @priv: Private driver interface data
1981 * @buf: Buffer for returning NoA
1982 * @buf_len: Buffer length in octets
1983 * Returns: Number of octets used in buf, 0 to indicate no NoA is being
1984 * advertized, or -1 on failure
1985 *
1986 * This function is used to fetch the current Notice of Absence
1987 * attribute value from GO.
1988 */
1989 int (*get_noa)(void *priv, u8 *buf, size_t buf_len);
1990
1991 /**
1992 * set_noa - Set Notice of Absence parameters for GO (testing)
1993 * @priv: Private driver interface data
1994 * @count: Count
1995 * @start: Start time in ms from next TBTT
1996 * @duration: Duration in ms
1997 * Returns: 0 on success or -1 on failure
1998 *
1999 * This function is used to set Notice of Absence parameters for GO. It
2000 * is used only for testing. To disable NoA, all parameters are set to
2001 * 0.
2002 */
2003 int (*set_noa)(void *priv, u8 count, int start, int duration);
c381508d
JM
2004
2005 /**
2006 * set_p2p_powersave - Set P2P power save options
2007 * @priv: Private driver interface data
2008 * @legacy_ps: 0 = disable, 1 = enable, 2 = maximum PS, -1 = no change
2009 * @opp_ps: 0 = disable, 1 = enable, -1 = no change
2010 * @ctwindow: 0.. = change (msec), -1 = no change
2011 * Returns: 0 on success or -1 on failure
2012 */
2013 int (*set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps,
2014 int ctwindow);
b6c79a99
JM
2015
2016 /**
2017 * ampdu - Enable/disable aggregation
2018 * @priv: Private driver interface data
2019 * @ampdu: 1/0 = enable/disable A-MPDU aggregation
2020 * Returns: 0 on success or -1 on failure
2021 */
2022 int (*ampdu)(void *priv, int ampdu);
0f66abd2
SS
2023
2024 /**
2025 * set_intra_bss - Enables/Disables intra BSS bridging
2026 */
2027 int (*set_intra_bss)(void *priv, int enabled);
6859f1cb
BG
2028
2029 /**
2030 * get_radio_name - Get physical radio name for the device
2031 * @priv: Private driver interface data
2032 * Returns: Radio name or %NULL if not known
2033 *
2034 * The returned data must not be modified by the caller. It is assumed
2035 * that any interface that has the same radio name as another is
2036 * sharing the same physical radio. This information can be used to
2037 * share scan results etc. information between the virtual interfaces
2038 * to speed up various operations.
2039 */
2040 const char * (*get_radio_name)(void *priv);
3ac17eba
JM
2041
2042 /**
2043 * p2p_find - Start P2P Device Discovery
2044 * @priv: Private driver interface data
2045 * @timeout: Timeout for find operation in seconds or 0 for no timeout
2046 * @type: Device Discovery type (enum p2p_discovery_type)
2047 * Returns: 0 on success, -1 on failure
2048 *
2049 * This function is only used if the driver implements P2P management,
2050 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2051 * struct wpa_driver_capa.
2052 */
2053 int (*p2p_find)(void *priv, unsigned int timeout, int type);
2054
2055 /**
2056 * p2p_stop_find - Stop P2P Device Discovery
2057 * @priv: Private driver interface data
2058 * Returns: 0 on success, -1 on failure
2059 *
2060 * This function is only used if the driver implements P2P management,
2061 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2062 * struct wpa_driver_capa.
2063 */
2064 int (*p2p_stop_find)(void *priv);
2065
2066 /**
2067 * p2p_listen - Start P2P Listen state for specified duration
2068 * @priv: Private driver interface data
2069 * @timeout: Listen state duration in milliseconds
2070 * Returns: 0 on success, -1 on failure
2071 *
2072 * This function can be used to request the P2P module to keep the
2073 * device discoverable on the listen channel for an extended set of
2074 * time. At least in its current form, this is mainly used for testing
2075 * purposes and may not be of much use for normal P2P operations.
2076 *
2077 * This function is only used if the driver implements P2P management,
2078 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2079 * struct wpa_driver_capa.
2080 */
2081 int (*p2p_listen)(void *priv, unsigned int timeout);
2082
2083 /**
2084 * p2p_connect - Start P2P group formation (GO negotiation)
2085 * @priv: Private driver interface data
2086 * @peer_addr: MAC address of the peer P2P client
2087 * @wps_method: enum p2p_wps_method value indicating config method
2088 * @go_intent: Local GO intent value (1..15)
2089 * @own_interface_addr: Intended interface address to use with the
2090 * group
2091 * @force_freq: The only allowed channel frequency in MHz or 0
2092 * @persistent_group: Whether to create persistent group
2093 * Returns: 0 on success, -1 on failure
2094 *
2095 * This function is only used if the driver implements P2P management,
2096 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2097 * struct wpa_driver_capa.
2098 */
2099 int (*p2p_connect)(void *priv, const u8 *peer_addr, int wps_method,
2100 int go_intent, const u8 *own_interface_addr,
2101 unsigned int force_freq, int persistent_group);
2102
2103 /**
2104 * wps_success_cb - Report successfully completed WPS provisioning
2105 * @priv: Private driver interface data
2106 * @peer_addr: Peer address
2107 * Returns: 0 on success, -1 on failure
2108 *
2109 * This function is used to report successfully completed WPS
2110 * provisioning during group formation in both GO/Registrar and
2111 * client/Enrollee roles.
2112 *
2113 * This function is only used if the driver implements P2P management,
2114 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2115 * struct wpa_driver_capa.
2116 */
2117 int (*wps_success_cb)(void *priv, const u8 *peer_addr);
2118
2119 /**
2120 * p2p_group_formation_failed - Report failed WPS provisioning
2121 * @priv: Private driver interface data
2122 * Returns: 0 on success, -1 on failure
2123 *
2124 * This function is used to report failed group formation. This can
2125 * happen either due to failed WPS provisioning or due to 15 second
2126 * timeout during the provisioning phase.
2127 *
2128 * This function is only used if the driver implements P2P management,
2129 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2130 * struct wpa_driver_capa.
2131 */
2132 int (*p2p_group_formation_failed)(void *priv);
2133
2134 /**
2135 * p2p_set_params - Set P2P parameters
2136 * @priv: Private driver interface data
2137 * @params: P2P parameters
2138 * Returns: 0 on success, -1 on failure
2139 *
2140 * This function is only used if the driver implements P2P management,
2141 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2142 * struct wpa_driver_capa.
2143 */
2144 int (*p2p_set_params)(void *priv, const struct p2p_params *params);
2145
2146 /**
2147 * p2p_prov_disc_req - Send Provision Discovery Request
2148 * @priv: Private driver interface data
2149 * @peer_addr: MAC address of the peer P2P client
2150 * @config_methods: WPS Config Methods value (only one bit set)
2151 * Returns: 0 on success, -1 on failure
2152 *
2153 * This function can be used to request a discovered P2P peer to
2154 * display a PIN (config_methods = WPS_CONFIG_DISPLAY) or be prepared
2155 * to enter a PIN from us (config_methods = WPS_CONFIG_KEYPAD). The
2156 * Provision Discovery Request frame is transmitted once immediately
2157 * and if no response is received, the frame will be sent again
2158 * whenever the target device is discovered during device dsicovery
2159 * (start with a p2p_find() call). Response from the peer is indicated
2160 * with the EVENT_P2P_PROV_DISC_RESPONSE event.
2161 *
2162 * This function is only used if the driver implements P2P management,
2163 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2164 * struct wpa_driver_capa.
2165 */
2166 int (*p2p_prov_disc_req)(void *priv, const u8 *peer_addr,
2167 u16 config_methods);
2168
2169 /**
2170 * p2p_sd_request - Schedule a service discovery query
2171 * @priv: Private driver interface data
2172 * @dst: Destination peer or %NULL to apply for all peers
2173 * @tlvs: P2P Service Query TLV(s)
2174 * Returns: Reference to the query or 0 on failure
2175 *
2176 * Response to the query is indicated with the
2177 * EVENT_P2P_SD_RESPONSE driver event.
2178 *
2179 * This function is only used if the driver implements P2P management,
2180 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2181 * struct wpa_driver_capa.
2182 */
2183 u64 (*p2p_sd_request)(void *priv, const u8 *dst,
2184 const struct wpabuf *tlvs);
2185
2186 /**
2187 * p2p_sd_cancel_request - Cancel a pending service discovery query
2188 * @priv: Private driver interface data
2189 * @req: Query reference from p2p_sd_request()
2190 * Returns: 0 on success, -1 on failure
2191 *
2192 * This function is only used if the driver implements P2P management,
2193 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2194 * struct wpa_driver_capa.
2195 */
2196 int (*p2p_sd_cancel_request)(void *priv, u64 req);
2197
2198 /**
2199 * p2p_sd_response - Send response to a service discovery query
2200 * @priv: Private driver interface data
2201 * @freq: Frequency from EVENT_P2P_SD_REQUEST event
2202 * @dst: Destination address from EVENT_P2P_SD_REQUEST event
2203 * @dialog_token: Dialog token from EVENT_P2P_SD_REQUEST event
2204 * @resp_tlvs: P2P Service Response TLV(s)
2205 * Returns: 0 on success, -1 on failure
2206 *
2207 * This function is called as a response to the request indicated with
2208 * the EVENT_P2P_SD_REQUEST driver event.
2209 *
2210 * This function is only used if the driver implements P2P management,
2211 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2212 * struct wpa_driver_capa.
2213 */
2214 int (*p2p_sd_response)(void *priv, int freq, const u8 *dst,
2215 u8 dialog_token,
2216 const struct wpabuf *resp_tlvs);
2217
2218 /**
2219 * p2p_service_update - Indicate a change in local services
2220 * @priv: Private driver interface data
2221 * Returns: 0 on success, -1 on failure
2222 *
2223 * This function needs to be called whenever there is a change in
2224 * availability of the local services. This will increment the
2225 * Service Update Indicator value which will be used in SD Request and
2226 * Response frames.
2227 *
2228 * This function is only used if the driver implements P2P management,
2229 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2230 * struct wpa_driver_capa.
2231 */
2232 int (*p2p_service_update)(void *priv);
2233
2234 /**
2235 * p2p_reject - Reject peer device (explicitly block connections)
2236 * @priv: Private driver interface data
2237 * @addr: MAC address of the peer
2238 * Returns: 0 on success, -1 on failure
2239 */
2240 int (*p2p_reject)(void *priv, const u8 *addr);
2241
2242 /**
2243 * p2p_invite - Invite a P2P Device into a group
2244 * @priv: Private driver interface data
2245 * @peer: Device Address of the peer P2P Device
2246 * @role: Local role in the group
2247 * @bssid: Group BSSID or %NULL if not known
2248 * @ssid: Group SSID
2249 * @ssid_len: Length of ssid in octets
2250 * @go_dev_addr: Forced GO Device Address or %NULL if none
2251 * @persistent_group: Whether this is to reinvoke a persistent group
2252 * Returns: 0 on success, -1 on failure
2253 */
2254 int (*p2p_invite)(void *priv, const u8 *peer, int role,
2255 const u8 *bssid, const u8 *ssid, size_t ssid_len,
2256 const u8 *go_dev_addr, int persistent_group);
281ff0aa
GP
2257
2258 /**
2259 * send_tdls_mgmt - for sending TDLS management packets
2260 * @priv: private driver interface data
2261 * @dst: Destination (peer) MAC address
2262 * @action_code: TDLS action code for the mssage
2263 * @dialog_token: Dialog Token to use in the message (if needed)
2264 * @status_code: Status Code or Reason Code to use (if needed)
2265 * @buf: TDLS IEs to add to the message
2266 * @len: Length of buf in octets
2267 * Returns: 0 on success, -1 on failure
2268 *
2269 * This optional function can be used to send packet to driver which is
2270 * responsible for receiving and sending all TDLS packets.
2271 */
2272 int (*send_tdls_mgmt)(void *priv, const u8 *dst, u8 action_code,
2273 u8 dialog_token, u16 status_code,
2274 const u8 *buf, size_t len);
2275
2276 int (*tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer);
1c5c7273
PS
2277
2278 /**
2279 * signal_poll - Get current connection information
2280 * @priv: Private driver interface data
2281 * @signal_info: Connection info structure
2282 */
2283 int (*signal_poll)(void *priv, struct wpa_signal_info *signal_info);
41fd1d9e
KZ
2284
2285 /**
2286 * set_authmode - Set authentication algorithm(s) for static WEP
2287 * @priv: Private driver interface data
2288 * @authmode: 1=Open System, 2=Shared Key, 3=both
2289 * Returns: 0 on success, -1 on failure
2290 *
2291 * This function can be used to set authentication algorithms for AP
2292 * mode when static WEP is used. If the driver uses user space MLME/SME
2293 * implementation, there is no need to implement this function.
2294 */
2295 int (*set_authmode)(void *priv, int authmode);
b14a210c
JB
2296
2297 /**
2298 * set_rekey_info - Set rekey information
2299 * @priv: Private driver interface data
2300 * @kek: Current KEK
2301 * @kck: Current KCK
2302 * @replay_ctr: Current EAPOL-Key Replay Counter
2303 *
2304 * This optional function can be used to provide information for the
2305 * driver/firmware to process EAPOL-Key frames in Group Key Handshake
2306 * while the host (including wpa_supplicant) is sleeping.
2307 */
2308 void (*set_rekey_info)(void *priv, const u8 *kek, const u8 *kck,
2309 const u8 *replay_ctr);
6fc6879b
JM
2310};
2311
e0498677 2312
6fc6879b
JM
2313/**
2314 * enum wpa_event_type - Event type for wpa_supplicant_event() calls
2315 */
9646a8ab 2316enum wpa_event_type {
6fc6879b
JM
2317 /**
2318 * EVENT_ASSOC - Association completed
2319 *
2320 * This event needs to be delivered when the driver completes IEEE
2321 * 802.11 association or reassociation successfully.
2322 * wpa_driver_ops::get_bssid() is expected to provide the current BSSID
2323 * after this event has been generated. In addition, optional
2324 * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
2325 * more information about the association. If the driver interface gets
2326 * both of these events at the same time, it can also include the
2327 * assoc_info data in EVENT_ASSOC call.
2328 */
2329 EVENT_ASSOC,
2330
2331 /**
2332 * EVENT_DISASSOC - Association lost
2333 *
2334 * This event should be called when association is lost either due to
2335 * receiving deauthenticate or disassociate frame from the AP or when
c2a04078
JM
2336 * sending either of these frames to the current AP. If the driver
2337 * supports separate deauthentication event, EVENT_DISASSOC should only
2338 * be used for disassociation and EVENT_DEAUTH for deauthentication.
1d041bec 2339 * In AP mode, union wpa_event_data::disassoc_info is required.
6fc6879b
JM
2340 */
2341 EVENT_DISASSOC,
2342
2343 /**
2344 * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
2345 *
2346 * This event must be delivered when a Michael MIC error is detected by
2347 * the local driver. Additional data for event processing is
2348 * provided with union wpa_event_data::michael_mic_failure. This
2349 * information is used to request new encyption key and to initiate
2350 * TKIP countermeasures if needed.
2351 */
2352 EVENT_MICHAEL_MIC_FAILURE,
2353
2354 /**
2355 * EVENT_SCAN_RESULTS - Scan results available
2356 *
2357 * This event must be called whenever scan results are available to be
2358 * fetched with struct wpa_driver_ops::get_scan_results(). This event
2359 * is expected to be used some time after struct wpa_driver_ops::scan()
2360 * is called. If the driver provides an unsolicited event when the scan
2361 * has been completed, this event can be used to trigger
2362 * EVENT_SCAN_RESULTS call. If such event is not available from the
2363 * driver, the driver wrapper code is expected to use a registered
2364 * timeout to generate EVENT_SCAN_RESULTS call after the time that the
8d923a4a
JM
2365 * scan is expected to be completed. Optional information about
2366 * completed scan can be provided with union wpa_event_data::scan_info.
6fc6879b
JM
2367 */
2368 EVENT_SCAN_RESULTS,
2369
2370 /**
2371 * EVENT_ASSOCINFO - Report optional extra information for association
2372 *
2373 * This event can be used to report extra association information for
2374 * EVENT_ASSOC processing. This extra information includes IEs from
2375 * association frames and Beacon/Probe Response frames in union
2376 * wpa_event_data::assoc_info. EVENT_ASSOCINFO must be send just before
2377 * EVENT_ASSOC. Alternatively, the driver interface can include
2378 * assoc_info data in the EVENT_ASSOC call if it has all the
2379 * information available at the same point.
2380 */
2381 EVENT_ASSOCINFO,
2382
2383 /**
2384 * EVENT_INTERFACE_STATUS - Report interface status changes
2385 *
2386 * This optional event can be used to report changes in interface
2387 * status (interface added/removed) using union
2388 * wpa_event_data::interface_status. This can be used to trigger
2389 * wpa_supplicant to stop and re-start processing for the interface,
2390 * e.g., when a cardbus card is ejected/inserted.
2391 */
2392 EVENT_INTERFACE_STATUS,
2393
2394 /**
2395 * EVENT_PMKID_CANDIDATE - Report a candidate AP for pre-authentication
2396 *
2397 * This event can be used to inform wpa_supplicant about candidates for
2398 * RSN (WPA2) pre-authentication. If wpa_supplicant is not responsible
2399 * for scan request (ap_scan=2 mode), this event is required for
2400 * pre-authentication. If wpa_supplicant is performing scan request
2401 * (ap_scan=1), this event is optional since scan results can be used
2402 * to add pre-authentication candidates. union
2403 * wpa_event_data::pmkid_candidate is used to report the BSSID of the
2404 * candidate and priority of the candidate, e.g., based on the signal
2405 * strength, in order to try to pre-authenticate first with candidates
2406 * that are most likely targets for re-association.
2407 *
2408 * EVENT_PMKID_CANDIDATE can be called whenever the driver has updates
2409 * on the candidate list. In addition, it can be called for the current
2410 * AP and APs that have existing PMKSA cache entries. wpa_supplicant
2411 * will automatically skip pre-authentication in cases where a valid
2412 * PMKSA exists. When more than one candidate exists, this event should
2413 * be generated once for each candidate.
2414 *
2415 * Driver will be notified about successful pre-authentication with
2416 * struct wpa_driver_ops::add_pmkid() calls.
2417 */
2418 EVENT_PMKID_CANDIDATE,
2419
2420 /**
2421 * EVENT_STKSTART - Request STK handshake (MLME-STKSTART.request)
2422 *
2423 * This event can be used to inform wpa_supplicant about desire to set
2424 * up secure direct link connection between two stations as defined in
2425 * IEEE 802.11e with a new PeerKey mechanism that replaced the original
2426 * STAKey negotiation. The caller will need to set peer address for the
2427 * event.
2428 */
2429 EVENT_STKSTART,
2430
281ff0aa
GP
2431 /**
2432 * EVENT_TDLS - Request TDLS operation
2433 *
2434 * This event can be used to request a TDLS operation to be performed.
2435 */
2436 EVENT_TDLS,
2437
6fc6879b
JM
2438 /**
2439 * EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs
2440 *
2441 * The driver is expected to report the received FT IEs from
2442 * FT authentication sequence from the AP. The FT IEs are included in
2443 * the extra information in union wpa_event_data::ft_ies.
2444 */
11ef8d35
JM
2445 EVENT_FT_RESPONSE,
2446
2447 /**
2448 * EVENT_IBSS_RSN_START - Request RSN authentication in IBSS
2449 *
2450 * The driver can use this event to inform wpa_supplicant about a STA
2451 * in an IBSS with which protected frames could be exchanged. This
2452 * event starts RSN authentication with the other STA to authenticate
2453 * the STA and set up encryption keys with it.
2454 */
c2a04078
JM
2455 EVENT_IBSS_RSN_START,
2456
2457 /**
2458 * EVENT_AUTH - Authentication result
2459 *
2460 * This event should be called when authentication attempt has been
2461 * completed. This is only used if the driver supports separate
2462 * authentication step (struct wpa_driver_ops::authenticate).
2463 * Information about authentication result is included in
2464 * union wpa_event_data::auth.
2465 */
2466 EVENT_AUTH,
2467
2468 /**
2469 * EVENT_DEAUTH - Authentication lost
2470 *
2471 * This event should be called when authentication is lost either due
2472 * to receiving deauthenticate frame from the AP or when sending that
2473 * frame to the current AP.
1d041bec 2474 * In AP mode, union wpa_event_data::deauth_info is required.
c2a04078 2475 */
efa46078
JM
2476 EVENT_DEAUTH,
2477
2478 /**
2479 * EVENT_ASSOC_REJECT - Association rejected
2480 *
2481 * This event should be called when (re)association attempt has been
59ddf221 2482 * rejected by the AP. Information about the association response is
efa46078
JM
2483 * included in union wpa_event_data::assoc_reject.
2484 */
da1fb17c
JM
2485 EVENT_ASSOC_REJECT,
2486
2487 /**
2488 * EVENT_AUTH_TIMED_OUT - Authentication timed out
2489 */
2490 EVENT_AUTH_TIMED_OUT,
2491
2492 /**
2493 * EVENT_ASSOC_TIMED_OUT - Association timed out
2494 */
08fd8c15
JM
2495 EVENT_ASSOC_TIMED_OUT,
2496
2497 /**
2498 * EVENT_FT_RRB_RX - FT (IEEE 802.11r) RRB frame received
2499 */
fcf0f87d
JM
2500 EVENT_FT_RRB_RX,
2501
2502 /**
2503 * EVENT_WPS_BUTTON_PUSHED - Report hardware push button press for WPS
2504 */
f8b1f695
JM
2505 EVENT_WPS_BUTTON_PUSHED,
2506
2507 /**
2508 * EVENT_TX_STATUS - Report TX status
2509 */
2510 EVENT_TX_STATUS,
2511
2512 /**
2513 * EVENT_RX_FROM_UNKNOWN - Report RX from unknown STA
2514 */
2515 EVENT_RX_FROM_UNKNOWN,
2516
2517 /**
2518 * EVENT_RX_MGMT - Report RX of a management frame
2519 */
245519e0
JM
2520 EVENT_RX_MGMT,
2521
55777702
JM
2522 /**
2523 * EVENT_RX_ACTION - Action frame received
2524 *
2525 * This event is used to indicate when an Action frame has been
2526 * received. Information about the received frame is included in
2527 * union wpa_event_data::rx_action.
2528 */
2529 EVENT_RX_ACTION,
2530
2531 /**
2532 * EVENT_REMAIN_ON_CHANNEL - Remain-on-channel duration started
2533 *
2534 * This event is used to indicate when the driver has started the
2535 * requested remain-on-channel duration. Information about the
2536 * operation is included in union wpa_event_data::remain_on_channel.
2537 */
2538 EVENT_REMAIN_ON_CHANNEL,
2539
2540 /**
2541 * EVENT_CANCEL_REMAIN_ON_CHANNEL - Remain-on-channel timed out
2542 *
2543 * This event is used to indicate when the driver has completed
2544 * remain-on-channel duration, i.e., may noot be available on the
2545 * requested channel anymore. Information about the
2546 * operation is included in union wpa_event_data::remain_on_channel.
2547 */
2548 EVENT_CANCEL_REMAIN_ON_CHANNEL,
2549
245519e0
JM
2550 /**
2551 * EVENT_MLME_RX - Report reception of frame for MLME (test use only)
2552 *
2553 * This event is used only by driver_test.c and userspace MLME.
2554 */
a0e0d3bb
JM
2555 EVENT_MLME_RX,
2556
2557 /**
2558 * EVENT_RX_PROBE_REQ - Indicate received Probe Request frame
2559 *
2560 * This event is used to indicate when a Probe Request frame has been
2561 * received. Information about the received frame is included in
504e905c
JM
2562 * union wpa_event_data::rx_probe_req. The driver is required to report
2563 * these events only after successfully completed probe_req_report()
2564 * commands to request the events (i.e., report parameter is non-zero)
2565 * in station mode. In AP mode, Probe Request frames should always be
2566 * reported.
a0e0d3bb 2567 */
a70a5d6d
JM
2568 EVENT_RX_PROBE_REQ,
2569
2570 /**
2571 * EVENT_NEW_STA - New wired device noticed
2572 *
2573 * This event is used to indicate that a new device has been detected
2574 * in a network that does not use association-like functionality (i.e.,
2575 * mainly wired Ethernet). This can be used to start EAPOL
2576 * authenticator when receiving a frame from a device. The address of
2577 * the device is included in union wpa_event_data::new_sta.
2578 */
a8e0505b
JM
2579 EVENT_NEW_STA,
2580
2581 /**
2582 * EVENT_EAPOL_RX - Report received EAPOL frame
2583 *
2584 * When in AP mode with hostapd, this event is required to be used to
2585 * deliver the receive EAPOL frames from the driver. With
2586 * %wpa_supplicant, this event is used only if the send_eapol() handler
2587 * is used to override the use of l2_packet for EAPOL frame TX.
2588 */
b625473c
JM
2589 EVENT_EAPOL_RX,
2590
2591 /**
2592 * EVENT_SIGNAL_CHANGE - Indicate change in signal strength
2593 *
2594 * This event is used to indicate changes in the signal strength
2595 * observed in frames received from the current AP if signal strength
2596 * monitoring has been enabled with signal_monitor().
2597 */
8401a6b0
JM
2598 EVENT_SIGNAL_CHANGE,
2599
2600 /**
2601 * EVENT_INTERFACE_ENABLED - Notify that interface was enabled
2602 *
2603 * This event is used to indicate that the interface was enabled after
2604 * having been previously disabled, e.g., due to rfkill.
2605 */
2606 EVENT_INTERFACE_ENABLED,
2607
2608 /**
2609 * EVENT_INTERFACE_DISABLED - Notify that interface was disabled
2610 *
2611 * This event is used to indicate that the interface was disabled,
2612 * e.g., due to rfkill.
2613 */
b5c9da8d
JM
2614 EVENT_INTERFACE_DISABLED,
2615
2616 /**
2617 * EVENT_CHANNEL_LIST_CHANGED - Channel list changed
2618 *
2619 * This event is used to indicate that the channel list has changed,
2620 * e.g., because of a regulatory domain change triggered by scan
2621 * results including an AP advertising a country code.
2622 */
c973f386
JM
2623 EVENT_CHANNEL_LIST_CHANGED,
2624
2625 /**
2626 * EVENT_INTERFACE_UNAVAILABLE - Notify that interface is unavailable
2627 *
2628 * This event is used to indicate that the driver cannot maintain this
2629 * interface in its operation mode anymore. The most likely use for
2630 * this is to indicate that AP mode operation is not available due to
2631 * operating channel would need to be changed to a DFS channel when
2632 * the driver does not support radar detection and another virtual
2633 * interfaces caused the operating channel to change. Other similar
2634 * resource conflicts could also trigger this for station mode
2635 * interfaces.
2636 */
7cfc4ac3
AGS
2637 EVENT_INTERFACE_UNAVAILABLE,
2638
2639 /**
2640 * EVENT_BEST_CHANNEL
2641 *
2642 * Driver generates this event whenever it detects a better channel
2643 * (e.g., based on RSSI or channel use). This information can be used
2644 * to improve channel selection for a new AP/P2P group.
2645 */
7d878ca7
JM
2646 EVENT_BEST_CHANNEL,
2647
2648 /**
2649 * EVENT_UNPROT_DEAUTH - Unprotected Deauthentication frame received
2650 *
2651 * This event should be called when a Deauthentication frame is dropped
2652 * due to it not being protected (MFP/IEEE 802.11w).
2653 * union wpa_event_data::unprot_deauth is required to provide more
2654 * details of the frame.
2655 */
2656 EVENT_UNPROT_DEAUTH,
2657
2658 /**
2659 * EVENT_UNPROT_DISASSOC - Unprotected Disassociation frame received
2660 *
2661 * This event should be called when a Disassociation frame is dropped
2662 * due to it not being protected (MFP/IEEE 802.11w).
2663 * union wpa_event_data::unprot_disassoc is required to provide more
2664 * details of the frame.
2665 */
2666 EVENT_UNPROT_DISASSOC,
0d7e5a3a
JB
2667
2668 /**
2669 * EVENT_STATION_LOW_ACK
2670 *
2671 * Driver generates this event whenever it detected that a particular
2672 * station was lost. Detection can be through massive transmission
2673 * failures for example.
2674 */
3ac17eba
JM
2675 EVENT_STATION_LOW_ACK,
2676
2677 /**
2678 * EVENT_P2P_DEV_FOUND - Report a discovered P2P device
2679 *
2680 * This event is used only if the driver implements P2P management
2681 * internally. Event data is stored in
2682 * union wpa_event_data::p2p_dev_found.
2683 */
2684 EVENT_P2P_DEV_FOUND,
2685
2686 /**
2687 * EVENT_P2P_GO_NEG_REQ_RX - Report reception of GO Negotiation Request
2688 *
2689 * This event is used only if the driver implements P2P management
2690 * internally. Event data is stored in
2691 * union wpa_event_data::p2p_go_neg_req_rx.
2692 */
2693 EVENT_P2P_GO_NEG_REQ_RX,
2694
2695 /**
2696 * EVENT_P2P_GO_NEG_COMPLETED - Report completion of GO Negotiation
2697 *
2698 * This event is used only if the driver implements P2P management
2699 * internally. Event data is stored in
2700 * union wpa_event_data::p2p_go_neg_completed.
2701 */
2702 EVENT_P2P_GO_NEG_COMPLETED,
2703
2704 EVENT_P2P_PROV_DISC_REQUEST,
2705 EVENT_P2P_PROV_DISC_RESPONSE,
2706 EVENT_P2P_SD_REQUEST,
ea244d21
XC
2707 EVENT_P2P_SD_RESPONSE,
2708
2709 /**
2710 * EVENT_IBSS_PEER_LOST - IBSS peer not reachable anymore
2711 */
b14a210c
JB
2712 EVENT_IBSS_PEER_LOST,
2713
2714 /**
2715 * EVENT_DRIVER_GTK_REKEY - Device/driver did GTK rekey
2716 *
2717 * This event carries the new replay counter to notify wpa_supplicant
2718 * of the current EAPOL-Key Replay Counter in case the driver/firmware
2719 * completed Group Key Handshake while the host (including
2720 * wpa_supplicant was sleeping).
2721 */
2722 EVENT_DRIVER_GTK_REKEY
9646a8ab 2723};
6fc6879b
JM
2724
2725
2726/**
2727 * union wpa_event_data - Additional data for wpa_supplicant_event() calls
2728 */
2729union wpa_event_data {
2730 /**
2731 * struct assoc_info - Data for EVENT_ASSOC and EVENT_ASSOCINFO events
2732 *
2733 * This structure is optional for EVENT_ASSOC calls and required for
2734 * EVENT_ASSOCINFO calls. By using EVENT_ASSOC with this data, the
2735 * driver interface does not need to generate separate EVENT_ASSOCINFO
2736 * calls.
2737 */
2738 struct assoc_info {
39b08b5f
SP
2739 /**
2740 * reassoc - Flag to indicate association or reassociation
2741 */
2742 int reassoc;
2743
6fc6879b
JM
2744 /**
2745 * req_ies - (Re)Association Request IEs
2746 *
2747 * If the driver generates WPA/RSN IE, this event data must be
2748 * returned for WPA handshake to have needed information. If
2749 * wpa_supplicant-generated WPA/RSN IE is used, this
2750 * information event is optional.
2751 *
2752 * This should start with the first IE (fixed fields before IEs
2753 * are not included).
2754 */
1d041bec 2755 const u8 *req_ies;
6fc6879b
JM
2756
2757 /**
2758 * req_ies_len - Length of req_ies in bytes
2759 */
2760 size_t req_ies_len;
2761
2762 /**
2763 * resp_ies - (Re)Association Response IEs
2764 *
2765 * Optional association data from the driver. This data is not
2766 * required WPA, but may be useful for some protocols and as
2767 * such, should be reported if this is available to the driver
2768 * interface.
2769 *
2770 * This should start with the first IE (fixed fields before IEs
2771 * are not included).
2772 */
1d041bec 2773 const u8 *resp_ies;
6fc6879b
JM
2774
2775 /**
2776 * resp_ies_len - Length of resp_ies in bytes
2777 */
2778 size_t resp_ies_len;
2779
2780 /**
2781 * beacon_ies - Beacon or Probe Response IEs
2782 *
2783 * Optional Beacon/ProbeResp data: IEs included in Beacon or
2784 * Probe Response frames from the current AP (i.e., the one
2785 * that the client just associated with). This information is
2786 * used to update WPA/RSN IE for the AP. If this field is not
2787 * set, the results from previous scan will be used. If no
2788 * data for the new AP is found, scan results will be requested
2789 * again (without scan request). At this point, the driver is
2790 * expected to provide WPA/RSN IE for the AP (if WPA/WPA2 is
2791 * used).
2792 *
2793 * This should start with the first IE (fixed fields before IEs
2794 * are not included).
2795 */
1d041bec 2796 const u8 *beacon_ies;
6fc6879b
JM
2797
2798 /**
2799 * beacon_ies_len - Length of beacon_ies */
2800 size_t beacon_ies_len;
4832ecd7
JM
2801
2802 /**
2803 * freq - Frequency of the operational channel in MHz
2804 */
2805 unsigned int freq;
1d041bec
JM
2806
2807 /**
2808 * addr - Station address (for AP mode)
2809 */
2810 const u8 *addr;
6fc6879b
JM
2811 } assoc_info;
2812
1d041bec
JM
2813 /**
2814 * struct disassoc_info - Data for EVENT_DISASSOC events
2815 */
2816 struct disassoc_info {
2817 /**
2818 * addr - Station address (for AP mode)
2819 */
2820 const u8 *addr;
0544b242
JM
2821
2822 /**
2823 * reason_code - Reason Code (host byte order) used in
2824 * Deauthentication frame
2825 */
2826 u16 reason_code;
75bde05d
JM
2827
2828 /**
2829 * ie - Optional IE(s) in Disassociation frame
2830 */
2831 const u8 *ie;
2832
2833 /**
2834 * ie_len - Length of ie buffer in octets
2835 */
2836 size_t ie_len;
1d041bec
JM
2837 } disassoc_info;
2838
2839 /**
2840 * struct deauth_info - Data for EVENT_DEAUTH events
2841 */
2842 struct deauth_info {
2843 /**
2844 * addr - Station address (for AP mode)
2845 */
2846 const u8 *addr;
0544b242
JM
2847
2848 /**
2849 * reason_code - Reason Code (host byte order) used in
2850 * Deauthentication frame
2851 */
2852 u16 reason_code;
75bde05d
JM
2853
2854 /**
2855 * ie - Optional IE(s) in Deauthentication frame
2856 */
2857 const u8 *ie;
2858
2859 /**
2860 * ie_len - Length of ie buffer in octets
2861 */
2862 size_t ie_len;
1d041bec
JM
2863 } deauth_info;
2864
6fc6879b
JM
2865 /**
2866 * struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE
2867 */
2868 struct michael_mic_failure {
2869 int unicast;
ad1e68e6 2870 const u8 *src;
6fc6879b
JM
2871 } michael_mic_failure;
2872
2873 /**
2874 * struct interface_status - Data for EVENT_INTERFACE_STATUS
2875 */
2876 struct interface_status {
2877 char ifname[100];
2878 enum {
2879 EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED
2880 } ievent;
2881 } interface_status;
2882
2883 /**
2884 * struct pmkid_candidate - Data for EVENT_PMKID_CANDIDATE
2885 */
2886 struct pmkid_candidate {
2887 /** BSSID of the PMKID candidate */
2888 u8 bssid[ETH_ALEN];
2889 /** Smaller the index, higher the priority */
2890 int index;
2891 /** Whether RSN IE includes pre-authenticate flag */
2892 int preauth;
2893 } pmkid_candidate;
2894
2895 /**
2896 * struct stkstart - Data for EVENT_STKSTART
2897 */
2898 struct stkstart {
2899 u8 peer[ETH_ALEN];
2900 } stkstart;
2901
281ff0aa
GP
2902 /**
2903 * struct tdls - Data for EVENT_TDLS
2904 */
2905 struct tdls {
2906 u8 peer[ETH_ALEN];
2907 enum {
2908 TDLS_REQUEST_SETUP,
2909 TDLS_REQUEST_TEARDOWN
2910 } oper;
2911 u16 reason_code; /* for teardown */
2912 } tdls;
2913
6fc6879b
JM
2914 /**
2915 * struct ft_ies - FT information elements (EVENT_FT_RESPONSE)
2916 *
2917 * During FT (IEEE 802.11r) authentication sequence, the driver is
2918 * expected to use this event to report received FT IEs (MDIE, FTIE,
2919 * RSN IE, TIE, possible resource request) to the supplicant. The FT
2920 * IEs for the next message will be delivered through the
2921 * struct wpa_driver_ops::update_ft_ies() callback.
2922 */
2923 struct ft_ies {
2924 const u8 *ies;
2925 size_t ies_len;
2926 int ft_action;
2927 u8 target_ap[ETH_ALEN];
babfbf15
JM
2928 /** Optional IE(s), e.g., WMM TSPEC(s), for RIC-Request */
2929 const u8 *ric_ies;
2930 /** Length of ric_ies buffer in octets */
2931 size_t ric_ies_len;
6fc6879b 2932 } ft_ies;
11ef8d35
JM
2933
2934 /**
2935 * struct ibss_rsn_start - Data for EVENT_IBSS_RSN_START
2936 */
2937 struct ibss_rsn_start {
2938 u8 peer[ETH_ALEN];
2939 } ibss_rsn_start;
c2a04078
JM
2940
2941 /**
2942 * struct auth_info - Data for EVENT_AUTH events
2943 */
2944 struct auth_info {
2945 u8 peer[ETH_ALEN];
2946 u16 auth_type;
2947 u16 status_code;
2948 const u8 *ies;
2949 size_t ies_len;
2950 } auth;
efa46078
JM
2951
2952 /**
2953 * struct assoc_reject - Data for EVENT_ASSOC_REJECT events
2954 */
2955 struct assoc_reject {
59ddf221
JM
2956 /**
2957 * bssid - BSSID of the AP that rejected association
2958 */
2959 const u8 *bssid;
2960
efa46078
JM
2961 /**
2962 * resp_ies - (Re)Association Response IEs
2963 *
2964 * Optional association data from the driver. This data is not
2965 * required WPA, but may be useful for some protocols and as
2966 * such, should be reported if this is available to the driver
2967 * interface.
2968 *
2969 * This should start with the first IE (fixed fields before IEs
2970 * are not included).
2971 */
59ddf221 2972 const u8 *resp_ies;
efa46078
JM
2973
2974 /**
2975 * resp_ies_len - Length of resp_ies in bytes
2976 */
2977 size_t resp_ies_len;
2978
2979 /**
2980 * status_code - Status Code from (Re)association Response
2981 */
2982 u16 status_code;
2983 } assoc_reject;
da1fb17c
JM
2984
2985 struct timeout_event {
2986 u8 addr[ETH_ALEN];
2987 } timeout_event;
08fd8c15
JM
2988
2989 /**
2990 * struct ft_rrb_rx - Data for EVENT_FT_RRB_RX events
2991 */
2992 struct ft_rrb_rx {
2993 const u8 *src;
2994 const u8 *data;
2995 size_t data_len;
2996 } ft_rrb_rx;
f8b1f695
JM
2997
2998 /**
2999 * struct tx_status - Data for EVENT_TX_STATUS events
3000 */
3001 struct tx_status {
3002 u16 type;
3003 u16 stype;
3004 const u8 *dst;
3005 const u8 *data;
3006 size_t data_len;
3007 int ack;
3008 } tx_status;
3009
3010 /**
3011 * struct rx_from_unknown - Data for EVENT_RX_FROM_UNKNOWN events
3012 */
3013 struct rx_from_unknown {
0d9fc3d8 3014 const u8 *frame;
f8b1f695
JM
3015 size_t len;
3016 } rx_from_unknown;
3017
3018 /**
3019 * struct rx_mgmt - Data for EVENT_RX_MGMT events
3020 */
3021 struct rx_mgmt {
b57e086c 3022 const u8 *frame;
f8b1f695 3023 size_t frame_len;
2a8b7416
JM
3024 u32 datarate;
3025 u32 ssi_signal;
f8b1f695 3026 } rx_mgmt;
8d923a4a 3027
55777702
JM
3028 /**
3029 * struct rx_action - Data for EVENT_RX_ACTION events
3030 */
3031 struct rx_action {
e8828999
JM
3032 /**
3033 * da - Destination address of the received Action frame
3034 */
3035 const u8 *da;
3036
55777702
JM
3037 /**
3038 * sa - Source address of the received Action frame
3039 */
3040 const u8 *sa;
3041
e8828999
JM
3042 /**
3043 * bssid - Address 3 of the received Action frame
3044 */
3045 const u8 *bssid;
3046
55777702
JM
3047 /**
3048 * category - Action frame category
3049 */
3050 u8 category;
3051
3052 /**
3053 * data - Action frame body after category field
3054 */
3055 const u8 *data;
3056
3057 /**
3058 * len - Length of data in octets
3059 */
3060 size_t len;
3061
3062 /**
3063 * freq - Frequency (in MHz) on which the frame was received
3064 */
3065 int freq;
3066 } rx_action;
3067
3068 /**
3069 * struct remain_on_channel - Data for EVENT_REMAIN_ON_CHANNEL events
3070 *
3071 * This is also used with EVENT_CANCEL_REMAIN_ON_CHANNEL events.
3072 */
3073 struct remain_on_channel {
3074 /**
3075 * freq - Channel frequency in MHz
3076 */
3077 unsigned int freq;
3078
3079 /**
3080 * duration - Duration to remain on the channel in milliseconds
3081 */
3082 unsigned int duration;
3083 } remain_on_channel;
3084
8d923a4a
JM
3085 /**
3086 * struct scan_info - Optional data for EVENT_SCAN_RESULTS events
3087 * @aborted: Whether the scan was aborted
3088 * @freqs: Scanned frequencies in MHz (%NULL = all channels scanned)
3089 * @num_freqs: Number of entries in freqs array
3090 * @ssids: Scanned SSIDs (%NULL or zero-length SSID indicates wildcard
3091 * SSID)
3092 * @num_ssids: Number of entries in ssids array
3093 */
3094 struct scan_info {
3095 int aborted;
3096 const int *freqs;
3097 size_t num_freqs;
3098 struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
3099 size_t num_ssids;
3100 } scan_info;
245519e0
JM
3101
3102 /**
3103 * struct mlme_rx - Data for EVENT_MLME_RX events
3104 */
3105 struct mlme_rx {
3106 const u8 *buf;
3107 size_t len;
3108 int freq;
3109 int channel;
3110 int ssi;
3111 } mlme_rx;
a0e0d3bb
JM
3112
3113 /**
3114 * struct rx_probe_req - Data for EVENT_RX_PROBE_REQ events
3115 */
3116 struct rx_probe_req {
3117 /**
3118 * sa - Source address of the received Probe Request frame
3119 */
3120 const u8 *sa;
3121
04a85e44
JM
3122 /**
3123 * da - Destination address of the received Probe Request frame
3124 * or %NULL if not available
3125 */
3126 const u8 *da;
3127
3128 /**
3129 * bssid - BSSID of the received Probe Request frame or %NULL
3130 * if not available
3131 */
3132 const u8 *bssid;
3133
a0e0d3bb
JM
3134 /**
3135 * ie - IEs from the Probe Request body
3136 */
3137 const u8 *ie;
3138
3139 /**
3140 * ie_len - Length of ie buffer in octets
3141 */
3142 size_t ie_len;
3143 } rx_probe_req;
a70a5d6d
JM
3144
3145 /**
3146 * struct new_sta - Data for EVENT_NEW_STA events
3147 */
3148 struct new_sta {
3149 const u8 *addr;
3150 } new_sta;
a8e0505b
JM
3151
3152 /**
3153 * struct eapol_rx - Data for EVENT_EAPOL_RX events
3154 */
3155 struct eapol_rx {
3156 const u8 *src;
3157 const u8 *data;
3158 size_t data_len;
3159 } eapol_rx;
b625473c
JM
3160
3161 /**
1c5c7273 3162 * signal_change - Data for EVENT_SIGNAL_CHANGE events
b625473c 3163 */
1c5c7273 3164 struct wpa_signal_info signal_change;
7cfc4ac3
AGS
3165
3166 /**
3167 * struct best_channel - Data for EVENT_BEST_CHANNEL events
3168 * @freq_24: Best 2.4 GHz band channel frequency in MHz
3169 * @freq_5: Best 5 GHz band channel frequency in MHz
3170 * @freq_overall: Best channel frequency in MHz
3171 *
3172 * 0 can be used to indicate no preference in either band.
3173 */
3174 struct best_channel {
3175 int freq_24;
3176 int freq_5;
3177 int freq_overall;
3178 } best_chan;
7d878ca7
JM
3179
3180 struct unprot_deauth {
3181 const u8 *sa;
3182 const u8 *da;
3183 u16 reason_code;
3184 } unprot_deauth;
3185
3186 struct unprot_disassoc {
3187 const u8 *sa;
3188 const u8 *da;
3189 u16 reason_code;
3190 } unprot_disassoc;
0d7e5a3a
JB
3191
3192 /**
3193 * struct low_ack - Data for EVENT_STATION_LOW_ACK events
3194 * @addr: station address
3195 */
3196 struct low_ack {
3197 u8 addr[ETH_ALEN];
3198 } low_ack;
3ac17eba
JM
3199
3200 /**
3201 * struct p2p_dev_found - Data for EVENT_P2P_DEV_FOUND
3202 */
3203 struct p2p_dev_found {
3204 const u8 *addr;
3205 const u8 *dev_addr;
3206 const u8 *pri_dev_type;
3207 const char *dev_name;
3208 u16 config_methods;
3209 u8 dev_capab;
3210 u8 group_capab;
3211 } p2p_dev_found;
3212
3213 /**
3214 * struct p2p_go_neg_req_rx - Data for EVENT_P2P_GO_NEG_REQ_RX
3215 */
3216 struct p2p_go_neg_req_rx {
3217 const u8 *src;
3218 u16 dev_passwd_id;
3219 } p2p_go_neg_req_rx;
3220
3221 /**
3222 * struct p2p_go_neg_completed - Data for EVENT_P2P_GO_NEG_COMPLETED
3223 */
3224 struct p2p_go_neg_completed {
3225 struct p2p_go_neg_results *res;
3226 } p2p_go_neg_completed;
3227
3228 struct p2p_prov_disc_req {
3229 const u8 *peer;
3230 u16 config_methods;
3231 const u8 *dev_addr;
3232 const u8 *pri_dev_type;
3233 const char *dev_name;
3234 u16 supp_config_methods;
3235 u8 dev_capab;
3236 u8 group_capab;
3237 } p2p_prov_disc_req;
3238
3239 struct p2p_prov_disc_resp {
3240 const u8 *peer;
3241 u16 config_methods;
3242 } p2p_prov_disc_resp;
3243
3244 struct p2p_sd_req {
3245 int freq;
3246 const u8 *sa;
3247 u8 dialog_token;
3248 u16 update_indic;
3249 const u8 *tlvs;
3250 size_t tlvs_len;
3251 } p2p_sd_req;
3252
3253 struct p2p_sd_resp {
3254 const u8 *sa;
3255 u16 update_indic;
3256 const u8 *tlvs;
3257 size_t tlvs_len;
3258 } p2p_sd_resp;
ea244d21
XC
3259
3260 /**
3261 * struct ibss_peer_lost - Data for EVENT_IBSS_PEER_LOST
3262 */
3263 struct ibss_peer_lost {
3264 u8 peer[ETH_ALEN];
3265 } ibss_peer_lost;
b14a210c
JB
3266
3267 /**
3268 * struct driver_gtk_rekey - Data for EVENT_DRIVER_GTK_REKEY
3269 */
3270 struct driver_gtk_rekey {
3271 const u8 *bssid;
3272 const u8 *replay_ctr;
3273 } driver_gtk_rekey;
6fc6879b
JM
3274};
3275
3276/**
3277 * wpa_supplicant_event - Report a driver event for wpa_supplicant
3278 * @ctx: Context pointer (wpa_s); this is the ctx variable registered
3279 * with struct wpa_driver_ops::init()
3280 * @event: event type (defined above)
3281 * @data: possible extra data for the event
3282 *
3283 * Driver wrapper code should call this function whenever an event is received
3284 * from the driver.
3285 */
9646a8ab 3286void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
6fc6879b
JM
3287 union wpa_event_data *data);
3288
c5121837 3289
1d041bec
JM
3290/*
3291 * The following inline functions are provided for convenience to simplify
3292 * event indication for some of the common events.
3293 */
3294
3295static inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie,
39b08b5f 3296 size_t ielen, int reassoc)
1d041bec
JM
3297{
3298 union wpa_event_data event;
3299 os_memset(&event, 0, sizeof(event));
39b08b5f 3300 event.assoc_info.reassoc = reassoc;
1d041bec
JM
3301 event.assoc_info.req_ies = ie;
3302 event.assoc_info.req_ies_len = ielen;
3303 event.assoc_info.addr = addr;
3304 wpa_supplicant_event(ctx, EVENT_ASSOC, &event);
3305}
3306
3307static inline void drv_event_disassoc(void *ctx, const u8 *addr)
3308{
3309 union wpa_event_data event;
3310 os_memset(&event, 0, sizeof(event));
3311 event.disassoc_info.addr = addr;
3312 wpa_supplicant_event(ctx, EVENT_DISASSOC, &event);
3313}
c5121837 3314
baac6490
JM
3315static inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data,
3316 size_t data_len)
3317{
3318 union wpa_event_data event;
3319 os_memset(&event, 0, sizeof(event));
3320 event.eapol_rx.src = src;
3321 event.eapol_rx.data = data;
3322 event.eapol_rx.data_len = data_len;
3323 wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);
3324}
3325
6fc6879b 3326#endif /* DRIVER_H */