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