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
63 #define HOSTAPD_MODE_FLAG_HT_INFO_KNOWN BIT(0)
66 * struct hostapd_hw_modes - Supported hardware mode information
68 struct hostapd_hw_modes {
70 * mode - Hardware mode
72 enum hostapd_hw_mode mode;
75 * num_channels - Number of entries in the channels array
80 * channels - Array of supported channels
82 struct hostapd_channel_data *channels;
85 * num_rates - Number of entries in the rates array
90 * rates - Array of supported rates in 100 kbps units
95 * ht_capab - HT (IEEE 802.11n) capabilities
100 * mcs_set - MCS (IEEE 802.11n) rate parameters
105 * a_mpdu_params - A-MPDU (IEEE 802.11n) parameters
109 unsigned int flags; /* HOSTAPD_MODE_FLAG_* */
113 #define IEEE80211_MODE_INFRA 0
114 #define IEEE80211_MODE_IBSS 1
115 #define IEEE80211_MODE_AP 2
117 #define IEEE80211_CAP_ESS 0x0001
118 #define IEEE80211_CAP_IBSS 0x0002
119 #define IEEE80211_CAP_PRIVACY 0x0010
121 #define WPA_SCAN_QUAL_INVALID BIT(0)
122 #define WPA_SCAN_NOISE_INVALID BIT(1)
123 #define WPA_SCAN_LEVEL_INVALID BIT(2)
124 #define WPA_SCAN_LEVEL_DBM BIT(3)
125 #define WPA_SCAN_AUTHENTICATED BIT(4)
126 #define WPA_SCAN_ASSOCIATED BIT(5)
129 * struct wpa_scan_res - Scan result for an BSS/IBSS
130 * @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
132 * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
133 * @beacon_int: beacon interval in TUs (host byte order)
134 * @caps: capability information field in host byte order
135 * @qual: signal quality
136 * @noise: noise level
137 * @level: signal level
139 * @age: Age of the information in milliseconds (i.e., how many milliseconds
140 * ago the last Beacon or Probe Response frame was received)
141 * @ie_len: length of the following IE field in octets
142 * @beacon_ie_len: length of the following Beacon IE field in octets
144 * This structure is used as a generic format for scan results from the
145 * driver. Each driver interface implementation is responsible for converting
146 * the driver or OS specific scan results into this format.
148 * If the driver does not support reporting all IEs, the IE data structure is
149 * constructed of the IEs that are available. This field will also need to
150 * include SSID in IE format. All drivers are encouraged to be extended to
151 * report all IEs to make it easier to support future additions.
153 struct wpa_scan_res {
165 size_t beacon_ie_len;
167 * Followed by ie_len octets of IEs from Probe Response frame (or if
168 * the driver does not indicate source of IEs, these may also be from
169 * Beacon frame). After the first set of IEs, another set of IEs may
170 * follow (with beacon_ie_len octets of data) if the driver provides
176 * struct wpa_scan_results - Scan results
177 * @res: Array of pointers to allocated variable length scan result entries
178 * @num: Number of entries in the scan result array
180 struct wpa_scan_results {
181 struct wpa_scan_res **res;
186 * struct wpa_interface_info - Network interface information
187 * @next: Pointer to the next interface or NULL if this is the last one
188 * @ifname: Interface name that can be used with init() or init2()
189 * @desc: Human readable adapter description (e.g., vendor/model) or NULL if
191 * @drv_name: struct wpa_driver_ops::name (note: unlike other strings, this one
192 * is not an allocated copy, i.e., get_interfaces() caller will not free
195 struct wpa_interface_info {
196 struct wpa_interface_info *next;
199 const char *drv_name;
202 #define WPAS_MAX_SCAN_SSIDS 16
205 * struct wpa_driver_scan_params - Scan parameters
206 * Data for struct wpa_driver_ops::scan2().
208 struct wpa_driver_scan_params {
210 * ssids - SSIDs to scan for
212 struct wpa_driver_scan_ssid {
214 * ssid - specific SSID to scan for (ProbeReq)
215 * %NULL or zero-length SSID is used to indicate active scan
216 * with wildcard SSID.
220 * ssid_len: Length of the SSID in octets
223 } ssids[WPAS_MAX_SCAN_SSIDS];
226 * num_ssids - Number of entries in ssids array
227 * Zero indicates a request for a passive scan.
232 * extra_ies - Extra IE(s) to add into Probe Request or %NULL
237 * extra_ies_len - Length of extra_ies in octets
239 size_t extra_ies_len;
242 * freqs - Array of frequencies to scan or %NULL for all frequencies
244 * The frequency is set in MHz. The array is zero-terminated.
249 * filter_ssids - Filter for reporting SSIDs
251 * This optional parameter can be used to request the driver wrapper to
252 * filter scan results to include only the specified SSIDs. %NULL
253 * indicates that no filtering is to be done. This can be used to
254 * reduce memory needs for scan results in environments that have large
255 * number of APs with different SSIDs.
257 * The driver wrapper is allowed to take this allocated buffer into its
258 * own use by setting the pointer to %NULL. In that case, the driver
259 * wrapper is responsible for freeing the buffer with os_free() once it
260 * is not needed anymore.
262 struct wpa_driver_scan_filter {
268 * num_filter_ssids - Number of entries in filter_ssids array
270 size_t num_filter_ssids;
273 * p2p_probe - Used to disable CCK (802.11b) rates for P2P probes
275 * When set, the driver is expected to remove rates 1, 2, 5.5, and 11
276 * Mbps from the support rates element(s) in the Probe Request frames
277 * and not to transmit the frames at any of those rates.
283 * struct wpa_driver_auth_params - Authentication parameters
284 * Data for struct wpa_driver_ops::authenticate().
286 struct wpa_driver_auth_params {
294 const u8 *wep_key[4];
295 size_t wep_key_len[4];
297 int local_state_change;
300 * p2p - Whether this connection is a P2P group
307 WPS_MODE_NONE /* no WPS provisioning being used */,
308 WPS_MODE_OPEN /* WPS provisioning with AP that is in open mode */,
309 WPS_MODE_PRIVACY /* WPS provisioning with AP that is using protection
314 * struct wpa_driver_associate_params - Association parameters
315 * Data for struct wpa_driver_ops::associate().
317 struct wpa_driver_associate_params {
319 * bssid - BSSID of the selected AP
320 * This can be %NULL, if ap_scan=2 mode is used and the driver is
321 * responsible for selecting with which BSS to associate. */
325 * ssid - The selected SSID
330 * ssid_len - Length of the SSID (1..32)
335 * freq - Frequency of the channel the selected AP is using
336 * Frequency that the selected AP is using (in MHz as
337 * reported in the scan results)
342 * wpa_ie - WPA information element for (Re)Association Request
343 * WPA information element to be included in (Re)Association
344 * Request (including information element id and length). Use
345 * of this WPA IE is optional. If the driver generates the WPA
346 * IE, it can use pairwise_suite, group_suite, and
347 * key_mgmt_suite to select proper algorithms. In this case,
348 * the driver has to notify wpa_supplicant about the used WPA
349 * IE by generating an event that the interface code will
350 * convert into EVENT_ASSOCINFO data (see below).
352 * When using WPA2/IEEE 802.11i, wpa_ie is used for RSN IE
353 * instead. The driver can determine which version is used by
354 * looking at the first byte of the IE (0xdd for WPA, 0x30 for
357 * When using WPS, wpa_ie is used for WPS IE instead of WPA/RSN IE.
362 * wpa_ie_len - length of the wpa_ie
367 * wpa_proto - Bitfield of WPA_PROTO_* values to indicate WPA/WPA2
369 unsigned int wpa_proto;
372 * pairwise_suite - Selected pairwise cipher suite
374 * This is usually ignored if @wpa_ie is used.
376 enum wpa_cipher pairwise_suite;
379 * group_suite - Selected group cipher suite
381 * This is usually ignored if @wpa_ie is used.
383 enum wpa_cipher group_suite;
386 * key_mgmt_suite - Selected key management suite
388 * This is usually ignored if @wpa_ie is used.
390 enum wpa_key_mgmt key_mgmt_suite;
393 * auth_alg - Allowed authentication algorithms
394 * Bit field of WPA_AUTH_ALG_*
399 * mode - Operation mode (infra/ibss) IEEE80211_MODE_*
404 * wep_key - WEP keys for static WEP configuration
406 const u8 *wep_key[4];
409 * wep_key_len - WEP key length for static WEP configuration
411 size_t wep_key_len[4];
414 * wep_tx_keyidx - WEP TX key index for static WEP configuration
419 * mgmt_frame_protection - IEEE 802.11w management frame protection
421 enum mfp_options mgmt_frame_protection;
424 * ft_ies - IEEE 802.11r / FT information elements
425 * If the supplicant is using IEEE 802.11r (FT) and has the needed keys
426 * for fast transition, this parameter is set to include the IEs that
427 * are to be sent in the next FT Authentication Request message.
428 * update_ft_ies() handler is called to update the IEs for further
429 * FT messages in the sequence.
431 * The driver should use these IEs only if the target AP is advertising
432 * the same mobility domain as the one included in the MDIE here.
434 * In ap_scan=2 mode, the driver can use these IEs when moving to a new
435 * AP after the initial association. These IEs can only be used if the
436 * target AP is advertising support for FT and is using the same MDIE
437 * and SSID as the current AP.
439 * The driver is responsible for reporting the FT IEs received from the
440 * AP's response using wpa_supplicant_event() with EVENT_FT_RESPONSE
441 * type. update_ft_ies() handler will then be called with the FT IEs to
442 * include in the next frame in the authentication sequence.
447 * ft_ies_len - Length of ft_ies in bytes
452 * ft_md - FT Mobility domain (6 octets) (also included inside ft_ies)
454 * This value is provided to allow the driver interface easier access
455 * to the current mobility domain. This value is set to %NULL if no
456 * mobility domain is currently active.
461 * passphrase - RSN passphrase for PSK
463 * This value is made available only for WPA/WPA2-Personal (PSK) and
464 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
465 * the 8..63 character ASCII passphrase, if available. Please note that
466 * this can be %NULL if passphrase was not used to generate the PSK. In
467 * that case, the psk field must be used to fetch the PSK.
469 const char *passphrase;
472 * psk - RSN PSK (alternative for passphrase for PSK)
474 * This value is made available only for WPA/WPA2-Personal (PSK) and
475 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
476 * the 32-octet (256-bit) PSK, if available. The driver wrapper should
477 * be prepared to handle %NULL value as an error.
482 * drop_unencrypted - Enable/disable unencrypted frame filtering
484 * Configure the driver to drop all non-EAPOL frames (both receive and
485 * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
486 * still be allowed for key negotiation.
488 int drop_unencrypted;
491 * prev_bssid - Previously used BSSID in this ESS
493 * When not %NULL, this is a request to use reassociation instead of
496 const u8 *prev_bssid;
501 * If the driver needs to do special configuration for WPS association,
502 * this variable provides more information on what type of association
503 * is being requested. Most drivers should not need ot use this.
508 * p2p - Whether this connection is a P2P group
513 * uapsd - UAPSD parameters for the network
514 * -1 = do not change defaults
515 * AP mode: 1 = enabled, 0 = disabled
516 * STA mode: bits 0..3 UAPSD enabled for VO,VI,BK,BE
523 HIDDEN_SSID_ZERO_LEN,
524 HIDDEN_SSID_ZERO_CONTENTS
527 struct wpa_driver_ap_params {
529 * head - Beacon head from IEEE 802.11 header to IEs before TIM IE
534 * head_len - Length of the head buffer in octets
539 * tail - Beacon tail following TIM IE
544 * tail_len - Length of the tail buffer in octets
549 * dtim_period - DTIM period
554 * beacon_int - Beacon interval
559 * basic_rates: -1 terminated array of basic rates in 100 kbps
561 * This parameter can be used to set a specific basic rate set for the
562 * BSS. If %NULL, default basic rate set is used.
567 * ssid - The SSID to use in Beacon/Probe Response frames
572 * ssid_len - Length of the SSID (1..32)
577 * hide_ssid - Whether to hide the SSID
579 enum hide_ssid hide_ssid;
582 * pairwise_ciphers - WPA_CIPHER_* bitfield
584 unsigned int pairwise_ciphers;
587 * group_cipher - WPA_CIPHER_*
589 unsigned int group_cipher;
592 * key_mgmt_suites - WPA_KEY_MGMT_* bitfield
594 unsigned int key_mgmt_suites;
597 * auth_algs - WPA_AUTH_ALG_* bitfield
599 unsigned int auth_algs;
602 * wpa_version - WPA_PROTO_* bitfield
604 unsigned int wpa_version;
607 * privacy - Whether privacy is used in the BSS
612 * beacon_ies - WPS/P2P IE(s) for Beacon frames
614 * This is used to add IEs like WPS IE and P2P IE by drivers that do
615 * not use the full Beacon template.
617 const struct wpabuf *beacon_ies;
620 * proberesp_ies - P2P/WPS IE(s) for Probe Response frames
622 * This is used to add IEs like WPS IE and P2P IE by drivers that
623 * reply to Probe Request frames internally.
625 const struct wpabuf *proberesp_ies;
628 * assocresp_ies - WPS IE(s) for (Re)Association Response frames
630 * This is used to add IEs like WPS IE by drivers that reply to
631 * (Re)Association Request frames internally.
633 const struct wpabuf *assocresp_ies;
636 * isolate - Whether to isolate frames between associated stations
638 * If this is non-zero, the AP is requested to disable forwarding of
639 * frames between associated stations.
644 * cts_protect - Whether CTS protection is enabled
649 * preamble - Whether short preamble is enabled
654 * short_slot_time - Whether short slot time is enabled
656 * 0 = short slot time disable, 1 = short slot time enabled, -1 = do
657 * not set (e.g., when 802.11g mode is not in use)
662 * ht_opmode - HT operation mode or -1 if HT not in use
667 * interworking - Whether Interworking is enabled
672 * hessid - Homogeneous ESS identifier or %NULL if not set
677 * access_network_type - Access Network Type (0..15)
679 * This is used for filtering Probe Request frames when Interworking is
682 u8 access_network_type;
686 * struct wpa_driver_capa - Driver capability information
688 struct wpa_driver_capa {
689 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA 0x00000001
690 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2 0x00000002
691 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK 0x00000004
692 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK 0x00000008
693 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE 0x00000010
694 #define WPA_DRIVER_CAPA_KEY_MGMT_FT 0x00000020
695 #define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK 0x00000040
696 unsigned int key_mgmt;
698 #define WPA_DRIVER_CAPA_ENC_WEP40 0x00000001
699 #define WPA_DRIVER_CAPA_ENC_WEP104 0x00000002
700 #define WPA_DRIVER_CAPA_ENC_TKIP 0x00000004
701 #define WPA_DRIVER_CAPA_ENC_CCMP 0x00000008
704 #define WPA_DRIVER_AUTH_OPEN 0x00000001
705 #define WPA_DRIVER_AUTH_SHARED 0x00000002
706 #define WPA_DRIVER_AUTH_LEAP 0x00000004
709 /* Driver generated WPA/RSN IE */
710 #define WPA_DRIVER_FLAGS_DRIVER_IE 0x00000001
711 /* Driver needs static WEP key setup after association command */
712 #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
713 /* unused: 0x00000004 */
714 /* Driver takes care of RSN 4-way handshake internally; PMK is configured with
715 * struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */
716 #define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE 0x00000008
717 #define WPA_DRIVER_FLAGS_WIRED 0x00000010
718 /* Driver provides separate commands for authentication and association (SME in
719 * wpa_supplicant). */
720 #define WPA_DRIVER_FLAGS_SME 0x00000020
721 /* Driver supports AP mode */
722 #define WPA_DRIVER_FLAGS_AP 0x00000040
723 /* Driver needs static WEP key setup after association has been completed */
724 #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE 0x00000080
725 /* Driver takes care of P2P management operations */
726 #define WPA_DRIVER_FLAGS_P2P_MGMT 0x00000100
727 /* Driver supports concurrent P2P operations */
728 #define WPA_DRIVER_FLAGS_P2P_CONCURRENT 0x00000200
730 * Driver uses the initial interface as a dedicated management interface, i.e.,
731 * it cannot be used for P2P group operations or non-P2P purposes.
733 #define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE 0x00000400
734 /* This interface is P2P capable (P2P Device, GO, or P2P Client */
735 #define WPA_DRIVER_FLAGS_P2P_CAPABLE 0x00000800
736 /* Driver supports concurrent operations on multiple channels */
737 #define WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT 0x00001000
739 * Driver uses the initial interface for P2P management interface and non-P2P
740 * purposes (e.g., connect to infra AP), but this interface cannot be used for
741 * P2P group operations.
743 #define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P 0x00002000
745 * Driver is known to use sane error codes, i.e., when it indicates that
746 * something (e.g., association) fails, there was indeed a failure and the
747 * operation does not end up getting completed successfully later.
749 #define WPA_DRIVER_FLAGS_SANE_ERROR_CODES 0x00004000
750 /* Driver supports off-channel TX */
751 #define WPA_DRIVER_FLAGS_OFFCHANNEL_TX 0x00008000
752 /* Driver indicates TX status events for EAPOL Data frames */
753 #define WPA_DRIVER_FLAGS_EAPOL_TX_STATUS 0x00010000
754 /* Driver indicates TX status events for Deauth/Disassoc frames */
755 #define WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS 0x00020000
756 /* Driver supports roaming (BSS selection) in firmware */
757 #define WPA_DRIVER_FLAGS_BSS_SELECTION 0x00040000
758 /* Driver supports operating as a TDLS peer */
759 #define WPA_DRIVER_FLAGS_TDLS_SUPPORT 0x00080000
760 /* Driver requires external TDLS setup/teardown/discovery */
761 #define WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP 0x00100000
765 int max_sched_scan_ssids;
766 int sched_scan_supported;
770 * max_remain_on_chan - Maximum remain-on-channel duration in msec
772 unsigned int max_remain_on_chan;
775 * max_stations - Maximum number of associated stations the driver
776 * supports in AP mode
778 unsigned int max_stations;
784 struct hostap_sta_driver_data {
785 unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
786 unsigned long current_tx_rate;
787 unsigned long inactive_msec;
789 unsigned long num_ps_buf_frames;
790 unsigned long tx_retry_failed;
791 unsigned long tx_retry_count;
796 struct hostapd_sta_add_params {
800 const u8 *supp_rates;
801 size_t supp_rates_len;
803 const struct ieee80211_ht_capabilities *ht_capabilities;
804 u32 flags; /* bitmask of WPA_STA_* flags */
805 int set; /* Set STA parameters instead of add */
808 struct hostapd_freq_params {
813 int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled,
814 * secondary channel below primary, 1 = HT40
815 * enabled, secondary channel above primary */
818 enum wpa_driver_if_type {
820 * WPA_IF_STATION - Station mode interface
825 * WPA_IF_AP_VLAN - AP mode VLAN interface
827 * This interface shares its address and Beacon frame with the main
833 * WPA_IF_AP_BSS - AP mode BSS interface
835 * This interface has its own address and Beacon frame.
840 * WPA_IF_P2P_GO - P2P Group Owner
845 * WPA_IF_P2P_CLIENT - P2P Client
850 * WPA_IF_P2P_GROUP - P2P Group interface (will become either
851 * WPA_IF_P2P_GO or WPA_IF_P2P_CLIENT, but the role is not yet known)
856 struct wpa_init_params {
862 const char *test_socket;
863 int use_pae_group_addr;
867 u8 *own_addr; /* buffer for writing own MAC address */
871 struct wpa_bss_params {
872 /** Interface name (for multi-SSID/VLAN support) */
874 /** Whether IEEE 802.1X or WPA/WPA2 is enabled */
883 enum mfp_options ieee80211w;
886 #define WPA_STA_AUTHORIZED BIT(0)
887 #define WPA_STA_WMM BIT(1)
888 #define WPA_STA_SHORT_PREAMBLE BIT(2)
889 #define WPA_STA_MFP BIT(3)
890 #define WPA_STA_TDLS_PEER BIT(4)
893 * struct p2p_params - P2P parameters for driver-based P2P management
896 const char *dev_name;
898 #define DRV_MAX_SEC_DEV_TYPES 5
899 u8 sec_dev_type[DRV_MAX_SEC_DEV_TYPES][8];
900 size_t num_sec_dev_types;
914 * struct wpa_signal_info - Information about channel signal quality
916 struct wpa_signal_info {
925 * struct wpa_driver_ops - Driver interface API definition
927 * This structure defines the API that each driver interface needs to implement
928 * for core wpa_supplicant code. All driver specific functionality is captured
931 struct wpa_driver_ops {
932 /** Name of the driver interface */
934 /** One line description of the driver interface */
938 * get_bssid - Get the current BSSID
939 * @priv: private driver interface data
940 * @bssid: buffer for BSSID (ETH_ALEN = 6 bytes)
942 * Returns: 0 on success, -1 on failure
944 * Query kernel driver for the current BSSID and copy it to bssid.
945 * Setting bssid to 00:00:00:00:00:00 is recommended if the STA is not
948 int (*get_bssid)(void *priv, u8 *bssid);
951 * get_ssid - Get the current SSID
952 * @priv: private driver interface data
953 * @ssid: buffer for SSID (at least 32 bytes)
955 * Returns: Length of the SSID on success, -1 on failure
957 * Query kernel driver for the current SSID and copy it to ssid.
958 * Returning zero is recommended if the STA is not associated.
960 * Note: SSID is an array of octets, i.e., it is not nul terminated and
961 * can, at least in theory, contain control characters (including nul)
962 * and as such, should be processed as binary data, not a printable
965 int (*get_ssid)(void *priv, u8 *ssid);
968 * set_key - Configure encryption key
969 * @ifname: Interface name (for multi-SSID/VLAN support)
970 * @priv: private driver interface data
971 * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
972 * %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK);
973 * %WPA_ALG_NONE clears the key.
974 * @addr: Address of the peer STA (BSSID of the current AP when setting
975 * pairwise key in station mode), ff:ff:ff:ff:ff:ff for
976 * broadcast keys, %NULL for default keys that are used both for
977 * broadcast and unicast; when clearing keys, %NULL is used to
978 * indicate that both the broadcast-only and default key of the
979 * specified key index is to be cleared
980 * @key_idx: key index (0..3), usually 0 for unicast keys; 0..4095 for
982 * @set_tx: configure this key as the default Tx key (only used when
983 * driver does not support separate unicast/individual key
984 * @seq: sequence number/packet number, seq_len octets, the next
985 * packet number to be used for in replay protection; configured
986 * for Rx keys (in most cases, this is only used with broadcast
987 * keys and set to zero for unicast keys); %NULL if not set
988 * @seq_len: length of the seq, depends on the algorithm:
989 * TKIP: 6 octets, CCMP: 6 octets, IGTK: 6 octets
990 * @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key,
992 * @key_len: length of the key buffer in octets (WEP: 5 or 13,
993 * TKIP: 32, CCMP: 16, IGTK: 16)
995 * Returns: 0 on success, -1 on failure
997 * Configure the given key for the kernel driver. If the driver
998 * supports separate individual keys (4 default keys + 1 individual),
999 * addr can be used to determine whether the key is default or
1000 * individual. If only 4 keys are supported, the default key with key
1001 * index 0 is used as the individual key. STA must be configured to use
1002 * it as the default Tx key (set_tx is set) and accept Rx for all the
1003 * key indexes. In most cases, WPA uses only key indexes 1 and 2 for
1004 * broadcast keys, so key index 0 is available for this kind of
1007 * Please note that TKIP keys include separate TX and RX MIC keys and
1008 * some drivers may expect them in different order than wpa_supplicant
1009 * is using. If the TX/RX keys are swapped, all TKIP encrypted packets
1010 * will trigger Michael MIC errors. This can be fixed by changing the
1011 * order of MIC keys by swapping te bytes 16..23 and 24..31 of the key
1012 * in driver_*.c set_key() implementation, see driver_ndis.c for an
1013 * example on how this can be done.
1015 int (*set_key)(const char *ifname, void *priv, enum wpa_alg alg,
1016 const u8 *addr, int key_idx, int set_tx,
1017 const u8 *seq, size_t seq_len,
1018 const u8 *key, size_t key_len);
1021 * init - Initialize driver interface
1022 * @ctx: context to be used when calling wpa_supplicant functions,
1023 * e.g., wpa_supplicant_event()
1024 * @ifname: interface name, e.g., wlan0
1026 * Returns: Pointer to private data, %NULL on failure
1028 * Initialize driver interface, including event processing for kernel
1029 * driver events (e.g., associated, scan results, Michael MIC failure).
1030 * This function can allocate a private configuration data area for
1031 * @ctx, file descriptor, interface name, etc. information that may be
1032 * needed in future driver operations. If this is not used, non-NULL
1033 * value will need to be returned because %NULL is used to indicate
1034 * failure. The returned value will be used as 'void *priv' data for
1035 * all other driver_ops functions.
1037 * The main event loop (eloop.c) of wpa_supplicant can be used to
1038 * register callback for read sockets (eloop_register_read_sock()).
1040 * See below for more information about events and
1041 * wpa_supplicant_event() function.
1043 void * (*init)(void *ctx, const char *ifname);
1046 * deinit - Deinitialize driver interface
1047 * @priv: private driver interface data from init()
1049 * Shut down driver interface and processing of driver events. Free
1050 * private data buffer if one was allocated in init() handler.
1052 void (*deinit)(void *priv);
1055 * set_param - Set driver configuration parameters
1056 * @priv: private driver interface data from init()
1057 * @param: driver specific configuration parameters
1059 * Returns: 0 on success, -1 on failure
1061 * Optional handler for notifying driver interface about configuration
1062 * parameters (driver_param).
1064 int (*set_param)(void *priv, const char *param);
1067 * set_countermeasures - Enable/disable TKIP countermeasures
1068 * @priv: private driver interface data
1069 * @enabled: 1 = countermeasures enabled, 0 = disabled
1071 * Returns: 0 on success, -1 on failure
1073 * Configure TKIP countermeasures. When these are enabled, the driver
1074 * should drop all received and queued frames that are using TKIP.
1076 int (*set_countermeasures)(void *priv, int enabled);
1079 * deauthenticate - Request driver to deauthenticate
1080 * @priv: private driver interface data
1081 * @addr: peer address (BSSID of the AP)
1082 * @reason_code: 16-bit reason code to be sent in the deauthentication
1085 * Returns: 0 on success, -1 on failure
1087 int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
1090 * disassociate - Request driver to disassociate
1091 * @priv: private driver interface data
1092 * @addr: peer address (BSSID of the AP)
1093 * @reason_code: 16-bit reason code to be sent in the disassociation
1096 * Returns: 0 on success, -1 on failure
1098 int (*disassociate)(void *priv, const u8 *addr, int reason_code);
1101 * associate - Request driver to associate
1102 * @priv: private driver interface data
1103 * @params: association parameters
1105 * Returns: 0 on success, -1 on failure
1107 int (*associate)(void *priv,
1108 struct wpa_driver_associate_params *params);
1111 * add_pmkid - Add PMKSA cache entry to the driver
1112 * @priv: private driver interface data
1113 * @bssid: BSSID for the PMKSA cache entry
1114 * @pmkid: PMKID for the PMKSA cache entry
1116 * Returns: 0 on success, -1 on failure
1118 * This function is called when a new PMK is received, as a result of
1119 * either normal authentication or RSN pre-authentication.
1121 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
1122 * associate(), add_pmkid() can be used to add new PMKSA cache entries
1123 * in the driver. If the driver uses wpa_ie from wpa_supplicant, this
1124 * driver_ops function does not need to be implemented. Likewise, if
1125 * the driver does not support WPA, this function is not needed.
1127 int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
1130 * remove_pmkid - Remove PMKSA cache entry to the driver
1131 * @priv: private driver interface data
1132 * @bssid: BSSID for the PMKSA cache entry
1133 * @pmkid: PMKID for the PMKSA cache entry
1135 * Returns: 0 on success, -1 on failure
1137 * This function is called when the supplicant drops a PMKSA cache
1138 * entry for any reason.
1140 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
1141 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
1142 * between the driver and wpa_supplicant. If the driver uses wpa_ie
1143 * from wpa_supplicant, this driver_ops function does not need to be
1144 * implemented. Likewise, if the driver does not support WPA, this
1145 * function is not needed.
1147 int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
1150 * flush_pmkid - Flush PMKSA cache
1151 * @priv: private driver interface data
1153 * Returns: 0 on success, -1 on failure
1155 * This function is called when the supplicant drops all PMKSA cache
1156 * entries for any reason.
1158 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
1159 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
1160 * between the driver and wpa_supplicant. If the driver uses wpa_ie
1161 * from wpa_supplicant, this driver_ops function does not need to be
1162 * implemented. Likewise, if the driver does not support WPA, this
1163 * function is not needed.
1165 int (*flush_pmkid)(void *priv);
1168 * get_capa - Get driver capabilities
1169 * @priv: private driver interface data
1171 * Returns: 0 on success, -1 on failure
1173 * Get driver/firmware/hardware capabilities.
1175 int (*get_capa)(void *priv, struct wpa_driver_capa *capa);
1178 * poll - Poll driver for association information
1179 * @priv: private driver interface data
1181 * This is an option callback that can be used when the driver does not
1182 * provide event mechanism for association events. This is called when
1183 * receiving WPA EAPOL-Key messages that require association
1184 * information. The driver interface is supposed to generate associnfo
1185 * event before returning from this callback function. In addition, the
1186 * driver interface should generate an association event after having
1187 * sent out associnfo.
1189 void (*poll)(void *priv);
1192 * get_ifname - Get interface name
1193 * @priv: private driver interface data
1195 * Returns: Pointer to the interface name. This can differ from the
1196 * interface name used in init() call. Init() is called first.
1198 * This optional function can be used to allow the driver interface to
1199 * replace the interface name with something else, e.g., based on an
1200 * interface mapping from a more descriptive name.
1202 const char * (*get_ifname)(void *priv);
1205 * get_mac_addr - Get own MAC address
1206 * @priv: private driver interface data
1208 * Returns: Pointer to own MAC address or %NULL on failure
1210 * This optional function can be used to get the own MAC address of the
1211 * device from the driver interface code. This is only needed if the
1212 * l2_packet implementation for the OS does not provide easy access to
1214 const u8 * (*get_mac_addr)(void *priv);
1217 * send_eapol - Optional function for sending EAPOL packets
1218 * @priv: private driver interface data
1219 * @dest: Destination MAC address
1221 * @data: EAPOL packet starting with IEEE 802.1X header
1222 * @data_len: Size of the EAPOL packet
1224 * Returns: 0 on success, -1 on failure
1226 * This optional function can be used to override l2_packet operations
1227 * with driver specific functionality. If this function pointer is set,
1228 * l2_packet module is not used at all and the driver interface code is
1229 * responsible for receiving and sending all EAPOL packets. The
1230 * received EAPOL packets are sent to core code with EVENT_EAPOL_RX
1231 * event. The driver interface is required to implement get_mac_addr()
1232 * handler if send_eapol() is used.
1234 int (*send_eapol)(void *priv, const u8 *dest, u16 proto,
1235 const u8 *data, size_t data_len);
1238 * set_operstate - Sets device operating state to DORMANT or UP
1239 * @priv: private driver interface data
1240 * @state: 0 = dormant, 1 = up
1241 * Returns: 0 on success, -1 on failure
1243 * This is an optional function that can be used on operating systems
1244 * that support a concept of controlling network device state from user
1245 * space applications. This function, if set, gets called with
1246 * state = 1 when authentication has been completed and with state = 0
1247 * when connection is lost.
1249 int (*set_operstate)(void *priv, int state);
1252 * mlme_setprotection - MLME-SETPROTECTION.request primitive
1253 * @priv: Private driver interface data
1254 * @addr: Address of the station for which to set protection (may be
1255 * %NULL for group keys)
1256 * @protect_type: MLME_SETPROTECTION_PROTECT_TYPE_*
1257 * @key_type: MLME_SETPROTECTION_KEY_TYPE_*
1258 * Returns: 0 on success, -1 on failure
1260 * This is an optional function that can be used to set the driver to
1261 * require protection for Tx and/or Rx frames. This uses the layer
1262 * interface defined in IEEE 802.11i-2004 clause 10.3.22.1
1263 * (MLME-SETPROTECTION.request). Many drivers do not use explicit
1264 * set protection operation; instead, they set protection implicitly
1265 * based on configured keys.
1267 int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type,
1271 * get_hw_feature_data - Get hardware support data (channels and rates)
1272 * @priv: Private driver interface data
1273 * @num_modes: Variable for returning the number of returned modes
1274 * flags: Variable for returning hardware feature flags
1275 * Returns: Pointer to allocated hardware data on success or %NULL on
1276 * failure. Caller is responsible for freeing this.
1278 struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
1283 * send_mlme - Send management frame from MLME
1284 * @priv: Private driver interface data
1285 * @data: IEEE 802.11 management frame with IEEE 802.11 header
1286 * @data_len: Size of the management frame
1287 * @noack: Do not wait for this frame to be acked (disable retries)
1288 * Returns: 0 on success, -1 on failure
1290 int (*send_mlme)(void *priv, const u8 *data, size_t data_len,
1294 * update_ft_ies - Update FT (IEEE 802.11r) IEs
1295 * @priv: Private driver interface data
1296 * @md: Mobility domain (2 octets) (also included inside ies)
1297 * @ies: FT IEs (MDIE, FTIE, ...) or %NULL to remove IEs
1298 * @ies_len: Length of FT IEs in bytes
1299 * Returns: 0 on success, -1 on failure
1301 * The supplicant uses this callback to let the driver know that keying
1302 * material for FT is available and that the driver can use the
1303 * provided IEs in the next message in FT authentication sequence.
1305 * This function is only needed for driver that support IEEE 802.11r
1306 * (Fast BSS Transition).
1308 int (*update_ft_ies)(void *priv, const u8 *md, const u8 *ies,
1312 * send_ft_action - Send FT Action frame (IEEE 802.11r)
1313 * @priv: Private driver interface data
1314 * @action: Action field value
1315 * @target_ap: Target AP address
1316 * @ies: FT IEs (MDIE, FTIE, ...) (FT Request action frame body)
1317 * @ies_len: Length of FT IEs in bytes
1318 * Returns: 0 on success, -1 on failure
1320 * The supplicant uses this callback to request the driver to transmit
1321 * an FT Action frame (action category 6) for over-the-DS fast BSS
1324 int (*send_ft_action)(void *priv, u8 action, const u8 *target_ap,
1325 const u8 *ies, size_t ies_len);
1328 * get_scan_results2 - Fetch the latest scan results
1329 * @priv: private driver interface data
1331 * Returns: Allocated buffer of scan results (caller is responsible for
1332 * freeing the data structure) on success, NULL on failure
1334 struct wpa_scan_results * (*get_scan_results2)(void *priv);
1337 * set_country - Set country
1338 * @priv: Private driver interface data
1339 * @alpha2: country to which to switch to
1340 * Returns: 0 on success, -1 on failure
1342 * This function is for drivers which support some form
1343 * of setting a regulatory domain.
1345 int (*set_country)(void *priv, const char *alpha2);
1348 * global_init - Global driver initialization
1349 * Returns: Pointer to private data (global), %NULL on failure
1351 * This optional function is called to initialize the driver wrapper
1352 * for global data, i.e., data that applies to all interfaces. If this
1353 * function is implemented, global_deinit() will also need to be
1354 * implemented to free the private data. The driver will also likely
1355 * use init2() function instead of init() to get the pointer to global
1356 * data available to per-interface initializer.
1358 void * (*global_init)(void);
1361 * global_deinit - Global driver deinitialization
1362 * @priv: private driver global data from global_init()
1364 * Terminate any global driver related functionality and free the
1365 * global data structure.
1367 void (*global_deinit)(void *priv);
1370 * init2 - Initialize driver interface (with global data)
1371 * @ctx: context to be used when calling wpa_supplicant functions,
1372 * e.g., wpa_supplicant_event()
1373 * @ifname: interface name, e.g., wlan0
1374 * @global_priv: private driver global data from global_init()
1375 * Returns: Pointer to private data, %NULL on failure
1377 * This function can be used instead of init() if the driver wrapper
1380 void * (*init2)(void *ctx, const char *ifname, void *global_priv);
1383 * get_interfaces - Get information about available interfaces
1384 * @global_priv: private driver global data from global_init()
1385 * Returns: Allocated buffer of interface information (caller is
1386 * responsible for freeing the data structure) on success, NULL on
1389 struct wpa_interface_info * (*get_interfaces)(void *global_priv);
1392 * scan2 - Request the driver to initiate scan
1393 * @priv: private driver interface data
1394 * @params: Scan parameters
1396 * Returns: 0 on success, -1 on failure
1398 * Once the scan results are ready, the driver should report scan
1399 * results event for wpa_supplicant which will eventually request the
1400 * results with wpa_driver_get_scan_results2().
1402 int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
1405 * authenticate - Request driver to authenticate
1406 * @priv: private driver interface data
1407 * @params: authentication parameters
1408 * Returns: 0 on success, -1 on failure
1410 * This is an optional function that can be used with drivers that
1411 * support separate authentication and association steps, i.e., when
1412 * wpa_supplicant can act as the SME. If not implemented, associate()
1413 * function is expected to take care of IEEE 802.11 authentication,
1416 int (*authenticate)(void *priv,
1417 struct wpa_driver_auth_params *params);
1420 * set_ap - Set Beacon and Probe Response information for AP mode
1421 * @priv: Private driver interface data
1422 * @params: Parameters to use in AP mode
1424 * This function is used to configure Beacon template and/or extra IEs
1425 * to add for Beacon and Probe Response frames for the driver in
1426 * AP mode. The driver is responsible for building the full Beacon
1427 * frame by concatenating the head part with TIM IE generated by the
1428 * driver/firmware and finishing with the tail part. Depending on the
1429 * driver architectue, this can be done either by using the full
1430 * template or the set of additional IEs (e.g., WPS and P2P IE).
1431 * Similarly, Probe Response processing depends on the driver design.
1432 * If the driver (or firmware) takes care of replying to Probe Request
1433 * frames, the extra IEs provided here needs to be added to the Probe
1436 * Returns: 0 on success, -1 on failure
1438 int (*set_ap)(void *priv, struct wpa_driver_ap_params *params);
1441 * hapd_init - Initialize driver interface (hostapd only)
1442 * @hapd: Pointer to hostapd context
1443 * @params: Configuration for the driver wrapper
1444 * Returns: Pointer to private data, %NULL on failure
1446 * This function is used instead of init() or init2() when the driver
1447 * wrapper is used with hostapd.
1449 void * (*hapd_init)(struct hostapd_data *hapd,
1450 struct wpa_init_params *params);
1453 * hapd_deinit - Deinitialize driver interface (hostapd only)
1454 * @priv: Private driver interface data from hapd_init()
1456 void (*hapd_deinit)(void *priv);
1459 * set_ieee8021x - Enable/disable IEEE 802.1X support (AP only)
1460 * @priv: Private driver interface data
1461 * @params: BSS parameters
1462 * Returns: 0 on success, -1 on failure
1464 * This is an optional function to configure the kernel driver to
1465 * enable/disable IEEE 802.1X support and set WPA/WPA2 parameters. This
1466 * can be left undefined (set to %NULL) if IEEE 802.1X support is
1467 * always enabled and the driver uses set_ap() to set WPA/RSN IE
1468 * for Beacon frames.
1470 * DEPRECATED - use set_ap() instead
1472 int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
1475 * set_privacy - Enable/disable privacy (AP only)
1476 * @priv: Private driver interface data
1477 * @enabled: 1 = privacy enabled, 0 = disabled
1478 * Returns: 0 on success, -1 on failure
1480 * This is an optional function to configure privacy field in the
1481 * kernel driver for Beacon frames. This can be left undefined (set to
1482 * %NULL) if the driver uses the Beacon template from set_ap().
1484 * DEPRECATED - use set_ap() instead
1486 int (*set_privacy)(void *priv, int enabled);
1489 * get_seqnum - Fetch the current TSC/packet number (AP only)
1490 * @ifname: The interface name (main or virtual)
1491 * @priv: Private driver interface data
1492 * @addr: MAC address of the station or %NULL for group keys
1494 * @seq: Buffer for returning the latest used TSC/packet number
1495 * Returns: 0 on success, -1 on failure
1497 * This function is used to fetch the last used TSC/packet number for
1498 * a TKIP, CCMP, or BIP/IGTK key. It is mainly used with group keys, so
1499 * there is no strict requirement on implementing support for unicast
1500 * keys (i.e., addr != %NULL).
1502 int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
1506 * flush - Flush all association stations (AP only)
1507 * @priv: Private driver interface data
1508 * Returns: 0 on success, -1 on failure
1510 * This function requests the driver to disassociate all associated
1511 * stations. This function does not need to be implemented if the
1512 * driver does not process association frames internally.
1514 int (*flush)(void *priv);
1517 * set_generic_elem - Add IEs into Beacon/Probe Response frames (AP)
1518 * @priv: Private driver interface data
1519 * @elem: Information elements
1520 * @elem_len: Length of the elem buffer in octets
1521 * Returns: 0 on success, -1 on failure
1523 * This is an optional function to add information elements in the
1524 * kernel driver for Beacon and Probe Response frames. This can be left
1525 * undefined (set to %NULL) if the driver uses the Beacon template from
1528 * DEPRECATED - use set_ap() instead
1530 int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len);
1533 * read_sta_data - Fetch station data (AP only)
1534 * @priv: Private driver interface data
1535 * @data: Buffer for returning station information
1536 * @addr: MAC address of the station
1537 * Returns: 0 on success, -1 on failure
1539 int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
1543 * hapd_send_eapol - Send an EAPOL packet (AP only)
1544 * @priv: private driver interface data
1545 * @addr: Destination MAC address
1546 * @data: EAPOL packet starting with IEEE 802.1X header
1547 * @data_len: Length of the EAPOL packet in octets
1548 * @encrypt: Whether the frame should be encrypted
1549 * @own_addr: Source MAC address
1550 * @flags: WPA_STA_* flags for the destination station
1552 * Returns: 0 on success, -1 on failure
1554 int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
1555 size_t data_len, int encrypt,
1556 const u8 *own_addr, u32 flags);
1559 * sta_deauth - Deauthenticate a station (AP only)
1560 * @priv: Private driver interface data
1561 * @own_addr: Source address and BSSID for the Deauthentication frame
1562 * @addr: MAC address of the station to deauthenticate
1563 * @reason: Reason code for the Deauthentiation frame
1564 * Returns: 0 on success, -1 on failure
1566 * This function requests a specific station to be deauthenticated and
1567 * a Deauthentication frame to be sent to it.
1569 int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
1573 * sta_disassoc - Disassociate a station (AP only)
1574 * @priv: Private driver interface data
1575 * @own_addr: Source address and BSSID for the Disassociation frame
1576 * @addr: MAC address of the station to disassociate
1577 * @reason: Reason code for the Disassociation frame
1578 * Returns: 0 on success, -1 on failure
1580 * This function requests a specific station to be disassociated and
1581 * a Disassociation frame to be sent to it.
1583 int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
1587 * sta_remove - Remove a station entry (AP only)
1588 * @priv: Private driver interface data
1589 * @addr: MAC address of the station to be removed
1590 * Returns: 0 on success, -1 on failure
1592 int (*sta_remove)(void *priv, const u8 *addr);
1595 * hapd_get_ssid - Get the current SSID (AP only)
1596 * @priv: Private driver interface data
1597 * @buf: Buffer for returning the SSID
1598 * @len: Maximum length of the buffer
1599 * Returns: Length of the SSID on success, -1 on failure
1601 * This function need not be implemented if the driver uses Beacon
1602 * template from set_ap() and does not reply to Probe Request frames.
1604 int (*hapd_get_ssid)(void *priv, u8 *buf, int len);
1607 * hapd_set_ssid - Set SSID (AP only)
1608 * @priv: Private driver interface data
1610 * @len: Length of the SSID in octets
1611 * Returns: 0 on success, -1 on failure
1613 * DEPRECATED - use set_ap() instead
1615 int (*hapd_set_ssid)(void *priv, const u8 *buf, int len);
1618 * hapd_set_countermeasures - Enable/disable TKIP countermeasures (AP)
1619 * @priv: Private driver interface data
1620 * @enabled: 1 = countermeasures enabled, 0 = disabled
1621 * Returns: 0 on success, -1 on failure
1623 * This need not be implemented if the driver does not take care of
1624 * association processing.
1626 int (*hapd_set_countermeasures)(void *priv, int enabled);
1629 * sta_add - Add a station entry
1630 * @priv: Private driver interface data
1631 * @params: Station parameters
1632 * Returns: 0 on success, -1 on failure
1634 * This function is used to add a station entry to the driver once the
1635 * station has completed association. This is only used if the driver
1636 * does not take care of association processing.
1638 * With TDLS, this function is also used to add or set (params->set 1)
1639 * TDLS peer entries.
1641 int (*sta_add)(void *priv, struct hostapd_sta_add_params *params);
1644 * get_inact_sec - Get station inactivity duration (AP only)
1645 * @priv: Private driver interface data
1646 * @addr: Station address
1647 * Returns: Number of seconds station has been inactive, -1 on failure
1649 int (*get_inact_sec)(void *priv, const u8 *addr);
1652 * sta_clear_stats - Clear station statistics (AP only)
1653 * @priv: Private driver interface data
1654 * @addr: Station address
1655 * Returns: 0 on success, -1 on failure
1657 int (*sta_clear_stats)(void *priv, const u8 *addr);
1660 * set_freq - Set channel/frequency (AP only)
1661 * @priv: Private driver interface data
1662 * @freq: Channel parameters
1663 * Returns: 0 on success, -1 on failure
1665 int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
1668 * set_rts - Set RTS threshold
1669 * @priv: Private driver interface data
1670 * @rts: RTS threshold in octets
1671 * Returns: 0 on success, -1 on failure
1673 int (*set_rts)(void *priv, int rts);
1676 * set_frag - Set fragmentation threshold
1677 * @priv: Private driver interface data
1678 * @frag: Fragmentation threshold in octets
1679 * Returns: 0 on success, -1 on failure
1681 int (*set_frag)(void *priv, int frag);
1684 * sta_set_flags - Set station flags (AP only)
1685 * @priv: Private driver interface data
1686 * @addr: Station address
1687 * @total_flags: Bitmap of all WPA_STA_* flags currently set
1688 * @flags_or: Bitmap of WPA_STA_* flags to add
1689 * @flags_and: Bitmap of WPA_STA_* flags to us as a mask
1690 * Returns: 0 on success, -1 on failure
1692 int (*sta_set_flags)(void *priv, const u8 *addr,
1693 int total_flags, int flags_or, int flags_and);
1696 * set_tx_queue_params - Set TX queue parameters
1697 * @priv: Private driver interface data
1698 * @queue: Queue number (0 = VO, 1 = VI, 2 = BE, 3 = BK)
1702 * @burst_time: Maximum length for bursting in 0.1 msec units
1704 int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
1705 int cw_max, int burst_time);
1708 * if_add - Add a virtual interface
1709 * @priv: Private driver interface data
1710 * @type: Interface type
1711 * @ifname: Interface name for the new virtual interface
1712 * @addr: Local address to use for the interface or %NULL to use the
1713 * parent interface address
1714 * @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces
1715 * @drv_priv: Pointer for overwriting the driver context or %NULL if
1716 * not allowed (applies only to %WPA_IF_AP_BSS type)
1717 * @force_ifname: Buffer for returning an interface name that the
1718 * driver ended up using if it differs from the requested ifname
1719 * @if_addr: Buffer for returning the allocated interface address
1720 * (this may differ from the requested addr if the driver cannot
1721 * change interface address)
1722 * @bridge: Bridge interface to use or %NULL if no bridge configured
1723 * Returns: 0 on success, -1 on failure
1725 int (*if_add)(void *priv, enum wpa_driver_if_type type,
1726 const char *ifname, const u8 *addr, void *bss_ctx,
1727 void **drv_priv, char *force_ifname, u8 *if_addr,
1728 const char *bridge);
1731 * if_remove - Remove a virtual interface
1732 * @priv: Private driver interface data
1733 * @type: Interface type
1734 * @ifname: Interface name of the virtual interface to be removed
1735 * Returns: 0 on success, -1 on failure
1737 int (*if_remove)(void *priv, enum wpa_driver_if_type type,
1738 const char *ifname);
1741 * set_sta_vlan - Bind a station into a specific interface (AP only)
1742 * @priv: Private driver interface data
1743 * @ifname: Interface (main or virtual BSS or VLAN)
1744 * @addr: MAC address of the associated station
1746 * Returns: 0 on success, -1 on failure
1748 * This function is used to bind a station to a specific virtual
1749 * interface. It is only used if when virtual interfaces are supported,
1750 * e.g., to assign stations to different VLAN interfaces based on
1751 * information from a RADIUS server. This allows separate broadcast
1752 * domains to be used with a single BSS.
1754 int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
1758 * commit - Optional commit changes handler (AP only)
1759 * @priv: driver private data
1760 * Returns: 0 on success, -1 on failure
1762 * This optional handler function can be registered if the driver
1763 * interface implementation needs to commit changes (e.g., by setting
1764 * network interface up) at the end of initial configuration. If set,
1765 * this handler will be called after initial setup has been completed.
1767 int (*commit)(void *priv);
1770 * send_ether - Send an ethernet packet (AP only)
1771 * @priv: private driver interface data
1772 * @dst: Destination MAC address
1773 * @src: Source MAC address
1775 * @data: EAPOL packet starting with IEEE 802.1X header
1776 * @data_len: Length of the EAPOL packet in octets
1777 * Returns: 0 on success, -1 on failure
1779 int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto,
1780 const u8 *data, size_t data_len);
1783 * set_radius_acl_auth - Notification of RADIUS ACL change
1784 * @priv: Private driver interface data
1785 * @mac: MAC address of the station
1786 * @accepted: Whether the station was accepted
1787 * @session_timeout: Session timeout for the station
1788 * Returns: 0 on success, -1 on failure
1790 int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted,
1791 u32 session_timeout);
1794 * set_radius_acl_expire - Notification of RADIUS ACL expiration
1795 * @priv: Private driver interface data
1796 * @mac: MAC address of the station
1797 * Returns: 0 on success, -1 on failure
1799 int (*set_radius_acl_expire)(void *priv, const u8 *mac);
1802 * set_ap_wps_ie - Add WPS IE(s) into Beacon/Probe Response frames (AP)
1803 * @priv: Private driver interface data
1804 * @beacon: WPS IE(s) for Beacon frames or %NULL to remove extra IE(s)
1805 * @proberesp: WPS IE(s) for Probe Response frames or %NULL to remove
1807 * @assocresp: WPS IE(s) for (Re)Association Response frames or %NULL
1808 * to remove extra IE(s)
1809 * Returns: 0 on success, -1 on failure
1811 * This is an optional function to add WPS IE in the kernel driver for
1812 * Beacon and Probe Response frames. This can be left undefined (set
1813 * to %NULL) if the driver uses the Beacon template from set_ap()
1814 * and does not process Probe Request frames. If the driver takes care
1815 * of (Re)Association frame processing, the assocresp buffer includes
1816 * WPS IE(s) that need to be added to (Re)Association Response frames
1817 * whenever a (Re)Association Request frame indicated use of WPS.
1819 * This will also be used to add P2P IE(s) into Beacon/Probe Response
1820 * frames when operating as a GO. The driver is responsible for adding
1821 * timing related attributes (e.g., NoA) in addition to the IEs
1822 * included here by appending them after these buffers. This call is
1823 * also used to provide Probe Response IEs for P2P Listen state
1824 * operations for drivers that generate the Probe Response frames
1827 * DEPRECATED - use set_ap() instead
1829 int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon,
1830 const struct wpabuf *proberesp,
1831 const struct wpabuf *assocresp);
1834 * set_supp_port - Set IEEE 802.1X Supplicant Port status
1835 * @priv: Private driver interface data
1836 * @authorized: Whether the port is authorized
1837 * Returns: 0 on success, -1 on failure
1839 int (*set_supp_port)(void *priv, int authorized);
1842 * set_wds_sta - Bind a station into a 4-address WDS (AP only)
1843 * @priv: Private driver interface data
1844 * @addr: MAC address of the associated station
1845 * @aid: Association ID
1846 * @val: 1 = bind to 4-address WDS; 0 = unbind
1847 * @bridge_ifname: Bridge interface to use for the WDS station or %NULL
1848 * to indicate that bridge is not to be used
1849 * Returns: 0 on success, -1 on failure
1851 int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val,
1852 const char *bridge_ifname);
1855 * send_action - Transmit an Action frame
1856 * @priv: Private driver interface data
1857 * @freq: Frequency (in MHz) of the channel
1858 * @wait: Time to wait off-channel for a response (in ms), or zero
1859 * @dst: Destination MAC address (Address 1)
1860 * @src: Source MAC address (Address 2)
1861 * @bssid: BSSID (Address 3)
1863 * @data_len: data length in octets
1864 @ @no_cck: Whether CCK rates must not be used to transmit this frame
1865 * Returns: 0 on success, -1 on failure
1867 * This command can be used to request the driver to transmit an action
1868 * frame to the specified destination.
1870 * If the %WPA_DRIVER_FLAGS_OFFCHANNEL_TX flag is set, the frame will
1871 * be transmitted on the given channel and the device will wait for a
1872 * response on that channel for the given wait time.
1874 * If the flag is not set, the wait time will be ignored. In this case,
1875 * if a remain-on-channel duration is in progress, the frame must be
1876 * transmitted on that channel; alternatively the frame may be sent on
1877 * the current operational channel (if in associated state in station
1878 * mode or while operating as an AP.)
1880 int (*send_action)(void *priv, unsigned int freq, unsigned int wait,
1881 const u8 *dst, const u8 *src, const u8 *bssid,
1882 const u8 *data, size_t data_len, int no_cck);
1885 * send_action_cancel_wait - Cancel action frame TX wait
1886 * @priv: Private driver interface data
1888 * This command cancels the wait time associated with sending an action
1889 * frame. It is only available when %WPA_DRIVER_FLAGS_OFFCHANNEL_TX is
1890 * set in the driver flags.
1892 void (*send_action_cancel_wait)(void *priv);
1895 * remain_on_channel - Remain awake on a channel
1896 * @priv: Private driver interface data
1897 * @freq: Frequency (in MHz) of the channel
1898 * @duration: Duration in milliseconds
1899 * Returns: 0 on success, -1 on failure
1901 * This command is used to request the driver to remain awake on the
1902 * specified channel for the specified duration and report received
1903 * Action frames with EVENT_RX_ACTION events. Optionally, received
1904 * Probe Request frames may also be requested to be reported by calling
1905 * probe_req_report(). These will be reported with EVENT_RX_PROBE_REQ.
1907 * The driver may not be at the requested channel when this function
1908 * returns, i.e., the return code is only indicating whether the
1909 * request was accepted. The caller will need to wait until the
1910 * EVENT_REMAIN_ON_CHANNEL event indicates that the driver has
1911 * completed the channel change. This may take some time due to other
1912 * need for the radio and the caller should be prepared to timing out
1913 * its wait since there are no guarantees on when this request can be
1916 int (*remain_on_channel)(void *priv, unsigned int freq,
1917 unsigned int duration);
1920 * cancel_remain_on_channel - Cancel remain-on-channel operation
1921 * @priv: Private driver interface data
1923 * This command can be used to cancel a remain-on-channel operation
1924 * before its originally requested duration has passed. This could be
1925 * used, e.g., when remain_on_channel() is used to request extra time
1926 * to receive a response to an Action frame and the response is
1927 * received when there is still unneeded time remaining on the
1928 * remain-on-channel operation.
1930 int (*cancel_remain_on_channel)(void *priv);
1933 * probe_req_report - Request Probe Request frames to be indicated
1934 * @priv: Private driver interface data
1935 * @report: Whether to report received Probe Request frames
1936 * Returns: 0 on success, -1 on failure (or if not supported)
1938 * This command can be used to request the driver to indicate when
1939 * Probe Request frames are received with EVENT_RX_PROBE_REQ events.
1940 * Since this operation may require extra resources, e.g., due to less
1941 * optimal hardware/firmware RX filtering, many drivers may disable
1942 * Probe Request reporting at least in station mode. This command is
1943 * used to notify the driver when the Probe Request frames need to be
1944 * reported, e.g., during remain-on-channel operations.
1946 int (*probe_req_report)(void *priv, int report);
1949 * deinit_ap - Deinitialize AP mode
1950 * @priv: Private driver interface data
1951 * Returns: 0 on success, -1 on failure (or if not supported)
1953 * This optional function can be used to disable AP mode related
1954 * configuration and change the driver mode to station mode to allow
1955 * normal station operations like scanning to be completed.
1957 int (*deinit_ap)(void *priv);
1960 * suspend - Notification on system suspend/hibernate event
1961 * @priv: Private driver interface data
1963 void (*suspend)(void *priv);
1966 * resume - Notification on system resume/thaw event
1967 * @priv: Private driver interface data
1969 void (*resume)(void *priv);
1972 * signal_monitor - Set signal monitoring parameters
1973 * @priv: Private driver interface data
1974 * @threshold: Threshold value for signal change events; 0 = disabled
1975 * @hysteresis: Minimum change in signal strength before indicating a
1977 * Returns: 0 on success, -1 on failure (or if not supported)
1979 * This function can be used to configure monitoring of signal strength
1980 * with the current AP. Whenever signal strength drops below the
1981 * %threshold value or increases above it, EVENT_SIGNAL_CHANGE event
1982 * should be generated assuming the signal strength has changed at
1983 * least %hysteresis from the previously indicated signal change event.
1985 int (*signal_monitor)(void *priv, int threshold, int hysteresis);
1988 * send_frame - Send IEEE 802.11 frame (testing use only)
1989 * @priv: Private driver interface data
1990 * @data: IEEE 802.11 frame with IEEE 802.11 header
1991 * @data_len: Size of the frame
1992 * @encrypt: Whether to encrypt the frame (if keys are set)
1993 * Returns: 0 on success, -1 on failure
1995 * This function is only used for debugging purposes and is not
1996 * required to be implemented for normal operations.
1998 int (*send_frame)(void *priv, const u8 *data, size_t data_len,
2002 * shared_freq - Get operating frequency of shared interface(s)
2003 * @priv: Private driver interface data
2004 * Returns: Operating frequency in MHz, 0 if no shared operation in
2005 * use, or -1 on failure
2007 * This command can be used to request the current operating frequency
2008 * of any virtual interface that shares the same radio to provide
2009 * information for channel selection for other virtual interfaces.
2011 int (*shared_freq)(void *priv);
2014 * get_noa - Get current Notice of Absence attribute payload
2015 * @priv: Private driver interface data
2016 * @buf: Buffer for returning NoA
2017 * @buf_len: Buffer length in octets
2018 * Returns: Number of octets used in buf, 0 to indicate no NoA is being
2019 * advertized, or -1 on failure
2021 * This function is used to fetch the current Notice of Absence
2022 * attribute value from GO.
2024 int (*get_noa)(void *priv, u8 *buf, size_t buf_len);
2027 * set_noa - Set Notice of Absence parameters for GO (testing)
2028 * @priv: Private driver interface data
2030 * @start: Start time in ms from next TBTT
2031 * @duration: Duration in ms
2032 * Returns: 0 on success or -1 on failure
2034 * This function is used to set Notice of Absence parameters for GO. It
2035 * is used only for testing. To disable NoA, all parameters are set to
2038 int (*set_noa)(void *priv, u8 count, int start, int duration);
2041 * set_p2p_powersave - Set P2P power save options
2042 * @priv: Private driver interface data
2043 * @legacy_ps: 0 = disable, 1 = enable, 2 = maximum PS, -1 = no change
2044 * @opp_ps: 0 = disable, 1 = enable, -1 = no change
2045 * @ctwindow: 0.. = change (msec), -1 = no change
2046 * Returns: 0 on success or -1 on failure
2048 int (*set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps,
2052 * ampdu - Enable/disable aggregation
2053 * @priv: Private driver interface data
2054 * @ampdu: 1/0 = enable/disable A-MPDU aggregation
2055 * Returns: 0 on success or -1 on failure
2057 int (*ampdu)(void *priv, int ampdu);
2060 * get_radio_name - Get physical radio name for the device
2061 * @priv: Private driver interface data
2062 * Returns: Radio name or %NULL if not known
2064 * The returned data must not be modified by the caller. It is assumed
2065 * that any interface that has the same radio name as another is
2066 * sharing the same physical radio. This information can be used to
2067 * share scan results etc. information between the virtual interfaces
2068 * to speed up various operations.
2070 const char * (*get_radio_name)(void *priv);
2073 * p2p_find - Start P2P Device Discovery
2074 * @priv: Private driver interface data
2075 * @timeout: Timeout for find operation in seconds or 0 for no timeout
2076 * @type: Device Discovery type (enum p2p_discovery_type)
2077 * Returns: 0 on success, -1 on failure
2079 * This function is only used if the driver implements P2P management,
2080 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2081 * struct wpa_driver_capa.
2083 int (*p2p_find)(void *priv, unsigned int timeout, int type);
2086 * p2p_stop_find - Stop P2P Device Discovery
2087 * @priv: Private driver interface data
2088 * Returns: 0 on success, -1 on failure
2090 * This function is only used if the driver implements P2P management,
2091 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2092 * struct wpa_driver_capa.
2094 int (*p2p_stop_find)(void *priv);
2097 * p2p_listen - Start P2P Listen state for specified duration
2098 * @priv: Private driver interface data
2099 * @timeout: Listen state duration in milliseconds
2100 * Returns: 0 on success, -1 on failure
2102 * This function can be used to request the P2P module to keep the
2103 * device discoverable on the listen channel for an extended set of
2104 * time. At least in its current form, this is mainly used for testing
2105 * purposes and may not be of much use for normal P2P operations.
2107 * This function is only used if the driver implements P2P management,
2108 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2109 * struct wpa_driver_capa.
2111 int (*p2p_listen)(void *priv, unsigned int timeout);
2114 * p2p_connect - Start P2P group formation (GO negotiation)
2115 * @priv: Private driver interface data
2116 * @peer_addr: MAC address of the peer P2P client
2117 * @wps_method: enum p2p_wps_method value indicating config method
2118 * @go_intent: Local GO intent value (1..15)
2119 * @own_interface_addr: Intended interface address to use with the
2121 * @force_freq: The only allowed channel frequency in MHz or 0
2122 * @persistent_group: Whether to create persistent group
2123 * Returns: 0 on success, -1 on failure
2125 * This function is only used if the driver implements P2P management,
2126 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2127 * struct wpa_driver_capa.
2129 int (*p2p_connect)(void *priv, const u8 *peer_addr, int wps_method,
2130 int go_intent, const u8 *own_interface_addr,
2131 unsigned int force_freq, int persistent_group);
2134 * wps_success_cb - Report successfully completed WPS provisioning
2135 * @priv: Private driver interface data
2136 * @peer_addr: Peer address
2137 * Returns: 0 on success, -1 on failure
2139 * This function is used to report successfully completed WPS
2140 * provisioning during group formation in both GO/Registrar and
2141 * client/Enrollee roles.
2143 * This function is only used if the driver implements P2P management,
2144 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2145 * struct wpa_driver_capa.
2147 int (*wps_success_cb)(void *priv, const u8 *peer_addr);
2150 * p2p_group_formation_failed - Report failed WPS provisioning
2151 * @priv: Private driver interface data
2152 * Returns: 0 on success, -1 on failure
2154 * This function is used to report failed group formation. This can
2155 * happen either due to failed WPS provisioning or due to 15 second
2156 * timeout during the provisioning phase.
2158 * This function is only used if the driver implements P2P management,
2159 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2160 * struct wpa_driver_capa.
2162 int (*p2p_group_formation_failed)(void *priv);
2165 * p2p_set_params - Set P2P parameters
2166 * @priv: Private driver interface data
2167 * @params: P2P parameters
2168 * Returns: 0 on success, -1 on failure
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.
2174 int (*p2p_set_params)(void *priv, const struct p2p_params *params);
2177 * p2p_prov_disc_req - Send Provision Discovery Request
2178 * @priv: Private driver interface data
2179 * @peer_addr: MAC address of the peer P2P client
2180 * @config_methods: WPS Config Methods value (only one bit set)
2181 * Returns: 0 on success, -1 on failure
2183 * This function can be used to request a discovered P2P peer to
2184 * display a PIN (config_methods = WPS_CONFIG_DISPLAY) or be prepared
2185 * to enter a PIN from us (config_methods = WPS_CONFIG_KEYPAD). The
2186 * Provision Discovery Request frame is transmitted once immediately
2187 * and if no response is received, the frame will be sent again
2188 * whenever the target device is discovered during device dsicovery
2189 * (start with a p2p_find() call). Response from the peer is indicated
2190 * with the EVENT_P2P_PROV_DISC_RESPONSE event.
2192 * This function is only used if the driver implements P2P management,
2193 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2194 * struct wpa_driver_capa.
2196 int (*p2p_prov_disc_req)(void *priv, const u8 *peer_addr,
2197 u16 config_methods);
2200 * p2p_sd_request - Schedule a service discovery query
2201 * @priv: Private driver interface data
2202 * @dst: Destination peer or %NULL to apply for all peers
2203 * @tlvs: P2P Service Query TLV(s)
2204 * Returns: Reference to the query or 0 on failure
2206 * Response to the query is indicated with the
2207 * EVENT_P2P_SD_RESPONSE driver event.
2209 * This function is only used if the driver implements P2P management,
2210 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2211 * struct wpa_driver_capa.
2213 u64 (*p2p_sd_request)(void *priv, const u8 *dst,
2214 const struct wpabuf *tlvs);
2217 * p2p_sd_cancel_request - Cancel a pending service discovery query
2218 * @priv: Private driver interface data
2219 * @req: Query reference from p2p_sd_request()
2220 * Returns: 0 on success, -1 on failure
2222 * This function is only used if the driver implements P2P management,
2223 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2224 * struct wpa_driver_capa.
2226 int (*p2p_sd_cancel_request)(void *priv, u64 req);
2229 * p2p_sd_response - Send response to a service discovery query
2230 * @priv: Private driver interface data
2231 * @freq: Frequency from EVENT_P2P_SD_REQUEST event
2232 * @dst: Destination address from EVENT_P2P_SD_REQUEST event
2233 * @dialog_token: Dialog token from EVENT_P2P_SD_REQUEST event
2234 * @resp_tlvs: P2P Service Response TLV(s)
2235 * Returns: 0 on success, -1 on failure
2237 * This function is called as a response to the request indicated with
2238 * the EVENT_P2P_SD_REQUEST driver event.
2240 * This function is only used if the driver implements P2P management,
2241 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2242 * struct wpa_driver_capa.
2244 int (*p2p_sd_response)(void *priv, int freq, const u8 *dst,
2246 const struct wpabuf *resp_tlvs);
2249 * p2p_service_update - Indicate a change in local services
2250 * @priv: Private driver interface data
2251 * Returns: 0 on success, -1 on failure
2253 * This function needs to be called whenever there is a change in
2254 * availability of the local services. This will increment the
2255 * Service Update Indicator value which will be used in SD Request and
2258 * This function is only used if the driver implements P2P management,
2259 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2260 * struct wpa_driver_capa.
2262 int (*p2p_service_update)(void *priv);
2265 * p2p_reject - Reject peer device (explicitly block connections)
2266 * @priv: Private driver interface data
2267 * @addr: MAC address of the peer
2268 * Returns: 0 on success, -1 on failure
2270 int (*p2p_reject)(void *priv, const u8 *addr);
2273 * p2p_invite - Invite a P2P Device into a group
2274 * @priv: Private driver interface data
2275 * @peer: Device Address of the peer P2P Device
2276 * @role: Local role in the group
2277 * @bssid: Group BSSID or %NULL if not known
2279 * @ssid_len: Length of ssid in octets
2280 * @go_dev_addr: Forced GO Device Address or %NULL if none
2281 * @persistent_group: Whether this is to reinvoke a persistent group
2282 * Returns: 0 on success, -1 on failure
2284 int (*p2p_invite)(void *priv, const u8 *peer, int role,
2285 const u8 *bssid, const u8 *ssid, size_t ssid_len,
2286 const u8 *go_dev_addr, int persistent_group);
2289 * send_tdls_mgmt - for sending TDLS management packets
2290 * @priv: private driver interface data
2291 * @dst: Destination (peer) MAC address
2292 * @action_code: TDLS action code for the mssage
2293 * @dialog_token: Dialog Token to use in the message (if needed)
2294 * @status_code: Status Code or Reason Code to use (if needed)
2295 * @buf: TDLS IEs to add to the message
2296 * @len: Length of buf in octets
2297 * Returns: 0 on success, negative (<0) on failure
2299 * This optional function can be used to send packet to driver which is
2300 * responsible for receiving and sending all TDLS packets.
2302 int (*send_tdls_mgmt)(void *priv, const u8 *dst, u8 action_code,
2303 u8 dialog_token, u16 status_code,
2304 const u8 *buf, size_t len);
2307 * tdls_oper - Ask the driver to perform high-level TDLS operations
2308 * @priv: Private driver interface data
2309 * @oper: TDLS high-level operation. See %enum tdls_oper
2310 * @peer: Destination (peer) MAC address
2311 * Returns: 0 on success, negative (<0) on failure
2313 * This optional function can be used to send high-level TDLS commands
2316 int (*tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer);
2319 * signal_poll - Get current connection information
2320 * @priv: Private driver interface data
2321 * @signal_info: Connection info structure
2323 int (*signal_poll)(void *priv, struct wpa_signal_info *signal_info);
2326 * set_authmode - Set authentication algorithm(s) for static WEP
2327 * @priv: Private driver interface data
2328 * @authmode: 1=Open System, 2=Shared Key, 3=both
2329 * Returns: 0 on success, -1 on failure
2331 * This function can be used to set authentication algorithms for AP
2332 * mode when static WEP is used. If the driver uses user space MLME/SME
2333 * implementation, there is no need to implement this function.
2335 * DEPRECATED - use set_ap() instead
2337 int (*set_authmode)(void *priv, int authmode);
2340 * set_rekey_info - Set rekey information
2341 * @priv: Private driver interface data
2344 * @replay_ctr: Current EAPOL-Key Replay Counter
2346 * This optional function can be used to provide information for the
2347 * driver/firmware to process EAPOL-Key frames in Group Key Handshake
2348 * while the host (including wpa_supplicant) is sleeping.
2350 void (*set_rekey_info)(void *priv, const u8 *kek, const u8 *kck,
2351 const u8 *replay_ctr);
2354 * sta_assoc - Station association indication
2355 * @priv: Private driver interface data
2356 * @own_addr: Source address and BSSID for association frame
2357 * @addr: MAC address of the station to associate
2358 * @reassoc: flag to indicate re-association
2359 * @status: association response status code
2360 * @ie: assoc response ie buffer
2361 * @len: ie buffer length
2362 * Returns: 0 on success, -1 on failure
2364 * This function indicates the driver to send (Re)Association
2365 * Response frame to the station.
2367 int (*sta_assoc)(void *priv, const u8 *own_addr, const u8 *addr,
2368 int reassoc, u16 status, const u8 *ie, size_t len);
2371 * sta_auth - Station authentication indication
2372 * @priv: Private driver interface data
2373 * @own_addr: Source address and BSSID for authentication frame
2374 * @addr: MAC address of the station to associate
2375 * @seq: authentication sequence number
2376 * @status: authentication response status code
2377 * @ie: authentication frame ie buffer
2378 * @len: ie buffer length
2380 * This function indicates the driver to send Authentication frame
2383 int (*sta_auth)(void *priv, const u8 *own_addr, const u8 *addr,
2384 u16 seq, u16 status, const u8 *ie, size_t len);
2387 * add_tspec - Add traffic stream
2388 * @priv: Private driver interface data
2389 * @addr: MAC address of the station to associate
2390 * @tspec_ie: tspec ie buffer
2391 * @tspec_ielen: tspec ie length
2392 * Returns: 0 on success, -1 on failure
2394 * This function adds the traffic steam for the station
2395 * and fills the medium_time in tspec_ie.
2397 int (*add_tspec)(void *priv, const u8 *addr, u8 *tspec_ie,
2398 size_t tspec_ielen);
2401 * add_sta_node - Add a station node in the driver
2402 * @priv: Private driver interface data
2403 * @addr: MAC address of the station to add
2404 * @auth_alg: authentication algorithm used by the station
2405 * Returns: 0 on success, -1 on failure
2407 * This function adds the station node in the driver, when
2408 * the station gets added by FT-over-DS.
2410 int (*add_sta_node)(void *priv, const u8 *addr, u16 auth_alg);
2413 * sched_scan - Request the driver to initiate scheduled scan
2414 * @priv: Private driver interface data
2415 * @params: Scan parameters
2416 * @interval: Interval between scan cycles in milliseconds
2417 * Returns: 0 on success, -1 on failure
2419 * This operation should be used for scheduled scan offload to
2420 * the hardware. Every time scan results are available, the
2421 * driver should report scan results event for wpa_supplicant
2422 * which will eventually request the results with
2423 * wpa_driver_get_scan_results2(). This operation is optional
2424 * and if not provided or if it returns -1, we fall back to
2425 * normal host-scheduled scans.
2427 int (*sched_scan)(void *priv, struct wpa_driver_scan_params *params,
2431 * stop_sched_scan - Request the driver to stop a scheduled scan
2432 * @priv: Private driver interface data
2433 * Returns: 0 on success, -1 on failure
2435 * This should cause the scheduled scan to be stopped and
2436 * results should stop being sent. Must be supported if
2437 * sched_scan is supported.
2439 int (*stop_sched_scan)(void *priv);
2442 * poll_client - Probe (null data or such) the given station
2443 * @priv: Private driver interface data
2444 * @own_addr: MAC address of sending interface
2445 * @addr: MAC address of the station to probe
2446 * @qos: Indicates whether station is QoS station
2448 * This function is used to verify whether an associated station is
2449 * still present. This function does not need to be implemented if the
2450 * driver provides such inactivity polling mechanism.
2452 void (*poll_client)(void *priv, const u8 *own_addr,
2453 const u8 *addr, int qos);
2458 * enum wpa_event_type - Event type for wpa_supplicant_event() calls
2460 enum wpa_event_type {
2462 * EVENT_ASSOC - Association completed
2464 * This event needs to be delivered when the driver completes IEEE
2465 * 802.11 association or reassociation successfully.
2466 * wpa_driver_ops::get_bssid() is expected to provide the current BSSID
2467 * after this event has been generated. In addition, optional
2468 * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
2469 * more information about the association. If the driver interface gets
2470 * both of these events at the same time, it can also include the
2471 * assoc_info data in EVENT_ASSOC call.
2476 * EVENT_DISASSOC - Association lost
2478 * This event should be called when association is lost either due to
2479 * receiving deauthenticate or disassociate frame from the AP or when
2480 * sending either of these frames to the current AP. If the driver
2481 * supports separate deauthentication event, EVENT_DISASSOC should only
2482 * be used for disassociation and EVENT_DEAUTH for deauthentication.
2483 * In AP mode, union wpa_event_data::disassoc_info is required.
2488 * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
2490 * This event must be delivered when a Michael MIC error is detected by
2491 * the local driver. Additional data for event processing is
2492 * provided with union wpa_event_data::michael_mic_failure. This
2493 * information is used to request new encyption key and to initiate
2494 * TKIP countermeasures if needed.
2496 EVENT_MICHAEL_MIC_FAILURE,
2499 * EVENT_SCAN_RESULTS - Scan results available
2501 * This event must be called whenever scan results are available to be
2502 * fetched with struct wpa_driver_ops::get_scan_results(). This event
2503 * is expected to be used some time after struct wpa_driver_ops::scan()
2504 * is called. If the driver provides an unsolicited event when the scan
2505 * has been completed, this event can be used to trigger
2506 * EVENT_SCAN_RESULTS call. If such event is not available from the
2507 * driver, the driver wrapper code is expected to use a registered
2508 * timeout to generate EVENT_SCAN_RESULTS call after the time that the
2509 * scan is expected to be completed. Optional information about
2510 * completed scan can be provided with union wpa_event_data::scan_info.
2515 * EVENT_ASSOCINFO - Report optional extra information for association
2517 * This event can be used to report extra association information for
2518 * EVENT_ASSOC processing. This extra information includes IEs from
2519 * association frames and Beacon/Probe Response frames in union
2520 * wpa_event_data::assoc_info. EVENT_ASSOCINFO must be send just before
2521 * EVENT_ASSOC. Alternatively, the driver interface can include
2522 * assoc_info data in the EVENT_ASSOC call if it has all the
2523 * information available at the same point.
2528 * EVENT_INTERFACE_STATUS - Report interface status changes
2530 * This optional event can be used to report changes in interface
2531 * status (interface added/removed) using union
2532 * wpa_event_data::interface_status. This can be used to trigger
2533 * wpa_supplicant to stop and re-start processing for the interface,
2534 * e.g., when a cardbus card is ejected/inserted.
2536 EVENT_INTERFACE_STATUS,
2539 * EVENT_PMKID_CANDIDATE - Report a candidate AP for pre-authentication
2541 * This event can be used to inform wpa_supplicant about candidates for
2542 * RSN (WPA2) pre-authentication. If wpa_supplicant is not responsible
2543 * for scan request (ap_scan=2 mode), this event is required for
2544 * pre-authentication. If wpa_supplicant is performing scan request
2545 * (ap_scan=1), this event is optional since scan results can be used
2546 * to add pre-authentication candidates. union
2547 * wpa_event_data::pmkid_candidate is used to report the BSSID of the
2548 * candidate and priority of the candidate, e.g., based on the signal
2549 * strength, in order to try to pre-authenticate first with candidates
2550 * that are most likely targets for re-association.
2552 * EVENT_PMKID_CANDIDATE can be called whenever the driver has updates
2553 * on the candidate list. In addition, it can be called for the current
2554 * AP and APs that have existing PMKSA cache entries. wpa_supplicant
2555 * will automatically skip pre-authentication in cases where a valid
2556 * PMKSA exists. When more than one candidate exists, this event should
2557 * be generated once for each candidate.
2559 * Driver will be notified about successful pre-authentication with
2560 * struct wpa_driver_ops::add_pmkid() calls.
2562 EVENT_PMKID_CANDIDATE,
2565 * EVENT_STKSTART - Request STK handshake (MLME-STKSTART.request)
2567 * This event can be used to inform wpa_supplicant about desire to set
2568 * up secure direct link connection between two stations as defined in
2569 * IEEE 802.11e with a new PeerKey mechanism that replaced the original
2570 * STAKey negotiation. The caller will need to set peer address for the
2576 * EVENT_TDLS - Request TDLS operation
2578 * This event can be used to request a TDLS operation to be performed.
2583 * EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs
2585 * The driver is expected to report the received FT IEs from
2586 * FT authentication sequence from the AP. The FT IEs are included in
2587 * the extra information in union wpa_event_data::ft_ies.
2592 * EVENT_IBSS_RSN_START - Request RSN authentication in IBSS
2594 * The driver can use this event to inform wpa_supplicant about a STA
2595 * in an IBSS with which protected frames could be exchanged. This
2596 * event starts RSN authentication with the other STA to authenticate
2597 * the STA and set up encryption keys with it.
2599 EVENT_IBSS_RSN_START,
2602 * EVENT_AUTH - Authentication result
2604 * This event should be called when authentication attempt has been
2605 * completed. This is only used if the driver supports separate
2606 * authentication step (struct wpa_driver_ops::authenticate).
2607 * Information about authentication result is included in
2608 * union wpa_event_data::auth.
2613 * EVENT_DEAUTH - Authentication lost
2615 * This event should be called when authentication is lost either due
2616 * to receiving deauthenticate frame from the AP or when sending that
2617 * frame to the current AP.
2618 * In AP mode, union wpa_event_data::deauth_info is required.
2623 * EVENT_ASSOC_REJECT - Association rejected
2625 * This event should be called when (re)association attempt has been
2626 * rejected by the AP. Information about the association response is
2627 * included in union wpa_event_data::assoc_reject.
2632 * EVENT_AUTH_TIMED_OUT - Authentication timed out
2634 EVENT_AUTH_TIMED_OUT,
2637 * EVENT_ASSOC_TIMED_OUT - Association timed out
2639 EVENT_ASSOC_TIMED_OUT,
2642 * EVENT_FT_RRB_RX - FT (IEEE 802.11r) RRB frame received
2647 * EVENT_WPS_BUTTON_PUSHED - Report hardware push button press for WPS
2649 EVENT_WPS_BUTTON_PUSHED,
2652 * EVENT_TX_STATUS - Report TX status
2657 * EVENT_RX_FROM_UNKNOWN - Report RX from unknown STA
2659 EVENT_RX_FROM_UNKNOWN,
2662 * EVENT_RX_MGMT - Report RX of a management frame
2667 * EVENT_RX_ACTION - Action frame received
2669 * This event is used to indicate when an Action frame has been
2670 * received. Information about the received frame is included in
2671 * union wpa_event_data::rx_action.
2676 * EVENT_REMAIN_ON_CHANNEL - Remain-on-channel duration started
2678 * This event is used to indicate when the driver has started the
2679 * requested remain-on-channel duration. Information about the
2680 * operation is included in union wpa_event_data::remain_on_channel.
2682 EVENT_REMAIN_ON_CHANNEL,
2685 * EVENT_CANCEL_REMAIN_ON_CHANNEL - Remain-on-channel timed out
2687 * This event is used to indicate when the driver has completed
2688 * remain-on-channel duration, i.e., may noot be available on the
2689 * requested channel anymore. Information about the
2690 * operation is included in union wpa_event_data::remain_on_channel.
2692 EVENT_CANCEL_REMAIN_ON_CHANNEL,
2695 * EVENT_MLME_RX - Report reception of frame for MLME (test use only)
2697 * This event is used only by driver_test.c and userspace MLME.
2702 * EVENT_RX_PROBE_REQ - Indicate received Probe Request frame
2704 * This event is used to indicate when a Probe Request frame has been
2705 * received. Information about the received frame is included in
2706 * union wpa_event_data::rx_probe_req. The driver is required to report
2707 * these events only after successfully completed probe_req_report()
2708 * commands to request the events (i.e., report parameter is non-zero)
2709 * in station mode. In AP mode, Probe Request frames should always be
2715 * EVENT_NEW_STA - New wired device noticed
2717 * This event is used to indicate that a new device has been detected
2718 * in a network that does not use association-like functionality (i.e.,
2719 * mainly wired Ethernet). This can be used to start EAPOL
2720 * authenticator when receiving a frame from a device. The address of
2721 * the device is included in union wpa_event_data::new_sta.
2726 * EVENT_EAPOL_RX - Report received EAPOL frame
2728 * When in AP mode with hostapd, this event is required to be used to
2729 * deliver the receive EAPOL frames from the driver. With
2730 * %wpa_supplicant, this event is used only if the send_eapol() handler
2731 * is used to override the use of l2_packet for EAPOL frame TX.
2736 * EVENT_SIGNAL_CHANGE - Indicate change in signal strength
2738 * This event is used to indicate changes in the signal strength
2739 * observed in frames received from the current AP if signal strength
2740 * monitoring has been enabled with signal_monitor().
2742 EVENT_SIGNAL_CHANGE,
2745 * EVENT_INTERFACE_ENABLED - Notify that interface was enabled
2747 * This event is used to indicate that the interface was enabled after
2748 * having been previously disabled, e.g., due to rfkill.
2750 EVENT_INTERFACE_ENABLED,
2753 * EVENT_INTERFACE_DISABLED - Notify that interface was disabled
2755 * This event is used to indicate that the interface was disabled,
2756 * e.g., due to rfkill.
2758 EVENT_INTERFACE_DISABLED,
2761 * EVENT_CHANNEL_LIST_CHANGED - Channel list changed
2763 * This event is used to indicate that the channel list has changed,
2764 * e.g., because of a regulatory domain change triggered by scan
2765 * results including an AP advertising a country code.
2767 EVENT_CHANNEL_LIST_CHANGED,
2770 * EVENT_INTERFACE_UNAVAILABLE - Notify that interface is unavailable
2772 * This event is used to indicate that the driver cannot maintain this
2773 * interface in its operation mode anymore. The most likely use for
2774 * this is to indicate that AP mode operation is not available due to
2775 * operating channel would need to be changed to a DFS channel when
2776 * the driver does not support radar detection and another virtual
2777 * interfaces caused the operating channel to change. Other similar
2778 * resource conflicts could also trigger this for station mode
2781 EVENT_INTERFACE_UNAVAILABLE,
2784 * EVENT_BEST_CHANNEL
2786 * Driver generates this event whenever it detects a better channel
2787 * (e.g., based on RSSI or channel use). This information can be used
2788 * to improve channel selection for a new AP/P2P group.
2793 * EVENT_UNPROT_DEAUTH - Unprotected Deauthentication frame received
2795 * This event should be called when a Deauthentication frame is dropped
2796 * due to it not being protected (MFP/IEEE 802.11w).
2797 * union wpa_event_data::unprot_deauth is required to provide more
2798 * details of the frame.
2800 EVENT_UNPROT_DEAUTH,
2803 * EVENT_UNPROT_DISASSOC - Unprotected Disassociation frame received
2805 * This event should be called when a Disassociation frame is dropped
2806 * due to it not being protected (MFP/IEEE 802.11w).
2807 * union wpa_event_data::unprot_disassoc is required to provide more
2808 * details of the frame.
2810 EVENT_UNPROT_DISASSOC,
2813 * EVENT_STATION_LOW_ACK
2815 * Driver generates this event whenever it detected that a particular
2816 * station was lost. Detection can be through massive transmission
2817 * failures for example.
2819 EVENT_STATION_LOW_ACK,
2822 * EVENT_P2P_DEV_FOUND - Report a discovered P2P device
2824 * This event is used only if the driver implements P2P management
2825 * internally. Event data is stored in
2826 * union wpa_event_data::p2p_dev_found.
2828 EVENT_P2P_DEV_FOUND,
2831 * EVENT_P2P_GO_NEG_REQ_RX - Report reception of GO Negotiation Request
2833 * This event is used only if the driver implements P2P management
2834 * internally. Event data is stored in
2835 * union wpa_event_data::p2p_go_neg_req_rx.
2837 EVENT_P2P_GO_NEG_REQ_RX,
2840 * EVENT_P2P_GO_NEG_COMPLETED - Report completion of GO Negotiation
2842 * This event is used only if the driver implements P2P management
2843 * internally. Event data is stored in
2844 * union wpa_event_data::p2p_go_neg_completed.
2846 EVENT_P2P_GO_NEG_COMPLETED,
2848 EVENT_P2P_PROV_DISC_REQUEST,
2849 EVENT_P2P_PROV_DISC_RESPONSE,
2850 EVENT_P2P_SD_REQUEST,
2851 EVENT_P2P_SD_RESPONSE,
2854 * EVENT_IBSS_PEER_LOST - IBSS peer not reachable anymore
2856 EVENT_IBSS_PEER_LOST,
2859 * EVENT_DRIVER_GTK_REKEY - Device/driver did GTK rekey
2861 * This event carries the new replay counter to notify wpa_supplicant
2862 * of the current EAPOL-Key Replay Counter in case the driver/firmware
2863 * completed Group Key Handshake while the host (including
2864 * wpa_supplicant was sleeping).
2866 EVENT_DRIVER_GTK_REKEY,
2869 * EVENT_SCHED_SCAN_STOPPED - Scheduled scan was stopped
2871 EVENT_SCHED_SCAN_STOPPED,
2874 * EVENT_DRIVER_CLIENT_POLL_OK - Station responded to poll
2876 * This event indicates that the station responded to the poll
2877 * initiated with @poll_client.
2879 EVENT_DRIVER_CLIENT_POLL_OK,
2882 * EVENT_EAPOL_TX_STATUS - notify of EAPOL TX status
2884 EVENT_EAPOL_TX_STATUS
2889 * union wpa_event_data - Additional data for wpa_supplicant_event() calls
2891 union wpa_event_data {
2893 * struct assoc_info - Data for EVENT_ASSOC and EVENT_ASSOCINFO events
2895 * This structure is optional for EVENT_ASSOC calls and required for
2896 * EVENT_ASSOCINFO calls. By using EVENT_ASSOC with this data, the
2897 * driver interface does not need to generate separate EVENT_ASSOCINFO
2902 * reassoc - Flag to indicate association or reassociation
2907 * req_ies - (Re)Association Request IEs
2909 * If the driver generates WPA/RSN IE, this event data must be
2910 * returned for WPA handshake to have needed information. If
2911 * wpa_supplicant-generated WPA/RSN IE is used, this
2912 * information event is optional.
2914 * This should start with the first IE (fixed fields before IEs
2915 * are not included).
2920 * req_ies_len - Length of req_ies in bytes
2925 * resp_ies - (Re)Association Response IEs
2927 * Optional association data from the driver. This data is not
2928 * required WPA, but may be useful for some protocols and as
2929 * such, should be reported if this is available to the driver
2932 * This should start with the first IE (fixed fields before IEs
2933 * are not included).
2938 * resp_ies_len - Length of resp_ies in bytes
2940 size_t resp_ies_len;
2943 * beacon_ies - Beacon or Probe Response IEs
2945 * Optional Beacon/ProbeResp data: IEs included in Beacon or
2946 * Probe Response frames from the current AP (i.e., the one
2947 * that the client just associated with). This information is
2948 * used to update WPA/RSN IE for the AP. If this field is not
2949 * set, the results from previous scan will be used. If no
2950 * data for the new AP is found, scan results will be requested
2951 * again (without scan request). At this point, the driver is
2952 * expected to provide WPA/RSN IE for the AP (if WPA/WPA2 is
2955 * This should start with the first IE (fixed fields before IEs
2956 * are not included).
2958 const u8 *beacon_ies;
2961 * beacon_ies_len - Length of beacon_ies */
2962 size_t beacon_ies_len;
2965 * freq - Frequency of the operational channel in MHz
2970 * addr - Station address (for AP mode)
2976 * struct disassoc_info - Data for EVENT_DISASSOC events
2978 struct disassoc_info {
2980 * addr - Station address (for AP mode)
2985 * reason_code - Reason Code (host byte order) used in
2986 * Deauthentication frame
2991 * ie - Optional IE(s) in Disassociation frame
2996 * ie_len - Length of ie buffer in octets
3002 * struct deauth_info - Data for EVENT_DEAUTH events
3004 struct deauth_info {
3006 * addr - Station address (for AP mode)
3011 * reason_code - Reason Code (host byte order) used in
3012 * Deauthentication frame
3017 * ie - Optional IE(s) in Deauthentication frame
3022 * ie_len - Length of ie buffer in octets
3028 * struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE
3030 struct michael_mic_failure {
3033 } michael_mic_failure;
3036 * struct interface_status - Data for EVENT_INTERFACE_STATUS
3038 struct interface_status {
3041 EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED
3046 * struct pmkid_candidate - Data for EVENT_PMKID_CANDIDATE
3048 struct pmkid_candidate {
3049 /** BSSID of the PMKID candidate */
3051 /** Smaller the index, higher the priority */
3053 /** Whether RSN IE includes pre-authenticate flag */
3058 * struct stkstart - Data for EVENT_STKSTART
3065 * struct tdls - Data for EVENT_TDLS
3071 TDLS_REQUEST_TEARDOWN
3073 u16 reason_code; /* for teardown */
3077 * struct ft_ies - FT information elements (EVENT_FT_RESPONSE)
3079 * During FT (IEEE 802.11r) authentication sequence, the driver is
3080 * expected to use this event to report received FT IEs (MDIE, FTIE,
3081 * RSN IE, TIE, possible resource request) to the supplicant. The FT
3082 * IEs for the next message will be delivered through the
3083 * struct wpa_driver_ops::update_ft_ies() callback.
3089 u8 target_ap[ETH_ALEN];
3090 /** Optional IE(s), e.g., WMM TSPEC(s), for RIC-Request */
3092 /** Length of ric_ies buffer in octets */
3097 * struct ibss_rsn_start - Data for EVENT_IBSS_RSN_START
3099 struct ibss_rsn_start {
3104 * struct auth_info - Data for EVENT_AUTH events
3110 u16 auth_transaction;
3117 * struct assoc_reject - Data for EVENT_ASSOC_REJECT events
3119 struct assoc_reject {
3121 * bssid - BSSID of the AP that rejected association
3126 * resp_ies - (Re)Association Response IEs
3128 * Optional association data from the driver. This data is not
3129 * required WPA, but may be useful for some protocols and as
3130 * such, should be reported if this is available to the driver
3133 * This should start with the first IE (fixed fields before IEs
3134 * are not included).
3139 * resp_ies_len - Length of resp_ies in bytes
3141 size_t resp_ies_len;
3144 * status_code - Status Code from (Re)association Response
3149 struct timeout_event {
3154 * struct ft_rrb_rx - Data for EVENT_FT_RRB_RX events
3163 * struct tx_status - Data for EVENT_TX_STATUS events
3175 * struct rx_from_unknown - Data for EVENT_RX_FROM_UNKNOWN events
3177 struct rx_from_unknown {
3184 * struct rx_mgmt - Data for EVENT_RX_MGMT events
3194 * struct rx_action - Data for EVENT_RX_ACTION events
3198 * da - Destination address of the received Action frame
3203 * sa - Source address of the received Action frame
3208 * bssid - Address 3 of the received Action frame
3213 * category - Action frame category
3218 * data - Action frame body after category field
3223 * len - Length of data in octets
3228 * freq - Frequency (in MHz) on which the frame was received
3234 * struct remain_on_channel - Data for EVENT_REMAIN_ON_CHANNEL events
3236 * This is also used with EVENT_CANCEL_REMAIN_ON_CHANNEL events.
3238 struct remain_on_channel {
3240 * freq - Channel frequency in MHz
3245 * duration - Duration to remain on the channel in milliseconds
3247 unsigned int duration;
3248 } remain_on_channel;
3251 * struct scan_info - Optional data for EVENT_SCAN_RESULTS events
3252 * @aborted: Whether the scan was aborted
3253 * @freqs: Scanned frequencies in MHz (%NULL = all channels scanned)
3254 * @num_freqs: Number of entries in freqs array
3255 * @ssids: Scanned SSIDs (%NULL or zero-length SSID indicates wildcard
3257 * @num_ssids: Number of entries in ssids array
3263 struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
3268 * struct mlme_rx - Data for EVENT_MLME_RX events
3279 * struct rx_probe_req - Data for EVENT_RX_PROBE_REQ events
3281 struct rx_probe_req {
3283 * sa - Source address of the received Probe Request frame
3288 * da - Destination address of the received Probe Request frame
3289 * or %NULL if not available
3294 * bssid - BSSID of the received Probe Request frame or %NULL
3300 * ie - IEs from the Probe Request body
3305 * ie_len - Length of ie buffer in octets
3311 * struct new_sta - Data for EVENT_NEW_STA events
3318 * struct eapol_rx - Data for EVENT_EAPOL_RX events
3327 * signal_change - Data for EVENT_SIGNAL_CHANGE events
3329 struct wpa_signal_info signal_change;
3332 * struct best_channel - Data for EVENT_BEST_CHANNEL events
3333 * @freq_24: Best 2.4 GHz band channel frequency in MHz
3334 * @freq_5: Best 5 GHz band channel frequency in MHz
3335 * @freq_overall: Best channel frequency in MHz
3337 * 0 can be used to indicate no preference in either band.
3339 struct best_channel {
3345 struct unprot_deauth {
3351 struct unprot_disassoc {
3358 * struct low_ack - Data for EVENT_STATION_LOW_ACK events
3359 * @addr: station address
3366 * struct p2p_dev_found - Data for EVENT_P2P_DEV_FOUND
3368 struct p2p_dev_found {
3371 const u8 *pri_dev_type;
3372 const char *dev_name;
3379 * struct p2p_go_neg_req_rx - Data for EVENT_P2P_GO_NEG_REQ_RX
3381 struct p2p_go_neg_req_rx {
3384 } p2p_go_neg_req_rx;
3387 * struct p2p_go_neg_completed - Data for EVENT_P2P_GO_NEG_COMPLETED
3389 struct p2p_go_neg_completed {
3390 struct p2p_go_neg_results *res;
3391 } p2p_go_neg_completed;
3393 struct p2p_prov_disc_req {
3397 const u8 *pri_dev_type;
3398 const char *dev_name;
3399 u16 supp_config_methods;
3402 } p2p_prov_disc_req;
3404 struct p2p_prov_disc_resp {
3407 } p2p_prov_disc_resp;
3418 struct p2p_sd_resp {
3426 * struct ibss_peer_lost - Data for EVENT_IBSS_PEER_LOST
3428 struct ibss_peer_lost {
3433 * struct driver_gtk_rekey - Data for EVENT_DRIVER_GTK_REKEY
3435 struct driver_gtk_rekey {
3437 const u8 *replay_ctr;
3441 * struct client_poll - Data for EVENT_DRIVER_CLIENT_POLL_OK events
3442 * @addr: station address
3444 struct client_poll {
3449 * struct eapol_tx_status
3450 * @dst: Original destination
3451 * @data: Data starting with IEEE 802.1X header (!)
3452 * @data_len: Length of data
3453 * @ack: Indicates ack or lost frame
3455 * This corresponds to hapd_send_eapol if the frame sent
3456 * there isn't just reported as EVENT_TX_STATUS.
3458 struct eapol_tx_status {
3467 * wpa_supplicant_event - Report a driver event for wpa_supplicant
3468 * @ctx: Context pointer (wpa_s); this is the ctx variable registered
3469 * with struct wpa_driver_ops::init()
3470 * @event: event type (defined above)
3471 * @data: possible extra data for the event
3473 * Driver wrapper code should call this function whenever an event is received
3476 void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
3477 union wpa_event_data *data);
3481 * The following inline functions are provided for convenience to simplify
3482 * event indication for some of the common events.
3485 static inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie,
3486 size_t ielen, int reassoc)
3488 union wpa_event_data event;
3489 os_memset(&event, 0, sizeof(event));
3490 event.assoc_info.reassoc = reassoc;
3491 event.assoc_info.req_ies = ie;
3492 event.assoc_info.req_ies_len = ielen;
3493 event.assoc_info.addr = addr;
3494 wpa_supplicant_event(ctx, EVENT_ASSOC, &event);
3497 static inline void drv_event_disassoc(void *ctx, const u8 *addr)
3499 union wpa_event_data event;
3500 os_memset(&event, 0, sizeof(event));
3501 event.disassoc_info.addr = addr;
3502 wpa_supplicant_event(ctx, EVENT_DISASSOC, &event);
3505 static inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data,
3508 union wpa_event_data event;
3509 os_memset(&event, 0, sizeof(event));
3510 event.eapol_rx.src = src;
3511 event.eapol_rx.data = data;
3512 event.eapol_rx.data_len = data_len;
3513 wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);
3516 /* driver_common.c */
3517 void wpa_scan_results_free(struct wpa_scan_results *res);
3519 /* Convert wpa_event_type to a string for logging */
3520 const char * event_to_string(enum wpa_event_type event);
3522 #endif /* DRIVER_H */