]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - src/drivers/driver.h
wpa_supplicant: Support VHT capability overrides
[thirdparty/hostap.git] / src / drivers / driver.h
index 816377b858eb99826ee6523e0d11957b3562dcf7..1a53db329a98def9be84cfe21fada0ad6006e011 100644 (file)
@@ -1,15 +1,9 @@
 /*
  * Driver interface definition
- * Copyright (c) 2003-2010, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2003-2012, 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
- * published by the Free Software Foundation.
- *
- * Alternatively, this software may be distributed under the terms of BSD
- * license.
- *
- * See README and COPYING for more details.
+ * This software may be distributed under the terms of the BSD license.
+ * See README 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
@@ -47,7 +41,7 @@ struct hostapd_channel_data {
        /**
         * freq - Frequency in MHz
         */
-       short freq;
+       int freq;
 
        /**
         * flag - Channel flags (HOSTAPD_CHAN_*)
@@ -106,6 +100,16 @@ struct hostapd_hw_modes {
         */
        u8 a_mpdu_params;
 
+       /**
+        * vht_capab - VHT (IEEE 802.11ac) capabilities
+        */
+       u32 vht_capab;
+
+       /**
+        * vht_mcs_set - VHT MCS (IEEE 802.11ac) rate parameters
+        */
+       u8 vht_mcs_set[8];
+
        unsigned int flags; /* HOSTAPD_MODE_FLAG_* */
 };
 
