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