WPS 2.0: Provide (Re)Association Response WPS IE to driver
[libeap.git] / src / drivers / driver.h
index 9ac06e6..96dec77 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * WPA Supplicant - driver interface definition
- * Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
+ * Driver interface definition
+ * Copyright (c) 2003-2010, Jouni Malinen <j@w1.fi>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * license.
  *
  * See README and COPYING for more details.
+ *
+ * This file defines a driver interface used by both %wpa_supplicant and
+ * hostapd. The first part of the file defines data structures used in various
+ * driver operations. This is followed by the struct wpa_driver_ops that each
+ * driver wrapper will beed to define with callback functions for requesting
+ * driver operations. After this, there are definitions for driver event
+ * reporting with wpa_supplicant_event() and some convenience helper functions
+ * that can be used to report events.
  */
 
 #ifndef DRIVER_H
 
 #define WPA_SUPPLICANT_DRIVER_VERSION 4
 
-#include "defs.h"
+#include "common/defs.h"
 
 #define HOSTAPD_CHAN_DISABLED 0x00000001
 #define HOSTAPD_CHAN_PASSIVE_SCAN 0x00000002
 #define HOSTAPD_CHAN_NO_IBSS 0x00000004
 #define HOSTAPD_CHAN_RADAR 0x00000008
 
+/**
+ * struct hostapd_channel_data - Channel information
+ */
 struct hostapd_channel_data {
-       short chan; /* channel number (IEEE 802.11) */
-       short freq; /* frequency in MHz */
-       int flag; /* flag for hostapd use (HOSTAPD_CHAN_*) */
-       u8 max_tx_power; /* maximum transmit power in dBm */
-};
+       /**
+        * chan - Channel number (IEEE 802.11)
+        */
+       short chan;
+
+       /**
+        * freq - Frequency in MHz
+        */
+       short freq;
+
+       /**
+        * flag - Channel flags (HOSTAPD_CHAN_*)
+        */
+       int flag;
 
-#define HOSTAPD_RATE_ERP 0x00000001
-#define HOSTAPD_RATE_BASIC 0x00000002
-#define HOSTAPD_RATE_PREAMBLE2 0x00000004
-#define HOSTAPD_RATE_SUPPORTED 0x00000010
-#define HOSTAPD_RATE_OFDM 0x00000020
-#define HOSTAPD_RATE_CCK 0x00000040
-#define HOSTAPD_RATE_MANDATORY 0x00000100
-
-struct hostapd_rate_data {
-       int rate; /* rate in 100 kbps */
-       int flags; /* HOSTAPD_RATE_ flags */
+       /**
+        * max_tx_power - maximum transmit power in dBm
+        */
+       u8 max_tx_power;
 };
 
+/**
+ * struct hostapd_hw_modes - Supported hardware mode information
+ */
 struct hostapd_hw_modes {
-       hostapd_hw_mode mode;
+       /**
+        * mode - Hardware mode
+        */
+       enum hostapd_hw_mode mode;
+
+       /**
+        * num_channels - Number of entries in the channels array
+        */
        int num_channels;
+
+       /**
+        * channels - Array of supported channels
+        */
        struct hostapd_channel_data *channels;
+
+       /**
+        * num_rates - Number of entries in the rates array
+        */
        int num_rates;
-       struct hostapd_rate_data *rates;
+
+       /**
+        * rates - Array of supported rates in 100 kbps units
+        */
+       int *rates;
+
+       /**
+        * ht_capab - HT (IEEE 802.11n) capabilities
+        */
        u16 ht_capab;
+
+       /**
+        * mcs_set - MCS (IEEE 802.11n) rate parameters
+        */
        u8 mcs_set[16];
-};
 
+       /**
+        * a_mpdu_params - A-MPDU (IEEE 802.11n) parameters
+        */
+       u8 a_mpdu_params;
+};
 
-#define AUTH_ALG_OPEN_SYSTEM   0x01
-#define AUTH_ALG_SHARED_KEY    0x02
-#define AUTH_ALG_LEAP          0x04
-#define AUTH_ALG_FT            0x08
 
 #define IEEE80211_MODE_INFRA   0
 #define IEEE80211_MODE_IBSS    1
@@ -68,61 +111,12 @@ struct hostapd_hw_modes {
 #define IEEE80211_CAP_IBSS     0x0002
 #define IEEE80211_CAP_PRIVACY  0x0010
 
-#define SSID_MAX_WPA_IE_LEN 40
-/**
- * struct wpa_scan_result - Scan results (old structure)
- * @bssid: BSSID
- * @ssid: SSID
- * @ssid_len: length of the ssid
- * @wpa_ie: WPA IE
- * @wpa_ie_len: length of the wpa_ie
- * @rsn_ie: RSN IE
- * @rsn_ie_len: length of the RSN IE
- * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
- * @caps: capability information field in host byte order
- * @qual: signal quality
- * @noise: noise level
- * @level: signal level
- * @maxrate: maximum supported rate
- * @mdie_present: Whether MDIE was included in Beacon/ProbeRsp frame
- * @mdie: Mobility domain identifier IE (IEEE 802.11r MDIE) (starting from
- * IE type field)
- * @tsf: Timestamp
- *
- * This structure is used as a generic format for scan results from the
- * driver. Each driver interface implementation is responsible for converting
- * the driver or OS specific scan results into this format.
- *
- * This structure is the old data structure used for scan results. It is
- * obsoleted by the new struct wpa_scan_res structure and the old version is
- * only included for backwards compatibility with existing driver wrapper
- * implementations. New implementations are encouraged to implement for struct
- * wpa_scan_res. The old structure will be removed at some point.
- */
-struct wpa_scan_result {
-       u8 bssid[ETH_ALEN];
-       u8 ssid[32];
-       size_t ssid_len;
-       u8 wpa_ie[SSID_MAX_WPA_IE_LEN];
-       size_t wpa_ie_len;
-       u8 rsn_ie[SSID_MAX_WPA_IE_LEN];
-       size_t rsn_ie_len;
-       int freq;
-       u16 caps;
-       int qual;
-       int noise;
-       int level;
-       int maxrate;
-       int mdie_present;
-       u8 mdie[5];
-       u64 tsf;
-};
-
-
 #define WPA_SCAN_QUAL_INVALID          BIT(0)
 #define WPA_SCAN_NOISE_INVALID         BIT(1)
 #define WPA_SCAN_LEVEL_INVALID         BIT(2)
 #define WPA_SCAN_LEVEL_DBM             BIT(3)
+#define WPA_SCAN_AUTHENTICATED         BIT(4)
+#define WPA_SCAN_ASSOCIATED            BIT(5)
 
 /**
  * struct wpa_scan_res - Scan result for an BSS/IBSS
@@ -138,6 +132,7 @@ struct wpa_scan_result {
  * @age: Age of the information in milliseconds (i.e., how many milliseconds
  * ago the last Beacon or Probe Response frame was received)
  * @ie_len: length of the following IE field in octets
+ * @beacon_ie_len: length of the following Beacon IE field in octets
  *
  * This structure is used as a generic format for scan results from the
  * driver. Each driver interface implementation is responsible for converting
@@ -160,7 +155,14 @@ struct wpa_scan_res {
        u64 tsf;
        unsigned int age;
        size_t ie_len;
-       /* followed by ie_len octets of IEs */
+       size_t beacon_ie_len;
+       /*
+        * Followed by ie_len octets of IEs from Probe Response frame (or if
+        * the driver does not indicate source of IEs, these may also be from
+        * Beacon frame). After the first set of IEs, another set of IEs may
+        * follow (with beacon_ie_len octets of data) if the driver provides
+        * both IE sets.
+        */
 };
 
 /**
@@ -179,7 +181,7 @@ struct wpa_scan_results {
  * @ifname: Interface name that can be used with init() or init2()
  * @desc: Human readable adapter description (e.g., vendor/model) or NULL if
  *     not available
- * @drv_bame: struct wpa_driver_ops::name (note: unlike other strings, this one
+ * @drv_name: struct wpa_driver_ops::name (note: unlike other strings, this one
  *     is not an allocated copy, i.e., get_interfaces() caller will not free
  *     this)
  */
