p2p.h 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701
  1. /*
  2. * Wi-Fi Direct - 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_H
  9. #define P2P_H
  10. /**
  11. * P2P_MAX_REG_CLASSES - Maximum number of regulatory classes
  12. */
  13. #define P2P_MAX_REG_CLASSES 10
  14. /**
  15. * P2P_MAX_REG_CLASS_CHANNELS - Maximum number of channels per regulatory class
  16. */
  17. #define P2P_MAX_REG_CLASS_CHANNELS 20
  18. /**
  19. * struct p2p_channels - List of supported channels
  20. */
  21. struct p2p_channels {
  22. /**
  23. * struct p2p_reg_class - Supported regulatory class
  24. */
  25. struct p2p_reg_class {
  26. /**
  27. * reg_class - Regulatory class (IEEE 802.11-2007, Annex J)
  28. */
  29. u8 reg_class;
  30. /**
  31. * channel - Supported channels
  32. */
  33. u8 channel[P2P_MAX_REG_CLASS_CHANNELS];
  34. /**
  35. * channels - Number of channel entries in use
  36. */
  37. size_t channels;
  38. } reg_class[P2P_MAX_REG_CLASSES];
  39. /**
  40. * reg_classes - Number of reg_class entries in use
  41. */
  42. size_t reg_classes;
  43. };
  44. enum p2p_wps_method {
  45. WPS_NOT_READY, WPS_PIN_DISPLAY, WPS_PIN_KEYPAD, WPS_PBC
  46. };
  47. /**
  48. * struct p2p_go_neg_results - P2P Group Owner Negotiation results
  49. */
  50. struct p2p_go_neg_results {
  51. /**
  52. * status - Negotiation result (Status Code)
  53. *
  54. * 0 (P2P_SC_SUCCESS) indicates success. Non-zero values indicate
  55. * failed negotiation.
  56. */
  57. int status;
  58. /**
  59. * role_go - Whether local end is Group Owner
  60. */
  61. int role_go;
  62. /**
  63. * freq - Frequency of the group operational channel in MHz
  64. */
  65. int freq;
  66. /**
  67. * ssid - SSID of the group
  68. */
  69. u8 ssid[32];
  70. /**
  71. * ssid_len - Length of SSID in octets
  72. */
  73. size_t ssid_len;
  74. /**
  75. * passphrase - WPA2-Personal passphrase for the group (GO only)
  76. */
  77. char passphrase[64];
  78. /**
  79. * peer_device_addr - P2P Device Address of the peer
  80. */
  81. u8 peer_device_addr[ETH_ALEN];
  82. /**
  83. * peer_interface_addr - P2P Interface Address of the peer
  84. */
  85. u8 peer_interface_addr[ETH_ALEN];
  86. /**
  87. * wps_method - WPS method to be used during provisioning
  88. */
  89. enum p2p_wps_method wps_method;
  90. #define P2P_MAX_CHANNELS 50
  91. /**
  92. * freq_list - Zero-terminated list of possible operational channels
  93. */
  94. int freq_list[P2P_MAX_CHANNELS];
  95. /**
  96. * persistent_group - Whether the group should be made persistent
  97. * 0 = not persistent
  98. * 1 = persistent group without persistent reconnect
  99. * 2 = persistent group with persistent reconnect
  100. */
  101. int persistent_group;
  102. /**
  103. * peer_config_timeout - Peer configuration timeout (in 10 msec units)
  104. */
  105. unsigned int peer_config_timeout;
  106. };
  107. struct p2p_data;
  108. enum p2p_scan_type {
  109. P2P_SCAN_SOCIAL,
  110. P2P_SCAN_FULL,
  111. P2P_SCAN_SPECIFIC,
  112. P2P_SCAN_SOCIAL_PLUS_ONE
  113. };
  114. #define P2P_MAX_WPS_VENDOR_EXT 10
  115. /**
  116. * struct p2p_peer_info - P2P peer information
  117. */
  118. struct p2p_peer_info {
  119. /**
  120. * p2p_device_addr - P2P Device Address of the peer
  121. */
  122. u8 p2p_device_addr[ETH_ALEN];
  123. /**
  124. * pri_dev_type - Primary Device Type
  125. */
  126. u8 pri_dev_type[8];
  127. /**
  128. * device_name - Device Name (0..32 octets encoded in UTF-8)
  129. */
  130. char device_name[33];
  131. /**
  132. * manufacturer - Manufacturer (0..64 octets encoded in UTF-8)
  133. */
  134. char manufacturer[65];
  135. /**
  136. * model_name - Model Name (0..32 octets encoded in UTF-8)
  137. */
  138. char model_name[33];
  139. /**
  140. * model_number - Model Number (0..32 octets encoded in UTF-8)
  141. */
  142. char model_number[33];
  143. /**
  144. * serial_number - Serial Number (0..32 octets encoded in UTF-8)
  145. */
  146. char serial_number[33];
  147. /**
  148. * level - Signal level
  149. */
  150. int level;
  151. /**
  152. * config_methods - WPS Configuration Methods
  153. */
  154. u16 config_methods;
  155. /**
  156. * dev_capab - Device Capabilities
  157. */
  158. u8 dev_capab;
  159. /**
  160. * group_capab - Group Capabilities
  161. */
  162. u8 group_capab;
  163. /**
  164. * wps_sec_dev_type_list - WPS secondary device type list
  165. *
  166. * This list includes from 0 to 16 Secondary Device Types as indicated
  167. * by wps_sec_dev_type_list_len (8 * number of types).
  168. */
  169. u8 wps_sec_dev_type_list[128];
  170. /**
  171. * wps_sec_dev_type_list_len - Length of secondary device type list
  172. */
  173. size_t wps_sec_dev_type_list_len;
  174. struct wpabuf *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT];
  175. };
  176. enum p2p_prov_disc_status {
  177. P2P_PROV_DISC_SUCCESS,
  178. P2P_PROV_DISC_TIMEOUT,
  179. P2P_PROV_DISC_REJECTED,
  180. };
  181. struct p2p_channel {
  182. u8 op_class;
  183. u8 chan;
  184. };
  185. /**
  186. * struct p2p_config - P2P configuration
  187. *
  188. * This configuration is provided to the P2P module during initialization with
  189. * p2p_init().
  190. */
  191. struct p2p_config {
  192. /**
  193. * country - Country code to use in P2P operations
  194. */
  195. char country[3];
  196. /**
  197. * reg_class - Regulatory class for own listen channel
  198. */
  199. u8 reg_class;
  200. /**
  201. * channel - Own listen channel
  202. */
  203. u8 channel;
  204. /**
  205. * Regulatory class for own operational channel
  206. */
  207. u8 op_reg_class;
  208. /**
  209. * op_channel - Own operational channel
  210. */
  211. u8 op_channel;
  212. /**
  213. * cfg_op_channel - Whether op_channel is hardcoded in configuration
  214. */
  215. u8 cfg_op_channel;
  216. /**
  217. * channels - Own supported regulatory classes and channels
  218. *
  219. * List of supposerted channels per regulatory class. The regulatory
  220. * classes are defined in IEEE Std 802.11-2007 Annex J and the
  221. * numbering of the clases depends on the configured country code.
  222. */
  223. struct p2p_channels channels;
  224. /**
  225. * num_pref_chan - Number of pref_chan entries
  226. */
  227. unsigned int num_pref_chan;
  228. /**
  229. * pref_chan - Preferred channels for GO Negotiation
  230. */
  231. struct p2p_channel *pref_chan;
  232. /**
  233. * pri_dev_type - Primary Device Type (see WPS)
  234. */
  235. u8 pri_dev_type[8];
  236. /**
  237. * P2P_SEC_DEVICE_TYPES - Maximum number of secondary device types
  238. */
  239. #define P2P_SEC_DEVICE_TYPES 5
  240. /**
  241. * sec_dev_type - Optional secondary device types
  242. */
  243. u8 sec_dev_type[P2P_SEC_DEVICE_TYPES][8];
  244. /**
  245. * num_sec_dev_types - Number of sec_dev_type entries
  246. */
  247. size_t num_sec_dev_types;
  248. /**
  249. * dev_addr - P2P Device Address
  250. */
  251. u8 dev_addr[ETH_ALEN];
  252. /**
  253. * dev_name - Device Name
  254. */
  255. char *dev_name;
  256. char *manufacturer;
  257. char *model_name;
  258. char *model_number;
  259. char *serial_number;
  260. u8 uuid[16];
  261. u16 config_methods;
  262. /**
  263. * concurrent_operations - Whether concurrent operations are supported
  264. */
  265. int concurrent_operations;
  266. /**
  267. * max_peers - Maximum number of discovered peers to remember
  268. *
  269. * If more peers are discovered, older entries will be removed to make
  270. * room for the new ones.
  271. */
  272. size_t max_peers;
  273. /**
  274. * p2p_intra_bss - Intra BSS communication is supported
  275. */
  276. int p2p_intra_bss;
  277. /**
  278. * ssid_postfix - Postfix data to add to the SSID
  279. *
  280. * This data will be added to the end of the SSID after the
  281. * DIRECT-<random two octets> prefix.
  282. */
  283. u8 ssid_postfix[32 - 9];
  284. /**
  285. * ssid_postfix_len - Length of the ssid_postfix data
  286. */
  287. size_t ssid_postfix_len;
  288. /**
  289. * msg_ctx - Context to use with wpa_msg() calls
  290. */
  291. void *msg_ctx;
  292. /**
  293. * cb_ctx - Context to use with callback functions
  294. */
  295. void *cb_ctx;
  296. /* Callbacks to request lower layer driver operations */
  297. /**
  298. * p2p_scan - Request a P2P scan/search
  299. * @ctx: Callback context from cb_ctx
  300. * @type: Scan type
  301. * @freq: Specific frequency (MHz) to scan or 0 for no restriction
  302. * @num_req_dev_types: Number of requested device types
  303. * @req_dev_types: Array containing requested device types
  304. * @dev_id: Device ID to search for or %NULL to find all devices
  305. * @pw_id: Device Password ID
  306. * Returns: 0 on success, -1 on failure
  307. *
  308. * This callback function is used to request a P2P scan or search
  309. * operation to be completed. Type type argument specifies which type
  310. * of scan is to be done. @P2P_SCAN_SOCIAL indicates that only the
  311. * social channels (1, 6, 11) should be scanned. @P2P_SCAN_FULL
  312. * indicates that all channels are to be scanned. @P2P_SCAN_SPECIFIC
  313. * request a scan of a single channel specified by freq.
  314. * @P2P_SCAN_SOCIAL_PLUS_ONE request scan of all the social channels
  315. * plus one extra channel specified by freq.
  316. *
  317. * The full scan is used for the initial scan to find group owners from
  318. * all. The other types are used during search phase scan of the social
  319. * channels (with potential variation if the Listen channel of the
  320. * target peer is known or if other channels are scanned in steps).
  321. *
  322. * The scan results are returned after this call by calling
  323. * p2p_scan_res_handler() for each scan result that has a P2P IE and
  324. * then calling p2p_scan_res_handled() to indicate that all scan
  325. * results have been indicated.
  326. */
  327. int (*p2p_scan)(void *ctx, enum p2p_scan_type type, int freq,
  328. unsigned int num_req_dev_types,
  329. const u8 *req_dev_types, const u8 *dev_id, u16 pw_id);
  330. /**
  331. * send_probe_resp - Transmit a Probe Response frame
  332. * @ctx: Callback context from cb_ctx
  333. * @buf: Probe Response frame (including the header and body)
  334. * Returns: 0 on success, -1 on failure
  335. *
  336. * This function is used to reply to Probe Request frames that were
  337. * indicated with a call to p2p_probe_req_rx(). The response is to be
  338. * sent on the same channel or to be dropped if the driver is not
  339. * anymore listening to Probe Request frames.
  340. *
  341. * Alternatively, the responsibility for building the Probe Response
  342. * frames in Listen state may be in another system component in which
  343. * case this function need to be implemented (i.e., the function
  344. * pointer can be %NULL). The WPS and P2P IEs to be added for Probe
  345. * Response frames in such a case are available from the
  346. * start_listen() callback. It should be noted that the received Probe
  347. * Request frames must be indicated by calling p2p_probe_req_rx() even
  348. * if this send_probe_resp() is not used.
  349. */
  350. int (*send_probe_resp)(void *ctx, const struct wpabuf *buf);
  351. /**
  352. * send_action - Transmit an Action frame
  353. * @ctx: Callback context from cb_ctx
  354. * @freq: Frequency in MHz for the channel on which to transmit
  355. * @dst: Destination MAC address (Address 1)
  356. * @src: Source MAC address (Address 2)
  357. * @bssid: BSSID (Address 3)
  358. * @buf: Frame body (starting from Category field)
  359. * @len: Length of buf in octets
  360. * @wait_time: How many msec to wait for a response frame
  361. * Returns: 0 on success, -1 on failure
  362. *
  363. * The Action frame may not be transmitted immediately and the status
  364. * of the transmission must be reported by calling
  365. * p2p_send_action_cb() once the frame has either been transmitted or
  366. * it has been dropped due to excessive retries or other failure to
  367. * transmit.
  368. */
  369. int (*send_action)(void *ctx, unsigned int freq, const u8 *dst,
  370. const u8 *src, const u8 *bssid, const u8 *buf,
  371. size_t len, unsigned int wait_time);
  372. /**
  373. * send_action_done - Notify that Action frame sequence was completed
  374. * @ctx: Callback context from cb_ctx
  375. *
  376. * This function is called when the Action frame sequence that was
  377. * started with send_action() has been completed, i.e., when there is
  378. * no need to wait for a response from the destination peer anymore.
  379. */
  380. void (*send_action_done)(void *ctx);
  381. /**
  382. * start_listen - Start Listen state
  383. * @ctx: Callback context from cb_ctx
  384. * @freq: Frequency of the listen channel in MHz
  385. * @duration: Duration for the Listen state in milliseconds
  386. * @probe_resp_ie: IE(s) to be added to Probe Response frames
  387. * Returns: 0 on success, -1 on failure
  388. *
  389. * This Listen state may not start immediately since the driver may
  390. * have other pending operations to complete first. Once the Listen
  391. * state has started, p2p_listen_cb() must be called to notify the P2P
  392. * module. Once the Listen state is stopped, p2p_listen_end() must be
  393. * called to notify the P2P module that the driver is not in the Listen
  394. * state anymore.
  395. *
  396. * If the send_probe_resp() is not used for generating the response,
  397. * the IEs from probe_resp_ie need to be added to the end of the Probe
  398. * Response frame body. If send_probe_resp() is used, the probe_resp_ie
  399. * information can be ignored.
  400. */
  401. int (*start_listen)(void *ctx, unsigned int freq,
  402. unsigned int duration,
  403. const struct wpabuf *probe_resp_ie);
  404. /**
  405. * stop_listen - Stop Listen state
  406. * @ctx: Callback context from cb_ctx
  407. *
  408. * This callback can be used to stop a Listen state operation that was
  409. * previously requested with start_listen().
  410. */
  411. void (*stop_listen)(void *ctx);
  412. /**
  413. * get_noa - Get current Notice of Absence attribute payload
  414. * @ctx: Callback context from cb_ctx
  415. * @interface_addr: P2P Interface Address of the GO
  416. * @buf: Buffer for returning NoA
  417. * @buf_len: Buffer length in octets
  418. * Returns: Number of octets used in buf, 0 to indicate no NoA is being
  419. * advertized, or -1 on failure
  420. *
  421. * This function is used to fetch the current Notice of Absence
  422. * attribute value from GO.
  423. */
  424. int (*get_noa)(void *ctx, const u8 *interface_addr, u8 *buf,
  425. size_t buf_len);
  426. /* Callbacks to notify events to upper layer management entity */
  427. /**
  428. * dev_found - Notification of a found P2P Device
  429. * @ctx: Callback context from cb_ctx
  430. * @addr: Source address of the message triggering this notification
  431. * @info: P2P peer information
  432. * @new_device: Inform if the peer is newly found
  433. *
  434. * This callback is used to notify that a new P2P Device has been
  435. * found. This may happen, e.g., during Search state based on scan
  436. * results or during Listen state based on receive Probe Request and
  437. * Group Owner Negotiation Request.
  438. */
  439. void (*dev_found)(void *ctx, const u8 *addr,
  440. const struct p2p_peer_info *info,
  441. int new_device);
  442. /**
  443. * dev_lost - Notification of a lost P2P Device
  444. * @ctx: Callback context from cb_ctx
  445. * @dev_addr: P2P Device Address of the lost P2P Device
  446. *
  447. * This callback is used to notify that a P2P Device has been deleted.
  448. */
  449. void (*dev_lost)(void *ctx, const u8 *dev_addr);
  450. /**
  451. * go_neg_req_rx - Notification of a receive GO Negotiation Request
  452. * @ctx: Callback context from cb_ctx
  453. * @src: Source address of the message triggering this notification
  454. * @dev_passwd_id: WPS Device Password ID
  455. *
  456. * This callback is used to notify that a P2P Device is requesting
  457. * group owner negotiation with us, but we do not have all the
  458. * necessary information to start GO Negotiation. This indicates that
  459. * the local user has not authorized the connection yet by providing a
  460. * PIN or PBC button press. This information can be provided with a
  461. * call to p2p_connect().
  462. */
  463. void (*go_neg_req_rx)(void *ctx, const u8 *src, u16 dev_passwd_id);
  464. /**
  465. * go_neg_completed - Notification of GO Negotiation results
  466. * @ctx: Callback context from cb_ctx
  467. * @res: GO Negotiation results
  468. *
  469. * This callback is used to notify that Group Owner Negotiation has
  470. * been completed. Non-zero struct p2p_go_neg_results::status indicates
  471. * failed negotiation. In case of success, this function is responsible
  472. * for creating a new group interface (or using the existing interface
  473. * depending on driver features), setting up the group interface in
  474. * proper mode based on struct p2p_go_neg_results::role_go and
  475. * initializing WPS provisioning either as a Registrar (if GO) or as an
  476. * Enrollee. Successful WPS provisioning must be indicated by calling
  477. * p2p_wps_success_cb(). The callee is responsible for timing out group
  478. * formation if WPS provisioning cannot be completed successfully
  479. * within 15 seconds.
  480. */
  481. void (*go_neg_completed)(void *ctx, struct p2p_go_neg_results *res);
  482. /**
  483. * sd_request - Callback on Service Discovery Request
  484. * @ctx: Callback context from cb_ctx
  485. * @freq: Frequency (in MHz) of the channel
  486. * @sa: Source address of the request
  487. * @dialog_token: Dialog token
  488. * @update_indic: Service Update Indicator from the source of request
  489. * @tlvs: P2P Service Request TLV(s)
  490. * @tlvs_len: Length of tlvs buffer in octets
  491. *
  492. * This callback is used to indicate reception of a service discovery
  493. * request. Response to the query must be indicated by calling
  494. * p2p_sd_response() with the context information from the arguments to
  495. * this callback function.
  496. *
  497. * This callback handler can be set to %NULL to indicate that service
  498. * discovery is not supported.
  499. */
  500. void (*sd_request)(void *ctx, int freq, const u8 *sa, u8 dialog_token,
  501. u16 update_indic, const u8 *tlvs, size_t tlvs_len);
  502. /**
  503. * sd_response - Callback on Service Discovery Response
  504. * @ctx: Callback context from cb_ctx
  505. * @sa: Source address of the request
  506. * @update_indic: Service Update Indicator from the source of response
  507. * @tlvs: P2P Service Response TLV(s)
  508. * @tlvs_len: Length of tlvs buffer in octets
  509. *
  510. * This callback is used to indicate reception of a service discovery
  511. * response. This callback handler can be set to %NULL if no service
  512. * discovery requests are used. The information provided with this call
  513. * is replies to the queries scheduled with p2p_sd_request().
  514. */
  515. void (*sd_response)(void *ctx, const u8 *sa, u16 update_indic,
  516. const u8 *tlvs, size_t tlvs_len);
  517. /**
  518. * prov_disc_req - Callback on Provisiong Discovery Request
  519. * @ctx: Callback context from cb_ctx
  520. * @peer: Source address of the request
  521. * @config_methods: Requested WPS Config Method
  522. * @dev_addr: P2P Device Address of the found P2P Device
  523. * @pri_dev_type: Primary Device Type
  524. * @dev_name: Device Name
  525. * @supp_config_methods: Supported configuration Methods
  526. * @dev_capab: Device Capabilities
  527. * @group_capab: Group Capabilities
  528. * @group_id: P2P Group ID (or %NULL if not included)
  529. * @group_id_len: Length of P2P Group ID
  530. *
  531. * This callback is used to indicate reception of a Provision Discovery
  532. * Request frame that the P2P module accepted.
  533. */
  534. void (*prov_disc_req)(void *ctx, const u8 *peer, u16 config_methods,
  535. const u8 *dev_addr, const u8 *pri_dev_type,
  536. const char *dev_name, u16 supp_config_methods,
  537. u8 dev_capab, u8 group_capab,
  538. const u8 *group_id, size_t group_id_len);
  539. /**
  540. * prov_disc_resp - Callback on Provisiong Discovery Response
  541. * @ctx: Callback context from cb_ctx
  542. * @peer: Source address of the response
  543. * @config_methods: Value from p2p_prov_disc_req() or 0 on failure
  544. *
  545. * This callback is used to indicate reception of a Provision Discovery
  546. * Response frame for a pending request scheduled with
  547. * p2p_prov_disc_req(). This callback handler can be set to %NULL if
  548. * provision discovery is not used.
  549. */
  550. void (*prov_disc_resp)(void *ctx, const u8 *peer, u16 config_methods);
  551. /**
  552. * prov_disc_fail - Callback on Provision Discovery failure
  553. * @ctx: Callback context from cb_ctx
  554. * @peer: Source address of the response
  555. * @status: Cause of failure, will not be %P2P_PROV_DISC_SUCCESS
  556. *
  557. * This callback is used to indicate either a failure or no response
  558. * to an earlier provision discovery request.
  559. *
  560. * This callback handler can be set to %NULL if provision discovery
  561. * is not used or failures do not need to be indicated.
  562. */
  563. void (*prov_disc_fail)(void *ctx, const u8 *peer,
  564. enum p2p_prov_disc_status status);
  565. /**
  566. * invitation_process - Optional callback for processing Invitations
  567. * @ctx: Callback context from cb_ctx
  568. * @sa: Source address of the Invitation Request
  569. * @bssid: P2P Group BSSID from the request or %NULL if not included
  570. * @go_dev_addr: GO Device Address from P2P Group ID
  571. * @ssid: SSID from P2P Group ID
  572. * @ssid_len: Length of ssid buffer in octets
  573. * @go: Variable for returning whether the local end is GO in the group
  574. * @group_bssid: Buffer for returning P2P Group BSSID (if local end GO)
  575. * @force_freq: Variable for returning forced frequency for the group
  576. * @persistent_group: Whether this is an invitation to reinvoke a
  577. * persistent group (instead of invitation to join an active
  578. * group)
  579. * Returns: Status code (P2P_SC_*)
  580. *
  581. * This optional callback can be used to implement persistent reconnect
  582. * by allowing automatic restarting of persistent groups without user
  583. * interaction. If this callback is not implemented (i.e., is %NULL),
  584. * the received Invitation Request frames are replied with
  585. * %P2P_SC_REQ_RECEIVED status and indicated to upper layer with the
  586. * invitation_result() callback.
  587. *
  588. * If the requested parameters are acceptable and the group is known,
  589. * %P2P_SC_SUCCESS may be returned. If the requested group is unknown,
  590. * %P2P_SC_FAIL_UNKNOWN_GROUP should be returned. %P2P_SC_REQ_RECEIVED
  591. * can be returned if there is not enough data to provide immediate
  592. * response, i.e., if some sort of user interaction is needed. The
  593. * invitation_received() callback will be called in that case
  594. * immediately after this call.
  595. */
  596. u8 (*invitation_process)(void *ctx, const u8 *sa, const u8 *bssid,
  597. const u8 *go_dev_addr, const u8 *ssid,
  598. size_t ssid_len, int *go, u8 *group_bssid,
  599. int *force_freq, int persistent_group);
  600. /**
  601. * invitation_received - Callback on Invitation Request RX
  602. * @ctx: Callback context from cb_ctx
  603. * @sa: Source address of the Invitation Request
  604. * @bssid: P2P Group BSSID or %NULL if not received
  605. * @ssid: SSID of the group
  606. * @ssid_len: Length of ssid in octets
  607. * @go_dev_addr: GO Device Address
  608. * @status: Response Status
  609. * @op_freq: Operational frequency for the group
  610. *
  611. * This callback is used to indicate sending of an Invitation Response
  612. * for a received Invitation Request. If status == 0 (success), the
  613. * upper layer code is responsible for starting the group. status == 1
  614. * indicates need to get user authorization for the group. Other status
  615. * values indicate that the invitation request was rejected.
  616. */
  617. void (*invitation_received)(void *ctx, const u8 *sa, const u8 *bssid,
  618. const u8 *ssid, size_t ssid_len,
  619. const u8 *go_dev_addr, u8 status,
  620. int op_freq);
  621. /**
  622. * invitation_result - Callback on Invitation result
  623. * @ctx: Callback context from cb_ctx
  624. * @status: Negotiation result (Status Code)
  625. * @bssid: P2P Group BSSID or %NULL if not received
  626. *
  627. * This callback is used to indicate result of an Invitation procedure
  628. * started with a call to p2p_invite(). The indicated status code is
  629. * the value received from the peer in Invitation Response with 0
  630. * (P2P_SC_SUCCESS) indicating success or -1 to indicate a timeout or a
  631. * local failure in transmitting the Invitation Request.
  632. */
  633. void (*invitation_result)(void *ctx, int status, const u8 *bssid);
  634. /**
  635. * go_connected - Check whether we are connected to a GO
  636. * @ctx: Callback context from cb_ctx
  637. * @dev_addr: P2P Device Address of a GO
  638. * Returns: 1 if we are connected as a P2P client to the specified GO
  639. * or 0 if not.
  640. */
  641. int (*go_connected)(void *ctx, const u8 *dev_addr);
  642. };
  643. /* P2P module initialization/deinitialization */
  644. /**
  645. * p2p_init - Initialize P2P module
  646. * @cfg: P2P module configuration
  647. * Returns: Pointer to private data or %NULL on failure
  648. *
  649. * This function is used to initialize global P2P module context (one per
  650. * device). The P2P module will keep a copy of the configuration data, so the
  651. * caller does not need to maintain this structure. However, the callback
  652. * functions and the context parameters to them must be kept available until
  653. * the P2P module is deinitialized with p2p_deinit().
  654. */
  655. struct p2p_data * p2p_init(const struct p2p_config *cfg);
  656. /**
  657. * p2p_deinit - Deinitialize P2P module
  658. * @p2p: P2P module context from p2p_init()
  659. */
  660. void p2p_deinit(struct p2p_data *p2p);
  661. /**
  662. * p2p_flush - Flush P2P module state
  663. * @p2p: P2P module context from p2p_init()
  664. *
  665. * This command removes the P2P module state like peer device entries.
  666. */
  667. void p2p_flush(struct p2p_data *p2p);
  668. /**
  669. * p2p_unauthorize - Unauthorize the specified peer device
  670. * @p2p: P2P module context from p2p_init()
  671. * @addr: P2P peer entry to be unauthorized
  672. * Returns: 0 on success, -1 on failure
  673. *
  674. * This command removes any connection authorization from the specified P2P
  675. * peer device address. This can be used, e.g., to cancel effect of a previous
  676. * p2p_authorize() or p2p_connect() call that has not yet resulted in completed
  677. * GO Negotiation.
  678. */
  679. int p2p_unauthorize(struct p2p_data *p2p, const u8 *addr);
  680. /**
  681. * p2p_set_dev_name - Set device name
  682. * @p2p: P2P module context from p2p_init()
  683. * Returns: 0 on success, -1 on failure
  684. *
  685. * This function can be used to update the P2P module configuration with
  686. * information that was not available at the time of the p2p_init() call.
  687. */
  688. int p2p_set_dev_name(struct p2p_data *p2p, const char *dev_name);
  689. int p2p_set_manufacturer(struct p2p_data *p2p, const char *manufacturer);
  690. int p2p_set_model_name(struct p2p_data *p2p, const char *model_name);
  691. int p2p_set_model_number(struct p2p_data *p2p, const char *model_number);
  692. int p2p_set_serial_number(struct p2p_data *p2p, const char *serial_number);
  693. void p2p_set_config_methods(struct p2p_data *p2p, u16 config_methods);
  694. void p2p_set_uuid(struct p2p_data *p2p, const u8 *uuid);
  695. /**
  696. * p2p_set_pri_dev_type - Set primary device type
  697. * @p2p: P2P module context from p2p_init()
  698. * Returns: 0 on success, -1 on failure
  699. *
  700. * This function can be used to update the P2P module configuration with
  701. * information that was not available at the time of the p2p_init() call.
  702. */
  703. int p2p_set_pri_dev_type(struct p2p_data *p2p, const u8 *pri_dev_type);
  704. /**
  705. * p2p_set_sec_dev_types - Set secondary device types
  706. * @p2p: P2P module context from p2p_init()
  707. * Returns: 0 on success, -1 on failure
  708. *
  709. * This function can be used to update the P2P module configuration with
  710. * information that was not available at the time of the p2p_init() call.
  711. */
  712. int p2p_set_sec_dev_types(struct p2p_data *p2p, const u8 dev_types[][8],
  713. size_t num_dev_types);
  714. int p2p_set_country(struct p2p_data *p2p, const char *country);
  715. /* Commands from upper layer management entity */
  716. enum p2p_discovery_type {
  717. P2P_FIND_START_WITH_FULL,
  718. P2P_FIND_ONLY_SOCIAL,
  719. P2P_FIND_PROGRESSIVE
  720. };
  721. /**
  722. * p2p_find - Start P2P Find (Device Discovery)
  723. * @p2p: P2P module context from p2p_init()
  724. * @timeout: Timeout for find operation in seconds or 0 for no timeout
  725. * @type: Device Discovery type
  726. * @num_req_dev_types: Number of requested device types
  727. * @req_dev_types: Requested device types array, must be an array
  728. * containing num_req_dev_types * WPS_DEV_TYPE_LEN bytes; %NULL if no
  729. * requested device types.
  730. * @dev_id: Device ID to search for or %NULL to find all devices
  731. * Returns: 0 on success, -1 on failure
  732. */
  733. int p2p_find(struct p2p_data *p2p, unsigned int timeout,
  734. enum p2p_discovery_type type,
  735. unsigned int num_req_dev_types, const u8 *req_dev_types,
  736. const u8 *dev_id);
  737. /**
  738. * p2p_stop_find - Stop P2P Find (Device Discovery)
  739. * @p2p: P2P module context from p2p_init()
  740. */
  741. void p2p_stop_find(struct p2p_data *p2p);
  742. /**
  743. * p2p_stop_find_for_freq - Stop P2P Find for next oper on specific freq
  744. * @p2p: P2P module context from p2p_init()
  745. * @freq: Frequency in MHz for next operation
  746. *
  747. * This is like p2p_stop_find(), but Listen state is not stopped if we are
  748. * already on the same frequency.
  749. */
  750. void p2p_stop_find_for_freq(struct p2p_data *p2p, int freq);
  751. /**
  752. * p2p_listen - Start P2P Listen state for specified duration
  753. * @p2p: P2P module context from p2p_init()
  754. * @timeout: Listen state duration in milliseconds
  755. * Returns: 0 on success, -1 on failure
  756. *
  757. * This function can be used to request the P2P module to keep the device
  758. * discoverable on the listen channel for an extended set of time. At least in
  759. * its current form, this is mainly used for testing purposes and may not be of
  760. * much use for normal P2P operations.
  761. */
  762. int p2p_listen(struct p2p_data *p2p, unsigned int timeout);
  763. /**
  764. * p2p_connect - Start P2P group formation (GO negotiation)
  765. * @p2p: P2P module context from p2p_init()
  766. * @peer_addr: MAC address of the peer P2P client
  767. * @wps_method: WPS method to be used in provisioning
  768. * @go_intent: Local GO intent value (1..15)
  769. * @own_interface_addr: Intended interface address to use with the group
  770. * @force_freq: The only allowed channel frequency in MHz or 0
  771. * @persistent_group: Whether to create a persistent group (0 = no, 1 =
  772. * persistent group without persistent reconnect, 2 = persistent group with
  773. * persistent reconnect)
  774. * @force_ssid: Forced SSID for the group if we become GO or %NULL to generate
  775. * a new SSID
  776. * @force_ssid_len: Length of $force_ssid buffer
  777. * @pd_before_go_neg: Whether to send Provision Discovery prior to GO
  778. * Negotiation as an interoperability workaround when initiating group
  779. * formation
  780. * Returns: 0 on success, -1 on failure
  781. */
  782. int p2p_connect(struct p2p_data *p2p, const u8 *peer_addr,
  783. enum p2p_wps_method wps_method,
  784. int go_intent, const u8 *own_interface_addr,
  785. unsigned int force_freq, int persistent_group,
  786. const u8 *force_ssid, size_t force_ssid_len,
  787. int pd_before_go_neg);
  788. /**
  789. * p2p_authorize - Authorize P2P group formation (GO negotiation)
  790. * @p2p: P2P module context from p2p_init()
  791. * @peer_addr: MAC address of the peer P2P client
  792. * @wps_method: WPS method to be used in provisioning
  793. * @go_intent: Local GO intent value (1..15)
  794. * @own_interface_addr: Intended interface address to use with the group
  795. * @force_freq: The only allowed channel frequency in MHz or 0
  796. * @persistent_group: Whether to create a persistent group (0 = no, 1 =
  797. * persistent group without persistent reconnect, 2 = persistent group with
  798. * persistent reconnect)
  799. * @force_ssid: Forced SSID for the group if we become GO or %NULL to generate
  800. * a new SSID
  801. * @force_ssid_len: Length of $force_ssid buffer
  802. * Returns: 0 on success, -1 on failure
  803. *
  804. * This is like p2p_connect(), but the actual group negotiation is not
  805. * initiated automatically, i.e., the other end is expected to do that.
  806. */
  807. int p2p_authorize(struct p2p_data *p2p, const u8 *peer_addr,
  808. enum p2p_wps_method wps_method,
  809. int go_intent, const u8 *own_interface_addr,
  810. unsigned int force_freq, int persistent_group,
  811. const u8 *force_ssid, size_t force_ssid_len);
  812. /**
  813. * p2p_reject - Reject peer device (explicitly block connection attempts)
  814. * @p2p: P2P module context from p2p_init()
  815. * @peer_addr: MAC address of the peer P2P client
  816. * Returns: 0 on success, -1 on failure
  817. */
  818. int p2p_reject(struct p2p_data *p2p, const u8 *peer_addr);
  819. /**
  820. * p2p_prov_disc_req - Send Provision Discovery Request
  821. * @p2p: P2P module context from p2p_init()
  822. * @peer_addr: MAC address of the peer P2P client
  823. * @config_methods: WPS Config Methods value (only one bit set)
  824. * @join: Whether this is used by a client joining an active group
  825. * @force_freq: Forced TX frequency for the frame (mainly for the join case)
  826. * Returns: 0 on success, -1 on failure
  827. *
  828. * This function can be used to request a discovered P2P peer to display a PIN
  829. * (config_methods = WPS_CONFIG_DISPLAY) or be prepared to enter a PIN from us
  830. * (config_methods = WPS_CONFIG_KEYPAD). The Provision Discovery Request frame
  831. * is transmitted once immediately and if no response is received, the frame
  832. * will be sent again whenever the target device is discovered during device
  833. * dsicovery (start with a p2p_find() call). Response from the peer is
  834. * indicated with the p2p_config::prov_disc_resp() callback.
  835. */
  836. int p2p_prov_disc_req(struct p2p_data *p2p, const u8 *peer_addr,
  837. u16 config_methods, int join, int force_freq);
  838. /**
  839. * p2p_sd_request - Schedule a service discovery query
  840. * @p2p: P2P module context from p2p_init()
  841. * @dst: Destination peer or %NULL to apply for all peers
  842. * @tlvs: P2P Service Query TLV(s)
  843. * Returns: Reference to the query or %NULL on failure
  844. *
  845. * Response to the query is indicated with the p2p_config::sd_response()
  846. * callback.
  847. */
  848. void * p2p_sd_request(struct p2p_data *p2p, const u8 *dst,
  849. const struct wpabuf *tlvs);
  850. /**
  851. * p2p_sd_cancel_request - Cancel a pending service discovery query
  852. * @p2p: P2P module context from p2p_init()
  853. * @req: Query reference from p2p_sd_request()
  854. * Returns: 0 if request for cancelled; -1 if not found
  855. */
  856. int p2p_sd_cancel_request(struct p2p_data *p2p, void *req);
  857. /**
  858. * p2p_sd_response - Send response to a service discovery query
  859. * @p2p: P2P module context from p2p_init()
  860. * @freq: Frequency from p2p_config::sd_request() callback
  861. * @dst: Destination address from p2p_config::sd_request() callback
  862. * @dialog_token: Dialog token from p2p_config::sd_request() callback
  863. * @resp_tlvs: P2P Service Response TLV(s)
  864. *
  865. * This function is called as a response to the request indicated with
  866. * p2p_config::sd_request() callback.
  867. */
  868. void p2p_sd_response(struct p2p_data *p2p, int freq, const u8 *dst,
  869. u8 dialog_token, const struct wpabuf *resp_tlvs);
  870. /**
  871. * p2p_sd_service_update - Indicate a change in local services
  872. * @p2p: P2P module context from p2p_init()
  873. *
  874. * This function needs to be called whenever there is a change in availability
  875. * of the local services. This will increment the Service Update Indicator
  876. * value which will be used in SD Request and Response frames.
  877. */
  878. void p2p_sd_service_update(struct p2p_data *p2p);
  879. enum p2p_invite_role {
  880. P2P_INVITE_ROLE_GO,
  881. P2P_INVITE_ROLE_ACTIVE_GO,
  882. P2P_INVITE_ROLE_CLIENT
  883. };
  884. /**
  885. * p2p_invite - Invite a P2P Device into a group
  886. * @p2p: P2P module context from p2p_init()
  887. * @peer: Device Address of the peer P2P Device
  888. * @role: Local role in the group
  889. * @bssid: Group BSSID or %NULL if not known
  890. * @ssid: Group SSID
  891. * @ssid_len: Length of ssid in octets
  892. * @force_freq: The only allowed channel frequency in MHz or 0
  893. * @go_dev_addr: Forced GO Device Address or %NULL if none
  894. * @persistent_group: Whether this is to reinvoke a persistent group
  895. * Returns: 0 on success, -1 on failure
  896. */
  897. int p2p_invite(struct p2p_data *p2p, const u8 *peer, enum p2p_invite_role role,
  898. const u8 *bssid, const u8 *ssid, size_t ssid_len,
  899. unsigned int force_freq, const u8 *go_dev_addr,
  900. int persistent_group);
  901. /**
  902. * p2p_presence_req - Request GO presence
  903. * @p2p: P2P module context from p2p_init()
  904. * @go_interface_addr: GO P2P Interface Address
  905. * @own_interface_addr: Own P2P Interface Address for this group
  906. * @freq: Group operating frequence (in MHz)
  907. * @duration1: Preferred presence duration in microseconds
  908. * @interval1: Preferred presence interval in microseconds
  909. * @duration2: Acceptable presence duration in microseconds
  910. * @interval2: Acceptable presence interval in microseconds
  911. * Returns: 0 on success, -1 on failure
  912. *
  913. * If both duration and interval values are zero, the parameter pair is not
  914. * specified (i.e., to remove Presence Request, use duration1 = interval1 = 0).
  915. */
  916. int p2p_presence_req(struct p2p_data *p2p, const u8 *go_interface_addr,
  917. const u8 *own_interface_addr, unsigned int freq,
  918. u32 duration1, u32 interval1, u32 duration2,
  919. u32 interval2);
  920. /**
  921. * p2p_ext_listen - Set Extended Listen Timing
  922. * @p2p: P2P module context from p2p_init()
  923. * @freq: Group operating frequence (in MHz)
  924. * @period: Availability period in milliseconds (1-65535; 0 to disable)
  925. * @interval: Availability interval in milliseconds (1-65535; 0 to disable)
  926. * Returns: 0 on success, -1 on failure
  927. *
  928. * This function can be used to enable or disable (period = interval = 0)
  929. * Extended Listen Timing. When enabled, the P2P Device will become
  930. * discoverable (go into Listen State) every @interval milliseconds for at
  931. * least @period milliseconds.
  932. */
  933. int p2p_ext_listen(struct p2p_data *p2p, unsigned int period,
  934. unsigned int interval);
  935. /* Event notifications from upper layer management operations */
  936. /**
  937. * p2p_wps_success_cb - Report successfully completed WPS provisioning
  938. * @p2p: P2P module context from p2p_init()
  939. * @mac_addr: Peer address
  940. *
  941. * This function is used to report successfully completed WPS provisioning
  942. * during group formation in both GO/Registrar and client/Enrollee roles.
  943. */
  944. void p2p_wps_success_cb(struct p2p_data *p2p, const u8 *mac_addr);
  945. /**
  946. * p2p_group_formation_failed - Report failed WPS provisioning
  947. * @p2p: P2P module context from p2p_init()
  948. *
  949. * This function is used to report failed group formation. This can happen
  950. * either due to failed WPS provisioning or due to 15 second timeout during
  951. * the provisioning phase.
  952. */
  953. void p2p_group_formation_failed(struct p2p_data *p2p);
  954. /**
  955. * p2p_get_provisioning_info - Get any stored provisioning info
  956. * @p2p: P2P module context from p2p_init()
  957. * @addr: Peer P2P Device Address
  958. * Returns: WPS provisioning information (WPS config method) or 0 if no
  959. * information is available
  960. *
  961. * This function is used to retrieve stored WPS provisioning info for the given
  962. * peer.
  963. */
  964. u16 p2p_get_provisioning_info(struct p2p_data *p2p, const u8 *addr);
  965. /**
  966. * p2p_clear_provisioning_info - Clear any stored provisioning info
  967. * @p2p: P2P module context from p2p_init()
  968. * @iface_addr: Peer P2P Device Address
  969. *
  970. * This function is used to clear stored WPS provisioning info for the given
  971. * peer.
  972. */
  973. void p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *addr);
  974. /* Event notifications from lower layer driver operations */
  975. /**
  976. * enum p2p_probe_req_status
  977. *
  978. * @P2P_PREQ_MALFORMED: frame was not well-formed
  979. * @P2P_PREQ_NOT_LISTEN: device isn't in listen state, frame ignored
  980. * @P2P_PREQ_NOT_P2P: frame was not a P2P probe request
  981. * @P2P_PREQ_P2P_NOT_PROCESSED: frame was P2P but wasn't processed
  982. * @P2P_PREQ_P2P_PROCESSED: frame has been processed by P2P
  983. */
  984. enum p2p_probe_req_status {
  985. P2P_PREQ_MALFORMED,
  986. P2P_PREQ_NOT_LISTEN,
  987. P2P_PREQ_NOT_P2P,
  988. P2P_PREQ_NOT_PROCESSED,
  989. P2P_PREQ_PROCESSED
  990. };
  991. /**
  992. * p2p_probe_req_rx - Report reception of a Probe Request frame
  993. * @p2p: P2P module context from p2p_init()
  994. * @addr: Source MAC address
  995. * @dst: Destination MAC address if available or %NULL
  996. * @bssid: BSSID if available or %NULL
  997. * @ie: Information elements from the Probe Request frame body
  998. * @ie_len: Length of ie buffer in octets
  999. * Returns: value indicating the type and status of the probe request
  1000. */
  1001. enum p2p_probe_req_status
  1002. p2p_probe_req_rx(struct p2p_data *p2p, const u8 *addr, const u8 *dst,
  1003. const u8 *bssid, const u8 *ie, size_t ie_len);
  1004. /**
  1005. * p2p_rx_action - Report received Action frame
  1006. * @p2p: P2P module context from p2p_init()
  1007. * @da: Destination address of the received Action frame
  1008. * @sa: Source address of the received Action frame
  1009. * @bssid: Address 3 of the received Action frame
  1010. * @category: Category of the received Action frame
  1011. * @data: Action frame body after the Category field
  1012. * @len: Length of the data buffer in octets
  1013. * @freq: Frequency (in MHz) on which the frame was received
  1014. */
  1015. void p2p_rx_action(struct p2p_data *p2p, const u8 *da, const u8 *sa,
  1016. const u8 *bssid, u8 category,
  1017. const u8 *data, size_t len, int freq);
  1018. /**
  1019. * p2p_scan_res_handler - Indicate a P2P scan results
  1020. * @p2p: P2P module context from p2p_init()
  1021. * @bssid: BSSID of the scan result
  1022. * @freq: Frequency of the channel on which the device was found in MHz
  1023. * @level: Signal level (signal strength of the received Beacon/Probe Response
  1024. * frame)
  1025. * @ies: Pointer to IEs from the scan result
  1026. * @ies_len: Length of the ies buffer
  1027. * Returns: 0 to continue or 1 to stop scan result indication
  1028. *
  1029. * This function is called to indicate a scan result entry with P2P IE from a
  1030. * scan requested with struct p2p_config::p2p_scan(). This can be called during
  1031. * the actual scan process (i.e., whenever a new device is found) or as a
  1032. * sequence of calls after the full scan has been completed. The former option
  1033. * can result in optimized operations, but may not be supported by all
  1034. * driver/firmware designs. The ies buffer need to include at least the P2P IE,
  1035. * but it is recommended to include all IEs received from the device. The
  1036. * caller does not need to check that the IEs contain a P2P IE before calling
  1037. * this function since frames will be filtered internally if needed.
  1038. *
  1039. * This function will return 1 if it wants to stop scan result iteration (and
  1040. * scan in general if it is still in progress). This is used to allow faster
  1041. * start of a pending operation, e.g., to start a pending GO negotiation.
  1042. */
  1043. int p2p_scan_res_handler(struct p2p_data *p2p, const u8 *bssid, int freq,
  1044. int level, const u8 *ies, size_t ies_len);
  1045. /**
  1046. * p2p_scan_res_handled - Indicate end of scan results
  1047. * @p2p: P2P module context from p2p_init()
  1048. *
  1049. * This function is called to indicate that all P2P scan results from a scan
  1050. * have been reported with zero or more calls to p2p_scan_res_handler(). This
  1051. * function must be called as a response to successful
  1052. * struct p2p_config::p2p_scan() call if none of the p2p_scan_res_handler()
  1053. * calls stopped iteration.
  1054. */
  1055. void p2p_scan_res_handled(struct p2p_data *p2p);
  1056. enum p2p_send_action_result {
  1057. P2P_SEND_ACTION_SUCCESS /* Frame was send and acknowledged */,
  1058. P2P_SEND_ACTION_NO_ACK /* Frame was sent, but not acknowledged */,
  1059. P2P_SEND_ACTION_FAILED /* Frame was not sent due to a failure */
  1060. };
  1061. /**
  1062. * p2p_send_action_cb - Notify TX status of an Action frame
  1063. * @p2p: P2P module context from p2p_init()
  1064. * @freq: Channel frequency in MHz
  1065. * @dst: Destination MAC address (Address 1)
  1066. * @src: Source MAC address (Address 2)
  1067. * @bssid: BSSID (Address 3)
  1068. * @result: Result of the transmission attempt
  1069. *
  1070. * This function is used to indicate the result of an Action frame transmission
  1071. * that was requested with struct p2p_config::send_action() callback.
  1072. */
  1073. void p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
  1074. const u8 *src, const u8 *bssid,
  1075. enum p2p_send_action_result result);
  1076. /**
  1077. * p2p_listen_cb - Indicate the start of a requested Listen state
  1078. * @p2p: P2P module context from p2p_init()
  1079. * @freq: Listen channel frequency in MHz
  1080. * @duration: Duration for the Listen state in milliseconds
  1081. *
  1082. * This function is used to indicate that a Listen state requested with
  1083. * struct p2p_config::start_listen() callback has started.
  1084. */
  1085. void p2p_listen_cb(struct p2p_data *p2p, unsigned int freq,
  1086. unsigned int duration);
  1087. /**
  1088. * p2p_listen_end - Indicate the end of a requested Listen state
  1089. * @p2p: P2P module context from p2p_init()
  1090. * @freq: Listen channel frequency in MHz
  1091. * Returns: 0 if no operations were started, 1 if an operation was started
  1092. *
  1093. * This function is used to indicate that a Listen state requested with
  1094. * struct p2p_config::start_listen() callback has ended.
  1095. */
  1096. int p2p_listen_end(struct p2p_data *p2p, unsigned int freq);
  1097. void p2p_deauth_notif(struct p2p_data *p2p, const u8 *bssid, u16 reason_code,
  1098. const u8 *ie, size_t ie_len);
  1099. void p2p_disassoc_notif(struct p2p_data *p2p, const u8 *bssid, u16 reason_code,
  1100. const u8 *ie, size_t ie_len);
  1101. /* Per-group P2P state for GO */
  1102. struct p2p_group;
  1103. /**
  1104. * struct p2p_group_config - P2P group configuration
  1105. *
  1106. * This configuration is provided to the P2P module during initialization of
  1107. * the per-group information with p2p_group_init().
  1108. */
  1109. struct p2p_group_config {
  1110. /**
  1111. * persistent_group - Whether the group is persistent
  1112. * 0 = not a persistent group
  1113. * 1 = persistent group without persistent reconnect
  1114. * 2 = persistent group with persistent reconnect
  1115. */
  1116. int persistent_group;
  1117. /**
  1118. * interface_addr - P2P Interface Address of the group
  1119. */
  1120. u8 interface_addr[ETH_ALEN];
  1121. /**
  1122. * max_clients - Maximum number of clients in the group
  1123. */
  1124. unsigned int max_clients;
  1125. /**
  1126. * ssid - Group SSID
  1127. */
  1128. u8 ssid[32];
  1129. /**
  1130. * ssid_len - Length of SSID
  1131. */
  1132. size_t ssid_len;
  1133. /**
  1134. * cb_ctx - Context to use with callback functions
  1135. */
  1136. void *cb_ctx;
  1137. /**
  1138. * ie_update - Notification of IE update
  1139. * @ctx: Callback context from cb_ctx
  1140. * @beacon_ies: P2P IE for Beacon frames or %NULL if no change
  1141. * @proberesp_ies: P2P Ie for Probe Response frames
  1142. *
  1143. * P2P module uses this callback function to notify whenever the P2P IE
  1144. * in Beacon or Probe Response frames should be updated based on group
  1145. * events.
  1146. *
  1147. * The callee is responsible for freeing the returned buffer(s) with
  1148. * wpabuf_free().
  1149. */
  1150. void (*ie_update)(void *ctx, struct wpabuf *beacon_ies,
  1151. struct wpabuf *proberesp_ies);
  1152. /**
  1153. * idle_update - Notification of changes in group idle state
  1154. * @ctx: Callback context from cb_ctx
  1155. * @idle: Whether the group is idle (no associated stations)
  1156. */
  1157. void (*idle_update)(void *ctx, int idle);
  1158. };
  1159. /**
  1160. * p2p_group_init - Initialize P2P group
  1161. * @p2p: P2P module context from p2p_init()
  1162. * @config: P2P group configuration (will be freed by p2p_group_deinit())
  1163. * Returns: Pointer to private data or %NULL on failure
  1164. *
  1165. * This function is used to initialize per-group P2P module context. Currently,
  1166. * this is only used to manage GO functionality and P2P clients do not need to
  1167. * create an instance of this per-group information.
  1168. */
  1169. struct p2p_group * p2p_group_init(struct p2p_data *p2p,
  1170. struct p2p_group_config *config);
  1171. /**
  1172. * p2p_group_deinit - Deinitialize P2P group
  1173. * @group: P2P group context from p2p_group_init()
  1174. */
  1175. void p2p_group_deinit(struct p2p_group *group);
  1176. /**
  1177. * p2p_group_notif_assoc - Notification of P2P client association with GO
  1178. * @group: P2P group context from p2p_group_init()
  1179. * @addr: Interface address of the P2P client
  1180. * @ie: IEs from the (Re)association Request frame
  1181. * @len: Length of the ie buffer in octets
  1182. * Returns: 0 on success, -1 on failure
  1183. */
  1184. int p2p_group_notif_assoc(struct p2p_group *group, const u8 *addr,
  1185. const u8 *ie, size_t len);
  1186. /**
  1187. * p2p_group_assoc_resp_ie - Build P2P IE for (re)association response
  1188. * @group: P2P group context from p2p_group_init()
  1189. * @status: Status value (P2P_SC_SUCCESS if association succeeded)
  1190. * Returns: P2P IE for (Re)association Response or %NULL on failure
  1191. *
  1192. * The caller is responsible for freeing the returned buffer with
  1193. * wpabuf_free().
  1194. */
  1195. struct wpabuf * p2p_group_assoc_resp_ie(struct p2p_group *group, u8 status);
  1196. /**
  1197. * p2p_group_notif_disassoc - Notification of P2P client disassociation from GO
  1198. * @group: P2P group context from p2p_group_init()
  1199. * @addr: Interface address of the P2P client
  1200. */
  1201. void p2p_group_notif_disassoc(struct p2p_group *group, const u8 *addr);
  1202. /**
  1203. * p2p_group_notif_formation_done - Notification of completed group formation
  1204. * @group: P2P group context from p2p_group_init()
  1205. */
  1206. void p2p_group_notif_formation_done(struct p2p_group *group);
  1207. /**
  1208. * p2p_group_notif_noa - Notification of NoA change
  1209. * @group: P2P group context from p2p_group_init()
  1210. * @noa: Notice of Absence attribute payload, %NULL if none
  1211. * @noa_len: Length of noa buffer in octets
  1212. * Returns: 0 on success, -1 on failure
  1213. *
  1214. * Notify the P2P group management about a new NoA contents. This will be
  1215. * inserted into the P2P IEs in Beacon and Probe Response frames with rest of
  1216. * the group information.
  1217. */
  1218. int p2p_group_notif_noa(struct p2p_group *group, const u8 *noa,
  1219. size_t noa_len);
  1220. /**
  1221. * p2p_group_match_dev_type - Match device types in group with requested type
  1222. * @group: P2P group context from p2p_group_init()
  1223. * @wps: WPS TLVs from Probe Request frame (concatenated WPS IEs)
  1224. * Returns: 1 on match, 0 on mismatch
  1225. *
  1226. * This function can be used to match the Requested Device Type attribute in
  1227. * WPS IE with the device types of a group member for deciding whether a GO
  1228. * should reply to a Probe Request frame. Match will be reported if the WPS IE
  1229. * is not requested any specific device type.
  1230. */
  1231. int p2p_group_match_dev_type(struct p2p_group *group, struct wpabuf *wps);
  1232. /**
  1233. * p2p_group_match_dev_id - Match P2P Device Address in group with requested device id
  1234. */
  1235. int p2p_group_match_dev_id(struct p2p_group *group, struct wpabuf *p2p);
  1236. /**
  1237. * p2p_group_go_discover - Send GO Discoverability Request to a group client
  1238. * @group: P2P group context from p2p_group_init()
  1239. * Returns: 0 on success (frame scheduled); -1 if client was not found
  1240. */
  1241. int p2p_group_go_discover(struct p2p_group *group, const u8 *dev_id,
  1242. const u8 *searching_dev, int rx_freq);
  1243. /* Generic helper functions */
  1244. /**
  1245. * p2p_ie_text - Build text format description of P2P IE
  1246. * @p2p_ie: P2P IE
  1247. * @buf: Buffer for returning text
  1248. * @end: Pointer to the end of the buf area
  1249. * Returns: Number of octets written to the buffer or -1 on failure
  1250. *
  1251. * This function can be used to parse P2P IE contents into text format
  1252. * field=value lines.
  1253. */
  1254. int p2p_ie_text(struct wpabuf *p2p_ie, char *buf, char *end);
  1255. /**
  1256. * p2p_scan_result_text - Build text format description of P2P IE
  1257. * @ies: Information elements from scan results
  1258. * @ies_len: ies buffer length in octets
  1259. * @buf: Buffer for returning text
  1260. * @end: Pointer to the end of the buf area
  1261. * Returns: Number of octets written to the buffer or -1 on failure
  1262. *
  1263. * This function can be used to parse P2P IE contents into text format
  1264. * field=value lines.
  1265. */
  1266. int p2p_scan_result_text(const u8 *ies, size_t ies_len, char *buf, char *end);
  1267. /**
  1268. * p2p_parse_dev_addr_in_p2p_ie - Parse P2P Device Address from a concatenated
  1269. * P2P IE
  1270. * @p2p_ie: P2P IE
  1271. * @dev_addr: Buffer for returning P2P Device Address
  1272. * Returns: 0 on success or -1 if P2P Device Address could not be parsed
  1273. */
  1274. int p2p_parse_dev_addr_in_p2p_ie(struct wpabuf *p2p_ie, u8 *dev_addr);
  1275. /**
  1276. * p2p_parse_dev_addr - Parse P2P Device Address from P2P IE(s)
  1277. * @ies: Information elements from scan results
  1278. * @ies_len: ies buffer length in octets
  1279. * @dev_addr: Buffer for returning P2P Device Address
  1280. * Returns: 0 on success or -1 if P2P Device Address could not be parsed
  1281. */
  1282. int p2p_parse_dev_addr(const u8 *ies, size_t ies_len, u8 *dev_addr);
  1283. /**
  1284. * p2p_assoc_req_ie - Build P2P IE for (Re)Association Request frame
  1285. * @p2p: P2P module context from p2p_init()
  1286. * @bssid: BSSID
  1287. * @buf: Buffer for writing the P2P IE
  1288. * @len: Maximum buf length in octets
  1289. * @p2p_group: Whether this is for association with a P2P GO
  1290. * @p2p_ie: Reassembled P2P IE data from scan results or %NULL if none
  1291. * Returns: Number of octets written into buf or -1 on failure
  1292. */
  1293. int p2p_assoc_req_ie(struct p2p_data *p2p, const u8 *bssid, u8 *buf,
  1294. size_t len, int p2p_group, struct wpabuf *p2p_ie);
  1295. /**
  1296. * p2p_scan_ie - Build P2P IE for Probe Request
  1297. * @p2p: P2P module context from p2p_init()
  1298. * @ies: Buffer for writing P2P IE
  1299. * @dev_id: Device ID to search for or %NULL for any
  1300. */
  1301. void p2p_scan_ie(struct p2p_data *p2p, struct wpabuf *ies, const u8 *dev_id);
  1302. /**
  1303. * p2p_scan_ie_buf_len - Get maximum buffer length needed for p2p_scan_ie
  1304. * @p2p: P2P module context from p2p_init()
  1305. * Returns: Number of octets that p2p_scan_ie() may add to the buffer
  1306. */
  1307. size_t p2p_scan_ie_buf_len(struct p2p_data *p2p);
  1308. /**
  1309. * p2p_go_params - Generate random P2P group parameters
  1310. * @p2p: P2P module context from p2p_init()
  1311. * @params: Buffer for parameters
  1312. * Returns: 0 on success, -1 on failure
  1313. */
  1314. int p2p_go_params(struct p2p_data *p2p, struct p2p_go_neg_results *params);
  1315. /**
  1316. * p2p_get_group_capab - Get Group Capability from P2P IE data
  1317. * @p2p_ie: P2P IE(s) contents
  1318. * Returns: Group Capability
  1319. */
  1320. u8 p2p_get_group_capab(const struct wpabuf *p2p_ie);
  1321. /**
  1322. * p2p_get_cross_connect_disallowed - Does WLAN AP disallows cross connection
  1323. * @p2p_ie: P2P IE(s) contents
  1324. * Returns: 0 if cross connection is allow, 1 if not
  1325. */
  1326. int p2p_get_cross_connect_disallowed(const struct wpabuf *p2p_ie);
  1327. /**
  1328. * p2p_get_go_dev_addr - Get P2P Device Address from P2P IE data
  1329. * @p2p_ie: P2P IE(s) contents
  1330. * Returns: Pointer to P2P Device Address or %NULL if not included
  1331. */
  1332. const u8 * p2p_get_go_dev_addr(const struct wpabuf *p2p_ie);
  1333. /**
  1334. * p2p_get_peer_info - Get P2P peer information
  1335. * @p2p: P2P module context from p2p_init()
  1336. * @addr: P2P Device Address of the peer or %NULL to indicate the first peer
  1337. * @next: Whether to select the peer entry following the one indicated by addr
  1338. * Returns: Pointer to peer info or %NULL if not found
  1339. */
  1340. const struct p2p_peer_info * p2p_get_peer_info(struct p2p_data *p2p,
  1341. const u8 *addr, int next);
  1342. /**
  1343. * p2p_get_peer_info_txt - Get internal P2P peer information in text format
  1344. * @info: Pointer to P2P peer info from p2p_get_peer_info()
  1345. * @buf: Buffer for returning text
  1346. * @buflen: Maximum buffer length
  1347. * Returns: Number of octets written to the buffer or -1 on failure
  1348. *
  1349. * Note: This information is internal to the P2P module and subject to change.
  1350. * As such, this should not really be used by external programs for purposes
  1351. * other than debugging.
  1352. */
  1353. int p2p_get_peer_info_txt(const struct p2p_peer_info *info,
  1354. char *buf, size_t buflen);
  1355. /**
  1356. * p2p_peer_known - Check whether P2P peer is known
  1357. * @p2p: P2P module context from p2p_init()
  1358. * @addr: P2P Device Address of the peer
  1359. * Returns: 1 if the specified device is in the P2P peer table or 0 if not
  1360. */
  1361. int p2p_peer_known(struct p2p_data *p2p, const u8 *addr);
  1362. /**
  1363. * p2p_set_client_discoverability - Set client discoverability capability
  1364. * @p2p: P2P module context from p2p_init()
  1365. * @enabled: Whether client discoverability will be enabled
  1366. *
  1367. * This function can be used to disable (and re-enable) client discoverability.
  1368. * This capability is enabled by default and should not be disabled in normal
  1369. * use cases, i.e., this is mainly for testing purposes.
  1370. */
  1371. void p2p_set_client_discoverability(struct p2p_data *p2p, int enabled);
  1372. /**
  1373. * p2p_set_managed_oper - Set managed P2P Device operations capability
  1374. * @p2p: P2P module context from p2p_init()
  1375. * @enabled: Whether managed P2P Device operations will be enabled
  1376. */
  1377. void p2p_set_managed_oper(struct p2p_data *p2p, int enabled);
  1378. int p2p_set_listen_channel(struct p2p_data *p2p, u8 reg_class, u8 channel);
  1379. int p2p_set_ssid_postfix(struct p2p_data *p2p, const u8 *postfix, size_t len);
  1380. int p2p_get_interface_addr(struct p2p_data *p2p, const u8 *dev_addr,
  1381. u8 *iface_addr);
  1382. int p2p_get_dev_addr(struct p2p_data *p2p, const u8 *iface_addr,
  1383. u8 *dev_addr);
  1384. void p2p_set_peer_filter(struct p2p_data *p2p, const u8 *addr);
  1385. /**
  1386. * p2p_set_cross_connect - Set cross connection capability
  1387. * @p2p: P2P module context from p2p_init()
  1388. * @enabled: Whether cross connection will be enabled
  1389. */
  1390. void p2p_set_cross_connect(struct p2p_data *p2p, int enabled);
  1391. int p2p_get_oper_freq(struct p2p_data *p2p, const u8 *iface_addr);
  1392. /**
  1393. * p2p_set_intra_bss_dist - Set intra BSS distribution
  1394. * @p2p: P2P module context from p2p_init()
  1395. * @enabled: Whether intra BSS distribution will be enabled
  1396. */
  1397. void p2p_set_intra_bss_dist(struct p2p_data *p2p, int enabled);
  1398. /**
  1399. * p2p_supported_freq - Check whether channel is supported for P2P
  1400. * @p2p: P2P module context from p2p_init()
  1401. * @freq: Channel frequency in MHz
  1402. * Returns: 0 if channel not usable for P2P, 1 if usable for P2P
  1403. */
  1404. int p2p_supported_freq(struct p2p_data *p2p, unsigned int freq);
  1405. void p2p_update_channel_list(struct p2p_data *p2p, struct p2p_channels *chan);
  1406. /**
  1407. * p2p_set_best_channels - Update best channel information
  1408. * @p2p: P2P module context from p2p_init()
  1409. * @freq_24: Frequency (MHz) of best channel in 2.4 GHz band
  1410. * @freq_5: Frequency (MHz) of best channel in 5 GHz band
  1411. * @freq_overall: Frequency (MHz) of best channel overall
  1412. */
  1413. void p2p_set_best_channels(struct p2p_data *p2p, int freq_24, int freq_5,
  1414. int freq_overall);
  1415. const u8 * p2p_get_go_neg_peer(struct p2p_data *p2p);
  1416. /**
  1417. * p2p_get_group_num_members - Get number of members in group
  1418. * @group: P2P group context from p2p_group_init()
  1419. * Returns: Number of members in the group
  1420. */
  1421. unsigned int p2p_get_group_num_members(struct p2p_group *group);
  1422. /**
  1423. * p2p_iterate_group_members - Iterate group members
  1424. * @group: P2P group context from p2p_group_init()
  1425. * @next: iteration pointer, must be a pointer to a void * that is set to %NULL
  1426. * on the first call and not modified later
  1427. * Returns: A P2P Interface Address for each call and %NULL for no more members
  1428. */
  1429. const u8 * p2p_iterate_group_members(struct p2p_group *group, void **next);
  1430. /**
  1431. * p2p_group_get_dev_addr - Get a P2P Device Address of a client in a group
  1432. * @group: P2P group context from p2p_group_init()
  1433. * @addr: P2P Interface Address of the client
  1434. * Returns: P2P Device Address of the client if found or %NULL if no match
  1435. * found
  1436. */
  1437. const u8 * p2p_group_get_dev_addr(struct p2p_group *group, const u8 *addr);
  1438. /**
  1439. * p2p_group_is_client_connected - Check whether a specific client is connected
  1440. * @group: P2P group context from p2p_group_init()
  1441. * @addr: P2P Device Address of the client
  1442. * Returns: 1 if client is connected or 0 if not
  1443. */
  1444. int p2p_group_is_client_connected(struct p2p_group *group, const u8 *dev_addr);
  1445. /**
  1446. * p2p_get_peer_found - Get P2P peer info structure of a found peer
  1447. * @p2p: P2P module context from p2p_init()
  1448. * @addr: P2P Device Address of the peer or %NULL to indicate the first peer
  1449. * @next: Whether to select the peer entry following the one indicated by addr
  1450. * Returns: The first P2P peer info available or %NULL if no such peer exists
  1451. */
  1452. const struct p2p_peer_info *
  1453. p2p_get_peer_found(struct p2p_data *p2p, const u8 *addr, int next);
  1454. /**
  1455. * p2p_remove_wps_vendor_extensions - Remove WPS vendor extensions
  1456. * @p2p: P2P module context from p2p_init()
  1457. */
  1458. void p2p_remove_wps_vendor_extensions(struct p2p_data *p2p);
  1459. /**
  1460. * p2p_add_wps_vendor_extension - Add a WPS vendor extension
  1461. * @p2p: P2P module context from p2p_init()
  1462. * @vendor_ext: The vendor extensions to add
  1463. * Returns: 0 on success, -1 on failure
  1464. *
  1465. * The wpabuf structures in the array are owned by the P2P
  1466. * module after this call.
  1467. */
  1468. int p2p_add_wps_vendor_extension(struct p2p_data *p2p,
  1469. const struct wpabuf *vendor_ext);
  1470. /**
  1471. * p2p_set_oper_channel - Set the P2P operating channel
  1472. * @p2p: P2P module context from p2p_init()
  1473. * @op_reg_class: Operating regulatory class to set
  1474. * @op_channel: operating channel to set
  1475. * @cfg_op_channel : Whether op_channel is hardcoded in configuration
  1476. * Returns: 0 on success, -1 on failure
  1477. */
  1478. int p2p_set_oper_channel(struct p2p_data *p2p, u8 op_reg_class, u8 op_channel,
  1479. int cfg_op_channel);
  1480. /**
  1481. * p2p_set_pref_chan - Set P2P preferred channel list
  1482. * @p2p: P2P module context from p2p_init()
  1483. * @num_pref_chan: Number of entries in pref_chan list
  1484. * @pref_chan: Preferred channels or %NULL to remove preferences
  1485. * Returns: 0 on success, -1 on failure
  1486. */
  1487. int p2p_set_pref_chan(struct p2p_data *p2p, unsigned int num_pref_chan,
  1488. const struct p2p_channel *pref_chan);
  1489. /**
  1490. * p2p_in_progress - Check whether a P2P operation is progress
  1491. * @p2p: P2P module context from p2p_init()
  1492. * Returns: 0 if P2P module is idle or 1 if an operation is in progress
  1493. */
  1494. int p2p_in_progress(struct p2p_data *p2p);
  1495. /**
  1496. * p2p_other_scan_completed - Notify completion of non-P2P scan
  1497. * @p2p: P2P module context from p2p_init()
  1498. * Returns: 0 if P2P module is idle or 1 if an operation was started
  1499. */
  1500. int p2p_other_scan_completed(struct p2p_data *p2p);
  1501. const char * p2p_wps_method_text(enum p2p_wps_method method);
  1502. #endif /* P2P_H */