]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - src/p2p/p2p.h
P2P: Wait until ongoing scan completes before starting P2P find
[thirdparty/hostap.git] / src / p2p / p2p.h
index db816a62cafe04ae51df35ff5a79293b45da0544..1501a20146b94b13940f5841f64126b373f55346 100644 (file)
@@ -56,7 +56,7 @@ struct p2p_channels {
 };
 
 enum p2p_wps_method {
-       WPS_NOT_READY, WPS_PIN_LABEL, WPS_PIN_DISPLAY, WPS_PIN_KEYPAD, WPS_PBC
+       WPS_NOT_READY, WPS_PIN_DISPLAY, WPS_PIN_KEYPAD, WPS_PBC
 };
 
 /**
@@ -120,6 +120,9 @@ struct p2p_go_neg_results {
 
        /**
         * persistent_group - Whether the group should be made persistent
+        * 0 = not persistent
+        * 1 = persistent group without persistent reconnect
+        * 2 = persistent group with persistent reconnect
         */
        int persistent_group;
 
@@ -846,7 +849,9 @@ int p2p_listen(struct p2p_data *p2p, unsigned int timeout);
  * @go_intent: Local GO intent value (1..15)
  * @own_interface_addr: Intended interface address to use with the group
  * @force_freq: The only allowed channel frequency in MHz or 0
- * @persistent_group: Whether to create a persistent group
+ * @persistent_group: Whether to create a persistent group (0 = no, 1 =
+ * persistent group without persistent reconnect, 2 = persistent group with
+ * persistent reconnect)
  * Returns: 0 on success, -1 on failure
  */
 int p2p_connect(struct p2p_data *p2p, const u8 *peer_addr,
@@ -862,7 +867,9 @@ int p2p_connect(struct p2p_data *p2p, const u8 *peer_addr,
  * @go_intent: Local GO intent value (1..15)
  * @own_interface_addr: Intended interface address to use with the group
  * @force_freq: The only allowed channel frequency in MHz or 0
- * @persistent_group: Whether to create a persistent group
+ * @persistent_group: Whether to create a persistent group (0 = no, 1 =
+ * persistent group without persistent reconnect, 2 = persistent group with
+ * persistent reconnect)
  * Returns: 0 on success, -1 on failure
  *
  * This is like p2p_connect(), but the actual group negotiation is not
@@ -1035,12 +1042,14 @@ void p2p_group_formation_failed(struct p2p_data *p2p);
  * p2p_probe_req_rx - Report reception of a Probe Request frame
  * @p2p: P2P module context from p2p_init()
  * @addr: Source MAC address
+ * @dst: Destination MAC address if available or %NULL
+ * @bssid: BSSID if available or %NULL
  * @ie: Information elements from the Probe Request frame body
  * @ie_len: Length of ie buffer in octets
  * Returns: 0 to indicate the frame was not processed or 1 if it was
  */
-int p2p_probe_req_rx(struct p2p_data *p2p, const u8 *addr, const u8 *ie,
-                    size_t ie_len);
+int p2p_probe_req_rx(struct p2p_data *p2p, const u8 *addr, const u8 *dst,
+                    const u8 *bssid, const u8 *ie, size_t ie_len);
 
 /**
  * p2p_rx_action - Report received Action frame
@@ -1162,6 +1171,9 @@ struct p2p_group;
 struct p2p_group_config {
        /**
         * persistent_group - Whether the group is persistent
+        * 0 = not a persistent group
+        * 1 = persistent group without persistent reconnect
+        * 2 = persistent group with persistent reconnect
         */
        int persistent_group;
 
@@ -1341,6 +1353,13 @@ int p2p_assoc_req_ie(struct p2p_data *p2p, const u8 *bssid, u8 *buf,
  */
 void p2p_scan_ie(struct p2p_data *p2p, struct wpabuf *ies);
 
+/**
+ * p2p_scan_ie_buf_len - Get maximum buffer length needed for p2p_scan_ie
+ * @p2p: P2P module context from p2p_init()
+ * Returns: Number of octets that p2p_scan_ie() may add to the buffer
+ */
+size_t p2p_scan_ie_buf_len(struct p2p_data *p2p);
+
 /**
  * p2p_go_params - Generate random P2P group parameters
  * @p2p: P2P module context from p2p_init()
@@ -1468,6 +1487,15 @@ unsigned int p2p_get_group_num_members(struct p2p_group *group);
  */
 const u8 * p2p_iterate_group_members(struct p2p_group *group, void **next);
 
+/**
+ * p2p_group_get_dev_addr - Get a P2P Device Address of a client in a group
+ * @group: P2P group context from p2p_group_init()
+ * @addr: P2P Interface Address of the client
+ * Returns: P2P Device Address of the client if found or %NULL if no match
+ * found
+ */
+const u8 * p2p_group_get_dev_addr(struct p2p_group *group, const u8 *addr);
+
 /**
  * p2p_get_peer_found - Get P2P peer info structure of a found peer
  * @p2p: P2P module context from p2p_init()
@@ -1507,4 +1535,18 @@ int p2p_add_wps_vendor_extension(struct p2p_data *p2p,
 int p2p_set_oper_channel(struct p2p_data *p2p, u8 op_reg_class, u8 op_channel,
                         int cfg_op_channel);
 
+/**
+ * p2p_in_progress - Check whether a P2P operation is progress
+ * @p2p: P2P module context from p2p_init()
+ * Returns: 0 if P2P module is idle or 1 if an operation is in progress
+ */
+int p2p_in_progress(struct p2p_data *p2p);
+
+/**
+ * p2p_other_scan_completed - Notify completion of non-P2P scan
+ * @p2p: P2P module context from p2p_init()
+ * Returns: 0 if P2P module is idle or 1 if an operation was started
+ */
+int p2p_other_scan_completed(struct p2p_data *p2p);
+
 #endif /* P2P_H */