wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Macros | Enumerations | Functions
p2p.h File Reference

Wi-Fi Direct - P2P module. More...

#include "common/ieee802_11_defs.h"
#include "wps/wps.h"

Go to the source code of this file.

Data Structures

struct  p2p_channels
 List of supported channels. More...
 
struct  p2p_channels::p2p_reg_class
 Supported regulatory class. More...
 
struct  p2p_go_neg_results
 P2P Group Owner Negotiation results. More...
 
struct  p2ps_provision
 
struct  p2ps_advertisement
 
struct  p2p_peer_info
 P2P peer information. More...
 
struct  p2p_channel
 
struct  p2p_config
 P2P configuration. More...
 
struct  p2p_group_config
 P2P group configuration. More...
 
struct  p2p_nfc_params
 

Macros

#define P2PS_SETUP_NONE   0
 
#define P2PS_SETUP_NEW   BIT(0)
 
#define P2PS_SETUP_CLIENT   BIT(1)
 
#define P2PS_SETUP_GROUP_OWNER   BIT(2)
 
#define P2PS_WILD_HASH_STR   "org.wi-fi.wfds"
 
#define P2PS_HASH_LEN   6
 
#define P2P_MAX_QUERY_HASH   6
 
#define P2PS_FEATURE_CAPAB_CPT_MAX   2
 
#define P2P_MAX_PREF_CHANNELS   100
 Maximum number of preferred channels.
 
#define P2P_MAX_REG_CLASSES   10
 Maximum number of regulatory classes.
 
#define P2P_MAX_REG_CLASS_CHANNELS   20
 Maximum number of channels per regulatory class.
 
#define P2P_MAX_CHANNELS   50
 
#define P2P_MAX_WPS_VENDOR_EXT   10
 
#define P2P_SEC_DEVICE_TYPES   5
 Maximum number of secondary device types.
 

Enumerations

enum  p2p_wps_method {
  WPS_NOT_READY, WPS_PIN_DISPLAY, WPS_PIN_KEYPAD, WPS_PBC,
  WPS_NFC, WPS_P2PS
}
 
enum  p2p_scan_type { P2P_SCAN_SOCIAL, P2P_SCAN_FULL, P2P_SCAN_SPECIFIC, P2P_SCAN_SOCIAL_PLUS_ONE }
 
enum  p2p_prov_disc_status {
  P2P_PROV_DISC_SUCCESS, P2P_PROV_DISC_TIMEOUT, P2P_PROV_DISC_REJECTED, P2P_PROV_DISC_TIMEOUT_JOIN,
  P2P_PROV_DISC_INFO_UNAVAILABLE
}
 
enum  p2p_discovery_type { P2P_FIND_START_WITH_FULL, P2P_FIND_ONLY_SOCIAL, P2P_FIND_PROGRESSIVE }
 
enum  p2p_invite_role { P2P_INVITE_ROLE_GO, P2P_INVITE_ROLE_ACTIVE_GO, P2P_INVITE_ROLE_CLIENT }
 
enum  p2p_probe_req_status {
  P2P_PREQ_MALFORMED, P2P_PREQ_NOT_LISTEN, P2P_PREQ_NOT_P2P, P2P_PREQ_NOT_PROCESSED,
  P2P_PREQ_PROCESSED
}
 enum p2p_probe_req_status More...
 
enum  p2p_send_action_result { P2P_SEND_ACTION_SUCCESS, P2P_SEND_ACTION_NO_ACK, P2P_SEND_ACTION_FAILED }
 

Functions

struct p2p_datap2p_init (const struct p2p_config *cfg)
 Initialize P2P module. More...
 
void p2p_deinit (struct p2p_data *p2p)
 Deinitialize P2P module. More...
 
void p2p_flush (struct p2p_data *p2p)
 Flush P2P module state. More...
 
int p2p_unauthorize (struct p2p_data *p2p, const u8 *addr)
 Unauthorize the specified peer device. More...
 
int p2p_set_dev_name (struct p2p_data *p2p, const char *dev_name)
 Set device name. More...
 
int p2p_set_manufacturer (struct p2p_data *p2p, const char *manufacturer)
 
int p2p_set_model_name (struct p2p_data *p2p, const char *model_name)
 
int p2p_set_model_number (struct p2p_data *p2p, const char *model_number)
 
int p2p_set_serial_number (struct p2p_data *p2p, const char *serial_number)
 
void p2p_set_config_methods (struct p2p_data *p2p, u16 config_methods)
 
void p2p_set_uuid (struct p2p_data *p2p, const u8 *uuid)
 
int p2p_set_pri_dev_type (struct p2p_data *p2p, const u8 *pri_dev_type)
 Set primary device type. More...
 
int p2p_set_sec_dev_types (struct p2p_data *p2p, const u8 dev_types[][8], size_t num_dev_types)
 Set secondary device types. More...
 
int p2p_set_country (struct p2p_data *p2p, const char *country)
 
int p2p_find (struct p2p_data *p2p, unsigned int timeout, enum p2p_discovery_type type, unsigned int num_req_dev_types, const u8 *req_dev_types, const u8 *dev_id, unsigned int search_delay, u8 seek_count, const char **seek_string, int freq)
 Start P2P Find (Device Discovery) More...
 
void p2p_notify_scan_trigger_status (struct p2p_data *p2p, int status)
 Indicate scan trigger status. More...
 
void p2p_stop_find (struct p2p_data *p2p)
 Stop P2P Find (Device Discovery) More...
 
void p2p_stop_find_for_freq (struct p2p_data *p2p, int freq)
 Stop P2P Find for next oper on specific freq. More...
 
int p2p_listen (struct p2p_data *p2p, unsigned int timeout)
 Start P2P Listen state for specified duration. More...
 
void p2p_stop_listen (struct p2p_data *p2p)
 Stop P2P Listen. More...
 
int p2p_connect (struct p2p_data *p2p, const u8 *peer_addr, enum p2p_wps_method wps_method, int go_intent, const u8 *own_interface_addr, unsigned int force_freq, int persistent_group, const u8 *force_ssid, size_t force_ssid_len, int pd_before_go_neg, unsigned int pref_freq, u16 oob_pw_id)
 Start P2P group formation (GO negotiation) More...
 
int p2p_authorize (struct p2p_data *p2p, const u8 *peer_addr, enum p2p_wps_method wps_method, int go_intent, const u8 *own_interface_addr, unsigned int force_freq, int persistent_group, const u8 *force_ssid, size_t force_ssid_len, unsigned int pref_freq, u16 oob_pw_id)
 Authorize P2P group formation (GO negotiation) More...
 
int p2p_reject (struct p2p_data *p2p, const u8 *peer_addr)
 Reject peer device (explicitly block connection attempts) More...
 
int p2p_prov_disc_req (struct p2p_data *p2p, const u8 *peer_addr, struct p2ps_provision *p2ps_prov, u16 config_methods, int join, int force_freq, int user_initiated_pd)
 Send Provision Discovery Request. More...
 
void * p2p_sd_request (struct p2p_data *p2p, const u8 *dst, const struct wpabuf *tlvs)
 Schedule a service discovery query. More...
 
