Initial step in adding simple AP mode support into wpa_supplicant
[wpasupplicant] / src / drivers / driver.h
index 342d032..8257991 100644 (file)
@@ -22,6 +22,7 @@
 #define AUTH_ALG_OPEN_SYSTEM   0x01
 #define AUTH_ALG_SHARED_KEY    0x02
 #define AUTH_ALG_LEAP          0x04
+#define AUTH_ALG_FT            0x08
 
 #define IEEE80211_MODE_INFRA   0
 #define IEEE80211_MODE_IBSS    1
@@ -190,6 +191,20 @@ struct wpa_driver_scan_params {
 };
 
 /**
+ * struct wpa_driver_auth_params - Authentication parameters
+ * Data for struct wpa_driver_ops::authenticate().
+ */
+struct wpa_driver_auth_params {
+       int freq;
+       const u8 *bssid;
+       const u8 *ssid;
+       size_t ssid_len;
+       int auth_alg;
+       const u8 *ie;
+       size_t ie_len;
+};
+
+/**
  * struct wpa_driver_associate_params - Association parameters
  * Data for struct wpa_driver_ops::associate().
  */
@@ -335,6 +350,15 @@ struct wpa_driver_associate_params {
         * be prepared to handle %NULL value as an error.
         */
        const u8 *psk;
+
+       /**
+        * drop_unencrypted - Enable/disable unencrypted frame filtering
+        *
+        * Configure the driver to drop all non-EAPOL frames (both receive and
+        * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
+        * still be allowed for key negotiation.
+        */
+       int drop_unencrypted;
 };
 
 /**
@@ -369,6 +393,11 @@ struct wpa_driver_capa {
  * struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */
 #define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE 0x00000008
 #define WPA_DRIVER_FLAGS_WIRED         0x00000010
+/* Driver provides separate commands for authentication and association (SME in
+ * wpa_supplicant). */
+#define WPA_DRIVER_FLAGS_SME           0x00000020
+/* Driver supports AP mode */
+#define WPA_DRIVER_FLAGS_AP            0x00000040
        unsigned int flags;
 
        int max_scan_ssids;
@@ -602,6 +631,9 @@ struct wpa_driver_ops {
         * Configure the driver to drop all non-EAPOL frames (both receive and
         * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
         * still be allowed for key negotiation.
+        *
+        * This function is deprecated. New driver wrapper implementations
+        * should use associate() parameter drop_unencrypted instead.
         */
        int (*set_drop_unencrypted)(void *priv, int enabled);
 
@@ -619,7 +651,7 @@ struct wpa_driver_ops {
         * results event for wpa_supplicant which will eventually request the
         * results with wpa_driver_get_scan_results().
         *
-        * This function is depracated. New driver wrapper implementations
+        * This function is deprecated. New driver wrapper implementations
         * should implement support for scan2().
         */
        int (*scan)(void *priv, const u8 *ssid, size_t ssid_len);
@@ -637,7 +669,7 @@ struct wpa_driver_ops {
         * returned and the remaining entries will not be included in the
         * buffer.
         *
-        * This function is depracated. New driver wrapper implementations
+        * This function is deprecated. New driver wrapper implementations
         * should implement support for get_scan_results2().
         */
        int (*get_scan_results)(void *priv,
@@ -693,6 +725,9 @@ struct wpa_driver_ops {
         * associate() params, so set_auth_alg may not be needed in case of
         * most drivers.
         *
+        * This function is deprecated. New driver wrapper implementations
+        * should use associate() parameter auth_alg instead.
+        *
         * Returns: 0 on success, -1 on failure
         */
        int (*set_auth_alg)(void *priv, int auth_alg);
@@ -1010,8 +1045,12 @@ struct wpa_driver_ops {
         * This handler will be called before any key configuration and call to
         * associate() handler in order to allow the operation mode to be
         * configured as early as possible. This information is also available
-        * in associate() params and as such, some driver wrappers may not need
+        * in associate() params and as such, driver wrappers may not need
         * to implement set_mode() handler.
+        *
+        * This function is deprecated. New driver wrapper implementations
+        * should use associate() parameter mode instead.
+        *
         * Returns: 0 on success, -1 on failure
         */
        int (*set_mode)(void *priv, int mode);
@@ -1083,6 +1122,21 @@ struct wpa_driver_ops {
         * results with wpa_driver_get_scan_results2().
         */
        int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
+
+       /**
+        * authenticate - Request driver to authenticate
+        * @priv: private driver interface data
+        * @params: authentication parameters
+        * Returns: 0 on success, -1 on failure
+        *
+        * This is an optional function that can be used with drivers that
+        * support separate authentication and association steps, i.e., when
+        * wpa_supplicant can act as the SME. If not implemented, associate()
+        * function is expected to take care of IEEE 802.11 authentication,
+        * too.
+        */
+        int (*authenticate)(void *priv,
+                            struct wpa_driver_auth_params *params);
 };
 
 /**
@@ -1108,7 +1162,9 @@ typedef enum wpa_event_type {
         *
         * This event should be called when association is lost either due to
         * receiving deauthenticate or disassociate frame from the AP or when
-        * sending either of these frames to the current AP.
+        * sending either of these frames to the current AP. If the driver
+        * supports separate deauthentication event, EVENT_DISASSOC should only
+        * be used for disassociation and EVENT_DEAUTH for deauthentication.
         */
        EVENT_DISASSOC,
 
@@ -1216,7 +1272,27 @@ typedef enum wpa_event_type {
         * event starts RSN authentication with the other STA to authenticate
         * the STA and set up encryption keys with it.
         */
-       EVENT_IBSS_RSN_START
+       EVENT_IBSS_RSN_START,
+
+       /**
+        * EVENT_AUTH - Authentication result
+        *
+        * This event should be called when authentication attempt has been
+        * completed. This is only used if the driver supports separate
+        * authentication step (struct wpa_driver_ops::authenticate).
+        * Information about authentication result is included in
+        * union wpa_event_data::auth.
+        */
+       EVENT_AUTH,
+
+       /**
+        * EVENT_DEAUTH - Authentication lost
+        *
+        * This event should be called when authentication is lost either due
+        * to receiving deauthenticate frame from the AP or when sending that
+        * frame to the current AP.
+        */
+       EVENT_DEAUTH
 } wpa_event_type;
 
 
@@ -1342,6 +1418,10 @@ union wpa_event_data {
                size_t ies_len;
                int ft_action;
                u8 target_ap[ETH_ALEN];
+               /** Optional IE(s), e.g., WMM TSPEC(s), for RIC-Request */
+               const u8 *ric_ies;
+               /** Length of ric_ies buffer in octets */
+               size_t ric_ies_len;
        } ft_ies;
 
        /**
@@ -1350,6 +1430,17 @@ union wpa_event_data {
        struct ibss_rsn_start {
                u8 peer[ETH_ALEN];
        } ibss_rsn_start;
+
+       /**
+        * struct auth_info - Data for EVENT_AUTH events
+        */
+       struct auth_info {
+               u8 peer[ETH_ALEN];
+               u16 auth_type;
+               u16 status_code;
+               const u8 *ies;
+               size_t ies_len;
+       } auth;
 };
 
 /**