@@ -235,6 +237,30 @@ struct wpa_driver_scan_params {
         * The frequency is set in MHz. The array is zero-terminated.
         */
        int *freqs;
+
+       /**
+        * filter_ssids - Filter for reporting SSIDs
+        *
+        * This optional parameter can be used to request the driver wrapper to
+        * filter scan results to include only the specified SSIDs. %NULL
+        * indicates that no filtering is to be done. This can be used to
+        * reduce memory needs for scan results in environments that have large
+        * number of APs with different SSIDs.
+        *
+        * The driver wrapper is allowed to take this allocated buffer into its
+        * own use by setting the pointer to %NULL. In that case, the driver
+        * wrapper is responsible for freeing the buffer with os_free() once it
+        * is not needed anymore.
+        */
+       struct wpa_driver_scan_filter {
+               u8 ssid[32];
+               size_t ssid_len;
+       } *filter_ssids;
+
+       /**
+        * num_filter_ssids - Number of entries in filter_ssids array
+        */
+       size_t num_filter_ssids;
 };
 
 /**
@@ -252,6 +278,14 @@ struct wpa_driver_auth_params {
        const u8 *wep_key[4];
        size_t wep_key_len[4];
        int wep_tx_keyidx;
+       int local_state_change;
+};
+
+enum wps_mode {
+       WPS_MODE_NONE /* no WPS provisioning being used */,
+       WPS_MODE_OPEN /* WPS provisioning with AP that is in open mode */,
+       WPS_MODE_PRIVACY /* WPS provisioning with AP that is using protection
+                         */
 };
 
 /**
@@ -269,6 +303,10 @@ struct wpa_driver_associate_params {
         * ssid - The selected SSID
         */
        const u8 *ssid;
+
+       /**
+        * ssid_len - Length of the SSID (1..32)
+        */
        size_t ssid_len;
 
        /**
@@ -297,20 +335,36 @@ struct wpa_driver_associate_params {
         * When using WPS, wpa_ie is used for WPS IE instead of WPA/RSN IE.
         */
        const u8 *wpa_ie;
+
        /**
         * wpa_ie_len - length of the wpa_ie
         */
        size_t wpa_ie_len;
 
-       /* The selected pairwise/group cipher and key management
-        * suites. These are usually ignored if @wpa_ie is used. */
-       wpa_cipher pairwise_suite;
-       wpa_cipher group_suite;
-       wpa_key_mgmt key_mgmt_suite;
+       /**
+        * pairwise_suite - Selected pairwise cipher suite
+        *
+        * This is usually ignored if @wpa_ie is used.
+        */
+       enum wpa_cipher pairwise_suite;
+
+       /**
+        * group_suite - Selected group cipher suite
+        *
+        * This is usually ignored if @wpa_ie is used.
+        */
+       enum wpa_cipher group_suite;
+
+       /**
+        * key_mgmt_suite - Selected key management suite
+        *
+        * This is usually ignored if @wpa_ie is used.
+        */
+       enum wpa_key_mgmt key_mgmt_suite;
 
        /**
         * auth_alg - Allowed authentication algorithms
-        * Bit field of AUTH_ALG_*
+        * Bit field of WPA_AUTH_ALG_*
         */
        int auth_alg;
 
@@ -337,11 +391,7 @@ struct wpa_driver_associate_params {
        /**
         * mgmt_frame_protection - IEEE 802.11w management frame protection
         */
-       enum {
-               NO_MGMT_FRAME_PROTECTION,
-               MGMT_FRAME_PROTECTION_OPTIONAL,
-               MGMT_FRAME_PROTECTION_REQUIRED
-       } mgmt_frame_protection;
+       enum mfp_options mgmt_frame_protection;
 
        /**
         * ft_ies - IEEE 802.11r / FT information elements
@@ -417,6 +467,28 @@ struct wpa_driver_associate_params {
         * association.
         */
        const u8 *prev_bssid;
+
+       /**
+        * wps - WPS mode
+        *
+        * If the driver needs to do special configuration for WPS association,
+        * this variable provides more information on what type of association
+        * is being requested. Most drivers should not need ot use this.
+        */
+       enum wps_mode wps;
+
+       /**
+        * p2p - Whether this connection is a P2P group
+        */
+       int p2p;
+
+       /**
+        * uapsd - UAPSD parameters for the network
+        * -1 = do not change defaults
+        * AP mode: 1 = enabled, 0 = disabled
+        * STA mode: bits 0..3 UAPSD enabled for VO,VI,BK,BE
+        */
+       int uapsd;
 };
 
 /**
@@ -459,15 +531,31 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS_AP            0x00000040
 /* Driver needs static WEP key setup after association has been completed */
 #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE     0x00000080
+/* Driver takes care of P2P management operations */
+#define WPA_DRIVER_FLAGS_P2P_MGMT      0x00000100
+/* Driver supports concurrent P2P operations */
+#define WPA_DRIVER_FLAGS_P2P_CONCURRENT        0x00000200
+/*
+ * Driver uses the initial interface as a dedicated management interface, i.e.,
+ * it cannot be used for P2P group operations.
+ */
+#define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE       0x00000400
+/* This interface is P2P capable (P2P Device, GO, or P2P Client */
+#define WPA_DRIVER_FLAGS_P2P_CAPABLE   0x00000800
        unsigned int flags;
 
        int max_scan_ssids;
-};
 
+       /**
+        * max_remain_on_chan - Maximum remain-on-channel duration in msec
+        */
+       unsigned int max_remain_on_chan;
 
-struct ieee80211_rx_status {
-        int channel;
-        int ssi;
+       /**
+        * max_stations - Maximum number of associated stations the driver
+        * supports in AP mode
+        */
+       unsigned int max_stations;
 };
 
 