int p2p_sd_cancel_request (struct p2p_data *p2p, void *req)
 Cancel a pending service discovery query. More...
 
void p2p_sd_response (struct p2p_data *p2p, int freq, const u8 *dst, u8 dialog_token, const struct wpabuf *resp_tlvs)
 Send response to a service discovery query. More...
 
void p2p_sd_service_update (struct p2p_data *p2p)
 Indicate a change in local services. More...
 
int p2p_invite (struct p2p_data *p2p, const u8 *peer, enum p2p_invite_role role, const u8 *bssid, const u8 *ssid, size_t ssid_len, unsigned int force_freq, const u8 *go_dev_addr, int persistent_group, unsigned int pref_freq, int dev_pw_id)
 Invite a P2P Device into a group. More...
 
int p2p_presence_req (struct p2p_data *p2p, const u8 *go_interface_addr, const u8 *own_interface_addr, unsigned int freq, u32 duration1, u32 interval1, u32 duration2, u32 interval2)
 Request GO presence. More...
 
int p2p_ext_listen (struct p2p_data *p2p, unsigned int period, unsigned int interval)
 Set Extended Listen Timing. More...
 
void p2p_wps_success_cb (struct p2p_data *p2p, const u8 *mac_addr)
 Report successfully completed WPS provisioning. More...
 
void p2p_group_formation_failed (struct p2p_data *p2p)
 Report failed WPS provisioning. More...
 
u16 p2p_get_provisioning_info (struct p2p_data *p2p, const u8 *addr)
 Get any stored provisioning info. More...
 
void p2p_clear_provisioning_info (struct p2p_data *p2p, const u8 *addr)
 Clear any stored provisioning info. More...
 
enum p2p_probe_req_status p2p_probe_req_rx (struct p2p_data *p2p, const u8 *addr, const u8 *dst, const u8 *bssid, const u8 *ie, size_t ie_len, unsigned int rx_freq)
 Report reception of a Probe Request frame. More...
 
void p2p_rx_action (struct p2p_data *p2p, const u8 *da, const u8 *sa, const u8 *bssid, u8 category, const u8 *data, size_t len, int freq)
 Report received Action frame. More...
 
int p2p_scan_res_handler (struct p2p_data *p2p, const u8 *bssid, int freq, struct os_reltime *rx_time, int level, const u8 *ies, size_t ies_len)
 Indicate a P2P scan results. More...
 
void p2p_scan_res_handled (struct p2p_data *p2p)
 Indicate end of scan results. More...
 
void p2p_send_action_cb (struct p2p_data *p2p, unsigned int freq, const u8 *dst, const u8 *src, const u8 *bssid, enum p2p_send_action_result result)
 Notify TX status of an Action frame. More...
 
void p2p_listen_cb (struct p2p_data *p2p, unsigned int freq, unsigned int duration)
 Indicate the start of a requested Listen state. More...
 
int p2p_listen_end (struct p2p_data *p2p, unsigned int freq)
 Indicate the end of a requested Listen state. More...
 
void p2p_deauth_notif (struct p2p_data *p2p, const u8 *bssid, u16 reason_code, const u8 *ie, size_t ie_len)
 
void p2p_disassoc_notif (struct p2p_data *p2p, const u8 *bssid, u16 reason_code, const u8 *ie, size_t ie_len)
 
struct p2p_groupp2p_group_init (struct p2p_data *p2p, struct p2p_group_config *config)
 Initialize P2P group. More...
 
void p2p_group_deinit (struct p2p_group *group)
 Deinitialize P2P group. More...
 
int p2p_group_notif_assoc (struct p2p_group *group, const u8 *addr, const u8 *ie, size_t len)
 Notification of P2P client association with GO. More...
 
struct wpabufp2p_group_assoc_resp_ie (struct p2p_group *group, u8 status)
 Build P2P IE for (re)association response. More...
 
void p2p_group_notif_disassoc (struct p2p_group *group, const u8 *addr)
 Notification of P2P client disassociation from GO. More...
 
void p2p_group_notif_formation_done (struct p2p_group *group)
 Notification of completed group formation. More...
 
int p2p_group_notif_noa (struct p2p_group *group, const u8 *noa, size_t noa_len)
 Notification of NoA change. More...
 
int p2p_group_match_dev_type (struct p2p_group *group, struct wpabuf *wps)
 Match device types in group with requested type. More...
 
int p2p_group_match_dev_id (struct p2p_group *group, struct wpabuf *p2p)
 Match P2P Device Address in group with requested device id.
 
int p2p_group_go_discover (struct p2p_group *group, const u8 *dev_id, const u8 *searching_dev, int rx_freq)
 Send GO Discoverability Request to a group client. More...
 
int p2p_ie_text (struct wpabuf *p2p_ie, char *buf, char *end)
 Build text format description of P2P IE. More...
 
int p2p_scan_result_text (const u8 *ies, size_t ies_len, char *buf, char *end)
 Build text format description of P2P IE. More...
 
int p2p_parse_dev_addr_in_p2p_ie (struct wpabuf *p2p_ie, u8 *dev_addr)
 Parse P2P Device Address from a concatenated P2P IE. More...
 
int p2p_parse_dev_addr (const u8 *ies, size_t ies_len, u8 *dev_addr)
 Parse P2P Device Address from P2P IE(s) More...
 
int p2p_assoc_req_ie (struct p2p_data *p2p, const u8 *bssid, u8 *buf, size_t len, int p2p_group, struct wpabuf *p2p_ie)
 Build P2P IE for (Re)Association Request frame. More...
 
void p2p_scan_ie (struct p2p_data *p2p, struct wpabuf *ies, const u8 *dev_id)
 Build P2P IE for Probe Request. More...
 
size_t p2p_scan_ie_buf_len (struct p2p_data *p2p)
 Get maximum buffer length needed for p2p_scan_ie. More...
 
int p2p_go_params (struct p2p_data *p2p, struct p2p_go_neg_results *params)
 Generate random P2P group parameters. More...
 
u8 p2p_get_group_capab (const struct wpabuf *p2p_ie)
 Get Group Capability from P2P IE data. More...
 
int p2p_get_cross_connect_disallowed (const struct wpabuf *p2p_ie)
 Does WLAN AP disallows cross connection. More...
 
const u8 * p2p_get_go_dev_addr (const struct wpabuf *p2p_ie)
 Get P2P Device Address from P2P IE data. More...
 
const struct p2p_peer_infop2p_get_peer_info (struct p2p_data *p2p, const u8 *addr, int next)
 Get P2P peer information. More...
 
int p2p_get_peer_info_txt (const struct p2p_peer_info *info, char *buf, size_t buflen)
 Get internal P2P peer information in text format. More...
 
int p2p_peer_known (struct p2p_data *p2p, const u8 *addr)
 Check whether P2P peer is known. More...
 
void p2p_set_client_discoverability (struct p2p_data *p2p, int enabled)
 Set client discoverability capability. More...
 
void p2p_set_managed_oper (struct p2p_data *p2p, int enabled)
 Set managed P2P Device operations capability. More...
 
int p2p_config_get_random_social (struct p2p_config *p2p, u8 *op_class, u8 *op_channel)
 Return a random social channel. More...
 
