TDLS: Add peer as a STA during link setup
[mech_eap.git] / src / drivers / driver.h
index 188f34c..5d61481 100644 (file)
@@ -31,6 +31,9 @@
 #define HOSTAPD_CHAN_PASSIVE_SCAN 0x00000002
 #define HOSTAPD_CHAN_NO_IBSS 0x00000004
 #define HOSTAPD_CHAN_RADAR 0x00000008
+#define HOSTAPD_CHAN_HT40PLUS 0x00000010
+#define HOSTAPD_CHAN_HT40MINUS 0x00000020
+#define HOSTAPD_CHAN_HT40 0x00000040
 
 /**
  * struct hostapd_channel_data - Channel information
@@ -57,6 +60,8 @@ struct hostapd_channel_data {
        u8 max_tx_power;
 };
 
+#define HOSTAPD_MODE_FLAG_HT_INFO_KNOWN BIT(0)
+
 /**
  * struct hostapd_hw_modes - Supported hardware mode information
  */
@@ -100,6 +105,8 @@ struct hostapd_hw_modes {
         * a_mpdu_params - A-MPDU (IEEE 802.11n) parameters
         */
        u8 a_mpdu_params;
+
+       unsigned int flags; /* HOSTAPD_MODE_FLAG_* */
 };
 
 
@@ -192,7 +199,7 @@ struct wpa_interface_info {
        const char *drv_name;
 };
 
-#define WPAS_MAX_SCAN_SSIDS 4
+#define WPAS_MAX_SCAN_SSIDS 16
 
 /**
  * struct wpa_driver_scan_params - Scan parameters
@@ -261,6 +268,15 @@ struct wpa_driver_scan_params {
         * num_filter_ssids - Number of entries in filter_ssids array
         */
        size_t num_filter_ssids;
+
+       /**
+        * p2p_probe - Used to disable CCK (802.11b) rates for P2P probes
+        *
+        * When set, the driver is expected to remove rates 1, 2, 5.5, and 11
+        * Mbps from the support rates element(s) in the Probe Request frames
+        * and not to transmit the frames at any of those rates.
+        */
+       u8 p2p_probe;
 };
 
 /**
@@ -278,6 +294,20 @@ struct wpa_driver_auth_params {
        const u8 *wep_key[4];
        size_t wep_key_len[4];
        int wep_tx_keyidx;
+       int local_state_change;
+
+       /**
+        * p2p - Whether this connection is a P2P group
+        */
+       int p2p;
+
+};
+
+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
+                         */
 };
 
 /**
@@ -334,6 +364,11 @@ struct wpa_driver_associate_params {
        size_t wpa_ie_len;
 
        /**
+        * wpa_proto - Bitfield of WPA_PROTO_* values to indicate WPA/WPA2
+        */
+       unsigned int wpa_proto;
+
+       /**
         * pairwise_suite - Selected pairwise cipher suite
         *
         * This is usually ignored if @wpa_ie is used.
@@ -459,6 +494,184 @@ 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;
+};
+
+enum hide_ssid {
+       NO_SSID_HIDING,
+       HIDDEN_SSID_ZERO_LEN,
+       HIDDEN_SSID_ZERO_CONTENTS
+};
+
+struct wpa_driver_ap_params {
+       /**
+        * head - Beacon head from IEEE 802.11 header to IEs before TIM IE
+        */
+       const u8 *head;
+
+       /**
+        * head_len - Length of the head buffer in octets
+        */
+       size_t head_len;
+
+       /**
+        * tail - Beacon tail following TIM IE
+        */
+       const u8 *tail;
+
+       /**
+        * tail_len - Length of the tail buffer in octets
+        */
+       size_t tail_len;
+
+       /**
+        * dtim_period - DTIM period
+        */
+       int dtim_period;
+
+       /**
+        * beacon_int - Beacon interval
+        */
+       int beacon_int;
+
+       /**
+        * ssid - The SSID to use in Beacon/Probe Response frames
+        */
+       const u8 *ssid;
+
+       /**
+        * ssid_len - Length of the SSID (1..32)
+        */
+       size_t ssid_len;
+
+       /**
+        * hide_ssid - Whether to hide the SSID
+        */
+       enum hide_ssid hide_ssid;
+
+       /**
+        * pairwise_ciphers - WPA_CIPHER_* bitfield
+        */
+       unsigned int pairwise_ciphers;
+
+       /**
+        * group_cipher - WPA_CIPHER_*
+        */
+       unsigned int group_cipher;
+
+       /**
+        * key_mgmt_suites - WPA_KEY_MGMT_* bitfield
+        */
+       unsigned int key_mgmt_suites;
+
+       /**
+        * auth_algs - WPA_AUTH_ALG_* bitfield
+        */
+       unsigned int auth_algs;
+
+       /**
+        * wpa_version - WPA_PROTO_* bitfield
+        */
+       unsigned int wpa_version;
+
+       /**
+        * privacy - Whether privacy is used in the BSS
+        */
+       int privacy;
+
+       /**
+        * beacon_ies - WPS/P2P IE(s) for Beacon frames
+        *
+        * This is used to add IEs like WPS IE and P2P IE by drivers that do
+        * not use the full Beacon template.
+        */
+       const struct wpabuf *beacon_ies;
+
+       /**
+        * proberesp_ies - P2P/WPS IE(s) for Probe Response frames
+        *
+        * This is used to add IEs like WPS IE and P2P IE by drivers that
+        * reply to Probe Request frames internally.
+        */
+       const struct wpabuf *proberesp_ies;
+
+       /**
+        * assocresp_ies - WPS IE(s) for (Re)Association Response frames
+        *
+        * This is used to add IEs like WPS IE by drivers that reply to
+        * (Re)Association Request frames internally.
+        */
+       const struct wpabuf *assocresp_ies;
+
+       /**
+        * isolate - Whether to isolate frames between associated stations
+        *
+        * If this is non-zero, the AP is requested to disable forwarding of
+        * frames between association stations.
+        */
+       int isolate;
+
+       /**
+        * cts_protect - Whether CTS protection is enabled
+        */
+       int cts_protect;
+
+       /**
+        * preamble - Whether short preamble is enabled
+        */
+       int preamble;
+
+       /**
+        * short_slot_time - Whether short slot time is enabled
+        *
+        * 0 = short slot time disable, 1 = short slot time enabled, -1 = do
+        * not set (e.g., when 802.11g mode is not in use)
+        */
+       int short_slot_time;
+
+       /**
+        * ht_opmode - HT operation mode or -1 if HT not in use
+        */
+       int ht_opmode;
+
+       /**
+        * interworking - Whether Interworking is enabled
+        */
+       int interworking;
+
+       /**
+        * hessid - Homogeneous ESS identifier or %NULL if not set
+        */
+       const u8 *hessid;
+
+       /**
+        * access_network_type - Access Network Type (0..15)
+        *
+        * This is used for filtering Probe Request frames when Interworking is
+        * enabled.
+        */
+       u8 access_network_type;
 };
 
 /**
@@ -489,7 +702,7 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS_DRIVER_IE     0x00000001
 /* Driver needs static WEP key setup after association command */
 #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