@@ -491,9 +579,8 @@ struct hostapd_sta_add_params {
        u16 capability;
        const u8 *supp_rates;
        size_t supp_rates_len;
-       int flags;
        u16 listen_interval;
-       const struct ht_cap_ie *ht_capabilities;
+       const struct ieee80211_ht_capabilities *ht_capabilities;
 };
 
 struct hostapd_freq_params {
@@ -506,8 +593,42 @@ struct hostapd_freq_params {
                                 * enabled, secondary channel above primary */
 };
 
-enum hostapd_driver_if_type {
-       HOSTAPD_IF_VLAN
+enum wpa_driver_if_type {
+       /**
+        * WPA_IF_STATION - Station mode interface
+        */
+       WPA_IF_STATION,
+
+       /**
+        * WPA_IF_AP_VLAN - AP mode VLAN interface
+        *
+        * This interface shares its address and Beacon frame with the main
+        * BSS.
+        */
+       WPA_IF_AP_VLAN,
+
+       /**
+        * WPA_IF_AP_BSS - AP mode BSS interface
+        *
+        * This interface has its own address and Beacon frame.
+        */
+       WPA_IF_AP_BSS,
+
+       /**
+        * WPA_IF_P2P_GO - P2P Group Owner
+        */
+       WPA_IF_P2P_GO,
+
+       /**
+        * WPA_IF_P2P_CLIENT - P2P Client
+        */
+       WPA_IF_P2P_CLIENT,
+
+       /**
+        * WPA_IF_P2P_GROUP - P2P Group interface (will become either
+        * WPA_IF_P2P_GO or WPA_IF_P2P_CLIENT, but the role is not yet known)
+        */
+       WPA_IF_P2P_GROUP
 };
 
 struct wpa_init_params {
@@ -524,6 +645,25 @@ struct wpa_init_params {
 };
 
 
+struct wpa_bss_params {
+       /** Interface name (for multi-SSID/VLAN support) */
+       const char *ifname;
+       /** Whether IEEE 802.1X or WPA/WPA2 is enabled */
+       int enabled;
+
+       int wpa;
+       int ieee802_1x;
+       int wpa_group;
+       int wpa_pairwise;
+       int wpa_key_mgmt;
+       int rsn_preauth;
+};
+
+#define WPA_STA_AUTHORIZED BIT(0)
+#define WPA_STA_WMM BIT(1)
+#define WPA_STA_SHORT_PREAMBLE BIT(2)
+#define WPA_STA_MFP BIT(3)
+
 /**
  * struct wpa_driver_ops - Driver interface API definition
  *
@@ -611,7 +751,7 @@ struct wpa_driver_ops {
         * in driver_*.c set_key() implementation, see driver_ndis.c for an
         * example on how this can be done.
         */
-       int (*set_key)(const char *ifname, void *priv, wpa_alg alg,
+       int (*set_key)(const char *ifname, void *priv, enum wpa_alg alg,
                       const u8 *addr, int key_idx, int set_tx,
                       const u8 *seq, size_t seq_len,
                       const u8 *key, size_t key_len);
@@ -675,45 +815,6 @@ struct wpa_driver_ops {
        int (*set_countermeasures)(void *priv, int enabled);
 
        /**
-        * scan - Request the driver to initiate scan (old version)
-        * @priv: private driver interface data
-        * @ssid: specific SSID to scan for (ProbeReq) or %NULL to scan for
-        *      all SSIDs (either active scan with wildcard SSID or passive
-        *      scan)
-        * @ssid_len: length of the SSID
-        *
-        * Returns: 0 on success, -1 on failure
-        *
-        * Once the scan results are ready, the driver should report scan
-        * results event for wpa_supplicant which will eventually request the
-        * results with wpa_driver_get_scan_results().
-        *
-        * This function is deprecated. New driver wrapper implementations
-        * should implement support for scan2().
-        */
-       int (*scan)(void *priv, const u8 *ssid, size_t ssid_len);
-
-       /**
-        * get_scan_results - Fetch the latest scan results (old version)
-        * @priv: private driver interface data
-        * @results: pointer to buffer for scan results
-        * @max_size: maximum number of entries (buffer size)
-        *
-        * Returns: Number of scan result entries used on success, -1 on
-        * failure
-        *
-        * If scan results include more than max_size BSSes, max_size will be
-        * returned and the remaining entries will not be included in the
-        * buffer.
-        *
-        * This function is deprecated. New driver wrapper implementations
-        * should implement support for get_scan_results2().
-        */
-       int (*get_scan_results)(void *priv,
-                               struct wpa_scan_result *results,
-                               size_t max_size);
-
-       /**
         * deauthenticate - Request driver to deauthenticate
         * @priv: private driver interface data
         * @addr: peer address (BSSID of the AP)
@@ -865,9 +966,9 @@ struct wpa_driver_ops {
         * with driver specific functionality. If this function pointer is set,
         * l2_packet module is not used at all and the driver interface code is
         * responsible for receiving and sending all EAPOL packets. The
-        * received EAPOL packets are sent to core code by calling
-        * wpa_supplicant_rx_eapol(). The driver interface is required to
-        * implement get_mac_addr() handler if send_eapol() is used.
+        * received EAPOL packets are sent to core code with EVENT_EAPOL_RX
+        * event. The driver interface is required to implement get_mac_addr()
+        * handler if send_eapol() is used.
         */
        int (*send_eapol)(void *priv, const u8 *dest, u16 proto,
                          const u8 *data, size_t data_len);
@@ -914,7 +1015,7 @@ struct wpa_driver_ops {
         * failure. Caller is responsible for freeing this.
         *
         * This function is only needed for drivers that export MLME
-        * (management frame processing) to wpa_supplicant.
+        * (management frame processing) to %wpa_supplicant or hostapd.
         */
        struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
                                                         u16 *num_modes,
@@ -931,7 +1032,7 @@ struct wpa_driver_ops {
         * This function is only needed for drivers that export MLME
         * (management frame processing) to wpa_supplicant.
         */
-       int (*set_channel)(void *priv, hostapd_hw_mode phymode, int chan,
+       int (*set_channel)(void *priv, enum hostapd_hw_mode phymode, int chan,
                           int freq);
 
        /**
@@ -1042,15 +1143,6 @@ struct wpa_driver_ops {
         struct wpa_scan_results * (*get_scan_results2)(void *priv);
 
        /**
-        * set_probe_req_ie - Set information element(s) for Probe Request
-        * @priv: private driver interface data
-        * @ies: Information elements to append or %NULL to remove extra IEs
-        * @ies_len: Length of the IE buffer in octets
-        * Returns: 0 on success, -1 on failure
-        */
-       int (*set_probe_req_ie)(void *priv, const u8 *ies, size_t ies_len);
-
-       /**
         * set_country - Set country
         * @priv: Private driver interface data
         * @alpha2: country to which to switch to
@@ -1133,125 +1225,462 @@ struct wpa_driver_ops {
        int (*authenticate)(void *priv,
                            struct wpa_driver_auth_params *params);
 
-       int (*set_beacon)(const char *ifname, void *priv,
-                         const u8 *head, size_t head_len,
+       /**
+        * set_beacon - Set Beacon frame template
+        * @priv: Private driver interface data
+        * @head: Beacon head from IEEE 802.11 header to IEs before TIM IE
+        * @head_len: Length of the head buffer in octets
+        * @tail: Beacon tail following TIM IE
+        * @tail_len: Length of the tail buffer in octets
+        * @dtim_period: DTIM period
+        * @beacon_int: Beacon interval
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function is used to configure Beacon template for the driver in
+        * AP mode. The driver is responsible for building the full Beacon
+        * frame by concatenating the head part with TIM IE generated by the
+        * driver/firmware and finishing with the tail part.
+        */
+       int (*set_beacon)(void *priv, const u8 *head, size_t head_len,
                          const u8 *tail, size_t tail_len, int dtim_period,
                          int beacon_int);
 
+       /**
+        * hapd_init - Initialize driver interface (hostapd only)
+        * @hapd: Pointer to hostapd context
+        * @params: Configuration for the driver wrapper
+        * Returns: Pointer to private data, %NULL on failure
+        *
+        * This function is used instead of init() or init2() when the driver
+        * wrapper is used withh hostapd.
+        */
        void * (*hapd_init)(struct hostapd_data *hapd,
                            struct wpa_init_params *params);
+
+       /**
+        * hapd_deinit - Deinitialize driver interface (hostapd only)
+        * @priv: Private driver interface data from hapd_init()
+        */
        void (*hapd_deinit)(void *priv);
 
        /**
-        * set_8021x - enable/disable IEEE 802.1X support
-        * @ifname: Interface name (for multi-SSID/VLAN support)
-        * @priv: driver private data
-        * @enabled: 1 = enable, 0 = disable
-        *
+        * set_ieee8021x - Enable/disable IEEE 802.1X support (AP only)
+        * @priv: Private driver interface data
+        * @params: BSS parameters
         * Returns: 0 on success, -1 on failure
         *
-        * Configure the kernel driver to enable/disable 802.1X support.
-        * This may be an empty function if 802.1X support is always enabled.
+        * This is an optional function to configure the kernel driver to
+        * enable/disable IEEE 802.1X support and set WPA/WPA2 parameters. This
+        * can be left undefined (set to %NULL) if IEEE 802.1X support is
+        * always enabled and the driver uses set_beacon() to set WPA/RSN IE
+        * for Beacon frames.
         */
-       int (*set_ieee8021x)(const char *ifname, void *priv, int enabled);
+       int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
 
        /**
-        * set_privacy - enable/disable privacy
-        * @priv: driver private data
+        * set_privacy - Enable/disable privacy (AP only)
+        * @priv: Private driver interface data
         * @enabled: 1 = privacy enabled, 0 = disabled
+        * Returns: 0 on success, -1 on failure
         *
-        * Return: 0 on success, -1 on failure
-        *
-        * Configure privacy.
+        * This is an optional function to configure privacy field in the
+        * kernel driver for Beacon frames. This can be left undefined (set to
+        * %NULL) if the driver uses the Beacon template from set_beacon().
         */
-       int (*set_privacy)(const char *ifname, void *priv, int enabled);
+       int (*set_privacy)(void *priv, int enabled);
 
+       /**
+        * get_seqnum - Fetch the current TSC/packet number (AP only)
+        * @ifname: The interface name (main or virtual)
+        * @priv: Private driver interface data
+        * @addr: MAC address of the station or %NULL for group keys
+        * @idx: Key index
+        * @seq: Buffer for returning the latest used TSC/packet number
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function is used to fetch the last used TSC/packet number for
+        * a TKIP, CCMP, or BIP/IGTK key. It is mainly used with group keys, so
+        * there is no strict requirement on implementing support for unicast
+        * keys (i.e., addr != %NULL).
+        */
        int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
                          int idx, u8 *seq);
-       int (*get_seqnum_igtk)(const char *ifname, void *priv, const u8 *addr,
-                              int idx, u8 *seq);
+
+       /**
+        * flush - Flush all association stations (AP only)
+        * @priv: Private driver interface data
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function requests the driver to disassociate all associated
+        * stations. This function does not need to be implemented if the
+        * driver does not process association frames internally.
+        */
        int (*flush)(void *priv);
-       int (*set_generic_elem)(const char *ifname, void *priv, const u8 *elem,
-                               size_t elem_len);
 
+       /**
+        * set_generic_elem - Add IEs into Beacon/Probe Response frames (AP)
+        * @priv: Private driver interface data
+        * @elem: Information elements
+        * @elem_len: Length of the elem buffer in octets
+        * Returns: 0 on success, -1 on failure
+        *
+        * This is an optional function to add information elements in the
+        * kernel driver for Beacon and Probe Response frames. This can be left
+        * undefined (set to %NULL) if the driver uses the Beacon template from
+        * set_beacon().
+        */
+       int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len);
+
+       /**
+        * read_sta_data - Fetch station data (AP only)
+        * @priv: Private driver interface data
+        * @data: Buffer for returning station information
+        * @addr: MAC address of the station
+        * Returns: 0 on success, -1 on failure
+        */
        int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
                             const u8 *addr);
+
+       /**
+        * hapd_send_eapol - Send an EAPOL packet (AP only)
+        * @priv: private driver interface data
+        * @addr: Destination MAC address
+        * @data: EAPOL packet starting with IEEE 802.1X header
+        * @data_len: Length of the EAPOL packet in octets
+        * @encrypt: Whether the frame should be encrypted
+        * @own_addr: Source MAC address
+        *
+        * Returns: 0 on success, -1 on failure
+        */
        int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
                               size_t data_len, int encrypt,
                               const u8 *own_addr);
+
+       /**
+        * sta_deauth - Deauthenticate a station (AP only)
+        * @priv: Private driver interface data
+        * @own_addr: Source address and BSSID for the Deauthentication frame
+        * @addr: MAC address of the station to deauthenticate
+        * @reason: Reason code for the Deauthentiation frame
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function requests a specific station to be deauthenticated and
+        * a Deauthentication frame to be sent to it.
+        */
        int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
                          int reason);
+
+       /**
+        * sta_disassoc - Disassociate a station (AP only)
+        * @priv: Private driver interface data
+        * @own_addr: Source address and BSSID for the Disassociation frame
+        * @addr: MAC address of the station to disassociate
+        * @reason: Reason code for the Disassociation frame
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function requests a specific station to be disassociated and
+        * a Disassociation frame to be sent to it.
+        */
        int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
                            int reason);
-       int (*sta_remove)(void *priv, const u8 *addr);
-       int (*hapd_get_ssid)(const char *ifname, void *priv, u8 *buf, int len);
-       int (*hapd_set_ssid)(const char *ifname, void *priv, const u8 *buf,
-                            int len);
-       int (*hapd_set_countermeasures)(void *priv, int enabled);
-       int (*sta_add)(const char *ifname, void *priv,
-                      struct hostapd_sta_add_params *params);
-       int (*get_inact_sec)(void *priv, const u8 *addr);
-       int (*sta_clear_stats)(void *priv, const u8 *addr);
-
-       int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
-       int (*set_rts)(void *priv, int rts);
-       int (*set_frag)(void *priv, int frag);
 
-       int (*sta_set_flags)(void *priv, const u8 *addr,
-                            int total_flags, int flags_or, int flags_and);
-       int (*set_rate_sets)(void *priv, int *supp_rates, int *basic_rates,
-                            int mode);
+       /**
+        * sta_remove - Remove a station entry (AP only)
+        * @priv: Private driver interface data
+        * @addr: MAC address of the station to be removed
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*sta_remove)(void *priv, const u8 *addr);
 
-       /* Configure internal bridge:
-        * 0 = disabled, i.e., client separation is enabled (no bridging of
-        *     packets between associated STAs
-        * 1 = enabled, i.e., bridge packets between associated STAs (default)
+       /**
+        * hapd_get_ssid - Get the current SSID (AP only)
+        * @priv: Private driver interface data
+        * @buf: Buffer for returning the SSID
+        * @len: Maximum length of the buffer
+        * Returns: Length of the SSID on success, -1 on failure
+        *
+        * This function need not be implemented if the driver uses Beacon
+        * template from set_beacon() and does not reply to Probe Request
+        * frames.
         */
-       int (*set_internal_bridge)(void *priv, int value);
-       int (*set_cts_protect)(void *priv, int value);
-       int (*set_preamble)(void *priv, int value);
-       int (*set_short_slot_time)(void *priv, int value);
-       int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
-                                  int cw_max, int burst_time);
-       int (*bss_add)(void *priv, const char *ifname, const u8 *bssid);
-       int (*bss_remove)(void *priv, const char *ifname);
-       int (*valid_bss_mask)(void *priv, const u8 *addr, const u8 *mask);
-       int (*if_add)(const char *iface, void *priv,
-                     enum hostapd_driver_if_type type, char *ifname,
-                     const u8 *addr);
-       int (*if_update)(void *priv, enum hostapd_driver_if_type type,
-                        char *ifname, const u8 *addr);
-       int (*if_remove)(void *priv, enum hostapd_driver_if_type type,
-                        const char *ifname, const u8 *addr);
-       int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
-                           int vlan_id);
+       int (*hapd_get_ssid)(void *priv, u8 *buf, int len);
+
        /**
-        * commit - Optional commit changes handler
-        * @priv: driver private data
+        * hapd_set_ssid - Set SSID (AP only)
+        * @priv: Private driver interface data
+        * @buf: SSID
+        * @len: Length of the SSID in octets
         * Returns: 0 on success, -1 on failure
-        *
-        * This optional handler function can be registered if the driver
-        * interface implementation needs to commit changes (e.g., by setting
-        * network interface up) at the end of initial configuration. If set,
-        * this handler will be called after initial setup has been completed.
         */
