WPS 2.0: Provide (Re)Association Response WPS IE to driver
[libeap.git] / src / drivers / driver.h
index 85ca0a5..96dec77 100644 (file)
@@ -281,6 +281,13 @@ struct wpa_driver_auth_params {
        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
+                         */
+};
+
 /**
  * struct wpa_driver_associate_params - Association parameters
  * Data for struct wpa_driver_ops::associate().
@@ -460,6 +467,28 @@ 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;
+
+       /**
+        * p2p - Whether this connection is a P2P group
+        */
+       int p2p;
+
+       /**
+        * uapsd - UAPSD parameters for the network
+        * -1 = do not change defaults
+        * AP mode: 1 = enabled, 0 = disabled
+        * STA mode: bits 0..3 UAPSD enabled for VO,VI,BK,BE
+        */
+       int uapsd;
 };
 
 /**
@@ -502,6 +531,17 @@ 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
+/* Driver takes care of P2P management operations */
+#define WPA_DRIVER_FLAGS_P2P_MGMT      0x00000100
+/* Driver supports concurrent P2P operations */
+#define WPA_DRIVER_FLAGS_P2P_CONCURRENT        0x00000200
+/*
+ * Driver uses the initial interface as a dedicated management interface, i.e.,
+ * it cannot be used for P2P group operations.
+ */
+#define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE       0x00000400
+/* This interface is P2P capable (P2P Device, GO, or P2P Client */
+#define WPA_DRIVER_FLAGS_P2P_CAPABLE   0x00000800
        unsigned int flags;
 
        int max_scan_ssids;
@@ -510,6 +550,12 @@ struct wpa_driver_capa {
         * max_remain_on_chan - Maximum remain-on-channel duration in msec
         */
        unsigned int max_remain_on_chan;
+
+       /**
+        * max_stations - Maximum number of associated stations the driver
+        * supports in AP mode
+        */
+       unsigned int max_stations;
 };
 
 
@@ -567,6 +613,22 @@ enum wpa_driver_if_type {
         * This interface has its own address and Beacon frame.
         */
        WPA_IF_AP_BSS,
+
+       /**
+        * WPA_IF_P2P_GO - P2P Group Owner
+        */
+       WPA_IF_P2P_GO,
+
+       /**
+        * WPA_IF_P2P_CLIENT - P2P Client
+        */
+       WPA_IF_P2P_CLIENT,
+
+       /**
+        * WPA_IF_P2P_GROUP - P2P Group interface (will become either
+        * WPA_IF_P2P_GO or WPA_IF_P2P_CLIENT, but the role is not yet known)
+        */
+       WPA_IF_P2P_GROUP
 };
 
 struct wpa_init_params {
@@ -1596,15 +1658,29 @@ struct wpa_driver_ops {
         * @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)
+        * @assocresp: WPS IE(s) for (Re)Association 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
         * Beacon and Probe Response frames. This can be left undefined (set
         * to %NULL) if the driver uses the Beacon template from set_beacon()
-        * and does not process Probe Request frames.
+        * and does not process Probe Request frames. If the driver takes care
+        * of (Re)Association frame processing, the assocresp buffer includes
+        * WPS IE(s) that need to be added to (Re)Association Response frames
+        * whenever a (Re)Association Request frame indicated use of WPS.
+        *
+        * This will also be used to add P2P IE(s) into Beacon/Probe Response
+        * frames when operating as a GO. The driver is responsible for adding
+        * timing related attributes (e.g., NoA) in addition to the IEs
+        * included here by appending them after these buffers. This call is
+        * also used to provide Probe Response IEs for P2P Listen state
+        * operations for drivers that generate the Probe Response frames
+        * internally.
         */
        int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon,
-                            const struct wpabuf *proberesp);
+                            const struct wpabuf *proberesp,
+                            const struct wpabuf *assocresp);
 
        /**
         * set_supp_port - Set IEEE 802.1X Supplicant Port status
@@ -1765,6 +1841,69 @@ struct wpa_driver_ops {
         */
        int (*send_frame)(void *priv, const u8 *data, size_t data_len,
                          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
+        * @buf_len: Buffer length in octets
+        * Returns: Number of octets used in buf, 0 to indicate no NoA is being
+        * advertized, or -1 on failure
+        *
+        * This function is used to fetch the current Notice of Absence
+        * attribute value from GO.
+        */
+       int (*get_noa)(void *priv, u8 *buf, size_t buf_len);
+
+       /**
+        * set_noa - Set Notice of Absence parameters for GO (testing)
+        * @priv: Private driver interface data
+        * @count: Count
+        * @start: Start time in ms from next TBTT
+        * @duration: Duration in ms
+        * Returns: 0 on success or -1 on failure
+        *
+        * This function is used to set Notice of Absence parameters for GO. It
+        * is used only for testing. To disable NoA, all parameters are set to
+        * 0.
+        */
+       int (*set_noa)(void *priv, u8 count, int start, int duration);
+
+       /**
+        * set_p2p_powersave - Set P2P power save options
+        * @priv: Private driver interface data
+        * @legacy_ps: 0 = disable, 1 = enable, 2 = maximum PS, -1 = no change
+        * @opp_ps: 0 = disable, 1 = enable, -1 = no change
+        * @ctwindow: 0.. = change (msec), -1 = no change
+        * Returns: 0 on success or -1 on failure
+        */
+       int (*set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps,
+                                int ctwindow);
+
+       /**
+        * ampdu - Enable/disable aggregation
+        * @priv: Private driver interface data
+        * @ampdu: 1/0 = enable/disable A-MPDU aggregation
+        * Returns: 0 on success or -1 on failure
+        */
+       int (*ampdu)(void *priv, int ampdu);
+
+       /**
+        * set_intra_bss - Enables/Disables intra BSS bridging
+        */
+       int (*set_intra_bss)(void *priv, int enabled);
 };
 
 
@@ -2162,6 +2301,16 @@ union wpa_event_data {
                 *      Deauthentication frame
                 */
                u16 reason_code;
+
+               /**
+                * ie - Optional IE(s) in Disassociation frame
+                */
+               const u8 *ie;
+
+               /**
+                * ie_len - Length of ie buffer in octets
+                */
+               size_t ie_len;
        } disassoc_info;
 
        /**
@@ -2178,6 +2327,16 @@ union wpa_event_data {
                 *      Deauthentication frame
                 */
                u16 reason_code;
+
+               /**
+                * ie - Optional IE(s) in Deauthentication frame
+                */
+               const u8 *ie;
+
+               /**
+                * ie_len - Length of ie buffer in octets
+                */
+               size_t ie_len;
        } deauth_info;
 
        /**
@@ -2452,6 +2611,7 @@ union wpa_event_data {
         */
        struct signal_change {
                int above_threshold;
+               int current_signal;
        } signal_change;
 };