wpa_supplicant: Use hostapd_freq_params in assoc_params
[mech_eap.git] / src / drivers / driver.h
index 6b6c0ef..6af7294 100644 (file)
@@ -50,6 +50,14 @@ enum reg_change_initiator {
        REGDOM_BEACON_HINT,
 };
 
+enum reg_type {
+       REGDOM_TYPE_UNKNOWN,
+       REGDOM_TYPE_COUNTRY,
+       REGDOM_TYPE_WORLD,
+       REGDOM_TYPE_CUSTOM_WORLD,
+       REGDOM_TYPE_INTERSECTION,
+};
+
 /**
  * struct hostapd_channel_data - Channel information
  */
@@ -93,6 +101,9 @@ struct hostapd_channel_data {
         */
        long double interference_factor;
 #endif /* CONFIG_ACS */
+
+       /* DFS CAC time in milliseconds */
+       unsigned int dfs_cac_ms;
 };
 
 #define HOSTAPD_MODE_FLAG_HT_INFO_KNOWN BIT(0)
@@ -340,7 +351,7 @@ struct wpa_driver_scan_params {
         * 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;
+       unsigned int p2p_probe:1;
 
        /**
         * only_new_results - Request driver to report only new results
@@ -349,7 +360,15 @@ struct wpa_driver_scan_params {
         * been detected after this scan request has been started, i.e., to
         * flush old cached BSS entries.
         */
-       int only_new_results;
+       unsigned int only_new_results:1;
+
+       /**
+        * low_priority - Requests driver to use a lower scan priority
+        *
+        * This is used to request the driver to use a lower scan priority
+        * if it supports such a thing.
+        */
+       unsigned int low_priority:1;
 
        /*
         * NOTE: Whenever adding new parameters here, please make sure
@@ -392,6 +411,25 @@ enum wps_mode {
                          */
 };
 
+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;
+};
+
 /**
  * struct wpa_driver_associate_params - Association parameters
  * Data for struct wpa_driver_ops::associate().
@@ -424,11 +462,9 @@ struct wpa_driver_associate_params {
        size_t ssid_len;
 
        /**
-        * freq - Frequency of the channel the selected AP is using
-        * Frequency that the selected AP is using (in MHz as
-        * reported in the scan results)
+        * freq - channel parameters
         */
-       int freq;
+       struct hostapd_freq_params freq;
 
        /**
         * freq_hint - Frequency of the channel the proposed AP is using
@@ -448,6 +484,11 @@ struct wpa_driver_associate_params {
        int bg_scan_period;
 
        /**
+        * beacon_int - Beacon interval for IBSS or 0 to use driver default
+        */
+       int beacon_int;
+
+       /**
         * wpa_ie - WPA information element for (Re)Association Request
         * WPA information element to be included in (Re)Association
         * Request (including information element id and length). Use
@@ -666,6 +707,16 @@ enum hide_ssid {
        HIDDEN_SSID_ZERO_CONTENTS
 };
 
+struct wowlan_triggers {
+       u8 any;
+       u8 disconnect;
+       u8 magic_pkt;
+       u8 gtk_rekey_failure;
+       u8 eap_identity_req;
+       u8 four_way_handshake;
+       u8 rfkill_release;
+};
+
 struct wpa_driver_ap_params {
        /**
         * head - Beacon head from IEEE 802.11 header to IEs before TIM IE
@@ -852,6 +903,11 @@ struct wpa_driver_ap_params {
         * osen - Whether OSEN security is enabled
         */
        int osen;
+
+       /**
+        * freq - Channel parameters for dynamic bandwidth changes
+        */
+       struct hostapd_freq_params *freq;
 };
 
 /**
@@ -892,7 +948,8 @@ 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
-/* unused: 0x00000004 */
+/* Driver takes care of all DFS operations */
+#define WPA_DRIVER_FLAGS_DFS_OFFLOAD                   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
@@ -904,7 +961,8 @@ 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
-/* unused: 0x00000100 */
+/* Driver supports dynamic HT 20/40 MHz channel changes during BSS lifetime */
+#define WPA_DRIVER_FLAGS_HT_2040_COEX                  0x00000100
 /* Driver supports concurrent P2P operations */
 #define WPA_DRIVER_FLAGS_P2P_CONCURRENT        0x00000200
 /*
@@ -1009,6 +1067,8 @@ struct wpa_driver_capa {
         */
        const u8 *extended_capa, *extended_capa_mask;
        unsigned int extended_capa_len;