@@ -118,6 +122,13 @@ struct hostapd_hw_modes {
 #define IEEE80211_CAP_IBSS     0x0002
 #define IEEE80211_CAP_PRIVACY  0x0010
 
+/* DMG (60 GHz) IEEE 802.11ad */
+/* type - bits 0..1 */
+#define IEEE80211_CAP_DMG_MASK 0x0003
+#define IEEE80211_CAP_DMG_IBSS 0x0001 /* Tx by: STA */
+#define IEEE80211_CAP_DMG_PBSS 0x0002 /* Tx by: PCP */
+#define IEEE80211_CAP_DMG_AP   0x0003 /* Tx by: AP */
+
 #define WPA_SCAN_QUAL_INVALID          BIT(0)
 #define WPA_SCAN_NOISE_INVALID         BIT(1)
 #define WPA_SCAN_LEVEL_INVALID         BIT(2)
@@ -176,10 +187,12 @@ struct wpa_scan_res {
  * struct wpa_scan_results - Scan results
  * @res: Array of pointers to allocated variable length scan result entries
  * @num: Number of entries in the scan result array
+ * @fetch_time: Time when the results were fetched from the driver
  */
 struct wpa_scan_results {
        struct wpa_scan_res **res;
        size_t num;
+       struct os_time fetch_time;
 };
 
 /**
@@ -269,6 +282,15 @@ struct wpa_driver_scan_params {
         */
        size_t num_filter_ssids;
 
+       /**
+        * filter_rssi - Filter by RSSI
+        *
+        * The driver may filter scan results in firmware to reduce host
+        * wakeups and thereby save power. Specify the RSSI threshold in s32
+        * dBm.
+        */
+       s32 filter_rssi;
+
        /**
         * p2p_probe - Used to disable CCK (802.11b) rates for P2P probes
         *
@@ -301,6 +323,9 @@ struct wpa_driver_auth_params {
         */
        int p2p;
 
+       const u8 *sae_data;
+       size_t sae_data_len;
+
 };
 
 enum wps_mode {
@@ -338,6 +363,13 @@ struct wpa_driver_associate_params {
         */
        int freq;
 
+       /**
+        * bg_scan_period - Background scan period in seconds, 0 to disable
+        * background scan, or -1 to indicate no change to default driver
+        * configuration
+        */
+       int bg_scan_period;
+
        /**
         * wpa_ie - WPA information element for (Re)Association Request
         * WPA information element to be included in (Re)Association
@@ -516,6 +548,39 @@ struct wpa_driver_associate_params {
         * STA mode: bits 0..3 UAPSD enabled for VO,VI,BK,BE
         */
        int uapsd;
+
+       /**
+        * fixed_bssid - Whether to force this BSSID in IBSS mode
+        * 1 = Fix this BSSID and prevent merges.
+        * 0 = Do not fix BSSID.
+        */
+       int fixed_bssid;
+
+       /**
+        * disable_ht - Disable HT (IEEE 802.11n) for this connection
+        */
+       int disable_ht;
+
+       /**
+        * HT Capabilities over-rides. Only bits set in the mask will be used,
+        * and not all values are used by the kernel anyway. Currently, MCS,
+        * MPDU and MSDU fields are used.
+        */
+       const u8 *htcaps;       /* struct ieee80211_ht_capabilities * */
+       const u8 *htcaps_mask;  /* struct ieee80211_ht_capabilities * */
+
+#ifdef CONFIG_VHT_OVERRIDES
+       /**
+        * disable_vht - Disable VHT for this connection
+        */
+       int disable_vht;
+
+       /**
+        * VHT capability overrides.
+        */
+       const struct ieee80211_vht_capabilities *vhtcaps;
+       const struct ieee80211_vht_capabilities *vhtcaps_mask;
+#endif /* CONFIG_VHT_OVERRIDES */
 };
 
 enum hide_ssid {
@@ -555,6 +620,27 @@ struct wpa_driver_ap_params {
         */
        int beacon_int;
 
+       /**
+        * basic_rates: -1 terminated array of basic rates in 100 kbps
+        *
+        * This parameter can be used to set a specific basic rate set for the
+        * BSS. If %NULL, default basic rate set is used.
+        */
+       int *basic_rates;
+
+       /**
+        * proberesp - Probe Response template
+        *
+        * This is used by drivers that reply to Probe Requests internally in
+        * AP mode and require the full Probe Response template.
+        */
+       const u8 *proberesp;
+
+       /**
+        * proberesp_len - Length of the proberesp buffer in octets
+        */
+       size_t proberesp_len;
+
        /**
         * ssid - The SSID to use in Beacon/Probe Response frames
         */
@@ -672,6 +758,18 @@ struct wpa_driver_ap_params {
         * enabled.
         */
        u8 access_network_type;
+
+       /**
+        * ap_max_inactivity - Timeout in seconds to detect STA's inactivity
+        *
+        * This is used by driver which advertises this capability.
+        */
+       int ap_max_inactivity;
+
+       /**
+        * disable_dgaf - Whether group-addressed frames are disabled
+        */
+       int disable_dgaf;
 };
 
 /**
@@ -685,12 +783,15 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE      0x00000010
 #define WPA_DRIVER_CAPA_KEY_MGMT_FT            0x00000020
 #define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK                0x00000040
+#define WPA_DRIVER_CAPA_KEY_MGMT_WAPI_PSK      0x00000080
        unsigned int key_mgmt;
 
 #define WPA_DRIVER_CAPA_ENC_WEP40      0x00000001
 #define WPA_DRIVER_CAPA_ENC_WEP104     0x00000002
 #define WPA_DRIVER_CAPA_ENC_TKIP       0x00000004
 #define WPA_DRIVER_CAPA_ENC_CCMP       0x00000008
+#define WPA_DRIVER_CAPA_ENC_WEP128     0x00000010
+#define WPA_DRIVER_CAPA_ENC_GCMP       0x00000020
        unsigned int enc;
 
 #define WPA_DRIVER_AUTH_OPEN           0x00000001
@@ -751,6 +852,18 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS_TDLS_SUPPORT                  0x00080000
 /* Driver requires external TDLS setup/teardown/discovery */
 #define WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP           0x00100000
+/* Driver indicates support for Probe Response offloading in AP mode */
+#define WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD            0x00200000
+/* Driver supports U-APSD in AP mode */
+#define WPA_DRIVER_FLAGS_AP_UAPSD                      0x00400000
+/* Driver supports inactivity timer in AP mode */
+#define WPA_DRIVER_FLAGS_INACTIVITY_TIMER              0x00800000
+/* Driver expects user space implementation of MLME in AP mode */
+#define WPA_DRIVER_FLAGS_AP_MLME                       0x01000000
+/* Driver supports SAE with user space SME */
+#define WPA_DRIVER_FLAGS_SAE                           0x02000000
+/* Driver makes use of OBSS scan mechanism in wpa_supplicant */
+#define WPA_DRIVER_FLAGS_OBSS_SCAN                     0x04000000
        unsigned int flags;
 
        int max_scan_ssids;
@@ -768,6 +881,20 @@ struct wpa_driver_capa {
         * supports in AP mode
         */
        unsigned int max_stations;
+
+       /**
+        * probe_resp_offloads - Bitmap of supported protocols by the driver
+        * for Probe Response offloading.
+        */
+/* Driver Probe Response offloading support for WPS ver. 1 */
+#define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS              0x00000001
+/* Driver Probe Response offloading support for WPS ver. 2 */
+#define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS2             0x00000002
+/* Driver Probe Response offloading support for P2P */
+#define WPA_DRIVER_PROBE_RESP_OFFLOAD_P2P              0x00000004
+/* Driver Probe Response offloading support for IEEE 802.11u (Interworking) */
+#define WPA_DRIVER_PROBE_RESP_OFFLOAD_INTERWORKING     0x00000008
+       unsigned int probe_resp_offloads;
 };
 
 
@@ -793,18 +920,31 @@ struct hostapd_sta_add_params {
        size_t supp_rates_len;
        u16 listen_interval;
        const struct ieee80211_ht_capabilities *ht_capabilities;
+       const struct ieee80211_vht_capabilities *vht_capabilities;
        u32 flags; /* bitmask of WPA_STA_* flags */
        int set; /* Set STA parameters instead of add */
+       u8 qosinfo;
+       const u8 *ext_capab;
+       size_t ext_capab_len;
 };
 
 struct hostapd_freq_params {
        int mode;
        int freq;
        int channel;
+       /* for HT */
        int ht_enabled;
        int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled,
                                 * secondary channel below primary, 1 = HT40
                                 * enabled, secondary channel above primary */
+
+       /* for VHT */
+       int vht_enabled;
+
+       /* valid for both HT and VHT, center_freq2 is non-zero
+        * only for bandwidth 80 and an 80+80 channel */
+       int center_freq1, center_freq2;
+       int bandwidth;
 };
 
 enum wpa_driver_if_type {
@@ -902,6 +1042,23 @@ enum tdls_oper {
        TDLS_DISABLE
 };
 
+enum wnm_oper {
+       WNM_SLEEP_ENTER_CONFIRM,
+       WNM_SLEEP_ENTER_FAIL,
+       WNM_SLEEP_EXIT_CONFIRM,
+       WNM_SLEEP_EXIT_FAIL,
+       WNM_SLEEP_TFS_REQ_IE_ADD,   /* STA requests driver to add TFS req IE */
+       WNM_SLEEP_TFS_REQ_IE_NONE,  /* STA requests empty TFS req IE */
+       WNM_SLEEP_TFS_REQ_IE_SET,   /* AP requests driver to set TFS req IE for
+                                    * a STA */
+       WNM_SLEEP_TFS_RESP_IE_ADD,  /* AP requests driver to add TFS resp IE
+                                    * for a STA */
+       WNM_SLEEP_TFS_RESP_IE_NONE, /* AP requests empty TFS resp IE */
+       WNM_SLEEP_TFS_RESP_IE_SET,  /* AP requests driver to set TFS resp IE
+                                    * for a STA */
+       WNM_SLEEP_TFS_IE_DEL        /* AP delete the TFS IE */
+};
+
 /**
  * struct wpa_signal_info - Information about channel signal quality
  */
@@ -961,7 +1118,8 @@ struct wpa_driver_ops {
         * @ifname: Interface name (for multi-SSID/VLAN support)
         * @priv: private driver interface data
         * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
-        *      %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK);
+        *      %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK,
+        *      %WPA_ALG_GCMP);
         *      %WPA_ALG_NONE clears the key.
         * @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
@@ -978,11 +1136,11 @@ struct wpa_driver_ops {
         *      for Rx keys (in most cases, this is only used with broadcast
         *      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
+        *      TKIP: 6 octets, CCMP/GCMP: 6 octets, IGTK: 6 octets
         * @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key,
         *      8-byte Rx Mic Key
         * @key_len: length of the key buffer in octets (WEP: 5 or 13,
-        *      TKIP: 32, CCMP: 16, IGTK: 16)
+        *      TKIP: 32, CCMP/GCMP: 16, IGTK: 16)
         *
         * Returns: 0 on success, -1 on failure
         *
@@ -1078,17 +1236,6 @@ struct wpa_driver_ops {
         */
        int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
 
-       /**
-        * disassociate - Request driver to disassociate
-        * @priv: private driver interface data
-        * @addr: peer address (BSSID of the AP)
-        * @reason_code: 16-bit reason code to be sent in the disassociation
-        *      frame
-        *
-        * Returns: 0 on success, -1 on failure
-        */
-       int (*disassociate)(void *priv, const u8 *addr, int reason_code);
-
        /**
         * associate - Request driver to associate
         * @priv: private driver interface data
@@ -1487,9 +1634,9 @@ struct wpa_driver_ops {
         * 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).
+        * a TKIP, CCMP, GCMP, 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);
@@ -1522,7 +1669,7 @@ struct wpa_driver_ops {
        int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len);
 
        /**
-        * read_sta_data - Fetch station data (AP only)
+        * read_sta_data - Fetch station data
         * @priv: Private driver interface data
         * @data: Buffer for returning station information
         * @addr: MAC address of the station
@@ -1684,14 +1831,6 @@ struct wpa_driver_ops {
        int (*sta_set_flags)(void *priv, const u8 *addr,
                             int total_flags, int flags_or, int flags_and);
 
-       /**
-        * set_rate_sets - Set basic rate set (AP only)
-        * @priv: Private driver interface data
-        * @basic_rates: -1 terminated array of basic rates in 100 kbps
-        * Returns: 0 on success, -1 on failure
-        */
-       int (*set_rate_sets)(void *priv, int *basic_rates);
-
        /**
         * set_tx_queue_params - Set TX queue parameters
         * @priv: Private driver interface data
@@ -1956,6 +2095,16 @@ struct wpa_driver_ops {
         */
        int (*deinit_ap)(void *priv);
 
+       /**
+        * deinit_p2p_cli - Deinitialize P2P client 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 P2P client mode. It
+        * can be used to change the interface type back to station mode.
+        */
+       int (*deinit_p2p_cli)(void *priv);
+
        /**
         * suspend - Notification on system suspend/hibernate event
         * @priv: Private driver interface data
@@ -2194,7 +2343,7 @@ struct wpa_driver_ops {
         * struct wpa_driver_capa.
         */
        int (*p2p_prov_disc_req)(void *priv, const u8 *peer_addr,
-                                u16 config_methods);
+                                u16 config_methods, int join);
 
        /**
         * p2p_sd_request - Schedule a service discovery query
@@ -2315,6 +2464,18 @@ struct wpa_driver_ops {
         */
        int (*tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer);
 
+       /**
+        * wnm_oper - Notify driver of the WNM frame reception
+        * @priv: Private driver interface data
+        * @oper: WNM operation. See %enum wnm_oper
+        * @peer: Destination (peer) MAC address
+        * @buf: Buffer for the driver to fill in (for getting IE)
+        * @buf_len: Return the len of buf
+        * Returns: 0 on success, negative (<0) on failure
+        */
+       int (*wnm_oper)(void *priv, enum wnm_oper oper, const u8 *peer,
+                       u8 *buf, u16 *buf_len);
+
        /**
         * signal_poll - Get current connection information
         * @priv: Private driver interface data
@@ -2451,6 +2612,30 @@ struct wpa_driver_ops {
         */
        void (*poll_client)(void *priv, const u8 *own_addr,
                            const u8 *addr, int qos);
+
+       /**
+        * radio_disable - Disable/enable radio
+        * @priv: Private driver interface data
+        * @disabled: 1=disable 0=enable radio
+        * Returns: 0 on success, -1 on failure
+        *
+        * This optional command is for testing purposes. It can be used to
+        * disable the radio on a testbed device to simulate out-of-radio-range
+        * conditions.
+        */
+       int (*radio_disable)(void *priv, int disabled);
+
+       /**
+        * switch_channel - Announce channel switch and migrate the GO to the
+        * given frequency
+        * @priv: Private driver interface data
+        * @freq: Frequency in MHz
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function is used to move the GO to the legacy STA channel to
+        * avoid frequency conflict in single channel concurrency.
+        */
+       int (*switch_channel)(void *priv, unsigned int freq);
 };
 
 
@@ -2881,7 +3066,30 @@ enum wpa_event_type {
        /**
         * EVENT_EAPOL_TX_STATUS - notify of EAPOL TX status
         */
-       EVENT_EAPOL_TX_STATUS
+       EVENT_EAPOL_TX_STATUS,
+
+       /**
+        * EVENT_CH_SWITCH - AP or GO decided to switch channels
+        *
+        * Described in wpa_event_data.ch_switch
+        * */
+       EVENT_CH_SWITCH,
+
+       /**
+        * EVENT_WNM - Request WNM operation
+        *
+        * This event can be used to request a WNM operation to be performed.
+        */
+       EVENT_WNM,
+
+       /**
+        * EVENT_CONNECT_FAILED_REASON - Connection failure reason in AP mode
+        *
+        * This event indicates that the driver reported a connection failure
+        * with the specified client (for example, max client reached, etc.) in
+        * AP mode.
+        */
+       EVENT_CONNECT_FAILED_REASON
 };
 
 
@@ -2996,6 +3204,11 @@ union wpa_event_data {
                 * ie_len - Length of ie buffer in octets
                 */
                size_t ie_len;
+
+               /**
+                * locally_generated - Whether the frame was locally generated
+                */
+               int locally_generated;
        } disassoc_info;
 
        /**
@@ -3022,6 +3235,11 @@ union wpa_event_data {
                 * ie_len - Length of ie buffer in octets
                 */
                size_t ie_len;
+
+               /**
+                * locally_generated - Whether the frame was locally generated
+                */
+               int locally_generated;
        } deauth_info;
 
        /**
@@ -3073,6 +3291,24 @@ union wpa_event_data {
                u16 reason_code; /* for teardown */
        } tdls;
 
+       /**
+        * struct wnm - Data for EVENT_WNM
+        */
+       struct wnm {
+               u8 addr[ETH_ALEN];
+               enum {
+                       WNM_OPER_SLEEP,
+               } oper;
+               enum {
+                       WNM_SLEEP_ENTER,
+                       WNM_SLEEP_EXIT
+               } sleep_action;
+               int sleep_intval;
+               u16 reason_code;
+               u8 *buf;
+               u16 buf_len;
+       } wnm;
+
        /**
         * struct ft_ies - FT information elements (EVENT_FT_RESPONSE)
         *
@@ -3187,7 +3423,7 @@ union wpa_event_data {
                const u8 *frame;
                size_t frame_len;
                u32 datarate;
-               u32 ssi_signal;
+               int ssi_signal; /* dBm */
        } rx_mgmt;
 
        /**
@@ -3305,6 +3541,11 @@ union wpa_event_data {
                 * ie_len - Length of ie buffer in octets
                 */
                size_t ie_len;
+
+               /**
+                * signal - signal strength in dBm (or 0 if not available)
+                */
+               int ssi_signal;
        } rx_probe_req;
 
        /**
@@ -3461,6 +3702,31 @@ union wpa_event_data {
                int data_len;
                int ack;
        } eapol_tx_status;
+
+       /**
+        * struct ch_switch
+        * @freq: Frequency of new channel in MHz
+        * @ht_enabled: Whether this is an HT channel
+        * @ch_offset: Secondary channel offset
+        */
+       struct ch_switch {
+               int freq;
+               int ht_enabled;
+               int ch_offset;
+       } ch_switch;
+
+       /**
+        * struct connect_failed - Data for EVENT_CONNECT_FAILED_REASON
+        * @addr: Remote client address
+        * @code: Reason code for connection failure
+        */
+       struct connect_failed_reason {
+               u8 addr[ETH_ALEN];
+               enum {
+                       MAX_CLIENT_REACHED,
+                       BLOCKED_CLIENT
+               } code;
+       } connect_failed_reason;
 };
 
 /**