-       int (*commit)(void *priv);
+       int (*hapd_set_ssid)(void *priv, const u8 *buf, int len);
 
-       int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto,
+       /**
+        * hapd_set_countermeasures - Enable/disable TKIP countermeasures (AP)
+        * @priv: Private driver interface data
+        * @enabled: 1 = countermeasures enabled, 0 = disabled
+        * Returns: 0 on success, -1 on failure
+        *
+        * This need not be implemented if the driver does not take care of
+        * association processing.
+        */
+       int (*hapd_set_countermeasures)(void *priv, int enabled);
+
+       /**
+        * sta_add - Add a station entry
+        * @priv: Private driver interface data
+        * @params: Station parameters
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function is used to add a station entry to the driver once the
+        * station has completed association. This is only used if the driver
+        * does not take care of association processing.
+        */
+       int (*sta_add)(void *priv, struct hostapd_sta_add_params *params);
+
+       /**
+        * get_inact_sec - Get station inactivity duration (AP only)
+        * @priv: Private driver interface data
+        * @addr: Station address
+        * Returns: Number of seconds station has been inactive, -1 on failure
+        */
+       int (*get_inact_sec)(void *priv, const u8 *addr);
+
+       /**
+        * sta_clear_stats - Clear station statistics (AP only)
+        * @priv: Private driver interface data
+        * @addr: Station address
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*sta_clear_stats)(void *priv, const u8 *addr);
+
+       /**
+        * set_freq - Set channel/frequency (AP only)
+        * @priv: Private driver interface data
+        * @freq: Channel parameters
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
+
+       /**
+        * set_rts - Set RTS threshold
+        * @priv: Private driver interface data
+        * @rts: RTS threshold in octets
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*set_rts)(void *priv, int rts);
+
+       /**
+        * set_frag - Set fragmentation threshold
+        * @priv: Private driver interface data
+        * @frag: Fragmentation threshold in octets
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*set_frag)(void *priv, int frag);
+
+       /**
+        * sta_set_flags - Set station flags (AP only)
+        * @priv: Private driver interface data
+        * @addr: Station address
+        * @total_flags: Bitmap of all WPA_STA_* flags currently set
+        * @flags_or: Bitmap of WPA_STA_* flags to add
+        * @flags_and: Bitmap of WPA_STA_* flags to us as a mask
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*sta_set_flags)(void *priv, const u8 *addr,
+                            int total_flags, int flags_or, int flags_and);
+
+       /**
+        * set_rate_sets - Set supported and basic rate sets (AP only)
+        * @priv: Private driver interface data
+        * @supp_rates: -1 terminated array of supported rates in 100 kbps
+        * @basic_rates: -1 terminated array of basic rates in 100 kbps
+        * @mode: hardware mode (HOSTAPD_MODE_*)
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*set_rate_sets)(void *priv, int *supp_rates, int *basic_rates,
+                            int mode);
+
+       /**
+        * set_cts_protect - Set CTS protection mode (AP only)
+        * @priv: Private driver interface data
+        * @value: Whether CTS protection is enabled
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*set_cts_protect)(void *priv, int value);
+
+       /**
+        * set_preamble - Set preamble mode (AP only)
+        * @priv: Private driver interface data
+        * @value: Whether short preamble is enabled
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*set_preamble)(void *priv, int value);
+
+       /**
+        * set_short_slot_time - Set short slot time (AP only)
+        * @priv: Private driver interface data
+        * @value: Whether short slot time is enabled
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*set_short_slot_time)(void *priv, int value);
+
+       /**
+        * set_tx_queue_params - Set TX queue parameters
+        * @priv: Private driver interface data
+        * @queue: Queue number
+        * @aifs: AIFS
+        * @cw_min: cwMin
+        * @cw_max: cwMax
+        * @burst_time: Maximum length for bursting in 0.1 msec units
+        */
+       int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
+                                  int cw_max, int burst_time);
+
+       /**
+        * valid_bss_mask - Validate BSSID mask
+        * @priv: Private driver interface data
+        * @addr: Address
+        * @mask: Mask
+        * Returns: 0 if mask is valid, -1 if mask is not valid, 1 if mask can
+        * be used, but the main interface address must be the first address in
+        * the block if mask is applied
+        */
+       int (*valid_bss_mask)(void *priv, const u8 *addr, const u8 *mask);
+
+       /**
+        * if_add - Add a virtual interface
+        * @priv: Private driver interface data
+        * @type: Interface type
+        * @ifname: Interface name for the new virtual interface
+        * @addr: Local address to use for the interface or %NULL to use the
+        *      parent interface address
+        * @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces
+        * @drv_priv: Pointer for overwriting the driver context or %NULL if
+        *      not allowed (applies only to %WPA_IF_AP_BSS type)
+        * @force_ifname: Buffer for returning an interface name that the
+        *      driver ended up using if it differs from the requested ifname
+        * @if_addr: Buffer for returning the allocated interface address
+        *      (this may differ from the requested addr if the driver cannot
+        *      change interface address)
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*if_add)(void *priv, enum wpa_driver_if_type type,
+                     const char *ifname, const u8 *addr, void *bss_ctx,
+                     void **drv_priv, char *force_ifname, u8 *if_addr);
+
+       /**
+        * if_remove - Remove a virtual interface
+        * @priv: Private driver interface data
+        * @type: Interface type
+        * @ifname: Interface name of the virtual interface to be removed
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*if_remove)(void *priv, enum wpa_driver_if_type type,
+                        const char *ifname);
+
+       /**
+        * set_sta_vlan - Bind a station into a specific interface (AP only)
+        * @priv: Private driver interface data
+        * @ifname: Interface (main or virtual BSS or VLAN)
+        * @addr: MAC address of the associated station
+        * @vlan_id: VLAN ID
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function is used to bind a station to a specific virtual
+        * interface. It is only used if when virtual interfaces are supported,
+        * e.g., to assign stations to different VLAN interfaces based on
+        * information from a RADIUS server. This allows separate broadcast
+        * domains to be used with a single BSS.
+        */
+       int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
+                           int vlan_id);
+
+       /**
+        * commit - Optional commit changes handler (AP only)
+        * @priv: driver private data
+        * Returns: 0 on success, -1 on failure
+        *
+        * This optional handler function can be registered if the driver
+        * interface implementation needs to commit changes (e.g., by setting
+        * network interface up) at the end of initial configuration. If set,
+        * this handler will be called after initial setup has been completed.
+        */
+       int (*commit)(void *priv);
+
+       /**
+        * send_ether - Send an ethernet packet (AP only)
+        * @priv: private driver interface data
+        * @dst: Destination MAC address
+        * @src: Source MAC address
+        * @proto: Ethertype
+        * @data: EAPOL packet starting with IEEE 802.1X header
+        * @data_len: Length of the EAPOL packet in octets
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto,
                          const u8 *data, size_t data_len);
 
+       /**
+        * set_radius_acl_auth - Notification of RADIUS ACL change
+        * @priv: Private driver interface data
+        * @mac: MAC address of the station
+        * @accepted: Whether the station was accepted
+        * @session_timeout: Session timeout for the station
+        * Returns: 0 on success, -1 on failure
+        */
        int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted, 
                                   u32 session_timeout);
