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