wlan_bssdef.h 22 KB

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