p2p.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. /*
  2. * Fundamental types and constants relating to WFA P2P (aka WiFi Direct)
  3. *
  4. * Portions of this code are copyright (c) 2020 Cypress Semiconductor Corporation
  5. *
  6. * Copyright (C) 1999-2020, Broadcom Corporation
  7. *
  8. * Unless you and Broadcom execute a separate written software license
  9. * agreement governing use of this software, this software is licensed to you
  10. * under the terms of the GNU General Public License version 2 (the "GPL"),
  11. * available at http://www.broadcom.com/licenses/GPLv2.php, with the
  12. * following added to such license:
  13. *
  14. * As a special exception, the copyright holders of this software give you
  15. * permission to link this software with independent modules, and to copy and
  16. * distribute the resulting executable under terms of your choice, provided that
  17. * you also meet, for each linked independent module, the terms and conditions of
  18. * the license of that module. An independent module is a module which is not
  19. * derived from this software. The special exception does not apply to any
  20. * modifications of the software.
  21. *
  22. * Notwithstanding the above, under no circumstances may you combine this
  23. * software in any way with any other Broadcom software provided under a license
  24. * other than the GPL, without Broadcom's express prior written consent.
  25. *
  26. *
  27. * <<Broadcom-WL-IPTag/Open:>>
  28. *
  29. * $Id: p2p.h 694837 2018-08-13 06:47:11Z $
  30. */
  31. #ifndef _P2P_H_
  32. #define _P2P_H_
  33. #ifndef _TYPEDEFS_H_
  34. #include <typedefs.h>
  35. #endif // endif
  36. #include <wlioctl.h>
  37. #include <802.11.h>
  38. /* This marks the start of a packed structure section. */
  39. #include <packed_section_start.h>
  40. /* WiFi P2P OUI values */
  41. #define P2P_VER WFA_OUI_TYPE_P2P /* P2P version: 9=WiFi P2P v1.0 */
  42. #define P2P_IE_ID 0xdd /* P2P IE element ID */
  43. /* WiFi P2P IE */
  44. BWL_PRE_PACKED_STRUCT struct wifi_p2p_ie {
  45. uint8 id; /* IE ID: 0xDD */
  46. uint8 len; /* IE length */
  47. uint8 OUI[3]; /* WiFi P2P specific OUI: P2P_OUI */
  48. uint8 oui_type; /* Identifies P2P version: P2P_VER */
  49. uint8 subelts[1]; /* variable length subelements */
  50. } BWL_POST_PACKED_STRUCT;
  51. typedef struct wifi_p2p_ie wifi_p2p_ie_t;
  52. #define P2P_IE_FIXED_LEN 6
  53. #define P2P_ATTR_ID_OFF 0
  54. #define P2P_ATTR_LEN_OFF 1
  55. #define P2P_ATTR_DATA_OFF 3
  56. #define P2P_ATTR_ID_LEN 1 /* ID filed length */
  57. #define P2P_ATTR_LEN_LEN 2 /* length field length */
  58. #define P2P_ATTR_HDR_LEN 3 /* ID + 2-byte length field spec 1.02 */
  59. #define P2P_WFDS_HASH_LEN 6
  60. #define P2P_WFDS_MAX_SVC_NAME_LEN 32
  61. /* P2P IE Subelement IDs from WiFi P2P Technical Spec 1.00 */
  62. #define P2P_SEID_STATUS 0 /* Status */
  63. #define P2P_SEID_MINOR_RC 1 /* Minor Reason Code */
  64. #define P2P_SEID_P2P_INFO 2 /* P2P Capability (capabilities info) */
  65. #define P2P_SEID_DEV_ID 3 /* P2P Device ID */
  66. #define P2P_SEID_INTENT 4 /* Group Owner Intent */
  67. #define P2P_SEID_CFG_TIMEOUT 5 /* Configuration Timeout */
  68. #define P2P_SEID_CHANNEL 6 /* Listen channel */
  69. #define P2P_SEID_GRP_BSSID 7 /* P2P Group BSSID */
  70. #define P2P_SEID_XT_TIMING 8 /* Extended Listen Timing */
  71. #define P2P_SEID_INTINTADDR 9 /* Intended P2P Interface Address */
  72. #define P2P_SEID_P2P_MGBTY 10 /* P2P Manageability */
  73. #define P2P_SEID_CHAN_LIST 11 /* Channel List */
  74. #define P2P_SEID_ABSENCE 12 /* Notice of Absence */
  75. #define P2P_SEID_DEV_INFO 13 /* Device Info */
  76. #define P2P_SEID_GROUP_INFO 14 /* Group Info */
  77. #define P2P_SEID_GROUP_ID 15 /* Group ID */
  78. #define P2P_SEID_P2P_IF 16 /* P2P Interface */
  79. #define P2P_SEID_OP_CHANNEL 17 /* Operating Channel */
  80. #define P2P_SEID_INVITE_FLAGS 18 /* Invitation Flags */
  81. #define P2P_SEID_SERVICE_HASH 21 /* Service hash */
  82. #define P2P_SEID_SESSION 22 /* Session information */
  83. #define P2P_SEID_CONNECT_CAP 23 /* Connection capability */
  84. #define P2P_SEID_ADVERTISE_ID 24 /* Advertisement ID */
  85. #define P2P_SEID_ADVERTISE_SERVICE 25 /* Advertised service */
  86. #define P2P_SEID_SESSION_ID 26 /* Session ID */
  87. #define P2P_SEID_FEATURE_CAP 27 /* Feature capability */
  88. #define P2P_SEID_PERSISTENT_GROUP 28 /* Persistent group */
  89. #define P2P_SEID_SESSION_INFO_RESP 29 /* Session Information Response */
  90. #define P2P_SEID_VNDR 221 /* Vendor-specific subelement */
  91. #define P2P_SE_VS_ID_SERVICES 0x1b
  92. /* WiFi P2P IE subelement: P2P Capability (capabilities info) */
  93. BWL_PRE_PACKED_STRUCT struct wifi_p2p_info_se_s {
  94. uint8 eltId; /* SE ID: P2P_SEID_P2P_INFO */
  95. uint8 len[2]; /* SE length not including eltId, len fields */
  96. uint8 dev; /* Device Capability Bitmap */
  97. uint8 group; /* Group Capability Bitmap */
  98. } BWL_POST_PACKED_STRUCT;
  99. typedef struct wifi_p2p_info_se_s wifi_p2p_info_se_t;
  100. /* P2P Capability subelement's Device Capability Bitmap bit values */
  101. #define P2P_CAPSE_DEV_SERVICE_DIS 0x1 /* Service Discovery */
  102. #define P2P_CAPSE_DEV_CLIENT_DIS 0x2 /* Client Discoverability */
  103. #define P2P_CAPSE_DEV_CONCURRENT 0x4 /* Concurrent Operation */
  104. #define P2P_CAPSE_DEV_INFRA_MAN 0x8 /* P2P Infrastructure Managed */
  105. #define P2P_CAPSE_DEV_LIMIT 0x10 /* P2P Device Limit */
  106. #define P2P_CAPSE_INVITE_PROC 0x20 /* P2P Invitation Procedure */
  107. /* P2P Capability subelement's Group Capability Bitmap bit values */
  108. #define P2P_CAPSE_GRP_OWNER 0x1 /* P2P Group Owner */
  109. #define P2P_CAPSE_PERSIST_GRP 0x2 /* Persistent P2P Group */
  110. #define P2P_CAPSE_GRP_LIMIT 0x4 /* P2P Group Limit */
  111. #define P2P_CAPSE_GRP_INTRA_BSS 0x8 /* Intra-BSS Distribution */
  112. #define P2P_CAPSE_GRP_X_CONNECT 0x10 /* Cross Connection */
  113. #define P2P_CAPSE_GRP_PERSISTENT 0x20 /* Persistent Reconnect */
  114. #define P2P_CAPSE_GRP_FORMATION 0x40 /* Group Formation */
  115. /* WiFi P2P IE subelement: Group Owner Intent */
  116. BWL_PRE_PACKED_STRUCT struct wifi_p2p_intent_se_s {
  117. uint8 eltId; /* SE ID: P2P_SEID_INTENT */
  118. uint8 len[2]; /* SE length not including eltId, len fields */
  119. uint8 intent; /* Intent Value 0...15 (0=legacy 15=master only) */
  120. } BWL_POST_PACKED_STRUCT;
  121. typedef struct wifi_p2p_intent_se_s wifi_p2p_intent_se_t;
  122. /* WiFi P2P IE subelement: Configuration Timeout */
  123. BWL_PRE_PACKED_STRUCT struct wifi_p2p_cfg_tmo_se_s {
  124. uint8 eltId; /* SE ID: P2P_SEID_CFG_TIMEOUT */
  125. uint8 len[2]; /* SE length not including eltId, len fields */
  126. uint8 go_tmo; /* GO config timeout in units of 10 ms */
  127. uint8 client_tmo; /* Client config timeout in units of 10 ms */
  128. } BWL_POST_PACKED_STRUCT;
  129. typedef struct wifi_p2p_cfg_tmo_se_s wifi_p2p_cfg_tmo_se_t;
  130. /* WiFi P2P IE subelement: Listen Channel */
  131. BWL_PRE_PACKED_STRUCT struct wifi_p2p_listen_channel_se_s {
  132. uint8 eltId; /* SE ID: P2P_SEID_CHANNEL */
  133. uint8 len[2]; /* SE length not including eltId, len fields */
  134. uint8 country[3]; /* Country String */
  135. uint8 op_class; /* Operating Class */
  136. uint8 channel; /* Channel */
  137. } BWL_POST_PACKED_STRUCT;
  138. typedef struct wifi_p2p_listen_channel_se_s wifi_p2p_listen_channel_se_t;
  139. /* WiFi P2P IE subelement: P2P Group BSSID */
  140. BWL_PRE_PACKED_STRUCT struct wifi_p2p_grp_bssid_se_s {
  141. uint8 eltId; /* SE ID: P2P_SEID_GRP_BSSID */
  142. uint8 len[2]; /* SE length not including eltId, len fields */
  143. uint8 mac[6]; /* P2P group bssid */
  144. } BWL_POST_PACKED_STRUCT;
  145. typedef struct wifi_p2p_grp_bssid_se_s wifi_p2p_grp_bssid_se_t;
  146. /* WiFi P2P IE subelement: P2P Group ID */
  147. BWL_PRE_PACKED_STRUCT struct wifi_p2p_grp_id_se_s {
  148. uint8 eltId; /* SE ID: P2P_SEID_GROUP_ID */
  149. uint8 len[2]; /* SE length not including eltId, len fields */
  150. uint8 mac[6]; /* P2P device address */
  151. uint8 ssid[1]; /* ssid. device id. variable length */
  152. } BWL_POST_PACKED_STRUCT;
  153. typedef struct wifi_p2p_grp_id_se_s wifi_p2p_grp_id_se_t;
  154. /* WiFi P2P IE subelement: P2P Interface */
  155. BWL_PRE_PACKED_STRUCT struct wifi_p2p_intf_se_s {
  156. uint8 eltId; /* SE ID: P2P_SEID_P2P_IF */
  157. uint8 len[2]; /* SE length not including eltId, len fields */
  158. uint8 mac[6]; /* P2P device address */
  159. uint8 ifaddrs; /* P2P Interface Address count */
  160. uint8 ifaddr[1][6]; /* P2P Interface Address list */
  161. } BWL_POST_PACKED_STRUCT;
  162. typedef struct wifi_p2p_intf_se_s wifi_p2p_intf_se_t;
  163. /* WiFi P2P IE subelement: Status */
  164. BWL_PRE_PACKED_STRUCT struct wifi_p2p_status_se_s {
  165. uint8 eltId; /* SE ID: P2P_SEID_STATUS */
  166. uint8 len[2]; /* SE length not including eltId, len fields */
  167. uint8 status; /* Status Code: P2P_STATSE_* */
  168. } BWL_POST_PACKED_STRUCT;
  169. typedef struct wifi_p2p_status_se_s wifi_p2p_status_se_t;
  170. /* Status subelement Status Code definitions */
  171. #define P2P_STATSE_SUCCESS 0
  172. /* Success */
  173. #define P2P_STATSE_FAIL_INFO_CURR_UNAVAIL 1
  174. /* Failed, information currently unavailable */
  175. #define P2P_STATSE_PASSED_UP P2P_STATSE_FAIL_INFO_CURR_UNAVAIL
  176. /* Old name for above in P2P spec 1.08 and older */
  177. #define P2P_STATSE_FAIL_INCOMPAT_PARAMS 2
  178. /* Failed, incompatible parameters */
  179. #define P2P_STATSE_FAIL_LIMIT_REACHED 3
  180. /* Failed, limit reached */
  181. #define P2P_STATSE_FAIL_INVALID_PARAMS 4
  182. /* Failed, invalid parameters */
  183. #define P2P_STATSE_FAIL_UNABLE_TO_ACCOM 5
  184. /* Failed, unable to accomodate request */
  185. #define P2P_STATSE_FAIL_PROTO_ERROR 6
  186. /* Failed, previous protocol error or disruptive behaviour */
  187. #define P2P_STATSE_FAIL_NO_COMMON_CHAN 7
  188. /* Failed, no common channels */
  189. #define P2P_STATSE_FAIL_UNKNOWN_GROUP 8
  190. /* Failed, unknown P2P Group */
  191. #define P2P_STATSE_FAIL_INTENT 9
  192. /* Failed, both peers indicated Intent 15 in GO Negotiation */
  193. #define P2P_STATSE_FAIL_INCOMPAT_PROVIS 10
  194. /* Failed, incompatible provisioning method */
  195. #define P2P_STATSE_FAIL_USER_REJECT 11
  196. /* Failed, rejected by user */
  197. #define P2P_STATSE_SUCCESS_USER_ACCEPT 12
  198. /* Success, accepted by user */
  199. /* WiFi P2P IE attribute: Extended Listen Timing */
  200. BWL_PRE_PACKED_STRUCT struct wifi_p2p_ext_se_s {
  201. uint8 eltId; /* ID: P2P_SEID_EXT_TIMING */
  202. uint8 len[2]; /* length not including eltId, len fields */
  203. uint8 avail[2]; /* availibility period */
  204. uint8 interval[2]; /* availibility interval */
  205. } BWL_POST_PACKED_STRUCT;
  206. typedef struct wifi_p2p_ext_se_s wifi_p2p_ext_se_t;
  207. #define P2P_EXT_MIN 10 /* minimum 10ms */
  208. /* WiFi P2P IE subelement: Intended P2P Interface Address */
  209. BWL_PRE_PACKED_STRUCT struct wifi_p2p_intintad_se_s {
  210. uint8 eltId; /* SE ID: P2P_SEID_INTINTADDR */
  211. uint8 len[2]; /* SE length not including eltId, len fields */
  212. uint8 mac[6]; /* intended P2P interface MAC address */
  213. } BWL_POST_PACKED_STRUCT;
  214. typedef struct wifi_p2p_intintad_se_s wifi_p2p_intintad_se_t;
  215. /* WiFi P2P IE subelement: Channel */
  216. BWL_PRE_PACKED_STRUCT struct wifi_p2p_channel_se_s {
  217. uint8 eltId; /* SE ID: P2P_SEID_STATUS */
  218. uint8 len[2]; /* SE length not including eltId, len fields */
  219. uint8 band; /* Regulatory Class (band) */
  220. uint8 channel; /* Channel */
  221. } BWL_POST_PACKED_STRUCT;
  222. typedef struct wifi_p2p_channel_se_s wifi_p2p_channel_se_t;
  223. /* Channel Entry structure within the Channel List SE */
  224. BWL_PRE_PACKED_STRUCT struct wifi_p2p_chanlist_entry_s {
  225. uint8 band; /* Regulatory Class (band) */
  226. uint8 num_channels; /* # of channels in the channel list */
  227. uint8 channels[WL_NUMCHANNELS]; /* Channel List */
  228. } BWL_POST_PACKED_STRUCT;
  229. typedef struct wifi_p2p_chanlist_entry_s wifi_p2p_chanlist_entry_t;
  230. #define WIFI_P2P_CHANLIST_SE_MAX_ENTRIES 2
  231. /* WiFi P2P IE subelement: Channel List */
  232. BWL_PRE_PACKED_STRUCT struct wifi_p2p_chanlist_se_s {
  233. uint8 eltId; /* SE ID: P2P_SEID_CHAN_LIST */
  234. uint8 len[2]; /* SE length not including eltId, len fields */
  235. uint8 country[3]; /* Country String */
  236. uint8 num_entries; /* # of channel entries */
  237. wifi_p2p_chanlist_entry_t entries[WIFI_P2P_CHANLIST_SE_MAX_ENTRIES];
  238. /* Channel Entry List */
  239. } BWL_POST_PACKED_STRUCT;
  240. typedef struct wifi_p2p_chanlist_se_s wifi_p2p_chanlist_se_t;
  241. /* WiFi Primary Device Type structure */
  242. BWL_PRE_PACKED_STRUCT struct wifi_p2p_pri_devtype_s {
  243. uint16 cat_id; /* Category ID */
  244. uint8 OUI[3]; /* WFA OUI: 0x0050F2 */
  245. uint8 oui_type; /* WPS_OUI_TYPE */
  246. uint16 sub_cat_id; /* Sub Category ID */
  247. } BWL_POST_PACKED_STRUCT;
  248. typedef struct wifi_p2p_pri_devtype_s wifi_p2p_pri_devtype_t;
  249. /* WiFi P2P Device Info Sub Element Primary Device Type Sub Category
  250. * maximum values for each category
  251. */
  252. #define P2P_DISE_SUBCATEGORY_MINVAL 1
  253. #define P2P_DISE_CATEGORY_COMPUTER 1
  254. #define P2P_DISE_SUBCATEGORY_COMPUTER_MAXVAL 8
  255. #define P2P_DISE_CATEGORY_INPUT_DEVICE 2
  256. #define P2P_DISE_SUBCATEGORY_INPUT_DEVICE_MAXVAL 9
  257. #define P2P_DISE_CATEGORY_PRINTER 3
  258. #define P2P_DISE_SUBCATEGORY_PRINTER_MAXVAL 5
  259. #define P2P_DISE_CATEGORY_CAMERA 4
  260. #define P2P_DISE_SUBCATEGORY_CAMERA_MAXVAL 4
  261. #define P2P_DISE_CATEGORY_STORAGE 5
  262. #define P2P_DISE_SUBCATEGORY_STORAGE_MAXVAL 1
  263. #define P2P_DISE_CATEGORY_NETWORK_INFRA 6
  264. #define P2P_DISE_SUBCATEGORY_NETWORK_INFRA_MAXVAL 4
  265. #define P2P_DISE_CATEGORY_DISPLAY 7
  266. #define P2P_DISE_SUBCATEGORY_DISPLAY_MAXVAL 4
  267. #define P2P_DISE_CATEGORY_MULTIMEDIA 8
  268. #define P2P_DISE_SUBCATEGORY_MULTIMEDIA_MAXVAL 6
  269. #define P2P_DISE_CATEGORY_GAMING 9
  270. #define P2P_DISE_SUBCATEGORY_GAMING_MAXVAL 5
  271. #define P2P_DISE_CATEGORY_TELEPHONE 10
  272. #define P2P_DISE_SUBCATEGORY_TELEPHONE_MAXVAL 5
  273. #define P2P_DISE_CATEGORY_AUDIO 11
  274. #define P2P_DISE_SUBCATEGORY_AUDIO_MAXVAL 6
  275. /* WiFi P2P IE's Device Info subelement */
  276. BWL_PRE_PACKED_STRUCT struct wifi_p2p_devinfo_se_s {
  277. uint8 eltId; /* SE ID: P2P_SEID_DEVINFO */
  278. uint8 len[2]; /* SE length not including eltId, len fields */
  279. uint8 mac[6]; /* P2P Device MAC address */
  280. uint16 wps_cfg_meths; /* Config Methods: reg_prototlv.h WPS_CONFMET_* */
  281. uint8 pri_devtype[8]; /* Primary Device Type */
  282. } BWL_POST_PACKED_STRUCT;
  283. typedef struct wifi_p2p_devinfo_se_s wifi_p2p_devinfo_se_t;
  284. #define P2P_DEV_TYPE_LEN 8
  285. /* WiFi P2P IE's Group Info subelement Client Info Descriptor */
  286. BWL_PRE_PACKED_STRUCT struct wifi_p2p_cid_fixed_s {
  287. uint8 len;
  288. uint8 devaddr[ETHER_ADDR_LEN]; /* P2P Device Address */
  289. uint8 ifaddr[ETHER_ADDR_LEN]; /* P2P Interface Address */
  290. uint8 devcap; /* Device Capability */
  291. uint8 cfg_meths[2]; /* Config Methods: reg_prototlv.h WPS_CONFMET_* */
  292. uint8 pridt[P2P_DEV_TYPE_LEN]; /* Primary Device Type */
  293. uint8 secdts; /* Number of Secondary Device Types */
  294. } BWL_POST_PACKED_STRUCT;
  295. typedef struct wifi_p2p_cid_fixed_s wifi_p2p_cid_fixed_t;
  296. /* WiFi P2P IE's Device ID subelement */
  297. BWL_PRE_PACKED_STRUCT struct wifi_p2p_devid_se_s {
  298. uint8 eltId;
  299. uint8 len[2];
  300. struct ether_addr addr; /* P2P Device MAC address */
  301. } BWL_POST_PACKED_STRUCT;
  302. typedef struct wifi_p2p_devid_se_s wifi_p2p_devid_se_t;
  303. /* WiFi P2P IE subelement: P2P Manageability */
  304. BWL_PRE_PACKED_STRUCT struct wifi_p2p_mgbt_se_s {
  305. uint8 eltId; /* SE ID: P2P_SEID_P2P_MGBTY */
  306. uint8 len[2]; /* SE length not including eltId, len fields */
  307. uint8 mg_bitmap; /* manageability bitmap */
  308. } BWL_POST_PACKED_STRUCT;
  309. typedef struct wifi_p2p_mgbt_se_s wifi_p2p_mgbt_se_t;
  310. /* mg_bitmap field bit values */
  311. #define P2P_MGBTSE_P2PDEVMGMT_FLAG 0x1 /* AP supports Managed P2P Device */
  312. /* WiFi P2P IE subelement: Group Info */
  313. BWL_PRE_PACKED_STRUCT struct wifi_p2p_grpinfo_se_s {
  314. uint8 eltId; /* SE ID: P2P_SEID_GROUP_INFO */
  315. uint8 len[2]; /* SE length not including eltId, len fields */
  316. } BWL_POST_PACKED_STRUCT;
  317. typedef struct wifi_p2p_grpinfo_se_s wifi_p2p_grpinfo_se_t;
  318. /* WiFi IE subelement: Operating Channel */
  319. BWL_PRE_PACKED_STRUCT struct wifi_p2p_op_channel_se_s {
  320. uint8 eltId; /* SE ID: P2P_SEID_OP_CHANNEL */
  321. uint8 len[2]; /* SE length not including eltId, len fields */
  322. uint8 country[3]; /* Country String */
  323. uint8 op_class; /* Operating Class */
  324. uint8 channel; /* Channel */
  325. } BWL_POST_PACKED_STRUCT;
  326. typedef struct wifi_p2p_op_channel_se_s wifi_p2p_op_channel_se_t;
  327. /* WiFi IE subelement: INVITATION FLAGS */
  328. BWL_PRE_PACKED_STRUCT struct wifi_p2p_invite_flags_se_s {
  329. uint8 eltId; /* SE ID: P2P_SEID_INVITE_FLAGS */
  330. uint8 len[2]; /* SE length not including eltId, len fields */
  331. uint8 flags; /* Flags */
  332. } BWL_POST_PACKED_STRUCT;
  333. typedef struct wifi_p2p_invite_flags_se_s wifi_p2p_invite_flags_se_t;
  334. /* WiFi P2P IE subelement: Service Hash */
  335. BWL_PRE_PACKED_STRUCT struct wifi_p2p_serv_hash_se_s {
  336. uint8 eltId; /* SE ID: P2P_SEID_SERVICE_HASH */
  337. uint8 len[2]; /* SE length not including eltId, len fields
  338. * in multiple of 6 Bytes
  339. */
  340. uint8 hash[1]; /* Variable length - SHA256 hash of
  341. * service names (can be more than one hashes)
  342. */
  343. } BWL_POST_PACKED_STRUCT;
  344. typedef struct wifi_p2p_serv_hash_se_s wifi_p2p_serv_hash_se_t;
  345. /* WiFi P2P IE subelement: Service Instance Data */
  346. BWL_PRE_PACKED_STRUCT struct wifi_p2p_serv_inst_data_se_s {
  347. uint8 eltId; /* SE ID: P2P_SEID_SESSION */
  348. uint8 len[2]; /* SE length not including eltId, len */
  349. uint8 ssn_info[1]; /* Variable length - Session information as specified by
  350. * the service layer, type matches serv. name
  351. */
  352. } BWL_POST_PACKED_STRUCT;
  353. typedef struct wifi_p2p_serv_inst_data_se_s wifi_p2p_serv_inst_data_se_t;
  354. /* WiFi P2P IE subelement: Connection capability */
  355. BWL_PRE_PACKED_STRUCT struct wifi_p2p_conn_cap_data_se_s {
  356. uint8 eltId; /* SE ID: P2P_SEID_CONNECT_CAP */
  357. uint8 len[2]; /* SE length not including eltId, len */
  358. uint8 conn_cap; /* 1byte capability as specified by the
  359. * service layer, valid bitmask/values
  360. */
  361. } BWL_POST_PACKED_STRUCT;
  362. typedef struct wifi_p2p_conn_cap_data_se_s wifi_p2p_conn_cap_data_se_t;
  363. /* WiFi P2P IE subelement: Advertisement ID */
  364. BWL_PRE_PACKED_STRUCT struct wifi_p2p_advt_id_se_s {
  365. uint8 eltId; /* SE ID: P2P_SEID_ADVERTISE_ID */
  366. uint8 len[2]; /* SE length not including eltId, len fixed 4 Bytes */
  367. uint8 advt_id[4]; /* 4byte Advertisement ID of the peer device sent in
  368. * PROV Disc in Network byte order
  369. */
  370. uint8 advt_mac[6]; /* P2P device address of the service advertiser */
  371. } BWL_POST_PACKED_STRUCT;
  372. typedef struct wifi_p2p_advt_id_se_s wifi_p2p_advt_id_se_t;
  373. /* WiFi P2P IE subelement: Advertise Service Hash */
  374. BWL_PRE_PACKED_STRUCT struct wifi_p2p_adv_serv_info_s {
  375. uint8 advt_id[4]; /* SE Advertise ID for the service */
  376. uint16 nw_cfg_method; /* SE Network Config method for the service */
  377. uint8 serv_name_len; /* SE length of the service name */
  378. uint8 serv_name[1]; /* Variable length service name field */
  379. } BWL_POST_PACKED_STRUCT;
  380. typedef struct wifi_p2p_adv_serv_info_s wifi_p2p_adv_serv_info_t;
  381. /* WiFi P2P IE subelement: Advertise Service Hash */
  382. BWL_PRE_PACKED_STRUCT struct wifi_p2p_advt_serv_se_s {
  383. uint8 eltId; /* SE ID: P2P_SEID_ADVERTISE_SERVICE */
  384. uint8 len[2]; /* SE length not including eltId, len fields mutiple len of
  385. * wifi_p2p_adv_serv_info_t entries
  386. */
  387. wifi_p2p_adv_serv_info_t p_advt_serv_info[1]; /* Variable length
  388. of multiple instances
  389. of the advertise service info
  390. */
  391. } BWL_POST_PACKED_STRUCT;
  392. typedef struct wifi_p2p_advt_serv_se_s wifi_p2p_advt_serv_se_t;
  393. /* WiFi P2P IE subelement: Session ID */
  394. BWL_PRE_PACKED_STRUCT struct wifi_p2p_ssn_id_se_s {
  395. uint8 eltId; /* SE ID: P2P_SEID_SESSION_ID */
  396. uint8 len[2]; /* SE length not including eltId, len fixed 4 Bytes */
  397. uint8 ssn_id[4]; /* 4byte Session ID of the peer device sent in
  398. * PROV Disc in Network byte order
  399. */
  400. uint8 ssn_mac[6]; /* P2P device address of the seeker - session mac */
  401. } BWL_POST_PACKED_STRUCT;
  402. typedef struct wifi_p2p_ssn_id_se_s wifi_p2p_ssn_id_se_t;
  403. #define P2P_ADVT_SERV_SE_FIXED_LEN 3 /* Includes only the element ID and len */
  404. #define P2P_ADVT_SERV_INFO_FIXED_LEN 7 /* Per ADV Service Instance advt_id +
  405. * nw_config_method + serv_name_len
  406. */
  407. /* WiFi P2P Action Frame */
  408. BWL_PRE_PACKED_STRUCT struct wifi_p2p_action_frame {
  409. uint8 category; /* P2P_AF_CATEGORY */
  410. uint8 OUI[3]; /* OUI - P2P_OUI */
  411. uint8 type; /* OUI Type - P2P_VER */
  412. uint8 subtype; /* OUI Subtype - P2P_AF_* */
  413. uint8 dialog_token; /* nonzero, identifies req/resp tranaction */
  414. uint8 elts[1]; /* Variable length information elements. Max size =
  415. * ACTION_FRAME_SIZE - sizeof(this structure) - 1
  416. */
  417. } BWL_POST_PACKED_STRUCT;
  418. typedef struct wifi_p2p_action_frame wifi_p2p_action_frame_t;
  419. #define P2P_AF_CATEGORY 0x7f
  420. #define P2P_AF_FIXED_LEN 7
  421. /* WiFi P2P Action Frame OUI Subtypes */
  422. #define P2P_AF_NOTICE_OF_ABSENCE 0 /* Notice of Absence */
  423. #define P2P_AF_PRESENCE_REQ 1 /* P2P Presence Request */
  424. #define P2P_AF_PRESENCE_RSP 2 /* P2P Presence Response */
  425. #define P2P_AF_GO_DISC_REQ 3 /* GO Discoverability Request */
  426. /* WiFi P2P Public Action Frame */
  427. BWL_PRE_PACKED_STRUCT struct wifi_p2p_pub_act_frame {
  428. uint8 category; /* P2P_PUB_AF_CATEGORY */
  429. uint8 action; /* P2P_PUB_AF_ACTION */
  430. uint8 oui[3]; /* P2P_OUI */
  431. uint8 oui_type; /* OUI type - P2P_VER */
  432. uint8 subtype; /* OUI subtype - P2P_TYPE_* */
  433. uint8 dialog_token; /* nonzero, identifies req/rsp transaction */
  434. uint8 elts[1]; /* Variable length information elements. Max size =
  435. * ACTION_FRAME_SIZE - sizeof(this structure) - 1
  436. */
  437. } BWL_POST_PACKED_STRUCT;
  438. typedef struct wifi_p2p_pub_act_frame wifi_p2p_pub_act_frame_t;
  439. #define P2P_PUB_AF_FIXED_LEN 8
  440. #define P2P_PUB_AF_CATEGORY 0x04
  441. #define P2P_PUB_AF_ACTION 0x09
  442. /* WiFi P2P Public Action Frame OUI Subtypes */
  443. #define P2P_PAF_GON_REQ 0 /* Group Owner Negotiation Req */
  444. #define P2P_PAF_GON_RSP 1 /* Group Owner Negotiation Rsp */
  445. #define P2P_PAF_GON_CONF 2 /* Group Owner Negotiation Confirm */
  446. #define P2P_PAF_INVITE_REQ 3 /* P2P Invitation Request */
  447. #define P2P_PAF_INVITE_RSP 4 /* P2P Invitation Response */
  448. #define P2P_PAF_DEVDIS_REQ 5 /* Device Discoverability Request */
  449. #define P2P_PAF_DEVDIS_RSP 6 /* Device Discoverability Response */
  450. #define P2P_PAF_PROVDIS_REQ 7 /* Provision Discovery Request */
  451. #define P2P_PAF_PROVDIS_RSP 8 /* Provision Discovery Response */
  452. #define P2P_PAF_SUBTYPE_INVALID 255 /* Invalid Subtype */
  453. /* TODO: Stop using these obsolete aliases for P2P_PAF_GON_* */
  454. #define P2P_TYPE_MNREQ P2P_PAF_GON_REQ
  455. #define P2P_TYPE_MNRSP P2P_PAF_GON_RSP
  456. #define P2P_TYPE_MNCONF P2P_PAF_GON_CONF
  457. /* WiFi P2P IE subelement: Notice of Absence */
  458. BWL_PRE_PACKED_STRUCT struct wifi_p2p_noa_desc {
  459. uint8 cnt_type; /* Count/Type */
  460. uint32 duration; /* Duration */
  461. uint32 interval; /* Interval */
  462. uint32 start; /* Start Time */
  463. } BWL_POST_PACKED_STRUCT;
  464. typedef struct wifi_p2p_noa_desc wifi_p2p_noa_desc_t;
  465. BWL_PRE_PACKED_STRUCT struct wifi_p2p_noa_se {
  466. uint8 eltId; /* Subelement ID */
  467. uint8 len[2]; /* Length */
  468. uint8 index; /* Index */
  469. uint8 ops_ctw_parms; /* CTWindow and OppPS Parameters */
  470. wifi_p2p_noa_desc_t desc[1]; /* Notice of Absence Descriptor(s) */
  471. } BWL_POST_PACKED_STRUCT;
  472. typedef struct wifi_p2p_noa_se wifi_p2p_noa_se_t;
  473. #define P2P_NOA_SE_FIXED_LEN 5
  474. #define P2P_NOA_SE_MAX_DESC 2 /* max NoA descriptors in presence request */
  475. /* cnt_type field values */
  476. #define P2P_NOA_DESC_CNT_RESERVED 0 /* reserved and should not be used */
  477. #define P2P_NOA_DESC_CNT_REPEAT 255 /* continuous schedule */
  478. #define P2P_NOA_DESC_TYPE_PREFERRED 1 /* preferred values */
  479. #define P2P_NOA_DESC_TYPE_ACCEPTABLE 2 /* acceptable limits */
  480. /* ctw_ops_parms field values */
  481. #define P2P_NOA_CTW_MASK 0x7f
  482. #define P2P_NOA_OPS_MASK 0x80
  483. #define P2P_NOA_OPS_SHIFT 7
  484. #define P2P_CTW_MIN 10 /* minimum 10TU */
  485. /*
  486. * P2P Service Discovery related
  487. */
  488. #define P2PSD_ACTION_CATEGORY 0x04
  489. /* Public action frame */
  490. #define P2PSD_ACTION_ID_GAS_IREQ 0x0a
  491. /* Action value for GAS Initial Request AF */
  492. #define P2PSD_ACTION_ID_GAS_IRESP 0x0b
  493. /* Action value for GAS Initial Response AF */
  494. #define P2PSD_ACTION_ID_GAS_CREQ 0x0c
  495. /* Action value for GAS Comeback Request AF */
  496. #define P2PSD_ACTION_ID_GAS_CRESP 0x0d
  497. /* Action value for GAS Comeback Response AF */
  498. #define P2PSD_AD_EID 0x6c
  499. /* Advertisement Protocol IE ID */
  500. #define P2PSD_ADP_TUPLE_QLMT_PAMEBI 0x00
  501. /* Query Response Length Limit 7 bits plus PAME-BI 1 bit */
  502. #define P2PSD_ADP_PROTO_ID 0x00
  503. /* Advertisement Protocol ID. Always 0 for P2P SD */
  504. #define P2PSD_GAS_OUI P2P_OUI
  505. /* WFA OUI */
  506. #define P2PSD_GAS_OUI_SUBTYPE P2P_VER
  507. /* OUI Subtype for GAS IE */
  508. #define P2PSD_GAS_NQP_INFOID 0xDDDD
  509. /* NQP Query Info ID: 56797 */
  510. #define P2PSD_GAS_COMEBACKDEALY 0x00
  511. /* Not used in the Native GAS protocol */
  512. /* Service Protocol Type */
  513. typedef enum p2psd_svc_protype {
  514. SVC_RPOTYPE_ALL = 0,
  515. SVC_RPOTYPE_BONJOUR = 1,
  516. SVC_RPOTYPE_UPNP = 2,
  517. SVC_RPOTYPE_WSD = 3,
  518. SVC_RPOTYPE_WFDS = 11,
  519. SVC_RPOTYPE_VENDOR = 255
  520. } p2psd_svc_protype_t;
  521. /* Service Discovery response status code */
  522. typedef enum {
  523. P2PSD_RESP_STATUS_SUCCESS = 0,
  524. P2PSD_RESP_STATUS_PROTYPE_NA = 1,
  525. P2PSD_RESP_STATUS_DATA_NA = 2,
  526. P2PSD_RESP_STATUS_BAD_REQUEST = 3
  527. } p2psd_resp_status_t;
  528. /* Advertisement Protocol IE tuple field */
  529. BWL_PRE_PACKED_STRUCT struct wifi_p2psd_adp_tpl {
  530. uint8 llm_pamebi; /* Query Response Length Limit bit 0-6, set to 0 plus
  531. * Pre-Associated Message Exchange BSSID Independent bit 7, set to 0
  532. */
  533. uint8 adp_id; /* Advertisement Protocol ID: 0 for NQP Native Query Protocol */
  534. } BWL_POST_PACKED_STRUCT;
  535. typedef struct wifi_p2psd_adp_tpl wifi_p2psd_adp_tpl_t;
  536. /* Advertisement Protocol IE */
  537. BWL_PRE_PACKED_STRUCT struct wifi_p2psd_adp_ie {
  538. uint8 id; /* IE ID: 0x6c - 108 */
  539. uint8 len; /* IE length */
  540. wifi_p2psd_adp_tpl_t adp_tpl; /* Advertisement Protocol Tuple field. Only one
  541. * tuple is defined for P2P Service Discovery
  542. */
  543. } BWL_POST_PACKED_STRUCT;
  544. typedef struct wifi_p2psd_adp_ie wifi_p2psd_adp_ie_t;
  545. /* NQP Vendor-specific Content */
  546. BWL_PRE_PACKED_STRUCT struct wifi_p2psd_nqp_query_vsc {
  547. uint8 oui_subtype; /* OUI Subtype: 0x09 */
  548. uint16 svc_updi; /* Service Update Indicator */
  549. uint8 svc_tlvs[1]; /* wifi_p2psd_qreq_tlv_t type for service request,
  550. * wifi_p2psd_qresp_tlv_t type for service response
  551. */
  552. } BWL_POST_PACKED_STRUCT;
  553. typedef struct wifi_p2psd_nqp_query_vsc wifi_p2psd_nqp_query_vsc_t;
  554. /* Service Request TLV */
  555. BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qreq_tlv {
  556. uint16 len; /* Length: 5 plus size of Query Data */
  557. uint8 svc_prot; /* Service Protocol Type */
  558. uint8 svc_tscid; /* Service Transaction ID */
  559. uint8 query_data[1]; /* Query Data, passed in from above Layer 2 */
  560. } BWL_POST_PACKED_STRUCT;
  561. typedef struct wifi_p2psd_qreq_tlv wifi_p2psd_qreq_tlv_t;
  562. /* Query Request Frame, defined in generic format, instead of NQP specific */
  563. BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qreq_frame {
  564. uint16 info_id; /* Info ID: 0xDDDD */
  565. uint16 len; /* Length of service request TLV, 5 plus the size of request data */
  566. uint8 oui[3]; /* WFA OUI: 0x0050F2 */
  567. uint8 qreq_vsc[1]; /* Vendor-specific Content: wifi_p2psd_nqp_query_vsc_t type for NQP */
  568. } BWL_POST_PACKED_STRUCT;
  569. typedef struct wifi_p2psd_qreq_frame wifi_p2psd_qreq_frame_t;
  570. /* GAS Initial Request AF body, "elts" in wifi_p2p_pub_act_frame */
  571. BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_ireq_frame {
  572. wifi_p2psd_adp_ie_t adp_ie; /* Advertisement Protocol IE */
  573. uint16 qreq_len; /* Query Request Length */
  574. uint8 qreq_frm[1]; /* Query Request Frame wifi_p2psd_qreq_frame_t */
  575. } BWL_POST_PACKED_STRUCT;
  576. typedef struct wifi_p2psd_gas_ireq_frame wifi_p2psd_gas_ireq_frame_t;
  577. /* Service Response TLV */
  578. BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qresp_tlv {
  579. uint16 len; /* Length: 5 plus size of Query Data */
  580. uint8 svc_prot; /* Service Protocol Type */
  581. uint8 svc_tscid; /* Service Transaction ID */
  582. uint8 status; /* Value defined in Table 57 of P2P spec. */
  583. uint8 query_data[1]; /* Response Data, passed in from above Layer 2 */
  584. } BWL_POST_PACKED_STRUCT;
  585. typedef struct wifi_p2psd_qresp_tlv wifi_p2psd_qresp_tlv_t;
  586. /* Query Response Frame, defined in generic format, instead of NQP specific */
  587. BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qresp_frame {
  588. uint16 info_id; /* Info ID: 0xDDDD */
  589. uint16 len; /* Lenth of service response TLV, 6 plus the size of resp data */
  590. uint8 oui[3]; /* WFA OUI: 0x0050F2 */
  591. uint8 qresp_vsc[1]; /* Vendor-specific Content: wifi_p2psd_qresp_tlv_t type for NQP */
  592. } BWL_POST_PACKED_STRUCT;
  593. typedef struct wifi_p2psd_qresp_frame wifi_p2psd_qresp_frame_t;
  594. /* GAS Initial Response AF body, "elts" in wifi_p2p_pub_act_frame */
  595. BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_iresp_frame {
  596. uint16 status; /* Value defined in Table 7-23 of IEEE P802.11u */
  597. uint16 cb_delay; /* GAS Comeback Delay */
  598. wifi_p2psd_adp_ie_t adp_ie; /* Advertisement Protocol IE */
  599. uint16 qresp_len; /* Query Response Length */
  600. uint8 qresp_frm[1]; /* Query Response Frame wifi_p2psd_qresp_frame_t */
  601. } BWL_POST_PACKED_STRUCT;
  602. typedef struct wifi_p2psd_gas_iresp_frame wifi_p2psd_gas_iresp_frame_t;
  603. /* GAS Comeback Response AF body, "elts" in wifi_p2p_pub_act_frame */
  604. BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_cresp_frame {
  605. uint16 status; /* Value defined in Table 7-23 of IEEE P802.11u */
  606. uint8 fragment_id; /* Fragmentation ID */
  607. uint16 cb_delay; /* GAS Comeback Delay */
  608. wifi_p2psd_adp_ie_t adp_ie; /* Advertisement Protocol IE */
  609. uint16 qresp_len; /* Query Response Length */
  610. uint8 qresp_frm[1]; /* Query Response Frame wifi_p2psd_qresp_frame_t */
  611. } BWL_POST_PACKED_STRUCT;
  612. typedef struct wifi_p2psd_gas_cresp_frame wifi_p2psd_gas_cresp_frame_t;
  613. /* Wi-Fi GAS Public Action Frame */
  614. BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_pub_act_frame {
  615. uint8 category; /* 0x04 Public Action Frame */
  616. uint8 action; /* 0x6c Advertisement Protocol */
  617. uint8 dialog_token; /* nonzero, identifies req/rsp transaction */
  618. uint8 query_data[1]; /* Query Data. wifi_p2psd_gas_ireq_frame_t
  619. * or wifi_p2psd_gas_iresp_frame_t format
  620. */
  621. } BWL_POST_PACKED_STRUCT;
  622. typedef struct wifi_p2psd_gas_pub_act_frame wifi_p2psd_gas_pub_act_frame_t;
  623. /* This marks the end of a packed structure section. */
  624. #include <packed_section_end.h>
  625. #endif /* _P2P_H_ */