int p2p_set_listen_channel (struct p2p_data *p2p, u8 reg_class, u8 channel, u8 forced)
 
u8 p2p_get_listen_channel (struct p2p_data *p2p)
 
int p2p_set_ssid_postfix (struct p2p_data *p2p, const u8 *postfix, size_t len)
 
int p2p_get_interface_addr (struct p2p_data *p2p, const u8 *dev_addr, u8 *iface_addr)
 
int p2p_get_dev_addr (struct p2p_data *p2p, const u8 *iface_addr, u8 *dev_addr)
 
void p2p_set_peer_filter (struct p2p_data *p2p, const u8 *addr)
 
void p2p_set_cross_connect (struct p2p_data *p2p, int enabled)
 Set cross connection capability. More...
 
int p2p_get_oper_freq (struct p2p_data *p2p, const u8 *iface_addr)
 
void p2p_set_intra_bss_dist (struct p2p_data *p2p, int enabled)
 Set intra BSS distribution. More...
 
int p2p_channels_includes_freq (const struct p2p_channels *channels, unsigned int freq)
 
int p2p_channels_to_freqs (const struct p2p_channels *channels, int *freq_list, unsigned int max_len)
 
int p2p_supported_freq (struct p2p_data *p2p, unsigned int freq)
 Check whether channel is supported for P2P. More...
 
int p2p_supported_freq_go (struct p2p_data *p2p, unsigned int freq)
 Check whether channel is supported for P2P GO operation. More...
 
int p2p_supported_freq_cli (struct p2p_data *p2p, unsigned int freq)
 Check whether channel is supported for P2P client operation. More...
 
unsigned int p2p_get_pref_freq (struct p2p_data *p2p, const struct p2p_channels *channels)
 Get channel from preferred channel list. More...
 
void p2p_update_channel_list (struct p2p_data *p2p, const struct p2p_channels *chan, const struct p2p_channels *cli_chan)
 
void p2p_set_best_channels (struct p2p_data *p2p, int freq_24, int freq_5, int freq_overall)
 Update best channel information. More...
 
void p2p_set_own_freq_preference (struct p2p_data *p2p, int freq)
 Set own preference for channel. More...
 
const u8 * p2p_get_go_neg_peer (struct p2p_data *p2p)
 
unsigned int p2p_get_group_num_members (struct p2p_group *group)
 Get number of members in group. More...
 
int p2p_client_limit_reached (struct p2p_group *group)
 Check if client limit is reached. More...
 
const u8 * p2p_iterate_group_members (struct p2p_group *group, void **next)
 Iterate group members. More...
 
const u8 * p2p_group_get_dev_addr (struct p2p_group *group, const u8 *addr)
 Get a P2P Device Address of a client in a group. More...
 
int p2p_group_is_client_connected (struct p2p_group *group, const u8 *dev_addr)
 Check whether a specific client is connected. More...
 
const struct p2p_group_configp2p_group_get_config (struct p2p_group *group)
 Get the group configuration. More...
 
void p2p_loop_on_all_groups (struct p2p_data *p2p, int(*group_callback)(struct p2p_group *group, void *user_data), void *user_data)
 Run the given callback on all groups. More...
 
const struct p2p_peer_infop2p_get_peer_found (struct p2p_data *p2p, const u8 *addr, int next)
 Get P2P peer info structure of a found peer. More...
 
void p2p_remove_wps_vendor_extensions (struct p2p_data *p2p)
 Remove WPS vendor extensions. More...
 
int p2p_add_wps_vendor_extension (struct p2p_data *p2p, const struct wpabuf *vendor_ext)
 Add a WPS vendor extension. More...
 
int p2p_set_oper_channel (struct p2p_data *p2p, u8 op_reg_class, u8 op_channel, int cfg_op_channel)
 Set the P2P operating channel. More...
 
int p2p_set_pref_chan (struct p2p_data *p2p, unsigned int num_pref_chan, const struct p2p_channel *pref_chan)
 Set P2P preferred channel list. More...
 
int p2p_set_no_go_freq (struct p2p_data *p2p, const struct wpa_freq_range_list *list)
 Set no GO channel ranges. More...
 
int p2p_in_progress (struct p2p_data *p2p)
 Check whether a P2P operation is progress. More...
 
const char * p2p_wps_method_text (enum p2p_wps_method method)
 
void p2p_set_config_timeout (struct p2p_data *p2p, u8 go_timeout, u8 client_timeout)
 Set local config timeouts. More...
 
int p2p_set_wfd_ie_beacon (struct p2p_data *p2p, struct wpabuf *ie)
 
int p2p_set_wfd_ie_probe_req (struct p2p_data *p2p, struct wpabuf *ie)
 
int p2p_set_wfd_ie_probe_resp (struct p2p_data *p2p, struct wpabuf *ie)
 
int p2p_set_wfd_ie_assoc_req (struct p2p_data *p2p, struct wpabuf *ie)
 
int p2p_set_wfd_ie_invitation (struct p2p_data *p2p, struct wpabuf *ie)
 
int p2p_set_wfd_ie_prov_disc_req (struct p2p_data *p2p, struct wpabuf *ie)
 
int p2p_set_wfd_ie_prov_disc_resp (struct p2p_data *p2p, struct wpabuf *ie)
 
int p2p_set_wfd_ie_go_neg (struct p2p_data *p2p, struct wpabuf *ie)
 
int p2p_set_wfd_dev_info (struct p2p_data *p2p, const struct wpabuf *elem)
 
int p2p_set_wfd_assoc_bssid (struct p2p_data *p2p, const struct wpabuf *elem)
 
int p2p_set_wfd_coupled_sink_info (struct p2p_data *p2p, const struct wpabuf *elem)
 
struct wpabufwifi_display_encaps (struct wpabuf *subelems)
 
int p2p_set_disc_int (struct p2p_data *p2p, int min_disc_int, int max_disc_int, int max_disc_tu)
 Set min/max discoverable interval for p2p_find. More...
 
const char * p2p_get_state_txt (struct p2p_data *p2p)
 Get current P2P state for debug purposes. More...
 
struct wpabufp2p_build_nfc_handover_req (struct p2p_data *p2p, int client_freq, const u8 *go_dev_addr, const u8 *ssid, size_t ssid_len)
 
struct wpabufp2p_build_nfc_handover_sel (struct p2p_data *p2p, int client_freq, const u8 *go_dev_addr, const u8 *ssid, size_t ssid_len)
 
int p2p_process_nfc_connection_handover (struct p2p_data *p2p, struct p2p_nfc_params *params)
 
void p2p_set_authorized_oob_dev_pw_id (struct p2p_data *p2p, u16 dev_pw_id, int go_intent, const u8 *own_interface_addr)
 
int p2p_set_passphrase_len (struct p2p_data *p2p, unsigned int len)
 
void p2p_loop_on_known_peers (struct p2p_data *p2p, void(*peer_callback)(struct p2p_peer_info *peer, void *user_data), void *user_data)
 
void p2p_set_vendor_elems (struct p2p_data *p2p, struct wpabuf **vendor_elem)
 
void p2p_set_intended_addr (struct p2p_data *p2p, const u8 *intended_addr)
 
