wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
p2p.h
Go to the documentation of this file.
1 
5 #ifndef P2P_H
6 #define P2P_H
7 
9 #include "wps/wps.h"
10 
11 /* P2P ASP Setup Capability */
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)
16 
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
21 
26 #define P2P_MAX_PREF_CHANNELS 100
27 
32 #define P2P_MAX_REG_CLASSES 10
33 
38 #define P2P_MAX_REG_CLASS_CHANNELS 20
39 
44 struct p2p_channels {
49  struct p2p_reg_class {
55 
61 
66  size_t channels;
67  } reg_class[P2P_MAX_REG_CLASSES];
68 
73  size_t reg_classes;
74 };
75 
76 enum p2p_wps_method {
77  WPS_NOT_READY, WPS_PIN_DISPLAY, WPS_PIN_KEYPAD, WPS_PBC, WPS_NFC,
78  WPS_P2PS
79 };
80 
93  int status;
94 
99  int role_go;
100 
105  int freq;
106 
107  int ht40;
108 
109  int vht;
110 
115  u8 ssid[SSID_MAX_LEN];
116 
121  size_t ssid_len;
122 
127  u8 psk[32];
128 
133  int psk_set;
134 
139  char passphrase[64];
140 
145  u8 peer_device_addr[ETH_ALEN];
146 
151  u8 peer_interface_addr[ETH_ALEN];
152 
157  enum p2p_wps_method wps_method;
158 
159 #define P2P_MAX_CHANNELS 50
160 
165  int freq_list[P2P_MAX_CHANNELS];
166 
174 
179  unsigned int peer_config_timeout;
180 };
181 
187  unsigned int pd_seeker:1;
188 
193  int status;
194 
199  u32 adv_id;
200 
206 
211  u16 method;
212 
218 
223  u8 role;
224 
229  u8 session_mac[ETH_ALEN];
230 
235  u8 adv_mac[ETH_ALEN];
236 
245 
254  u8 cpt_priority[P2PS_FEATURE_CAPAB_CPT_MAX + 1];
255 
260  char info[0];
261 };
262 
264  struct p2ps_advertisement *next;
265 
270  char *svc_info;
271 
276  u32 id;
277 
283 
288  u8 state;
289 
295 
300  u8 hash[P2PS_HASH_LEN];
301 
310 
319  u8 cpt_priority[P2PS_FEATURE_CAPAB_CPT_MAX + 1];
320 
325  char svc_name[0];
326 };
327 
328 
329 struct p2p_data;
330 
331 enum p2p_scan_type {
332  P2P_SCAN_SOCIAL,
333  P2P_SCAN_FULL,
334  P2P_SCAN_SPECIFIC,
335  P2P_SCAN_SOCIAL_PLUS_ONE
336 };
337 
338 #define P2P_MAX_WPS_VENDOR_EXT 10
339 
349  u8 p2p_device_addr[ETH_ALEN];
350 
356 
361  char device_name[WPS_DEV_NAME_MAX_LEN + 1];
362 
367  char manufacturer[WPS_MANUFACTURER_MAX_LEN + 1];
368 
373  char model_name[WPS_MODEL_NAME_MAX_LEN + 1];
374 
379  char model_number[WPS_MODEL_NUMBER_MAX_LEN + 1];
380 
385  char serial_number[WPS_SERIAL_NUMBER_MAX_LEN + 1];
386 
391  int level;
392 
398 
404 
410 
418  u8 wps_sec_dev_type_list[WPS_SEC_DEV_TYPE_MAX_LEN];
419 
425 
426  struct wpabuf *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT];
427 
433 
442 
448 };
449 
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,
456 };
457 
458 struct p2p_channel {
459  u8 op_class;
460  u8 chan;
461 };
462 
470 struct p2p_config {
475  char country[3];
476 
482 
488 
494 
497 
503 
509 
519 
534 
539  unsigned int num_pref_chan;
540 
546 
552 
557 #define P2P_SEC_DEVICE_TYPES 5
558 
564 
570 
575  u8 dev_addr[ETH_ALEN];
576 
581  char *dev_name;
582 
583  char *manufacturer;
584  char *model_name;
585  char *model_number;
586  char *serial_number;
587 
588  u8 uuid[16];
589  u16 config_methods;
590 
596 
604  size_t max_peers;
605 
611 
619  u8 ssid_postfix[SSID_MAX_LEN - 9];
620 
626 
631  unsigned int max_listen;
632 
640  unsigned int passphrase_len;
641 
646  void *cb_ctx;
647 
654  void (*debug_print)(void *ctx, int level, const char *msg);
655 
656 
657  /* Callbacks to request lower layer driver operations */
658 
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);
692 
715  int (*send_probe_resp)(void *ctx, const struct wpabuf *buf,
716  unsigned int freq);
717 
736  int (*send_action)(void *ctx, unsigned int freq, const u8 *dst,
737  const u8 *src, const u8 *bssid, const u8 *buf,
738  size_t len, unsigned int wait_time);
739 
748  void (*send_action_done)(void *ctx);
749 
770  int (*start_listen)(void *ctx, unsigned int freq,
771  unsigned int duration,
772  const struct wpabuf *probe_resp_ie);
780  void (*stop_listen)(void *ctx);
781 
794  int (*get_noa)(void *ctx, const u8 *interface_addr, u8 *buf,
795  size_t buf_len);
796 
797  /* Callbacks to notify events to upper layer management entity */
798 
811  void (*dev_found)(void *ctx, const u8 *addr,
812  const struct p2p_peer_info *info,
813  int new_device);
814 
822  void (*dev_lost)(void *ctx, const u8 *dev_addr);
823 
828  void (*find_stopped)(void *ctx);
829 
844  void (*go_neg_req_rx)(void *ctx, const u8 *src, u16 dev_passwd_id,
845  u8 go_intent);
846 
864  void (*go_neg_completed)(void *ctx, struct p2p_go_neg_results *res);
865 
884  void (*sd_request)(void *ctx, int freq, const u8 *sa, u8 dialog_token,
885  u16 update_indic, const u8 *tlvs, size_t tlvs_len);
886 
900  void (*sd_response)(void *ctx, const u8 *sa, u16 update_indic,
901  const u8 *tlvs, size_t tlvs_len);
902 
920  void (*prov_disc_req)(void *ctx, const u8 *peer, u16 config_methods,
921  const u8 *dev_addr, const u8 *pri_dev_type,
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);
925 
937  void (*prov_disc_resp)(void *ctx, const u8 *peer, u16 config_methods);
938 
954  void (*prov_disc_fail)(void *ctx, const u8 *peer,
955  enum p2p_prov_disc_status status,
956  u32 adv_id, const u8 *adv_mac,
957  const char *deferred_session_resp);
958 
993  u8 (*invitation_process)(void *ctx, const u8 *sa, const u8 *bssid,
994  const u8 *go_dev_addr, const u8 *ssid,
995  size_t ssid_len, int *go, u8 *group_bssid,
996  int *force_freq, int persistent_group,
997  const struct p2p_channels *channels,
998  int dev_pw_id);
999 
1017  void (*invitation_received)(void *ctx, const u8 *sa, const u8 *bssid,
1018  const u8 *ssid, size_t ssid_len,
1019  const u8 *go_dev_addr, u8 status,
1020  int op_freq);
1021 
1039  void (*invitation_result)(void *ctx, int status, const u8 *bssid,
1040  const struct p2p_channels *channels,
1041  const u8 *addr, int freq, int peer_oper_freq);
1042 
1050  int (*go_connected)(void *ctx, const u8 *dev_addr);
1051 
1060  void (*presence_resp)(void *ctx, const u8 *src, u8 status,
1061  const u8 *noa, size_t noa_len);
1062 
1070  int (*is_concurrent_session_active)(void *ctx);
1071 
1078  int (*is_p2p_in_progress)(void *ctx);
1079 
1093  int (*get_persistent_group)(void *ctx, const u8 *addr, const u8 *ssid,
1094  size_t ssid_len, u8 *go_dev_addr,
1095  u8 *ret_ssid, size_t *ret_ssid_len,
1096  u8 *intended_iface_addr);
1097 
1112  int (*get_go_info)(void *ctx, u8 *intended_addr,
1113  u8 *ssid, size_t *ssid_len, int *group_iface);
1114 
1123  int (*remove_stale_groups)(void *ctx, const u8 *peer, const u8 *go,
1124  const u8 *ssid, size_t ssid_len);
1125 
1133  void (*p2ps_prov_complete)(void *ctx, u8 status, const u8 *dev,
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);
1141 
1150  int (*prov_disc_resp_cb)(void *ctx);
1151 
1162  u8 (*p2ps_group_capability)(void *ctx, u8 incoming, u8 role);
1163 
1175  int (*get_pref_freq_list)(void *ctx, int go,
1176  unsigned int *len, unsigned int *freq_list);
1177 };
1178 
1179 
1180 /* P2P module initialization/deinitialization */
1181 
1193 struct p2p_data * p2p_init(const struct p2p_config *cfg);
1194 
1199 void p2p_deinit(struct p2p_data *p2p);
1200 
1207 void p2p_flush(struct p2p_data *p2p);
1208 
1220 int p2p_unauthorize(struct p2p_data *p2p, const u8 *addr);
1221 
1230 int p2p_set_dev_name(struct p2p_data *p2p, const char *dev_name);
1231 
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);
1236 
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);
1239 
1248 int p2p_set_pri_dev_type(struct p2p_data *p2p, const u8 *pri_dev_type);
1249 
1258 int p2p_set_sec_dev_types(struct p2p_data *p2p, const u8 dev_types[][8],
1259  size_t num_dev_types);
1260 
1261 int p2p_set_country(struct p2p_data *p2p, const char *country);
1262 
1263 
1264 /* Commands from upper layer management entity */
1265 
1266 enum p2p_discovery_type {
1267  P2P_FIND_START_WITH_FULL,
1268  P2P_FIND_ONLY_SOCIAL,
1269  P2P_FIND_PROGRESSIVE
1270 };
1271 
1291 int p2p_find(struct p2p_data *p2p, unsigned int timeout,
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);
1296 
1302 void p2p_notify_scan_trigger_status(struct p2p_data *p2p, int status);
1303 
1308 void p2p_stop_find(struct p2p_data *p2p);
1309 
1318 void p2p_stop_find_for_freq(struct p2p_data *p2p, int freq);
1319 
1331 int p2p_listen(struct p2p_data *p2p, unsigned int timeout);
1332 
1337 void p2p_stop_listen(struct p2p_data *p2p);
1338 
1360 int p2p_connect(struct p2p_data *p2p, const u8 *peer_addr,
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);
1366 
1388 int p2p_authorize(struct p2p_data *p2p, const u8 *peer_addr,
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);
1394 
1401 int p2p_reject(struct p2p_data *p2p, const u8 *peer_addr);
1402 
1422 int p2p_prov_disc_req(struct p2p_data *p2p, const u8 *peer_addr,
1423  struct p2ps_provision *p2ps_prov, u16 config_methods,
1424  int join, int force_freq,
1425  int user_initiated_pd);
1426 
1437 void * p2p_sd_request(struct p2p_data *p2p, const u8 *dst,
1438  const struct wpabuf *tlvs);
1439 
1440 #ifdef CONFIG_WIFI_DISPLAY
1441 void * p2p_sd_request_wfd(struct p2p_data *p2p, const u8 *dst,
1442  const struct wpabuf *tlvs);
1443 #endif /* CONFIG_WIFI_DISPLAY */
1444 
1451 int p2p_sd_cancel_request(struct p2p_data *p2p, void *req);
1452 
1464 void p2p_sd_response(struct p2p_data *p2p, int freq, const u8 *dst,
1465  u8 dialog_token, const struct wpabuf *resp_tlvs);
1466 
1475 void p2p_sd_service_update(struct p2p_data *p2p);
1476 
1477 
1478 enum p2p_invite_role {
1479  P2P_INVITE_ROLE_GO,
1480  P2P_INVITE_ROLE_ACTIVE_GO,
1481  P2P_INVITE_ROLE_CLIENT
1482 };
1483 
1501 int p2p_invite(struct p2p_data *p2p, const u8 *peer, enum p2p_invite_role role,
1502  const u8 *bssid, const u8 *ssid, size_t ssid_len,
1503  unsigned int force_freq, const u8 *go_dev_addr,
1504  int persistent_group, unsigned int pref_freq, int dev_pw_id);
1505 
1521 int p2p_presence_req(struct p2p_data *p2p, const u8 *go_interface_addr,
1522  const u8 *own_interface_addr, unsigned int freq,
1523  u32 duration1, u32 interval1, u32 duration2,
1524  u32 interval2);
1525 
1539 int p2p_ext_listen(struct p2p_data *p2p, unsigned int period,
1540  unsigned int interval);
1541 
1542 /* Event notifications from upper layer management operations */
1543 
1552 void p2p_wps_success_cb(struct p2p_data *p2p, const u8 *mac_addr);
1553 
1562 void p2p_group_formation_failed(struct p2p_data *p2p);
1563 
1574 u16 p2p_get_provisioning_info(struct p2p_data *p2p, const u8 *addr);
1575 
1584 void p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *addr);
1585 
1586 
1587 /* Event notifications from lower layer driver operations */
1588 
1599  P2P_PREQ_MALFORMED,
1600  P2P_PREQ_NOT_LISTEN,
1601  P2P_PREQ_NOT_P2P,
1602  P2P_PREQ_NOT_PROCESSED,
1603  P2P_PREQ_PROCESSED
1604 };
1605 
1618 p2p_probe_req_rx(struct p2p_data *p2p, const u8 *addr, const u8 *dst,
1619  const u8 *bssid, const u8 *ie, size_t ie_len,
1620  unsigned int rx_freq);
1621 
1633 void p2p_rx_action(struct p2p_data *p2p, const u8 *da, const u8 *sa,
1634  const u8 *bssid, u8 category,
1635  const u8 *data, size_t len, int freq);
1636 
1663 int p2p_scan_res_handler(struct p2p_data *p2p, const u8 *bssid, int freq,
1664  struct os_reltime *rx_time, int level, const u8 *ies,
1665  size_t ies_len);
1666 
1677 void p2p_scan_res_handled(struct p2p_data *p2p);
1678 
1679 enum p2p_send_action_result {
1680  P2P_SEND_ACTION_SUCCESS /* Frame was send and acknowledged */,
1681  P2P_SEND_ACTION_NO_ACK /* Frame was sent, but not acknowledged */,
1682  P2P_SEND_ACTION_FAILED /* Frame was not sent due to a failure */
1683 };
1684 
1697 void p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
1698  const u8 *src, const u8 *bssid,
1699  enum p2p_send_action_result result);
1700 
1710 void p2p_listen_cb(struct p2p_data *p2p, unsigned int freq,
1711  unsigned int duration);
1712 
1722 int p2p_listen_end(struct p2p_data *p2p, unsigned int freq);
1723 
1724 void p2p_deauth_notif(struct p2p_data *p2p, const u8 *bssid, u16 reason_code,
1725  const u8 *ie, size_t ie_len);
1726 
1727 void p2p_disassoc_notif(struct p2p_data *p2p, const u8 *bssid, u16 reason_code,
1728  const u8 *ie, size_t ie_len);
1729 
1730 
1731 /* Per-group P2P state for GO */
1732 
1733 struct p2p_group;
1734 
1750 
1755  u8 interface_addr[ETH_ALEN];
1756 
1761  unsigned int max_clients;
1762 
1767  u8 ssid[SSID_MAX_LEN];
1768 
1773  size_t ssid_len;
1774 
1779  int freq;
1780 
1785  void *cb_ctx;
1786 
1800  void (*ie_update)(void *ctx, struct wpabuf *beacon_ies,
1801  struct wpabuf *proberesp_ies);
1802 
1808  void (*idle_update)(void *ctx, int idle);
1809 };
1810 
1821 struct p2p_group * p2p_group_init(struct p2p_data *p2p,
1822  struct p2p_group_config *config);
1823 
1828 void p2p_group_deinit(struct p2p_group *group);
1829 
1838 int p2p_group_notif_assoc(struct p2p_group *group, const u8 *addr,
1839  const u8 *ie, size_t len);
1840 
1850 struct wpabuf * p2p_group_assoc_resp_ie(struct p2p_group *group, u8 status);
1851 
1857 void p2p_group_notif_disassoc(struct p2p_group *group, const u8 *addr);
1858 
1863 void p2p_group_notif_formation_done(struct p2p_group *group);
1864 
1876 int p2p_group_notif_noa(struct p2p_group *group, const u8 *noa,
1877  size_t noa_len);
1878 
1890 int p2p_group_match_dev_type(struct p2p_group *group, struct wpabuf *wps);
1891 
1896 int p2p_group_match_dev_id(struct p2p_group *group, struct wpabuf *p2p);
1897 
1903 int p2p_group_go_discover(struct p2p_group *group, const u8 *dev_id,
1904  const u8 *searching_dev, int rx_freq);
1905 
1906 
1907 /* Generic helper functions */
1908 
1919 int p2p_ie_text(struct wpabuf *p2p_ie, char *buf, char *end);
1920 
1932 int p2p_scan_result_text(const u8 *ies, size_t ies_len, char *buf, char *end);
1933 
1941 int p2p_parse_dev_addr_in_p2p_ie(struct wpabuf *p2p_ie, u8 *dev_addr);
1942 
1950 int p2p_parse_dev_addr(const u8 *ies, size_t ies_len, u8 *dev_addr);
1951 
1962 int p2p_assoc_req_ie(struct p2p_data *p2p, const u8 *bssid, u8 *buf,
1963  size_t len, int p2p_group, struct wpabuf *p2p_ie);
1964 
1971 void p2p_scan_ie(struct p2p_data *p2p, struct wpabuf *ies, const u8 *dev_id);
1972 
1978 size_t p2p_scan_ie_buf_len(struct p2p_data *p2p);
1979 
1986 int p2p_go_params(struct p2p_data *p2p, struct p2p_go_neg_results *params);
1987 
1993 u8 p2p_get_group_capab(const struct wpabuf *p2p_ie);
1994 
2000 int p2p_get_cross_connect_disallowed(const struct wpabuf *p2p_ie);
2001 
2007 const u8 * p2p_get_go_dev_addr(const struct wpabuf *p2p_ie);
2008 
2016 const struct p2p_peer_info * p2p_get_peer_info(struct p2p_data *p2p,
2017  const u8 *addr, int next);
2018 
2030 int p2p_get_peer_info_txt(const struct p2p_peer_info *info,
2031  char *buf, size_t buflen);
2032 
2039 int p2p_peer_known(struct p2p_data *p2p, const u8 *addr);
2040 
2050 void p2p_set_client_discoverability(struct p2p_data *p2p, int enabled);
2051 
2057 void p2p_set_managed_oper(struct p2p_data *p2p, int enabled);
2058 
2070 int p2p_config_get_random_social(struct p2p_config *p2p, u8 *op_class,
2071  u8 *op_channel);
2072 
2073 int p2p_set_listen_channel(struct p2p_data *p2p, u8 reg_class, u8 channel,
2074  u8 forced);
2075 
2076 u8 p2p_get_listen_channel(struct p2p_data *p2p);
2077 
2078 int p2p_set_ssid_postfix(struct p2p_data *p2p, const u8 *postfix, size_t len);
2079 
2080 int p2p_get_interface_addr(struct p2p_data *p2p, const u8 *dev_addr,
2081  u8 *iface_addr);
2082 int p2p_get_dev_addr(struct p2p_data *p2p, const u8 *iface_addr,
2083  u8 *dev_addr);
2084 
2085 void p2p_set_peer_filter(struct p2p_data *p2p, const u8 *addr);
2086 
2092 void p2p_set_cross_connect(struct p2p_data *p2p, int enabled);
2093 
2094 int p2p_get_oper_freq(struct p2p_data *p2p, const u8 *iface_addr);
2095 
2101 void p2p_set_intra_bss_dist(struct p2p_data *p2p, int enabled);
2102 
2103 int p2p_channels_includes_freq(const struct p2p_channels *channels,
2104  unsigned int freq);
2105 
2106 int p2p_channels_to_freqs(const struct p2p_channels *channels,
2107  int *freq_list, unsigned int max_len);
2108 
2115 int p2p_supported_freq(struct p2p_data *p2p, unsigned int freq);
2116 
2123 int p2p_supported_freq_go(struct p2p_data *p2p, unsigned int freq);
2124 
2131 int p2p_supported_freq_cli(struct p2p_data *p2p, unsigned int freq);
2132 
2139 unsigned int p2p_get_pref_freq(struct p2p_data *p2p,
2140  const struct p2p_channels *channels);
2141 
2142 void p2p_update_channel_list(struct p2p_data *p2p,
2143  const struct p2p_channels *chan,
2144  const struct p2p_channels *cli_chan);
2145 
2153 void p2p_set_best_channels(struct p2p_data *p2p, int freq_24, int freq_5,
2154  int freq_overall);
2155 
2165 void p2p_set_own_freq_preference(struct p2p_data *p2p, int freq);
2166 
2167 const u8 * p2p_get_go_neg_peer(struct p2p_data *p2p);
2168 
2174 unsigned int p2p_get_group_num_members(struct p2p_group *group);
2175 
2181 int p2p_client_limit_reached(struct p2p_group *group);
2182 
2190 const u8 * p2p_iterate_group_members(struct p2p_group *group, void **next);
2191 
2199 const u8 * p2p_group_get_dev_addr(struct p2p_group *group, const u8 *addr);
2200 
2207 int p2p_group_is_client_connected(struct p2p_group *group, const u8 *dev_addr);
2208 
2214 const struct p2p_group_config * p2p_group_get_config(struct p2p_group *group);
2215 
2224 void p2p_loop_on_all_groups(struct p2p_data *p2p,
2225  int (*group_callback)(struct p2p_group *group,
2226  void *user_data),
2227  void *user_data);
2228 
2236 const struct p2p_peer_info *
2237 p2p_get_peer_found(struct p2p_data *p2p, const u8 *addr, int next);
2238 
2243 void p2p_remove_wps_vendor_extensions(struct p2p_data *p2p);
2244 
2254 int p2p_add_wps_vendor_extension(struct p2p_data *p2p,
2255  const struct wpabuf *vendor_ext);
2256 
2265 int p2p_set_oper_channel(struct p2p_data *p2p, u8 op_reg_class, u8 op_channel,
2266  int cfg_op_channel);
2267 
2275 int p2p_set_pref_chan(struct p2p_data *p2p, unsigned int num_pref_chan,
2276  const struct p2p_channel *pref_chan);
2277 
2284 int p2p_set_no_go_freq(struct p2p_data *p2p,
2285  const struct wpa_freq_range_list *list);
2286 
2293 int p2p_in_progress(struct p2p_data *p2p);
2294 
2295 const char * p2p_wps_method_text(enum p2p_wps_method method);
2296 
2303 void p2p_set_config_timeout(struct p2p_data *p2p, u8 go_timeout,
2304  u8 client_timeout);
2305 
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);
2319 
2338 int p2p_set_disc_int(struct p2p_data *p2p, int min_disc_int, int max_disc_int,
2339  int max_disc_tu);
2340 
2350 const char * p2p_get_state_txt(struct p2p_data *p2p);
2351 
2352 struct wpabuf * p2p_build_nfc_handover_req(struct p2p_data *p2p,
2353  int client_freq,
2354  const u8 *go_dev_addr,
2355  const u8 *ssid, size_t ssid_len);
2356 struct wpabuf * p2p_build_nfc_handover_sel(struct p2p_data *p2p,
2357  int client_freq,
2358  const u8 *go_dev_addr,
2359  const u8 *ssid, size_t ssid_len);
2360 
2362  int sel;
2363  const u8 *wsc_attr;
2364  size_t wsc_len;
2365  const u8 *p2p_attr;
2366  size_t p2p_len;
2367 
2368  enum {
2369  NO_ACTION, JOIN_GROUP, AUTH_JOIN, INIT_GO_NEG, RESP_GO_NEG,
2370  BOTH_GO, PEER_CLIENT
2371  } next_step;
2372  struct p2p_peer_info *peer;
2373  u8 oob_dev_pw[WPS_OOB_PUBKEY_HASH_LEN + 2 +
2374  WPS_OOB_DEVICE_PASSWORD_LEN];
2375  size_t oob_dev_pw_len;
2376  int go_freq;
2377  u8 go_dev_addr[ETH_ALEN];
2378  u8 go_ssid[SSID_MAX_LEN];
2379  size_t go_ssid_len;
2380 };
2381 
2382 int p2p_process_nfc_connection_handover(struct p2p_data *p2p,
2383  struct p2p_nfc_params *params);
2384 
2385 void p2p_set_authorized_oob_dev_pw_id(struct p2p_data *p2p, u16 dev_pw_id,
2386  int go_intent,
2387  const u8 *own_interface_addr);
2388 
2389 int p2p_set_passphrase_len(struct p2p_data *p2p, unsigned int len);
2390 
2391 void p2p_loop_on_known_peers(struct p2p_data *p2p,
2392  void (*peer_callback)(struct p2p_peer_info *peer,
2393  void *user_data),
2394  void *user_data);
2395 
2396 void p2p_set_vendor_elems(struct p2p_data *p2p, struct wpabuf **vendor_elem);
2397 
2398 void p2p_set_intended_addr(struct p2p_data *p2p, const u8 *intended_addr);
2399 
2400 struct p2ps_advertisement *
2401 p2p_service_p2ps_id(struct p2p_data *p2p, u32 adv_id);
2402 int p2p_service_add_asp(struct p2p_data *p2p, int auto_accept, u32 adv_id,
2403  const char *adv_str, u8 svc_state,
2404  u16 config_methods, const char *svc_info,
2405  const u8 *cpt_priority);
2406 int p2p_service_del_asp(struct p2p_data *p2p, u32 adv_id);
2407 void p2p_service_flush_asp(struct p2p_data *p2p);
2408 struct p2ps_advertisement * p2p_get_p2ps_adv_list(struct p2p_data *p2p);
2409 
2417 void p2p_expire_peers(struct p2p_data *p2p);
2418 
2419 void p2p_set_own_pref_freq_list(struct p2p_data *p2p,
2420  const unsigned int *pref_freq_list,
2421  unsigned int size);
2422 
2430 int p2p_group_get_common_freqs(struct p2p_group *group, int *common_freqs,
2431  unsigned int *num);
2432 
2433 #endif /* P2P_H */
Definition: p2p.h:2361
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
Definition: wpabuf.h:16
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
Definition: common.h:501
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
Definition: p2p.h:182
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
Definition: p2p.h:458
u8 p2p_get_group_capab(const struct wpabuf *p2p_ie)
Get Group Capability from P2P IE data.
Definition: p2p_parse.c:847
Definition: os.h:22
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
Definition: p2p.h:263
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
Wi-Fi Protected Setup.
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