OSDN Git Service

2026a291ecf612a4c16ad24b0bcc42a91da5aeca
[android-x86/external-modules-rtl8723au.git] / include / wlan_bssdef.h
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
23
24 #define MAX_IE_SZ       768
25
26
27 #ifdef PLATFORM_LINUX
28
29 #define NDIS_802_11_LENGTH_SSID         32
30 #define NDIS_802_11_LENGTH_RATES        8
31 #define NDIS_802_11_LENGTH_RATES_EX     16
32
33 typedef unsigned char   NDIS_802_11_MAC_ADDRESS[6];
34 typedef long                    NDIS_802_11_RSSI;           // in dBm
35 typedef unsigned char   NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES];        // Set of 8 data rates
36 typedef unsigned char   NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX];  // Set of 16 data rates
37
38
39 typedef  ULONG  NDIS_802_11_KEY_INDEX;
40 typedef unsigned long long NDIS_802_11_KEY_RSC;
41
42
43 typedef struct _NDIS_802_11_SSID
44 {
45   ULONG  SsidLength;
46   UCHAR  Ssid[32];
47 } NDIS_802_11_SSID, *PNDIS_802_11_SSID;
48
49 typedef enum _NDIS_802_11_NETWORK_TYPE
50 {
51     Ndis802_11FH,
52     Ndis802_11DS,
53     Ndis802_11OFDM5,
54     Ndis802_11OFDM24,
55     Ndis802_11NetworkTypeMax    // not a real type, defined as an upper bound
56 } NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
57
58 typedef struct _NDIS_802_11_CONFIGURATION_FH
59 {
60     ULONG           Length;             // Length of structure
61     ULONG           HopPattern;         // As defined by 802.11, MSB set
62     ULONG           HopSet;             // to one if non-802.11
63     ULONG           DwellTime;          // units are Kusec
64 } NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH;
65
66
67 /*
68         FW will only save the channel number in DSConfig.
69         ODI Handler will convert the channel number to freq. number.
70 */
71 typedef struct _NDIS_802_11_CONFIGURATION
72 {
73     ULONG           Length;             // Length of structure
74     ULONG           BeaconPeriod;       // units are Kusec
75     ULONG           ATIMWindow;         // units are Kusec
76     ULONG           DSConfig;           // Frequency, units are kHz
77     NDIS_802_11_CONFIGURATION_FH    FHConfig;
78 } NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION;
79
80
81
82 typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE
83 {
84     Ndis802_11IBSS,
85     Ndis802_11Infrastructure,
86     Ndis802_11AutoUnknown,
87     Ndis802_11InfrastructureMax,     // Not a real value, defined as upper bound
88     Ndis802_11APMode
89 } NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE;
90
91
92
93
94
95 typedef struct _NDIS_802_11_FIXED_IEs
96 {
97   UCHAR  Timestamp[8];
98   USHORT  BeaconInterval;
99   USHORT  Capabilities;
100 } NDIS_802_11_FIXED_IEs, *PNDIS_802_11_FIXED_IEs;
101
102
103
104 typedef struct _NDIS_802_11_VARIABLE_IEs
105 {
106   UCHAR  ElementID;
107   UCHAR  Length;
108   UCHAR  data[1];
109 } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs;
110
111
112
113 /*
114
115
116
117 Length is the 4 bytes multiples of the sume of
118         sizeof (NDIS_802_11_MAC_ADDRESS) + 2 + sizeof (NDIS_802_11_SSID) + sizeof (ULONG)
119 +   sizeof (NDIS_802_11_RSSI) + sizeof (NDIS_802_11_NETWORK_TYPE) + sizeof (NDIS_802_11_CONFIGURATION)
120 +   sizeof (NDIS_802_11_RATES_EX) + IELength
121
122 Except the IELength, all other fields are fixed length. Therefore, we can define a marco to present the
123 partial sum.
124
125 */
126 #if 0
127 typedef struct _NDIS_WLAN_BSSID_EX
128 {
129   ULONG  Length;
130   NDIS_802_11_MAC_ADDRESS  MacAddress;
131   UCHAR  Reserved[2];//[0]: IS beacon frame, [1]:optimum_antenna=>For antenna diversity;
132   NDIS_802_11_SSID  Ssid;
133   ULONG  Privacy;
134   NDIS_802_11_RSSI  Rssi;
135   NDIS_802_11_NETWORK_TYPE  NetworkTypeInUse;
136   NDIS_802_11_CONFIGURATION  Configuration;
137   NDIS_802_11_NETWORK_INFRASTRUCTURE  InfrastructureMode;
138   NDIS_802_11_RATES_EX  SupportedRates;
139   ULONG  IELength;
140   UCHAR  IEs[MAX_IE_SZ];        //(timestamp, beacon interval, and capability information)
141 } NDIS_WLAN_BSSID_EX, *PNDIS_WLAN_BSSID_EX;
142
143
144 typedef struct _NDIS_802_11_BSSID_LIST_EX
145 {
146   ULONG  NumberOfItems;
147   NDIS_WLAN_BSSID_EX  Bssid[1];
148 } NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX;
149 #endif
150
151 typedef enum _NDIS_802_11_AUTHENTICATION_MODE
152 {
153     Ndis802_11AuthModeOpen,
154     Ndis802_11AuthModeShared,
155     Ndis802_11AuthModeAutoSwitch,
156     Ndis802_11AuthModeWPA,
157     Ndis802_11AuthModeWPAPSK,
158     Ndis802_11AuthModeWPANone,
159     Ndis802_11AuthModeWAPI,
160     Ndis802_11AuthModeMax               // Not a real mode, defined as upper bound
161 } NDIS_802_11_AUTHENTICATION_MODE, *PNDIS_802_11_AUTHENTICATION_MODE;
162
163 typedef enum _NDIS_802_11_WEP_STATUS
164 {
165     Ndis802_11WEPEnabled,
166     Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
167     Ndis802_11WEPDisabled,
168     Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
169     Ndis802_11WEPKeyAbsent,
170     Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
171     Ndis802_11WEPNotSupported,
172     Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
173     Ndis802_11Encryption2Enabled,
174     Ndis802_11Encryption2KeyAbsent,
175     Ndis802_11Encryption3Enabled,
176     Ndis802_11Encryption3KeyAbsent,
177     Ndis802_11_EncrypteionWAPI
178 } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
179   NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
180
181
182 #define NDIS_802_11_AI_REQFI_CAPABILITIES      1
183 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL    2
184 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS  4
185
186 #define NDIS_802_11_AI_RESFI_CAPABILITIES      1
187 #define NDIS_802_11_AI_RESFI_STATUSCODE        2
188 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID     4
189
190 typedef struct _NDIS_802_11_AI_REQFI
191 {
192     USHORT Capabilities;
193     USHORT ListenInterval;
194     NDIS_802_11_MAC_ADDRESS  CurrentAPAddress;
195 } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
196
197 typedef struct _NDIS_802_11_AI_RESFI
198 {
199     USHORT Capabilities;
200     USHORT StatusCode;
201     USHORT AssociationId;
202 } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
203
204 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
205 {
206     ULONG                   Length;
207     USHORT                  AvailableRequestFixedIEs;
208     NDIS_802_11_AI_REQFI    RequestFixedIEs;
209     ULONG                   RequestIELength;
210     ULONG                   OffsetRequestIEs;
211     USHORT                  AvailableResponseFixedIEs;
212     NDIS_802_11_AI_RESFI    ResponseFixedIEs;
213     ULONG                   ResponseIELength;
214     ULONG                   OffsetResponseIEs;
215 } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
216
217 typedef enum _NDIS_802_11_RELOAD_DEFAULTS
218 {
219    Ndis802_11ReloadWEPKeys
220 } NDIS_802_11_RELOAD_DEFAULTS, *PNDIS_802_11_RELOAD_DEFAULTS;
221
222
223 // Key mapping keys require a BSSID
224 typedef struct _NDIS_802_11_KEY
225 {
226     ULONG           Length;             // Length of this structure
227     ULONG           KeyIndex;
228     ULONG           KeyLength;          // length of key in bytes
229     NDIS_802_11_MAC_ADDRESS BSSID;
230     NDIS_802_11_KEY_RSC KeyRSC;
231     UCHAR           KeyMaterial[32];     // variable length depending on above field
232 } NDIS_802_11_KEY, *PNDIS_802_11_KEY;
233
234 typedef struct _NDIS_802_11_REMOVE_KEY
235 {
236     ULONG                   Length;        // Length of this structure
237     ULONG                   KeyIndex;
238     NDIS_802_11_MAC_ADDRESS BSSID;
239 } NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY;
240
241 typedef struct _NDIS_802_11_WEP
242 {
243     ULONG     Length;        // Length of this structure
244     ULONG     KeyIndex;      // 0 is the per-client key, 1-N are the global keys
245     ULONG     KeyLength;     // length of key in bytes
246     UCHAR     KeyMaterial[16];// variable length depending on above field
247 } NDIS_802_11_WEP, *PNDIS_802_11_WEP;
248
249 typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST
250 {
251     ULONG Length;            // Length of structure
252     NDIS_802_11_MAC_ADDRESS Bssid;
253     ULONG Flags;
254 } NDIS_802_11_AUTHENTICATION_REQUEST, *PNDIS_802_11_AUTHENTICATION_REQUEST;
255
256 typedef enum _NDIS_802_11_STATUS_TYPE
257 {
258         Ndis802_11StatusType_Authentication,
259         Ndis802_11StatusType_MediaStreamMode,
260         Ndis802_11StatusType_PMKID_CandidateList,
261         Ndis802_11StatusTypeMax    // not a real type, defined as an upper bound
262 } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
263
264 typedef struct _NDIS_802_11_STATUS_INDICATION
265 {
266     NDIS_802_11_STATUS_TYPE StatusType;
267 } NDIS_802_11_STATUS_INDICATION, *PNDIS_802_11_STATUS_INDICATION;
268
269 // mask for authentication/integrity fields
270 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS        0x0f
271 #define NDIS_802_11_AUTH_REQUEST_REAUTH                 0x01
272 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE              0x02
273 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR         0x06
274 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR            0x0E
275
276 // MIC check time, 60 seconds.
277 #define MIC_CHECK_TIME  60000000
278
279 typedef struct _NDIS_802_11_AUTHENTICATION_EVENT
280 {
281     NDIS_802_11_STATUS_INDICATION       Status;
282     NDIS_802_11_AUTHENTICATION_REQUEST  Request[1];
283 } NDIS_802_11_AUTHENTICATION_EVENT, *PNDIS_802_11_AUTHENTICATION_EVENT;
284
285 typedef struct _NDIS_802_11_TEST
286 {
287     ULONG Length;
288     ULONG Type;
289     union
290     {
291         NDIS_802_11_AUTHENTICATION_EVENT AuthenticationEvent;
292         NDIS_802_11_RSSI RssiTrigger;
293     }tt;
294 } NDIS_802_11_TEST, *PNDIS_802_11_TEST;
295
296
297 #endif //end of #ifdef PLATFORM_LINUX
298
299 #ifdef PLATFORM_FREEBSD
300
301 #define NDIS_802_11_LENGTH_SSID         32
302 #define NDIS_802_11_LENGTH_RATES        8
303 #define NDIS_802_11_LENGTH_RATES_EX     16
304
305 typedef unsigned char   NDIS_802_11_MAC_ADDRESS[6];
306 typedef long                    NDIS_802_11_RSSI;           // in dBm
307 typedef unsigned char   NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES];        // Set of 8 data rates
308 typedef unsigned char   NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX];  // Set of 16 data rates
309
310
311 typedef  ULONG  NDIS_802_11_KEY_INDEX;
312 typedef unsigned long long NDIS_802_11_KEY_RSC;
313
314
315 typedef struct _NDIS_802_11_SSID
316 {
317   ULONG  SsidLength;
318   UCHAR  Ssid[32];
319 } NDIS_802_11_SSID, *PNDIS_802_11_SSID;
320
321 typedef enum _NDIS_802_11_NETWORK_TYPE
322 {
323     Ndis802_11FH,
324     Ndis802_11DS,
325     Ndis802_11OFDM5,
326     Ndis802_11OFDM24,
327     Ndis802_11NetworkTypeMax    // not a real type, defined as an upper bound
328 } NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
329
330 typedef struct _NDIS_802_11_CONFIGURATION_FH
331 {
332     ULONG           Length;             // Length of structure
333     ULONG           HopPattern;         // As defined by 802.11, MSB set
334     ULONG           HopSet;             // to one if non-802.11
335     ULONG           DwellTime;          // units are Kusec
336 } NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH;
337
338
339 /*
340         FW will only save the channel number in DSConfig.
341         ODI Handler will convert the channel number to freq. number.
342 */
343 typedef struct _NDIS_802_11_CONFIGURATION
344 {
345     ULONG           Length;             // Length of structure
346     ULONG           BeaconPeriod;       // units are Kusec
347     ULONG           ATIMWindow;         // units are Kusec
348     ULONG           DSConfig;           // Frequency, units are kHz
349     NDIS_802_11_CONFIGURATION_FH    FHConfig;
350 } NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION;
351
352
353
354 typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE
355 {
356     Ndis802_11IBSS,
357     Ndis802_11Infrastructure,
358     Ndis802_11AutoUnknown,
359     Ndis802_11InfrastructureMax,     // Not a real value, defined as upper bound
360     Ndis802_11APMode
361 } NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE;
362
363
364
365
366
367 typedef struct _NDIS_802_11_FIXED_IEs
368 {
369   UCHAR  Timestamp[8];
370   USHORT  BeaconInterval;
371   USHORT  Capabilities;
372 } NDIS_802_11_FIXED_IEs, *PNDIS_802_11_FIXED_IEs;
373
374
375
376 typedef struct _NDIS_802_11_VARIABLE_IEs
377 {
378   UCHAR  ElementID;
379   UCHAR  Length;
380   UCHAR  data[1];
381 } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs;
382
383
384
385 /*
386
387
388
389 Length is the 4 bytes multiples of the sume of
390         sizeof (NDIS_802_11_MAC_ADDRESS) + 2 + sizeof (NDIS_802_11_SSID) + sizeof (ULONG)
391 +   sizeof (NDIS_802_11_RSSI) + sizeof (NDIS_802_11_NETWORK_TYPE) + sizeof (NDIS_802_11_CONFIGURATION)
392 +   sizeof (NDIS_802_11_RATES_EX) + IELength
393
394 Except the IELength, all other fields are fixed length. Therefore, we can define a marco to present the
395 partial sum.
396
397 */
398 #if 0
399 typedef struct _NDIS_WLAN_BSSID_EX
400 {
401   ULONG  Length;
402   NDIS_802_11_MAC_ADDRESS  MacAddress;
403   UCHAR  Reserved[2];//[0]: IS beacon frame, [1]:optimum_antenna=>For antenna diversity;
404   NDIS_802_11_SSID  Ssid;
405   ULONG  Privacy;
406   NDIS_802_11_RSSI  Rssi;
407   NDIS_802_11_NETWORK_TYPE  NetworkTypeInUse;
408   NDIS_802_11_CONFIGURATION  Configuration;
409   NDIS_802_11_NETWORK_INFRASTRUCTURE  InfrastructureMode;
410   NDIS_802_11_RATES_EX  SupportedRates;
411   ULONG  IELength;
412   UCHAR  IEs[MAX_IE_SZ];        //(timestamp, beacon interval, and capability information)
413 } NDIS_WLAN_BSSID_EX, *PNDIS_WLAN_BSSID_EX;
414
415
416 typedef struct _NDIS_802_11_BSSID_LIST_EX
417 {
418   ULONG  NumberOfItems;
419   NDIS_WLAN_BSSID_EX  Bssid[1];
420 } NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX;
421 #endif
422
423 typedef enum _NDIS_802_11_AUTHENTICATION_MODE
424 {
425     Ndis802_11AuthModeOpen,
426     Ndis802_11AuthModeShared,
427     Ndis802_11AuthModeAutoSwitch,
428     Ndis802_11AuthModeWPA,
429     Ndis802_11AuthModeWPAPSK,
430     Ndis802_11AuthModeWPANone,
431     Ndis802_11AuthModeMax               // Not a real mode, defined as upper bound
432 } NDIS_802_11_AUTHENTICATION_MODE, *PNDIS_802_11_AUTHENTICATION_MODE;
433
434 typedef enum _NDIS_802_11_WEP_STATUS
435 {
436     Ndis802_11WEPEnabled,
437     Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
438     Ndis802_11WEPDisabled,
439     Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
440     Ndis802_11WEPKeyAbsent,
441     Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
442     Ndis802_11WEPNotSupported,
443     Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
444     Ndis802_11Encryption2Enabled,
445     Ndis802_11Encryption2KeyAbsent,
446     Ndis802_11Encryption3Enabled,
447     Ndis802_11Encryption3KeyAbsent
448 } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
449   NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
450
451
452 #define NDIS_802_11_AI_REQFI_CAPABILITIES      1
453 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL    2
454 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS  4
455
456 #define NDIS_802_11_AI_RESFI_CAPABILITIES      1
457 #define NDIS_802_11_AI_RESFI_STATUSCODE        2
458 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID     4
459
460 typedef struct _NDIS_802_11_AI_REQFI
461 {
462     USHORT Capabilities;
463     USHORT ListenInterval;
464     NDIS_802_11_MAC_ADDRESS  CurrentAPAddress;
465 } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
466
467 typedef struct _NDIS_802_11_AI_RESFI
468 {
469     USHORT Capabilities;
470     USHORT StatusCode;
471     USHORT AssociationId;
472 } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
473
474 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
475 {
476     ULONG                   Length;
477     USHORT                  AvailableRequestFixedIEs;
478     NDIS_802_11_AI_REQFI    RequestFixedIEs;
479     ULONG                   RequestIELength;
480     ULONG                   OffsetRequestIEs;
481     USHORT                  AvailableResponseFixedIEs;
482     NDIS_802_11_AI_RESFI    ResponseFixedIEs;
483     ULONG                   ResponseIELength;
484     ULONG                   OffsetResponseIEs;
485 } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
486
487 typedef enum _NDIS_802_11_RELOAD_DEFAULTS
488 {
489    Ndis802_11ReloadWEPKeys
490 } NDIS_802_11_RELOAD_DEFAULTS, *PNDIS_802_11_RELOAD_DEFAULTS;
491
492
493 // Key mapping keys require a BSSID
494 typedef struct _NDIS_802_11_KEY
495 {
496     ULONG           Length;             // Length of this structure
497     ULONG           KeyIndex;
498     ULONG           KeyLength;          // length of key in bytes
499     NDIS_802_11_MAC_ADDRESS BSSID;
500     NDIS_802_11_KEY_RSC KeyRSC;
501     UCHAR           KeyMaterial[32];     // variable length depending on above field
502 } NDIS_802_11_KEY, *PNDIS_802_11_KEY;
503
504 typedef struct _NDIS_802_11_REMOVE_KEY
505 {
506     ULONG                   Length;        // Length of this structure
507     ULONG                   KeyIndex;
508     NDIS_802_11_MAC_ADDRESS BSSID;
509 } NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY;
510
511 typedef struct _NDIS_802_11_WEP
512 {
513     ULONG     Length;        // Length of this structure
514     ULONG     KeyIndex;      // 0 is the per-client key, 1-N are the global keys
515     ULONG     KeyLength;     // length of key in bytes
516     UCHAR     KeyMaterial[16];// variable length depending on above field
517 } NDIS_802_11_WEP, *PNDIS_802_11_WEP;
518
519 typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST
520 {
521     ULONG Length;            // Length of structure
522     NDIS_802_11_MAC_ADDRESS Bssid;
523     ULONG Flags;
524 } NDIS_802_11_AUTHENTICATION_REQUEST, *PNDIS_802_11_AUTHENTICATION_REQUEST;
525
526 typedef enum _NDIS_802_11_STATUS_TYPE
527 {
528         Ndis802_11StatusType_Authentication,
529         Ndis802_11StatusType_MediaStreamMode,
530         Ndis802_11StatusType_PMKID_CandidateList,
531         Ndis802_11StatusTypeMax    // not a real type, defined as an upper bound
532 } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
533
534 typedef struct _NDIS_802_11_STATUS_INDICATION
535 {
536     NDIS_802_11_STATUS_TYPE StatusType;
537 } NDIS_802_11_STATUS_INDICATION, *PNDIS_802_11_STATUS_INDICATION;
538
539 // mask for authentication/integrity fields
540 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS        0x0f
541 #define NDIS_802_11_AUTH_REQUEST_REAUTH                 0x01
542 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE              0x02
543 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR         0x06
544 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR            0x0E
545
546 // MIC check time, 60 seconds.
547 #define MIC_CHECK_TIME  60000000
548
549 typedef struct _NDIS_802_11_AUTHENTICATION_EVENT
550 {
551     NDIS_802_11_STATUS_INDICATION       Status;
552     NDIS_802_11_AUTHENTICATION_REQUEST  Request[1];
553 } NDIS_802_11_AUTHENTICATION_EVENT, *PNDIS_802_11_AUTHENTICATION_EVENT;
554
555 typedef struct _NDIS_802_11_TEST
556 {
557     ULONG Length;
558     ULONG Type;
559     union
560     {
561         NDIS_802_11_AUTHENTICATION_EVENT AuthenticationEvent;
562         NDIS_802_11_RSSI RssiTrigger;
563     }tt;
564 } NDIS_802_11_TEST, *PNDIS_802_11_TEST;
565
566
567 #endif //PLATFORM_FREEBSD
568 #ifndef Ndis802_11APMode
569 #define Ndis802_11APMode (Ndis802_11InfrastructureMax+1)
570 #endif
571
572 typedef struct _WLAN_PHY_INFO
573 {
574         u8      SignalStrength;//(in percentage)
575         u8      SignalQuality;//(in percentage)
576         u8      Optimum_antenna;  //for Antenna diversity
577         u8      Reserved_0;
578 }WLAN_PHY_INFO,*PWLAN_PHY_INFO;
579
580 typedef struct _WLAN_BCN_INFO
581 {
582         /* these infor get from rtw_get_encrypt_info when
583          *       * translate scan to UI */
584         u8 encryp_protocol;//ENCRYP_PROTOCOL_E: OPEN/WEP/WPA/WPA2/WAPI
585         int group_cipher; //WPA/WPA2 group cipher
586         int pairwise_cipher;////WPA/WPA2/WEP pairwise cipher
587         int is_8021x;
588
589         /* bwmode 20/40 and ch_offset UP/LOW */
590         unsigned short  ht_cap_info;
591         unsigned char   ht_info_infos_0;
592 }WLAN_BCN_INFO,*PWLAN_BCN_INFO;
593
594 /* temporally add #pragma pack for structure alignment issue of
595 *   WLAN_BSSID_EX and get_WLAN_BSSID_EX_sz()
596 */
597 #ifdef PLATFORM_WINDOWS
598 #pragma pack(push)
599 #pragma pack(1)
600 #endif
601 typedef struct _WLAN_BSSID_EX
602 {
603   ULONG  Length;
604   NDIS_802_11_MAC_ADDRESS  MacAddress;
605   UCHAR  Reserved[2];//[0]: IS beacon frame
606   NDIS_802_11_SSID  Ssid;
607   ULONG  Privacy;
608   NDIS_802_11_RSSI  Rssi;//(in dBM,raw data ,get from PHY)
609   NDIS_802_11_NETWORK_TYPE  NetworkTypeInUse;
610   NDIS_802_11_CONFIGURATION  Configuration;
611   NDIS_802_11_NETWORK_INFRASTRUCTURE  InfrastructureMode;
612   NDIS_802_11_RATES_EX  SupportedRates;
613   WLAN_PHY_INFO PhyInfo;
614   ULONG  IELength;
615   UCHAR  IEs[MAX_IE_SZ];        //(timestamp, beacon interval, and capability information)
616 }
617 #ifndef PLATFORM_WINDOWS
618 __attribute__((packed))
619 #endif
620 WLAN_BSSID_EX, *PWLAN_BSSID_EX;
621 #ifdef PLATFORM_WINDOWS
622 #pragma pack(pop)
623 #endif
624
625 __inline  static uint get_WLAN_BSSID_EX_sz(WLAN_BSSID_EX *bss)
626 {
627 #if 0
628         uint t_len;
629
630         t_len = sizeof (ULONG)
631                 + sizeof (NDIS_802_11_MAC_ADDRESS)
632                 + 2
633                 + sizeof (NDIS_802_11_SSID)
634                 + sizeof (ULONG)
635                 + sizeof (NDIS_802_11_RSSI)
636                 + sizeof (NDIS_802_11_NETWORK_TYPE)
637                 + sizeof (NDIS_802_11_CONFIGURATION)
638                 + sizeof (NDIS_802_11_NETWORK_INFRASTRUCTURE)
639                 + sizeof (NDIS_802_11_RATES_EX)
640                 //all new member add here
641                 + sizeof(WLAN_PHY_INFO)
642                 //all new member add here
643                 + sizeof (ULONG)
644                 + bss->IELength;
645         return t_len;
646 #else
647         return (sizeof(WLAN_BSSID_EX) -MAX_IE_SZ + bss->IELength);
648 #endif
649 }
650
651 struct  wlan_network {
652         _list   list;
653         int     network_type;   //refer to ieee80211.h for WIRELESS_11A/B/G
654         int     fixed;                  // set to fixed when not to be removed as site-surveying
655         unsigned long   last_scanned; //timestamp for the network
656         int     aid;                    //will only be valid when a BSS is joinned.
657         int     join_res;
658         WLAN_BSSID_EX   network; //must be the last item
659         WLAN_BCN_INFO   BcnInfo;
660 #ifdef PLATFORM_WINDOWS
661         unsigned char  iebuf[MAX_IE_SZ];
662 #endif
663
664 };
665
666 enum VRTL_CARRIER_SENSE
667 {
668     DISABLE_VCS,
669     ENABLE_VCS,
670     AUTO_VCS
671 };
672
673 enum VCS_TYPE
674 {
675     NONE_VCS,
676     RTS_CTS,
677     CTS_TO_SELF
678 };
679
680
681
682
683 #define PWR_CAM 0
684 #define PWR_MINPS 1
685 #define PWR_MAXPS 2
686 #define PWR_UAPSD 3
687 #define PWR_VOIP 4
688
689
690 enum UAPSD_MAX_SP
691 {
692         NO_LIMIT,
693        TWO_MSDU,
694        FOUR_MSDU,
695        SIX_MSDU
696 };
697
698
699 //john
700 #define NUM_PRE_AUTH_KEY 16
701 #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY
702
703 /*
704 *       WPA2
705 */
706
707 #ifndef PLATFORM_OS_CE
708 typedef struct _PMKID_CANDIDATE {
709     NDIS_802_11_MAC_ADDRESS BSSID;
710     ULONG Flags;
711 } PMKID_CANDIDATE, *PPMKID_CANDIDATE;
712
713 typedef struct _NDIS_802_11_PMKID_CANDIDATE_LIST
714 {
715     ULONG Version;       // Version of the structure
716     ULONG NumCandidates; // No. of pmkid candidates
717     PMKID_CANDIDATE CandidateList[1];
718 } NDIS_802_11_PMKID_CANDIDATE_LIST, *PNDIS_802_11_PMKID_CANDIDATE_LIST;
719
720
721 typedef struct _NDIS_802_11_AUTHENTICATION_ENCRYPTION
722 {
723         NDIS_802_11_AUTHENTICATION_MODE AuthModeSupported;
724         NDIS_802_11_ENCRYPTION_STATUS EncryptStatusSupported;
725
726 } NDIS_802_11_AUTHENTICATION_ENCRYPTION, *PNDIS_802_11_AUTHENTICATION_ENCRYPTION;
727
728 typedef struct _NDIS_802_11_CAPABILITY
729 {
730         ULONG  Length;
731         ULONG  Version;
732         ULONG  NoOfPMKIDs;
733         ULONG  NoOfAuthEncryptPairsSupported;
734         NDIS_802_11_AUTHENTICATION_ENCRYPTION AuthenticationEncryptionSupported[1];
735
736 } NDIS_802_11_CAPABILITY, *PNDIS_802_11_CAPABILITY;
737 #endif
738
739
740 #endif //#ifndef WLAN_BSSDEF_H_