driver: Make setting up AP optional when creating AP interface
[mech_eap.git] / src / drivers / driver.h
index e58ea6c..d3f7057 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Driver interface definition
- * Copyright (c) 2003-2014, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2003-2015, Jouni Malinen <j@w1.fi>
  *
  * This software may be distributed under the terms of the BSD license.
  * See README for more details.
@@ -20,6 +20,7 @@
 #define WPA_SUPPLICANT_DRIVER_VERSION 4
 
 #include "common/defs.h"
+#include "common/ieee802_11_defs.h"
 #include "utils/list.h"
 
 #define HOSTAPD_CHAN_DISABLED 0x00000001
@@ -198,7 +199,6 @@ struct hostapd_hw_modes {
 #define WPA_SCAN_NOISE_INVALID         BIT(1)
 #define WPA_SCAN_LEVEL_INVALID         BIT(2)
 #define WPA_SCAN_LEVEL_DBM             BIT(3)
-#define WPA_SCAN_AUTHENTICATED         BIT(4)
 #define WPA_SCAN_ASSOCIATED            BIT(5)
 
 /**
@@ -214,6 +214,9 @@ struct hostapd_hw_modes {
  * @tsf: Timestamp
  * @age: Age of the information in milliseconds (i.e., how many milliseconds
  * ago the last Beacon or Probe Response frame was received)
+ * @est_throughput: Estimated throughput in kbps (this is calculated during
+ * scan result processing if left zero by the driver wrapper)
+ * @snr: Signal-to-noise ratio in dB (calculated during scan result processing)
  * @ie_len: length of the following IE field in octets
  * @beacon_ie_len: length of the following Beacon IE field in octets
  *
@@ -242,6 +245,8 @@ struct wpa_scan_res {
        int level;
        u64 tsf;
        unsigned int age;
+       unsigned int est_throughput;
+       int snr;
        size_t ie_len;
        size_t beacon_ie_len;
        /* Followed by ie_len + beacon_ie_len octets of IE data */
@@ -337,7 +342,7 @@ struct wpa_driver_scan_params {
         * is not needed anymore.
         */
        struct wpa_driver_scan_filter {
-               u8 ssid[32];
+               u8 ssid[SSID_MAX_LEN];
                size_t ssid_len;
        } *filter_ssids;
 
@@ -381,6 +386,27 @@ struct wpa_driver_scan_params {
         */
        unsigned int low_priority:1;
 
+       /**
+        * mac_addr_rand - Requests driver to randomize MAC address
+        */
+       unsigned int mac_addr_rand:1;
+
+       /**
+        * mac_addr - MAC address used with randomization. The address cannot be
+        * a multicast one, i.e., bit 0 of byte 0 should not be set.
+        */
+       const u8 *mac_addr;
+
+       /**
+        * mac_addr_mask - MAC address mask used with randomization.
+        *
+        * Bits that are 0 in the mask should be randomized. Bits that are 1 in
+        * the mask should be taken as is from mac_addr. The mask should not
+        * allow the generation of a multicast address, i.e., bit 0 of byte 0
+        * must be set.
+        */
+       const u8 *mac_addr_mask;
+
        /*
         * NOTE: Whenever adding new parameters here, please make sure
         * wpa_scan_clone_params() and wpa_scan_free_params() get updated with
@@ -747,6 +773,14 @@ struct wpa_driver_associate_params {
        int fixed_bssid;
 
        /**
+        * fixed_freq - Fix control channel in IBSS mode
+        * 0 = don't fix control channel (default)
+        * 1 = fix control channel; this prevents IBSS merging with another
+        *      channel
+        */
+       int fixed_freq;
+
+       /**
         * disable_ht - Disable HT (IEEE 802.11n) for this connection
         */
        int disable_ht;
@@ -990,6 +1024,11 @@ struct wpa_driver_ap_params {
        int ap_max_inactivity;
 
        /**
+        * ctwindow - Client Traffic Window (in TUs)
+        */
+       u8 p2p_go_ctwindow;
+
+       /**
         * smps_mode - SMPS mode
         *
         * SMPS mode to be used by the AP, specified as the relevant bits of
@@ -1011,6 +1050,11 @@ struct wpa_driver_ap_params {
         * freq - Channel parameters for dynamic bandwidth changes
         */
        struct hostapd_freq_params *freq;
+
+       /**
+        * reenable - Whether this is to re-enable beaconing
+        */
+       int reenable;
 };
 
 struct wpa_driver_mesh_bss_params {
@@ -1020,6 +1064,7 @@ struct wpa_driver_mesh_bss_params {
         * See NL80211_MESHCONF_* for all the mesh config parameters.
         */
        unsigned int flags;
+       int peer_link_timeout;
 };
 
 struct wpa_driver_mesh_join_params {
@@ -1028,10 +1073,9 @@ struct wpa_driver_mesh_join_params {
        const int *basic_rates;
        const u8 *ies;
        int ie_len;
-       int freq;
+       struct hostapd_freq_params freq;
        int beacon_int;
        int max_peer_links;
-       enum ht_mode ht_mode;
        struct wpa_driver_mesh_bss_params conf;
 #define WPA_DRIVER_MESH_FLAG_USER_MPM  0x00000001
 #define WPA_DRIVER_MESH_FLAG_DRIVER_MPM        0x00000002
@@ -1052,6 +1096,8 @@ struct wpa_driver_capa {
 #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
+#define WPA_DRIVER_CAPA_KEY_MGMT_SUITE_B       0x00000100
+#define WPA_DRIVER_CAPA_KEY_MGMT_SUITE_B_192   0x00000200
        /** Bitfield of supported key management suites */
        unsigned int key_mgmt;
 
@@ -1162,6 +1208,14 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS_KEY_MGMT_OFFLOAD      0x0000000400000000ULL
 /** Driver supports TDLS channel switching */
 #define WPA_DRIVER_FLAGS_TDLS_CHANNEL_SWITCH   0x0000000800000000ULL
+/** Driver supports IBSS with HT datarates */
+#define WPA_DRIVER_FLAGS_HT_IBSS               0x0000001000000000ULL
+/** Driver supports IBSS with VHT datarates */
+#define WPA_DRIVER_FLAGS_VHT_IBSS              0x0000002000000000ULL
+/** Driver supports automatic band selection */
+#define WPA_DRIVER_FLAGS_SUPPORT_HW_MODE_ANY   0x0000004000000000ULL
+/** Driver supports simultaneous off-channel operations */
+#define WPA_DRIVER_FLAGS_OFFCHANNEL_SIMULTANEOUS       0x0000008000000000ULL
        u64 flags;
 
 #define WPA_DRIVER_SMPS_MODE_STATIC                    0x00000001
@@ -1170,6 +1224,9 @@ struct wpa_driver_capa {
 
        unsigned int wmm_ac_supported:1;
 
+       unsigned int mac_addr_rand_scan_supported:1;
+       unsigned int mac_addr_rand_sched_scan_supported:1;
+
        /** Maximum number of supported active probe SSIDs */
        int max_scan_ssids;
 
@@ -1242,6 +1299,16 @@ struct wpa_driver_capa {
  */
 #define WPA_DRIVER_FLAGS_TX_POWER_INSERTION            0x00000008
        u32 rrm_flags;
+
+       /* Driver concurrency capabilities */
+       unsigned int conc_capab;
+       /* Maximum number of concurrent channels on 2.4 GHz */
+       unsigned int max_conc_chan_2_4;
+       /* Maximum number of concurrent channels on 5 GHz */
+       unsigned int max_conc_chan_5_0;
+
+       /* Maximum number of supported CSA counters */
+       u16 max_csa_counters;
 };
 
 
@@ -1342,6 +1409,16 @@ enum wpa_driver_if_type {
         * WPA_IF_MESH - Mesh interface
         */
        WPA_IF_MESH,
+
+       /*
+        * WPA_IF_TDLS - TDLS offchannel interface (used for pref freq only)
+        */
+       WPA_IF_TDLS,
+
+       /*
+        * WPA_IF_IBSS - IBSS interface (used for pref freq only)
+        */
+       WPA_IF_IBSS,
 };
 
 struct wpa_init_params {
@@ -1425,6 +1502,7 @@ struct wpa_signal_info {
        int above_threshold;
        int current_signal;
        int avg_signal;
+       int avg_beacon_signal;
        int current_noise;
        int current_txrate;
        enum chan_width chanwidth;
@@ -1481,8 +1559,8 @@ struct csa_settings {
        struct beacon_data beacon_csa;
        struct beacon_data beacon_after;
 
-       u16 counter_offset_beacon;
-       u16 counter_offset_presp;
+       u16 counter_offset_beacon[2];
+       u16 counter_offset_presp[2];
 };
 
 /* TDLS peer capabilities for send_tdls_mgmt() */
@@ -1524,6 +1602,7 @@ enum drv_br_port_attr {
 
 enum drv_br_net_param {
        DRV_BR_NET_PARAM_GARP_ACCEPT,
+       DRV_BR_MULTICAST_SNOOPING,
 };
 
 struct drv_acs_params {
@@ -1535,6 +1614,17 @@ struct drv_acs_params {
 
        /* Indicates whether HT40 is enabled */
        int ht40_enabled;
+
+       /* Indicates whether VHT is enabled */
+       int vht_enabled;
+
+       /* Configured ACS channel width */
+       u16 ch_width;
+
+       /* ACS channel list info */
+       unsigned int ch_list_len;
+       const u8 *ch_list;
+       const int *freq_list;
 };
 
 
@@ -1873,10 +1963,15 @@ struct wpa_driver_ops {
         * @data: IEEE 802.11 management frame with IEEE 802.11 header
         * @data_len: Size of the management frame
         * @noack: Do not wait for this frame to be acked (disable retries)
+        * @freq: Frequency (in MHz) to send the frame on, or 0 to let the
+        * driver decide
+        * @csa_offs: Array of CSA offsets or %NULL
+        * @csa_offs_len: Number of elements in csa_offs
         * Returns: 0 on success, -1 on failure
         */
        int (*send_mlme)(void *priv, const u8 *data, size_t data_len,
-                        int noack);
+                        int noack, unsigned int freq, const u16 *csa_offs,
+                        size_t csa_offs_len);
 
        /**
         * update_ft_ies - Update FT (IEEE 802.11r) IEs
@@ -2280,7 +2375,8 @@ struct wpa_driver_ops {
         * Returns: 0 on success, -1 on failure
         */
        int (*sta_set_flags)(void *priv, const u8 *addr,
-                            int total_flags, int flags_or, int flags_and);
+                            unsigned int total_flags, unsigned int flags_or,
+                            unsigned int flags_and);
 
        /**
         * set_tx_queue_params - Set TX queue parameters
@@ -2311,12 +2407,13 @@ struct wpa_driver_ops {
         *      change interface address)
         * @bridge: Bridge interface to use or %NULL if no bridge configured
         * @use_existing: Whether to allow existing interface to be used
+        * @setup_ap: Whether to setup AP for %WPA_IF_AP_BSS interfaces
         * Returns: 0 on success, -1 on failure
         */
        int (*if_add)(void *priv, enum wpa_driver_if_type type,
                      const char *ifname, const u8 *addr, void *bss_ctx,
                      void **drv_priv, char *force_ifname, u8 *if_addr,
-                     const char *bridge, int use_existing);
+                     const char *bridge, int use_existing, int setup_ap);
 
        /**
         * if_remove - Remove a virtual interface
@@ -2604,18 +2701,6 @@ struct wpa_driver_ops {
                          int encrypt);
 
        /**
-        * shared_freq - Get operating frequency of shared interface(s)
-        * @priv: Private driver interface data
-        * Returns: Operating frequency in MHz, 0 if no shared operation in
-        * use, or -1 on failure
-        *
-        * This command can be used to request the current operating frequency
-        * of any virtual interface that shares the same radio to provide
-        * information for channel selection for other virtual interfaces.
-        */
-       int (*shared_freq)(void *priv);
-
-       /**
         * get_noa - Get current Notice of Absence attribute payload
         * @priv: Private driver interface data
         * @buf: Buffer for returning NoA
@@ -2834,14 +2919,17 @@ struct wpa_driver_ops {
         * set_rekey_info - Set rekey information
         * @priv: Private driver interface data
         * @kek: Current KEK
+        * @kek_len: KEK length in octets
         * @kck: Current KCK
+        * @kck_len: KCK length in octets
         * @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,
+       void (*set_rekey_info)(void *priv, const u8 *kek, size_t kek_len,
+                              const u8 *kck, size_t kck_len,
                               const u8 *replay_ctr);
 
        /**
@@ -2993,6 +3081,33 @@ struct wpa_driver_ops {
        int (*del_tx_ts)(void *priv, u8 tsid, const u8 *addr);
 
        /**
+        * Enable channel-switching with TDLS peer
+        * @priv: Private driver interface data
+        * @addr: MAC address of the TDLS peer
+        * @oper_class: Operating class of the switch channel
+        * @params: Channel specification
+        * Returns: 0 on success, -1 on failure
+        *
+        * The function indicates to driver that it can start switching to a
+        * different channel with a specified TDLS peer. The switching is
+        * assumed on until canceled with tdls_disable_channel_switch().
+        */
+       int (*tdls_enable_channel_switch)(
+               void *priv, const u8 *addr, u8 oper_class,
+               const struct hostapd_freq_params *params);
+
+       /**
+        * Disable channel switching with TDLS peer
+        * @priv: Private driver interface data
+        * @addr: MAC address of the TDLS peer
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function indicates to the driver that it should stop switching
+        * with a given TDLS peer.
+        */
+       int (*tdls_disable_channel_switch)(void *priv, const u8 *addr);
+
+       /**
         * start_dfs_cac - Listen for radar interference on the channel
         * @priv: Private driver interface data
         * @freq: Channel parameters
@@ -3299,6 +3414,40 @@ struct wpa_driver_ops {
         * indicates support for such offloading (WPA_DRIVER_FLAGS_ACS_OFFLOAD).
         */
        int (*do_acs)(void *priv, struct drv_acs_params *params);
+
+       /**
+        * set_band - Notify driver of band selection
+        * @priv: Private driver interface data
+        * @band: The selected band(s)
+        * Returns 0 on success, -1 on failure
+        */
+       int (*set_band)(void *priv, enum set_band band);
+
+       /**
+        * get_pref_freq_list - Get preferred frequency list for an interface
+        * @priv: Private driver interface data
+        * @if_type: Interface type
+        * @num: Number of channels
+        * @freq_list: Preferred channel frequency list encoded in MHz values
+        * Returns 0 on success, -1 on failure
+        *
+        * This command can be used to query the preferred frequency list from
+        * the driver specific to a particular interface type.
+        */
+       int (*get_pref_freq_list)(void *priv, enum wpa_driver_if_type if_type,
+                                 unsigned int *num, unsigned int *freq_list);
+
+       /**
+        * set_prob_oper_freq - Indicate probable P2P operating channel
+        * @priv: Private driver interface data
+        * @freq: Channel frequency in MHz
+        * Returns 0 on success, -1 on failure
+        *
+        * This command can be used to inform the driver of the operating
+        * frequency that an ongoing P2P group formation is likely to come up
+        * on. Local device is assuming P2P Client role.
+        */
+       int (*set_prob_oper_freq)(void *priv, unsigned int freq);
 };
 
 
@@ -3701,7 +3850,7 @@ enum wpa_event_type {
        EVENT_CONNECT_FAILED_REASON,
 
        /**
-        * EVENT_RADAR_DETECTED - Notify of radar detection
+        * EVENT_DFS_RADAR_DETECTED - Notify of radar detection
         *
         * A radar has been detected on the supplied frequency, hostapd should
         * react accordingly (e.g., change channel).
@@ -3709,14 +3858,14 @@ enum wpa_event_type {
        EVENT_DFS_RADAR_DETECTED,
 
        /**
-        * EVENT_CAC_FINISHED - Notify that channel availability check has been completed
+        * EVENT_DFS_CAC_FINISHED - Notify that channel availability check has been completed
         *
         * After a successful CAC, the channel can be marked clear and used.
         */
        EVENT_DFS_CAC_FINISHED,
 
        /**
-        * EVENT_CAC_ABORTED - Notify that channel availability check has been aborted
+        * EVENT_DFS_CAC_ABORTED - Notify that channel availability check has been aborted
         *
         * The CAC was not successful, and the channel remains in the previous
         * state. This may happen due to a radar beeing detected or other
@@ -3725,7 +3874,7 @@ enum wpa_event_type {
        EVENT_DFS_CAC_ABORTED,
 
        /**
-        * EVENT_DFS_CAC_NOP_FINISHED - Notify that non-occupancy period is over
+        * EVENT_DFS_NOP_FINISHED - Notify that non-occupancy period is over
         *
         * The channel which was previously unavailable is now available again.
         */
@@ -3774,6 +3923,15 @@ enum wpa_event_type {
         * in device.
         */
        EVENT_ACS_CHANNEL_SELECTED,
+
+       /**
+        * EVENT_DFS_CAC_STARTED - Notify that channel availability check has
+        * been started.
+        *
+        * This event indicates that channel availability check has been started
+        * on a DFS frequency by a driver that supports DFS Offload.
+        */
+       EVENT_DFS_CAC_STARTED,
 };
 
 
@@ -3949,6 +4107,12 @@ union wpa_event_data {
                 * ptk_kek_len - The length of ptk_kek
                 */
                size_t ptk_kek_len;
+
+               /**
+                * subnet_status - The subnet status:
+                * 0 = unknown, 1 = unchanged, 2 = changed
+                */
+               u8 subnet_status;
        } assoc_info;
 
        /**
@@ -4057,7 +4221,8 @@ union wpa_event_data {
                u8 peer[ETH_ALEN];
                enum {
                        TDLS_REQUEST_SETUP,
-                       TDLS_REQUEST_TEARDOWN
+                       TDLS_REQUEST_TEARDOWN,
+                       TDLS_REQUEST_DISCOVER,
                } oper;
                u16 reason_code; /* for teardown */
        } tdls;
@@ -4231,6 +4396,9 @@ union wpa_event_data {
         * @ssids: Scanned SSIDs (%NULL or zero-length SSID indicates wildcard
         *      SSID)
         * @num_ssids: Number of entries in ssids array
+        * @external_scan: Whether the scan info is for an external scan
+        * @nl_scan_event: 1 if the source of this scan event is a normal scan,
+        *      0 if the source of the scan event is a vendor scan
         */
        struct scan_info {
                int aborted;
@@ -4238,6 +4406,8 @@ union wpa_event_data {
                size_t num_freqs;
                struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
                size_t num_ssids;
+               int external_scan;
+               int nl_scan_event;
        } scan_info;
 
        /**
@@ -4465,10 +4635,20 @@ union wpa_event_data {
         * struct acs_selected_channels - Data for EVENT_ACS_CHANNEL_SELECTED
         * @pri_channel: Selected primary channel
         * @sec_channel: Selected secondary channel
+        * @vht_seg0_center_ch: VHT mode Segment0 center channel
+        * @vht_seg1_center_ch: VHT mode Segment1 center channel
+        * @ch_width: Selected Channel width by driver. Driver may choose to
+        *      change hostapd configured ACS channel width due driver internal
+        *      channel restrictions.
+        * hw_mode: Selected band (used with hw_mode=any)
         */
        struct acs_selected_channels {
                u8 pri_channel;
                u8 sec_channel;
+               u8 vht_seg0_center_ch;
+               u8 vht_seg1_center_ch;
+               u16 ch_width;
+               enum hostapd_hw_mode hw_mode;
        } acs_selected_channels;
 };
 
@@ -4539,6 +4719,6 @@ wpa_get_wowlan_triggers(const char *wowlan_triggers,
                        const struct wpa_driver_capa *capa);
 
 /* NULL terminated array of linked in driver wrappers */
-extern struct wpa_driver_ops *wpa_drivers[];
+extern const struct wpa_driver_ops *const wpa_drivers[];
 
 #endif /* DRIVER_H */