+
+       struct wowlan_triggers wowlan_triggers;
 };
 
 
@@ -1048,25 +1108,6 @@ struct hostapd_sta_add_params {
        size_t supp_oper_classes_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;
-};
-
 struct mac_address {
        u8 addr[ETH_ALEN];
 };
@@ -1263,6 +1304,22 @@ struct csa_settings {
        u16 counter_offset_presp;
 };
 
+/* TDLS peer capabilities for send_tdls_mgmt() */
+enum tdls_peer_capability {
+       TDLS_PEER_HT = BIT(0),
+       TDLS_PEER_VHT = BIT(1),
+       TDLS_PEER_WMM = BIT(2),
+};
+
+#ifdef CONFIG_MACSEC
+struct macsec_init_params {
+       Boolean always_include_sci;
+       Boolean use_es;
+       Boolean use_scb;
+};
+#endif /* CONFIG_MACSEC */
+
+
 /**
  * struct wpa_driver_ops - Driver interface API definition
  *
@@ -2140,7 +2197,7 @@ struct wpa_driver_ops {
         * @session_timeout: Session timeout for the station
         * Returns: 0 on success, -1 on failure
         */
-       int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted, 
+       int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted,
                                   u32 session_timeout);
 
        /**
@@ -2204,7 +2261,7 @@ struct wpa_driver_ops {
         * Returns: 0 on success, -1 on failure
         */
        int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val,
-                          const char *bridge_ifname, char *ifname_wds);
+                          const char *bridge_ifname, char *ifname_wds);
 
        /**
         * send_action - Transmit an Action frame
@@ -2443,6 +2500,8 @@ struct wpa_driver_ops {
         * @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)
+        * @peer_capab: TDLS peer capability (TDLS_PEER_* bitfield)
+        * @initiator: Is the current end the TDLS link initiator
         * @buf: TDLS IEs to add to the message
         * @len: Length of buf in octets
         * Returns: 0 on success, negative (<0) on failure
@@ -2451,8 +2510,8 @@ struct wpa_driver_ops {
         * 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);
+                             u8 dialog_token, u16 status_code, u32 peer_capab,
+                             int initiator, const u8 *buf, size_t len);
 
        /**
         * tdls_oper - Ask the driver to perform high-level TDLS operations
@@ -2488,10 +2547,17 @@ struct wpa_driver_ops {
                           u8 qos_map_set_len);
 
        /**
+        * set_wowlan - Set wake-on-wireless triggers
+        * @priv: Private driver interface data
+        * @triggers: wowlan triggers
+        */
+       int (*set_wowlan)(void *priv, const struct wowlan_triggers *triggers);
+
+       /**
         * 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);
 
        /**
@@ -2736,6 +2802,227 @@ struct wpa_driver_ops {
         * Returns: Length of written status information or -1 on failure
         */
        int (*status)(void *priv, char *buf, size_t buflen);
