1 /* 2 * Copyright (C) 1999-2013, Broadcom Corporation 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 * 16 * Fundamental types and constants relating to WFA P2P (aka WiFi Direct) 17 * 18 * $Id: p2p.h 384536 2013-02-12 04:13:09Z $ 19 */ 20 21 #ifndef _P2P_H_ 22 #define _P2P_H_ 23 24 #ifndef _TYPEDEFS_H_ 25 #include <typedefs.h> 26 #endif 27 #include <wlioctl.h> 28 #include <proto/802.11.h> 29 30 /* This marks the start of a packed structure section. */ 31 #include <packed_section_start.h> 32 33 34 /* WiFi P2P OUI values */ 35 #define P2P_OUI WFA_OUI /* WiFi P2P OUI */ 36 #define P2P_VER WFA_OUI_TYPE_P2P /* P2P version: 9=WiFi P2P v1.0 */ 37 38 #define P2P_IE_ID 0xdd /* P2P IE element ID */ 39 40 /* WiFi P2P IE */ 41 BWL_PRE_PACKED_STRUCT struct wifi_p2p_ie { 42 uint8 id; /* IE ID: 0xDD */ 43 uint8 len; /* IE length */ 44 uint8 OUI[3]; /* WiFi P2P specific OUI: P2P_OUI */ 45 uint8 oui_type; /* Identifies P2P version: P2P_VER */ 46 uint8 subelts[1]; /* variable length subelements */ 47 } BWL_POST_PACKED_STRUCT; 48 typedef struct wifi_p2p_ie wifi_p2p_ie_t; 49 50 #define P2P_IE_FIXED_LEN 6 51 52 #define P2P_ATTR_ID_OFF 0 53 #define P2P_ATTR_LEN_OFF 1 54 #define P2P_ATTR_DATA_OFF 3 55 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 60 /* P2P IE Subelement IDs from WiFi P2P Technical Spec 1.00 */ 61 #define P2P_SEID_STATUS 0 /* Status */ 62 #define P2P_SEID_MINOR_RC 1 /* Minor Reason Code */ 63 #define P2P_SEID_P2P_INFO 2 /* P2P Capability (capabilities info) */ 64 #define P2P_SEID_DEV_ID 3 /* P2P Device ID */ 65 #define P2P_SEID_INTENT 4 /* Group Owner Intent */ 66 #define P2P_SEID_CFG_TIMEOUT 5 /* Configuration Timeout */ 67 #define P2P_SEID_CHANNEL 6 /* Listen channel */ 68 #define P2P_SEID_GRP_BSSID 7 /* P2P Group BSSID */ 69 #define P2P_SEID_XT_TIMING 8 /* Extended Listen Timing */ 70 #define P2P_SEID_INTINTADDR 9 /* Intended P2P Interface Address */ 71 #define P2P_SEID_P2P_MGBTY 10 /* P2P Manageability */ 72 #define P2P_SEID_CHAN_LIST 11 /* Channel List */ 73 #define P2P_SEID_ABSENCE 12 /* Notice of Absence */ 74 #define P2P_SEID_DEV_INFO 13 /* Device Info */ 75 #define P2P_SEID_GROUP_INFO 14 /* Group Info */ 76 #define P2P_SEID_GROUP_ID 15 /* Group ID */ 77 #define P2P_SEID_P2P_IF 16 /* P2P Interface */ 78 #define P2P_SEID_OP_CHANNEL 17 /* Operating Channel */ 79 #define P2P_SEID_INVITE_FLAGS 18 /* Invitation Flags */ 80 #define P2P_SEID_VNDR 221 /* Vendor-specific subelement */ 81 82 #define P2P_SE_VS_ID_SERVICES 0x1b /* BRCM proprietary subel: L2 Services */ 83 84 85 /* WiFi P2P IE subelement: P2P Capability (capabilities info) */ 86 BWL_PRE_PACKED_STRUCT struct wifi_p2p_info_se_s { 87 uint8 eltId; /* SE ID: P2P_SEID_P2P_INFO */ 88 uint8 len[2]; /* SE length not including eltId, len fields */ 89 uint8 dev; /* Device Capability Bitmap */ 90 uint8 group; /* Group Capability Bitmap */ 91 } BWL_POST_PACKED_STRUCT; 92 typedef struct wifi_p2p_info_se_s wifi_p2p_info_se_t; 93 94 /* P2P Capability subelement's Device Capability Bitmap bit values */ 95 #define P2P_CAPSE_DEV_SERVICE_DIS 0x1 /* Service Discovery */ 96 #define P2P_CAPSE_DEV_CLIENT_DIS 0x2 /* Client Discoverability */ 97 #define P2P_CAPSE_DEV_CONCURRENT 0x4 /* Concurrent Operation */ 98 #define P2P_CAPSE_DEV_INFRA_MAN 0x8 /* P2P Infrastructure Managed */ 99 #define P2P_CAPSE_DEV_LIMIT 0x10 /* P2P Device Limit */ 100 #define P2P_CAPSE_INVITE_PROC 0x20 /* P2P Invitation Procedure */ 101 102 /* P2P Capability subelement's Group Capability Bitmap bit values */ 103 #define P2P_CAPSE_GRP_OWNER 0x1 /* P2P Group Owner */ 104 #define P2P_CAPSE_PERSIST_GRP 0x2 /* Persistent P2P Group */ 105 #define P2P_CAPSE_GRP_LIMIT 0x4 /* P2P Group Limit */ 106 #define P2P_CAPSE_GRP_INTRA_BSS 0x8 /* Intra-BSS Distribution */ 107 #define P2P_CAPSE_GRP_X_CONNECT 0x10 /* Cross Connection */ 108 #define P2P_CAPSE_GRP_PERSISTENT 0x20 /* Persistent Reconnect */ 109 #define P2P_CAPSE_GRP_FORMATION 0x40 /* Group Formation */ 110 111 112 /* WiFi P2P IE subelement: Group Owner Intent */ 113 BWL_PRE_PACKED_STRUCT struct wifi_p2p_intent_se_s { 114 uint8 eltId; /* SE ID: P2P_SEID_INTENT */ 115 uint8 len[2]; /* SE length not including eltId, len fields */ 116 uint8 intent; /* Intent Value 0...15 (0=legacy 15=master only) */ 117 } BWL_POST_PACKED_STRUCT; 118 typedef struct wifi_p2p_intent_se_s wifi_p2p_intent_se_t; 119 120 /* WiFi P2P IE subelement: Configuration Timeout */ 121 BWL_PRE_PACKED_STRUCT struct wifi_p2p_cfg_tmo_se_s { 122 uint8 eltId; /* SE ID: P2P_SEID_CFG_TIMEOUT */ 123 uint8 len[2]; /* SE length not including eltId, len fields */ 124 uint8 go_tmo; /* GO config timeout in units of 10 ms */ 125 uint8 client_tmo; /* Client config timeout in units of 10 ms */ 126 } BWL_POST_PACKED_STRUCT; 127 typedef struct wifi_p2p_cfg_tmo_se_s wifi_p2p_cfg_tmo_se_t; 128 129 /* WiFi P2P IE subelement: Listen Channel */ 130 BWL_PRE_PACKED_STRUCT struct wifi_p2p_listen_channel_se_s { 131 uint8 eltId; /* SE ID: P2P_SEID_CHANNEL */ 132 uint8 len[2]; /* SE length not including eltId, len fields */ 133 uint8 country[3]; /* Country String */ 134 uint8 op_class; /* Operating Class */ 135 uint8 channel; /* Channel */ 136 } BWL_POST_PACKED_STRUCT; 137 typedef struct wifi_p2p_listen_channel_se_s wifi_p2p_listen_channel_se_t; 138 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 147 /* WiFi P2P IE subelement: P2P Group ID */ 148 BWL_PRE_PACKED_STRUCT struct wifi_p2p_grp_id_se_s { 149 uint8 eltId; /* SE ID: P2P_SEID_GROUP_ID */ 150 uint8 len[2]; /* SE length not including eltId, len fields */ 151 uint8 mac[6]; /* P2P device address */ 152 uint8 ssid[1]; /* ssid. device id. variable length */ 153 } BWL_POST_PACKED_STRUCT; 154 typedef struct wifi_p2p_grp_id_se_s wifi_p2p_grp_id_se_t; 155 156 /* WiFi P2P IE subelement: P2P Interface */ 157 BWL_PRE_PACKED_STRUCT struct wifi_p2p_intf_se_s { 158 uint8 eltId; /* SE ID: P2P_SEID_P2P_IF */ 159 uint8 len[2]; /* SE length not including eltId, len fields */ 160 uint8 mac[6]; /* P2P device address */ 161 uint8 ifaddrs; /* P2P Interface Address count */ 162 uint8 ifaddr[1][6]; /* P2P Interface Address list */ 163 } BWL_POST_PACKED_STRUCT; 164 typedef struct wifi_p2p_intf_se_s wifi_p2p_intf_se_t; 165 166 /* WiFi P2P IE subelement: Status */ 167 BWL_PRE_PACKED_STRUCT struct wifi_p2p_status_se_s { 168 uint8 eltId; /* SE ID: P2P_SEID_STATUS */ 169 uint8 len[2]; /* SE length not including eltId, len fields */ 170 uint8 status; /* Status Code: P2P_STATSE_* */ 171 } BWL_POST_PACKED_STRUCT; 172 typedef struct wifi_p2p_status_se_s wifi_p2p_status_se_t; 173 174 /* Status subelement Status Code definitions */ 175 #define P2P_STATSE_SUCCESS 0 176 /* Success */ 177 #define P2P_STATSE_FAIL_INFO_CURR_UNAVAIL 1 178 /* Failed, information currently unavailable */ 179 #define P2P_STATSE_PASSED_UP P2P_STATSE_FAIL_INFO_CURR_UNAVAIL 180 /* Old name for above in P2P spec 1.08 and older */ 181 #define P2P_STATSE_FAIL_INCOMPAT_PARAMS 2 182 /* Failed, incompatible parameters */ 183 #define P2P_STATSE_FAIL_LIMIT_REACHED 3 184 /* Failed, limit reached */ 185 #define P2P_STATSE_FAIL_INVALID_PARAMS 4 186 /* Failed, invalid parameters */ 187 #define P2P_STATSE_FAIL_UNABLE_TO_ACCOM 5 188 /* Failed, unable to accomodate request */ 189 #define P2P_STATSE_FAIL_PROTO_ERROR 6 190 /* Failed, previous protocol error or disruptive behaviour */ 191 #define P2P_STATSE_FAIL_NO_COMMON_CHAN 7 192 /* Failed, no common channels */ 193 #define P2P_STATSE_FAIL_UNKNOWN_GROUP 8 194 /* Failed, unknown P2P Group */ 195 #define P2P_STATSE_FAIL_INTENT 9 196 /* Failed, both peers indicated Intent 15 in GO Negotiation */ 197 #define P2P_STATSE_FAIL_INCOMPAT_PROVIS 10 198 /* Failed, incompatible provisioning method */ 199 #define P2P_STATSE_FAIL_USER_REJECT 11 200 /* Failed, rejected by user */ 201 202 /* WiFi P2P IE attribute: Extended Listen Timing */ 203 BWL_PRE_PACKED_STRUCT struct wifi_p2p_ext_se_s { 204 uint8 eltId; /* ID: P2P_SEID_EXT_TIMING */ 205 uint8 len[2]; /* length not including eltId, len fields */ 206 uint8 avail[2]; /* availibility period */ 207 uint8 interval[2]; /* availibility interval */ 208 } BWL_POST_PACKED_STRUCT; 209 typedef struct wifi_p2p_ext_se_s wifi_p2p_ext_se_t; 210 211 #define P2P_EXT_MIN 10 /* minimum 10ms */ 212 213 /* WiFi P2P IE subelement: Intended P2P Interface Address */ 214 BWL_PRE_PACKED_STRUCT struct wifi_p2p_intintad_se_s { 215 uint8 eltId; /* SE ID: P2P_SEID_INTINTADDR */ 216 uint8 len[2]; /* SE length not including eltId, len fields */ 217 uint8 mac[6]; /* intended P2P interface MAC address */ 218 } BWL_POST_PACKED_STRUCT; 219 typedef struct wifi_p2p_intintad_se_s wifi_p2p_intintad_se_t; 220 221 /* WiFi P2P IE subelement: Channel */ 222 BWL_PRE_PACKED_STRUCT struct wifi_p2p_channel_se_s { 223 uint8 eltId; /* SE ID: P2P_SEID_STATUS */ 224 uint8 len[2]; /* SE length not including eltId, len fields */ 225 uint8 band; /* Regulatory Class (band) */ 226 uint8 channel; /* Channel */ 227 } BWL_POST_PACKED_STRUCT; 228 typedef struct wifi_p2p_channel_se_s wifi_p2p_channel_se_t; 229 230 231 /* Channel Entry structure within the Channel List SE */ 232 BWL_PRE_PACKED_STRUCT struct wifi_p2p_chanlist_entry_s { 233 uint8 band; /* Regulatory Class (band) */ 234 uint8 num_channels; /* # of channels in the channel list */ 235 uint8 channels[WL_NUMCHANNELS]; /* Channel List */ 236 } BWL_POST_PACKED_STRUCT; 237 typedef struct wifi_p2p_chanlist_entry_s wifi_p2p_chanlist_entry_t; 238 #define WIFI_P2P_CHANLIST_SE_MAX_ENTRIES 2 239 240 /* WiFi P2P IE subelement: Channel List */ 241 BWL_PRE_PACKED_STRUCT struct wifi_p2p_chanlist_se_s { 242 uint8 eltId; /* SE ID: P2P_SEID_CHAN_LIST */ 243 uint8 len[2]; /* SE length not including eltId, len fields */ 244 uint8 country[3]; /* Country String */ 245 uint8 num_entries; /* # of channel entries */ 246 wifi_p2p_chanlist_entry_t entries[WIFI_P2P_CHANLIST_SE_MAX_ENTRIES]; 247 /* Channel Entry List */ 248 } BWL_POST_PACKED_STRUCT; 249 typedef struct wifi_p2p_chanlist_se_s wifi_p2p_chanlist_se_t; 250 251 /* WiFi Primary Device Type structure */ 252 BWL_PRE_PACKED_STRUCT struct wifi_p2p_pri_devtype_s { 253 uint16 cat_id; /* Category ID */ 254 uint8 OUI[3]; /* WFA OUI: 0x0050F2 */ 255 uint8 oui_type; /* WPS_OUI_TYPE */ 256 uint16 sub_cat_id; /* Sub Category ID */ 257 } BWL_POST_PACKED_STRUCT; 258 typedef struct wifi_p2p_pri_devtype_s wifi_p2p_pri_devtype_t; 259 260 /* WiFi P2P IE's Device Info subelement */ 261 BWL_PRE_PACKED_STRUCT struct wifi_p2p_devinfo_se_s { 262 uint8 eltId; /* SE ID: P2P_SEID_DEVINFO */ 263 uint8 len[2]; /* SE length not including eltId, len fields */ 264 uint8 mac[6]; /* P2P Device MAC address */ 265 uint16 wps_cfg_meths; /* Config Methods: reg_prototlv.h WPS_CONFMET_* */ 266 uint8 pri_devtype[8]; /* Primary Device Type */ 267 } BWL_POST_PACKED_STRUCT; 268 typedef struct wifi_p2p_devinfo_se_s wifi_p2p_devinfo_se_t; 269 270 #define P2P_DEV_TYPE_LEN 8 271 272 /* WiFi P2P IE's Group Info subelement Client Info Descriptor */ 273 BWL_PRE_PACKED_STRUCT struct wifi_p2p_cid_fixed_s { 274 uint8 len; 275 uint8 devaddr[ETHER_ADDR_LEN]; /* P2P Device Address */ 276 uint8 ifaddr[ETHER_ADDR_LEN]; /* P2P Interface Address */ 277 uint8 devcap; /* Device Capability */ 278 uint8 cfg_meths[2]; /* Config Methods: reg_prototlv.h WPS_CONFMET_* */ 279 uint8 pridt[P2P_DEV_TYPE_LEN]; /* Primary Device Type */ 280 uint8 secdts; /* Number of Secondary Device Types */ 281 } BWL_POST_PACKED_STRUCT; 282 typedef struct wifi_p2p_cid_fixed_s wifi_p2p_cid_fixed_t; 283 284 /* WiFi P2P IE's Device ID subelement */ 285 BWL_PRE_PACKED_STRUCT struct wifi_p2p_devid_se_s { 286 uint8 eltId; 287 uint8 len[2]; 288 struct ether_addr addr; /* P2P Device MAC address */ 289 } BWL_POST_PACKED_STRUCT; 290 typedef struct wifi_p2p_devid_se_s wifi_p2p_devid_se_t; 291 292 /* WiFi P2P IE subelement: P2P Manageability */ 293 BWL_PRE_PACKED_STRUCT struct wifi_p2p_mgbt_se_s { 294 uint8 eltId; /* SE ID: P2P_SEID_P2P_MGBTY */ 295 uint8 len[2]; /* SE length not including eltId, len fields */ 296 uint8 mg_bitmap; /* manageability bitmap */ 297 } BWL_POST_PACKED_STRUCT; 298 typedef struct wifi_p2p_mgbt_se_s wifi_p2p_mgbt_se_t; 299 /* mg_bitmap field bit values */ 300 #define P2P_MGBTSE_P2PDEVMGMT_FLAG 0x1 /* AP supports Managed P2P Device */ 301 302 /* WiFi P2P IE subelement: Group Info */ 303 BWL_PRE_PACKED_STRUCT struct wifi_p2p_grpinfo_se_s { 304 uint8 eltId; /* SE ID: P2P_SEID_GROUP_INFO */ 305 uint8 len[2]; /* SE length not including eltId, len fields */ 306 } BWL_POST_PACKED_STRUCT; 307 typedef struct wifi_p2p_grpinfo_se_s wifi_p2p_grpinfo_se_t; 308 309 /* WiFi IE subelement: Operating Channel */ 310 BWL_PRE_PACKED_STRUCT struct wifi_p2p_op_channel_se_s { 311 uint8 eltId; /* SE ID: P2P_SEID_OP_CHANNEL */ 312 uint8 len[2]; /* SE length not including eltId, len fields */ 313 uint8 country[3]; /* Country String */ 314 uint8 op_class; /* Operating Class */ 315 uint8 channel; /* Channel */ 316 } BWL_POST_PACKED_STRUCT; 317 typedef struct wifi_p2p_op_channel_se_s wifi_p2p_op_channel_se_t; 318 319 /* WiFi IE subelement: INVITATION FLAGS */ 320 BWL_PRE_PACKED_STRUCT struct wifi_p2p_invite_flags_se_s { 321 uint8 eltId; /* SE ID: P2P_SEID_INVITE_FLAGS */ 322 uint8 len[2]; /* SE length not including eltId, len fields */ 323 uint8 flags; /* Flags */ 324 } BWL_POST_PACKED_STRUCT; 325 typedef struct wifi_p2p_invite_flags_se_s wifi_p2p_invite_flags_se_t; 326 327 /* WiFi P2P Action Frame */ 328 BWL_PRE_PACKED_STRUCT struct wifi_p2p_action_frame { 329 uint8 category; /* P2P_AF_CATEGORY */ 330 uint8 OUI[3]; /* OUI - P2P_OUI */ 331 uint8 type; /* OUI Type - P2P_VER */ 332 uint8 subtype; /* OUI Subtype - P2P_AF_* */ 333 uint8 dialog_token; /* nonzero, identifies req/resp tranaction */ 334 uint8 elts[1]; /* Variable length information elements. Max size = 335 * ACTION_FRAME_SIZE - sizeof(this structure) - 1 336 */ 337 } BWL_POST_PACKED_STRUCT; 338 typedef struct wifi_p2p_action_frame wifi_p2p_action_frame_t; 339 #define P2P_AF_CATEGORY 0x7f 340 341 #define P2P_AF_FIXED_LEN 7 342 343 /* WiFi P2P Action Frame OUI Subtypes */ 344 #define P2P_AF_NOTICE_OF_ABSENCE 0 /* Notice of Absence */ 345 #define P2P_AF_PRESENCE_REQ 1 /* P2P Presence Request */ 346 #define P2P_AF_PRESENCE_RSP 2 /* P2P Presence Response */ 347 #define P2P_AF_GO_DISC_REQ 3 /* GO Discoverability Request */ 348 349 350 /* WiFi P2P Public Action Frame */ 351 BWL_PRE_PACKED_STRUCT struct wifi_p2p_pub_act_frame { 352 uint8 category; /* P2P_PUB_AF_CATEGORY */ 353 uint8 action; /* P2P_PUB_AF_ACTION */ 354 uint8 oui[3]; /* P2P_OUI */ 355 uint8 oui_type; /* OUI type - P2P_VER */ 356 uint8 subtype; /* OUI subtype - P2P_TYPE_* */ 357 uint8 dialog_token; /* nonzero, identifies req/rsp transaction */ 358 uint8 elts[1]; /* Variable length information elements. Max size = 359 * ACTION_FRAME_SIZE - sizeof(this structure) - 1 360 */ 361 } BWL_POST_PACKED_STRUCT; 362 typedef struct wifi_p2p_pub_act_frame wifi_p2p_pub_act_frame_t; 363 #define P2P_PUB_AF_FIXED_LEN 8 364 #define P2P_PUB_AF_CATEGORY 0x04 365 #define P2P_PUB_AF_ACTION 0x09 366 367 /* WiFi P2P Public Action Frame OUI Subtypes */ 368 #define P2P_PAF_GON_REQ 0 /* Group Owner Negotiation Req */ 369 #define P2P_PAF_GON_RSP 1 /* Group Owner Negotiation Rsp */ 370 #define P2P_PAF_GON_CONF 2 /* Group Owner Negotiation Confirm */ 371 #define P2P_PAF_INVITE_REQ 3 /* P2P Invitation Request */ 372 #define P2P_PAF_INVITE_RSP 4 /* P2P Invitation Response */ 373 #define P2P_PAF_DEVDIS_REQ 5 /* Device Discoverability Request */ 374 #define P2P_PAF_DEVDIS_RSP 6 /* Device Discoverability Response */ 375 #define P2P_PAF_PROVDIS_REQ 7 /* Provision Discovery Request */ 376 #define P2P_PAF_PROVDIS_RSP 8 /* Provision Discovery Response */ 377 #define P2P_PAF_SUBTYPE_INVALID 255 /* Invalid Subtype */ 378 379 /* TODO: Stop using these obsolete aliases for P2P_PAF_GON_* */ 380 #define P2P_TYPE_MNREQ P2P_PAF_GON_REQ 381 #define P2P_TYPE_MNRSP P2P_PAF_GON_RSP 382 #define P2P_TYPE_MNCONF P2P_PAF_GON_CONF 383 384 /* WiFi P2P IE subelement: Notice of Absence */ 385 BWL_PRE_PACKED_STRUCT struct wifi_p2p_noa_desc { 386 uint8 cnt_type; /* Count/Type */ 387 uint32 duration; /* Duration */ 388 uint32 interval; /* Interval */ 389 uint32 start; /* Start Time */ 390 } BWL_POST_PACKED_STRUCT; 391 typedef struct wifi_p2p_noa_desc wifi_p2p_noa_desc_t; 392 393 BWL_PRE_PACKED_STRUCT struct wifi_p2p_noa_se { 394 uint8 eltId; /* Subelement ID */ 395 uint8 len[2]; /* Length */ 396 uint8 index; /* Index */ 397 uint8 ops_ctw_parms; /* CTWindow and OppPS Parameters */ 398 wifi_p2p_noa_desc_t desc[1]; /* Notice of Absence Descriptor(s) */ 399 } BWL_POST_PACKED_STRUCT; 400 typedef struct wifi_p2p_noa_se wifi_p2p_noa_se_t; 401 402 #define P2P_NOA_SE_FIXED_LEN 5 403 404 #define P2P_NOA_SE_MAX_DESC 2 /* max NoA descriptors in presence request */ 405 406 /* cnt_type field values */ 407 #define P2P_NOA_DESC_CNT_RESERVED 0 /* reserved and should not be used */ 408 #define P2P_NOA_DESC_CNT_REPEAT 255 /* continuous schedule */ 409 #define P2P_NOA_DESC_TYPE_PREFERRED 1 /* preferred values */ 410 #define P2P_NOA_DESC_TYPE_ACCEPTABLE 2 /* acceptable limits */ 411 412 /* ctw_ops_parms field values */ 413 #define P2P_NOA_CTW_MASK 0x7f 414 #define P2P_NOA_OPS_MASK 0x80 415 #define P2P_NOA_OPS_SHIFT 7 416 417 #define P2P_CTW_MIN 10 /* minimum 10TU */ 418 419 /* 420 * P2P Service Discovery related 421 */ 422 #define P2PSD_ACTION_CATEGORY 0x04 423 /* Public action frame */ 424 #define P2PSD_ACTION_ID_GAS_IREQ 0x0a 425 /* Action value for GAS Initial Request AF */ 426 #define P2PSD_ACTION_ID_GAS_IRESP 0x0b 427 /* Action value for GAS Initial Response AF */ 428 #define P2PSD_ACTION_ID_GAS_CREQ 0x0c 429 /* Action value for GAS Comback Request AF */ 430 #define P2PSD_ACTION_ID_GAS_CRESP 0x0d 431 /* Action value for GAS Comback Response AF */ 432 #define P2PSD_AD_EID 0x6c 433 /* Advertisement Protocol IE ID */ 434 #define P2PSD_ADP_TUPLE_QLMT_PAMEBI 0x00 435 /* Query Response Length Limit 7 bits plus PAME-BI 1 bit */ 436 #define P2PSD_ADP_PROTO_ID 0x00 437 /* Advertisement Protocol ID. Always 0 for P2P SD */ 438 #define P2PSD_GAS_OUI P2P_OUI 439 /* WFA OUI */ 440 #define P2PSD_GAS_OUI_SUBTYPE P2P_VER 441 /* OUI Subtype for GAS IE */ 442 #define P2PSD_GAS_NQP_INFOID 0xDDDD 443 /* NQP Query Info ID: 56797 */ 444 #define P2PSD_GAS_COMEBACKDEALY 0x00 445 /* Not used in the Native GAS protocol */ 446 447 /* Service Protocol Type */ 448 typedef enum p2psd_svc_protype { 449 SVC_RPOTYPE_ALL = 0, 450 SVC_RPOTYPE_BONJOUR = 1, 451 SVC_RPOTYPE_UPNP = 2, 452 SVC_RPOTYPE_WSD = 3, 453 SVC_RPOTYPE_VENDOR = 255 454 } p2psd_svc_protype_t; 455 456 /* Service Discovery response status code */ 457 typedef enum { 458 P2PSD_RESP_STATUS_SUCCESS = 0, 459 P2PSD_RESP_STATUS_PROTYPE_NA = 1, 460 P2PSD_RESP_STATUS_DATA_NA = 2, 461 P2PSD_RESP_STATUS_BAD_REQUEST = 3 462 } p2psd_resp_status_t; 463 464 /* Advertisement Protocol IE tuple field */ 465 BWL_PRE_PACKED_STRUCT struct wifi_p2psd_adp_tpl { 466 uint8 llm_pamebi; /* Query Response Length Limit bit 0-6, set to 0 plus 467 * Pre-Associated Message Exchange BSSID Independent bit 7, set to 0 468 */ 469 uint8 adp_id; /* Advertisement Protocol ID: 0 for NQP Native Query Protocol */ 470 } BWL_POST_PACKED_STRUCT; 471 typedef struct wifi_p2psd_adp_tpl wifi_p2psd_adp_tpl_t; 472 473 /* Advertisement Protocol IE */ 474 BWL_PRE_PACKED_STRUCT struct wifi_p2psd_adp_ie { 475 uint8 id; /* IE ID: 0x6c - 108 */ 476 uint8 len; /* IE length */ 477 wifi_p2psd_adp_tpl_t adp_tpl; /* Advertisement Protocol Tuple field. Only one 478 * tuple is defined for P2P Service Discovery 479 */ 480 } BWL_POST_PACKED_STRUCT; 481 typedef struct wifi_p2psd_adp_ie wifi_p2psd_adp_ie_t; 482 483 /* NQP Vendor-specific Content */ 484 BWL_PRE_PACKED_STRUCT struct wifi_p2psd_nqp_query_vsc { 485 uint8 oui_subtype; /* OUI Subtype: 0x09 */ 486 uint16 svc_updi; /* Service Update Indicator */ 487 uint8 svc_tlvs[1]; /* wifi_p2psd_qreq_tlv_t type for service request, 488 * wifi_p2psd_qresp_tlv_t type for service response 489 */ 490 } BWL_POST_PACKED_STRUCT; 491 typedef struct wifi_p2psd_nqp_query_vsc wifi_p2psd_nqp_query_vsc_t; 492 493 /* Service Request TLV */ 494 BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qreq_tlv { 495 uint16 len; /* Length: 5 plus size of Query Data */ 496 uint8 svc_prot; /* Service Protocol Type */ 497 uint8 svc_tscid; /* Service Transaction ID */ 498 uint8 query_data[1]; /* Query Data, passed in from above Layer 2 */ 499 } BWL_POST_PACKED_STRUCT; 500 typedef struct wifi_p2psd_qreq_tlv wifi_p2psd_qreq_tlv_t; 501 502 /* Query Request Frame, defined in generic format, instead of NQP specific */ 503 BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qreq_frame { 504 uint16 info_id; /* Info ID: 0xDDDD */ 505 uint16 len; /* Length of service request TLV, 5 plus the size of request data */ 506 uint8 oui[3]; /* WFA OUI: 0x0050F2 */ 507 uint8 qreq_vsc[1]; /* Vendor-specific Content: wifi_p2psd_nqp_query_vsc_t type for NQP */ 508 509 } BWL_POST_PACKED_STRUCT; 510 typedef struct wifi_p2psd_qreq_frame wifi_p2psd_qreq_frame_t; 511 512 /* GAS Initial Request AF body, "elts" in wifi_p2p_pub_act_frame */ 513 BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_ireq_frame { 514 wifi_p2psd_adp_ie_t adp_ie; /* Advertisement Protocol IE */ 515 uint16 qreq_len; /* Query Request Length */ 516 uint8 qreq_frm[1]; /* Query Request Frame wifi_p2psd_qreq_frame_t */ 517 } BWL_POST_PACKED_STRUCT; 518 typedef struct wifi_p2psd_gas_ireq_frame wifi_p2psd_gas_ireq_frame_t; 519 520 /* Service Response TLV */ 521 BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qresp_tlv { 522 uint16 len; /* Length: 5 plus size of Query Data */ 523 uint8 svc_prot; /* Service Protocol Type */ 524 uint8 svc_tscid; /* Service Transaction ID */ 525 uint8 status; /* Value defined in Table 57 of P2P spec. */ 526 uint8 query_data[1]; /* Response Data, passed in from above Layer 2 */ 527 } BWL_POST_PACKED_STRUCT; 528 typedef struct wifi_p2psd_qresp_tlv wifi_p2psd_qresp_tlv_t; 529 530 /* Query Response Frame, defined in generic format, instead of NQP specific */ 531 BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qresp_frame { 532 uint16 info_id; /* Info ID: 0xDDDD */ 533 uint16 len; /* Lenth of service response TLV, 6 plus the size of resp data */ 534 uint8 oui[3]; /* WFA OUI: 0x0050F2 */ 535 uint8 qresp_vsc[1]; /* Vendor-specific Content: wifi_p2psd_qresp_tlv_t type for NQP */ 536 537 } BWL_POST_PACKED_STRUCT; 538 typedef struct wifi_p2psd_qresp_frame wifi_p2psd_qresp_frame_t; 539 540 /* GAS Initial Response AF body, "elts" in wifi_p2p_pub_act_frame */ 541 BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_iresp_frame { 542 uint16 status; /* Value defined in Table 7-23 of IEEE P802.11u */ 543 uint16 cb_delay; /* GAS Comeback Delay */ 544 wifi_p2psd_adp_ie_t adp_ie; /* Advertisement Protocol IE */ 545 uint16 qresp_len; /* Query Response Length */ 546 uint8 qresp_frm[1]; /* Query Response Frame wifi_p2psd_qresp_frame_t */ 547 } BWL_POST_PACKED_STRUCT; 548 typedef struct wifi_p2psd_gas_iresp_frame wifi_p2psd_gas_iresp_frame_t; 549 550 /* GAS Comeback Response AF body, "elts" in wifi_p2p_pub_act_frame */ 551 BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_cresp_frame { 552 uint16 status; /* Value defined in Table 7-23 of IEEE P802.11u */ 553 uint8 fragment_id; /* Fragmentation ID */ 554 uint16 cb_delay; /* GAS Comeback Delay */ 555 wifi_p2psd_adp_ie_t adp_ie; /* Advertisement Protocol IE */ 556 uint16 qresp_len; /* Query Response Length */ 557 uint8 qresp_frm[1]; /* Query Response Frame wifi_p2psd_qresp_frame_t */ 558 } BWL_POST_PACKED_STRUCT; 559 typedef struct wifi_p2psd_gas_cresp_frame wifi_p2psd_gas_cresp_frame_t; 560 561 /* Wi-Fi GAS Public Action Frame */ 562 BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_pub_act_frame { 563 uint8 category; /* 0x04 Public Action Frame */ 564 uint8 action; /* 0x6c Advertisement Protocol */ 565 uint8 dialog_token; /* nonzero, identifies req/rsp transaction */ 566 uint8 query_data[1]; /* Query Data. wifi_p2psd_gas_ireq_frame_t 567 * or wifi_p2psd_gas_iresp_frame_t format 568 */ 569 } BWL_POST_PACKED_STRUCT; 570 typedef struct wifi_p2psd_gas_pub_act_frame wifi_p2psd_gas_pub_act_frame_t; 571 572 /* This marks the end of a packed structure section. */ 573 #include <packed_section_end.h> 574 575 #endif /* _P2P_H_ */ 576