]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - src/drivers/driver.h
NDIS: Fix association for WPS provisioning with protected AP
[thirdparty/hostap.git] / src / drivers / driver.h
index 3cab8f580995845e753c526e57deb7af2c4be163..4e40a38390ccfd50bdd8178d3c42aa94178ca1c5 100644 (file)
@@ -278,6 +278,14 @@ struct wpa_driver_auth_params {
        const u8 *wep_key[4];
        size_t wep_key_len[4];
        int wep_tx_keyidx;
+       int local_state_change;
+};
+
+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
+                         */
 };
 
 /**
@@ -459,6 +467,15 @@ 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;
 };
 
 /**
@@ -504,6 +521,11 @@ struct wpa_driver_capa {
        unsigned int flags;
 
        int max_scan_ssids;
+
+       /**
+        * max_remain_on_chan - Maximum remain-on-channel duration in msec
+        */
+       unsigned int max_remain_on_chan;
 };
 
 
@@ -1219,7 +1241,7 @@ struct wpa_driver_ops {
         * kernel driver for Beacon frames. This can be left undefined (set to
         * %NULL) if the driver uses the Beacon template from set_beacon().
         */
-       int (*set_privacy)(const char *ifname, void *priv, int enabled);
+       int (*set_privacy)(void *priv, int enabled);
 
        /**
         * get_seqnum - Fetch the current TSC/packet number (AP only)
@@ -1251,7 +1273,6 @@ struct wpa_driver_ops {
 
        /**
         * set_generic_elem - Add IEs into Beacon/Probe Response frames (AP)
-        * @ifname: The interface name (main or virtual BSS)
         * @priv: Private driver interface data
         * @elem: Information elements
         * @elem_len: Length of the elem buffer in octets
@@ -1262,8 +1283,7 @@ struct wpa_driver_ops {
         * undefined (set to %NULL) if the driver uses the Beacon template from
         * set_beacon().
         */
-       int (*set_generic_elem)(const char *ifname, void *priv, const u8 *elem,
-                               size_t elem_len);
+       int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len);
 
        /**
         * read_sta_data - Fetch station data (AP only)
@@ -1328,7 +1348,6 @@ struct wpa_driver_ops {
 
        /**
         * hapd_get_ssid - Get the current SSID (AP only)
-        * @ifname: Interface (master or virtual BSS)
         * @priv: Private driver interface data
         * @buf: Buffer for returning the SSID
         * @len: Maximum length of the buffer
@@ -1338,18 +1357,17 @@ struct wpa_driver_ops {
         * template from set_beacon() and does not reply to Probe Request
         * frames.
         */
-       int (*hapd_get_ssid)(const char *ifname, void *priv, u8 *buf, int len);
+       int (*hapd_get_ssid)(void *priv, u8 *buf, int len);
 
        /**
         * hapd_set_ssid - Set SSID (AP only)
-        * @ifname: Interface (master or virtual BSS)
         * @priv: Private driver interface data
         * @buf: SSID
         * @len: Length of the SSID in octets
         * Returns: 0 on success, -1 on failure
         */
-       int (*hapd_set_ssid)(const char *ifname, void *priv, const u8 *buf,
-                            int len);
+       int (*hapd_set_ssid)(void *priv, const u8 *buf, int len);
+
        /**
         * hapd_set_countermeasures - Enable/disable TKIP countermeasures (AP)
         * @priv: Private driver interface data
@@ -1363,7 +1381,6 @@ struct wpa_driver_ops {
 
        /**
         * sta_add - Add a station entry
-        * @ifname: Interface (master or virtual)
         * @priv: Private driver interface data
         * @params: Station parameters
         * Returns: 0 on success, -1 on failure
@@ -1372,8 +1389,7 @@ struct wpa_driver_ops {
         * station has completed association. This is only used if the driver
         * does not take care of association processing.
         */