+
+       /**
+        * roaming - Set roaming policy for driver-based BSS selection
+        * @priv: Private driver interface data
+        * @allowed: Whether roaming within ESS is allowed
+        * @bssid: Forced BSSID if roaming is disabled or %NULL if not set
+        * Returns: Length of written status information or -1 on failure
+        *
+        * This optional callback can be used to update roaming policy from the
+        * associate() command (bssid being set there indicates that the driver
+        * should not roam before getting this roaming() call to allow roaming.
+        * If the driver does not indicate WPA_DRIVER_FLAGS_BSS_SELECTION
+        * capability, roaming policy is handled within wpa_supplicant and there
+        * is no need to implement or react to this callback.
+        */
+       int (*roaming)(void *priv, int allowed, const u8 *bssid);
+
+       /**
+        * set_mac_addr - Set MAC address
+        * @priv: Private driver interface data
+        * @addr: MAC address to use or %NULL for setting back to permanent
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*set_mac_addr)(void *priv, const u8 *addr);
+
+#ifdef CONFIG_MACSEC
+       int (*macsec_init)(void *priv, struct macsec_init_params *params);
+
+       int (*macsec_deinit)(void *priv);
+
+       /**
+        * enable_protect_frames - Set protect frames status
+        * @priv: Private driver interface data
+        * @enabled: TRUE = protect frames enabled
+        *           FALSE = protect frames disabled
+        * Returns: 0 on success, -1 on failure (or if not supported)
+        */
+       int (*enable_protect_frames)(void *priv, Boolean enabled);
+
+       /**
+        * set_replay_protect - Set replay protect status and window size
+        * @priv: Private driver interface data
+        * @enabled: TRUE = replay protect enabled
+        *           FALSE = replay protect disabled
+        * @window: replay window size, valid only when replay protect enabled
+        * Returns: 0 on success, -1 on failure (or if not supported)
+        */
+       int (*set_replay_protect)(void *priv, Boolean enabled, u32 window);
+
+       /**
+        * set_current_cipher_suite - Set current cipher suite
+        * @priv: Private driver interface data
+        * @cs: EUI64 identifier
+        * @cs_len: Length of the cs buffer in octets
+        * Returns: 0 on success, -1 on failure (or if not supported)
+        */
+       int (*set_current_cipher_suite)(void *priv, const u8 *cs,
+                                       size_t cs_len);
+
+       /**
+        * enable_controlled_port - Set controlled port status
+        * @priv: Private driver interface data
+        * @enabled: TRUE = controlled port enabled
+        *           FALSE = controlled port disabled
+        * Returns: 0 on success, -1 on failure (or if not supported)
+        */
+       int (*enable_controlled_port)(void *priv, Boolean enabled);
+
+       /**
+        * get_receive_lowest_pn - Get receive lowest pn
+        * @priv: Private driver interface data
+        * @channel: secure channel
+        * @an: association number
+        * @lowest_pn: lowest accept pn
+        * Returns: 0 on success, -1 on failure (or if not supported)
+        */
+       int (*get_receive_lowest_pn)(void *priv, u32 channel, u8 an,
+                                    u32 *lowest_pn);
+
+       /**
+        * get_transmit_next_pn - Get transmit next pn
+        * @priv: Private driver interface data
+        * @channel: secure channel
+        * @an: association number
+        * @next_pn: next pn
+        * Returns: 0 on success, -1 on failure (or if not supported)
+        */
+       int (*get_transmit_next_pn)(void *priv, u32 channel, u8 an,
+                                   u32 *next_pn);
+
+       /**
+        * set_transmit_next_pn - Set transmit next pn
+        * @priv: Private driver interface data
+        * @channel: secure channel
+        * @an: association number
+        * @next_pn: next pn
+        * Returns: 0 on success, -1 on failure (or if not supported)
+        */
+       int (*set_transmit_next_pn)(void *priv, u32 channel, u8 an,
+                                   u32 next_pn);
+
+       /**
+        * get_available_receive_sc - get available receive channel
+        * @priv: Private driver interface data
+        * @channel: secure channel
+        * Returns: 0 on success, -1 on failure (or if not supported)
+        */
+       int (*get_available_receive_sc)(void *priv, u32 *channel);
+
+       /**
+        * create_receive_sc - create secure channel for receiving
+        * @priv: Private driver interface data
+        * @channel: secure channel
+        * @sci_addr: secure channel identifier - address
+        * @sci_port: secure channel identifier - port
+        * @conf_offset: confidentiality offset (0, 30, or 50)
+        * @validation: frame validation policy (0 = Disabled, 1 = Checked,
+        *      2 = Strict)
+        * Returns: 0 on success, -1 on failure (or if not supported)
+        */
+       int (*create_receive_sc)(void *priv, u32 channel, const u8 *sci_addr,
+                                u16 sci_port, unsigned int conf_offset,
+                                int validation);
+
+       /**
+        * delete_receive_sc - delete secure connection for receiving
+        * @priv: private driver interface data from init()
+        * @channel: secure channel
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*delete_receive_sc)(void *priv, u32 channel);
+
+       /**
+        * create_receive_sa - create secure association for receive
+        * @priv: private driver interface data from init()
+        * @channel: secure channel
+        * @an: association number
+        * @lowest_pn: the lowest packet number can be received
+        * @sak: the secure association key
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*create_receive_sa)(void *priv, u32 channel, u8 an,
+                                u32 lowest_pn, const u8 *sak);
+
+       /**
+        * enable_receive_sa - enable the SA for receive
+        * @priv: private driver interface data from init()
+        * @channel: secure channel
+        * @an: association number
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*enable_receive_sa)(void *priv, u32 channel, u8 an);
+
+       /**
+        * disable_receive_sa - disable SA for receive
+        * @priv: private driver interface data from init()
+        * @channel: secure channel index
+        * @an: association number
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*disable_receive_sa)(void *priv, u32 channel, u8 an);
+
+       /**
+        * get_available_transmit_sc - get available transmit channel
+        * @priv: Private driver interface data
+        * @channel: secure channel
+        * Returns: 0 on success, -1 on failure (or if not supported)
+        */
+       int (*get_available_transmit_sc)(void *priv, u32 *channel);
+
+       /**
+        * create_transmit_sc - create secure connection for transmit
+        * @priv: private driver interface data from init()
+        * @channel: secure channel
+        * @sci_addr: secure channel identifier - address
+        * @sci_port: secure channel identifier - port
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*create_transmit_sc)(void *priv, u32 channel, const u8 *sci_addr,
+                                 u16 sci_port, unsigned int conf_offset);
+
+       /**
+        * delete_transmit_sc - delete secure connection for transmit
+        * @priv: private driver interface data from init()
+        * @channel: secure channel
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*delete_transmit_sc)(void *priv, u32 channel);
+
+       /**
+        * create_transmit_sa - create secure association for transmit
+        * @priv: private driver interface data from init()
+        * @channel: secure channel index
+        * @an: association number
+        * @next_pn: the packet number used as next transmit packet
+        * @confidentiality: True if the SA is to provide confidentiality
+        *                   as well as integrity
+        * @sak: the secure association key
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*create_transmit_sa)(void *priv, u32 channel, u8 an, u32 next_pn,
+                                 Boolean confidentiality, const u8 *sak);
+
+       /**
+        * enable_transmit_sa - enable SA for transmit
+        * @priv: private driver interface data from init()
+        * @channel: secure channel
+        * @an: association number
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*enable_transmit_sa)(void *priv, u32 channel, u8 an);
+
+       /**
+        * disable_transmit_sa - disable SA for transmit
+        * @priv: private driver interface data from init()
+        * @channel: secure channel
+        * @an: association number
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*disable_transmit_sa)(void *priv, u32 channel, u8 an);
+#endif /* CONFIG_MACSEC */
 };
 
 
