p2p_i.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. /*
  2. * P2P - Internal definitions for P2P module
  3. * Copyright (c) 2009-2010, Atheros Communications
  4. *
  5. * This software may be distributed under the terms of the BSD license.
  6. * See README for more details.
  7. */
  8. #ifndef P2P_I_H
  9. #define P2P_I_H
  10. #include "utils/list.h"
  11. #include "p2p.h"
  12. enum p2p_go_state {
  13. UNKNOWN_GO,
  14. LOCAL_GO,
  15. REMOTE_GO
  16. };
  17. /**
  18. * struct p2p_device - P2P Device data (internal to P2P module)
  19. */
  20. struct p2p_device {
  21. struct dl_list list;
  22. struct os_time last_seen;
  23. int listen_freq;
  24. enum p2p_wps_method wps_method;
  25. struct p2p_peer_info info;
  26. /*
  27. * If the peer was discovered based on an interface address (e.g., GO
  28. * from Beacon/Probe Response), the interface address is stored here.
  29. * p2p_device_addr must still be set in such a case to the unique
  30. * identifier for the P2P Device.
  31. */
  32. u8 interface_addr[ETH_ALEN];
  33. /*
  34. * P2P Device Address of the GO in whose group this P2P Device is a
  35. * client.
  36. */
  37. u8 member_in_go_dev[ETH_ALEN];
  38. /*
  39. * P2P Interface Address of the GO in whose group this P2P Device is a
  40. * client.
  41. */
  42. u8 member_in_go_iface[ETH_ALEN];
  43. int go_neg_req_sent;
  44. enum p2p_go_state go_state;
  45. u8 dialog_token;
  46. u8 tie_breaker;
  47. u8 intended_addr[ETH_ALEN];
  48. char country[3];
  49. struct p2p_channels channels;
  50. int oper_freq;
  51. u8 oper_ssid[32];
  52. size_t oper_ssid_len;
  53. /**
  54. * req_config_methods - Pending provision discovery methods
  55. */
  56. u16 req_config_methods;
  57. /**
  58. * wps_prov_info - Stored provisioning WPS config method
  59. *
  60. * This is used to store pending WPS config method between Provisioning
  61. * Discovery and connection to a running group.
  62. */
  63. u16 wps_prov_info;
  64. #define P2P_DEV_PROBE_REQ_ONLY BIT(0)
  65. #define P2P_DEV_REPORTED BIT(1)
  66. #define P2P_DEV_NOT_YET_READY BIT(2)
  67. #define P2P_DEV_SD_INFO BIT(3)
  68. #define P2P_DEV_SD_SCHEDULE BIT(4)
  69. #define P2P_DEV_PD_PEER_DISPLAY BIT(5)
  70. #define P2P_DEV_PD_PEER_KEYPAD BIT(6)
  71. #define P2P_DEV_USER_REJECTED BIT(7)
  72. #define P2P_DEV_PEER_WAITING_RESPONSE BIT(8)
  73. #define P2P_DEV_PREFER_PERSISTENT_GROUP BIT(9)
  74. #define P2P_DEV_WAIT_GO_NEG_RESPONSE BIT(10)
  75. #define P2P_DEV_WAIT_GO_NEG_CONFIRM BIT(11)
  76. #define P2P_DEV_GROUP_CLIENT_ONLY BIT(12)
  77. #define P2P_DEV_FORCE_FREQ BIT(13)
  78. #define P2P_DEV_PD_FOR_JOIN BIT(14)
  79. #define P2P_DEV_REPORTED_ONCE BIT(15)
  80. #define P2P_DEV_PREFER_PERSISTENT_RECONN BIT(16)
  81. #define P2P_DEV_PD_BEFORE_GO_NEG BIT(17)
  82. #define P2P_DEV_NO_PREF_CHAN BIT(18)
  83. unsigned int flags;
  84. int status; /* enum p2p_status_code */
  85. unsigned int wait_count;
  86. unsigned int connect_reqs;
  87. unsigned int invitation_reqs;
  88. u16 ext_listen_period;
  89. u16 ext_listen_interval;
  90. u8 go_timeout;
  91. u8 client_timeout;
  92. };
  93. struct p2p_sd_query {
  94. struct p2p_sd_query *next;
  95. u8 peer[ETH_ALEN];
  96. int for_all_peers;
  97. int wsd; /* Wi-Fi Display Service Discovery Request */
  98. struct wpabuf *tlvs;
  99. };
  100. struct p2p_pending_action_tx {
  101. unsigned int freq;
  102. u8 dst[ETH_ALEN];
  103. u8 src[ETH_ALEN];
  104. u8 bssid[ETH_ALEN];
  105. size_t len;
  106. unsigned int wait_time;
  107. /* Followed by len octets of the frame */
  108. };
  109. /**
  110. * struct p2p_data - P2P module data (internal to P2P module)
  111. */
  112. struct p2p_data {
  113. /**
  114. * cfg - P2P module configuration
  115. *
  116. * This is included in the same memory allocation with the
  117. * struct p2p_data and as such, must not be freed separately.
  118. */
  119. struct p2p_config *cfg;
  120. /**
  121. * state - The current P2P state
  122. */
  123. enum p2p_state {
  124. /**
  125. * P2P_IDLE - Idle
  126. */
  127. P2P_IDLE,
  128. /**
  129. * P2P_SEARCH - Search (Device Discovery)
  130. */
  131. P2P_SEARCH,
  132. /**
  133. * P2P_CONNECT - Trying to start GO Negotiation
  134. */
  135. P2P_CONNECT,
  136. /**
  137. * P2P_CONNECT_LISTEN - Listen during GO Negotiation start
  138. */
  139. P2P_CONNECT_LISTEN,
  140. /**
  141. * P2P_GO_NEG - In GO Negotiation
  142. */
  143. P2P_GO_NEG,
  144. /**
  145. * P2P_LISTEN_ONLY - Listen only
  146. */
  147. P2P_LISTEN_ONLY,
  148. /**
  149. * P2P_WAIT_PEER_CONNECT - Waiting peer in List for GO Neg
  150. */
  151. P2P_WAIT_PEER_CONNECT,
  152. /**
  153. * P2P_WAIT_PEER_IDLE - Waiting peer idle for GO Neg
  154. */
  155. P2P_WAIT_PEER_IDLE,
  156. /**
  157. * P2P_SD_DURING_FIND - Service Discovery during find
  158. */
  159. P2P_SD_DURING_FIND,
  160. /**
  161. * P2P_PROVISIONING - Provisioning (during group formation)
  162. */
  163. P2P_PROVISIONING,
  164. /**
  165. * P2P_PD_DURING_FIND - Provision Discovery during find
  166. */
  167. P2P_PD_DURING_FIND,
  168. /**
  169. * P2P_INVITE - Trying to start Invite
  170. */
  171. P2P_INVITE,
  172. /**
  173. * P2P_INVITE_LISTEN - Listen during Invite
  174. */
  175. P2P_INVITE_LISTEN,
  176. /**
  177. * P2P_SEARCH_WHEN_READY - Waiting to start Search
  178. */
  179. P2P_SEARCH_WHEN_READY,
  180. /**
  181. * P2P_CONTINUE_SEARCH_WHEN_READY - Waiting to continue Search
  182. */
  183. P2P_CONTINUE_SEARCH_WHEN_READY,
  184. } state;
  185. /**
  186. * min_disc_int - minDiscoverableInterval
  187. */
  188. int min_disc_int;
  189. /**
  190. * max_disc_int - maxDiscoverableInterval
  191. */
  192. int max_disc_int;
  193. /**
  194. * max_disc_tu - Maximum number of TUs for discoverable interval
  195. */
  196. int max_disc_tu;
  197. /**
  198. * devices - List of known P2P Device peers
  199. */
  200. struct dl_list devices;
  201. /**
  202. * go_neg_peer - Pointer to GO Negotiation peer
  203. */
  204. struct p2p_device *go_neg_peer;
  205. /**
  206. * invite_peer - Pointer to Invite peer
  207. */
  208. struct p2p_device *invite_peer;
  209. const u8 *invite_go_dev_addr;
  210. u8 invite_go_dev_addr_buf[ETH_ALEN];
  211. /**
  212. * sd_peer - Pointer to Service Discovery peer
  213. */
  214. struct p2p_device *sd_peer;
  215. /**
  216. * sd_query - Pointer to Service Discovery query
  217. */
  218. struct p2p_sd_query *sd_query;
  219. /* GO Negotiation data */
  220. /**
  221. * intended_addr - Local Intended P2P Interface Address
  222. *
  223. * This address is used during group owner negotiation as the Intended
  224. * P2P Interface Address and the group interface will be created with
  225. * address as the local address in case of successfully completed
  226. * negotiation.
  227. */
  228. u8 intended_addr[ETH_ALEN];
  229. /**
  230. * go_intent - Local GO Intent to be used during GO Negotiation
  231. */
  232. u8 go_intent;
  233. /**
  234. * next_tie_breaker - Next tie-breaker value to use in GO Negotiation
  235. */
  236. u8 next_tie_breaker;
  237. /**
  238. * ssid - Selected SSID for GO Negotiation (if local end will be GO)
  239. */
  240. u8 ssid[32];
  241. /**
  242. * ssid_len - ssid length in octets
  243. */
  244. size_t ssid_len;
  245. /**
  246. * ssid_set - Whether SSID is already set for GO Negotiation
  247. */
  248. int ssid_set;
  249. /**
  250. * Regulatory class for own operational channel
  251. */
  252. u8 op_reg_class;
  253. /**
  254. * op_channel - Own operational channel
  255. */
  256. u8 op_channel;
  257. /**
  258. * channels - Own supported regulatory classes and channels
  259. *
  260. * List of supposerted channels per regulatory class. The regulatory
  261. * classes are defined in IEEE Std 802.11-2007 Annex J and the
  262. * numbering of the clases depends on the configured country code.
  263. */
  264. struct p2p_channels channels;
  265. enum p2p_pending_action_state {
  266. P2P_NO_PENDING_ACTION,
  267. P2P_PENDING_GO_NEG_REQUEST,
  268. P2P_PENDING_GO_NEG_RESPONSE,
  269. P2P_PENDING_GO_NEG_RESPONSE_FAILURE,
  270. P2P_PENDING_GO_NEG_CONFIRM,
  271. P2P_PENDING_SD,
  272. P2P_PENDING_PD,
  273. P2P_PENDING_INVITATION_REQUEST,
  274. P2P_PENDING_INVITATION_RESPONSE,
  275. P2P_PENDING_DEV_DISC_REQUEST,
  276. P2P_PENDING_DEV_DISC_RESPONSE,
  277. P2P_PENDING_GO_DISC_REQ
  278. } pending_action_state;
  279. unsigned int pending_listen_freq;
  280. unsigned int pending_listen_sec;
  281. unsigned int pending_listen_usec;
  282. u8 dev_capab;
  283. int in_listen;
  284. int drv_in_listen;
  285. /**
  286. * sd_queries - Pending service discovery queries
  287. */
  288. struct p2p_sd_query *sd_queries;
  289. /**
  290. * srv_update_indic - Service Update Indicator for local services
  291. */
  292. u16 srv_update_indic;
  293. struct wpabuf *sd_resp; /* Fragmented SD response */
  294. u8 sd_resp_addr[ETH_ALEN];
  295. u8 sd_resp_dialog_token;
  296. size_t sd_resp_pos; /* Offset in sd_resp */
  297. u8 sd_frag_id;
  298. struct wpabuf *sd_rx_resp; /* Reassembled SD response */
  299. u16 sd_rx_update_indic;
  300. /* P2P Invitation data */
  301. enum p2p_invite_role inv_role;
  302. u8 inv_bssid[ETH_ALEN];
  303. int inv_bssid_set;
  304. u8 inv_ssid[32];
  305. size_t inv_ssid_len;
  306. u8 inv_sa[ETH_ALEN];
  307. u8 inv_group_bssid[ETH_ALEN];
  308. u8 *inv_group_bssid_ptr;
  309. u8 inv_go_dev_addr[ETH_ALEN];
  310. u8 inv_status;
  311. int inv_op_freq;
  312. int inv_persistent;
  313. enum p2p_discovery_type find_type;
  314. unsigned int last_p2p_find_timeout;
  315. u8 last_prog_scan_class;
  316. u8 last_prog_scan_chan;
  317. int p2p_scan_running;
  318. enum p2p_after_scan {
  319. P2P_AFTER_SCAN_NOTHING,
  320. P2P_AFTER_SCAN_LISTEN,
  321. P2P_AFTER_SCAN_CONNECT
  322. } start_after_scan;
  323. u8 after_scan_peer[ETH_ALEN];
  324. struct p2p_pending_action_tx *after_scan_tx;
  325. unsigned int after_scan_tx_in_progress:1;
  326. /* Requested device types for find/search */
  327. unsigned int num_req_dev_types;
  328. u8 *req_dev_types;
  329. u8 *find_dev_id;
  330. u8 find_dev_id_buf[ETH_ALEN];
  331. struct os_time find_start; /* time of last p2p_find start */
  332. struct p2p_group **groups;
  333. size_t num_groups;
  334. struct p2p_device *pending_client_disc_go;
  335. u8 pending_client_disc_addr[ETH_ALEN];
  336. u8 pending_dev_disc_dialog_token;
  337. u8 pending_dev_disc_addr[ETH_ALEN];
  338. int pending_dev_disc_freq;
  339. unsigned int pending_client_disc_freq;
  340. int ext_listen_only;
  341. unsigned int ext_listen_period;
  342. unsigned int ext_listen_interval;
  343. unsigned int ext_listen_interval_sec;
  344. unsigned int ext_listen_interval_usec;
  345. u8 peer_filter[ETH_ALEN];
  346. int cross_connect;
  347. int best_freq_24;
  348. int best_freq_5;
  349. int best_freq_overall;
  350. int own_freq_preference;
  351. /**
  352. * wps_vendor_ext - WPS Vendor Extensions to add
  353. */
  354. struct wpabuf *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT];
  355. /*
  356. * user_initiated_pd - Whether a PD request is user initiated or not.
  357. */
  358. u8 user_initiated_pd;
  359. /*
  360. * Keep track of which peer a given PD request was sent to.
  361. * Used to raise a timeout alert in case there is no response.
  362. */
  363. u8 pending_pd_devaddr[ETH_ALEN];
  364. /*
  365. * Retry counter for provision discovery requests when issued
  366. * in IDLE state.
  367. */
  368. int pd_retries;
  369. u8 go_timeout;
  370. u8 client_timeout;
  371. /* Extra delay in milliseconds between search iterations */
  372. unsigned int search_delay;
  373. int in_search_delay;
  374. #ifdef CONFIG_WIFI_DISPLAY
  375. struct wpabuf *wfd_ie_beacon;
  376. struct wpabuf *wfd_ie_probe_req;
  377. struct wpabuf *wfd_ie_probe_resp;
  378. struct wpabuf *wfd_ie_assoc_req;
  379. struct wpabuf *wfd_ie_invitation;
  380. struct wpabuf *wfd_ie_prov_disc_req;
  381. struct wpabuf *wfd_ie_prov_disc_resp;
  382. struct wpabuf *wfd_ie_go_neg;
  383. struct wpabuf *wfd_dev_info;
  384. struct wpabuf *wfd_assoc_bssid;
  385. struct wpabuf *wfd_coupled_sink_info;
  386. #endif /* CONFIG_WIFI_DISPLAY */
  387. };
  388. /**
  389. * struct p2p_message - Parsed P2P message (or P2P IE)
  390. */
  391. struct p2p_message {
  392. struct wpabuf *p2p_attributes;
  393. struct wpabuf *wps_attributes;
  394. struct wpabuf *wfd_subelems;
  395. u8 dialog_token;
  396. const u8 *capability;
  397. const u8 *go_intent;
  398. const u8 *status;
  399. const u8 *listen_channel;
  400. const u8 *operating_channel;
  401. const u8 *channel_list;
  402. u8 channel_list_len;
  403. const u8 *config_timeout;
  404. const u8 *intended_addr;
  405. const u8 *group_bssid;
  406. const u8 *invitation_flags;
  407. const u8 *group_info;
  408. size_t group_info_len;
  409. const u8 *group_id;
  410. size_t group_id_len;
  411. const u8 *device_id;
  412. const u8 *manageability;
  413. const u8 *noa;
  414. size_t noa_len;
  415. const u8 *ext_listen_timing;
  416. const u8 *minor_reason_code;
  417. /* P2P Device Info */
  418. const u8 *p2p_device_info;
  419. size_t p2p_device_info_len;
  420. const u8 *p2p_device_addr;
  421. const u8 *pri_dev_type;
  422. u8 num_sec_dev_types;
  423. char device_name[33];
  424. u16 config_methods;
  425. /* WPS IE */
  426. u16 dev_password_id;
  427. u16 wps_config_methods;
  428. const u8 *wps_pri_dev_type;
  429. const u8 *wps_sec_dev_type_list;
  430. size_t wps_sec_dev_type_list_len;
  431. const u8 *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT];
  432. size_t wps_vendor_ext_len[P2P_MAX_WPS_VENDOR_EXT];
  433. const u8 *manufacturer;
  434. size_t manufacturer_len;
  435. const u8 *model_name;
  436. size_t model_name_len;
  437. const u8 *model_number;
  438. size_t model_number_len;
  439. const u8 *serial_number;
  440. size_t serial_number_len;
  441. /* DS Parameter Set IE */
  442. const u8 *ds_params;
  443. /* SSID IE */
  444. const u8 *ssid;
  445. };
  446. #define P2P_MAX_GROUP_ENTRIES 50
  447. struct p2p_group_info {
  448. unsigned int num_clients;
  449. struct p2p_client_info {
  450. const u8 *p2p_device_addr;
  451. const u8 *p2p_interface_addr;
  452. u8 dev_capab;
  453. u16 config_methods;
  454. const u8 *pri_dev_type;
  455. u8 num_sec_dev_types;
  456. const u8 *sec_dev_types;
  457. const char *dev_name;
  458. size_t dev_name_len;
  459. } client[P2P_MAX_GROUP_ENTRIES];
  460. };
  461. /* p2p_utils.c */
  462. int p2p_random(char *buf, size_t len);
  463. int p2p_channel_to_freq(const char *country, int reg_class, int channel);
  464. int p2p_freq_to_channel(const char *country, unsigned int freq, u8 *reg_class,
  465. u8 *channel);
  466. void p2p_channels_intersect(const struct p2p_channels *a,
  467. const struct p2p_channels *b,
  468. struct p2p_channels *res);
  469. int p2p_channels_includes(const struct p2p_channels *channels, u8 reg_class,
  470. u8 channel);
  471. /* p2p_parse.c */
  472. int p2p_parse_p2p_ie(const struct wpabuf *buf, struct p2p_message *msg);
  473. int p2p_parse_ies(const u8 *data, size_t len, struct p2p_message *msg);
  474. int p2p_parse(const u8 *data, size_t len, struct p2p_message *msg);
  475. void p2p_parse_free(struct p2p_message *msg);
  476. int p2p_attr_text(struct wpabuf *data, char *buf, char *end);
  477. int p2p_group_info_parse(const u8 *gi, size_t gi_len,
  478. struct p2p_group_info *info);
  479. /* p2p_build.c */
  480. struct p2p_noa_desc {
  481. u8 count_type;
  482. u32 duration;
  483. u32 interval;
  484. u32 start_time;
  485. };
  486. /* p2p_group.c */
  487. const u8 * p2p_group_get_interface_addr(struct p2p_group *group);
  488. u8 p2p_group_presence_req(struct p2p_group *group,
  489. const u8 *client_interface_addr,
  490. const u8 *noa, size_t noa_len);
  491. int p2p_group_is_group_id_match(struct p2p_group *group, const u8 *group_id,
  492. size_t group_id_len);
  493. void p2p_group_update_ies(struct p2p_group *group);
  494. struct wpabuf * p2p_group_get_wfd_ie(struct p2p_group *g);
  495. void p2p_buf_add_action_hdr(struct wpabuf *buf, u8 subtype, u8 dialog_token);
  496. void p2p_buf_add_public_action_hdr(struct wpabuf *buf, u8 subtype,
  497. u8 dialog_token);
  498. u8 * p2p_buf_add_ie_hdr(struct wpabuf *buf);
  499. void p2p_buf_add_status(struct wpabuf *buf, u8 status);
  500. void p2p_buf_add_device_info(struct wpabuf *buf, struct p2p_data *p2p,
  501. struct p2p_device *peer);
  502. void p2p_buf_add_device_id(struct wpabuf *buf, const u8 *dev_addr);
  503. void p2p_buf_update_ie_hdr(struct wpabuf *buf, u8 *len);
  504. void p2p_buf_add_capability(struct wpabuf *buf, u8 dev_capab, u8 group_capab);
  505. void p2p_buf_add_go_intent(struct wpabuf *buf, u8 go_intent);
  506. void p2p_buf_add_listen_channel(struct wpabuf *buf, const char *country,
  507. u8 reg_class, u8 channel);
  508. void p2p_buf_add_operating_channel(struct wpabuf *buf, const char *country,
  509. u8 reg_class, u8 channel);
  510. void p2p_buf_add_channel_list(struct wpabuf *buf, const char *country,
  511. struct p2p_channels *chan);
  512. void p2p_buf_add_config_timeout(struct wpabuf *buf, u8 go_timeout,
  513. u8 client_timeout);
  514. void p2p_buf_add_intended_addr(struct wpabuf *buf, const u8 *interface_addr);
  515. void p2p_buf_add_group_bssid(struct wpabuf *buf, const u8 *bssid);
  516. void p2p_buf_add_group_id(struct wpabuf *buf, const u8 *dev_addr,
  517. const u8 *ssid, size_t ssid_len);
  518. void p2p_buf_add_invitation_flags(struct wpabuf *buf, u8 flags);
  519. void p2p_buf_add_noa(struct wpabuf *buf, u8 noa_index, u8 opp_ps, u8 ctwindow,
  520. struct p2p_noa_desc *desc1, struct p2p_noa_desc *desc2);
  521. void p2p_buf_add_ext_listen_timing(struct wpabuf *buf, u16 period,
  522. u16 interval);
  523. void p2p_buf_add_p2p_interface(struct wpabuf *buf, struct p2p_data *p2p);
  524. void p2p_build_wps_ie(struct p2p_data *p2p, struct wpabuf *buf, int pw_id,
  525. int all_attr);
  526. /* p2p_sd.c */
  527. struct p2p_sd_query * p2p_pending_sd_req(struct p2p_data *p2p,
  528. struct p2p_device *dev);
  529. void p2p_free_sd_queries(struct p2p_data *p2p);
  530. void p2p_rx_gas_initial_req(struct p2p_data *p2p, const u8 *sa,
  531. const u8 *data, size_t len, int rx_freq);
  532. void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
  533. const u8 *data, size_t len, int rx_freq);
  534. void p2p_rx_gas_comeback_req(struct p2p_data *p2p, const u8 *sa,
  535. const u8 *data, size_t len, int rx_freq);
  536. void p2p_rx_gas_comeback_resp(struct p2p_data *p2p, const u8 *sa,
  537. const u8 *data, size_t len, int rx_freq);
  538. int p2p_start_sd(struct p2p_data *p2p, struct p2p_device *dev);
  539. /* p2p_go_neg.c */
  540. int p2p_peer_channels_check(struct p2p_data *p2p, struct p2p_channels *own,
  541. struct p2p_device *dev,
  542. const u8 *channel_list, size_t channel_list_len);
  543. void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
  544. const u8 *data, size_t len, int rx_freq);
  545. void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
  546. const u8 *data, size_t len, int rx_freq);
  547. void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa,
  548. const u8 *data, size_t len);
  549. int p2p_connect_send(struct p2p_data *p2p, struct p2p_device *dev);
  550. u16 p2p_wps_method_pw_id(enum p2p_wps_method wps_method);
  551. void p2p_reselect_channel(struct p2p_data *p2p,
  552. struct p2p_channels *intersection);
  553. /* p2p_pd.c */
  554. void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
  555. const u8 *data, size_t len, int rx_freq);
  556. void p2p_process_prov_disc_resp(struct p2p_data *p2p, const u8 *sa,
  557. const u8 *data, size_t len);
  558. int p2p_send_prov_disc_req(struct p2p_data *p2p, struct p2p_device *dev,
  559. int join, int force_freq);
  560. void p2p_reset_pending_pd(struct p2p_data *p2p);
  561. /* p2p_invitation.c */
  562. void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
  563. const u8 *data, size_t len, int rx_freq);
  564. void p2p_process_invitation_resp(struct p2p_data *p2p, const u8 *sa,
  565. const u8 *data, size_t len);
  566. int p2p_invite_send(struct p2p_data *p2p, struct p2p_device *dev,
  567. const u8 *go_dev_addr);
  568. void p2p_invitation_req_cb(struct p2p_data *p2p, int success);
  569. void p2p_invitation_resp_cb(struct p2p_data *p2p, int success);
  570. /* p2p_dev_disc.c */
  571. void p2p_process_dev_disc_req(struct p2p_data *p2p, const u8 *sa,
  572. const u8 *data, size_t len, int rx_freq);
  573. void p2p_dev_disc_req_cb(struct p2p_data *p2p, int success);
  574. int p2p_send_dev_disc_req(struct p2p_data *p2p, struct p2p_device *dev);
  575. void p2p_dev_disc_resp_cb(struct p2p_data *p2p, int success);
  576. void p2p_process_dev_disc_resp(struct p2p_data *p2p, const u8 *sa,
  577. const u8 *data, size_t len);
  578. void p2p_go_disc_req_cb(struct p2p_data *p2p, int success);
  579. void p2p_process_go_disc_req(struct p2p_data *p2p, const u8 *da, const u8 *sa,
  580. const u8 *data, size_t len, int rx_freq);
  581. /* p2p.c */
  582. void p2p_set_state(struct p2p_data *p2p, int new_state);
  583. void p2p_set_timeout(struct p2p_data *p2p, unsigned int sec,
  584. unsigned int usec);
  585. void p2p_clear_timeout(struct p2p_data *p2p);
  586. void p2p_continue_find(struct p2p_data *p2p);
  587. struct p2p_device * p2p_add_dev_from_go_neg_req(struct p2p_data *p2p,
  588. const u8 *addr,
  589. struct p2p_message *msg);
  590. void p2p_add_dev_info(struct p2p_data *p2p, const u8 *addr,
  591. struct p2p_device *dev, struct p2p_message *msg);
  592. int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,
  593. struct os_time *rx_time, int level, const u8 *ies,
  594. size_t ies_len, int scan_res);
  595. struct p2p_device * p2p_get_device(struct p2p_data *p2p, const u8 *addr);
  596. struct p2p_device * p2p_get_device_interface(struct p2p_data *p2p,
  597. const u8 *addr);
  598. void p2p_go_neg_failed(struct p2p_data *p2p, struct p2p_device *peer,
  599. int status);
  600. void p2p_go_complete(struct p2p_data *p2p, struct p2p_device *peer);
  601. int p2p_match_dev_type(struct p2p_data *p2p, struct wpabuf *wps);
  602. int dev_type_list_match(const u8 *dev_type, const u8 *req_dev_type[],
  603. size_t num_req_dev_type);
  604. struct wpabuf * p2p_build_probe_resp_ies(struct p2p_data *p2p);
  605. void p2p_build_ssid(struct p2p_data *p2p, u8 *ssid, size_t *ssid_len);
  606. int p2p_send_action(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
  607. const u8 *src, const u8 *bssid, const u8 *buf,
  608. size_t len, unsigned int wait_time);
  609. void p2p_stop_listen_for_freq(struct p2p_data *p2p, int freq);
  610. int p2p_prepare_channel(struct p2p_data *p2p, struct p2p_device *dev,
  611. unsigned int force_freq, unsigned int pref_freq);
  612. #endif /* P2P_I_H */