OSDN Git Service

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