OSDN Git Service

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