wlan_bssdef.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2017 Realtek Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. *****************************************************************************/
  15. #ifndef __WLAN_BSSDEF_H__
  16. #define __WLAN_BSSDEF_H__
  17. #define MAX_IE_SZ 768
  18. #ifdef PLATFORM_LINUX
  19. #define NDIS_802_11_LENGTH_SSID 32
  20. #define NDIS_802_11_LENGTH_RATES 8
  21. #define NDIS_802_11_LENGTH_RATES_EX 16
  22. typedef unsigned char NDIS_802_11_MAC_ADDRESS[ETH_ALEN];
  23. typedef long NDIS_802_11_RSSI; /* in dBm */
  24. typedef unsigned char NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; /* Set of 8 data rates */
  25. typedef unsigned char NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; /* Set of 16 data rates */
  26. typedef ULONG NDIS_802_11_KEY_INDEX;
  27. typedef unsigned long long NDIS_802_11_KEY_RSC;
  28. typedef struct _NDIS_802_11_SSID {
  29. ULONG SsidLength;
  30. UCHAR Ssid[32];
  31. } NDIS_802_11_SSID, *PNDIS_802_11_SSID;
  32. typedef enum _NDIS_802_11_NETWORK_TYPE {
  33. Ndis802_11FH,
  34. Ndis802_11DS,
  35. Ndis802_11OFDM5,
  36. Ndis802_11OFDM24,
  37. Ndis802_11NetworkTypeMax /* not a real type, defined as an upper bound */
  38. } NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
  39. typedef struct _NDIS_802_11_CONFIGURATION_FH {
  40. ULONG Length; /* Length of structure */
  41. ULONG HopPattern; /* As defined by 802.11, MSB set */
  42. ULONG HopSet; /* to one if non-802.11 */
  43. ULONG DwellTime; /* units are Kusec */
  44. } NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH;
  45. /*
  46. FW will only save the channel number in DSConfig.
  47. ODI Handler will convert the channel number to freq. number.
  48. */
  49. typedef struct _NDIS_802_11_CONFIGURATION {
  50. ULONG Length; /* Length of structure */
  51. ULONG BeaconPeriod; /* units are Kusec */
  52. ULONG ATIMWindow; /* units are Kusec */
  53. ULONG DSConfig; /* channel number */
  54. NDIS_802_11_CONFIGURATION_FH FHConfig;
  55. } NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION;
  56. typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE {
  57. Ndis802_11IBSS,
  58. Ndis802_11Infrastructure,
  59. Ndis802_11AutoUnknown,
  60. Ndis802_11InfrastructureMax, /* Not a real value, defined as upper bound */
  61. Ndis802_11APMode,
  62. Ndis802_11Monitor,
  63. Ndis802_11_mesh,
  64. } NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE;
  65. typedef struct _NDIS_802_11_FIXED_IEs {
  66. UCHAR Timestamp[8];
  67. USHORT BeaconInterval;
  68. USHORT Capabilities;
  69. } NDIS_802_11_FIXED_IEs, *PNDIS_802_11_FIXED_IEs;
  70. typedef struct _NDIS_802_11_VARIABLE_IEs {
  71. UCHAR ElementID;
  72. UCHAR Length;
  73. UCHAR data[1];
  74. } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs;
  75. /*
  76. Length is the 4 bytes multiples of the sume of
  77. sizeof (NDIS_802_11_MAC_ADDRESS) + 2 + sizeof (NDIS_802_11_SSID) + sizeof (ULONG)
  78. + sizeof (NDIS_802_11_RSSI) + sizeof (NDIS_802_11_NETWORK_TYPE) + sizeof (NDIS_802_11_CONFIGURATION)
  79. + sizeof (NDIS_802_11_RATES_EX) + IELength
  80. Except the IELength, all other fields are fixed length. Therefore, we can define a marco to present the
  81. partial sum.
  82. */
  83. #if 0
  84. typedef struct _NDIS_WLAN_BSSID_EX {
  85. ULONG Length;
  86. NDIS_802_11_MAC_ADDRESS MacAddress;
  87. UCHAR Reserved[2];/* [0]: IS beacon frame, [1]:optimum_antenna=>For antenna diversity; */
  88. NDIS_802_11_SSID Ssid;
  89. ULONG Privacy;
  90. NDIS_802_11_RSSI Rssi;
  91. NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
  92. NDIS_802_11_CONFIGURATION Configuration;
  93. NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
  94. NDIS_802_11_RATES_EX SupportedRates;
  95. ULONG IELength;
  96. UCHAR IEs[MAX_IE_SZ]; /* (timestamp, beacon interval, and capability information) */
  97. } NDIS_WLAN_BSSID_EX, *PNDIS_WLAN_BSSID_EX;
  98. typedef struct _NDIS_802_11_BSSID_LIST_EX {
  99. ULONG NumberOfItems;
  100. NDIS_WLAN_BSSID_EX Bssid[1];
  101. } NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX;
  102. #endif
  103. typedef enum _NDIS_802_11_AUTHENTICATION_MODE {
  104. Ndis802_11AuthModeOpen,
  105. Ndis802_11AuthModeShared,
  106. Ndis802_11AuthModeAutoSwitch,
  107. Ndis802_11AuthModeWPA,
  108. Ndis802_11AuthModeWPAPSK,
  109. Ndis802_11AuthModeWPANone,
  110. Ndis802_11AuthModeWAPI,
  111. Ndis802_11AuthModeMax /* Not a real mode, defined as upper bound */
  112. } NDIS_802_11_AUTHENTICATION_MODE, *PNDIS_802_11_AUTHENTICATION_MODE;
  113. typedef enum _NDIS_802_11_WEP_STATUS {
  114. Ndis802_11WEPEnabled,
  115. Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
  116. Ndis802_11WEPDisabled,
  117. Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
  118. Ndis802_11WEPKeyAbsent,
  119. Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
  120. Ndis802_11WEPNotSupported,
  121. Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
  122. Ndis802_11Encryption2Enabled,
  123. Ndis802_11Encryption2KeyAbsent,
  124. Ndis802_11Encryption3Enabled,
  125. Ndis802_11Encryption3KeyAbsent,
  126. Ndis802_11_EncrypteionWAPI
  127. } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
  128. NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
  129. #define NDIS_802_11_AI_REQFI_CAPABILITIES 1
  130. #define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2
  131. #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4
  132. #define NDIS_802_11_AI_RESFI_CAPABILITIES 1
  133. #define NDIS_802_11_AI_RESFI_STATUSCODE 2
  134. #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4
  135. typedef struct _NDIS_802_11_AI_REQFI {
  136. USHORT Capabilities;
  137. USHORT ListenInterval;
  138. NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
  139. } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
  140. typedef struct _NDIS_802_11_AI_RESFI {
  141. USHORT Capabilities;
  142. USHORT StatusCode;
  143. USHORT AssociationId;
  144. } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
  145. typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION {
  146. ULONG Length;
  147. USHORT AvailableRequestFixedIEs;
  148. NDIS_802_11_AI_REQFI RequestFixedIEs;
  149. ULONG RequestIELength;
  150. ULONG OffsetRequestIEs;
  151. USHORT AvailableResponseFixedIEs;
  152. NDIS_802_11_AI_RESFI ResponseFixedIEs;
  153. ULONG ResponseIELength;
  154. ULONG OffsetResponseIEs;
  155. } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
  156. typedef enum _NDIS_802_11_RELOAD_DEFAULTS {
  157. Ndis802_11ReloadWEPKeys
  158. } NDIS_802_11_RELOAD_DEFAULTS, *PNDIS_802_11_RELOAD_DEFAULTS;
  159. /* Key mapping keys require a BSSID */
  160. typedef struct _NDIS_802_11_KEY {
  161. ULONG Length; /* Length of this structure */
  162. ULONG KeyIndex;
  163. ULONG KeyLength; /* length of key in bytes */
  164. NDIS_802_11_MAC_ADDRESS BSSID;
  165. NDIS_802_11_KEY_RSC KeyRSC;
  166. UCHAR KeyMaterial[32]; /* variable length depending on above field */
  167. } NDIS_802_11_KEY, *PNDIS_802_11_KEY;
  168. typedef struct _NDIS_802_11_REMOVE_KEY {
  169. ULONG Length; /* Length of this structure */
  170. ULONG KeyIndex;
  171. NDIS_802_11_MAC_ADDRESS BSSID;
  172. } NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY;
  173. typedef struct _NDIS_802_11_WEP {
  174. ULONG Length; /* Length of this structure */
  175. ULONG KeyIndex; /* 0 is the per-client key, 1-N are the global keys */
  176. ULONG KeyLength; /* length of key in bytes */
  177. UCHAR KeyMaterial[16];/* variable length depending on above field */
  178. } NDIS_802_11_WEP, *PNDIS_802_11_WEP;
  179. typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST {
  180. ULONG Length; /* Length of structure */
  181. NDIS_802_11_MAC_ADDRESS Bssid;
  182. ULONG Flags;
  183. } NDIS_802_11_AUTHENTICATION_REQUEST, *PNDIS_802_11_AUTHENTICATION_REQUEST;
  184. typedef enum _NDIS_802_11_STATUS_TYPE {
  185. Ndis802_11StatusType_Authentication,
  186. Ndis802_11StatusType_MediaStreamMode,
  187. Ndis802_11StatusType_PMKID_CandidateList,
  188. Ndis802_11StatusTypeMax /* not a real type, defined as an upper bound */
  189. } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
  190. typedef struct _NDIS_802_11_STATUS_INDICATION {
  191. NDIS_802_11_STATUS_TYPE StatusType;
  192. } NDIS_802_11_STATUS_INDICATION, *PNDIS_802_11_STATUS_INDICATION;
  193. /* mask for authentication/integrity fields */
  194. #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
  195. #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
  196. #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
  197. #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
  198. #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
  199. /* MIC check time, 60 seconds. */
  200. #define MIC_CHECK_TIME 60000000
  201. typedef struct _NDIS_802_11_AUTHENTICATION_EVENT {
  202. NDIS_802_11_STATUS_INDICATION Status;
  203. NDIS_802_11_AUTHENTICATION_REQUEST Request[1];
  204. } NDIS_802_11_AUTHENTICATION_EVENT, *PNDIS_802_11_AUTHENTICATION_EVENT;
  205. typedef struct _NDIS_802_11_TEST {
  206. ULONG Length;
  207. ULONG Type;
  208. union {
  209. NDIS_802_11_AUTHENTICATION_EVENT AuthenticationEvent;
  210. NDIS_802_11_RSSI RssiTrigger;
  211. } tt;
  212. } NDIS_802_11_TEST, *PNDIS_802_11_TEST;
  213. #endif /* end of #ifdef PLATFORM_LINUX */
  214. #ifdef PLATFORM_FREEBSD
  215. #define NDIS_802_11_LENGTH_SSID 32
  216. #define NDIS_802_11_LENGTH_RATES 8
  217. #define NDIS_802_11_LENGTH_RATES_EX 16
  218. typedef unsigned char NDIS_802_11_MAC_ADDRESS[ETH_ALEN];
  219. typedef long NDIS_802_11_RSSI; /* in dBm */
  220. typedef unsigned char NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; /* Set of 8 data rates */
  221. typedef unsigned char NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; /* Set of 16 data rates */
  222. typedef ULONG NDIS_802_11_KEY_INDEX;
  223. typedef unsigned long long NDIS_802_11_KEY_RSC;
  224. typedef struct _NDIS_802_11_SSID {
  225. ULONG SsidLength;
  226. UCHAR Ssid[32];
  227. } NDIS_802_11_SSID, *PNDIS_802_11_SSID;
  228. typedef enum _NDIS_802_11_NETWORK_TYPE {
  229. Ndis802_11FH,
  230. Ndis802_11DS,
  231. Ndis802_11OFDM5,
  232. Ndis802_11OFDM24,
  233. Ndis802_11NetworkTypeMax /* not a real type, defined as an upper bound */
  234. } NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
  235. typedef struct _NDIS_802_11_CONFIGURATION_FH {
  236. ULONG Length; /* Length of structure */
  237. ULONG HopPattern; /* As defined by 802.11, MSB set */
  238. ULONG HopSet; /* to one if non-802.11 */
  239. ULONG DwellTime; /* units are Kusec */
  240. } NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH;
  241. /*
  242. FW will only save the channel number in DSConfig.
  243. ODI Handler will convert the channel number to freq. number.
  244. */
  245. typedef struct _NDIS_802_11_CONFIGURATION {
  246. ULONG Length; /* Length of structure */
  247. ULONG BeaconPeriod; /* units are Kusec */
  248. ULONG ATIMWindow; /* units are Kusec */
  249. ULONG DSConfig; /* channel number */
  250. NDIS_802_11_CONFIGURATION_FH FHConfig;
  251. } NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION;
  252. typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE {
  253. Ndis802_11IBSS,
  254. Ndis802_11Infrastructure,
  255. Ndis802_11AutoUnknown,
  256. Ndis802_11InfrastructureMax, /* Not a real value, defined as upper bound */
  257. Ndis802_11APMode
  258. } NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE;
  259. typedef struct _NDIS_802_11_FIXED_IEs {
  260. UCHAR Timestamp[8];
  261. USHORT BeaconInterval;
  262. USHORT Capabilities;
  263. } NDIS_802_11_FIXED_IEs, *PNDIS_802_11_FIXED_IEs;
  264. typedef struct _NDIS_802_11_VARIABLE_IEs {
  265. UCHAR ElementID;
  266. UCHAR Length;
  267. UCHAR data[1];
  268. } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs;
  269. /*
  270. Length is the 4 bytes multiples of the sume of
  271. sizeof (NDIS_802_11_MAC_ADDRESS) + 2 + sizeof (NDIS_802_11_SSID) + sizeof (ULONG)
  272. + sizeof (NDIS_802_11_RSSI) + sizeof (NDIS_802_11_NETWORK_TYPE) + sizeof (NDIS_802_11_CONFIGURATION)
  273. + sizeof (NDIS_802_11_RATES_EX) + IELength
  274. Except the IELength, all other fields are fixed length. Therefore, we can define a marco to present the
  275. partial sum.
  276. */
  277. #if 0
  278. typedef struct _NDIS_WLAN_BSSID_EX {
  279. ULONG Length;
  280. NDIS_802_11_MAC_ADDRESS MacAddress;
  281. UCHAR Reserved[2];/* [0]: IS beacon frame, [1]:optimum_antenna=>For antenna diversity; */
  282. NDIS_802_11_SSID Ssid;
  283. ULONG Privacy;
  284. NDIS_802_11_RSSI Rssi;
  285. NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
  286. NDIS_802_11_CONFIGURATION Configuration;
  287. NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
  288. NDIS_802_11_RATES_EX SupportedRates;
  289. ULONG IELength;
  290. UCHAR IEs[MAX_IE_SZ]; /* (timestamp, beacon interval, and capability information) */
  291. } NDIS_WLAN_BSSID_EX, *PNDIS_WLAN_BSSID_EX;
  292. typedef struct _NDIS_802_11_BSSID_LIST_EX {
  293. ULONG NumberOfItems;
  294. NDIS_WLAN_BSSID_EX Bssid[1];
  295. } NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX;
  296. #endif
  297. typedef enum _NDIS_802_11_AUTHENTICATION_MODE {
  298. Ndis802_11AuthModeOpen,
  299. Ndis802_11AuthModeShared,
  300. Ndis802_11AuthModeAutoSwitch,
  301. Ndis802_11AuthModeWPA,
  302. Ndis802_11AuthModeWPAPSK,
  303. Ndis802_11AuthModeWPANone,
  304. Ndis802_11AuthModeMax /* Not a real mode, defined as upper bound */
  305. } NDIS_802_11_AUTHENTICATION_MODE, *PNDIS_802_11_AUTHENTICATION_MODE;
  306. typedef enum _NDIS_802_11_WEP_STATUS {
  307. Ndis802_11WEPEnabled,
  308. Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
  309. Ndis802_11WEPDisabled,
  310. Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
  311. Ndis802_11WEPKeyAbsent,
  312. Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
  313. Ndis802_11WEPNotSupported,
  314. Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
  315. Ndis802_11Encryption2Enabled,
  316. Ndis802_11Encryption2KeyAbsent,
  317. Ndis802_11Encryption3Enabled,
  318. Ndis802_11Encryption3KeyAbsent
  319. } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
  320. NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
  321. #define NDIS_802_11_AI_REQFI_CAPABILITIES 1
  322. #define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2
  323. #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4
  324. #define NDIS_802_11_AI_RESFI_CAPABILITIES 1
  325. #define NDIS_802_11_AI_RESFI_STATUSCODE 2
  326. #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4
  327. typedef struct _NDIS_802_11_AI_REQFI {
  328. USHORT Capabilities;
  329. USHORT ListenInterval;
  330. NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
  331. } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
  332. typedef struct _NDIS_802_11_AI_RESFI {
  333. USHORT Capabilities;
  334. USHORT StatusCode;
  335. USHORT AssociationId;
  336. } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
  337. typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION {
  338. ULONG Length;
  339. USHORT AvailableRequestFixedIEs;
  340. NDIS_802_11_AI_REQFI RequestFixedIEs;
  341. ULONG RequestIELength;
  342. ULONG OffsetRequestIEs;
  343. USHORT AvailableResponseFixedIEs;
  344. NDIS_802_11_AI_RESFI ResponseFixedIEs;
  345. ULONG ResponseIELength;
  346. ULONG OffsetResponseIEs;
  347. } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
  348. typedef enum _NDIS_802_11_RELOAD_DEFAULTS {
  349. Ndis802_11ReloadWEPKeys
  350. } NDIS_802_11_RELOAD_DEFAULTS, *PNDIS_802_11_RELOAD_DEFAULTS;
  351. /* Key mapping keys require a BSSID */
  352. typedef struct _NDIS_802_11_KEY {
  353. ULONG Length; /* Length of this structure */
  354. ULONG KeyIndex;
  355. ULONG KeyLength; /* length of key in bytes */
  356. NDIS_802_11_MAC_ADDRESS BSSID;
  357. NDIS_802_11_KEY_RSC KeyRSC;
  358. UCHAR KeyMaterial[32]; /* variable length depending on above field */
  359. } NDIS_802_11_KEY, *PNDIS_802_11_KEY;
  360. typedef struct _NDIS_802_11_REMOVE_KEY {
  361. ULONG Length; /* Length of this structure */
  362. ULONG KeyIndex;
  363. NDIS_802_11_MAC_ADDRESS BSSID;
  364. } NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY;
  365. typedef struct _NDIS_802_11_WEP {
  366. ULONG Length; /* Length of this structure */
  367. ULONG KeyIndex; /* 0 is the per-client key, 1-N are the global keys */
  368. ULONG KeyLength; /* length of key in bytes */
  369. UCHAR KeyMaterial[16];/* variable length depending on above field */
  370. } NDIS_802_11_WEP, *PNDIS_802_11_WEP;
  371. typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST {
  372. ULONG Length; /* Length of structure */
  373. NDIS_802_11_MAC_ADDRESS Bssid;
  374. ULONG Flags;
  375. } NDIS_802_11_AUTHENTICATION_REQUEST, *PNDIS_802_11_AUTHENTICATION_REQUEST;
  376. typedef enum _NDIS_802_11_STATUS_TYPE {
  377. Ndis802_11StatusType_Authentication,
  378. Ndis802_11StatusType_MediaStreamMode,
  379. Ndis802_11StatusType_PMKID_CandidateList,
  380. Ndis802_11StatusTypeMax /* not a real type, defined as an upper bound */
  381. } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
  382. typedef struct _NDIS_802_11_STATUS_INDICATION {
  383. NDIS_802_11_STATUS_TYPE StatusType;
  384. } NDIS_802_11_STATUS_INDICATION, *PNDIS_802_11_STATUS_INDICATION;
  385. /* mask for authentication/integrity fields */
  386. #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
  387. #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
  388. #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
  389. #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
  390. #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
  391. /* MIC check time, 60 seconds. */
  392. #define MIC_CHECK_TIME 60000000
  393. typedef struct _NDIS_802_11_AUTHENTICATION_EVENT {
  394. NDIS_802_11_STATUS_INDICATION Status;
  395. NDIS_802_11_AUTHENTICATION_REQUEST Request[1];
  396. } NDIS_802_11_AUTHENTICATION_EVENT, *PNDIS_802_11_AUTHENTICATION_EVENT;
  397. typedef struct _NDIS_802_11_TEST {
  398. ULONG Length;
  399. ULONG Type;
  400. union {
  401. NDIS_802_11_AUTHENTICATION_EVENT AuthenticationEvent;
  402. NDIS_802_11_RSSI RssiTrigger;
  403. } tt;
  404. } NDIS_802_11_TEST, *PNDIS_802_11_TEST;
  405. #endif /* PLATFORM_FREEBSD */
  406. #ifndef Ndis802_11APMode
  407. #define Ndis802_11APMode (Ndis802_11InfrastructureMax+1)
  408. #endif
  409. typedef struct _WLAN_PHY_INFO {
  410. u8 SignalStrength;/* (in percentage) */
  411. u8 SignalQuality;/* (in percentage) */
  412. u8 Optimum_antenna; /* for Antenna diversity */
  413. u8 is_cck_rate; /* 1:cck_rate */
  414. s8 rx_snr[4];
  415. #ifdef CONFIG_RTW_80211K
  416. u32 free_cnt; /* freerun counter */
  417. u8 rm_en_cap[5];
  418. #endif
  419. } WLAN_PHY_INFO, *PWLAN_PHY_INFO;
  420. typedef struct _WLAN_BCN_INFO {
  421. /* these infor get from rtw_get_encrypt_info when
  422. * * translate scan to UI */
  423. u8 encryp_protocol;/* ENCRYP_PROTOCOL_E: OPEN/WEP/WPA/WPA2/WAPI */
  424. int group_cipher; /* WPA/WPA2 group cipher */
  425. int pairwise_cipher;/* //WPA/WPA2/WEP pairwise cipher */
  426. int is_8021x;
  427. /* bwmode 20/40 and ch_offset UP/LOW */
  428. unsigned short ht_cap_info;
  429. unsigned char ht_info_infos_0;
  430. } WLAN_BCN_INFO, *PWLAN_BCN_INFO;
  431. enum bss_type {
  432. BSS_TYPE_UNDEF,
  433. BSS_TYPE_BCN = 1,
  434. BSS_TYPE_PROB_REQ = 2,
  435. BSS_TYPE_PROB_RSP = 3,
  436. };
  437. /* temporally add #pragma pack for structure alignment issue of
  438. * WLAN_BSSID_EX and get_WLAN_BSSID_EX_sz()
  439. */
  440. #ifdef PLATFORM_WINDOWS
  441. #pragma pack(push)
  442. #pragma pack(1)
  443. #endif
  444. typedef struct _WLAN_BSSID_EX {
  445. ULONG Length;
  446. NDIS_802_11_MAC_ADDRESS MacAddress;
  447. UCHAR Reserved[2];/* [0]: IS beacon frame , bss_type*/
  448. NDIS_802_11_SSID Ssid;
  449. NDIS_802_11_SSID mesh_id;
  450. ULONG Privacy;
  451. NDIS_802_11_RSSI Rssi;/* (in dBM,raw data ,get from PHY) */
  452. NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
  453. NDIS_802_11_CONFIGURATION Configuration;
  454. NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
  455. NDIS_802_11_RATES_EX SupportedRates;
  456. WLAN_PHY_INFO PhyInfo;
  457. ULONG IELength;
  458. UCHAR IEs[MAX_IE_SZ]; /* (timestamp, beacon interval, and capability information) */
  459. }
  460. #ifndef PLATFORM_WINDOWS
  461. __attribute__((packed))
  462. #endif
  463. WLAN_BSSID_EX, *PWLAN_BSSID_EX;
  464. #ifdef PLATFORM_WINDOWS
  465. #pragma pack(pop)
  466. #endif
  467. #define BSS_EX_IES(bss_ex) ((bss_ex)->IEs)
  468. #define BSS_EX_IES_LEN(bss_ex) ((bss_ex)->IELength)
  469. #define BSS_EX_FIXED_IE_OFFSET(bss_ex) ((bss_ex)->Reserved[0] == BSS_TYPE_PROB_REQ ? 0 : 12)
  470. #define BSS_EX_TLV_IES(bss_ex) (BSS_EX_IES((bss_ex)) + BSS_EX_FIXED_IE_OFFSET((bss_ex)))
  471. #define BSS_EX_TLV_IES_LEN(bss_ex) (BSS_EX_IES_LEN((bss_ex)) - BSS_EX_FIXED_IE_OFFSET((bss_ex)))
  472. __inline static uint get_WLAN_BSSID_EX_sz(WLAN_BSSID_EX *bss)
  473. {
  474. #if 0
  475. uint t_len;
  476. t_len = sizeof(ULONG)
  477. + sizeof(NDIS_802_11_MAC_ADDRESS)
  478. + 2
  479. + sizeof(NDIS_802_11_SSID)
  480. + sizeof(ULONG)
  481. + sizeof(NDIS_802_11_RSSI)
  482. + sizeof(NDIS_802_11_NETWORK_TYPE)
  483. + sizeof(NDIS_802_11_CONFIGURATION)
  484. + sizeof(NDIS_802_11_NETWORK_INFRASTRUCTURE)
  485. + sizeof(NDIS_802_11_RATES_EX)
  486. /* all new member add here */
  487. + sizeof(WLAN_PHY_INFO)
  488. /* all new member add here */
  489. + sizeof(ULONG)
  490. + bss->IELength;
  491. return t_len;
  492. #else
  493. return sizeof(WLAN_BSSID_EX) - MAX_IE_SZ + bss->IELength;
  494. #endif
  495. }
  496. struct wlan_network {
  497. _list list;
  498. int network_type; /* refer to ieee80211.h for WIRELESS_11A/B/G */
  499. int fixed; /* set to fixed when not to be removed as site-surveying */
  500. systime last_scanned; /* timestamp for the network */
  501. #ifdef CONFIG_RTW_MESH
  502. #if CONFIG_RTW_MESH_ACNODE_PREVENT
  503. systime acnode_stime;
  504. systime acnode_notify_etime;
  505. #endif
  506. #endif
  507. int aid; /* will only be valid when a BSS is joinned. */
  508. int join_res;
  509. WLAN_BSSID_EX network; /* must be the last item */
  510. WLAN_BCN_INFO BcnInfo;
  511. #ifdef PLATFORM_WINDOWS
  512. unsigned char iebuf[MAX_IE_SZ];
  513. #endif
  514. };
  515. enum VRTL_CARRIER_SENSE {
  516. DISABLE_VCS,
  517. ENABLE_VCS,
  518. AUTO_VCS
  519. };
  520. enum VCS_TYPE {
  521. NONE_VCS,
  522. RTS_CTS,
  523. CTS_TO_SELF
  524. };
  525. #define PWR_CAM 0
  526. #define PWR_MINPS 1
  527. #define PWR_MAXPS 2
  528. #define PWR_UAPSD 3
  529. #define PWR_VOIP 4
  530. enum UAPSD_MAX_SP {
  531. NO_LIMIT,
  532. TWO_MSDU,
  533. FOUR_MSDU,
  534. SIX_MSDU
  535. };
  536. /* john */
  537. #define NUM_PRE_AUTH_KEY 16
  538. #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY
  539. /*
  540. * WPA2
  541. */
  542. #ifndef PLATFORM_OS_CE
  543. typedef struct _PMKID_CANDIDATE {
  544. NDIS_802_11_MAC_ADDRESS BSSID;
  545. ULONG Flags;
  546. } PMKID_CANDIDATE, *PPMKID_CANDIDATE;
  547. typedef struct _NDIS_802_11_PMKID_CANDIDATE_LIST {
  548. ULONG Version; /* Version of the structure */
  549. ULONG NumCandidates; /* No. of pmkid candidates */
  550. PMKID_CANDIDATE CandidateList[1];
  551. } NDIS_802_11_PMKID_CANDIDATE_LIST, *PNDIS_802_11_PMKID_CANDIDATE_LIST;
  552. typedef struct _NDIS_802_11_AUTHENTICATION_ENCRYPTION {
  553. NDIS_802_11_AUTHENTICATION_MODE AuthModeSupported;
  554. NDIS_802_11_ENCRYPTION_STATUS EncryptStatusSupported;
  555. } NDIS_802_11_AUTHENTICATION_ENCRYPTION, *PNDIS_802_11_AUTHENTICATION_ENCRYPTION;
  556. typedef struct _NDIS_802_11_CAPABILITY {
  557. ULONG Length;
  558. ULONG Version;
  559. ULONG NoOfPMKIDs;
  560. ULONG NoOfAuthEncryptPairsSupported;
  561. NDIS_802_11_AUTHENTICATION_ENCRYPTION AuthenticationEncryptionSupported[1];
  562. } NDIS_802_11_CAPABILITY, *PNDIS_802_11_CAPABILITY;
  563. #endif
  564. #endif /* #ifndef WLAN_BSSDEF_H_ */