-       int (*sta_add)(const char *ifname, void *priv,
-                      struct hostapd_sta_add_params *params);
+       int (*sta_add)(void *priv, struct hostapd_sta_add_params *params);
 
        /**
         * get_inact_sec - Get station inactivity duration (AP only)
@@ -1417,7 +1433,6 @@ struct wpa_driver_ops {
 
        /**
         * sta_set_flags - Set station flags (AP only)
-        * @ifname: Interface name (for multi-SSID/VLAN support)
         * @priv: Private driver interface data
         * @addr: Station address
         * @total_flags: Bitmap of all WPA_STA_* flags currently set
@@ -1425,7 +1440,7 @@ struct wpa_driver_ops {
         * @flags_and: Bitmap of WPA_STA_* flags to us as a mask
         * Returns: 0 on success, -1 on failure
         */
-       int (*sta_set_flags)(const char *ifname, void *priv, const u8 *addr,
+       int (*sta_set_flags)(void *priv, const u8 *addr,
                             int total_flags, int flags_or, int flags_and);
 
        /**
@@ -1496,11 +1511,16 @@ 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)
         * 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);
 
        /**
         * if_remove - Remove a virtual interface
@@ -1575,7 +1595,6 @@ struct wpa_driver_ops {
 
        /**
         * set_ht_params - Set HT parameters (AP only)
-        * @ifname: The interface name (main or virtual BSS)
         * @priv: Private driver interface data
         * @ht_capab: HT Capabilities IE
         * @ht_capab_len: Length of ht_capab in octets
@@ -1583,16 +1602,16 @@ struct wpa_driver_ops {
         * @ht_oper_len: Length of ht_oper in octets
         * Returns: 0 on success, -1 on failure
         */
-       int (*set_ht_params)(const char *ifname, void *priv,
+       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)
         * Returns: 0 on success, -1 on failure
         *
         * This is an optional function to add WPS IE in the kernel driver for
@@ -1600,8 +1619,7 @@ struct wpa_driver_ops {
         * to %NULL) if the driver uses the Beacon template from set_beacon()
         * and does not process Probe Request frames.
         */
-       int (*set_ap_wps_ie)(const char *ifname, void *priv,
-                            const struct wpabuf *beacon,
+       int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon,
                             const struct wpabuf *proberesp);
 
        /**
@@ -1644,40 +1662,6 @@ struct wpa_driver_ops {
                           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
-        *
-        * 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.
-        *
-        * The allocated address can be used in a if_add() call to request a
-        * specific bssid.
-        */
-       int (*alloc_interface_addr)(void *priv, u8 *addr, char *ifname);
-
-       /**
-        * release_interface_addr - Release a virtual interface address
-        * @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.
-        */
-       void (*release_interface_addr)(void *priv, const u8 *addr);
-
        /**
         * remain_on_channel - Remain awake on a channel
         * @priv: Private driver interface data
@@ -1767,6 +1751,36 @@ struct wpa_driver_ops {
         * @priv: Private driver interface data
         */
        void (*resume)(void *priv);
+
+       /**
+        * 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 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.
+        */
+       int (*signal_monitor)(void *priv, int threshold, int hysteresis);
+
+       /**
+        * 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 function is only used for debugging purposes and is not
+        * required to be implemented for normal operations.
+        */
+       int (*send_frame)(void *priv, const u8 *data, size_t data_len,
+                         int encrypt);
 };
 
 
@@ -2039,7 +2053,32 @@ 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
 };
 
 
@@ -2133,6 +2172,12 @@ 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;
        } disassoc_info;
 
        /**
@@ -2143,6 +2188,12 @@ 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;
        } deauth_info;
 
        /**
@@ -2411,6 +2462,14 @@ union wpa_event_data {
                const u8 *data;
                size_t data_len;
        } eapol_rx;
+
+       /**
+        * struct signal_change - Data for EVENT_SIGNAL_CHANGE events
+        */
+       struct signal_change {
+               int above_threshold;
+               int current_signal;
+       } signal_change;
 };
 
 /**