+
+       /**
+        * set_radius_acl_expire - Notification of RADIUS ACL expiration
+        * @priv: Private driver interface data
+        * @mac: MAC address of the station
+        * Returns: 0 on success, -1 on failure
+        */
        int (*set_radius_acl_expire)(void *priv, const u8 *mac);
 
-       int (*set_ht_params)(const char *ifname, void *priv,
+       /**
+        * set_ht_params - Set HT parameters (AP only)
+        * @priv: Private driver interface data
+        * @ht_capab: HT Capabilities IE
+        * @ht_capab_len: Length of ht_capab in octets
+        * @ht_oper: HT Operation IE
+        * @ht_oper_len: Length of ht_oper in octets
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*set_ht_params)(void *priv,
                             const u8 *ht_capab, size_t ht_capab_len,
                             const u8 *ht_oper, size_t ht_oper_len);
 
-       int (*set_wps_beacon_ie)(const char *ifname, void *priv,
-                                const u8 *ie, size_t len);
-       int (*set_wps_probe_resp_ie)(const char *ifname, void *priv,
-                                    const u8 *ie, size_t len);
+       /**
+        * set_ap_wps_ie - Add WPS IE(s) into Beacon/Probe Response frames (AP)
+        * @priv: Private driver interface data
+        * @beacon: WPS IE(s) for Beacon frames or %NULL to remove extra IE(s)
+        * @proberesp: WPS IE(s) for Probe Response frames or %NULL to remove
+        *      extra IE(s)
+        * @assocresp: WPS IE(s) for (Re)Association Response frames or %NULL
+        *      to remove extra IE(s)
+        * Returns: 0 on success, -1 on failure
+        *
+        * This is an optional function to add WPS IE in the kernel driver for
+        * Beacon and Probe Response frames. This can be left undefined (set
+        * to %NULL) if the driver uses the Beacon template from set_beacon()
+        * and does not process Probe Request frames. If the driver takes care
+        * of (Re)Association frame processing, the assocresp buffer includes
+        * WPS IE(s) that need to be added to (Re)Association Response frames
+        * whenever a (Re)Association Request frame indicated use of WPS.
+        *
+        * This will also be used to add P2P IE(s) into Beacon/Probe Response
+        * frames when operating as a GO. The driver is responsible for adding
+        * timing related attributes (e.g., NoA) in addition to the IEs
+        * included here by appending them after these buffers. This call is
+        * also used to provide Probe Response IEs for P2P Listen state
+        * operations for drivers that generate the Probe Response frames
+        * internally.
+        */
+       int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon,
+                            const struct wpabuf *proberesp,
+                            const struct wpabuf *assocresp);
 
        /**
         * set_supp_port - Set IEEE 802.1X Supplicant Port status
@@ -1260,12 +1689,228 @@ struct wpa_driver_ops {
         * Returns: 0 on success, -1 on failure
         */
        int (*set_supp_port)(void *priv, int authorized);
