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