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