struct p2ps_advertisementp2p_service_p2ps_id (struct p2p_data *p2p, u32 adv_id)
 
int p2p_service_add_asp (struct p2p_data *p2p, int auto_accept, u32 adv_id, const char *adv_str, u8 svc_state, u16 config_methods, const char *svc_info, const u8 *cpt_priority)
 
int p2p_service_del_asp (struct p2p_data *p2p, u32 adv_id)
 
void p2p_service_flush_asp (struct p2p_data *p2p)
 
struct p2ps_advertisementp2p_get_p2ps_adv_list (struct p2p_data *p2p)
 
void p2p_expire_peers (struct p2p_data *p2p)
 Periodic cleanup function to expire peers. More...
 
void p2p_set_own_pref_freq_list (struct p2p_data *p2p, const unsigned int *pref_freq_list, unsigned int size)
 
int p2p_group_get_common_freqs (struct p2p_group *group, int *common_freqs, unsigned int *num)
 Get the group common frequencies. More...
 

Detailed Description

Wi-Fi Direct - P2P module.

Enumeration Type Documentation

enum p2p_probe_req_status

Parameters
P2P_PREQ_MALFORMEDframe was not well-formed
P2P_PREQ_NOT_LISTENdevice isn't in listen state, frame ignored
P2P_PREQ_NOT_P2Pframe was not a P2P probe request
P2P_PREQ_P2P_NOT_PROCESSEDframe was P2P but wasn't processed
P2P_PREQ_P2P_PROCESSEDframe has been processed by P2P

Function Documentation

int p2p_add_wps_vendor_extension ( struct p2p_data p2p,
const struct wpabuf vendor_ext 
)

Add a WPS vendor extension.

Parameters
p2pP2P module context from p2p_init()
vendor_extThe vendor extensions to add
Returns
0 on success, -1 on failure

The wpabuf structures in the array are owned by the P2P module after this call.

int p2p_assoc_req_ie ( struct p2p_data p2p,
const u8 *  bssid,
u8 *  buf,
size_t  len,
int  p2p_group,
struct wpabuf p2p_ie 
)

Build P2P IE for (Re)Association Request frame.

Parameters
p2pP2P module context from p2p_init()
bssidBSSID
bufBuffer for writing the P2P IE
lenMaximum buf length in octets
p2p_groupWhether this is for association with a P2P GO
p2p_ieReassembled P2P IE data from scan results or NULL if none
Returns
Number of octets written into buf or -1 on failure
int p2p_authorize ( struct p2p_data p2p,
const u8 *  peer_addr,
enum p2p_wps_method  wps_method,
int  go_intent,
const u8 *  own_interface_addr,
unsigned int  force_freq,
int  persistent_group,
const u8 *  force_ssid,
size_t  force_ssid_len,
unsigned int  pref_freq,
u16  oob_pw_id 
)

Authorize P2P group formation (GO negotiation)

Parameters
p2pP2P module context from p2p_init()
peer_addrMAC address of the peer P2P client
wps_methodWPS method to be used in provisioning
go_intentLocal GO intent value (1..15)
own_interface_addrIntended interface address to use with the group
force_freqThe only allowed channel frequency in MHz or 0
persistent_groupWhether to create a persistent group (0 = no, 1 = persistent group without persistent reconnect, 2 = persistent group with persistent reconnect)
force_ssidForced SSID for the group if we become GO or NULL to generate a new SSID
force_ssid_lenLength of $force_ssid buffer
pref_freqPreferred operating frequency in MHz or 0 (this is only used if force_freq == 0)
Returns
0 on success, -1 on failure

This is like p2p_connect(), but the actual group negotiation is not initiated automatically, i.e., the other end is expected to do that.

void p2p_clear_provisioning_info ( struct p2p_data p2p,
const u8 *  addr 
)

Clear any stored provisioning info.

Parameters
p2pP2P module context from p2p_init()
iface_addrPeer P2P Device Address

This function is used to clear stored WPS provisioning info for the given peer.

int p2p_client_limit_reached ( struct p2p_group group)

Check if client limit is reached.

Parameters
groupP2P group context from p2p_group_init()
Returns
1 if no of clients limit reached
int p2p_config_get_random_social ( struct p2p_config p2p,
u8 *  op_class,
u8 *  op_channel 
)

Return a random social channel.

Parameters
p2pP2P config
op_classSelected operating class
op_channelSelected social channel
Returns
0 on success, -1 on failure

This function is used before p2p_init is called. A random social channel from supports bands 2.4 GHz (channels 1,6,11) and 60 GHz (channel 2) is returned on success.

int p2p_connect ( struct p2p_data p2p,
const u8 *  peer_addr,
enum p2p_wps_method  wps_method,
int  go_intent,
const u8 *  own_interface_addr,
unsigned int  force_freq,
int  persistent_group,
const u8 *  force_ssid,
size_t  force_ssid_len,
int  pd_before_go_neg,
unsigned int  pref_freq,
u16  oob_pw_id 
)

Start P2P group formation (GO negotiation)

Parameters
p2pP2P module context from p2p_init()
peer_addrMAC address of the peer P2P client
wps_methodWPS method to be used in provisioning
go_intentLocal GO intent value (1..15)
own_interface_addrIntended interface address to use with the group
force_freqThe only allowed channel frequency in MHz or 0
persistent_groupWhether to create a persistent group (0 = no, 1 = persistent group without persistent reconnect, 2 = persistent group with persistent reconnect)
force_ssidForced SSID for the group if we become GO or NULL to generate a new SSID
force_ssid_lenLength of $force_ssid buffer
pd_before_go_negWhether to send Provision Discovery prior to GO Negotiation as an interoperability workaround when initiating group formation
pref_freqPreferred operating frequency in MHz or 0 (this is only used if force_freq == 0)
Returns
0 on success, -1 on failure
void p2p_deinit ( struct p2p_data p2p)

Deinitialize P2P module.

Parameters
p2pP2P module context from p2p_init()
void p2p_expire_peers ( struct p2p_data p2p)

Periodic cleanup function to expire peers.

Parameters
p2pP2P module context from p2p_init()

This is a cleanup function that the entity calling p2p_init() is expected to call periodically to clean up expired peer entries.

int p2p_ext_listen ( struct p2p_data p2p,
unsigned int  period,
unsigned int  interval 
)

Set Extended Listen Timing.

Parameters
p2pP2P module context from p2p_init()
freqGroup operating frequence (in MHz)
periodAvailability period in milliseconds (1-65535; 0 to disable)
intervalAvailability interval in milliseconds (1-65535; 0 to disable)
Returns
0 on success, -1 on failure

This function can be used to enable or disable (period = interval = 0) Extended Listen Timing. When enabled, the P2P Device will become discoverable (go into Listen State) every interval milliseconds for at least period milliseconds.

int p2p_find ( struct p2p_data p2p,
unsigned int  timeout,
enum p2p_discovery_type  type,
unsigned int  num_req_dev_types,
const u8 *  req_dev_types,
const u8 *  dev_id,
unsigned int  search_delay,
u8  seek_count,
const char **  seek_string,
int  freq 
)

Start P2P Find (Device Discovery)

