p2p_mac.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. /*
  2. ** Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/include/nic/p2p_mac.h#2
  3. */
  4. /*! \file "p2p_mac.h"
  5. * \brief Brief description.
  6. *
  7. * Detail description.
  8. */
  9. #ifndef _P2P_MAC_H
  10. #define _P2P_MAC_H
  11. /*******************************************************************************
  12. * C O M P I L E R F L A G S
  13. ********************************************************************************
  14. */
  15. /*******************************************************************************
  16. * E X T E R N A L R E F E R E N C E S
  17. ********************************************************************************
  18. */
  19. /*******************************************************************************
  20. * C O N S T A N T S
  21. ********************************************************************************
  22. */
  23. #define ACTION_PUBLIC_WIFI_DIRECT 9
  24. #define ACTION_GAS_INITIAL_REQUEST 10
  25. #define ACTION_GAS_INITIAL_RESPONSE 11
  26. #define ACTION_GAS_COMEBACK_REQUEST 12
  27. #define ACTION_GAS_COMEBACK_RESPONSE 13
  28. /* P2P 4.2.8.1 - P2P Public Action Frame Type. */
  29. #define P2P_PUBLIC_ACTION_GO_NEGO_REQ 0
  30. #define P2P_PUBLIC_ACTION_GO_NEGO_RSP 1
  31. #define P2P_PUBLIC_ACTION_GO_NEGO_CFM 2
  32. #define P2P_PUBLIC_ACTION_INVITATION_REQ 3
  33. #define P2P_PUBLIC_ACTION_INVITATION_RSP 4
  34. #define P2P_PUBLIC_ACTION_DEV_DISCOVER_REQ 5
  35. #define P2P_PUBLIC_ACTION_DEV_DISCOVER_RSP 6
  36. #define P2P_PUBLIC_ACTION_PROV_DISCOVERY_REQ 7
  37. #define P2P_PUBLIC_ACTION_PROV_DISCOVERY_RSP 8
  38. /* P2P 4.2.9.1 - P2P Action Frame Type */
  39. #define P2P_ACTION_NOTICE_OF_ABSENCE 0
  40. #define P2P_ACTION_P2P_PRESENCE_REQ 1
  41. #define P2P_ACTION_P2P_PRESENCE_RSP 2
  42. #define P2P_ACTION_GO_DISCOVER_REQ 3
  43. #define P2P_PUBLIC_ACTION_FRAME_LEN (WLAN_MAC_MGMT_HEADER_LEN + 8)
  44. #define P2P_ACTION_FRAME_LEN (WLAN_MAC_MGMT_HEADER_LEN + 7)
  45. /*******************************************************************************
  46. * M A C R O S
  47. ********************************************************************************
  48. */
  49. /*******************************************************************************
  50. * D A T A T Y P E S
  51. ********************************************************************************
  52. */
  53. /*******************************************************************************
  54. * P U B L I C D A T A
  55. ********************************************************************************
  56. */
  57. /*******************************************************************************
  58. * P R I V A T E D A T A
  59. ********************************************************************************
  60. */
  61. /*******************************************************************************
  62. * F U N C T I O N D E C L A R A T I O N S
  63. ********************************************************************************
  64. */
  65. /* --------------- WPS Data Element Definitions --------------- */
  66. /* P2P 4.2.2 - General WSC Attribute */
  67. #define WSC_ATTRI_HDR_LEN 4 /* ID(2 octet) + Length(2 octets) */
  68. #define WSC_ATTRI_MAX_LEN_VERSION 1
  69. #define WSC_ATTRI_MAX_LEN_DEVICE_PASSWORD_ID 2
  70. #define WSC_ATTRI_LEN_CONFIG_METHOD 2
  71. /* --------------- WFA P2P IE --------------- */
  72. /* P2P 4.1.1 - P2P IE format */
  73. #define P2P_OUI_TYPE_LEN 4
  74. #define P2P_IE_OUI_HDR (ELEM_HDR_LEN + P2P_OUI_TYPE_LEN) /* == OFFSET_OF(IE_P2P_T,
  75. *aucP2PAttributes[0]) */
  76. /* P2P 4.1.1 - General P2P Attribute */
  77. #define P2P_ATTRI_HDR_LEN 3 /* ID(1 octet) + Length(2 octets) */
  78. /* P2P 4.1.1 - P2P Attribute ID definitions */
  79. #define P2P_ATTRI_ID_STATUS 0
  80. #define P2P_ATTRI_ID_REASON_CODE 1
  81. #define P2P_ATTRI_ID_P2P_CAPABILITY 2
  82. #define P2P_ATTRI_ID_P2P_DEV_ID 3
  83. #define P2P_ATTRI_ID_GO_INTENT 4
  84. #define P2P_ATTRI_ID_CFG_TIMEOUT 5
  85. #define P2P_ATTRI_ID_LISTEN_CHANNEL 6
  86. #define P2P_ATTRI_ID_P2P_GROUP_BSSID 7
  87. #define P2P_ATTRI_ID_EXT_LISTEN_TIMING 8
  88. #define P2P_ATTRI_ID_INTENDED_P2P_IF_ADDR 9
  89. #define P2P_ATTRI_ID_P2P_MANAGEABILITY 10
  90. #define P2P_ATTRI_ID_CHANNEL_LIST 11
  91. #define P2P_ATTRI_ID_NOTICE_OF_ABSENCE 12
  92. #define P2P_ATTRI_ID_P2P_DEV_INFO 13
  93. #define P2P_ATTRI_ID_P2P_GROUP_INFO 14
  94. #define P2P_ATTRI_ID_P2P_GROUP_ID 15
  95. #define P2P_ATTRI_ID_P2P_INTERFACE 16
  96. #define P2P_ATTRI_ID_OPERATING_CHANNEL 17
  97. #define P2P_ATTRI_ID_INVITATION_FLAG 18
  98. #define P2P_ATTRI_ID_VENDOR_SPECIFIC 221
  99. /* Maximum Length of P2P Attributes */
  100. #define P2P_ATTRI_MAX_LEN_STATUS 1 /* 0 */
  101. #define P2P_ATTRI_MAX_LEN_REASON_CODE 1 /* 1 */
  102. #define P2P_ATTRI_MAX_LEN_P2P_CAPABILITY 2 /* 2 */
  103. #define P2P_ATTRI_MAX_LEN_P2P_DEV_ID 6 /* 3 */
  104. #define P2P_ATTRI_MAX_LEN_GO_INTENT 1 /* 4 */
  105. #define P2P_ATTRI_MAX_LEN_CFG_TIMEOUT 2 /* 5 */
  106. #define P2P_ATTRI_MAX_LEN_LISTEN_CHANNEL 5 /* 6 */
  107. #define P2P_ATTRI_MAX_LEN_P2P_GROUP_BSSID 6 /* 7 */
  108. #define P2P_ATTRI_MAX_LEN_EXT_LISTEN_TIMING 4 /* 8 */
  109. #define P2P_ATTRI_MAX_LEN_INTENDED_P2P_IF_ADDR 6 /* 9 */
  110. #define P2P_ATTRI_MAX_LEN_P2P_MANAGEABILITY 1 /* 10 */
  111. /* #define P2P_ATTRI_MAX_LEN_CHANNEL_LIST 3 + (n* (2 + num_of_ch)) *//* 11 */
  112. #define P2P_ATTRI_LEN_CHANNEL_LIST 3 /* 11 */
  113. #define P2P_ATTRI_LEN_CHANNEL_ENTRY 2 /* 11 */
  114. #define P2P_MAXIMUM_ATTRIBUTE_LEN 251
  115. /* P2P 4.1.2 - P2P Status definitions */
  116. #define P2P_STATUS_SUCCESS 0
  117. #define P2P_STATUS_FAIL_INFO_IS_CURRENTLY_UNAVAILABLE 1
  118. #define P2P_STATUS_FAIL_INCOMPATIBLE_PARAM 2
  119. #define P2P_STATUS_FAIL_LIMIT_REACHED 3
  120. #define P2P_STATUS_FAIL_INVALID_PARAM 4
  121. #define P2P_STATUS_FAIL_UNABLE_ACCOMMODATE_REQ 5
  122. #define P2P_STATUS_FAIL_PREVIOUS_PROTOCOL_ERR 6
  123. #define P2P_STATUS_FAIL_NO_COMMON_CHANNELS 7
  124. #define P2P_STATUS_FAIL_UNKNOWN_P2P_GROUP 8
  125. #define P2P_STATUS_FAIL_SAME_INTENT_VALUE_15 9
  126. #define P2P_STATUS_FAIL_INCOMPATIBLE_PROVISION_METHOD 10
  127. #define P2P_STATUS_FAIL_REJECTED_BY_USER 11
  128. /* P2P 4.1.14 - CTWindow and OppPS Parameters definitions */
  129. #define P2P_CTW_OPPPS_PARAM_OPPPS_FIELD BIT(7)
  130. #define P2P_CTW_OPPPS_PARAM_CTWINDOW_MASK BITS(0, 6)
  131. /* --------------- WFA P2P IE and Attributes --------------- */
  132. /* P2P 4.1.1 - P2P Information Element */
  133. typedef struct _IE_P2P_T {
  134. UINT_8 ucId; /* Element ID */
  135. UINT_8 ucLength; /* Length */
  136. UINT_8 aucOui[3]; /* OUI */
  137. UINT_8 ucOuiType; /* OUI Type */
  138. UINT_8 aucP2PAttributes[1]; /* P2P Attributes */
  139. } __KAL_ATTRIB_PACKED__ IE_P2P_T, *P_IE_P2P_T;
  140. /* P2P 4.1.1 - General WSC Attribute */
  141. typedef struct _WSC_ATTRIBUTE_T {
  142. UINT_16 u2Id; /* Attribute ID */
  143. UINT_16 u2Length; /* Length */
  144. UINT_8 aucBody[1]; /* Body field */
  145. } __KAL_ATTRIB_PACKED__ WSC_ATTRIBUTE_T, *P_WSC_ATTRIBUTE_T;
  146. /* P2P 4.1.2 - P2P Status Attribute */
  147. typedef struct _P2P_ATTRI_STATUS_T {
  148. UINT_8 ucId; /* Attribute ID */
  149. UINT_16 u2Length; /* Length */
  150. UINT_8 ucStatusCode; /* Status Code */
  151. } __KAL_ATTRIB_PACKED__ P2P_ATTRI_STATUS_T, *P_P2P_ATTRI_STATUS_T;
  152. /* P2P 4.1.10 - Extended Listen Timing Attribute */
  153. typedef struct _P2P_ATTRI_EXT_LISTEN_TIMING_T {
  154. UINT_8 ucId; /* Attribute ID */
  155. UINT_16 u2Length; /* Length */
  156. UINT_16 u2AvailPeriod; /* Availability Period */
  157. UINT_16 u2AvailInterval; /* Availability Interval */
  158. } __KAL_ATTRIB_PACKED__ P2P_ATTRI_EXT_LISTEN_TIMING_T, *P_P2P_ATTRI_EXT_LISTEN_TIMING_T;
  159. /* P2P 4.2.8.2 P2P Public Action Frame Format */
  160. typedef struct _P2P_PUBLIC_ACTION_FRAME_T {
  161. /* MAC header */
  162. UINT_16 u2FrameCtrl; /* Frame Control */
  163. UINT_16 u2Duration; /* Duration */
  164. UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */
  165. UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */
  166. UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */
  167. UINT_16 u2SeqCtrl; /* Sequence Control */
  168. /* P2P Public Action Frame Body */
  169. UINT_8 ucCategory; /* Category, 0x04 */
  170. UINT_8 ucAction; /* Action Value, 0x09 */
  171. UINT_8 aucOui[3]; /* 0x50, 0x6F, 0x9A */
  172. UINT_8 ucOuiType; /* 0x09 */
  173. UINT_8 ucOuiSubtype; /* GO Nego Req/Rsp/Cfm, P2P Invittion Req/Rsp, Device Discoverability
  174. *Req/Rsp */
  175. UINT_8 ucDialogToken; /* Dialog Token. */
  176. UINT_8 aucInfoElem[1]; /* P2P IE, WSC IE. */
  177. } __KAL_ATTRIB_PACKED__ P2P_PUBLIC_ACTION_FRAME_T, *P_P2P_PUBLIC_ACTION_FRAME_T;
  178. /* P2P 4.2.9.1 - General Action Frame Format. */
  179. typedef struct _P2P_ACTION_FRAME_T {
  180. /* MAC header */
  181. UINT_16 u2FrameCtrl; /* Frame Control */
  182. UINT_16 u2Duration; /* Duration */
  183. UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */
  184. UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */
  185. UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */
  186. UINT_16 u2SeqCtrl; /* Sequence Control */
  187. /* P2P Action Frame Body */
  188. UINT_8 ucCategory; /* 0x7F */
  189. UINT_8 aucOui[3]; /* 0x50, 0x6F, 0x9A */
  190. UINT_8 ucOuiType; /* 0x09 */
  191. UINT_8 ucOuiSubtype; /* */
  192. UINT_8 ucDialogToken;
  193. UINT_8 aucInfoElem[1];
  194. } __KAL_ATTRIB_PACKED__ P2P_ACTION_FRAME_T, *P_P2P_ACTION_FRAME_T;
  195. /* P2P C.1 GAS Public Action Initial Request Frame Format */
  196. typedef struct _GAS_PUBLIC_ACTION_INITIAL_REQUEST_FRAME_T {
  197. /* MAC header */
  198. UINT_16 u2FrameCtrl; /* Frame Control */
  199. UINT_16 u2Duration; /* Duration */
  200. UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */
  201. UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */
  202. UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */
  203. UINT_16 u2SeqCtrl; /* Sequence Control */
  204. /* P2P Public Action Frame Body */
  205. UINT_8 ucCategory; /* Category, 0x04 */
  206. UINT_8 ucAction; /* Action Value, 0x09 */
  207. UINT_8 ucDialogToken; /* Dialog Token. */
  208. UINT_8 aucInfoElem[1]; /* Advertisement IE. */
  209. } __KAL_ATTRIB_PACKED__ GAS_PUBLIC_ACTION_INITIAL_REQUEST_FRAME_T, *P_GAS_PUBLIC_ACTION_INITIAL_REQUEST_FRAME_T;
  210. /* P2P C.2 GAS Public Action Initial Response Frame Format */
  211. typedef struct _GAS_PUBLIC_ACTION_INITIAL_RESPONSE_FRAME_T {
  212. /* MAC header */
  213. UINT_16 u2FrameCtrl; /* Frame Control */
  214. UINT_16 u2Duration; /* Duration */
  215. UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */
  216. UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */
  217. UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */
  218. UINT_16 u2SeqCtrl; /* Sequence Control */
  219. /* P2P Public Action Frame Body */
  220. UINT_8 ucCategory; /* Category, 0x04 */
  221. UINT_8 ucAction; /* Action Value, 0x09 */
  222. UINT_8 ucDialogToken; /* Dialog Token. */
  223. UINT_16 u2StatusCode; /* Initial Response. */
  224. UINT_16 u2ComebackDelay; /* Initial Response. *//* In unit of TU. */
  225. UINT_8 aucInfoElem[1]; /* Advertisement IE. */
  226. } __KAL_ATTRIB_PACKED__ GAS_PUBLIC_ACTION_INITIAL_RESPONSE_FRAME_T, *P_GAS_PUBLIC_ACTION_INITIAL_RESPONSE_FRAME_T;
  227. /* P2P C.3-1 GAS Public Action Comeback Request Frame Format */
  228. typedef struct _GAS_PUBLIC_ACTION_COMEBACK_REQUEST_FRAME_T {
  229. /* MAC header */
  230. UINT_16 u2FrameCtrl; /* Frame Control */
  231. UINT_16 u2Duration; /* Duration */
  232. UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */
  233. UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */
  234. UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */
  235. UINT_16 u2SeqCtrl; /* Sequence Control */
  236. /* P2P Public Action Frame Body */
  237. UINT_8 ucCategory; /* Category, 0x04 */
  238. UINT_8 ucAction; /* Action Value, 0x09 */
  239. UINT_8 ucDialogToken; /* Dialog Token. */
  240. } __KAL_ATTRIB_PACKED__ GAS_PUBLIC_ACTION_COMEBACK_REQUEST_FRAME_T, *P_GAS_PUBLIC_ACTION_COMEBACK_REQUEST_FRAME_T;
  241. /* P2P C.3-2 GAS Public Action Comeback Response Frame Format */
  242. typedef struct _GAS_PUBLIC_ACTION_COMEBACK_RESPONSE_FRAME_T {
  243. /* MAC header */
  244. UINT_16 u2FrameCtrl; /* Frame Control */
  245. UINT_16 u2Duration; /* Duration */
  246. UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */
  247. UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */
  248. UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */
  249. UINT_16 u2SeqCtrl; /* Sequence Control */
  250. /* P2P Public Action Frame Body */
  251. UINT_8 ucCategory; /* Category, 0x04 */
  252. UINT_8 ucAction; /* Action Value, 0x09 */
  253. UINT_8 ucDialogToken; /* Dialog Token. */
  254. UINT_16 u2StatusCode; /* Comeback Response. */
  255. UINT_8 ucFragmentID; /*Comeback Response. */
  256. UINT_16 u2ComebackDelay; /* Comeback Response. */
  257. UINT_8 aucInfoElem[1]; /* Advertisement IE. */
  258. } __KAL_ATTRIB_PACKED__ GAS_PUBLIC_ACTION_COMEBACK_RESPONSE_FRAME_T, *P_GAS_PUBLIC_ACTION_COMEBACK_RESPONSE_FRAME_T;
  259. typedef struct _P2P_SD_VENDER_SPECIFIC_CONTENT_T {
  260. /* Service Discovery Vendor-specific Content. */
  261. UINT_8 ucOuiSubtype; /* 0x09 */
  262. UINT_16 u2ServiceUpdateIndicator;
  263. UINT_8 aucServiceTLV[1];
  264. } __KAL_ATTRIB_PACKED__ P2P_SD_VENDER_SPECIFIC_CONTENT_T, *P_P2P_SD_VENDER_SPECIFIC_CONTENT_T;
  265. typedef struct _P2P_SERVICE_REQUEST_TLV_T {
  266. UINT_16 u2Length;
  267. UINT_8 ucServiceProtocolType;
  268. UINT_8 ucServiceTransID;
  269. UINT_8 aucQueryData[1];
  270. } __KAL_ATTRIB_PACKED__ P2P_SERVICE_REQUEST_TLV_T, *P_P2P_SERVICE_REQUEST_TLV_T;
  271. typedef struct _P2P_SERVICE_RESPONSE_TLV_T {
  272. UINT_16 u2Length;
  273. UINT_8 ucServiceProtocolType;
  274. UINT_8 ucServiceTransID;
  275. UINT_8 ucStatusCode;
  276. UINT_8 aucResponseData[1];
  277. } __KAL_ATTRIB_PACKED__ P2P_SERVICE_RESPONSE_TLV_T, *P_P2P_SERVICE_RESPONSE_TLV_T;
  278. /* P2P 4.1.1 - General P2P Attribute */
  279. typedef struct _P2P_ATTRIBUTE_T {
  280. UINT_8 ucId; /* Attribute ID */
  281. UINT_16 u2Length; /* Length */
  282. UINT_8 aucBody[1]; /* Body field */
  283. } __KAL_ATTRIB_PACKED__ P2P_ATTRIBUTE_T, ATTRIBUTE_HDR_T, *P_P2P_ATTRIBUTE_T, *P_ATTRIBUTE_HDR_T;
  284. /* P2P 4.1.14 - Notice of Absence Attribute */
  285. typedef struct _P2P_ATTRI_NOA_T {
  286. UINT_8 ucId; /* Attribute ID */
  287. UINT_16 u2Length; /* Length */
  288. UINT_8 ucIndex; /* Index */
  289. UINT_8 ucCTWOppPSParam; /* CTWindow and OppPS Parameters */
  290. UINT_8 aucNoADesc[1]; /* NoA Descriptor */
  291. } __KAL_ATTRIB_PACKED__ P2P_ATTRI_NOA_T, *P_P2P_ATTRI_NOA_T;
  292. typedef struct _NOA_DESCRIPTOR_T {
  293. UINT_8 ucCountType; /* Count/Type */
  294. UINT_32 u4Duration; /* Duration */
  295. UINT_32 u4Interval; /* Interval */
  296. UINT_32 u4StartTime; /* Start Time */
  297. } __KAL_ATTRIB_PACKED__ NOA_DESCRIPTOR_T, *P_NOA_DESCRIPTOR_T;
  298. typedef struct _CHANNEL_ENTRY_FIELD_T {
  299. UINT_8 ucRegulatoryClass; /* Regulatory Class */
  300. UINT_8 ucNumberOfChannels; /* Number Of Channels */
  301. UINT_8 aucChannelList[1]; /* Channel List */
  302. } __KAL_ATTRIB_PACKED__ CHANNEL_ENTRY_FIELD_T, *P_CHANNEL_ENTRY_FIELD_T;
  303. #endif