2 * Driver interface definition
3 * Copyright (c) 2003-2010, Jouni Malinen <j@w1.fi>
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.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
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.
26 #define WPA_SUPPLICANT_DRIVER_VERSION 4
28 #include "common/defs.h"
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
39 * struct hostapd_channel_data - Channel information
41 struct hostapd_channel_data {
43 * chan - Channel number (IEEE 802.11)
48 * freq - Frequency in MHz
53 * flag - Channel flags (HOSTAPD_CHAN_*)
58 * max_tx_power - maximum transmit power in dBm
64 * struct hostapd_hw_modes - Supported hardware mode information
66 struct hostapd_hw_modes {
68 * mode - Hardware mode
70 enum hostapd_hw_mode mode;
73 * num_channels - Number of entries in the channels array
78 * channels - Array of supported channels
80 struct hostapd_channel_data *channels;
83 * num_rates - Number of entries in the rates array
88 * rates - Array of supported rates in 100 kbps units
93 * ht_capab - HT (IEEE 802.11n) capabilities
98 * mcs_set - MCS (IEEE 802.11n) rate parameters
103 * a_mpdu_params - A-MPDU (IEEE 802.11n) parameters
109 #define IEEE80211_MODE_INFRA 0
110 #define IEEE80211_MODE_IBSS 1
111 #define IEEE80211_MODE_AP 2
113 #define IEEE80211_CAP_ESS 0x0001
114 #define IEEE80211_CAP_IBSS 0x0002
115 #define IEEE80211_CAP_PRIVACY 0x0010
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)
125 * struct wpa_scan_res - Scan result for an BSS/IBSS
126 * @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
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
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
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.
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.
149 struct wpa_scan_res {
161 size_t beacon_ie_len;
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
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
176 struct wpa_scan_results {
177 struct wpa_scan_res **res;
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
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
191 struct wpa_interface_info {
192 struct wpa_interface_info *next;
195 const char *drv_name;
198 #define WPAS_MAX_SCAN_SSIDS 4
201 * struct wpa_driver_scan_params - Scan parameters
202 * Data for struct wpa_driver_ops::scan2().
204 struct wpa_driver_scan_params {
206 * ssids - SSIDs to scan for
208 struct wpa_driver_scan_ssid {
210 * ssid - specific SSID to scan for (ProbeReq)
211 * %NULL or zero-length SSID is used to indicate active scan
212 * with wildcard SSID.
216 * ssid_len: Length of the SSID in octets
219 } ssids[WPAS_MAX_SCAN_SSIDS];
222 * num_ssids - Number of entries in ssids array
223 * Zero indicates a request for a passive scan.
228 * extra_ies - Extra IE(s) to add into Probe Request or %NULL
233 * extra_ies_len - Length of extra_ies in octets
235 size_t extra_ies_len;
238 * freqs - Array of frequencies to scan or %NULL for all frequencies
240 * The frequency is set in MHz. The array is zero-terminated.
245 * filter_ssids - Filter for reporting SSIDs
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.
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.
258 struct wpa_driver_scan_filter {
264 * num_filter_ssids - Number of entries in filter_ssids array
266 size_t num_filter_ssids;
270 * struct wpa_driver_auth_params - Authentication parameters
271 * Data for struct wpa_driver_ops::authenticate().
273 struct wpa_driver_auth_params {
281 const u8 *wep_key[4];
282 size_t wep_key_len[4];
284 int local_state_change;
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
295 * struct wpa_driver_associate_params - Association parameters
296 * Data for struct wpa_driver_ops::associate().
298 struct wpa_driver_associate_params {
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. */
306 * ssid - The selected SSID
311 * ssid_len - Length of the SSID (1..32)
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)
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).
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
338 * When using WPS, wpa_ie is used for WPS IE instead of WPA/RSN IE.
343 * wpa_ie_len - length of the wpa_ie
348 * pairwise_suite - Selected pairwise cipher suite
350 * This is usually ignored if @wpa_ie is used.
352 enum wpa_cipher pairwise_suite;
355 * group_suite - Selected group cipher suite
357 * This is usually ignored if @wpa_ie is used.
359 enum wpa_cipher group_suite;
362 * key_mgmt_suite - Selected key management suite
364 * This is usually ignored if @wpa_ie is used.
366 enum wpa_key_mgmt key_mgmt_suite;
369 * auth_alg - Allowed authentication algorithms
370 * Bit field of WPA_AUTH_ALG_*
375 * mode - Operation mode (infra/ibss) IEEE80211_MODE_*
380 * wep_key - WEP keys for static WEP configuration
382 const u8 *wep_key[4];
385 * wep_key_len - WEP key length for static WEP configuration
387 size_t wep_key_len[4];
390 * wep_tx_keyidx - WEP TX key index for static WEP configuration
395 * mgmt_frame_protection - IEEE 802.11w management frame protection
397 enum mfp_options mgmt_frame_protection;
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.
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.
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.
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.
423 * ft_ies_len - Length of ft_ies in bytes
428 * ft_md - FT Mobility domain (6 octets) (also included inside ft_ies)
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.
437 * passphrase - RSN passphrase for PSK
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.
445 const char *passphrase;
448 * psk - RSN PSK (alternative for passphrase for PSK)
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.
458 * drop_unencrypted - Enable/disable unencrypted frame filtering
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.
464 int drop_unencrypted;
467 * prev_bssid - Previously used BSSID in this ESS
469 * When not %NULL, this is a request to use reassociation instead of
472 const u8 *prev_bssid;
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.
484 * p2p - Whether this connection is a P2P group
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
498 * struct wpa_driver_capa - Driver capability information
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;
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
516 #define WPA_DRIVER_AUTH_OPEN 0x00000001
517 #define WPA_DRIVER_AUTH_SHARED 0x00000002
518 #define WPA_DRIVER_AUTH_LEAP 0x00000004
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
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.
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
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.
555 #define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P 0x00002000
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.
561 #define WPA_DRIVER_FLAGS_SANE_ERROR_CODES 0x00004000
567 * max_remain_on_chan - Maximum remain-on-channel duration in msec
569 unsigned int max_remain_on_chan;
572 * max_stations - Maximum number of associated stations the driver
573 * supports in AP mode
575 unsigned int max_stations;
581 struct hostap_sta_driver_data {
582 unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
583 unsigned long current_tx_rate;
584 unsigned long inactive_msec;
586 unsigned long num_ps_buf_frames;
587 unsigned long tx_retry_failed;
588 unsigned long tx_retry_count;
593 struct hostapd_sta_add_params {
597 const u8 *supp_rates;
598 size_t supp_rates_len;
600 const struct ieee80211_ht_capabilities *ht_capabilities;
603 struct hostapd_freq_params {
608 int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled,
609 * secondary channel below primary, 1 = HT40
610 * enabled, secondary channel above primary */
613 enum wpa_driver_if_type {
615 * WPA_IF_STATION - Station mode interface
620 * WPA_IF_AP_VLAN - AP mode VLAN interface
622 * This interface shares its address and Beacon frame with the main
628 * WPA_IF_AP_BSS - AP mode BSS interface
630 * This interface has its own address and Beacon frame.
635 * WPA_IF_P2P_GO - P2P Group Owner
640 * WPA_IF_P2P_CLIENT - P2P Client
645 * WPA_IF_P2P_GROUP - P2P Group interface (will become either
646 * WPA_IF_P2P_GO or WPA_IF_P2P_CLIENT, but the role is not yet known)
651 struct wpa_init_params {
656 const char *test_socket;
657 int use_pae_group_addr;
661 u8 *own_addr; /* buffer for writing own MAC address */
665 struct wpa_bss_params {
666 /** Interface name (for multi-SSID/VLAN support) */
668 /** Whether IEEE 802.1X or WPA/WPA2 is enabled */
679 #define WPA_STA_AUTHORIZED BIT(0)
680 #define WPA_STA_WMM BIT(1)
681 #define WPA_STA_SHORT_PREAMBLE BIT(2)
682 #define WPA_STA_MFP BIT(3)
685 * struct wpa_driver_ops - Driver interface API definition
687 * This structure defines the API that each driver interface needs to implement
688 * for core wpa_supplicant code. All driver specific functionality is captured
691 struct wpa_driver_ops {
692 /** Name of the driver interface */
694 /** One line description of the driver interface */
698 * get_bssid - Get the current BSSID
699 * @priv: private driver interface data
700 * @bssid: buffer for BSSID (ETH_ALEN = 6 bytes)
702 * Returns: 0 on success, -1 on failure
704 * Query kernel driver for the current BSSID and copy it to bssid.
705 * Setting bssid to 00:00:00:00:00:00 is recommended if the STA is not
708 int (*get_bssid)(void *priv, u8 *bssid);
711 * get_ssid - Get the current SSID
712 * @priv: private driver interface data
713 * @ssid: buffer for SSID (at least 32 bytes)
715 * Returns: Length of the SSID on success, -1 on failure
717 * Query kernel driver for the current SSID and copy it to ssid.
718 * Returning zero is recommended if the STA is not associated.
720 * Note: SSID is an array of octets, i.e., it is not nul terminated and
721 * can, at least in theory, contain control characters (including nul)
722 * and as such, should be processed as binary data, not a printable
725 int (*get_ssid)(void *priv, u8 *ssid);
728 * set_key - Configure encryption key
729 * @ifname: Interface name (for multi-SSID/VLAN support)
730 * @priv: private driver interface data
731 * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
732 * %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK);
733 * %WPA_ALG_NONE clears the key.
734 * @addr: address of the peer STA or ff:ff:ff:ff:ff:ff for
735 * broadcast/default keys
736 * @key_idx: key index (0..3), usually 0 for unicast keys; 0..4095 for
738 * @set_tx: configure this key as the default Tx key (only used when
739 * driver does not support separate unicast/individual key
740 * @seq: sequence number/packet number, seq_len octets, the next
741 * packet number to be used for in replay protection; configured
742 * for Rx keys (in most cases, this is only used with broadcast
743 * keys and set to zero for unicast keys)
744 * @seq_len: length of the seq, depends on the algorithm:
745 * TKIP: 6 octets, CCMP: 6 octets, IGTK: 6 octets
746 * @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key,
748 * @key_len: length of the key buffer in octets (WEP: 5 or 13,
749 * TKIP: 32, CCMP: 16, IGTK: 16)
751 * Returns: 0 on success, -1 on failure
753 * Configure the given key for the kernel driver. If the driver
754 * supports separate individual keys (4 default keys + 1 individual),
755 * addr can be used to determine whether the key is default or
756 * individual. If only 4 keys are supported, the default key with key
757 * index 0 is used as the individual key. STA must be configured to use
758 * it as the default Tx key (set_tx is set) and accept Rx for all the
759 * key indexes. In most cases, WPA uses only key indexes 1 and 2 for
760 * broadcast keys, so key index 0 is available for this kind of
763 * Please note that TKIP keys include separate TX and RX MIC keys and
764 * some drivers may expect them in different order than wpa_supplicant
765 * is using. If the TX/RX keys are swapped, all TKIP encrypted packets
766 * will tricker Michael MIC errors. This can be fixed by changing the
767 * order of MIC keys by swapping te bytes 16..23 and 24..31 of the key
768 * in driver_*.c set_key() implementation, see driver_ndis.c for an
769 * example on how this can be done.
771 int (*set_key)(const char *ifname, void *priv, enum wpa_alg alg,
772 const u8 *addr, int key_idx, int set_tx,
773 const u8 *seq, size_t seq_len,
774 const u8 *key, size_t key_len);
777 * init - Initialize driver interface
778 * @ctx: context to be used when calling wpa_supplicant functions,
779 * e.g., wpa_supplicant_event()
780 * @ifname: interface name, e.g., wlan0
782 * Returns: Pointer to private data, %NULL on failure
784 * Initialize driver interface, including event processing for kernel
785 * driver events (e.g., associated, scan results, Michael MIC failure).
786 * This function can allocate a private configuration data area for
787 * @ctx, file descriptor, interface name, etc. information that may be
788 * needed in future driver operations. If this is not used, non-NULL
789 * value will need to be returned because %NULL is used to indicate
790 * failure. The returned value will be used as 'void *priv' data for
791 * all other driver_ops functions.
793 * The main event loop (eloop.c) of wpa_supplicant can be used to
794 * register callback for read sockets (eloop_register_read_sock()).
796 * See below for more information about events and
797 * wpa_supplicant_event() function.
799 void * (*init)(void *ctx, const char *ifname);
802 * deinit - Deinitialize driver interface
803 * @priv: private driver interface data from init()
805 * Shut down driver interface and processing of driver events. Free
806 * private data buffer if one was allocated in init() handler.
808 void (*deinit)(void *priv);
811 * set_param - Set driver configuration parameters
812 * @priv: private driver interface data from init()
813 * @param: driver specific configuration parameters
815 * Returns: 0 on success, -1 on failure
817 * Optional handler for notifying driver interface about configuration
818 * parameters (driver_param).
820 int (*set_param)(void *priv, const char *param);
823 * set_countermeasures - Enable/disable TKIP countermeasures
824 * @priv: private driver interface data
825 * @enabled: 1 = countermeasures enabled, 0 = disabled
827 * Returns: 0 on success, -1 on failure
829 * Configure TKIP countermeasures. When these are enabled, the driver
830 * should drop all received and queued frames that are using TKIP.
832 int (*set_countermeasures)(void *priv, int enabled);
835 * deauthenticate - Request driver to deauthenticate
836 * @priv: private driver interface data
837 * @addr: peer address (BSSID of the AP)
838 * @reason_code: 16-bit reason code to be sent in the deauthentication
841 * Returns: 0 on success, -1 on failure
843 int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
846 * disassociate - Request driver to disassociate
847 * @priv: private driver interface data
848 * @addr: peer address (BSSID of the AP)
849 * @reason_code: 16-bit reason code to be sent in the disassociation
852 * Returns: 0 on success, -1 on failure
854 int (*disassociate)(void *priv, const u8 *addr, int reason_code);
857 * associate - Request driver to associate
858 * @priv: private driver interface data
859 * @params: association parameters
861 * Returns: 0 on success, -1 on failure
863 int (*associate)(void *priv,
864 struct wpa_driver_associate_params *params);
867 * add_pmkid - Add PMKSA cache entry to the driver
868 * @priv: private driver interface data
869 * @bssid: BSSID for the PMKSA cache entry
870 * @pmkid: PMKID for the PMKSA cache entry
872 * Returns: 0 on success, -1 on failure
874 * This function is called when a new PMK is received, as a result of
875 * either normal authentication or RSN pre-authentication.
877 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
878 * associate(), add_pmkid() can be used to add new PMKSA cache entries
879 * in the driver. If the driver uses wpa_ie from wpa_supplicant, this
880 * driver_ops function does not need to be implemented. Likewise, if
881 * the driver does not support WPA, this function is not needed.
883 int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
886 * remove_pmkid - Remove PMKSA cache entry to the driver
887 * @priv: private driver interface data
888 * @bssid: BSSID for the PMKSA cache entry
889 * @pmkid: PMKID for the PMKSA cache entry
891 * Returns: 0 on success, -1 on failure
893 * This function is called when the supplicant drops a PMKSA cache
894 * entry for any reason.
896 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
897 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
898 * between the driver and wpa_supplicant. If the driver uses wpa_ie
899 * from wpa_supplicant, this driver_ops function does not need to be
900 * implemented. Likewise, if the driver does not support WPA, this
901 * function is not needed.
903 int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
906 * flush_pmkid - Flush PMKSA cache
907 * @priv: private driver interface data
909 * Returns: 0 on success, -1 on failure
911 * This function is called when the supplicant drops all PMKSA cache
912 * entries for any reason.
914 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
915 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
916 * between the driver and wpa_supplicant. If the driver uses wpa_ie
917 * from wpa_supplicant, this driver_ops function does not need to be
918 * implemented. Likewise, if the driver does not support WPA, this
919 * function is not needed.
921 int (*flush_pmkid)(void *priv);
924 * get_capa - Get driver capabilities
925 * @priv: private driver interface data
927 * Returns: 0 on success, -1 on failure
929 * Get driver/firmware/hardware capabilities.
931 int (*get_capa)(void *priv, struct wpa_driver_capa *capa);
934 * poll - Poll driver for association information
935 * @priv: private driver interface data
937 * This is an option callback that can be used when the driver does not
938 * provide event mechanism for association events. This is called when
939 * receiving WPA EAPOL-Key messages that require association
940 * information. The driver interface is supposed to generate associnfo
941 * event before returning from this callback function. In addition, the
942 * driver interface should generate an association event after having
943 * sent out associnfo.
945 void (*poll)(void *priv);
948 * get_ifname - Get interface name
949 * @priv: private driver interface data
951 * Returns: Pointer to the interface name. This can differ from the
952 * interface name used in init() call. Init() is called first.
954 * This optional function can be used to allow the driver interface to
955 * replace the interface name with something else, e.g., based on an
956 * interface mapping from a more descriptive name.
958 const char * (*get_ifname)(void *priv);
961 * get_mac_addr - Get own MAC address
962 * @priv: private driver interface data
964 * Returns: Pointer to own MAC address or %NULL on failure
966 * This optional function can be used to get the own MAC address of the
967 * device from the driver interface code. This is only needed if the
968 * l2_packet implementation for the OS does not provide easy access to
970 const u8 * (*get_mac_addr)(void *priv);
973 * send_eapol - Optional function for sending EAPOL packets
974 * @priv: private driver interface data
975 * @dest: Destination MAC address
977 * @data: EAPOL packet starting with IEEE 802.1X header
978 * @data_len: Size of the EAPOL packet
980 * Returns: 0 on success, -1 on failure
982 * This optional function can be used to override l2_packet operations
983 * with driver specific functionality. If this function pointer is set,
984 * l2_packet module is not used at all and the driver interface code is
985 * responsible for receiving and sending all EAPOL packets. The
986 * received EAPOL packets are sent to core code with EVENT_EAPOL_RX
987 * event. The driver interface is required to implement get_mac_addr()
988 * handler if send_eapol() is used.
990 int (*send_eapol)(void *priv, const u8 *dest, u16 proto,
991 const u8 *data, size_t data_len);
994 * set_operstate - Sets device operating state to DORMANT or UP
995 * @priv: private driver interface data
996 * @state: 0 = dormant, 1 = up
997 * Returns: 0 on success, -1 on failure
999 * This is an optional function that can be used on operating systems
1000 * that support a concept of controlling network device state from user
1001 * space applications. This function, if set, gets called with
1002 * state = 1 when authentication has been completed and with state = 0
1003 * when connection is lost.
1005 int (*set_operstate)(void *priv, int state);
1008 * mlme_setprotection - MLME-SETPROTECTION.request primitive
1009 * @priv: Private driver interface data
1010 * @addr: Address of the station for which to set protection (may be
1011 * %NULL for group keys)
1012 * @protect_type: MLME_SETPROTECTION_PROTECT_TYPE_*
1013 * @key_type: MLME_SETPROTECTION_KEY_TYPE_*
1014 * Returns: 0 on success, -1 on failure
1016 * This is an optional function that can be used to set the driver to
1017 * require protection for Tx and/or Rx frames. This uses the layer
1018 * interface defined in IEEE 802.11i-2004 clause 10.3.22.1
1019 * (MLME-SETPROTECTION.request). Many drivers do not use explicit
1020 * set protection operation; instead, they set protection implicitly
1021 * based on configured keys.
1023 int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type,
1027 * get_hw_feature_data - Get hardware support data (channels and rates)
1028 * @priv: Private driver interface data
1029 * @num_modes: Variable for returning the number of returned modes
1030 * flags: Variable for returning hardware feature flags
1031 * Returns: Pointer to allocated hardware data on success or %NULL on
1032 * failure. Caller is responsible for freeing this.
1034 * This function is only needed for drivers that export MLME
1035 * (management frame processing) to %wpa_supplicant or hostapd.
1037 struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
1042 * set_channel - Set channel
1043 * @priv: Private driver interface data
1044 * @phymode: HOSTAPD_MODE_IEEE80211B, ..
1045 * @chan: IEEE 802.11 channel number
1046 * @freq: Frequency of the channel in MHz
1047 * Returns: 0 on success, -1 on failure
1049 * This function is only needed for drivers that export MLME
1050 * (management frame processing) to wpa_supplicant.
1052 int (*set_channel)(void *priv, enum hostapd_hw_mode phymode, int chan,
1056 * set_ssid - Set SSID
1057 * @priv: Private driver interface data
1059 * @ssid_len: SSID length
1060 * Returns: 0 on success, -1 on failure
1062 * This function is only needed for drivers that export MLME
1063 * (management frame processing) to wpa_supplicant.
1065 int (*set_ssid)(void *priv, const u8 *ssid, size_t ssid_len);
1068 * set_bssid - Set BSSID
1069 * @priv: Private driver interface data
1071 * Returns: 0 on success, -1 on failure
1073 * This function is only needed for drivers that export MLME
1074 * (management frame processing) to wpa_supplicant.
1076 int (*set_bssid)(void *priv, const u8 *bssid);
1079 * send_mlme - Send management frame from MLME
1080 * @priv: Private driver interface data
1081 * @data: IEEE 802.11 management frame with IEEE 802.11 header
1082 * @data_len: Size of the management frame
1083 * Returns: 0 on success, -1 on failure
1085 * This function is only needed for drivers that export MLME
1086 * (management frame processing) to wpa_supplicant.
1088 int (*send_mlme)(void *priv, const u8 *data, size_t data_len);
1091 * mlme_add_sta - Add a STA entry into the driver/netstack
1092 * @priv: Private driver interface data
1093 * @addr: MAC address of the STA (e.g., BSSID of the AP)
1094 * @supp_rates: Supported rate set (from (Re)AssocResp); in IEEE 802.11
1095 * format (one octet per rate, 1 = 0.5 Mbps)
1096 * @supp_rates_len: Number of entries in supp_rates
1097 * Returns: 0 on success, -1 on failure
1099 * This function is only needed for drivers that export MLME
1100 * (management frame processing) to wpa_supplicant. When the MLME code
1101 * completes association with an AP, this function is called to
1102 * configure the driver/netstack with a STA entry for data frame
1103 * processing (TX rate control, encryption/decryption).
1105 int (*mlme_add_sta)(void *priv, const u8 *addr, const u8 *supp_rates,
1106 size_t supp_rates_len);
1109 * mlme_remove_sta - Remove a STA entry from the driver/netstack
1110 * @priv: Private driver interface data
1111 * @addr: MAC address of the STA (e.g., BSSID of the AP)
1112 * Returns: 0 on success, -1 on failure
1114 * This function is only needed for drivers that export MLME
1115 * (management frame processing) to wpa_supplicant.
1117 int (*mlme_remove_sta)(void *priv, const u8 *addr);
1120 * update_ft_ies - Update FT (IEEE 802.11r) IEs
1121 * @priv: Private driver interface data
1122 * @md: Mobility domain (2 octets) (also included inside ies)
1123 * @ies: FT IEs (MDIE, FTIE, ...) or %NULL to remove IEs
1124 * @ies_len: Length of FT IEs in bytes
1125 * Returns: 0 on success, -1 on failure
1127 * The supplicant uses this callback to let the driver know that keying
1128 * material for FT is available and that the driver can use the
1129 * provided IEs in the next message in FT authentication sequence.
1131 * This function is only needed for driver that support IEEE 802.11r
1132 * (Fast BSS Transition).
1134 int (*update_ft_ies)(void *priv, const u8 *md, const u8 *ies,
1138 * send_ft_action - Send FT Action frame (IEEE 802.11r)
1139 * @priv: Private driver interface data
1140 * @action: Action field value
1141 * @target_ap: Target AP address
1142 * @ies: FT IEs (MDIE, FTIE, ...) (FT Request action frame body)
1143 * @ies_len: Length of FT IEs in bytes
1144 * Returns: 0 on success, -1 on failure
1146 * The supplicant uses this callback to request the driver to transmit
1147 * an FT Action frame (action category 6) for over-the-DS fast BSS
1150 int (*send_ft_action)(void *priv, u8 action, const u8 *target_ap,
1151 const u8 *ies, size_t ies_len);
1154 * get_scan_results2 - Fetch the latest scan results
1155 * @priv: private driver interface data
1157 * Returns: Allocated buffer of scan results (caller is responsible for
1158 * freeing the data structure) on success, NULL on failure
1160 struct wpa_scan_results * (*get_scan_results2)(void *priv);
1163 * set_country - Set country
1164 * @priv: Private driver interface data
1165 * @alpha2: country to which to switch to
1166 * Returns: 0 on success, -1 on failure
1168 * This function is for drivers which support some form
1169 * of setting a regulatory domain.
1171 int (*set_country)(void *priv, const char *alpha2);
1174 * global_init - Global driver initialization
1175 * Returns: Pointer to private data (global), %NULL on failure
1177 * This optional function is called to initialize the driver wrapper
1178 * for global data, i.e., data that applies to all interfaces. If this
1179 * function is implemented, global_deinit() will also need to be
1180 * implemented to free the private data. The driver will also likely
1181 * use init2() function instead of init() to get the pointer to global
1182 * data available to per-interface initializer.
1184 void * (*global_init)(void);
1187 * global_deinit - Global driver deinitialization
1188 * @priv: private driver global data from global_init()
1190 * Terminate any global driver related functionality and free the
1191 * global data structure.
1193 void (*global_deinit)(void *priv);
1196 * init2 - Initialize driver interface (with global data)
1197 * @ctx: context to be used when calling wpa_supplicant functions,
1198 * e.g., wpa_supplicant_event()
1199 * @ifname: interface name, e.g., wlan0
1200 * @global_priv: private driver global data from global_init()
1201 * Returns: Pointer to private data, %NULL on failure
1203 * This function can be used instead of init() if the driver wrapper
1206 void * (*init2)(void *ctx, const char *ifname, void *global_priv);
1209 * get_interfaces - Get information about available interfaces
1210 * @global_priv: private driver global data from global_init()
1211 * Returns: Allocated buffer of interface information (caller is
1212 * responsible for freeing the data structure) on success, NULL on
1215 struct wpa_interface_info * (*get_interfaces)(void *global_priv);
1218 * scan2 - Request the driver to initiate scan
1219 * @priv: private driver interface data
1220 * @params: Scan parameters
1222 * Returns: 0 on success, -1 on failure
1224 * Once the scan results are ready, the driver should report scan
1225 * results event for wpa_supplicant which will eventually request the
1226 * results with wpa_driver_get_scan_results2().
1228 int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
1231 * authenticate - Request driver to authenticate
1232 * @priv: private driver interface data
1233 * @params: authentication parameters
1234 * Returns: 0 on success, -1 on failure
1236 * This is an optional function that can be used with drivers that
1237 * support separate authentication and association steps, i.e., when
1238 * wpa_supplicant can act as the SME. If not implemented, associate()
1239 * function is expected to take care of IEEE 802.11 authentication,
1242 int (*authenticate)(void *priv,
1243 struct wpa_driver_auth_params *params);
1246 * set_beacon - Set Beacon frame template
1247 * @priv: Private driver interface data
1248 * @head: Beacon head from IEEE 802.11 header to IEs before TIM IE
1249 * @head_len: Length of the head buffer in octets
1250 * @tail: Beacon tail following TIM IE
1251 * @tail_len: Length of the tail buffer in octets
1252 * @dtim_period: DTIM period
1253 * @beacon_int: Beacon interval
1254 * Returns: 0 on success, -1 on failure
1256 * This function is used to configure Beacon template for the driver in
1257 * AP mode. The driver is responsible for building the full Beacon
1258 * frame by concatenating the head part with TIM IE generated by the
1259 * driver/firmware and finishing with the tail part.
1261 int (*set_beacon)(void *priv, const u8 *head, size_t head_len,
1262 const u8 *tail, size_t tail_len, int dtim_period,
1266 * hapd_init - Initialize driver interface (hostapd only)
1267 * @hapd: Pointer to hostapd context
1268 * @params: Configuration for the driver wrapper
1269 * Returns: Pointer to private data, %NULL on failure
1271 * This function is used instead of init() or init2() when the driver
1272 * wrapper is used withh hostapd.
1274 void * (*hapd_init)(struct hostapd_data *hapd,
1275 struct wpa_init_params *params);
1278 * hapd_deinit - Deinitialize driver interface (hostapd only)
1279 * @priv: Private driver interface data from hapd_init()
1281 void (*hapd_deinit)(void *priv);
1284 * set_ieee8021x - Enable/disable IEEE 802.1X support (AP only)
1285 * @priv: Private driver interface data
1286 * @params: BSS parameters
1287 * Returns: 0 on success, -1 on failure
1289 * This is an optional function to configure the kernel driver to
1290 * enable/disable IEEE 802.1X support and set WPA/WPA2 parameters. This
1291 * can be left undefined (set to %NULL) if IEEE 802.1X support is
1292 * always enabled and the driver uses set_beacon() to set WPA/RSN IE
1293 * for Beacon frames.
1295 int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
1298 * set_privacy - Enable/disable privacy (AP only)
1299 * @priv: Private driver interface data
1300 * @enabled: 1 = privacy enabled, 0 = disabled
1301 * Returns: 0 on success, -1 on failure
1303 * This is an optional function to configure privacy field in the
1304 * kernel driver for Beacon frames. This can be left undefined (set to
1305 * %NULL) if the driver uses the Beacon template from set_beacon().
1307 int (*set_privacy)(void *priv, int enabled);
1310 * get_seqnum - Fetch the current TSC/packet number (AP only)
1311 * @ifname: The interface name (main or virtual)
1312 * @priv: Private driver interface data
1313 * @addr: MAC address of the station or %NULL for group keys
1315 * @seq: Buffer for returning the latest used TSC/packet number
1316 * Returns: 0 on success, -1 on failure
1318 * This function is used to fetch the last used TSC/packet number for
1319 * a TKIP, CCMP, or BIP/IGTK key. It is mainly used with group keys, so
1320 * there is no strict requirement on implementing support for unicast
1321 * keys (i.e., addr != %NULL).
1323 int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
1327 * flush - Flush all association stations (AP only)
1328 * @priv: Private driver interface data
1329 * Returns: 0 on success, -1 on failure
1331 * This function requests the driver to disassociate all associated
1332 * stations. This function does not need to be implemented if the
1333 * driver does not process association frames internally.
1335 int (*flush)(void *priv);
1338 * set_generic_elem - Add IEs into Beacon/Probe Response frames (AP)
1339 * @priv: Private driver interface data
1340 * @elem: Information elements
1341 * @elem_len: Length of the elem buffer in octets
1342 * Returns: 0 on success, -1 on failure
1344 * This is an optional function to add information elements in the
1345 * kernel driver for Beacon and Probe Response frames. This can be left
1346 * undefined (set to %NULL) if the driver uses the Beacon template from
1349 int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len);
1352 * read_sta_data - Fetch station data (AP only)
1353 * @priv: Private driver interface data
1354 * @data: Buffer for returning station information
1355 * @addr: MAC address of the station
1356 * Returns: 0 on success, -1 on failure
1358 int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
1362 * hapd_send_eapol - Send an EAPOL packet (AP only)
1363 * @priv: private driver interface data
1364 * @addr: Destination MAC address
1365 * @data: EAPOL packet starting with IEEE 802.1X header
1366 * @data_len: Length of the EAPOL packet in octets
1367 * @encrypt: Whether the frame should be encrypted
1368 * @own_addr: Source MAC address
1370 * Returns: 0 on success, -1 on failure
1372 int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
1373 size_t data_len, int encrypt,
1374 const u8 *own_addr);
1377 * sta_deauth - Deauthenticate a station (AP only)
1378 * @priv: Private driver interface data
1379 * @own_addr: Source address and BSSID for the Deauthentication frame
1380 * @addr: MAC address of the station to deauthenticate
1381 * @reason: Reason code for the Deauthentiation frame
1382 * Returns: 0 on success, -1 on failure
1384 * This function requests a specific station to be deauthenticated and
1385 * a Deauthentication frame to be sent to it.
1387 int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
1391 * sta_disassoc - Disassociate a station (AP only)
1392 * @priv: Private driver interface data
1393 * @own_addr: Source address and BSSID for the Disassociation frame
1394 * @addr: MAC address of the station to disassociate
1395 * @reason: Reason code for the Disassociation frame
1396 * Returns: 0 on success, -1 on failure
1398 * This function requests a specific station to be disassociated and
1399 * a Disassociation frame to be sent to it.
1401 int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
1405 * sta_remove - Remove a station entry (AP only)
1406 * @priv: Private driver interface data
1407 * @addr: MAC address of the station to be removed
1408 * Returns: 0 on success, -1 on failure
1410 int (*sta_remove)(void *priv, const u8 *addr);
1413 * hapd_get_ssid - Get the current SSID (AP only)
1414 * @priv: Private driver interface data
1415 * @buf: Buffer for returning the SSID
1416 * @len: Maximum length of the buffer
1417 * Returns: Length of the SSID on success, -1 on failure
1419 * This function need not be implemented if the driver uses Beacon
1420 * template from set_beacon() and does not reply to Probe Request
1423 int (*hapd_get_ssid)(void *priv, u8 *buf, int len);
1426 * hapd_set_ssid - Set SSID (AP only)
1427 * @priv: Private driver interface data
1429 * @len: Length of the SSID in octets
1430 * Returns: 0 on success, -1 on failure
1432 int (*hapd_set_ssid)(void *priv, const u8 *buf, int len);
1435 * hapd_set_countermeasures - Enable/disable TKIP countermeasures (AP)
1436 * @priv: Private driver interface data
1437 * @enabled: 1 = countermeasures enabled, 0 = disabled
1438 * Returns: 0 on success, -1 on failure
1440 * This need not be implemented if the driver does not take care of
1441 * association processing.
1443 int (*hapd_set_countermeasures)(void *priv, int enabled);
1446 * sta_add - Add a station entry
1447 * @priv: Private driver interface data
1448 * @params: Station parameters
1449 * Returns: 0 on success, -1 on failure
1451 * This function is used to add a station entry to the driver once the
1452 * station has completed association. This is only used if the driver
1453 * does not take care of association processing.
1455 int (*sta_add)(void *priv, struct hostapd_sta_add_params *params);
1458 * get_inact_sec - Get station inactivity duration (AP only)
1459 * @priv: Private driver interface data
1460 * @addr: Station address
1461 * Returns: Number of seconds station has been inactive, -1 on failure
1463 int (*get_inact_sec)(void *priv, const u8 *addr);
1466 * sta_clear_stats - Clear station statistics (AP only)
1467 * @priv: Private driver interface data
1468 * @addr: Station address
1469 * Returns: 0 on success, -1 on failure
1471 int (*sta_clear_stats)(void *priv, const u8 *addr);
1474 * set_freq - Set channel/frequency (AP only)
1475 * @priv: Private driver interface data
1476 * @freq: Channel parameters
1477 * Returns: 0 on success, -1 on failure
1479 int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
1482 * set_rts - Set RTS threshold
1483 * @priv: Private driver interface data
1484 * @rts: RTS threshold in octets
1485 * Returns: 0 on success, -1 on failure
1487 int (*set_rts)(void *priv, int rts);
1490 * set_frag - Set fragmentation threshold
1491 * @priv: Private driver interface data
1492 * @frag: Fragmentation threshold in octets
1493 * Returns: 0 on success, -1 on failure
1495 int (*set_frag)(void *priv, int frag);
1498 * sta_set_flags - Set station flags (AP only)
1499 * @priv: Private driver interface data
1500 * @addr: Station address
1501 * @total_flags: Bitmap of all WPA_STA_* flags currently set
1502 * @flags_or: Bitmap of WPA_STA_* flags to add
1503 * @flags_and: Bitmap of WPA_STA_* flags to us as a mask
1504 * Returns: 0 on success, -1 on failure
1506 int (*sta_set_flags)(void *priv, const u8 *addr,
1507 int total_flags, int flags_or, int flags_and);
1510 * set_rate_sets - Set supported and basic rate sets (AP only)
1511 * @priv: Private driver interface data
1512 * @supp_rates: -1 terminated array of supported rates in 100 kbps
1513 * @basic_rates: -1 terminated array of basic rates in 100 kbps
1514 * @mode: hardware mode (HOSTAPD_MODE_*)
1515 * Returns: 0 on success, -1 on failure
1517 int (*set_rate_sets)(void *priv, int *supp_rates, int *basic_rates,
1521 * set_cts_protect - Set CTS protection mode (AP only)
1522 * @priv: Private driver interface data
1523 * @value: Whether CTS protection is enabled
1524 * Returns: 0 on success, -1 on failure
1526 int (*set_cts_protect)(void *priv, int value);
1529 * set_preamble - Set preamble mode (AP only)
1530 * @priv: Private driver interface data
1531 * @value: Whether short preamble is enabled
1532 * Returns: 0 on success, -1 on failure
1534 int (*set_preamble)(void *priv, int value);
1537 * set_short_slot_time - Set short slot time (AP only)
1538 * @priv: Private driver interface data
1539 * @value: Whether short slot time is enabled
1540 * Returns: 0 on success, -1 on failure
1542 int (*set_short_slot_time)(void *priv, int value);
1545 * set_tx_queue_params - Set TX queue parameters
1546 * @priv: Private driver interface data
1547 * @queue: Queue number (0 = VO, 1 = VI, 2 = BE, 3 = BK)
1551 * @burst_time: Maximum length for bursting in 0.1 msec units
1553 int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
1554 int cw_max, int burst_time);
1557 * valid_bss_mask - Validate BSSID mask
1558 * @priv: Private driver interface data
1561 * Returns: 0 if mask is valid, -1 if mask is not valid, 1 if mask can
1562 * be used, but the main interface address must be the first address in
1563 * the block if mask is applied
1565 int (*valid_bss_mask)(void *priv, const u8 *addr, const u8 *mask);
1568 * if_add - Add a virtual interface
1569 * @priv: Private driver interface data
1570 * @type: Interface type
1571 * @ifname: Interface name for the new virtual interface
1572 * @addr: Local address to use for the interface or %NULL to use the
1573 * parent interface address
1574 * @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces
1575 * @drv_priv: Pointer for overwriting the driver context or %NULL if
1576 * not allowed (applies only to %WPA_IF_AP_BSS type)
1577 * @force_ifname: Buffer for returning an interface name that the
1578 * driver ended up using if it differs from the requested ifname
1579 * @if_addr: Buffer for returning the allocated interface address
1580 * (this may differ from the requested addr if the driver cannot
1581 * change interface address)
1582 * Returns: 0 on success, -1 on failure
1584 int (*if_add)(void *priv, enum wpa_driver_if_type type,
1585 const char *ifname, const u8 *addr, void *bss_ctx,
1586 void **drv_priv, char *force_ifname, u8 *if_addr);
1589 * if_remove - Remove a virtual interface
1590 * @priv: Private driver interface data
1591 * @type: Interface type
1592 * @ifname: Interface name of the virtual interface to be removed
1593 * Returns: 0 on success, -1 on failure
1595 int (*if_remove)(void *priv, enum wpa_driver_if_type type,
1596 const char *ifname);
1599 * set_sta_vlan - Bind a station into a specific interface (AP only)
1600 * @priv: Private driver interface data
1601 * @ifname: Interface (main or virtual BSS or VLAN)
1602 * @addr: MAC address of the associated station
1604 * Returns: 0 on success, -1 on failure
1606 * This function is used to bind a station to a specific virtual
1607 * interface. It is only used if when virtual interfaces are supported,
1608 * e.g., to assign stations to different VLAN interfaces based on
1609 * information from a RADIUS server. This allows separate broadcast
1610 * domains to be used with a single BSS.
1612 int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
1616 * commit - Optional commit changes handler (AP only)
1617 * @priv: driver private data
1618 * Returns: 0 on success, -1 on failure
1620 * This optional handler function can be registered if the driver
1621 * interface implementation needs to commit changes (e.g., by setting
1622 * network interface up) at the end of initial configuration. If set,
1623 * this handler will be called after initial setup has been completed.
1625 int (*commit)(void *priv);
1628 * send_ether - Send an ethernet packet (AP only)
1629 * @priv: private driver interface data
1630 * @dst: Destination MAC address
1631 * @src: Source MAC address
1633 * @data: EAPOL packet starting with IEEE 802.1X header
1634 * @data_len: Length of the EAPOL packet in octets
1635 * Returns: 0 on success, -1 on failure
1637 int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto,
1638 const u8 *data, size_t data_len);
1641 * set_radius_acl_auth - Notification of RADIUS ACL change
1642 * @priv: Private driver interface data
1643 * @mac: MAC address of the station
1644 * @accepted: Whether the station was accepted
1645 * @session_timeout: Session timeout for the station
1646 * Returns: 0 on success, -1 on failure
1648 int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted,
1649 u32 session_timeout);
1652 * set_radius_acl_expire - Notification of RADIUS ACL expiration
1653 * @priv: Private driver interface data
1654 * @mac: MAC address of the station
1655 * Returns: 0 on success, -1 on failure
1657 int (*set_radius_acl_expire)(void *priv, const u8 *mac);
1660 * set_ht_params - Set HT parameters (AP only)
1661 * @priv: Private driver interface data
1662 * @ht_capab: HT Capabilities IE
1663 * @ht_capab_len: Length of ht_capab in octets
1664 * @ht_oper: HT Operation IE
1665 * @ht_oper_len: Length of ht_oper in octets
1666 * Returns: 0 on success, -1 on failure
1668 int (*set_ht_params)(void *priv,
1669 const u8 *ht_capab, size_t ht_capab_len,
1670 const u8 *ht_oper, size_t ht_oper_len);
1673 * set_ap_wps_ie - Add WPS IE(s) into Beacon/Probe Response frames (AP)
1674 * @priv: Private driver interface data
1675 * @beacon: WPS IE(s) for Beacon frames or %NULL to remove extra IE(s)
1676 * @proberesp: WPS IE(s) for Probe Response frames or %NULL to remove
1678 * @assocresp: WPS IE(s) for (Re)Association Response frames or %NULL
1679 * to remove extra IE(s)
1680 * Returns: 0 on success, -1 on failure
1682 * This is an optional function to add WPS IE in the kernel driver for
1683 * Beacon and Probe Response frames. This can be left undefined (set
1684 * to %NULL) if the driver uses the Beacon template from set_beacon()
1685 * and does not process Probe Request frames. If the driver takes care
1686 * of (Re)Association frame processing, the assocresp buffer includes
1687 * WPS IE(s) that need to be added to (Re)Association Response frames
1688 * whenever a (Re)Association Request frame indicated use of WPS.
1690 * This will also be used to add P2P IE(s) into Beacon/Probe Response
1691 * frames when operating as a GO. The driver is responsible for adding
1692 * timing related attributes (e.g., NoA) in addition to the IEs
1693 * included here by appending them after these buffers. This call is
1694 * also used to provide Probe Response IEs for P2P Listen state
1695 * operations for drivers that generate the Probe Response frames
1698 int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon,
1699 const struct wpabuf *proberesp,
1700 const struct wpabuf *assocresp);
1703 * set_supp_port - Set IEEE 802.1X Supplicant Port status
1704 * @priv: Private driver interface data
1705 * @authorized: Whether the port is authorized
1706 * Returns: 0 on success, -1 on failure
1708 int (*set_supp_port)(void *priv, int authorized);
1711 * set_wds_sta - Bind a station into a 4-address WDS (AP only)
1712 * @priv: Private driver interface data
1713 * @addr: MAC address of the associated station
1714 * @aid: Association ID
1715 * @val: 1 = bind to 4-address WDS; 0 = unbind
1716 * @bridge_ifname: Bridge interface to use for the WDS station or %NULL
1717 * to indicate that bridge is not to be used
1718 * Returns: 0 on success, -1 on failure
1720 int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val,
1721 const char *bridge_ifname);
1724 * send_action - Transmit an Action frame
1725 * @priv: Private driver interface data
1726 * @freq: Frequency (in MHz) of the channel
1727 * @dst: Destination MAC address (Address 1)
1728 * @src: Source MAC address (Address 2)
1729 * @bssid: BSSID (Address 3)
1731 * @data_len: data length in octets
1732 * Returns: 0 on success, -1 on failure
1734 * This command can be used to request the driver to transmit an action
1735 * frame to the specified destination. If a remain-on-channel duration
1736 * is in progress, the frame is transmitted on that channel. Otherwise,
1737 * the frame is transmitted on the current operational channel if in
1738 * associated state in station mode or if operating as an AP. If none
1739 * of these conditions is in effect, send_action() cannot be used.
1741 int (*send_action)(void *priv, unsigned int freq,
1742 const u8 *dst, const u8 *src, const u8 *bssid,
1743 const u8 *data, size_t data_len);
1746 * remain_on_channel - Remain awake on a channel
1747 * @priv: Private driver interface data
1748 * @freq: Frequency (in MHz) of the channel
1749 * @duration: Duration in milliseconds
1750 * Returns: 0 on success, -1 on failure
1752 * This command is used to request the driver to remain awake on the
1753 * specified channel for the specified duration and report received
1754 * Action frames with EVENT_RX_ACTION events. Optionally, received
1755 * Probe Request frames may also be requested to be reported by calling
1756 * probe_req_report(). These will be reported with EVENT_RX_PROBE_REQ.
1758 * The driver may not be at the requested channel when this function
1759 * returns, i.e., the return code is only indicating whether the
1760 * request was accepted. The caller will need to wait until the
1761 * EVENT_REMAIN_ON_CHANNEL event indicates that the driver has
1762 * completed the channel change. This may take some time due to other
1763 * need for the radio and the caller should be prepared to timing out
1764 * its wait since there are no guarantees on when this request can be
1767 int (*remain_on_channel)(void *priv, unsigned int freq,
1768 unsigned int duration);
1771 * cancel_remain_on_channel - Cancel remain-on-channel operation
1772 * @priv: Private driver interface data
1774 * This command can be used to cancel a remain-on-channel operation
1775 * before its originally requested duration has passed. This could be
1776 * used, e.g., when remain_on_channel() is used to request extra time
1777 * to receive a response to an Action frame and the response is
1778 * received when there is still unneeded time remaining on the
1779 * remain-on-channel operation.
1781 int (*cancel_remain_on_channel)(void *priv);
1784 * probe_req_report - Request Probe Request frames to be indicated
1785 * @priv: Private driver interface data
1786 * @report: Whether to report received Probe Request frames
1787 * Returns: 0 on success, -1 on failure (or if not supported)
1789 * This command can be used to request the driver to indicate when
1790 * Probe Request frames are received with EVENT_RX_PROBE_REQ events.
1791 * Since this operation may require extra resources, e.g., due to less
1792 * optimal hardware/firmware RX filtering, many drivers may disable
1793 * Probe Request reporting at least in station mode. This command is
1794 * used to notify the driver when the Probe Request frames need to be
1795 * reported, e.g., during remain-on-channel operations.
1797 int (*probe_req_report)(void *priv, int report);
1800 * disable_11b_rates - Set whether IEEE 802.11b rates are used for TX
1801 * @priv: Private driver interface data
1802 * @disabled: Whether IEEE 802.11b rates are disabled
1803 * Returns: 0 on success, -1 on failure (or if not supported)
1805 * This command is used to disable IEEE 802.11b rates (1, 2, 5.5, and
1806 * 11 Mbps) as TX rates for data and management frames. This can be
1807 * used to optimize channel use when there is no need to support IEEE
1808 * 802.11b-only devices.
1810 int (*disable_11b_rates)(void *priv, int disabled);
1813 * deinit_ap - Deinitialize AP mode
1814 * @priv: Private driver interface data
1815 * Returns: 0 on success, -1 on failure (or if not supported)
1817 * This optional function can be used to disable AP mode related
1818 * configuration and change the driver mode to station mode to allow
1819 * normal station operations like scanning to be completed.
1821 int (*deinit_ap)(void *priv);
1824 * suspend - Notification on system suspend/hibernate event
1825 * @priv: Private driver interface data
1827 void (*suspend)(void *priv);
1830 * resume - Notification on system resume/thaw event
1831 * @priv: Private driver interface data
1833 void (*resume)(void *priv);
1836 * signal_monitor - Set signal monitoring parameters
1837 * @priv: Private driver interface data
1838 * @threshold: Threshold value for signal change events; 0 = disabled
1839 * @hysteresis: Minimum change in signal strength before indicating a
1841 * Returns: 0 on success, -1 on failure (or if not supported)
1843 * This function can be used to configure monitoring of signal strength
1844 * with the current AP. Whenever signal strength drops below the
1845 * %threshold value or increases above it, EVENT_SIGNAL_CHANGE event
1846 * should be generated assuming the signal strength has changed at
1847 * least %hysteresis from the previously indicated signal change event.
1849 int (*signal_monitor)(void *priv, int threshold, int hysteresis);
1852 * send_frame - Send IEEE 802.11 frame (testing use only)
1853 * @priv: Private driver interface data
1854 * @data: IEEE 802.11 frame with IEEE 802.11 header
1855 * @data_len: Size of the frame
1856 * @encrypt: Whether to encrypt the frame (if keys are set)
1857 * Returns: 0 on success, -1 on failure
1859 * This function is only used for debugging purposes and is not
1860 * required to be implemented for normal operations.
1862 int (*send_frame)(void *priv, const u8 *data, size_t data_len,
1866 * shared_freq - Get operating frequency of shared interface(s)
1867 * @priv: Private driver interface data
1868 * Returns: Operating frequency in MHz, 0 if no shared operation in
1869 * use, or -1 on failure
1871 * This command can be used to request the current operating frequency
1872 * of any virtual interface that shares the same radio to provide
1873 * information for channel selection for other virtual interfaces.
1875 int (*shared_freq)(void *priv);
1878 * get_noa - Get current Notice of Absence attribute payload
1879 * @priv: Private driver interface data
1880 * @buf: Buffer for returning NoA
1881 * @buf_len: Buffer length in octets
1882 * Returns: Number of octets used in buf, 0 to indicate no NoA is being
1883 * advertized, or -1 on failure
1885 * This function is used to fetch the current Notice of Absence
1886 * attribute value from GO.
1888 int (*get_noa)(void *priv, u8 *buf, size_t buf_len);
1891 * set_noa - Set Notice of Absence parameters for GO (testing)
1892 * @priv: Private driver interface data
1894 * @start: Start time in ms from next TBTT
1895 * @duration: Duration in ms
1896 * Returns: 0 on success or -1 on failure
1898 * This function is used to set Notice of Absence parameters for GO. It
1899 * is used only for testing. To disable NoA, all parameters are set to
1902 int (*set_noa)(void *priv, u8 count, int start, int duration);
1905 * set_p2p_powersave - Set P2P power save options
1906 * @priv: Private driver interface data
1907 * @legacy_ps: 0 = disable, 1 = enable, 2 = maximum PS, -1 = no change
1908 * @opp_ps: 0 = disable, 1 = enable, -1 = no change
1909 * @ctwindow: 0.. = change (msec), -1 = no change
1910 * Returns: 0 on success or -1 on failure
1912 int (*set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps,
1916 * ampdu - Enable/disable aggregation
1917 * @priv: Private driver interface data
1918 * @ampdu: 1/0 = enable/disable A-MPDU aggregation
1919 * Returns: 0 on success or -1 on failure
1921 int (*ampdu)(void *priv, int ampdu);
1924 * set_intra_bss - Enables/Disables intra BSS bridging
1926 int (*set_intra_bss)(void *priv, int enabled);
1931 * enum wpa_event_type - Event type for wpa_supplicant_event() calls
1933 enum wpa_event_type {
1935 * EVENT_ASSOC - Association completed
1937 * This event needs to be delivered when the driver completes IEEE
1938 * 802.11 association or reassociation successfully.
1939 * wpa_driver_ops::get_bssid() is expected to provide the current BSSID
1940 * after this event has been generated. In addition, optional
1941 * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
1942 * more information about the association. If the driver interface gets
1943 * both of these events at the same time, it can also include the
1944 * assoc_info data in EVENT_ASSOC call.
1949 * EVENT_DISASSOC - Association lost
1951 * This event should be called when association is lost either due to
1952 * receiving deauthenticate or disassociate frame from the AP or when
1953 * sending either of these frames to the current AP. If the driver
1954 * supports separate deauthentication event, EVENT_DISASSOC should only
1955 * be used for disassociation and EVENT_DEAUTH for deauthentication.
1956 * In AP mode, union wpa_event_data::disassoc_info is required.
1961 * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
1963 * This event must be delivered when a Michael MIC error is detected by
1964 * the local driver. Additional data for event processing is
1965 * provided with union wpa_event_data::michael_mic_failure. This
1966 * information is used to request new encyption key and to initiate
1967 * TKIP countermeasures if needed.
1969 EVENT_MICHAEL_MIC_FAILURE,
1972 * EVENT_SCAN_RESULTS - Scan results available
1974 * This event must be called whenever scan results are available to be
1975 * fetched with struct wpa_driver_ops::get_scan_results(). This event
1976 * is expected to be used some time after struct wpa_driver_ops::scan()
1977 * is called. If the driver provides an unsolicited event when the scan
1978 * has been completed, this event can be used to trigger
1979 * EVENT_SCAN_RESULTS call. If such event is not available from the
1980 * driver, the driver wrapper code is expected to use a registered
1981 * timeout to generate EVENT_SCAN_RESULTS call after the time that the
1982 * scan is expected to be completed. Optional information about
1983 * completed scan can be provided with union wpa_event_data::scan_info.
1988 * EVENT_ASSOCINFO - Report optional extra information for association
1990 * This event can be used to report extra association information for
1991 * EVENT_ASSOC processing. This extra information includes IEs from
1992 * association frames and Beacon/Probe Response frames in union
1993 * wpa_event_data::assoc_info. EVENT_ASSOCINFO must be send just before
1994 * EVENT_ASSOC. Alternatively, the driver interface can include
1995 * assoc_info data in the EVENT_ASSOC call if it has all the
1996 * information available at the same point.
2001 * EVENT_INTERFACE_STATUS - Report interface status changes
2003 * This optional event can be used to report changes in interface
2004 * status (interface added/removed) using union
2005 * wpa_event_data::interface_status. This can be used to trigger
2006 * wpa_supplicant to stop and re-start processing for the interface,
2007 * e.g., when a cardbus card is ejected/inserted.
2009 EVENT_INTERFACE_STATUS,
2012 * EVENT_PMKID_CANDIDATE - Report a candidate AP for pre-authentication
2014 * This event can be used to inform wpa_supplicant about candidates for
2015 * RSN (WPA2) pre-authentication. If wpa_supplicant is not responsible
2016 * for scan request (ap_scan=2 mode), this event is required for
2017 * pre-authentication. If wpa_supplicant is performing scan request
2018 * (ap_scan=1), this event is optional since scan results can be used
2019 * to add pre-authentication candidates. union
2020 * wpa_event_data::pmkid_candidate is used to report the BSSID of the
2021 * candidate and priority of the candidate, e.g., based on the signal
2022 * strength, in order to try to pre-authenticate first with candidates
2023 * that are most likely targets for re-association.
2025 * EVENT_PMKID_CANDIDATE can be called whenever the driver has updates
2026 * on the candidate list. In addition, it can be called for the current
2027 * AP and APs that have existing PMKSA cache entries. wpa_supplicant
2028 * will automatically skip pre-authentication in cases where a valid
2029 * PMKSA exists. When more than one candidate exists, this event should
2030 * be generated once for each candidate.
2032 * Driver will be notified about successful pre-authentication with
2033 * struct wpa_driver_ops::add_pmkid() calls.
2035 EVENT_PMKID_CANDIDATE,
2038 * EVENT_STKSTART - Request STK handshake (MLME-STKSTART.request)
2040 * This event can be used to inform wpa_supplicant about desire to set
2041 * up secure direct link connection between two stations as defined in
2042 * IEEE 802.11e with a new PeerKey mechanism that replaced the original
2043 * STAKey negotiation. The caller will need to set peer address for the
2049 * EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs
2051 * The driver is expected to report the received FT IEs from
2052 * FT authentication sequence from the AP. The FT IEs are included in
2053 * the extra information in union wpa_event_data::ft_ies.
2058 * EVENT_IBSS_RSN_START - Request RSN authentication in IBSS
2060 * The driver can use this event to inform wpa_supplicant about a STA
2061 * in an IBSS with which protected frames could be exchanged. This
2062 * event starts RSN authentication with the other STA to authenticate
2063 * the STA and set up encryption keys with it.
2065 EVENT_IBSS_RSN_START,
2068 * EVENT_AUTH - Authentication result
2070 * This event should be called when authentication attempt has been
2071 * completed. This is only used if the driver supports separate
2072 * authentication step (struct wpa_driver_ops::authenticate).
2073 * Information about authentication result is included in
2074 * union wpa_event_data::auth.
2079 * EVENT_DEAUTH - Authentication lost
2081 * This event should be called when authentication is lost either due
2082 * to receiving deauthenticate frame from the AP or when sending that
2083 * frame to the current AP.
2084 * In AP mode, union wpa_event_data::deauth_info is required.
2089 * EVENT_ASSOC_REJECT - Association rejected
2091 * This event should be called when (re)association attempt has been
2092 * rejected by the AP. Information about the association response is
2093 * included in union wpa_event_data::assoc_reject.
2098 * EVENT_AUTH_TIMED_OUT - Authentication timed out
2100 EVENT_AUTH_TIMED_OUT,
2103 * EVENT_ASSOC_TIMED_OUT - Association timed out
2105 EVENT_ASSOC_TIMED_OUT,
2108 * EVENT_FT_RRB_RX - FT (IEEE 802.11r) RRB frame received
2113 * EVENT_WPS_BUTTON_PUSHED - Report hardware push button press for WPS
2115 EVENT_WPS_BUTTON_PUSHED,
2118 * EVENT_TX_STATUS - Report TX status
2123 * EVENT_RX_FROM_UNKNOWN - Report RX from unknown STA
2125 EVENT_RX_FROM_UNKNOWN,
2128 * EVENT_RX_MGMT - Report RX of a management frame
2133 * EVENT_RX_ACTION - Action frame received
2135 * This event is used to indicate when an Action frame has been
2136 * received. Information about the received frame is included in
2137 * union wpa_event_data::rx_action.
2142 * EVENT_REMAIN_ON_CHANNEL - Remain-on-channel duration started
2144 * This event is used to indicate when the driver has started the
2145 * requested remain-on-channel duration. Information about the
2146 * operation is included in union wpa_event_data::remain_on_channel.
2148 EVENT_REMAIN_ON_CHANNEL,
2151 * EVENT_CANCEL_REMAIN_ON_CHANNEL - Remain-on-channel timed out
2153 * This event is used to indicate when the driver has completed
2154 * remain-on-channel duration, i.e., may noot be available on the
2155 * requested channel anymore. Information about the
2156 * operation is included in union wpa_event_data::remain_on_channel.
2158 EVENT_CANCEL_REMAIN_ON_CHANNEL,
2161 * EVENT_MLME_RX - Report reception of frame for MLME (test use only)
2163 * This event is used only by driver_test.c and userspace MLME.
2168 * EVENT_RX_PROBE_REQ - Indicate received Probe Request frame
2170 * This event is used to indicate when a Probe Request frame has been
2171 * received. Information about the received frame is included in
2172 * union wpa_event_data::rx_probe_req. The driver is required to report
2173 * these events only after successfully completed probe_req_report()
2174 * commands to request the events (i.e., report parameter is non-zero)
2175 * in station mode. In AP mode, Probe Request frames should always be
2181 * EVENT_NEW_STA - New wired device noticed
2183 * This event is used to indicate that a new device has been detected
2184 * in a network that does not use association-like functionality (i.e.,
2185 * mainly wired Ethernet). This can be used to start EAPOL
2186 * authenticator when receiving a frame from a device. The address of
2187 * the device is included in union wpa_event_data::new_sta.
2192 * EVENT_EAPOL_RX - Report received EAPOL frame
2194 * When in AP mode with hostapd, this event is required to be used to
2195 * deliver the receive EAPOL frames from the driver. With
2196 * %wpa_supplicant, this event is used only if the send_eapol() handler
2197 * is used to override the use of l2_packet for EAPOL frame TX.
2202 * EVENT_SIGNAL_CHANGE - Indicate change in signal strength
2204 * This event is used to indicate changes in the signal strength
2205 * observed in frames received from the current AP if signal strength
2206 * monitoring has been enabled with signal_monitor().
2208 EVENT_SIGNAL_CHANGE,
2211 * EVENT_INTERFACE_ENABLED - Notify that interface was enabled
2213 * This event is used to indicate that the interface was enabled after
2214 * having been previously disabled, e.g., due to rfkill.
2216 EVENT_INTERFACE_ENABLED,
2219 * EVENT_INTERFACE_DISABLED - Notify that interface was disabled
2221 * This event is used to indicate that the interface was disabled,
2222 * e.g., due to rfkill.
2224 EVENT_INTERFACE_DISABLED,
2227 * EVENT_CHANNEL_LIST_CHANGED - Channel list changed
2229 * This event is used to indicate that the channel list has changed,
2230 * e.g., because of a regulatory domain change triggered by scan
2231 * results including an AP advertising a country code.
2233 EVENT_CHANNEL_LIST_CHANGED,
2236 * EVENT_INTERFACE_UNAVAILABLE - Notify that interface is unavailable
2238 * This event is used to indicate that the driver cannot maintain this
2239 * interface in its operation mode anymore. The most likely use for
2240 * this is to indicate that AP mode operation is not available due to
2241 * operating channel would need to be changed to a DFS channel when
2242 * the driver does not support radar detection and another virtual
2243 * interfaces caused the operating channel to change. Other similar
2244 * resource conflicts could also trigger this for station mode
2247 EVENT_INTERFACE_UNAVAILABLE,
2250 * EVENT_BEST_CHANNEL
2252 * Driver generates this event whenever it detects a better channel
2253 * (e.g., based on RSSI or channel use). This information can be used
2254 * to improve channel selection for a new AP/P2P group.
2261 * union wpa_event_data - Additional data for wpa_supplicant_event() calls
2263 union wpa_event_data {
2265 * struct assoc_info - Data for EVENT_ASSOC and EVENT_ASSOCINFO events
2267 * This structure is optional for EVENT_ASSOC calls and required for
2268 * EVENT_ASSOCINFO calls. By using EVENT_ASSOC with this data, the
2269 * driver interface does not need to generate separate EVENT_ASSOCINFO
2274 * req_ies - (Re)Association Request IEs
2276 * If the driver generates WPA/RSN IE, this event data must be
2277 * returned for WPA handshake to have needed information. If
2278 * wpa_supplicant-generated WPA/RSN IE is used, this
2279 * information event is optional.
2281 * This should start with the first IE (fixed fields before IEs
2282 * are not included).
2287 * req_ies_len - Length of req_ies in bytes
2292 * resp_ies - (Re)Association Response IEs
2294 * Optional association data from the driver. This data is not
2295 * required WPA, but may be useful for some protocols and as
2296 * such, should be reported if this is available to the driver
2299 * This should start with the first IE (fixed fields before IEs
2300 * are not included).
2305 * resp_ies_len - Length of resp_ies in bytes
2307 size_t resp_ies_len;
2310 * beacon_ies - Beacon or Probe Response IEs
2312 * Optional Beacon/ProbeResp data: IEs included in Beacon or
2313 * Probe Response frames from the current AP (i.e., the one
2314 * that the client just associated with). This information is
2315 * used to update WPA/RSN IE for the AP. If this field is not
2316 * set, the results from previous scan will be used. If no
2317 * data for the new AP is found, scan results will be requested
2318 * again (without scan request). At this point, the driver is
2319 * expected to provide WPA/RSN IE for the AP (if WPA/WPA2 is
2322 * This should start with the first IE (fixed fields before IEs
2323 * are not included).
2325 const u8 *beacon_ies;
2328 * beacon_ies_len - Length of beacon_ies */
2329 size_t beacon_ies_len;
2332 * freq - Frequency of the operational channel in MHz
2337 * addr - Station address (for AP mode)
2343 * struct disassoc_info - Data for EVENT_DISASSOC events
2345 struct disassoc_info {
2347 * addr - Station address (for AP mode)
2352 * reason_code - Reason Code (host byte order) used in
2353 * Deauthentication frame
2358 * ie - Optional IE(s) in Disassociation frame
2363 * ie_len - Length of ie buffer in octets
2369 * struct deauth_info - Data for EVENT_DEAUTH events
2371 struct deauth_info {
2373 * addr - Station address (for AP mode)
2378 * reason_code - Reason Code (host byte order) used in
2379 * Deauthentication frame
2384 * ie - Optional IE(s) in Deauthentication frame
2389 * ie_len - Length of ie buffer in octets
2395 * struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE
2397 struct michael_mic_failure {
2400 } michael_mic_failure;
2403 * struct interface_status - Data for EVENT_INTERFACE_STATUS
2405 struct interface_status {
2408 EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED
2413 * struct pmkid_candidate - Data for EVENT_PMKID_CANDIDATE
2415 struct pmkid_candidate {
2416 /** BSSID of the PMKID candidate */
2418 /** Smaller the index, higher the priority */
2420 /** Whether RSN IE includes pre-authenticate flag */
2425 * struct stkstart - Data for EVENT_STKSTART
2432 * struct ft_ies - FT information elements (EVENT_FT_RESPONSE)
2434 * During FT (IEEE 802.11r) authentication sequence, the driver is
2435 * expected to use this event to report received FT IEs (MDIE, FTIE,
2436 * RSN IE, TIE, possible resource request) to the supplicant. The FT
2437 * IEs for the next message will be delivered through the
2438 * struct wpa_driver_ops::update_ft_ies() callback.
2444 u8 target_ap[ETH_ALEN];
2445 /** Optional IE(s), e.g., WMM TSPEC(s), for RIC-Request */
2447 /** Length of ric_ies buffer in octets */
2452 * struct ibss_rsn_start - Data for EVENT_IBSS_RSN_START
2454 struct ibss_rsn_start {
2459 * struct auth_info - Data for EVENT_AUTH events
2470 * struct assoc_reject - Data for EVENT_ASSOC_REJECT events
2472 struct assoc_reject {
2474 * bssid - BSSID of the AP that rejected association
2479 * resp_ies - (Re)Association Response IEs
2481 * Optional association data from the driver. This data is not
2482 * required WPA, but may be useful for some protocols and as
2483 * such, should be reported if this is available to the driver
2486 * This should start with the first IE (fixed fields before IEs
2487 * are not included).
2492 * resp_ies_len - Length of resp_ies in bytes
2494 size_t resp_ies_len;
2497 * status_code - Status Code from (Re)association Response
2502 struct timeout_event {
2507 * struct ft_rrb_rx - Data for EVENT_FT_RRB_RX events
2516 * struct tx_status - Data for EVENT_TX_STATUS events
2528 * struct rx_from_unknown - Data for EVENT_RX_FROM_UNKNOWN events
2530 struct rx_from_unknown {
2536 * struct rx_mgmt - Data for EVENT_RX_MGMT events
2546 * struct rx_action - Data for EVENT_RX_ACTION events
2550 * da - Destination address of the received Action frame
2555 * sa - Source address of the received Action frame
2560 * bssid - Address 3 of the received Action frame
2565 * category - Action frame category
2570 * data - Action frame body after category field
2575 * len - Length of data in octets
2580 * freq - Frequency (in MHz) on which the frame was received
2586 * struct remain_on_channel - Data for EVENT_REMAIN_ON_CHANNEL events
2588 * This is also used with EVENT_CANCEL_REMAIN_ON_CHANNEL events.
2590 struct remain_on_channel {
2592 * freq - Channel frequency in MHz
2597 * duration - Duration to remain on the channel in milliseconds
2599 unsigned int duration;
2600 } remain_on_channel;
2603 * struct scan_info - Optional data for EVENT_SCAN_RESULTS events
2604 * @aborted: Whether the scan was aborted
2605 * @freqs: Scanned frequencies in MHz (%NULL = all channels scanned)
2606 * @num_freqs: Number of entries in freqs array
2607 * @ssids: Scanned SSIDs (%NULL or zero-length SSID indicates wildcard
2609 * @num_ssids: Number of entries in ssids array
2615 struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
2620 * struct mlme_rx - Data for EVENT_MLME_RX events
2631 * struct rx_probe_req - Data for EVENT_RX_PROBE_REQ events
2633 struct rx_probe_req {
2635 * sa - Source address of the received Probe Request frame
2640 * ie - IEs from the Probe Request body
2645 * ie_len - Length of ie buffer in octets
2651 * struct new_sta - Data for EVENT_NEW_STA events
2658 * struct eapol_rx - Data for EVENT_EAPOL_RX events
2667 * struct signal_change - Data for EVENT_SIGNAL_CHANGE events
2669 struct signal_change {
2671 int above_threshold;
2678 * struct best_channel - Data for EVENT_BEST_CHANNEL events
2679 * @freq_24: Best 2.4 GHz band channel frequency in MHz
2680 * @freq_5: Best 5 GHz band channel frequency in MHz
2681 * @freq_overall: Best channel frequency in MHz
2683 * 0 can be used to indicate no preference in either band.
2685 struct best_channel {
2693 * wpa_supplicant_event - Report a driver event for wpa_supplicant
2694 * @ctx: Context pointer (wpa_s); this is the ctx variable registered
2695 * with struct wpa_driver_ops::init()
2696 * @event: event type (defined above)
2697 * @data: possible extra data for the event
2699 * Driver wrapper code should call this function whenever an event is received
2702 void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
2703 union wpa_event_data *data);
2707 * The following inline functions are provided for convenience to simplify
2708 * event indication for some of the common events.
2711 static inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie,
2714 union wpa_event_data event;
2715 os_memset(&event, 0, sizeof(event));
2716 event.assoc_info.req_ies = ie;
2717 event.assoc_info.req_ies_len = ielen;
2718 event.assoc_info.addr = addr;
2719 wpa_supplicant_event(ctx, EVENT_ASSOC, &event);
2722 static inline void drv_event_disassoc(void *ctx, const u8 *addr)
2724 union wpa_event_data event;
2725 os_memset(&event, 0, sizeof(event));
2726 event.disassoc_info.addr = addr;
2727 wpa_supplicant_event(ctx, EVENT_DISASSOC, &event);
2730 static inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data,
2733 union wpa_event_data event;
2734 os_memset(&event, 0, sizeof(event));
2735 event.eapol_rx.src = src;
2736 event.eapol_rx.data = data;
2737 event.eapol_rx.data_len = data_len;
2738 wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);
2741 #endif /* DRIVER_H */