Parameters
p2pP2P module context from p2p_init()
timeoutTimeout for find operation in seconds or 0 for no timeout
typeDevice Discovery type
num_req_dev_typesNumber of requested device types
req_dev_typesRequested device types array, must be an array containing num_req_dev_types * WPS_DEV_TYPE_LEN bytes; NULL if no requested device types.
dev_idDevice ID to search for or NULL to find all devices
search_delayExtra delay in milliseconds between search iterations
seek_countNumber of ASP Service Strings in the seek_string array
seek_stringASP Service Strings to query for in Probe Requests
freqRequested first scan frequency (in MHz) to modify type == P2P_FIND_START_WITH_FULL behavior. 0 = Use normal full scan. If p2p_find is already in progress, this parameter is ignored and full scan will be executed.
Returns
0 on success, -1 on failure
void p2p_flush ( struct p2p_data p2p)

Flush P2P module state.

Parameters
p2pP2P module context from p2p_init()

This command removes the P2P module state like peer device entries.

int p2p_get_cross_connect_disallowed ( const struct wpabuf p2p_ie)

Does WLAN AP disallows cross connection.

Parameters
p2p_ieP2P IE(s) contents
Returns
0 if cross connection is allow, 1 if not
const u8* p2p_get_go_dev_addr ( const struct wpabuf p2p_ie)

Get P2P Device Address from P2P IE data.

Parameters
p2p_ieP2P IE(s) contents
Returns
Pointer to P2P Device Address or NULL if not included
u8 p2p_get_group_capab ( const struct wpabuf p2p_ie)

Get Group Capability from P2P IE data.

Parameters
p2p_ieP2P IE(s) contents
Returns
Group Capability
unsigned int p2p_get_group_num_members ( struct p2p_group group)

Get number of members in group.

Parameters
groupP2P group context from p2p_group_init()
Returns
Number of members in the group
const struct p2p_peer_info* p2p_get_peer_found ( struct p2p_data p2p,
const u8 *  addr,
int  next 
)

Get P2P peer info structure of a found peer.

Parameters
p2pP2P module context from p2p_init()
addrP2P Device Address of the peer or NULL to indicate the first peer
nextWhether to select the peer entry following the one indicated by addr
Returns
The first P2P peer info available or NULL if no such peer exists
const struct p2p_peer_info* p2p_get_peer_info ( struct p2p_data p2p,
const u8 *  addr,
int  next 
)

Get P2P peer information.

Parameters
p2pP2P module context from p2p_init()
addrP2P Device Address of the peer or NULL to indicate the first peer
nextWhether to select the peer entry following the one indicated by addr
Returns
Pointer to peer info or NULL if not found
int p2p_get_peer_info_txt ( const struct p2p_peer_info info,
char *  buf,
size_t  buflen 
)

Get internal P2P peer information in text format.

Parameters
infoPointer to P2P peer info from p2p_get_peer_info()
bufBuffer for returning text
buflenMaximum buffer length
Returns
Number of octets written to the buffer or -1 on failure

Note: This information is internal to the P2P module and subject to change. As such, this should not really be used by external programs for purposes other than debugging.

unsigned int p2p_get_pref_freq ( struct p2p_data p2p,
const struct p2p_channels channels 
)

Get channel from preferred channel list.

Parameters
p2pP2P module context from p2p_init()
channelsList of channels
Returns
Preferred channel
u16 p2p_get_provisioning_info ( struct p2p_data p2p,
const u8 *  addr 
)

Get any stored provisioning info.

Parameters
p2pP2P module context from p2p_init()
addrPeer P2P Device Address
Returns
WPS provisioning information (WPS config method) or 0 if no information is available

This function is used to retrieve stored WPS provisioning info for the given peer.

const char* p2p_get_state_txt ( struct p2p_data p2p)

Get current P2P state for debug purposes.

Parameters
p2pP2P module context from p2p_init()
Returns
Name of the current P2P module state

It should be noted that the P2P module state names are internal information and subject to change at any point, i.e., this information should be used mainly for debugging purposes.

int p2p_go_params ( struct p2p_data p2p,
struct p2p_go_neg_results params 
)

Generate random P2P group parameters.

Parameters
p2pP2P module context from p2p_init()
paramsBuffer for parameters
Returns
0 on success, -1 on failure
struct wpabuf* p2p_group_assoc_resp_ie ( struct p2p_group group,
u8  status 
)

Build P2P IE for (re)association response.

Parameters
groupP2P group context from p2p_group_init()
statusStatus value (P2P_SC_SUCCESS if association succeeded)
Returns
P2P IE for (Re)association Response or NULL on failure

The caller is responsible for freeing the returned buffer with wpabuf_free().

void p2p_group_deinit ( struct p2p_group group)

Deinitialize P2P group.

Parameters
groupP2P group context from p2p_group_init()
void p2p_group_formation_failed ( struct p2p_data p2p)

Report failed WPS provisioning.

Parameters
p2pP2P module context from p2p_init()

This function is used to report failed group formation. This can happen either due to failed WPS provisioning or due to 15 second timeout during the provisioning phase.

int p2p_group_get_common_freqs ( struct p2p_group group,
int *  common_freqs,
unsigned int *  num 
)

Get the group common frequencies.

Parameters
groupP2P group context from p2p_group_init()
common_freqsOn return will hold the group common frequencies
numOn return will hold the number of group common frequencies
Returns
0 on success, -1 otherwise
const struct p2p_group_config* p2p_group_get_config ( struct p2p_group group)

Get the group configuration.

Parameters
groupP2P group context from p2p_group_init()
Returns
The group configuration pointer
const u8* p2p_group_get_dev_addr ( struct p2p_group group,
const u8 *  addr 
)

Get a P2P Device Address of a client in a group.

Parameters
groupP2P group context from p2p_group_init()
addrP2P Interface Address of the client
Returns
P2P Device Address of the client if found or NULL if no match found
int p2p_group_go_discover ( struct p2p_group group,
const u8 *  dev_id,
const u8 *  searching_dev,
int  rx_freq 
)

Send GO Discoverability Request to a group client.

Parameters
groupP2P group context from p2p_group_init()
Returns
0 on success (frame scheduled); -1 if client was not found
struct p2p_group* p2p_group_init ( struct p2p_data p2p,
struct p2p_group_config config 
)

Initialize P2P group.

Parameters
p2pP2P module context from p2p_init()
configP2P group configuration (will be freed by p2p_group_deinit())
Returns
Pointer to private data or NULL on failure

This function is used to initialize per-group P2P module context. Currently, this is only used to manage GO functionality and P2P clients do not need to create an instance of this per-group information.

int p2p_group_is_client_connected ( struct p2p_group group,
const u8 *  dev_addr 
)

Check whether a specific client is connected.

Parameters
groupP2P group context from p2p_group_init()
addrP2P Device Address of the client
Returns
1 if client is connected or 0 if not
int p2p_group_match_dev_type ( struct p2p_group group,
struct wpabuf wps 
)

Match device types in group with requested type.

Parameters
groupP2P group context from p2p_group_init()
wpsWPS TLVs from Probe Request frame (concatenated WPS IEs)
Returns
1 on match, 0 on mismatch