+
+       /**
+        * set_wds_sta - Bind a station into a 4-address WDS (AP only)
+        * @priv: Private driver interface data
+        * @addr: MAC address of the associated station
+        * @aid: Association ID
+        * @val: 1 = bind to 4-address WDS; 0 = unbind
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val);
+
+       /**
+        * send_action - Transmit an Action frame
+        * @priv: Private driver interface data
+        * @freq: Frequency (in MHz) of the channel
+        * @dst: Destination MAC address (Address 1)
+        * @src: Source MAC address (Address 2)
+        * @bssid: BSSID (Address 3)
+        * @data: Frame body
+        * @data_len: data length in octets
+        * Returns: 0 on success, -1 on failure
+        *
+        * This command can be used to request the driver to transmit an action
+        * frame to the specified destination. If a remain-on-channel duration
+        * is in progress, the frame is transmitted on that channel. Otherwise,
+        * the frame is transmitted on the current operational channel if in
+        * associated state in station mode or if operating as an AP. If none
+        * of these conditions is in effect, send_action() cannot be used.
+        */
+       int (*send_action)(void *priv, unsigned int freq,
+                          const u8 *dst, const u8 *src, const u8 *bssid,
+                          const u8 *data, size_t data_len);
+
+       /**
+        * remain_on_channel - Remain awake on a channel
+        * @priv: Private driver interface data
+        * @freq: Frequency (in MHz) of the channel
+        * @duration: Duration in milliseconds
+        * Returns: 0 on success, -1 on failure
+        *
+        * This command is used to request the driver to remain awake on the
+        * specified channel for the specified duration and report received
+        * Action frames with EVENT_RX_ACTION events. Optionally, received
+        * Probe Request frames may also be requested to be reported by calling
+        * probe_req_report(). These will be reported with EVENT_RX_PROBE_REQ.
+        *
+        * The driver may not be at the requested channel when this function
+        * returns, i.e., the return code is only indicating whether the
+        * request was accepted. The caller will need to wait until the
+        * EVENT_REMAIN_ON_CHANNEL event indicates that the driver has
+        * completed the channel change. This may take some time due to other
+        * need for the radio and the caller should be prepared to timing out
+        * its wait since there are no guarantees on when this request can be
+        * executed.
+        */
+       int (*remain_on_channel)(void *priv, unsigned int freq,
+                                unsigned int duration);
+
+       /**
+        * cancel_remain_on_channel - Cancel remain-on-channel operation
+        * @priv: Private driver interface data
+        *
+        * This command can be used to cancel a remain-on-channel operation
+        * before its originally requested duration has passed. This could be
+        * used, e.g., when remain_on_channel() is used to request extra time
+        * to receive a response to an Action frame and the response is
+        * received when there is still unneeded time remaining on the
+        * remain-on-channel operation.
+        */
+       int (*cancel_remain_on_channel)(void *priv);
+
+       /**
+        * probe_req_report - Request Probe Request frames to be indicated
+        * @priv: Private driver interface data
+        * @report: Whether to report received Probe Request frames
+        * Returns: 0 on success, -1 on failure (or if not supported)
+        *
+        * This command can be used to request the driver to indicate when
+        * Probe Request frames are received with EVENT_RX_PROBE_REQ events.
+        * Since this operation may require extra resources, e.g., due to less
+        * optimal hardware/firmware RX filtering, many drivers may disable
+        * Probe Request reporting at least in station mode. This command is
+        * used to notify the driver when the Probe Request frames need to be
+        * reported, e.g., during remain-on-channel operations.
+        */
+       int (*probe_req_report)(void *priv, int report);
+
+       /**
+        * disable_11b_rates - Set whether IEEE 802.11b rates are used for TX
+        * @priv: Private driver interface data
+        * @disabled: Whether IEEE 802.11b rates are disabled
+        * Returns: 0 on success, -1 on failure (or if not supported)
+        *
+        * This command is used to disable IEEE 802.11b rates (1, 2, 5.5, and
+        * 11 Mbps) as TX rates for data and management frames. This can be
+        * used to optimize channel use when there is no need to support IEEE
+        * 802.11b-only devices.
+        */
+       int (*disable_11b_rates)(void *priv, int disabled);
+
+       /**
+        * deinit_ap - Deinitialize AP mode
+        * @priv: Private driver interface data
+        * Returns: 0 on success, -1 on failure (or if not supported)
+        *
+        * This optional function can be used to disable AP mode related
+        * configuration and change the driver mode to station mode to allow
+        * normal station operations like scanning to be completed.
+        */
+       int (*deinit_ap)(void *priv);
+
+       /**
+        * suspend - Notification on system suspend/hibernate event
+        * @priv: Private driver interface data
+        */
+       void (*suspend)(void *priv);
+
+       /**
+        * resume - Notification on system resume/thaw event
+        * @priv: Private driver interface data
+        */
+       void (*resume)(void *priv);
+
+       /**
+        * signal_monitor - Set signal monitoring parameters
+        * @priv: Private driver interface data
+        * @threshold: Threshold value for signal change events; 0 = disabled
+        * @hysteresis: Minimum change in signal strength before indicating a
+        *      new event
+        * Returns: 0 on success, -1 on failure (or if not supported)
+        *
+        * This function can be used to configure monitoring of signal strength
+        * with the current AP. Whenever signal strength drops below the
+        * %threshold value or increases above it, EVENT_SIGNAL_CHANGE event
+        * should be generated assuming the signal strength has changed at
+        * least %hysteresis from the previously indicated signal change event.
+        */
+       int (*signal_monitor)(void *priv, int threshold, int hysteresis);
+
+       /**
+        * send_frame - Send IEEE 802.11 frame (testing use only)
+        * @priv: Private driver interface data
+        * @data: IEEE 802.11 frame with IEEE 802.11 header
+        * @data_len: Size of the frame
+        * @encrypt: Whether to encrypt the frame (if keys are set)
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function is only used for debugging purposes and is not
+        * required to be implemented for normal operations.
+        */
+       int (*send_frame)(void *priv, const u8 *data, size_t data_len,
+                         int encrypt);
+
+       /**
+        * shared_freq - Get operating frequency of shared interface(s)
+        * @priv: Private driver interface data
+        * Returns: Operating frequency in MHz, 0 if no shared operation in
+        * use, or -1 on failure
+        *
+        * This command can be used to request the current operating frequency
+        * of any virtual interface that shares the same radio to provide
+        * information for channel selection for other virtual interfaces.
+        */
+       int (*shared_freq)(void *priv);
+
+       /**
+        * get_noa - Get current Notice of Absence attribute payload
+        * @priv: Private driver interface data
+        * @buf: Buffer for returning NoA
+        * @buf_len: Buffer length in octets
+        * Returns: Number of octets used in buf, 0 to indicate no NoA is being
+        * advertized, or -1 on failure
+        *
+        * This function is used to fetch the current Notice of Absence
+        * attribute value from GO.
+        */
+       int (*get_noa)(void *priv, u8 *buf, size_t buf_len);
+
+       /**
+        * set_noa - Set Notice of Absence parameters for GO (testing)
+        * @priv: Private driver interface data
+        * @count: Count
+        * @start: Start time in ms from next TBTT
+        * @duration: Duration in ms
+        * Returns: 0 on success or -1 on failure
+        *
+        * This function is used to set Notice of Absence parameters for GO. It
+        * is used only for testing. To disable NoA, all parameters are set to
+        * 0.
+        */
+       int (*set_noa)(void *priv, u8 count, int start, int duration);
+
+       /**
+        * set_p2p_powersave - Set P2P power save options
+        * @priv: Private driver interface data
+        * @legacy_ps: 0 = disable, 1 = enable, 2 = maximum PS, -1 = no change
+        * @opp_ps: 0 = disable, 1 = enable, -1 = no change
+        * @ctwindow: 0.. = change (msec), -1 = no change
+        * Returns: 0 on success or -1 on failure
+        */
+       int (*set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps,
+                                int ctwindow);
+
+       /**
+        * ampdu - Enable/disable aggregation
+        * @priv: Private driver interface data
+        * @ampdu: 1/0 = enable/disable A-MPDU aggregation
+        * Returns: 0 on success or -1 on failure
+        */
+       int (*ampdu)(void *priv, int ampdu);
+
+       /**
+        * set_intra_bss - Enables/Disables intra BSS bridging
+        */
+       int (*set_intra_bss)(void *priv, int enabled);
 };
 
+
 /**
  * enum wpa_event_type - Event type for wpa_supplicant_event() calls
  */
