wpa_supplicant: Use hostapd_freq_params in assoc_params
[mech_eap.git] / src / drivers / driver.h
index 00565a7..6af7294 100644 (file)
@@ -351,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
@@ -360,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
@@ -403,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().
@@ -435,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
@@ -682,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
@@ -1032,6 +1067,8 @@ struct wpa_driver_capa {
         */
        const u8 *extended_capa, *extended_capa_mask;
        unsigned int extended_capa_len;
+
+       struct wowlan_triggers wowlan_triggers;
 };
 
 
@@ -1071,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];
 };
@@ -1293,6 +1311,15 @@ enum tdls_peer_capability {
        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
  *
@@ -2474,6 +2501,7 @@ struct wpa_driver_ops {
         * @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
@@ -2483,7 +2511,7 @@ struct wpa_driver_ops {
         */
        int (*send_tdls_mgmt)(void *priv, const u8 *dst, u8 action_code,
                              u8 dialog_token, u16 status_code, u32 peer_capab,
-                             const u8 *buf, size_t len);
+                             int initiator, const u8 *buf, size_t len);
 
        /**
         * tdls_oper - Ask the driver to perform high-level TDLS operations
@@ -2519,6 +2547,13 @@ 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
@@ -2767,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 */
 };
 
 
@@ -3083,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,
 
@@ -3938,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[];