This function can be used to match the Requested Device Type attribute in WPS IE with the device types of a group member for deciding whether a GO should reply to a Probe Request frame. Match will be reported if the WPS IE is not requested any specific device type.

int p2p_group_notif_assoc ( struct p2p_group group,
const u8 *  addr,
const u8 *  ie,
size_t  len 
)

Notification of P2P client association with GO.

Parameters
groupP2P group context from p2p_group_init()
addrInterface address of the P2P client
ieIEs from the (Re)association Request frame
lenLength of the ie buffer in octets
Returns
0 on success, -1 on failure
void p2p_group_notif_disassoc ( struct p2p_group group,
const u8 *  addr 
)

Notification of P2P client disassociation from GO.

Parameters
groupP2P group context from p2p_group_init()
addrInterface address of the P2P client
void p2p_group_notif_formation_done ( struct p2p_group group)

Notification of completed group formation.

Parameters
groupP2P group context from p2p_group_init()
int p2p_group_notif_noa ( struct p2p_group group,
const u8 *  noa,
size_t  noa_len 
)

Notification of NoA change.

Parameters
groupP2P group context from p2p_group_init()
noaNotice of Absence attribute payload, NULL if none
noa_lenLength of noa buffer in octets
Returns
0 on success, -1 on failure

Notify the P2P group management about a new NoA contents. This will be inserted into the P2P IEs in Beacon and Probe Response frames with rest of the group information.

int p2p_ie_text ( struct wpabuf p2p_ie,
char *  buf,
char *  end 
)

Build text format description of P2P IE.

Parameters
p2p_ieP2P IE
bufBuffer for returning text
endPointer to the end of the buf area
Returns
Number of octets written to the buffer or -1 on failure

This function can be used to parse P2P IE contents into text format field=value lines.

int p2p_in_progress ( struct p2p_data p2p)

Check whether a P2P operation is progress.

Parameters
p2pP2P module context from p2p_init()
Returns
0 if P2P module is idle, 1 if an operation is in progress but not in search state, or 2 if search state operation is in progress
struct p2p_data* p2p_init ( const struct p2p_config cfg)

Initialize P2P module.

Parameters
cfgP2P module configuration
Returns
Pointer to private data or NULL on failure

This function is used to initialize global P2P module context (one per device). The P2P module will keep a copy of the configuration data, so the caller does not need to maintain this structure. However, the callback functions and the context parameters to them must be kept available until the P2P module is deinitialized with p2p_deinit().

int p2p_invite ( struct p2p_data p2p,
const u8 *  peer,
enum p2p_invite_role  role,
const u8 *  bssid,
const u8 *  ssid,
size_t  ssid_len,
unsigned int  force_freq,
const u8 *  go_dev_addr,
int  persistent_group,
unsigned int  pref_freq,
int  dev_pw_id 
)

Invite a P2P Device into a group.

Parameters
p2pP2P module context from p2p_init()
peerDevice Address of the peer P2P Device
roleLocal role in the group
bssidGroup BSSID or NULL if not known
ssidGroup SSID
ssid_lenLength of ssid in octets
force_freqThe only allowed channel frequency in MHz or 0
go_dev_addrForced GO Device Address or NULL if none
persistent_groupWhether this is to reinvoke a persistent group
pref_freqPreferred operating frequency in MHz or 0 (this is only used if force_freq == 0)
dev_pw_idDevice Password ID from OOB Device Password (NFC) static handover case or -1 if not used
Returns
0 on success, -1 on failure
const u8* p2p_iterate_group_members ( struct p2p_group group,
void **  next 
)

Iterate group members.

Parameters
groupP2P group context from p2p_group_init()
nextiteration pointer, must be a pointer to a void * that is set to NULL on the first call and not modified later
Returns
A P2P Device Address for each call and NULL for no more members
int p2p_listen ( struct p2p_data p2p,
unsigned int  timeout 
)

Start P2P Listen state for specified duration.

Parameters
p2pP2P module context from p2p_init()
timeoutListen state duration in milliseconds
Returns
0 on success, -1 on failure

This function can be used to request the P2P module to keep the device discoverable on the listen channel for an extended set of time. At least in its current form, this is mainly used for testing purposes and may not be of much use for normal P2P operations.

void p2p_listen_cb ( struct p2p_data p2p,
unsigned int  freq,
unsigned int  duration 
)

Indicate the start of a requested Listen state.

Parameters
p2pP2P module context from p2p_init()
freqListen channel frequency in MHz
durationDuration for the Listen state in milliseconds

This function is used to indicate that a Listen state requested with struct p2p_config::start_listen() callback has started.

int p2p_listen_end ( struct p2p_data p2p,
unsigned int  freq 
)

Indicate the end of a requested Listen state.

Parameters
p2pP2P module context from p2p_init()
freqListen channel frequency in MHz
Returns
0 if no operations were started, 1 if an operation was started

This function is used to indicate that a Listen state requested with struct p2p_config::start_listen() callback has ended.

void p2p_loop_on_all_groups ( struct p2p_data p2p,
int(*)(struct p2p_group *group, void *user_data)  group_callback,
void *  user_data 
)

Run the given callback on all groups.

Parameters
p2pP2P module context from p2p_init()
group_callbackThe callback function pointer
user_dataSome user data pointer which can be NULL

The group_callback function can stop the iteration by returning 0.

void p2p_notify_scan_trigger_status ( struct p2p_data p2p,
int  status 
)

Indicate scan trigger status.

Parameters
p2pP2P module context from p2p_init()
status0 on success, -1 on failure
int p2p_parse_dev_addr ( const u8 *  ies,
size_t  ies_len,
u8 *  dev_addr 
)

Parse P2P Device Address from P2P IE(s)

Parameters
iesInformation elements from scan results
ies_lenies buffer length in octets
dev_addrBuffer for returning P2P Device Address
Returns
0 on success or -1 if P2P Device Address could not be parsed
int p2p_parse_dev_addr_in_p2p_ie ( struct wpabuf p2p_ie,
u8 *  dev_addr 
)

Parse P2P Device Address from a concatenated P2P IE.

Parameters
p2p_ieP2P IE
dev_addrBuffer for returning P2P Device Address
Returns
0 on success or -1 if P2P Device Address could not be parsed
int p2p_peer_known ( struct p2p_data p2p,
const u8 *  addr 
)

Check whether P2P peer is known.

Parameters
p2pP2P module context from p2p_init()
addrP2P Device Address of the peer
Returns
1 if the specified device is in the P2P peer table or 0 if not
int p2p_presence_req ( struct p2p_data p2p,
const u8 *  go_interface_addr,
const u8 *  own_interface_addr,
unsigned int  freq,
u32  duration1,
u32  interval1,
u32  duration2,
u32  interval2 
)

Request GO presence.

Parameters
p2pP2P module context from p2p_init()
go_interface_addrGO P2P Interface Address
own_interface_addrOwn P2P Interface Address for this group
freqGroup operating frequence (in MHz)
duration1Preferred presence duration in microseconds
interval1Preferred presence interval in microseconds
duration2Acceptable presence duration in microseconds
interval2Acceptable presence interval in microseconds
Returns
0 on success, -1 on failure

