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