-#define WPA_DRIVER_FLAGS_USER_SPACE_MLME 0x00000004
+/* unused: 0x00000004 */
 /* Driver takes care of RSN 4-way handshake internally; PMK is configured with
  * struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */
 #define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE 0x00000008
@@ -501,9 +714,60 @@ 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 or non-P2P purposes.
+ */
+#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
+/* Driver supports concurrent operations on multiple channels */
+#define WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT      0x00001000
+/*
+ * Driver uses the initial interface for P2P management interface and non-P2P
+ * purposes (e.g., connect to infra AP), but this interface cannot be used for
+ * P2P group operations.
+ */
+#define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P          0x00002000
+/*
+ * Driver is known to use sane error codes, i.e., when it indicates that
+ * something (e.g., association) fails, there was indeed a failure and the
+ * operation does not end up getting completed successfully later.
+ */
+#define WPA_DRIVER_FLAGS_SANE_ERROR_CODES              0x00004000
+/* Driver supports off-channel TX */
+#define WPA_DRIVER_FLAGS_OFFCHANNEL_TX                 0x00008000
+/* Driver indicates TX status events for EAPOL Data frames */
+#define WPA_DRIVER_FLAGS_EAPOL_TX_STATUS               0x00010000
+/* Driver indicates TX status events for Deauth/Disassoc frames */
+#define WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS              0x00020000
+/* Driver supports roaming (BSS selection) in firmware */
+#define WPA_DRIVER_FLAGS_BSS_SELECTION                 0x00040000
+/* Driver supports operating as a TDLS peer */
+#define WPA_DRIVER_FLAGS_TDLS_SUPPORT                  0x00080000
+/* Driver requires external TDLS setup/teardown/discovery */
+#define WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP           0x00100000
        unsigned int flags;
 
        int max_scan_ssids;
+       int max_sched_scan_ssids;
+       int sched_scan_supported;
+       int max_match_sets;
+
+       /**
+        * max_remain_on_chan - Maximum remain-on-channel duration in msec
+        */
+       unsigned int max_remain_on_chan;
+
+       /**
+        * max_stations - Maximum number of associated stations the driver
+        * supports in AP mode
+        */
+       unsigned int max_stations;
 };
 
 