If both duration and interval values are zero, the parameter pair is not specified (i.e., to remove Presence Request, use duration1 = interval1 = 0).

enum p2p_probe_req_status p2p_probe_req_rx ( struct p2p_data p2p,
const u8 *  addr,
const u8 *  dst,
const u8 *  bssid,
const u8 *  ie,
size_t  ie_len,
unsigned int  rx_freq 
)

Report reception of a Probe Request frame.

Parameters
p2pP2P module context from p2p_init()
addrSource MAC address
dstDestination MAC address if available or NULL
bssidBSSID if available or NULL
ieInformation elements from the Probe Request frame body
ie_lenLength of ie buffer in octets
rx_freqProbe Request frame RX frequency
Returns
value indicating the type and status of the probe request
int p2p_prov_disc_req ( struct p2p_data p2p,
const u8 *  peer_addr,
struct p2ps_provision p2ps_prov,
u16  config_methods,
int  join,
int  force_freq,
int  user_initiated_pd 
)

Send Provision Discovery Request.

Parameters
p2pP2P module context from p2p_init()
peer_addrMAC address of the peer P2P client
p2ps_provProvisioning info for P2PS
config_methodsWPS Config Methods value (only one bit set)
joinWhether this is used by a client joining an active group
force_freqForced TX frequency for the frame (mainly for the join case)
user_initiated_pdFlag to indicate if initiated by user or not
Returns
0 on success, -1 on failure

This function can be used to request a discovered P2P peer to display a PIN (config_methods = WPS_CONFIG_DISPLAY) or be prepared to enter a PIN from us (config_methods = WPS_CONFIG_KEYPAD). The Provision Discovery Request frame is transmitted once immediately and if no response is received, the frame will be sent again whenever the target device is discovered during device dsicovery (start with a p2p_find() call). Response from the peer is indicated with the p2p_config::prov_disc_resp() callback.

int p2p_reject ( struct p2p_data p2p,
const u8 *  peer_addr 
)

Reject peer device (explicitly block connection attempts)

Parameters
p2pP2P module context from p2p_init()
peer_addrMAC address of the peer P2P client
Returns
0 on success, -1 on failure
void p2p_remove_wps_vendor_extensions ( struct p2p_data p2p)

Remove WPS vendor extensions.

Parameters
p2pP2P module context from p2p_init()
void p2p_rx_action ( struct p2p_data p2p,
const u8 *  da,
const u8 *  sa,
const u8 *  bssid,
u8  category,
const u8 *  data,
size_t  len,
int  freq 
)

Report received Action frame.

Parameters
p2pP2P module context from p2p_init()
daDestination address of the received Action frame
saSource address of the received Action frame
bssidAddress 3 of the received Action frame
categoryCategory of the received Action frame
dataAction frame body after the Category field
lenLength of the data buffer in octets
freqFrequency (in MHz) on which the frame was received
void p2p_scan_ie ( struct p2p_data p2p,
struct wpabuf ies,
const u8 *  dev_id 
)

Build P2P IE for Probe Request.

Parameters
p2pP2P module context from p2p_init()
iesBuffer for writing P2P IE
dev_idDevice ID to search for or NULL for any
size_t p2p_scan_ie_buf_len ( struct p2p_data p2p)

Get maximum buffer length needed for p2p_scan_ie.

Parameters
p2pP2P module context from p2p_init()
Returns
Number of octets that p2p_scan_ie() may add to the buffer
void p2p_scan_res_handled ( struct p2p_data p2p)

Indicate end of scan results.

Parameters
p2pP2P module context from p2p_init()

This function is called to indicate that all P2P scan results from a scan have been reported with zero or more calls to p2p_scan_res_handler(). This function must be called as a response to successful struct p2p_config::p2p_scan() call if none of the p2p_scan_res_handler() calls stopped iteration.

int p2p_scan_res_handler ( struct p2p_data p2p,
const u8 *  bssid,
int  freq,
struct os_reltime rx_time,
int  level,
const u8 *  ies,
size_t  ies_len 
)

Indicate a P2P scan results.

Parameters
p2pP2P module context from p2p_init()
bssidBSSID of the scan result
freqFrequency of the channel on which the device was found in MHz
rx_timeTime when the result was received
levelSignal level (signal strength of the received Beacon/Probe Response frame)
iesPointer to IEs from the scan result
ies_lenLength of the ies buffer
Returns
0 to continue or 1 to stop scan result indication

This function is called to indicate a scan result entry with P2P IE from a scan requested with struct p2p_config::p2p_scan(). This can be called during the actual scan process (i.e., whenever a new device is found) or as a sequence of calls after the full scan has been completed. The former option can result in optimized operations, but may not be supported by all driver/firmware designs. The ies buffer need to include at least the P2P IE, but it is recommended to include all IEs received from the device. The caller does not need to check that the IEs contain a P2P IE before calling this function since frames will be filtered internally if needed.

This function will return 1 if it wants to stop scan result iteration (and scan in general if it is still in progress). This is used to allow faster start of a pending operation, e.g., to start a pending GO negotiation.

int p2p_scan_result_text ( const u8 *  ies,
size_t  ies_len,
char *  buf,
char *  end 
)

Build text format description of P2P IE.

Parameters
iesInformation elements from scan results
ies_lenies buffer length in octets
bufBuffer for returning text
endPointer to the end of the buf area
Returns
Number of octets written to the buffer or -1 on failure

This function can be used to parse P2P IE contents into text format field=value lines.

int p2p_sd_cancel_request ( struct p2p_data p2p,
void *  req 
)

Cancel a pending service discovery query.

Parameters
p2pP2P module context from p2p_init()
reqQuery reference from p2p_sd_request()
Returns
0 if request for cancelled; -1 if not found
void* p2p_sd_request ( struct p2p_data p2p,
const u8 *  dst,
const struct wpabuf tlvs 
)

Schedule a service discovery query.

Parameters
p2pP2P module context from p2p_init()
dstDestination peer or NULL to apply for all peers
tlvsP2P Service Query TLV(s)
Returns
Reference to the query or NULL on failure

Response to the query is indicated with the p2p_config::sd_response() callback.

void p2p_sd_response ( struct p2p_data p2p,
int  freq,
const u8 *  dst,
u8  dialog_token,
const struct wpabuf resp_tlvs 
)

Send response to a service discovery query.

Parameters
p2pP2P module context from p2p_init()
freqFrequency from p2p_config::sd_request() callback
dstDestination address from p2p_config::sd_request() callback
dialog_tokenDialog token from p2p_config::sd_request() callback
resp_tlvsP2P Service Response TLV(s)

This function is called as a response to the request indicated with p2p_config::sd_request() callback.

void p2p_sd_service_update ( struct p2p_data p2p)

Indicate a change in local services.

Parameters
p2pP2P module context from p2p_init()

This function needs to be called whenever there is a change in availability of the local services. This will increment the Service Update Indicator value which will be used in SD Request and Response frames.

void p2p_send_action_cb ( struct p2p_data p2p,
unsigned int  freq,
const u8 *  dst,
const u8 *  src,
const u8 *  bssid,
enum p2p_send_action_result  result 
)