-typedef enum wpa_event_type {
+enum wpa_event_type {
        /**
         * EVENT_ASSOC - Association completed
         *
@@ -1288,6 +1933,7 @@ typedef enum wpa_event_type {
         * sending either of these frames to the current AP. If the driver
         * supports separate deauthentication event, EVENT_DISASSOC should only
         * be used for disassociation and EVENT_DEAUTH for deauthentication.
+        * In AP mode, union wpa_event_data::disassoc_info is required.
         */
        EVENT_DISASSOC,
 
@@ -1313,7 +1959,8 @@ typedef enum wpa_event_type {
         * EVENT_SCAN_RESULTS call. If such event is not available from the
         * driver, the driver wrapper code is expected to use a registered
         * timeout to generate EVENT_SCAN_RESULTS call after the time that the
-        * scan is expected to be completed.
+        * scan is expected to be completed. Optional information about
+        * completed scan can be provided with union wpa_event_data::scan_info.
         */
        EVENT_SCAN_RESULTS,
 
@@ -1414,6 +2061,7 @@ typedef enum wpa_event_type {
         * This event should be called when authentication is lost either due
         * to receiving deauthenticate frame from the AP or when sending that
         * frame to the current AP.
+        * In AP mode, union wpa_event_data::deauth_info is required.
         */
        EVENT_DEAUTH,
 
@@ -1434,8 +2082,127 @@ typedef enum wpa_event_type {
        /**
         * EVENT_ASSOC_TIMED_OUT - Association timed out
         */
-       EVENT_ASSOC_TIMED_OUT
-} wpa_event_type;
+       EVENT_ASSOC_TIMED_OUT,
+
+       /**
+        * EVENT_FT_RRB_RX - FT (IEEE 802.11r) RRB frame received
+        */
+       EVENT_FT_RRB_RX,
+
+       /**
+        * EVENT_WPS_BUTTON_PUSHED - Report hardware push button press for WPS
+        */
+       EVENT_WPS_BUTTON_PUSHED,
+
+       /**
+        * EVENT_TX_STATUS - Report TX status
+        */
+       EVENT_TX_STATUS,
+
+       /**
+        * EVENT_RX_FROM_UNKNOWN - Report RX from unknown STA
+        */
+       EVENT_RX_FROM_UNKNOWN,
+
+       /**
+        * EVENT_RX_MGMT - Report RX of a management frame
+        */
+       EVENT_RX_MGMT,
+
+       /**
+        * EVENT_RX_ACTION - Action frame received
+        *
+        * This event is used to indicate when an Action frame has been
+        * received. Information about the received frame is included in
+        * union wpa_event_data::rx_action.
+        */
+       EVENT_RX_ACTION,
+
+       /**
+        * EVENT_REMAIN_ON_CHANNEL - Remain-on-channel duration started
+        *
+        * This event is used to indicate when the driver has started the
+        * requested remain-on-channel duration. Information about the
+        * operation is included in union wpa_event_data::remain_on_channel.
+        */
+       EVENT_REMAIN_ON_CHANNEL,
+
+       /**
+        * EVENT_CANCEL_REMAIN_ON_CHANNEL - Remain-on-channel timed out
+        *
+        * This event is used to indicate when the driver has completed
+        * remain-on-channel duration, i.e., may noot be available on the
+        * requested channel anymore. Information about the
+        * operation is included in union wpa_event_data::remain_on_channel.
+        */
+       EVENT_CANCEL_REMAIN_ON_CHANNEL,
+
+       /**
+        * EVENT_MLME_RX - Report reception of frame for MLME (test use only)
+        *
+        * This event is used only by driver_test.c and userspace MLME.
+        */
+       EVENT_MLME_RX,
+
+       /**
+        * EVENT_RX_PROBE_REQ - Indicate received Probe Request frame
+        *
+        * This event is used to indicate when a Probe Request frame has been
+        * received. Information about the received frame is included in
+        * union wpa_event_data::rx_probe_req. The driver is required to report
+        * these events only after successfully completed probe_req_report()
+        * commands to request the events (i.e., report parameter is non-zero)
+        * in station mode. In AP mode, Probe Request frames should always be
+        * reported.
+        */
+       EVENT_RX_PROBE_REQ,
+
+       /**
+        * EVENT_NEW_STA - New wired device noticed
+        *
+        * This event is used to indicate that a new device has been detected
+        * in a network that does not use association-like functionality (i.e.,
+        * mainly wired Ethernet). This can be used to start EAPOL
+        * authenticator when receiving a frame from a device. The address of
+        * the device is included in union wpa_event_data::new_sta.
+        */
+       EVENT_NEW_STA,
+
+       /**
+        * EVENT_EAPOL_RX - Report received EAPOL frame
+        *
+        * When in AP mode with hostapd, this event is required to be used to
+        * deliver the receive EAPOL frames from the driver. With
+        * %wpa_supplicant, this event is used only if the send_eapol() handler
+        * is used to override the use of l2_packet for EAPOL frame TX.
+        */
+       EVENT_EAPOL_RX,
+
+       /**
+        * EVENT_SIGNAL_CHANGE - Indicate change in signal strength
+        *
+        * This event is used to indicate changes in the signal strength
+        * observed in frames received from the current AP if signal strength
+        * monitoring has been enabled with signal_monitor().
+        */
+       EVENT_SIGNAL_CHANGE,
+
+       /**
+        * EVENT_INTERFACE_ENABLED - Notify that interface was enabled
+        *
+        * This event is used to indicate that the interface was enabled after
+        * having been previously disabled, e.g., due to rfkill.
+        */
+       EVENT_INTERFACE_ENABLED,
+
+       /**
+        * EVENT_INTERFACE_DISABLED - Notify that interface was disabled
+        *
+        * This event is used to indicate that the interface was disabled,
+        * e.g., due to rfkill.
+        */
+       EVENT_INTERFACE_DISABLED
+};
 
 
 /**
@@ -1462,7 +2229,7 @@ union wpa_event_data {
                 * This should start with the first IE (fixed fields before IEs
                 * are not included).
                 */
-               u8 *req_ies;
+               const u8 *req_ies;
 
                /**
                 * req_ies_len - Length of req_ies in bytes
@@ -1480,7 +2247,7 @@ union wpa_event_data {
                 * This should start with the first IE (fixed fields before IEs
                 * are not included).
                 */
-               u8 *resp_ies;
+               const u8 *resp_ies;
 
                /**
                 * resp_ies_len - Length of resp_ies in bytes
@@ -1503,14 +2270,76 @@ union wpa_event_data {
                 * This should start with the first IE (fixed fields before IEs
                 * are not included).
                 */
-               u8 *beacon_ies;
+               const u8 *beacon_ies;
 
                /**
                 * beacon_ies_len - Length of beacon_ies */
                size_t beacon_ies_len;
+
+               /**
+                * freq - Frequency of the operational channel in MHz
+                */
+               unsigned int freq;
+
+               /**
+                * addr - Station address (for AP mode)
+                */
+               const u8 *addr;
        } assoc_info;
 
        /**
+        * struct disassoc_info - Data for EVENT_DISASSOC events
+        */
+       struct disassoc_info {
+               /**
+                * addr - Station address (for AP mode)
+                */
+               const u8 *addr;
+
+               /**
+                * reason_code - Reason Code (host byte order) used in
+                *      Deauthentication frame
+                */
+               u16 reason_code;
+
+               /**
+                * ie - Optional IE(s) in Disassociation frame
+                */
+               const u8 *ie;
+
+               /**
+                * ie_len - Length of ie buffer in octets
+                */
+               size_t ie_len;
+       } disassoc_info;
+
+       /**
+        * struct deauth_info - Data for EVENT_DEAUTH events
+        */
+       struct deauth_info {
+               /**
+                * addr - Station address (for AP mode)
+                */
+               const u8 *addr;
+
+               /**
+                * reason_code - Reason Code (host byte order) used in
+                *      Deauthentication frame
+                */
+               u16 reason_code;
+
+               /**
+                * ie - Optional IE(s) in Deauthentication frame
+                */
+               const u8 *ie;
+
+               /**
+                * ie_len - Length of ie buffer in octets
+                */
+               size_t ie_len;
+       } deauth_info;
+
+       /**
         * struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE
         */
        struct michael_mic_failure {
@@ -1616,6 +2445,174 @@ union wpa_event_data {
        struct timeout_event {
                u8 addr[ETH_ALEN];
        } timeout_event;
+
+       /**
+        * struct ft_rrb_rx - Data for EVENT_FT_RRB_RX events
+        */
+       struct ft_rrb_rx {
+               const u8 *src;
+               const u8 *data;
+               size_t data_len;
+       } ft_rrb_rx;
+
+       /**
+        * struct tx_status - Data for EVENT_TX_STATUS events
+        */
+       struct tx_status {
+               u16 type;
+               u16 stype;
+               const u8 *dst;
+               const u8 *data;
+               size_t data_len;
+               int ack;
+       } tx_status;
+
+       /**
+        * struct rx_from_unknown - Data for EVENT_RX_FROM_UNKNOWN events
+        */
+       struct rx_from_unknown {
+               const u8 *frame;
+               size_t len;
+       } rx_from_unknown;
+
+       /**
+        * struct rx_mgmt - Data for EVENT_RX_MGMT events
+        */
+       struct rx_mgmt {
+               const u8 *frame;
+               size_t frame_len;
+               u32 datarate;
+               u32 ssi_signal;
+       } rx_mgmt;
+
+       /**
+        * struct rx_action - Data for EVENT_RX_ACTION events
+        */
+       struct rx_action {
+               /**
+                * da - Destination address of the received Action frame
+                */
+               const u8 *da;
+
+               /**
+                * sa - Source address of the received Action frame
+                */
+               const u8 *sa;
+
+               /**
+                * bssid - Address 3 of the received Action frame
+                */
+               const u8 *bssid;
+
+               /**
+                * category - Action frame category
+                */
+               u8 category;
+
+               /**
+                * data - Action frame body after category field
+                */
+               const u8 *data;
+
+               /**
+                * len - Length of data in octets
+                */
+               size_t len;
+
+               /**
+                * freq - Frequency (in MHz) on which the frame was received
+                */
+               int freq;
+       } rx_action;
+
+       /**
+        * struct remain_on_channel - Data for EVENT_REMAIN_ON_CHANNEL events
+        *
+        * This is also used with EVENT_CANCEL_REMAIN_ON_CHANNEL events.
+        */
+       struct remain_on_channel {
+               /**
+                * freq - Channel frequency in MHz
+                */
+               unsigned int freq;
+
+               /**
+                * duration - Duration to remain on the channel in milliseconds
+                */
+               unsigned int duration;
+       } remain_on_channel;
+
+       /**
+        * struct scan_info - Optional data for EVENT_SCAN_RESULTS events
+        * @aborted: Whether the scan was aborted
+        * @freqs: Scanned frequencies in MHz (%NULL = all channels scanned)
+        * @num_freqs: Number of entries in freqs array
+        * @ssids: Scanned SSIDs (%NULL or zero-length SSID indicates wildcard
+        *      SSID)
+        * @num_ssids: Number of entries in ssids array
+        */
+       struct scan_info {
+               int aborted;
+               const int *freqs;
+               size_t num_freqs;
+               struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
+               size_t num_ssids;
+       } scan_info;
+
+       /**
+        * struct mlme_rx - Data for EVENT_MLME_RX events
+        */
+       struct mlme_rx {
+               const u8 *buf;
+               size_t len;
+               int freq;
+               int channel;
+               int ssi;
+       } mlme_rx;
+
+       /**
+        * struct rx_probe_req - Data for EVENT_RX_PROBE_REQ events
+        */
+       struct rx_probe_req {
+               /**
+                * sa - Source address of the received Probe Request frame
+                */
+               const u8 *sa;
+
+               /**
+                * ie - IEs from the Probe Request body
+                */
+               const u8 *ie;
+
+               /**
+                * ie_len - Length of ie buffer in octets
+                */
+               size_t ie_len;
+       } rx_probe_req;
+
+       /**
+        * struct new_sta - Data for EVENT_NEW_STA events
+        */
+       struct new_sta {
+               const u8 *addr;
+       } new_sta;
+
+       /**
+        * struct eapol_rx - Data for EVENT_EAPOL_RX events
+        */
+       struct eapol_rx {
+               const u8 *src;
+               const u8 *data;
+               size_t data_len;
+       } eapol_rx;
+
+       /**
+        * struct signal_change - Data for EVENT_SIGNAL_CHANGE events
+        */
+       struct signal_change {
+               int above_threshold;
+               int current_signal;
+       } signal_change;
 };
 
 /**
@@ -1628,72 +2625,43 @@ union wpa_event_data {
  * Driver wrapper code should call this function whenever an event is received
  * from the driver.
  */
-void wpa_supplicant_event(void *ctx, wpa_event_type event,
+void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                          union wpa_event_data *data);
 
-/**
- * wpa_supplicant_rx_eapol - Deliver a received EAPOL frame to wpa_supplicant
- * @ctx: Context pointer (wpa_s); this is the ctx variable registered
- *     with struct wpa_driver_ops::init()
- * @src_addr: Source address of the EAPOL frame
- * @buf: EAPOL data starting from the EAPOL header (i.e., no Ethernet header)
- * @len: Length of the EAPOL data
- *
- * This function is called for each received EAPOL frame. Most driver
- * interfaces rely on more generic OS mechanism for receiving frames through
- * l2_packet, but if such a mechanism is not available, the driver wrapper may
- * take care of received EAPOL frames and deliver them to the core supplicant
- * code by calling this function.
+
+/*
+ * The following inline functions are provided for convenience to simplify
+ * event indication for some of the common events.
  */
-void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
-                            const u8 *buf, size_t len);
-
-void wpa_supplicant_sta_rx(void *ctx, const u8 *buf, size_t len,
-                          struct ieee80211_rx_status *rx_status);
-
-const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie);
-#define WPA_IE_VENDOR_TYPE 0x0050f201
-#define WPS_IE_VENDOR_TYPE 0x0050f204
-const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res,
-                                 u32 vendor_type);
-struct wpabuf * wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res *res,
-                                            u32 vendor_type);
-int wpa_scan_get_max_rate(const struct wpa_scan_res *res);
-void wpa_scan_results_free(struct wpa_scan_results *res);
-void wpa_scan_sort_results(struct wpa_scan_results *res);
-
-/* hostapd functions for driver wrappers */
-
-struct sta_info;
-struct ieee80211_hdr;
-
-void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
-                          int reassoc);
-void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
-                      const u8 *buf, size_t len, int ack);
-void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd,
-                                const struct ieee80211_hdr *hdr, size_t len);
-int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
-                       const u8 *ie, size_t ielen);
-void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
-void hostapd_eapol_receive(struct hostapd_data *hapd, const u8 *sa,
-                          const u8 *buf, size_t len);
-
-struct hostapd_frame_info {
-       u32 phytype;
-       u32 channel;
-       u32 datarate;
-       u32 ssi_signal;
-};
 