@@ -529,6 +793,8 @@ struct hostapd_sta_add_params {
        size_t supp_rates_len;
        u16 listen_interval;
        const struct ieee80211_ht_capabilities *ht_capabilities;
+       u32 flags; /* bitmask of WPA_STA_* flags */
+       int set; /* Set STA parameters instead of add */
 };
 
 struct hostapd_freq_params {
@@ -561,9 +827,26 @@ enum wpa_driver_if_type {
         * 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 {
+       void *global_priv;
        const u8 *bssid;
        const char *ifname;
        const u8 *ssid;
@@ -589,12 +872,46 @@ struct wpa_bss_params {
        int wpa_pairwise;
        int wpa_key_mgmt;
        int rsn_preauth;
+       enum mfp_options ieee80211w;
 };
 
 #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)
+#define WPA_STA_TDLS_PEER BIT(4)
+
+/**
+ * struct p2p_params - P2P parameters for driver-based P2P management
+ */
+struct p2p_params {
+       const char *dev_name;
+       u8 pri_dev_type[8];
+#define DRV_MAX_SEC_DEV_TYPES 5
+       u8 sec_dev_type[DRV_MAX_SEC_DEV_TYPES][8];
+       size_t num_sec_dev_types;
+};
+
+enum tdls_oper {
+       TDLS_DISCOVERY_REQ,
+       TDLS_SETUP,
+       TDLS_TEARDOWN,
+       TDLS_ENABLE_LINK,
+       TDLS_DISABLE_LINK,
+       TDLS_ENABLE,
+       TDLS_DISABLE
+};
+
+/**
+ * struct wpa_signal_info - Information about channel signal quality
+ */
+struct wpa_signal_info {
+       u32 frequency;
+       int above_threshold;
+       int current_signal;
+       int current_noise;
+       int current_txrate;
+};
 
 /**
  * struct wpa_driver_ops - Driver interface API definition
@@ -646,8 +963,12 @@ struct wpa_driver_ops {
         * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
         *      %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK);
         *      %WPA_ALG_NONE clears the key.
-        * @addr: address of the peer STA or ff:ff:ff:ff:ff:ff for
-        *      broadcast/default keys
+        * @addr: Address of the peer STA (BSSID of the current AP when setting
+        *      pairwise key in station mode), ff:ff:ff:ff:ff:ff for
+        *      broadcast keys, %NULL for default keys that are used both for
+        *      broadcast and unicast; when clearing keys, %NULL is used to
+        *      indicate that both the broadcast-only and default key of the
+        *      specified key index is to be cleared
         * @key_idx: key index (0..3), usually 0 for unicast keys; 0..4095 for
         *      IGTK
         * @set_tx: configure this key as the default Tx key (only used when
@@ -655,7 +976,7 @@ struct wpa_driver_ops {
         * @seq: sequence number/packet number, seq_len octets, the next
         *      packet number to be used for in replay protection; configured
         *      for Rx keys (in most cases, this is only used with broadcast
-        *      keys and set to zero for unicast keys)
+        *      keys and set to zero for unicast keys); %NULL if not set
         * @seq_len: length of the seq, depends on the algorithm:
         *      TKIP: 6 octets, CCMP: 6 octets, IGTK: 6 octets
         * @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key,
@@ -678,7 +999,7 @@ struct wpa_driver_ops {
         * Please note that TKIP keys include separate TX and RX MIC keys and
         * some drivers may expect them in different order than wpa_supplicant
         * is using. If the TX/RX keys are swapped, all TKIP encrypted packets
-        * will tricker Michael MIC errors. This can be fixed by changing the
+        * will trigger Michael MIC errors. This can be fixed by changing the
         * order of MIC keys by swapping te bytes 16..23 and 24..31 of the key
         * in driver_*.c set_key() implementation, see driver_ndis.c for an
         * example on how this can be done.
@@ -945,93 +1266,21 @@ struct wpa_driver_ops {
         * flags: Variable for returning hardware feature flags
         * Returns: Pointer to allocated hardware data on success or %NULL on
         * failure. Caller is responsible for freeing this.
-        *
-        * This function is only needed for drivers that export MLME
-        * (management frame processing) to %wpa_supplicant or hostapd.
         */
        struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
                                                         u16 *num_modes,
                                                         u16 *flags);
 
        /**
-        * set_channel - Set channel
-        * @priv: Private driver interface data
-        * @phymode: HOSTAPD_MODE_IEEE80211B, ..
-        * @chan: IEEE 802.11 channel number
-        * @freq: Frequency of the channel in MHz
-        * Returns: 0 on success, -1 on failure
-        *
-        * This function is only needed for drivers that export MLME
-        * (management frame processing) to wpa_supplicant.
-        */
-       int (*set_channel)(void *priv, enum hostapd_hw_mode phymode, int chan,
-                          int freq);
-
-       /**
-        * set_ssid - Set SSID
-        * @priv: Private driver interface data
-        * @ssid: SSID
-        * @ssid_len: SSID length
-        * Returns: 0 on success, -1 on failure
-        *
-        * This function is only needed for drivers that export MLME
-        * (management frame processing) to wpa_supplicant.
-        */
-       int (*set_ssid)(void *priv, const u8 *ssid, size_t ssid_len);
-
-       /**
-        * set_bssid - Set BSSID
-        * @priv: Private driver interface data
-        * @bssid: BSSID
-        * Returns: 0 on success, -1 on failure
-        *
-        * This function is only needed for drivers that export MLME
-        * (management frame processing) to wpa_supplicant.
-        */
-       int (*set_bssid)(void *priv, const u8 *bssid);
-
-       /**
         * send_mlme - Send management frame from MLME
         * @priv: Private driver interface data
         * @data: IEEE 802.11 management frame with IEEE 802.11 header
         * @data_len: Size of the management frame
         * Returns: 0 on success, -1 on failure
-        *
-        * This function is only needed for drivers that export MLME
-        * (management frame processing) to wpa_supplicant.
         */
        int (*send_mlme)(void *priv, const u8 *data, size_t data_len);
 
        /**
-        * mlme_add_sta - Add a STA entry into the driver/netstack
-        * @priv: Private driver interface data
-        * @addr: MAC address of the STA (e.g., BSSID of the AP)
-        * @supp_rates: Supported rate set (from (Re)AssocResp); in IEEE 802.11
-        * format (one octet per rate, 1 = 0.5 Mbps)
-        * @supp_rates_len: Number of entries in supp_rates
-        * Returns: 0 on success, -1 on failure
-        *
-        * This function is only needed for drivers that export MLME
-        * (management frame processing) to wpa_supplicant. When the MLME code
-        * completes association with an AP, this function is called to
-        * configure the driver/netstack with a STA entry for data frame
-        * processing (TX rate control, encryption/decryption).
-        */
-       int (*mlme_add_sta)(void *priv, const u8 *addr, const u8 *supp_rates,
-                           size_t supp_rates_len);
-
-       /**
-        * mlme_remove_sta - Remove a STA entry from the driver/netstack
-        * @priv: Private driver interface data
-        * @addr: MAC address of the STA (e.g., BSSID of the AP)
-        * Returns: 0 on success, -1 on failure
-        *
-        * This function is only needed for drivers that export MLME
-        * (management frame processing) to wpa_supplicant.
-        */
-       int (*mlme_remove_sta)(void *priv, const u8 *addr);
-
-       /**
         * update_ft_ies - Update FT (IEEE 802.11r) IEs
         * @priv: Private driver interface data
         * @md: Mobility domain (2 octets) (also included inside ies)
@@ -1158,24 +1407,25 @@ struct wpa_driver_ops {
                            struct wpa_driver_auth_params *params);
 
        /**
-        * set_beacon - Set Beacon frame template
+        * set_ap - Set Beacon and Probe Response information for AP mode
         * @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
+        * @params: Parameters to use in AP mode
         *
-        * This function is used to configure Beacon template for the driver in
+        * This function is used to configure Beacon template and/or extra IEs
+        * to add for Beacon and Probe Response frames 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.
+        * driver/firmware and finishing with the tail part. Depending on the
+        * driver architectue, this can be done either by using the full
+        * template or the set of additional IEs (e.g., WPS and P2P IE).
+        * Similarly, Probe Response processing depends on the driver design.
+        * If the driver (or firmware) takes care of replying to Probe Request
+        * frames, the extra IEs provided here needs to be added to the Probe
+        * Response frames.
+        *
+        * Returns: 0 on success, -1 on failure
         */
-       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);
+       int (*set_ap)(void *priv, struct wpa_driver_ap_params *params);
 
        /**
         * hapd_init - Initialize driver interface (hostapd only)
@@ -1184,7 +1434,7 @@ struct wpa_driver_ops {
         * 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.
+        * wrapper is used with hostapd.
         */
        void * (*hapd_init)(struct hostapd_data *hapd,
                            struct wpa_init_params *params);
@@ -1204,8 +1454,10 @@ struct wpa_driver_ops {
         * 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
+        * always enabled and the driver uses set_ap() to set WPA/RSN IE
         * for Beacon frames.
+        *
+        * DEPRECATED - use set_ap() instead
         */
        int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
 
@@ -1217,7 +1469,9 @@ struct wpa_driver_ops {
         *
         * 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().
+        * %NULL) if the driver uses the Beacon template from set_ap().
+        *
+        * DEPRECATED - use set_ap() instead
         */
        int (*set_privacy)(void *priv, int enabled);
 
@@ -1259,7 +1513,9 @@ struct wpa_driver_ops {
         * 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().
+        * set_ap().
+        *
+        * DEPRECATED - use set_ap() instead
         */
        int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len);
 
@@ -1281,12 +1537,13 @@ struct wpa_driver_ops {
         * @data_len: Length of the EAPOL packet in octets
         * @encrypt: Whether the frame should be encrypted
         * @own_addr: Source MAC address
+        * @flags: WPA_STA_* flags for the destination station
         *
         * 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);
+                              const u8 *own_addr, u32 flags);
 
        /**
         * sta_deauth - Deauthenticate a station (AP only)
@@ -1332,8 +1589,7 @@ struct wpa_driver_ops {
         * 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.
+        * template from set_ap() and does not reply to Probe Request frames.
         */
        int (*hapd_get_ssid)(void *priv, u8 *buf, int len);
 
@@ -1343,6 +1599,8 @@ struct wpa_driver_ops {
         * @buf: SSID
         * @len: Length of the SSID in octets
         * Returns: 0 on success, -1 on failure
+        *
+        * DEPRECATED - use set_ap() instead
         */
        int (*hapd_set_ssid)(void *priv, const u8 *buf, int len);
 
@@ -1366,6 +1624,9 @@ struct wpa_driver_ops {
         * 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.
+        *
+        * With TDLS, this function is also used to add or set (params->set 1)
+        * TDLS peer entries.
         */
        int (*sta_add)(void *priv, struct hostapd_sta_add_params *params);
 
@@ -1433,33 +1694,9 @@ struct wpa_driver_ops {
                             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
+        * @queue: Queue number (0 = VO, 1 = VI, 2 = BE, 3 = BK)
         * @aifs: AIFS
         * @cw_min: cwMin
         * @cw_max: cwMax
@@ -1489,11 +1726,18 @@ struct wpa_driver_ops {
         * @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)
+        * @bridge: Bridge interface to use or %NULL if no bridge configured
         * 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);
+                     void **drv_priv, char *force_ifname, u8 *if_addr,
+                     const char *bridge);
 
        /**
         * if_remove - Remove a virtual interface
@@ -1567,34 +1811,36 @@ struct wpa_driver_ops {
        int (*set_radius_acl_expire)(void *priv, const u8 *mac);
 
        /**
-        * 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);
-
-       /**
-        * set_ap_wps_ie - Add WPS IE into Beacon/Probe Response frames (AP)
-        * @ifname: The interface name (main or virtual BSS)
+        * set_ap_wps_ie - Add WPS IE(s) into Beacon/Probe Response frames (AP)
         * @priv: Private driver interface data
-        * @beacon: WPS IE for Beacon frames
-        * @proberesp: WPS IE for Probe Response frames
+        * @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.
+        * to %NULL) if the driver uses the Beacon template from set_ap()
+        * 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.
+        *
+        * DEPRECATED - use set_ap() instead
         */
-       int (*set_ap_wps_ie)(const char *ifname, void *priv,
-                            const struct wpabuf *beacon,
-                            const struct wpabuf *proberesp);
+       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
@@ -1610,14 +1856,18 @@ struct wpa_driver_ops {
         * @addr: MAC address of the associated station
         * @aid: Association ID
         * @val: 1 = bind to 4-address WDS; 0 = unbind
+        * @bridge_ifname: Bridge interface to use for the WDS station or %NULL
+        *      to indicate that bridge is not to be used
         * Returns: 0 on success, -1 on failure
         */
-       int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val);
+       int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val,
+                          const char *bridge_ifname);
 
        /**
         * send_action - Transmit an Action frame
         * @priv: Private driver interface data
         * @freq: Frequency (in MHz) of the channel
+        * @wait: Time to wait off-channel for a response (in ms), or zero
         * @dst: Destination MAC address (Address 1)
         * @src: Source MAC address (Address 2)
         * @bssid: BSSID (Address 3)
@@ -1626,49 +1876,31 @@ struct wpa_driver_ops {
         * 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);
-
-       /**
-        * alloc_interface_addr - Allocate a virtual interface address
-        * @priv: Private driver interface data
-        * @addr: Buffer for returning the address
-        * @ifname: Buffer for returning interface name (if needed)
-        * Returns: 0 on success, -1 on failure
+        * frame to the specified destination.
         *
-        * This command pre-allocates an interface address for a new virtual
-        * interface. This can be used before creating a virtual interface if
-        * the interface mode (e.g., AP vs. station) is not yet known, but the
-        * address of the virtual interface is already needed. This helps with
-        * drivers that cannot change interface mode without destroying and
-        * re-creating the interface. If the driver requires a specific
-        * interface name to be used, the ifname buffer (up to IFNAMSIZ
-        * characters) will be used to indicate which name must be used for
-        * this virtual interface.
+        * If the %WPA_DRIVER_FLAGS_OFFCHANNEL_TX flag is set, the frame will
+        * be transmitted on the given channel and the device will wait for a
+        * response on that channel for the given wait time.
         *
-        * The allocated address can be used in a if_add() call to request a
-        * specific bssid.
+        * If the flag is not set, the wait time will be ignored. In this case,
+        * if a remain-on-channel duration is in progress, the frame must be
+        * transmitted on that channel; alternatively the frame may be sent on
+        * the current operational channel (if in associated state in station
+        * mode or while operating as an AP.)
         */
-       int (*alloc_interface_addr)(void *priv, u8 *addr, char *ifname);
+       int (*send_action)(void *priv, unsigned int freq, unsigned int wait,
+                          const u8 *dst, const u8 *src, const u8 *bssid,
+                          const u8 *data, size_t data_len);
 
        /**
-        * release_interface_addr - Release a virtual interface address
+        * send_action_cancel_wait - Cancel action frame TX wait
         * @priv: Private driver interface data
-        * @addr: Address to be freed from alloc_interface_addr()
         *
-        * This command is used to release a virtual interface address that was
-        * allocated with alloc_interface_addr(), but has not yet been used
-        * with if_add() to actually create the interface. This allows the
-        * driver to release the pending allocation for a new interface.
+        * This command cancels the wait time associated with sending an action
+        * frame. It is only available when %WPA_DRIVER_FLAGS_OFFCHANNEL_TX is
+        * set in the driver flags.
         */
-       void (*release_interface_addr)(void *priv, const u8 *addr);
+       void (*send_action_cancel_wait)(void *priv);
 
        /**
         * remain_on_channel - Remain awake on a channel
@@ -1759,54 +1991,538 @@ struct wpa_driver_ops {
         * @priv: Private driver interface data
         */
        void (*resume)(void *priv);
-};
 