Notify TX status of an Action frame.

Parameters
p2pP2P module context from p2p_init()
freqChannel frequency in MHz
dstDestination MAC address (Address 1)
srcSource MAC address (Address 2)
bssidBSSID (Address 3)
resultResult 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_set_best_channels ( struct p2p_data p2p,
int  freq_24,
int  freq_5,
int  freq_overall 
)

Update best channel information.

Parameters
p2pP2P module context from p2p_init()
freq_24Frequency (MHz) of best channel in 2.4 GHz band
freq_5Frequency (MHz) of best channel in 5 GHz band
freq_overallFrequency (MHz) of best channel overall
void p2p_set_client_discoverability ( struct p2p_data p2p,
int  enabled 
)

Set client discoverability capability.

Parameters
p2pP2P module context from p2p_init()
enabledWhether client discoverability will be enabled

This function can be used to disable (and re-enable) client discoverability. This capability is enabled by default and should not be disabled in normal use cases, i.e., this is mainly for testing purposes.

void p2p_set_config_timeout ( struct p2p_data p2p,
u8  go_timeout,
u8  client_timeout 
)

Set local config timeouts.

Parameters
p2pP2P module context from p2p_init()
go_timeoutTime in 10 ms units it takes to start the GO mode
client_timeoutTime in 10 ms units it takes to start the client mode
void p2p_set_cross_connect ( struct p2p_data p2p,
int  enabled 
)

Set cross connection capability.

Parameters
p2pP2P module context from p2p_init()
enabledWhether cross connection will be enabled
int p2p_set_dev_name ( struct p2p_data p2p,
const char *  dev_name 
)

Set device name.

Parameters
p2pP2P module context from p2p_init()
Returns
0 on success, -1 on failure

This function can be used to update the P2P module configuration with information that was not available at the time of the p2p_init() call.

int p2p_set_disc_int ( struct p2p_data p2p,
int  min_disc_int,
int  max_disc_int,
int  max_disc_tu 
)

Set min/max discoverable interval for p2p_find.

Parameters
p2pP2P module context from p2p_init()
min_disc_intminDiscoverableInterval (in units of 100 TU); default 1
max_disc_intmaxDiscoverableInterval (in units of 100 TU); default 3
max_disc_tuMaximum number of TUs (1.024 ms) for discoverable interval; or -1 not to limit
Returns
0 on success, or -1 on failure

This function can be used to configure minDiscoverableInterval and maxDiscoverableInterval parameters for the Listen state during device discovery (p2p_find). A random number of 100 TU units is picked for each Listen state iteration from [min_disc_int,max_disc_int] range.

max_disc_tu can be used to futher limit the discoverable duration. However, it should be noted that use of this parameter is not recommended since it would not be compliant with the P2P specification.

void p2p_set_intra_bss_dist ( struct p2p_data p2p,
int  enabled 
)

Set intra BSS distribution.

Parameters
p2pP2P module context from p2p_init()
enabledWhether intra BSS distribution will be enabled
void p2p_set_managed_oper ( struct p2p_data p2p,
int  enabled 
)

Set managed P2P Device operations capability.

Parameters
p2pP2P module context from p2p_init()
enabledWhether managed P2P Device operations will be enabled
int p2p_set_no_go_freq ( struct p2p_data p2p,
const struct wpa_freq_range_list list 
)

Set no GO channel ranges.

Parameters
p2pP2P module context from p2p_init()
listChannel ranges or NULL to remove restriction
Returns
0 on success, -1 on failure
int p2p_set_oper_channel ( struct p2p_data p2p,
u8  op_reg_class,
u8  op_channel,
int  cfg_op_channel 
)

Set the P2P operating channel.

Parameters
p2pP2P module context from p2p_init()
op_reg_classOperating regulatory class to set
op_channeloperating channel to set
cfg_op_channel: Whether op_channel is hardcoded in configuration
Returns
0 on success, -1 on failure
void p2p_set_own_freq_preference ( struct p2p_data p2p,
int  freq 
)

Set own preference for channel.

Parameters
p2pP2P module context from p2p_init()
freqFrequency (MHz) of the preferred channel or 0 if no preference

This function can be used to set a preference on the operating channel based on frequencies used on the other virtual interfaces that share the same radio. If non-zero, this is used to try to avoid multi-channel concurrency.

int p2p_set_pref_chan ( struct p2p_data p2p,
unsigned int  num_pref_chan,
const struct p2p_channel pref_chan 
)

Set P2P preferred channel list.

Parameters
p2pP2P module context from p2p_init()
num_pref_chanNumber of entries in pref_chan list
pref_chanPreferred channels or NULL to remove preferences
Returns
0 on success, -1 on failure
int p2p_set_pri_dev_type ( struct p2p_data p2p,
const u8 *  pri_dev_type 
)

Set primary device type.

Parameters
p2pP2P module context from p2p_init()
Returns
0 on success, -1 on failure

This function can be used to update the P2P module configuration with information that was not available at the time of the p2p_init() call.

int p2p_set_sec_dev_types ( struct p2p_data p2p,
const u8  dev_types[][8],
size_t  num_dev_types 
)

Set secondary device types.

Parameters
p2pP2P module context from p2p_init()
Returns
0 on success, -1 on failure

This function can be used to update the P2P module configuration with information that was not available at the time of the p2p_init() call.

void p2p_stop_find ( struct p2p_data p2p)

Stop P2P Find (Device Discovery)

Parameters
p2pP2P module context from p2p_init()
void p2p_stop_find_for_freq ( struct p2p_data p2p,
int  freq 
)

Stop P2P Find for next oper on specific freq.

Parameters
p2pP2P module context from p2p_init()
freqFrequency 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_listen ( struct p2p_data p2p)

Stop P2P Listen.

Parameters
p2pP2P module context from p2p_init()
int p2p_supported_freq ( struct p2p_data p2p,
unsigned int  freq 
)

Check whether channel is supported for P2P.

Parameters
p2pP2P module context from p2p_init()
freqChannel frequency in MHz
Returns
0 if channel not usable for P2P, 1 if usable for P2P
int p2p_supported_freq_cli ( struct p2p_data p2p,
unsigned int  freq 
)

Check whether channel is supported for P2P client operation.

Parameters
p2pP2P module context from p2p_init()
freqChannel frequency in MHz
Returns
0 if channel not usable for P2P, 1 if usable for P2P
int p2p_supported_freq_go ( struct p2p_data p2p,
unsigned int  freq 
)

Check whether channel is supported for P2P GO operation.

Parameters
p2pP2P module context from p2p_init()
freqChannel frequency in MHz
Returns
0 if channel not usable for P2P, 1 if usable for P2P
int p2p_unauthorize ( struct p2p_data p2p,
const u8 *  addr 
)

Unauthorize the specified peer device.

Parameters
p2pP2P module context from p2p_init()
addrP2P 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.

void p2p_wps_success_cb ( struct p2p_data p2p,
const u8 *  mac_addr 
)

Report successfully completed WPS provisioning.

Parameters
p2pP2P module context from p2p_init()
mac_addrPeer address

This function is used to report successfully completed WPS provisioning during group formation in both GO/Registrar and client/Enrollee roles.