12 #define P2PS_SETUP_NONE 0
13 #define P2PS_SETUP_NEW BIT(0)
14 #define P2PS_SETUP_CLIENT BIT(1)
15 #define P2PS_SETUP_GROUP_OWNER BIT(2)
17 #define P2PS_WILD_HASH_STR "org.wi-fi.wfds"
18 #define P2PS_HASH_LEN 6
19 #define P2P_MAX_QUERY_HASH 6
20 #define P2PS_FEATURE_CAPAB_CPT_MAX 2
26 #define P2P_MAX_PREF_CHANNELS 100
32 #define P2P_MAX_REG_CLASSES 10
38 #define P2P_MAX_REG_CLASS_CHANNELS 20
77 WPS_NOT_READY, WPS_PIN_DISPLAY, WPS_PIN_KEYPAD, WPS_PBC, WPS_NFC,
159 #define P2P_MAX_CHANNELS 50
335 P2P_SCAN_SOCIAL_PLUS_ONE
338 #define P2P_MAX_WPS_VENDOR_EXT 10
426 struct wpabuf *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT];
450 enum p2p_prov_disc_status {
451 P2P_PROV_DISC_SUCCESS,
452 P2P_PROV_DISC_TIMEOUT,
453 P2P_PROV_DISC_REJECTED,
454 P2P_PROV_DISC_TIMEOUT_JOIN,
455 P2P_PROV_DISC_INFO_UNAVAILABLE,
557 #define P2P_SEC_DEVICE_TYPES 5
689 int (*
p2p_scan)(
void *ctx,
enum p2p_scan_type type,
int freq,
690 unsigned int num_req_dev_types,
691 const u8 *req_dev_types,
const u8 *dev_id, u16 pw_id);
737 const u8 *src,
const u8 *bssid,
const u8 *buf,
738 size_t len,
unsigned int wait_time);
771 unsigned int duration,
772 const struct wpabuf *probe_resp_ie);
794 int (*
get_noa)(
void *ctx,
const u8 *interface_addr, u8 *buf,
885 u16 update_indic,
const u8 *tlvs,
size_t tlvs_len);
901 const u8 *tlvs,
size_t tlvs_len);
922 const char *
dev_name, u16 supp_config_methods,
923 u8 dev_capab, u8 group_capab,
924 const u8 *group_id,
size_t group_id_len);
955 enum p2p_prov_disc_status
status,
956 u32 adv_id,
const u8 *adv_mac,
957 const char *deferred_session_resp);
994 const u8 *go_dev_addr,
const u8 *
ssid,
995 size_t ssid_len,
int *go, u8 *group_bssid,
1018 const u8 *ssid,
size_t ssid_len,
1019 const u8 *go_dev_addr, u8 status,
1041 const u8 *addr,
int freq,
int peer_oper_freq);
1061 const u8 *noa,
size_t noa_len);
1094 size_t ssid_len, u8 *go_dev_addr,
1095 u8 *ret_ssid,
size_t *ret_ssid_len,
1096 u8 *intended_iface_addr);
1113 u8 *ssid,
size_t *ssid_len,
int *group_iface);
1124 const u8 *ssid,
size_t ssid_len);
1134 const u8 *adv_mac,
const u8 *ses_mac,
1135 const u8 *grp_mac, u32 adv_id, u32 ses_id,
1136 u8 conncap,
int passwd_id,
1137 const u8 *persist_ssid,
1138 size_t persist_ssid_size,
int response_done,
1139 int prov_start,
const char *session_info,
1140 const u8 *feat_cap,
size_t feat_cap_len);
1176 unsigned int *len,
unsigned int *freq_list);
1232 int p2p_set_manufacturer(
struct p2p_data *p2p,
const char *manufacturer);
1233 int p2p_set_model_name(
struct p2p_data *p2p,
const char *model_name);
1234 int p2p_set_model_number(
struct p2p_data *p2p,
const char *model_number);
1235 int p2p_set_serial_number(
struct p2p_data *p2p,
const char *serial_number);
1237 void p2p_set_config_methods(
struct p2p_data *p2p, u16 config_methods);
1238 void p2p_set_uuid(
struct p2p_data *p2p,
const u8 *uuid);
1259 size_t num_dev_types);
1261 int p2p_set_country(
struct p2p_data *p2p,
const char *country);
1266 enum p2p_discovery_type {
1267 P2P_FIND_START_WITH_FULL,
1268 P2P_FIND_ONLY_SOCIAL,
1269 P2P_FIND_PROGRESSIVE
1292 enum p2p_discovery_type type,
1293 unsigned int num_req_dev_types,
const u8 *req_dev_types,
1294 const u8 *dev_id,
unsigned int search_delay,
1295 u8 seek_count,
const char **seek_string,
int freq);
1361 enum p2p_wps_method wps_method,
1362 int go_intent,
const u8 *own_interface_addr,
1363 unsigned int force_freq,
int persistent_group,
1364 const u8 *force_ssid,
size_t force_ssid_len,
1365 int pd_before_go_neg,
unsigned int pref_freq, u16 oob_pw_id);
1389 enum p2p_wps_method wps_method,
1390 int go_intent,
const u8 *own_interface_addr,
1391 unsigned int force_freq,
int persistent_group,
1392 const u8 *force_ssid,
size_t force_ssid_len,
1393 unsigned int pref_freq, u16 oob_pw_id);
1424 int join,
int force_freq,
1425 int user_initiated_pd);
1438 const struct wpabuf *tlvs);
1440 #ifdef CONFIG_WIFI_DISPLAY
1441 void * p2p_sd_request_wfd(
struct p2p_data *p2p,
const u8 *dst,
1442 const struct wpabuf *tlvs);
1465 u8 dialog_token,
const struct wpabuf *resp_tlvs);
1478 enum p2p_invite_role {
1480 P2P_INVITE_ROLE_ACTIVE_GO,
1481 P2P_INVITE_ROLE_CLIENT
1503 unsigned int force_freq,
const u8 *go_dev_addr,
1504 int persistent_group,
unsigned int pref_freq,
int dev_pw_id);
1522 const u8 *own_interface_addr,
unsigned int freq,
1523 u32 duration1, u32 interval1, u32 duration2,
1540 unsigned int interval);
1600 P2P_PREQ_NOT_LISTEN,
1602 P2P_PREQ_NOT_PROCESSED,
1619 const u8 *bssid,
const u8 *ie,
size_t ie_len,
1620 unsigned int rx_freq);
1634 const u8 *bssid, u8 category,
1635 const u8 *data,
size_t len,
int freq);
1664 struct os_reltime *rx_time,
int level,
const u8 *ies,
1679 enum p2p_send_action_result {
1680 P2P_SEND_ACTION_SUCCESS ,
1681 P2P_SEND_ACTION_NO_ACK ,
1682 P2P_SEND_ACTION_FAILED
1698 const u8 *src,
const u8 *bssid,
1699 enum p2p_send_action_result result);
1711 unsigned int duration);
1724 void p2p_deauth_notif(
struct p2p_data *p2p,
const u8 *bssid, u16 reason_code,
1725 const u8 *ie,
size_t ie_len);
1727 void p2p_disassoc_notif(
struct p2p_data *p2p,
const u8 *bssid, u16 reason_code,
1728 const u8 *ie,
size_t ie_len);
1801 struct wpabuf *proberesp_ies);
1839 const u8 *ie,
size_t len);
1904 const u8 *searching_dev,
int rx_freq);
2017 const u8 *addr,
int next);
2031 char *buf,
size_t buflen);
2073 int p2p_set_listen_channel(
struct p2p_data *p2p, u8 reg_class, u8 channel,
2076 u8 p2p_get_listen_channel(
struct p2p_data *p2p);
2078 int p2p_set_ssid_postfix(
struct p2p_data *p2p,
const u8 *postfix,
size_t len);
2080 int p2p_get_interface_addr(
struct p2p_data *p2p,
const u8 *dev_addr,
2082 int p2p_get_dev_addr(
struct p2p_data *p2p,
const u8 *iface_addr,
2085 void p2p_set_peer_filter(
struct p2p_data *p2p,
const u8 *addr);
2094 int p2p_get_oper_freq(
struct p2p_data *p2p,
const u8 *iface_addr);
2103 int p2p_channels_includes_freq(
const struct p2p_channels *channels,
2106 int p2p_channels_to_freqs(
const struct p2p_channels *channels,
2107 int *freq_list,
unsigned int max_len);
2142 void p2p_update_channel_list(
struct p2p_data *p2p,
2167 const u8 * p2p_get_go_neg_peer(
struct p2p_data *p2p);
2225 int (*group_callback)(
struct p2p_group *group,
2255 const struct wpabuf *vendor_ext);
2266 int cfg_op_channel);
2295 const char * p2p_wps_method_text(
enum p2p_wps_method method);
2306 int p2p_set_wfd_ie_beacon(
struct p2p_data *p2p,
struct wpabuf *ie);
2307 int p2p_set_wfd_ie_probe_req(
struct p2p_data *p2p,
struct wpabuf *ie);
2308 int p2p_set_wfd_ie_probe_resp(
struct p2p_data *p2p,
struct wpabuf *ie);
2309 int p2p_set_wfd_ie_assoc_req(
struct p2p_data *p2p,
struct wpabuf *ie);
2310 int p2p_set_wfd_ie_invitation(
struct p2p_data *p2p,
struct wpabuf *ie);
2311 int p2p_set_wfd_ie_prov_disc_req(
struct p2p_data *p2p,
struct wpabuf *ie);
2312 int p2p_set_wfd_ie_prov_disc_resp(
struct p2p_data *p2p,
struct wpabuf *ie);
2313 int p2p_set_wfd_ie_go_neg(
struct p2p_data *p2p,
struct wpabuf *ie);
2314 int p2p_set_wfd_dev_info(
struct p2p_data *p2p,
const struct wpabuf *elem);
2315 int p2p_set_wfd_assoc_bssid(
struct p2p_data *p2p,
const struct wpabuf *elem);
2316 int p2p_set_wfd_coupled_sink_info(
struct p2p_data *p2p,
2317 const struct wpabuf *elem);
2318 struct wpabuf * wifi_display_encaps(
struct wpabuf *subelems);
2354 const u8 *go_dev_addr,
2355 const u8 *ssid,
size_t ssid_len);
2358 const u8 *go_dev_addr,
2359 const u8 *ssid,
size_t ssid_len);
2369 NO_ACTION, JOIN_GROUP, AUTH_JOIN, INIT_GO_NEG, RESP_GO_NEG,
2370 BOTH_GO, PEER_CLIENT
2373 u8 oob_dev_pw[WPS_OOB_PUBKEY_HASH_LEN + 2 +
2374 WPS_OOB_DEVICE_PASSWORD_LEN];
2375 size_t oob_dev_pw_len;
2377 u8 go_dev_addr[ETH_ALEN];
2378 u8 go_ssid[SSID_MAX_LEN];
2382 int p2p_process_nfc_connection_handover(
struct p2p_data *p2p,
2385 void p2p_set_authorized_oob_dev_pw_id(
struct p2p_data *p2p, u16 dev_pw_id,
2387 const u8 *own_interface_addr);
2389 int p2p_set_passphrase_len(
struct p2p_data *p2p,
unsigned int len);
2391 void p2p_loop_on_known_peers(
struct p2p_data *p2p,
2396 void p2p_set_vendor_elems(
struct p2p_data *p2p,
struct wpabuf **vendor_elem);
2398 void p2p_set_intended_addr(
struct p2p_data *p2p,
const u8 *intended_addr);
2401 p2p_service_p2ps_id(
struct p2p_data *p2p, u32 adv_id);
2403 const char *adv_str, u8 svc_state,
2406 int p2p_service_del_asp(
struct p2p_data *p2p, u32 adv_id);
2407 void p2p_service_flush_asp(
struct p2p_data *p2p);
2419 void p2p_set_own_pref_freq_list(
struct p2p_data *p2p,
2420 const unsigned int *pref_freq_list,
struct wpabuf * p2ps_instance
P2PS Application Service Info.
Definition: p2p.h:447
size_t channels
Number of channel entries in use.
Definition: p2p.h:66
struct p2p_channels channels
Own supported regulatory classes and channels.
Definition: p2p.h:518
void(* presence_resp)(void *ctx, const u8 *src, u8 status, const u8 *noa, size_t noa_len)
Callback on Presence Response.
Definition: p2p.h:1060
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)
Definition: p2p.c:1637
u8 reg_class
Regulatory class (IEEE 802.11-2007, Annex J)
Definition: p2p.h:54
struct wpabuf * p2p_group_assoc_resp_ie(struct p2p_group *group, u8 status)
Build P2P IE for (re)association response.
Definition: p2p_group.c:640
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.
Definition: p2p.c:3385
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.
Definition: p2p.c:1918
u8 channel[P2P_MAX_REG_CLASS_CHANNELS]
Supported channels.
Definition: p2p.h:60
u8 ssid[SSID_MAX_LEN]
Group SSID.
Definition: p2p.h:1767
void(* prov_disc_req)(void *ctx, const u8 *peer, u16 config_methods, const u8 *dev_addr, const u8 *pri_dev_type, const char *dev_name, u16 supp_config_methods, u8 dev_capab, u8 group_capab, const u8 *group_id, size_t group_id_len)
Callback on Provisiong Discovery Request.
Definition: p2p.h:920
char serial_number[WPS_SERIAL_NUMBER_MAX_LEN+1]
Serial Number (0..32 octets encoded in UTF-8)
Definition: p2p.h:385
#define P2P_SEC_DEVICE_TYPES
Maximum number of secondary device types.
Definition: p2p.h:557
size_t ssid_len
ssid length in octets
Definition: p2p_i.h:373
unsigned int p2p_get_pref_freq(struct p2p_data *p2p, const struct p2p_channels *channels)
Get channel from preferred channel list.
Definition: p2p_utils.c:316
u8 hash[P2PS_HASH_LEN]
6 octet Service Name has to match against incoming Probe Requests
Definition: p2p.h:300
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.
Definition: p2p.c:3645
int p2p_set_sec_dev_types(struct p2p_data *p2p, const u8 dev_types[][8], size_t num_dev_types)
Set secondary device types.
Definition: p2p.c:3102
void(* invitation_received)(void *ctx, const u8 *sa, const u8 *bssid, const u8 *ssid, size_t ssid_len, const u8 *go_dev_addr, u8 status, int op_freq)
Callback on Invitation Request RX.
Definition: p2p.h:1017
void(* go_neg_req_rx)(void *ctx, const u8 *src, u16 dev_passwd_id, u8 go_intent)
Notification of a receive GO Negotiation Request.
Definition: p2p.h:844
int(* is_concurrent_session_active)(void *ctx)
Check whether concurrent session is active on other virtual interfaces.
Definition: p2p.h:1070
int freq
Frequency of the group operational channel in MHz.
Definition: p2p.h:105
int level
Signal level.
Definition: p2p.h:391
void(* stop_listen)(void *ctx)
Stop Listen state.
Definition: p2p.h:780
P2P configuration.
Definition: p2p.h:470
int(* prov_disc_resp_cb)(void *ctx)
Callback for indicating completion of PD Response.
Definition: p2p.h:1150
u8 reg_class
Regulatory class for own listen channel.
Definition: p2p.h:481
unsigned int max_clients
Maximum number of clients in the group.
Definition: p2p.h:1761
int p2p_group_notif_noa(struct p2p_group *group, const u8 *noa, size_t noa_len)
Notification of NoA change.
Definition: p2p_group.c:805
const u8 * p2p_get_go_dev_addr(const struct wpabuf *p2p_ie)
Get P2P Device Address from P2P IE data.
Definition: p2p_parse.c:862
char model_name[WPS_MODEL_NAME_MAX_LEN+1]
Model Name (0..32 octets encoded in UTF-8)
Definition: p2p.h:373
int p2p_set_no_go_freq(struct p2p_data *p2p, const struct wpa_freq_range_list *list)
Set no GO channel ranges.
Definition: p2p.c:4710
P2P peer information.
Definition: p2p.h:344
int concurrent_operations
Whether concurrent operations are supported.
Definition: p2p.h:595
u16 p2p_get_provisioning_info(struct p2p_data *p2p, const u8 *addr)
Get any stored provisioning info.
Definition: p2p.c:155
size_t reg_classes
Number of reg_class entries in use.
Definition: p2p.h:73
u8 cpt_priority[P2PS_FEATURE_CAPAB_CPT_MAX+1]
Coordination Protocol Transport priority list.
Definition: p2p.h:254
int(* send_action)(void *ctx, unsigned int freq, const u8 *dst, const u8 *src, const u8 *bssid, const u8 *buf, size_t len, unsigned int wait_time)
Transmit an Action frame.
Definition: p2p.h:736
int p2p_supported_freq(struct p2p_data *p2p, unsigned int freq)
Check whether channel is supported for P2P.
Definition: p2p_utils.c:283
int p2p_group_get_common_freqs(struct p2p_group *group, int *common_freqs, unsigned int *num)
Get the group common frequencies.
Definition: p2p_group.c:1073
unsigned int passphrase_len
Passphrase length (8..63)
Definition: p2p.h:640
u8 channel_forced
the listen channel was forced by configuration or by control interface and cannot be overridden ...
Definition: p2p.h:493
int p2p_client_limit_reached(struct p2p_group *group)
Check if client limit is reached.
Definition: p2p_group.c:988
int p2p_reject(struct p2p_data *p2p, const u8 *peer_addr)
Reject peer device (explicitly block connection attempts)
Definition: p2p.c:4055
void p2p_listen_cb(struct p2p_data *p2p, unsigned int freq, unsigned int duration)
Indicate the start of a requested Listen state.
Definition: p2p.c:3709
u8 session_mac[ETH_ALEN]
MAC address of the peer that started the session.
Definition: p2p.h:229
void p2p_sd_service_update(struct p2p_data *p2p)
Indicate a change in local services.
Definition: p2p_sd.c:899
#define P2P_MAX_REG_CLASSES
Maximum number of regulatory classes.
Definition: p2p.h:32
int p2p_scan_result_text(const u8 *ies, size_t ies_len, char *buf, char *end)
Build text format description of P2P IE.
Definition: p2p.c:2617
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.
Definition: p2p_group.c:596
void * cb_ctx
Context to use with callback functions.
Definition: p2p.h:646
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.
Definition: p2p.c:4688
void p2p_set_client_discoverability(struct p2p_data *p2p, int enabled)
Set client discoverability capability.
Definition: p2p.c:4264
u8 ssid[SSID_MAX_LEN]
SSID of the group.
Definition: p2p.h:115
void p2p_group_notif_disassoc(struct p2p_group *group, const u8 *addr)
Notification of P2P client disassociation from GO.
Definition: p2p_group.c:684
size_t ssid_postfix_len
Length of the ssid_postfix data.
Definition: p2p.h:625
int status
Negotiation result (Status Code)
Definition: p2p.h:93
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.
Definition: p2p_sd.c:412
const struct p2p_group_config * p2p_group_get_config(struct p2p_group *group)
Get the group configuration.
Definition: p2p_group.c:1053
int(* get_pref_freq_list)(void *ctx, int go, unsigned int *len, unsigned int *freq_list)
Get preferred frequency list for an interface.
Definition: p2p.h:1175
void * p2p_sd_request(struct p2p_data *p2p, const u8 *dst, const struct wpabuf *tlvs)
Schedule a service discovery query.
Definition: p2p_sd.c:844
char * dev_name
Device Name.
Definition: p2p.h:581
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.
Definition: p2p.c:4312
int p2p_group_match_dev_type(struct p2p_group *group, struct wpabuf *wps)
Match device types in group with requested type.
Definition: p2p_group.c:753
u8 p2p_device_addr[ETH_ALEN]
P2P Device Address of the peer.
Definition: p2p.h:349
void p2p_stop_find_for_freq(struct p2p_data *p2p, int freq)
Stop P2P Find for next oper on specific freq.
Definition: p2p.c:1275
size_t wps_sec_dev_type_list_len
Length of secondary device type list.
Definition: p2p.h:424
void(* debug_print)(void *ctx, int level, const char *msg)
Debug print.
Definition: p2p.h:654
int p2p_unauthorize(struct p2p_data *p2p, const u8 *addr)
Unauthorize the specified peer device.
Definition: p2p.c:2983
u8 adv_mac[ETH_ALEN]
MAC address of the peer advertised the service.
Definition: p2p.h:235
int p2p_listen(struct p2p_data *p2p, unsigned int timeout)
Start P2P Listen state for specified duration.
Definition: p2p.c:303
u16 config_methods
WPS Methods which are allowed for this service.
Definition: p2p.h:282
u8(* invitation_process)(void *ctx, const u8 *sa, const u8 *bssid, const u8 *go_dev_addr, const u8 *ssid, size_t ssid_len, int *go, u8 *group_bssid, int *force_freq, int persistent_group, const struct p2p_channels *channels, int dev_pw_id)
Optional callback for processing Invitations.
Definition: p2p.h:993
size_t ssid_len
Length of SSID in octets.
Definition: p2p.h:121
u8 channel
Own listen channel.
Definition: p2p.h:487
void(* go_neg_completed)(void *ctx, struct p2p_go_neg_results *res)
Notification of GO Negotiation results.
Definition: p2p.h:864
void p2p_group_formation_failed(struct p2p_data *p2p)
Report failed WPS provisioning.
Definition: p2p.c:2849
size_t num_sec_dev_types
Number of sec_dev_type entries.
Definition: p2p.h:569
u8 dev_capab
Device Capabilities.
Definition: p2p.h:403
unsigned int max_listen
Maximum listen duration in ms.
Definition: p2p.h:631
u8 op_channel
Own operational channel.
Definition: p2p.h:502
struct p2p_config * cfg
P2P module configuration.
Definition: p2p_i.h:185
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)
Definition: p2p.c:1146
int freq_list[P2P_MAX_CHANNELS]
Zero-terminated list of possible operational channels.
Definition: p2p.h:165
u32 id
P2PS Advertisement ID.
Definition: p2p.h:276
u8 auto_accept
Automatically Accept provisioning request if possible.
Definition: p2p.h:294
int p2p_supported_freq_cli(struct p2p_data *p2p, unsigned int freq)
Check whether channel is supported for P2P client operation.
Definition: p2p_utils.c:304
void p2p_set_config_timeout(struct p2p_data *p2p, u8 go_timeout, u8 client_timeout)
Set local config timeouts.
Definition: p2p.c:4916
void(* invitation_result)(void *ctx, int status, const u8 *bssid, const struct p2p_channels *channels, const u8 *addr, int freq, int peer_oper_freq)
Callback on Invitation result.
Definition: p2p.h:1039
void(* sd_request)(void *ctx, int freq, const u8 *sa, u8 dialog_token, u16 update_indic, const u8 *tlvs, size_t tlvs_len)
Callback on Service Discovery Request.
Definition: p2p.h:884
u8 sec_dev_type[P2P_SEC_DEVICE_TYPES][8]
Optional secondary device types.
Definition: p2p.h:563
void p2p_group_deinit(struct p2p_group *group)
Deinitialize P2P group.
Definition: p2p_group.c:95
void p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *addr)
Clear any stored provisioning info.
Definition: p2p.c:170
u8 cfg_op_channel
Whether op_channel is hardcoded in configuration.
Definition: p2p.h:508
int p2p_parse_dev_addr(const u8 *ies, size_t ies_len, u8 *dev_addr)
Parse P2P Device Address from P2P IE(s)
Definition: p2p.c:2803
char country[3]
Country code to use in P2P operations.
Definition: p2p.h:475
void(* find_stopped)(void *ctx)
Notification of a p2p_find operation stopping.
Definition: p2p.h:828
char info[0]
Vendor defined extra Provisioning information.
Definition: p2p.h:260
int(* p2p_scan)(void *ctx, enum p2p_scan_type type, int freq, unsigned int num_req_dev_types, const u8 *req_dev_types, const u8 *dev_id, u16 pw_id)
Request a P2P scan/search.
Definition: p2p.h:689
u8 p2p_get_group_capab(const struct wpabuf *p2p_ie)
Get Group Capability from P2P IE data.
Definition: p2p_parse.c:847
List of supported channels.
Definition: p2p.h:44
u8 op_reg_class
Regulatory class for own operational channel.
Definition: p2p.h:496
u8 cpt_mask
Supported Coordination Protocol Transport mask.
Definition: p2p.h:244
P2P module data (internal to P2P module)
Definition: p2p_i.h:177
void(* send_action_done)(void *ctx)
Notify that Action frame sequence was completed.
Definition: p2p.h:748
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.
Definition: p2p_group.c:863
struct wpabuf * wfd_subelems
Wi-Fi Display subelements from WFD IE(s)
Definition: p2p.h:432
u8 wps_sec_dev_type_list[WPS_SEC_DEV_TYPE_MAX_LEN]
WPS secondary device type list.
Definition: p2p.h:418
size_t ssid_len
Length of SSID.
Definition: p2p.h:1773
int p2p_config_get_random_social(struct p2p_config *p2p, u8 *op_class, u8 *op_channel)
Return a random social channel.
Definition: p2p.c:4611
int freq
Operating channel of the group.
Definition: p2p.h:1779
u32 session_id
P2PS Session ID.
Definition: p2p.h:205
u8 ssid_postfix[SSID_MAX_LEN-9]
Postfix data to add to the SSID.
Definition: p2p.h:619
u8 pri_dev_type[8]
Primary Device Type.
Definition: p2p.h:355
void p2p_expire_peers(struct p2p_data *p2p)
Periodic cleanup function to expire peers.
Definition: p2p.c:48
int p2p_set_pri_dev_type(struct p2p_data *p2p, const u8 *pri_dev_type)
Set primary device type.
Definition: p2p.c:3095
enum p2p_wps_method wps_method
WPS method to be used during provisioning.
Definition: p2p.h:157
char svc_name[0]
NULL Terminated UTF-8 Service Name, and svc_info storage.
Definition: p2p.h:325
struct p2p_channels cli_channels
Additional client channels.
Definition: p2p.h:533
Supported regulatory class.
Definition: p2p.h:49
u8 ssid[SSID_MAX_LEN]
Selected SSID for GO Negotiation (if local end will be GO)
Definition: p2p_i.h:367
void p2p_group_notif_formation_done(struct p2p_group *group)
Notification of completed group formation.
Definition: p2p_group.c:795
int psk_set
Whether PSK field is configured (GO only)
Definition: p2p.h:133
void p2p_remove_wps_vendor_extensions(struct p2p_data *p2p)
Remove WPS vendor extensions.
Definition: p2p.c:3113
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.
Definition: p2p.c:4673
u8 state
Current state of the service: 0 - Out Of Service, 1-255 Vendor defined.
Definition: p2p.h:288
int p2p_sd_cancel_request(struct p2p_data *p2p, void *req)
Cancel a pending service discovery query.
Definition: p2p_sd.c:905
int(* send_probe_resp)(void *ctx, const struct wpabuf *buf, unsigned int freq)
Transmit a Probe Response frame.
Definition: p2p.h:715
u8 interface_addr[ETH_ALEN]
P2P Interface Address of the group.
Definition: p2p.h:1755
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.
Definition: p2p.c:2554
int persistent_group
Whether the group is persistent 0 = not a persistent group 1 = persistent group without persistent re...
Definition: p2p.h:1749
unsigned int p2p_get_group_num_members(struct p2p_group *group)
Get number of members in group.
Definition: p2p_group.c:979
int p2p_group_match_dev_id(struct p2p_group *group, struct wpabuf *p2p)
Match P2P Device Address in group with requested device id.
Definition: p2p_group.c:770
int(* is_p2p_in_progress)(void *ctx)
Check whether P2P operation is in progress.
Definition: p2p.h:1078
P2P Group Owner Negotiation results.
Definition: p2p.h:85
char * svc_info
Pointer to (internal) Service defined information.
Definition: p2p.h:270
P2P group configuration.
Definition: p2p.h:1742
int p2p_intra_bss
Intra BSS communication is supported.
Definition: p2p.h:610
void(* dev_found)(void *ctx, const u8 *addr, const struct p2p_peer_info *info, int new_device)
Notification of a found P2P Device.
Definition: p2p.h:811
void(* sd_response)(void *ctx, const u8 *sa, u16 update_indic, const u8 *tlvs, size_t tlvs_len)
Callback on Service Discovery Response.
Definition: p2p.h:900
void(* prov_disc_fail)(void *ctx, const u8 *peer, enum p2p_prov_disc_status status, u32 adv_id, const u8 *adv_mac, const char *deferred_session_resp)
Callback on Provision Discovery failure.
Definition: p2p.h:954
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)
Definition: p2p.c:1524
int role_go
Whether local end is Group Owner.
Definition: p2p.h:99
int(* start_listen)(void *ctx, unsigned int freq, unsigned int duration, const struct wpabuf *probe_resp_ie)
Start Listen state.
Definition: p2p.h:770
int(* get_persistent_group)(void *ctx, const u8 *addr, const u8 *ssid, size_t ssid_len, u8 *go_dev_addr, u8 *ret_ssid, size_t *ret_ssid_len, u8 *intended_iface_addr)
Determine if we have a persistent group we share with remote peer and allocate interface for this gro...
Definition: p2p.h:1093
u8 peer_device_addr[ETH_ALEN]
P2P Device Address of the peer.
Definition: p2p.h:145
u8 dev_addr[ETH_ALEN]
P2P Device Address.
Definition: p2p.h:575
int p2p_ie_text(struct wpabuf *p2p_ie, char *buf, char *end)
Build text format description of P2P IE.
Definition: p2p.c:3484
struct p2p_data * p2p_init(const struct p2p_config *cfg)
Initialize P2P module.
Definition: p2p.c:2863
unsigned int peer_config_timeout
Peer configuration timeout (in 10 msec units)
Definition: p2p.h:179
int p2p_add_wps_vendor_extension(struct p2p_data *p2p, const struct wpabuf *vendor_ext)
Add a WPS vendor extension.
Definition: p2p.c:3124
void(* ie_update)(void *ctx, struct wpabuf *beacon_ies, struct wpabuf *proberesp_ies)
Notification of IE update.
Definition: p2p.h:1800
void p2p_stop_find(struct p2p_data *p2p)
Stop P2P Find (Device Discovery)
Definition: p2p.c:1333
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.
Definition: p2p.c:2445
void p2p_set_own_freq_preference(struct p2p_data *p2p, int freq)
Set own preference for channel.
Definition: p2p.c:4850
void p2p_notify_scan_trigger_status(struct p2p_data *p2p, int status)
Indicate scan trigger status.
Definition: p2p.c:1026
u8(* p2ps_group_capability)(void *ctx, u8 incoming, u8 role)
Determine group capability.
Definition: p2p.h:1162
u16 method
WPS Method (to be) used to establish session.
Definition: p2p.h:211
u16 config_methods
WPS Configuration Methods.
Definition: p2p.h:397
void p2p_scan_res_handled(struct p2p_data *p2p)
Indicate end of scan results.
Definition: p2p.c:3410
void p2p_flush(struct p2p_data *p2p)
Flush P2P module state.
Definition: p2p.c:2967
IEEE 802.11 Frame type definitions Copyright (c) 2007-2008 Intel Corporation.
int p2p_supported_freq_go(struct p2p_data *p2p, unsigned int freq)
Check whether channel is supported for P2P GO operation.
Definition: p2p_utils.c:293
struct wpabuf * vendor_elems
Unrecognized vendor elements.
Definition: p2p.h:441
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.
Definition: p2p.c:4866
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.
Definition: p2p_group.c:890
u8 conncap
Connection Capabilities negotiated between P2P peers.
Definition: p2p.h:217
void p2p_wps_success_cb(struct p2p_data *p2p, const u8 *mac_addr)
Report successfully completed WPS provisioning.
Definition: p2p.c:2826
int p2p_parse_dev_addr_in_p2p_ie(struct wpabuf *p2p_ie, u8 *dev_addr)
Parse P2P Device Address from a concatenated P2P IE.
Definition: p2p.c:2784
struct p2p_group * p2p_group_init(struct p2p_data *p2p, struct p2p_group_config *config)
Initialize P2P group.
Definition: p2p_group.c:43
u8 role
Info about the roles to be used for this connection.
Definition: p2p.h:223
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.
Definition: p2p_pd.c:1341
int status
Remote returned provisioning status code.
Definition: p2p.h:193
int p2p_group_is_client_connected(struct p2p_group *group, const u8 *dev_addr)
Check whether a specific client is connected.
Definition: p2p_group.c:1015
int(* get_go_info)(void *ctx, u8 *intended_addr, u8 *ssid, size_t *ssid_len, int *group_iface)
Get information about a possible local GO role.
Definition: p2p.h:1112
void(* prov_disc_resp)(void *ctx, const u8 *peer, u16 config_methods)
Callback on Provisiong Discovery Response.
Definition: p2p.h:937
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.
Definition: p2p_invitation.c:644
int p2p_go_params(struct p2p_data *p2p, struct p2p_go_neg_results *params)
Generate random P2P group parameters.
Definition: p2p.c:1756
size_t max_peers
Maximum number of discovered peers to remember.
Definition: p2p.h:604
char model_number[WPS_MODEL_NUMBER_MAX_LEN+1]
Model Number (0..32 octets encoded in UTF-8)
Definition: p2p.h:379
void p2p_set_managed_oper(struct p2p_data *p2p, int enabled)
Set managed P2P Device operations capability.
Definition: p2p.c:4599
void p2p_set_best_channels(struct p2p_data *p2p, int freq_24, int freq_5, int freq_overall)
Update best channel information.
Definition: p2p.c:4839
int p2p_peer_known(struct p2p_data *p2p, const u8 *addr)
Check whether P2P peer is known.
Definition: p2p.c:4258
void p2p_deinit(struct p2p_data *p2p)
Deinitialize P2P module.
Definition: p2p.c:2927
unsigned int pd_seeker
P2PS provision discovery seeker role.
Definition: p2p.h:187
Internal P2P module per-group data.
Definition: p2p_group.c:31
void * cb_ctx
Context to use with callback functions.
Definition: p2p.h:1785
int(* remove_stale_groups)(void *ctx, const u8 *peer, const u8 *go, const u8 *ssid, size_t ssid_len)
Remove stale P2PS groups.
Definition: p2p.h:1123
int p2p_set_dev_name(struct p2p_data *p2p, const char *dev_name)
Set device name.
Definition: p2p.c:3014
u8 cpt_mask
supported Coordination Protocol Transport mask
Definition: p2p.h:309
size_t p2p_scan_ie_buf_len(struct p2p_data *p2p)
Get maximum buffer length needed for p2p_scan_ie.
Definition: p2p.c:3467
int persistent_group
Whether the group should be made persistent 0 = not persistent 1 = persistent group without persisten...
Definition: p2p.h:173
u8 peer_interface_addr[ETH_ALEN]
P2P Interface Address of the peer.
Definition: p2p.h:151
void p2p_set_intra_bss_dist(struct p2p_data *p2p, int enabled)
Set intra BSS distribution.
Definition: p2p.c:4789
int(* get_noa)(void *ctx, const u8 *interface_addr, u8 *buf, size_t buf_len)
Get current Notice of Absence attribute payload.
Definition: p2p.h:794
void p2p_stop_listen(struct p2p_data *p2p)
Stop P2P Listen.
Definition: p2p.c:1321
int p2p_get_cross_connect_disallowed(const struct wpabuf *p2p_ie)
Does WLAN AP disallows cross connection.
Definition: p2p_parse.c:832
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.
Definition: p2p.c:4131
void(* idle_update)(void *ctx, int idle)
Notification of changes in group idle state.
Definition: p2p.h:1808
u8 cpt_priority[P2PS_FEATURE_CAPAB_CPT_MAX+1]
Coordination Protocol Transport priority list.
Definition: p2p.h:319
void p2p_set_cross_connect(struct p2p_data *p2p, int enabled)
Set cross connection capability.
Definition: p2p.c:4768
u8 go_intent
Local GO Intent to be used during GO Negotiation.
Definition: p2p_i.h:355
u8 psk[32]
WPA pre-shared key (256 bits) (GO only)
Definition: p2p.h:127
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.
Definition: p2p_group.c:1059
int p2p_ext_listen(struct p2p_data *p2p, unsigned int period, unsigned int interval)
Set Extended Listen Timing.
Definition: p2p.c:4517
p2p_probe_req_status
enum p2p_probe_req_status
Definition: p2p.h:1598
void(* p2ps_prov_complete)(void *ctx, u8 status, const u8 *dev, const u8 *adv_mac, const u8 *ses_mac, const u8 *grp_mac, u32 adv_id, u32 ses_id, u8 conncap, int passwd_id, const u8 *persist_ssid, size_t persist_ssid_size, int response_done, int prov_start, const char *session_info, const u8 *feat_cap, size_t feat_cap_len)
P2PS provisioning complete.
Definition: p2p.h:1133
const struct p2p_peer_info * p2p_get_peer_info(struct p2p_data *p2p, const u8 *addr, int next)
Get P2P peer information.
Definition: p2p.c:4108
int(* go_connected)(void *ctx, const u8 *dev_addr)
Check whether we are connected to a GO.
Definition: p2p.h:1050
int p2p_listen_end(struct p2p_data *p2p, unsigned int freq)
Indicate the end of a requested Listen state.
Definition: p2p.c:3743
void p2p_scan_ie(struct p2p_data *p2p, struct wpabuf *ies, const u8 *dev_id)
Build P2P IE for Probe Request.
Definition: p2p.c:3425
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.
Definition: p2p.c:5051
u8 pri_dev_type[8]
Primary Device Type (see WPS)
Definition: p2p.h:551
u8 group_capab
Group Capabilities.
Definition: p2p.h:409
#define P2P_MAX_REG_CLASS_CHANNELS
Maximum number of channels per regulatory class.
Definition: p2p.h:38
struct p2p_channel * pref_chan
Preferred channels for GO Negotiation.
Definition: p2p.h:545
char manufacturer[WPS_MANUFACTURER_MAX_LEN+1]
Manufacturer (0..64 octets encoded in UTF-8)
Definition: p2p.h:367
void(* dev_lost)(void *ctx, const u8 *dev_addr)
Notification of a lost P2P Device.
Definition: p2p.h:822
unsigned int num_pref_chan
Number of pref_chan entries.
Definition: p2p.h:539
const u8 * p2p_iterate_group_members(struct p2p_group *group, void **next)
Iterate group members.
Definition: p2p_group.c:997
char device_name[WPS_DEV_NAME_MAX_LEN+1]
Device Name (0..32 octets encoded in UTF-8)
Definition: p2p.h:361
const char * p2p_get_state_txt(struct p2p_data *p2p)
Get current P2P state for debug purposes.
Definition: p2p.c:136
int p2p_in_progress(struct p2p_data *p2p)
Check whether a P2P operation is progress.
Definition: p2p.c:4906
u32 adv_id
P2PS Advertisement ID.
Definition: p2p.h:199
char passphrase[64]
WPA2-Personal passphrase for the group (GO only)
Definition: p2p.h:139