1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
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.
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
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
19 ******************************************************************************/
20 #ifndef __WLAN_BSSDEF_H__
21 #define __WLAN_BSSDEF_H__
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
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
37 typedef u32 NDIS_802_11_KEY_INDEX;
38 typedef unsigned long long NDIS_802_11_KEY_RSC;
41 typedef struct _NDIS_802_11_SSID
45 } NDIS_802_11_SSID, *PNDIS_802_11_SSID;
47 typedef enum _NDIS_802_11_NETWORK_TYPE
53 Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound
54 } NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
56 typedef struct _NDIS_802_11_CONFIGURATION_FH
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;
66 FW will only save the channel number in DSConfig.
67 ODI Handler will convert the channel number to freq. number.
69 typedef struct _NDIS_802_11_CONFIGURATION
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;
80 typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE
83 Ndis802_11Infrastructure,
84 Ndis802_11AutoUnknown,
85 Ndis802_11InfrastructureMax, // Not a real value, defined as upper bound
87 } NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE;
90 typedef struct _NDIS_802_11_FIXED_IEs
95 } NDIS_802_11_FIXED_IEs, *PNDIS_802_11_FIXED_IEs;
99 typedef struct _NDIS_802_11_VARIABLE_IEs
104 } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs;
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
117 Except the IELength, all other fields are fixed length. Therefore, we can define a marco to present the
122 typedef struct _NDIS_WLAN_BSSID_EX
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;
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;
135 u8 IEs[MAX_IE_SZ]; //(timestamp, beacon interval, and capability information)
136 } NDIS_WLAN_BSSID_EX, *PNDIS_WLAN_BSSID_EX;
139 typedef struct _NDIS_802_11_BSSID_LIST_EX
142 NDIS_WLAN_BSSID_EX Bssid[1];
143 } NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX;
146 typedef enum _NDIS_802_11_AUTHENTICATION_MODE
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;
158 typedef enum _NDIS_802_11_WEP_STATUS
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;
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
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
185 typedef struct _NDIS_802_11_AI_REQFI
189 NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
190 } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
192 typedef struct _NDIS_802_11_AI_RESFI
197 } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
199 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
202 u16 AvailableRequestFixedIEs;
203 NDIS_802_11_AI_REQFI RequestFixedIEs;
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;
212 typedef enum _NDIS_802_11_RELOAD_DEFAULTS
214 Ndis802_11ReloadWEPKeys
215 } NDIS_802_11_RELOAD_DEFAULTS, *PNDIS_802_11_RELOAD_DEFAULTS;
218 // Key mapping keys require a BSSID
219 typedef struct _NDIS_802_11_KEY
221 u32 Length; // Length of this structure
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;
229 typedef struct _NDIS_802_11_REMOVE_KEY
231 u32 Length; // Length of this structure
233 NDIS_802_11_MAC_ADDRESS BSSID;
234 } NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY;
236 typedef struct _NDIS_802_11_WEP
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;
244 typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST
246 u32 Length; // Length of structure
247 NDIS_802_11_MAC_ADDRESS Bssid;
249 } NDIS_802_11_AUTHENTICATION_REQUEST, *PNDIS_802_11_AUTHENTICATION_REQUEST;
251 typedef enum _NDIS_802_11_STATUS_TYPE
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;
259 typedef struct _NDIS_802_11_STATUS_INDICATION
261 NDIS_802_11_STATUS_TYPE StatusType;
262 } NDIS_802_11_STATUS_INDICATION, *PNDIS_802_11_STATUS_INDICATION;
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
271 // MIC check time, 60 seconds.
272 #define MIC_CHECK_TIME 60000000
274 typedef struct _NDIS_802_11_AUTHENTICATION_EVENT
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;
280 typedef struct _NDIS_802_11_TEST
286 NDIS_802_11_AUTHENTICATION_EVENT AuthenticationEvent;
287 NDIS_802_11_RSSI RssiTrigger;
289 } NDIS_802_11_TEST, *PNDIS_802_11_TEST;
291 #ifndef Ndis802_11APMode
292 #define Ndis802_11APMode (Ndis802_11InfrastructureMax+1)
295 typedef struct _WLAN_PHY_INFO
297 u8 SignalStrength;//(in percentage)
298 u8 SignalQuality;//(in percentage)
299 u8 Optimum_antenna; //for Antenna diversity
301 }WLAN_PHY_INFO,*PWLAN_PHY_INFO;
303 typedef struct _WLAN_BCN_INFO
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
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;
317 typedef struct _WLAN_BSSID_EX
320 NDIS_802_11_MAC_ADDRESS MacAddress;
321 u8 Reserved[2];//[0]: IS beacon frame
322 NDIS_802_11_SSID Ssid;
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;
331 u8 IEs[MAX_IE_SZ]; //(timestamp, beacon interval, and capability information)
332 }__attribute__((packed))
333 WLAN_BSSID_EX, *PWLAN_BSSID_EX;
335 __inline static uint get_WLAN_BSSID_EX_sz(WLAN_BSSID_EX *bss)
341 + sizeof (NDIS_802_11_MAC_ADDRESS)
343 + sizeof (NDIS_802_11_SSID)
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
357 return (sizeof(WLAN_BSSID_EX) -MAX_IE_SZ + bss->IELength);
361 struct wlan_network {
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.
368 WLAN_BSSID_EX network; //must be the last item
369 WLAN_BCN_INFO BcnInfo;
372 enum VRTL_CARRIER_SENSE
406 #define NUM_PRE_AUTH_KEY 16
407 #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY
413 typedef struct _PMKID_CANDIDATE {
414 NDIS_802_11_MAC_ADDRESS BSSID;
416 } PMKID_CANDIDATE, *PPMKID_CANDIDATE;
418 typedef struct _NDIS_802_11_PMKID_CANDIDATE_LIST
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;
426 typedef struct _NDIS_802_11_AUTHENTICATION_ENCRYPTION
428 NDIS_802_11_AUTHENTICATION_MODE AuthModeSupported;
429 NDIS_802_11_ENCRYPTION_STATUS EncryptStatusSupported;
431 } NDIS_802_11_AUTHENTICATION_ENCRYPTION, *PNDIS_802_11_AUTHENTICATION_ENCRYPTION;
433 typedef struct _NDIS_802_11_CAPABILITY
438 u32 NoOfAuthEncryptPairsSupported;
439 NDIS_802_11_AUTHENTICATION_ENCRYPTION AuthenticationEncryptionSupported[1];
441 } NDIS_802_11_CAPABILITY, *PNDIS_802_11_CAPABILITY;
444 #endif //#ifndef WLAN_BSSDEF_H_