-
-/**
- * enum wpa_event_type - Event type for wpa_supplicant_event() calls
- */
-enum wpa_event_type {
        /**
-        * EVENT_ASSOC - Association completed
+        * 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 event needs to be delivered when the driver completes IEEE
-        * 802.11 association or reassociation successfully.
-        * wpa_driver_ops::get_bssid() is expected to provide the current BSSID
-        * after this event has been generated. In addition, optional
-        * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
-        * more information about the association. If the driver interface gets
-        * both of these events at the same time, it can also include the
-        * assoc_info data in EVENT_ASSOC call.
+        * 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.
         */
-       EVENT_ASSOC,
+       int (*signal_monitor)(void *priv, int threshold, int hysteresis);
 
        /**
-        * EVENT_DISASSOC - Association lost
+        * 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 event should be called when association is lost either due to
-        * receiving deauthenticate or disassociate frame from the AP or when
-        * 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.
+        * This function is only used for debugging purposes and is not
+        * required to be implemented for normal operations.
         */
-       EVENT_DISASSOC,
+       int (*send_frame)(void *priv, const u8 *data, size_t data_len,
+                         int encrypt);
 
        /**
-        * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
+        * 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 event must be delivered when a Michael MIC error is detected by
-        * the local driver. Additional data for event processing is
-        * provided with union wpa_event_data::michael_mic_failure. This
-        * information is used to request new encyption key and to initiate
-        * TKIP countermeasures if needed.
+        * 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.
         */
-       EVENT_MICHAEL_MIC_FAILURE,
+       int (*shared_freq)(void *priv);
 
        /**
-        * EVENT_SCAN_RESULTS - Scan results available
+        * 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 event must be called whenever scan results are available to be
+        * 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);
+
+       /**
+        * get_radio_name - Get physical radio name for the device
+        * @priv: Private driver interface data
+        * Returns: Radio name or %NULL if not known
+        *
+        * The returned data must not be modified by the caller. It is assumed
+        * that any interface that has the same radio name as another is
+        * sharing the same physical radio. This information can be used to
+        * share scan results etc. information between the virtual interfaces
+        * to speed up various operations.
+        */
+       const char * (*get_radio_name)(void *priv);
+
+       /**
+        * p2p_find - Start P2P Device Discovery
+        * @priv: Private driver interface data
+        * @timeout: Timeout for find operation in seconds or 0 for no timeout
+        * @type: Device Discovery type (enum p2p_discovery_type)
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function is only used if the driver implements P2P management,
+        * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
+        * struct wpa_driver_capa.
+        */
+       int (*p2p_find)(void *priv, unsigned int timeout, int type);
+
+       /**
+        * p2p_stop_find - Stop P2P Device Discovery
+        * @priv: Private driver interface data
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function is only used if the driver implements P2P management,
+        * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
+        * struct wpa_driver_capa.
+        */
+       int (*p2p_stop_find)(void *priv);
+
+       /**
+        * p2p_listen - Start P2P Listen state for specified duration
+        * @priv: Private driver interface data
+        * @timeout: Listen state duration in milliseconds
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function can be used to request the P2P module to keep the
+        * device discoverable on the listen channel for an extended set of
+        * time. At least in its current form, this is mainly used for testing
+        * purposes and may not be of much use for normal P2P operations.
+        *
+        * This function is only used if the driver implements P2P management,
+        * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
+        * struct wpa_driver_capa.
+        */
+       int (*p2p_listen)(void *priv, unsigned int timeout);
+
+       /**
+        * p2p_connect - Start P2P group formation (GO negotiation)
+        * @priv: Private driver interface data
+        * @peer_addr: MAC address of the peer P2P client
+        * @wps_method: enum p2p_wps_method value indicating config method
+        * @go_intent: Local GO intent value (1..15)
+        * @own_interface_addr: Intended interface address to use with the
+        *      group
+        * @force_freq: The only allowed channel frequency in MHz or 0
+        * @persistent_group: Whether to create persistent group
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function is only used if the driver implements P2P management,
+        * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
+        * struct wpa_driver_capa.
+        */
+       int (*p2p_connect)(void *priv, const u8 *peer_addr, int wps_method,
+                          int go_intent, const u8 *own_interface_addr,
+                          unsigned int force_freq, int persistent_group);
+
+       /**
+        * wps_success_cb - Report successfully completed WPS provisioning
+        * @priv: Private driver interface data
+        * @peer_addr: Peer address
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function is used to report successfully completed WPS
+        * provisioning during group formation in both GO/Registrar and
+        * client/Enrollee roles.
+        *
+        * This function is only used if the driver implements P2P management,
+        * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
+        * struct wpa_driver_capa.
+        */
+       int (*wps_success_cb)(void *priv, const u8 *peer_addr);
+
+       /**
+        * p2p_group_formation_failed - Report failed WPS provisioning
+        * @priv: Private driver interface data
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function is used to report failed group formation. This can
+        * happen either due to failed WPS provisioning or due to 15 second
+        * timeout during the provisioning phase.
+        *
+        * This function is only used if the driver implements P2P management,
+        * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
+        * struct wpa_driver_capa.
+        */
+       int (*p2p_group_formation_failed)(void *priv);
+
+       /**
+        * p2p_set_params - Set P2P parameters
+        * @priv: Private driver interface data
+        * @params: P2P parameters
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function is only used if the driver implements P2P management,
+        * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
+        * struct wpa_driver_capa.
+        */
+       int (*p2p_set_params)(void *priv, const struct p2p_params *params);
+
+       /**
+        * p2p_prov_disc_req - Send Provision Discovery Request
+        * @priv: Private driver interface data
+        * @peer_addr: MAC address of the peer P2P client
+        * @config_methods: WPS Config Methods value (only one bit set)
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function can be used to request a discovered P2P peer to
+        * display a PIN (config_methods = WPS_CONFIG_DISPLAY) or be prepared
+        * to enter a PIN from us (config_methods = WPS_CONFIG_KEYPAD). The
+        * Provision Discovery Request frame is transmitted once immediately
+        * and if no response is received, the frame will be sent again
+        * whenever the target device is discovered during device dsicovery
+        * (start with a p2p_find() call). Response from the peer is indicated
+        * with the EVENT_P2P_PROV_DISC_RESPONSE event.
+        *
+        * This function is only used if the driver implements P2P management,
+        * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
+        * struct wpa_driver_capa.
+        */
+       int (*p2p_prov_disc_req)(void *priv, const u8 *peer_addr,
+                                u16 config_methods);
+
+       /**
+        * p2p_sd_request - Schedule a service discovery query
+        * @priv: Private driver interface data
+        * @dst: Destination peer or %NULL to apply for all peers
+        * @tlvs: P2P Service Query TLV(s)
+        * Returns: Reference to the query or 0 on failure
+        *
+        * Response to the query is indicated with the
+        * EVENT_P2P_SD_RESPONSE driver event.
+        *
+        * This function is only used if the driver implements P2P management,
+        * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
+        * struct wpa_driver_capa.
+        */
+       u64 (*p2p_sd_request)(void *priv, const u8 *dst,
+                             const struct wpabuf *tlvs);
+
+       /**
+        * p2p_sd_cancel_request - Cancel a pending service discovery query
+        * @priv: Private driver interface data
+        * @req: Query reference from p2p_sd_request()
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function is only used if the driver implements P2P management,
+        * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
+        * struct wpa_driver_capa.
+        */
+       int (*p2p_sd_cancel_request)(void *priv, u64 req);
+
+       /**
+        * p2p_sd_response - Send response to a service discovery query
+        * @priv: Private driver interface data
+        * @freq: Frequency from EVENT_P2P_SD_REQUEST event
+        * @dst: Destination address from EVENT_P2P_SD_REQUEST event
+        * @dialog_token: Dialog token from EVENT_P2P_SD_REQUEST event
+        * @resp_tlvs: P2P Service Response TLV(s)
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function is called as a response to the request indicated with
+        * the EVENT_P2P_SD_REQUEST driver event.
+        *
+        * This function is only used if the driver implements P2P management,
+        * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
+        * struct wpa_driver_capa.
+        */
+       int (*p2p_sd_response)(void *priv, int freq, const u8 *dst,
+                              u8 dialog_token,
+                              const struct wpabuf *resp_tlvs);
+
+       /**
+        * p2p_service_update - Indicate a change in local services
+        * @priv: Private driver interface data
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function needs to be called whenever there is a change in
+        * availability of the local services. This will increment the
+        * Service Update Indicator value which will be used in SD Request and
+        * Response frames.
+        *
+        * This function is only used if the driver implements P2P management,
+        * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
+        * struct wpa_driver_capa.
+        */
+       int (*p2p_service_update)(void *priv);
+
+       /**
+        * p2p_reject - Reject peer device (explicitly block connections)
+        * @priv: Private driver interface data
+        * @addr: MAC address of the peer
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*p2p_reject)(void *priv, const u8 *addr);
+
+       /**
+        * p2p_invite - Invite a P2P Device into a group
+        * @priv: Private driver interface data
+        * @peer: Device Address of the peer P2P Device
+        * @role: Local role in the group
+        * @bssid: Group BSSID or %NULL if not known
+        * @ssid: Group SSID
+        * @ssid_len: Length of ssid in octets
+        * @go_dev_addr: Forced GO Device Address or %NULL if none
+        * @persistent_group: Whether this is to reinvoke a persistent group
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*p2p_invite)(void *priv, const u8 *peer, int role,
+                         const u8 *bssid, const u8 *ssid, size_t ssid_len,
+                         const u8 *go_dev_addr, int persistent_group);
+
+       /**
+        * send_tdls_mgmt - for sending TDLS management packets
+        * @priv: private driver interface data
+        * @dst: Destination (peer) MAC address
+        * @action_code: TDLS action code for the mssage
+        * @dialog_token: Dialog Token to use in the message (if needed)
+        * @status_code: Status Code or Reason Code to use (if needed)
+        * @buf: TDLS IEs to add to the message
+        * @len: Length of buf in octets
+        * Returns: 0 on success, negative (<0) on failure
+        *
+        * This optional function can be used to send packet to driver which is
+        * responsible for receiving and sending all TDLS packets.
+        */
+       int (*send_tdls_mgmt)(void *priv, const u8 *dst, u8 action_code,
+                             u8 dialog_token, u16 status_code,
+                             const u8 *buf, size_t len);
+
+       /**
+        * tdls_oper - Ask the driver to perform high-level TDLS operations
+        * @priv: Private driver interface data
+        * @oper: TDLS high-level operation. See %enum tdls_oper
+        * @peer: Destination (peer) MAC address
+        * Returns: 0 on success, negative (<0) on failure
+        *
+        * This optional function can be used to send high-level TDLS commands
+        * to the driver.
+        */
+       int (*tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer);
+
+       /**
+        * signal_poll - Get current connection information
+        * @priv: Private driver interface data
+        * @signal_info: Connection info structure
+         */
+       int (*signal_poll)(void *priv, struct wpa_signal_info *signal_info);
+
+       /**
+        * set_authmode - Set authentication algorithm(s) for static WEP
+        * @priv: Private driver interface data
+        * @authmode: 1=Open System, 2=Shared Key, 3=both
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function can be used to set authentication algorithms for AP
+        * mode when static WEP is used. If the driver uses user space MLME/SME
+        * implementation, there is no need to implement this function.
+        *
+        * DEPRECATED - use set_ap() instead
+        */
+       int (*set_authmode)(void *priv, int authmode);
+
+       /**
+        * set_rekey_info - Set rekey information
+        * @priv: Private driver interface data
+        * @kek: Current KEK
+        * @kck: Current KCK
+        * @replay_ctr: Current EAPOL-Key Replay Counter
+        *
+        * This optional function can be used to provide information for the
+        * driver/firmware to process EAPOL-Key frames in Group Key Handshake
+        * while the host (including wpa_supplicant) is sleeping.
+        */
+       void (*set_rekey_info)(void *priv, const u8 *kek, const u8 *kck,
+                              const u8 *replay_ctr);
+
+       /**
+        * sta_assoc - Station association indication
+        * @priv: Private driver interface data
+        * @own_addr: Source address and BSSID for association frame
+        * @addr: MAC address of the station to associate
+        * @reassoc: flag to indicate re-association
+        * @status: association response status code
+        * @ie: assoc response ie buffer
+        * @len: ie buffer length
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function indicates the driver to send (Re)Association
+        * Response frame to the station.
+        */
+        int (*sta_assoc)(void *priv, const u8 *own_addr, const u8 *addr,
+                         int reassoc, u16 status, const u8 *ie, size_t len);
+
+       /**
+        * sta_auth - Station authentication indication
+        * @priv: Private driver interface data
+        * @own_addr: Source address and BSSID for authentication frame
+        * @addr: MAC address of the station to associate
+        * @seq: authentication sequence number
+        * @status: authentication response status code
+        * @ie: authentication frame ie buffer
+        * @len: ie buffer length
+        *
+        * This function indicates the driver to send Authentication frame
+        * to the station.
+        */
+        int (*sta_auth)(void *priv, const u8 *own_addr, const u8 *addr,
+                        u16 seq, u16 status, const u8 *ie, size_t len);
+
+       /**
+        * add_tspec - Add traffic stream
+        * @priv: Private driver interface data
+        * @addr: MAC address of the station to associate
+        * @tspec_ie: tspec ie buffer
+        * @tspec_ielen: tspec ie length
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function adds the traffic steam for the station
+        * and fills the medium_time in tspec_ie.
+        */
+        int (*add_tspec)(void *priv, const u8 *addr, u8 *tspec_ie,
+                         size_t tspec_ielen);
+
+       /**
+        * add_sta_node - Add a station node in the driver
+        * @priv: Private driver interface data
+        * @addr: MAC address of the station to add
+        * @auth_alg: authentication algorithm used by the station
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function adds the station node in the driver, when
+        * the station gets added by FT-over-DS.
+        */
+       int (*add_sta_node)(void *priv, const u8 *addr, u16 auth_alg);
+
+       /**
+        * sched_scan - Request the driver to initiate scheduled scan
+        * @priv: Private driver interface data
+        * @params: Scan parameters
+        * @interval: Interval between scan cycles in milliseconds
+        * Returns: 0 on success, -1 on failure
+        *
+        * This operation should be used for scheduled scan offload to
+        * the hardware. Every time scan results are available, the
+        * driver should report scan results event for wpa_supplicant
+        * which will eventually request the results with
+        * wpa_driver_get_scan_results2(). This operation is optional
+        * and if not provided or if it returns -1, we fall back to
+        * normal host-scheduled scans.
+        */
+       int (*sched_scan)(void *priv, struct wpa_driver_scan_params *params,
+                         u32 interval);
+
+       /**
+        * stop_sched_scan - Request the driver to stop a scheduled scan
+        * @priv: Private driver interface data
+        * Returns: 0 on success, -1 on failure
+        *
+        * This should cause the scheduled scan to be stopped and
+        * results should stop being sent. Must be supported if
+        * sched_scan is supported.
+        */
+       int (*stop_sched_scan)(void *priv);
+
+       /**
+        * poll_client - Probe (null data or such) the given station
+        * @priv: Private driver interface data
+        * @own_addr: MAC address of sending interface
+        * @addr: MAC address of the station to probe
+        * @qos: Indicates whether station is QoS station
+        *
+        * This function is used to verify whether an associated station is
+        * still present. This function does not need to be implemented if the
+        * driver provides such inactivity polling mechanism.
+        */
+       void (*poll_client)(void *priv, const u8 *own_addr,
+                           const u8 *addr, int qos);
+};
+
+
+/**
+ * enum wpa_event_type - Event type for wpa_supplicant_event() calls
+ */
+enum wpa_event_type {
+       /**
+        * EVENT_ASSOC - Association completed
+        *
+        * This event needs to be delivered when the driver completes IEEE
+        * 802.11 association or reassociation successfully.
+        * wpa_driver_ops::get_bssid() is expected to provide the current BSSID
+        * after this event has been generated. In addition, optional
+        * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
+        * more information about the association. If the driver interface gets
+        * both of these events at the same time, it can also include the
+        * assoc_info data in EVENT_ASSOC call.
+        */
+       EVENT_ASSOC,
+
+       /**
+        * EVENT_DISASSOC - Association lost
+        *
+        * This event should be called when association is lost either due to
+        * receiving deauthenticate or disassociate frame from the AP or when
+        * 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,
+
+       /**
+        * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
+        *
+        * This event must be delivered when a Michael MIC error is detected by
+        * the local driver. Additional data for event processing is
+        * provided with union wpa_event_data::michael_mic_failure. This
+        * information is used to request new encyption key and to initiate
+        * TKIP countermeasures if needed.
+        */
+       EVENT_MICHAEL_MIC_FAILURE,
+
+       /**
+        * EVENT_SCAN_RESULTS - Scan results available
+        *
+        * This event must be called whenever scan results are available to be
         * fetched with struct wpa_driver_ops::get_scan_results(). This event
         * is expected to be used some time after struct wpa_driver_ops::scan()
         * is called. If the driver provides an unsolicited event when the scan
@@ -1881,6 +2597,13 @@ enum wpa_event_type {
        EVENT_STKSTART,
 
        /**
+        * EVENT_TDLS - Request TDLS operation
+        *
+        * This event can be used to request a TDLS operation to be performed.
+        */
+       EVENT_TDLS,
+
+       /**
         * EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs
         *
         * The driver is expected to report the received FT IEs from
@@ -1924,7 +2647,7 @@ enum wpa_event_type {
         * EVENT_ASSOC_REJECT - Association rejected
         *
         * This event should be called when (re)association attempt has been
-        * rejected by the AP. Information about authentication result is
+        * rejected by the AP. Information about the association response is
         * included in union wpa_event_data::assoc_reject.
         */
        EVENT_ASSOC_REJECT,
@@ -2031,7 +2754,153 @@ enum wpa_event_type {
         * %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_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,
+
+       /**
+        * EVENT_CHANNEL_LIST_CHANGED - Channel list changed
+        *
+        * This event is used to indicate that the channel list has changed,
+        * e.g., because of a regulatory domain change triggered by scan
+        * results including an AP advertising a country code.
+        */
+       EVENT_CHANNEL_LIST_CHANGED,
+
+       /**
+        * EVENT_INTERFACE_UNAVAILABLE - Notify that interface is unavailable
+        *
+        * This event is used to indicate that the driver cannot maintain this
+        * interface in its operation mode anymore. The most likely use for
+        * this is to indicate that AP mode operation is not available due to
+        * operating channel would need to be changed to a DFS channel when
+        * the driver does not support radar detection and another virtual
+        * interfaces caused the operating channel to change. Other similar
+        * resource conflicts could also trigger this for station mode
+        * interfaces.
+        */
+       EVENT_INTERFACE_UNAVAILABLE,
+
+       /**
+        * EVENT_BEST_CHANNEL
+        *
+        * Driver generates this event whenever it detects a better channel
+        * (e.g., based on RSSI or channel use). This information can be used
+        * to improve channel selection for a new AP/P2P group.
+        */
+       EVENT_BEST_CHANNEL,
+
+       /**
+        * EVENT_UNPROT_DEAUTH - Unprotected Deauthentication frame received
+        *
+        * This event should be called when a Deauthentication frame is dropped
+        * due to it not being protected (MFP/IEEE 802.11w).
+        * union wpa_event_data::unprot_deauth is required to provide more
+        * details of the frame.
+        */
+       EVENT_UNPROT_DEAUTH,
+
+       /**
+        * EVENT_UNPROT_DISASSOC - Unprotected Disassociation frame received
+        *
+        * This event should be called when a Disassociation frame is dropped
+        * due to it not being protected (MFP/IEEE 802.11w).
+        * union wpa_event_data::unprot_disassoc is required to provide more
+        * details of the frame.
+        */
+       EVENT_UNPROT_DISASSOC,
+
+       /**
+        * EVENT_STATION_LOW_ACK
+        *
+        * Driver generates this event whenever it detected that a particular
+        * station was lost. Detection can be through massive transmission
+        * failures for example.
+        */
+       EVENT_STATION_LOW_ACK,
+
+       /**
+        * EVENT_P2P_DEV_FOUND - Report a discovered P2P device
+        *
+        * This event is used only if the driver implements P2P management
+        * internally. Event data is stored in
+        * union wpa_event_data::p2p_dev_found.
+        */
+       EVENT_P2P_DEV_FOUND,
+
+       /**
+        * EVENT_P2P_GO_NEG_REQ_RX - Report reception of GO Negotiation Request
+        *
+        * This event is used only if the driver implements P2P management
+        * internally. Event data is stored in
+        * union wpa_event_data::p2p_go_neg_req_rx.
+        */
+       EVENT_P2P_GO_NEG_REQ_RX,
+
+       /**
+        * EVENT_P2P_GO_NEG_COMPLETED - Report completion of GO Negotiation
+        *
+        * This event is used only if the driver implements P2P management
+        * internally. Event data is stored in
+        * union wpa_event_data::p2p_go_neg_completed.
+        */
+       EVENT_P2P_GO_NEG_COMPLETED,
+
+       EVENT_P2P_PROV_DISC_REQUEST,
+       EVENT_P2P_PROV_DISC_RESPONSE,
+       EVENT_P2P_SD_REQUEST,
+       EVENT_P2P_SD_RESPONSE,
+
+       /**
+        * EVENT_IBSS_PEER_LOST - IBSS peer not reachable anymore
+        */
+       EVENT_IBSS_PEER_LOST,
+
+       /**
+        * EVENT_DRIVER_GTK_REKEY - Device/driver did GTK rekey
+        *
+        * This event carries the new replay counter to notify wpa_supplicant
+        * of the current EAPOL-Key Replay Counter in case the driver/firmware
+        * completed Group Key Handshake while the host (including
+        * wpa_supplicant was sleeping).
+        */
+       EVENT_DRIVER_GTK_REKEY,
+
+       /**
+        * EVENT_SCHED_SCAN_STOPPED - Scheduled scan was stopped
+        */
+       EVENT_SCHED_SCAN_STOPPED,
+
+       /**
+        * EVENT_DRIVER_CLIENT_POLL_OK - Station responded to poll
+        *
+        * This event indicates that the station responded to the poll
+        * initiated with @poll_client.
+        */
+       EVENT_DRIVER_CLIENT_POLL_OK
 };
 
 
@@ -2049,6 +2918,11 @@ union wpa_event_data {
         */
        struct assoc_info {
                /**
+                * reassoc - Flag to indicate association or reassociation
+                */
+               int reassoc;
+
+               /**
                 * req_ies - (Re)Association Request IEs
                 *
                 * If the driver generates WPA/RSN IE, this event data must be
@@ -2125,6 +2999,22 @@ union wpa_event_data {
                 * 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;
 
        /**
@@ -2135,6 +3025,22 @@ union wpa_event_data {
                 * 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;
 
        /**
@@ -2175,6 +3081,18 @@ union wpa_event_data {
        } stkstart;
 
        /**
+        * struct tdls - Data for EVENT_TDLS
+        */
+       struct tdls {
+               u8 peer[ETH_ALEN];
+               enum {
+                       TDLS_REQUEST_SETUP,
+                       TDLS_REQUEST_TEARDOWN
+               } oper;
+               u16 reason_code; /* for teardown */
+       } tdls;
+
+       /**
         * struct ft_ies - FT information elements (EVENT_FT_RESPONSE)
         *
         * During FT (IEEE 802.11r) authentication sequence, the driver is
@@ -2206,7 +3124,9 @@ union wpa_event_data {
         */
        struct auth_info {
                u8 peer[ETH_ALEN];
+               u8 bssid[ETH_ALEN];
                u16 auth_type;
+               u16 auth_transaction;
                u16 status_code;
                const u8 *ies;
                size_t ies_len;
@@ -2217,6 +3137,11 @@ union wpa_event_data {
         */
        struct assoc_reject {
                /**
+                * bssid - BSSID of the AP that rejected association
+                */
+               const u8 *bssid;
+
+               /**
                 * resp_ies - (Re)Association Response IEs
                 *
                 * Optional association data from the driver. This data is not
@@ -2227,7 +3152,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
@@ -2269,8 +3194,9 @@ union wpa_event_data {
         * struct rx_from_unknown - Data for EVENT_RX_FROM_UNKNOWN events
         */
        struct rx_from_unknown {
-               const u8 *frame;
-               size_t len;
+               const u8 *bssid;
+               const u8 *addr;
+               int wds;
        } rx_from_unknown;
 
        /**
@@ -2378,6 +3304,18 @@ union wpa_event_data {
                const u8 *sa;
 
                /**
+                * da - Destination address of the received Probe Request frame
+                *      or %NULL if not available
+                */
+               const u8 *da;
+
+               /**
+                * bssid - BSSID of the received Probe Request frame or %NULL
+                *      if not available
+                */
+               const u8 *bssid;
+
+               /**
                 * ie - IEs from the Probe Request body
                 */
                const u8 *ie;
@@ -2403,6 +3341,128 @@ union wpa_event_data {
                const u8 *data;
                size_t data_len;
        } eapol_rx;
+
+       /**
+        * signal_change - Data for EVENT_SIGNAL_CHANGE events
+        */
+       struct wpa_signal_info signal_change;
+
+       /**
+        * struct best_channel - Data for EVENT_BEST_CHANNEL events
+        * @freq_24: Best 2.4 GHz band channel frequency in MHz
+        * @freq_5: Best 5 GHz band channel frequency in MHz
+        * @freq_overall: Best channel frequency in MHz
+        *
+        * 0 can be used to indicate no preference in either band.
+        */
+       struct best_channel {
+               int freq_24;
+               int freq_5;
+               int freq_overall;
+       } best_chan;
+
+       struct unprot_deauth {
+               const u8 *sa;
+               const u8 *da;
+               u16 reason_code;
+       } unprot_deauth;
+
+       struct unprot_disassoc {
+               const u8 *sa;
+               const u8 *da;
+               u16 reason_code;
+       } unprot_disassoc;
+
+       /**
+        * struct low_ack - Data for EVENT_STATION_LOW_ACK events
+        * @addr: station address
+        */
+       struct low_ack {
+               u8 addr[ETH_ALEN];
+       } low_ack;
+
+       /**
+        * struct p2p_dev_found - Data for EVENT_P2P_DEV_FOUND
+        */
+       struct p2p_dev_found {
+               const u8 *addr;
+               const u8 *dev_addr;
+               const u8 *pri_dev_type;
+               const char *dev_name;
+               u16 config_methods;
+               u8 dev_capab;
+               u8 group_capab;
+       } p2p_dev_found;
+
+       /**
+        * struct p2p_go_neg_req_rx - Data for EVENT_P2P_GO_NEG_REQ_RX
+        */
+       struct p2p_go_neg_req_rx {
+               const u8 *src;
+               u16 dev_passwd_id;
+       } p2p_go_neg_req_rx;
+
+       /**
+        * struct p2p_go_neg_completed - Data for EVENT_P2P_GO_NEG_COMPLETED
+        */
+       struct p2p_go_neg_completed {
+               struct p2p_go_neg_results *res;
+       } p2p_go_neg_completed;
+
+       struct p2p_prov_disc_req {
+               const u8 *peer;
+               u16 config_methods;
+               const u8 *dev_addr;
+               const u8 *pri_dev_type;
+               const char *dev_name;
+               u16 supp_config_methods;
+               u8 dev_capab;
+               u8 group_capab;
+       } p2p_prov_disc_req;
+
+       struct p2p_prov_disc_resp {
+               const u8 *peer;
+               u16 config_methods;
+       } p2p_prov_disc_resp;
+
+       struct p2p_sd_req {
+               int freq;
+               const u8 *sa;
+               u8 dialog_token;
+               u16 update_indic;
+               const u8 *tlvs;
+               size_t tlvs_len;
+       } p2p_sd_req;
+
+       struct p2p_sd_resp {
+               const u8 *sa;
+               u16 update_indic;
+               const u8 *tlvs;
+               size_t tlvs_len;
+       } p2p_sd_resp;
+
+       /**
+        * struct ibss_peer_lost - Data for EVENT_IBSS_PEER_LOST
+        */
+       struct ibss_peer_lost {
+               u8 peer[ETH_ALEN];
+       } ibss_peer_lost;
+
+       /**
+        * struct driver_gtk_rekey - Data for EVENT_DRIVER_GTK_REKEY
+        */
+       struct driver_gtk_rekey {
+               const u8 *bssid;
+               const u8 *replay_ctr;
+       } driver_gtk_rekey;
+
+       /**
+        * struct client_poll - Data for EVENT_DRIVER_CLIENT_POLL_OK events
+        * @addr: station address
+        */
+       struct client_poll {
+               u8 addr[ETH_ALEN];
+       } client_poll;
 };
 
 /**
@@ -2425,10 +3485,11 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
  */
 
 static inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie,
-                                  size_t ielen)
+                                  size_t ielen, int reassoc)
 {
        union wpa_event_data event;
        os_memset(&event, 0, sizeof(event));
+       event.assoc_info.reassoc = reassoc;
        event.assoc_info.req_ies = ie;
        event.assoc_info.req_ies_len = ielen;
        event.assoc_info.addr = addr;
@@ -2454,4 +3515,17 @@ static inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data,
        wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);
 }
 
+static inline void wpa_scan_results_free(struct wpa_scan_results *res)
+{
+       size_t i;
+
+       if (res == NULL)
+               return;
+
+       for (i = 0; i < res->num; i++)
+               os_free(res->res[i]);
+       os_free(res->res);
+       os_free(res);
+}
+
 #endif /* DRIVER_H */