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