-void hostapd_mgmt_rx(struct hostapd_data *hapd, u8 *buf, size_t len,
-                    u16 stype, struct hostapd_frame_info *fi);
-void hostapd_mgmt_tx_cb(struct hostapd_data *hapd, u8 *buf, size_t len,
-                       u16 stype, int ok);
-void hostapd_michael_mic_failure(struct hostapd_data *hapd, const u8 *addr);
-struct hostapd_data * hostapd_sta_get_bss(struct hostapd_data *hapd,
-                                         const u8 *addr);
-void hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa,
-                         const u8 *ie, size_t ie_len);
+static inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie,
+                                  size_t ielen)
+{
+       union wpa_event_data event;
+       os_memset(&event, 0, sizeof(event));
+       event.assoc_info.req_ies = ie;
+       event.assoc_info.req_ies_len = ielen;
+       event.assoc_info.addr = addr;
+       wpa_supplicant_event(ctx, EVENT_ASSOC, &event);
+}
+
+static inline void drv_event_disassoc(void *ctx, const u8 *addr)
+{
+       union wpa_event_data event;
+       os_memset(&event, 0, sizeof(event));
+       event.disassoc_info.addr = addr;
+       wpa_supplicant_event(ctx, EVENT_DISASSOC, &event);
+}
+
+static inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data,
+                                     size_t data_len)
+{
+       union wpa_event_data event;
+       os_memset(&event, 0, sizeof(event));
+       event.eapol_rx.src = src;
+       event.eapol_rx.data = data;
+       event.eapol_rx.data_len = data_len;
+       wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);
+}
 
 #endif /* DRIVER_H */