@@ -3052,7 +3339,8 @@ enum wpa_event_type {
         * 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.
+        * interfaces. This event can be propagated when channel switching
+        * fails.
         */
        EVENT_INTERFACE_UNAVAILABLE,
 
@@ -3580,6 +3868,15 @@ union wpa_event_data {
                u32 datarate;
 
                /**
+                * drv_priv - Pointer to store driver private BSS information
+                *
+                * If not set to NULL, this is used for comparison with
+                * hostapd_data->drv_priv to determine which BSS should process
+                * the frame.
+                */
+               void *drv_priv;
+
+               /**
                 * freq - Frequency (in MHz) on which the frame was received
                 */
                int freq;
@@ -3825,9 +4122,13 @@ union wpa_event_data {
        /**
         * channel_list_changed - Data for EVENT_CHANNEL_LIST_CHANGED
         * @initiator: Initiator of the regulatory change
+        * @type: Regulatory change type
+        * @alpha2: Country code (or "" if not available)
         */
        struct channel_list_changed {
                enum reg_change_initiator initiator;
+               enum reg_type type;
+               char alpha2[3];
        } channel_list_changed;
 
        /**
@@ -3894,6 +4195,9 @@ void wpa_scan_results_free(struct wpa_scan_results *res);
 /* Convert wpa_event_type to a string for logging */
 const char * event_to_string(enum wpa_event_type event);
 
+/* Convert chan_width to a string for logging and control interfaces */
+const char * channel_width_to_string(enum chan_width width);
+
 /* NULL terminated array of linked in driver wrappers */
 extern struct wpa_driver_ops *wpa_drivers[];