AP: Pass station P2P PS capabilities info during station add/set
[mech_eap.git] / src / drivers / driver.h
index 1ed2320..7948950 100644 (file)
 #define HOSTAPD_CHAN_INDOOR_ONLY 0x00010000
 #define HOSTAPD_CHAN_GO_CONCURRENT 0x00020000
 
+#define HOSTAPD_CHAN_VHT_10_150 0x00100000
+#define HOSTAPD_CHAN_VHT_30_130 0x00200000
+#define HOSTAPD_CHAN_VHT_50_110 0x00400000
+#define HOSTAPD_CHAN_VHT_70_90  0x00800000
+#define HOSTAPD_CHAN_VHT_90_70  0x01000000
+#define HOSTAPD_CHAN_VHT_110_50 0x02000000
+#define HOSTAPD_CHAN_VHT_130_30 0x04000000
+#define HOSTAPD_CHAN_VHT_150_10 0x08000000
+
 /**
  * enum reg_change_initiator - Regulatory change initiator
  */
@@ -284,6 +293,18 @@ struct wpa_interface_info {
 #define WPAS_MAX_SCAN_SSIDS 16
 
 /**
+ * struct wpa_driver_scan_ssid - SSIDs to scan for
+ * @ssid - specific SSID to scan for (ProbeReq)
+ *     %NULL or zero-length SSID is used to indicate active scan
+ *     with wildcard SSID.
+ * @ssid_len - Length of the SSID in octets
+ */
+struct wpa_driver_scan_ssid {
+       const u8 *ssid;
+       size_t ssid_len;
+};
+
+/**
  * struct wpa_driver_scan_params - Scan parameters
  * Data for struct wpa_driver_ops::scan2().
  */
@@ -291,18 +312,7 @@ struct wpa_driver_scan_params {
        /**
         * ssids - SSIDs to scan for
         */
-       struct wpa_driver_scan_ssid {
-               /**
-                * ssid - specific SSID to scan for (ProbeReq)
-                * %NULL or zero-length SSID is used to indicate active scan
-                * with wildcard SSID.
-                */
-               const u8 *ssid;
-               /**
-                * ssid_len: Length of the SSID in octets
-                */
-               size_t ssid_len;
-       } ssids[WPAS_MAX_SCAN_SSIDS];
+       struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
 
        /**
         * num_ssids - Number of entries in ssids array
@@ -407,6 +417,37 @@ struct wpa_driver_scan_params {
         */
        const u8 *mac_addr_mask;
 
+       /**
+        * sched_scan_plans - Scan plans for scheduled scan
+        *
+        * Each scan plan consists of the number of iterations to scan and the
+        * interval between scans. When a scan plan finishes (i.e., it was run
+        * for the specified number of iterations), the next scan plan is
+        * executed. The scan plans are executed in the order they appear in
+        * the array (lower index first). The last scan plan will run infinitely
+        * (until requested to stop), thus must not specify the number of
+        * iterations. All other scan plans must specify the number of
+        * iterations.
+        */
+       struct sched_scan_plan {
+                u32 interval; /* In seconds */
+                u32 iterations; /* Zero to run infinitely */
+        } *sched_scan_plans;
+
+       /**
+        * sched_scan_plans_num - Number of scan plans in sched_scan_plans array
+        */
+        unsigned int sched_scan_plans_num;
+
+       /**
+        * bssid - Specific BSSID to scan for
+        *
+        * This optional parameter can be used to replace the default wildcard
+        * BSSID with a specific BSSID to scan for if results are needed from
+        * only a single BSS.
+        */
+       const u8 *bssid;
+
        /*
         * NOTE: Whenever adding new parameters here, please make sure
         * wpa_scan_clone_params() and wpa_scan_free_params() get updated with
@@ -828,6 +869,12 @@ struct wpa_driver_associate_params {
         * RRM (Radio Resource Measurements)
         */
        int rrm_used;
+
+       /**
+        * pbss - If set, connect to a PCP in a PBSS. Otherwise, connect to an
+        * AP as usual. Valid for DMG network only.
+        */
+       int pbss;
 };
 
 enum hide_ssid {
@@ -1055,6 +1102,12 @@ struct wpa_driver_ap_params {
         * reenable - Whether this is to re-enable beaconing
         */
        int reenable;
+
+       /**
+        * pbss - Whether to start a PCP (in PBSS) instead of an AP in
+        * infrastructure BSS. Valid only for DMG network.
+        */
+       int pbss;
 };
 
 struct wpa_driver_mesh_bss_params {
@@ -1216,8 +1269,13 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS_SUPPORT_HW_MODE_ANY   0x0000004000000000ULL
 /** Driver supports simultaneous off-channel operations */
 #define WPA_DRIVER_FLAGS_OFFCHANNEL_SIMULTANEOUS       0x0000008000000000ULL
+/** Driver supports full AP client state */
+#define WPA_DRIVER_FLAGS_FULL_AP_CLIENT_STATE  0x0000010000000000ULL
        u64 flags;
 
+#define FULL_AP_CLIENT_STATE_SUPP(drv_flags) \
+       (drv_flags & WPA_DRIVER_FLAGS_FULL_AP_CLIENT_STATE)
+
 #define WPA_DRIVER_SMPS_MODE_STATIC                    0x00000001
 #define WPA_DRIVER_SMPS_MODE_DYNAMIC                   0x00000002
        unsigned int smps_modes;
@@ -1233,6 +1291,15 @@ struct wpa_driver_capa {
        /** Maximum number of supported active probe SSIDs for sched_scan */
        int max_sched_scan_ssids;
 
+       /** Maximum number of supported scan plans for scheduled scan */
+       unsigned int max_sched_scan_plans;
+
+       /** Maximum interval in a scan plan. In seconds */
+       u32 max_sched_scan_plan_interval;
+
+       /** Maximum number of iterations in a single scan plan */
+       u32 max_sched_scan_plan_iterations;
+
        /** Whether sched_scan (offloaded scanning) is supported */
        int sched_scan_supported;
 
@@ -1315,7 +1382,9 @@ struct wpa_driver_capa {
 struct hostapd_data;
 
 struct hostap_sta_driver_data {
-       unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
+       unsigned long rx_packets, tx_packets;
+       unsigned long long rx_bytes, tx_bytes;
+       int bytes_64bit; /* whether 64-bit byte counters are supported */
        unsigned long current_tx_rate;
        unsigned long inactive_msec;
        unsigned long flags;
@@ -1350,6 +1419,7 @@ struct hostapd_sta_add_params {
        size_t supp_channels_len;
        const u8 *supp_oper_classes;
        size_t supp_oper_classes_len;
+       int support_p2p_ps;
 };
 
 struct mac_address {
@@ -1455,6 +1525,7 @@ struct wpa_bss_params {
 #define WPA_STA_MFP BIT(3)
 #define WPA_STA_TDLS_PEER BIT(4)
 #define WPA_STA_AUTHENTICATED BIT(5)
+#define WPA_STA_ASSOCIATED BIT(6)
 
 enum tdls_oper {
        TDLS_DISCOVERY_REQ,
@@ -1888,6 +1959,14 @@ struct wpa_driver_ops {
        void (*poll)(void *priv);
 
        /**
+        * get_ifindex - Get interface index
+        * @priv: private driver interface data
+        *
+        * Returns: Interface index
+        */
+       unsigned int (*get_ifindex)(void *priv);
+
+       /**
         * get_ifname - Get interface name
         * @priv: private driver interface data
         *
@@ -2021,6 +2100,7 @@ struct wpa_driver_ops {
 
        /**
         * global_init - Global driver initialization
+        * @ctx: wpa_global pointer
         * Returns: Pointer to private data (global), %NULL on failure
         *
         * This optional function is called to initialize the driver wrapper
@@ -2030,7 +2110,7 @@ struct wpa_driver_ops {
         * use init2() function instead of init() to get the pointer to global
         * data available to per-interface initializer.
         */
-       void * (*global_init)(void);
+       void * (*global_init)(void *ctx);
 
        /**
         * global_deinit - Global driver deinitialization
@@ -2316,12 +2396,17 @@ struct wpa_driver_ops {
         * @params: Station parameters
         * Returns: 0 on success, -1 on failure
         *
-        * This function is used to add a station entry to the driver once the
-        * station has completed association. This is only used if the driver
+        * This function is used to add or set (params->set 1) a station
+        * entry in the driver. Adding STA entries is used only if the driver
         * does not take care of association processing.
         *
-        * With TDLS, this function is also used to add or set (params->set 1)
-        * TDLS peer entries.
+        * With drivers that don't support full AP client state, this function
+        * is used to add a station entry to the driver once the station has
+        * completed association.
+        *
+        * With TDLS, this function is used to add or set (params->set 1)
+        * TDLS peer entries (even with drivers that do not support full AP
+        * client state).
         */
        int (*sta_add)(void *priv, struct hostapd_sta_add_params *params);
 
@@ -2407,12 +2492,13 @@ struct wpa_driver_ops {
         *      change interface address)
         * @bridge: Bridge interface to use or %NULL if no bridge configured
         * @use_existing: Whether to allow existing interface to be used
+        * @setup_ap: Whether to setup AP for %WPA_IF_AP_BSS interfaces
         * 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, char *force_ifname, u8 *if_addr,
-                     const char *bridge, int use_existing);
+                     const char *bridge, int use_existing, int setup_ap);
 
        /**
         * if_remove - Remove a virtual interface
@@ -2994,7 +3080,6 @@ struct wpa_driver_ops {
         * sched_scan - Request the driver to initiate scheduled scan
         * @priv: Private driver interface data
         * @params: Scan parameters
-        * @interval: Interval between scan cycles in milliseconds
         * Returns: 0 on success, -1 on failure
         *
         * This operation should be used for scheduled scan offload to
@@ -3005,8 +3090,7 @@ struct wpa_driver_ops {
         * and if not provided or if it returns -1, we fall back to
         * normal host-scheduled scans.
         */
-       int (*sched_scan)(void *priv, struct wpa_driver_scan_params *params,
-                         u32 interval);
+       int (*sched_scan)(void *priv, struct wpa_driver_scan_params *params);
 
        /**
         * stop_sched_scan - Request the driver to stop a scheduled scan
@@ -3447,6 +3531,13 @@ struct wpa_driver_ops {
         * on. Local device is assuming P2P Client role.
         */
        int (*set_prob_oper_freq)(void *priv, unsigned int freq);
+
+       /**
+        * abort_scan - Request the driver to abort an ongoing scan
+        * @priv: Private driver interface data
+        * Returns 0 on success, -1 on failure
+        */
+       int (*abort_scan)(void *priv);
 };
 
 
@@ -4188,6 +4279,7 @@ union wpa_event_data {
         * struct interface_status - Data for EVENT_INTERFACE_STATUS
         */
        struct interface_status {
+               unsigned int ifindex;
                char ifname[100];
                enum {
                        EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED
@@ -4664,6 +4756,18 @@ union wpa_event_data {
 void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                          union wpa_event_data *data);
 
+/**
+ * wpa_supplicant_event_global - Report a driver event for wpa_supplicant
+ * @ctx: Context pointer (wpa_s); this is the ctx variable registered
+ *     with struct wpa_driver_ops::init()
+ * @event: event type (defined above)
+ * @data: possible extra data for the event
+ *
+ * Same as wpa_supplicant_event(), but we search for the interface in
+ * wpa_global.
+ */
+void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
+                                union wpa_event_data *data);
 
 /*
  * The following inline functions are provided for convenience to simplify