P2P: Add p2p_unauthorize command
[mech_eap.git] / src / p2p / p2p.h
index c34c97b..bab4939 100644 (file)
@@ -122,6 +122,11 @@ struct p2p_go_neg_results {
         * persistent_group - Whether the group should be made persistent
         */
        int persistent_group;
+
+       /**
+        * peer_config_timeout - Peer configuration timeout (in 10 msec units)
+        */
+       unsigned int peer_config_timeout;
 };
 
 struct p2p_data;
@@ -166,6 +171,11 @@ struct p2p_config {
        u8 op_channel;
 
        /**
+        * cfg_op_channel - Whether op_channel is hardcoded in configuration
+        */
+       u8 cfg_op_channel;
+
+       /**
         * channels - Own supported regulatory classes and channels
         *
         * List of supposerted channels per regulatory class. The regulatory
@@ -218,6 +228,11 @@ struct p2p_config {
        size_t max_peers;
 
        /**
+        * p2p_intra_bss - Intra BSS communication is supported
+        */
+       int p2p_intra_bss;
+
+       /**
         * ssid_postfix - Postfix data to add to the SSID
         *
         * This data will be added to the end of the SSID after the
@@ -602,6 +617,19 @@ void p2p_deinit(struct p2p_data *p2p);
 void p2p_flush(struct p2p_data *p2p);
 
 /**
+ * p2p_unauthorize - Unauthorize the specified peer device
+ * @p2p: P2P module context from p2p_init()
+ * @addr: P2P peer entry to be unauthorized
+ * Returns: 0 on success, -1 on failure
+ *
+ * This command removes any connection authorization from the specified P2P
+ * peer device address. This can be used, e.g., to cancel effect of a previous
+ * p2p_authorize() or p2p_connect() call that has not yet resulted in completed
+ * GO Negotiation.
+ */
+int p2p_unauthorize(struct p2p_data *p2p, const u8 *addr);
+
+/**
  * p2p_set_dev_name - Set device name
  * @p2p: P2P module context from p2p_init()
  * Returns: 0 on success, -1 on failure
@@ -660,6 +688,16 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
 void p2p_stop_find(struct p2p_data *p2p);
 
 /**
+ * p2p_stop_find_for_freq - Stop P2P Find for next oper on specific freq
+ * @p2p: P2P module context from p2p_init()
+ * @freq: Frequency in MHz for next operation
+ *
+ * This is like p2p_stop_find(), but Listen state is not stopped if we are
+ * already on the same frequency.
+ */
+void p2p_stop_find_for_freq(struct p2p_data *p2p, int freq);
+
+/**
  * p2p_listen - Start P2P Listen state for specified duration
  * @p2p: P2P module context from p2p_init()
  * @timeout: Listen state duration in milliseconds
@@ -931,6 +969,12 @@ int p2p_scan_res_handler(struct p2p_data *p2p, const u8 *bssid, int freq,
  */
 void p2p_scan_res_handled(struct p2p_data *p2p);
 
+enum p2p_send_action_result {
+       P2P_SEND_ACTION_SUCCESS /* Frame was send and acknowledged */,
+       P2P_SEND_ACTION_NO_ACK /* Frame was sent, but not acknowledged */,
+       P2P_SEND_ACTION_FAILED /* Frame was not sent due to a failure */
+};
+
 /**
  * p2p_send_action_cb - Notify TX status of an Action frame
  * @p2p: P2P module context from p2p_init()
@@ -938,13 +982,14 @@ void p2p_scan_res_handled(struct p2p_data *p2p);
  * @dst: Destination MAC address (Address 1)
  * @src: Source MAC address (Address 2)
  * @bssid: BSSID (Address 3)
- * @success: Whether the transmission succeeded
+ * @result: Result of the transmission attempt
  *
  * This function is used to indicate the result of an Action frame transmission
  * that was requested with struct p2p_config::send_action() callback.
  */
 void p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
-                       const u8 *src, const u8 *bssid, int success);
+                       const u8 *src, const u8 *bssid,
+                       enum p2p_send_action_result result);
 
 /**
  * p2p_listen_cb - Indicate the start of a requested Listen state
@@ -998,6 +1043,11 @@ struct p2p_group_config {
        u8 interface_addr[ETH_ALEN];
 
        /**
+        * max_clients - Maximum number of clients in the group
+        */
+       unsigned int max_clients;
+
+       /**
         * cb_ctx - Context to use with callback functions
         */
        void *cb_ctx;
@@ -1017,6 +1067,13 @@ struct p2p_group_config {
         */
        void (*ie_update)(void *ctx, struct wpabuf *beacon_ies,
                          struct wpabuf *proberesp_ies);
+
+       /**
+        * idle_update - Notification of changes in group idle state
+        * @ctx: Callback context from cb_ctx
+        * @idle: Whether the group is idle (no associated stations)
+        */
+       void (*idle_update)(void *ctx, int idle);
 };
 
 /**
@@ -1235,4 +1292,34 @@ void p2p_set_cross_connect(struct p2p_data *p2p, int enabled);
 
 int p2p_get_oper_freq(struct p2p_data *p2p, const u8 *iface_addr);
 
+int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, int level,
+                  const u8 *ies, size_t ies_len);
+
+/**
+ * p2p_set_intra_bss_dist - Set intra BSS distribution
+ * @p2p: P2P module context from p2p_init()
+ * @enabled: Whether intra BSS distribution will be enabled
+ */
+void p2p_set_intra_bss_dist(struct p2p_data *p2p, int enabled);
+
+/**
+ * p2p_supported_freq - Check whether channel is supported for P2P
+ * @p2p: P2P module context from p2p_init()
+ * @freq: Channel frequency in MHz
+ * Returns: 0 if channel not usable for P2P, 1 if usable for P2P
+ */
+int p2p_supported_freq(struct p2p_data *p2p, unsigned int freq);
+
+void p2p_update_channel_list(struct p2p_data *p2p, struct p2p_channels *chan);
+
+/**
+ * p2p_set_best_channels - Update best channel information
+ * @p2p: P2P module context from p2p_init()
+ * @freq_24: Frequency (MHz) of best channel in 2.4 GHz band
+ * @freq_5: Frequency (MHz) of best channel in 5 GHz band
+ * @freq_overall: Frequency (MHz) of best channel overall
+ */
+void p2p_set_best_channels(struct p2p_data *p2p, int freq_24, int freq_5,
+                          int freq_overall);
+
 #endif /* P2P_H */