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__
26 #define NDIS_802_11_LENGTH_SSID 32
27 #define NDIS_802_11_LENGTH_RATES 8
28 #define NDIS_802_11_LENGTH_RATES_EX 16
30 #define NDIS_802_11_RSSI long /* in dBm */
32 struct ndis_802_11_ssid {
37 enum NDIS_802_11_NETWORK_TYPE {
42 Ndis802_11NetworkTypeMax /* dummy upper bound */
45 struct ndis_802_11_config_fh {
46 u32 Length; /* Length of structure */
47 u32 HopPattern; /* As defined by 802.11, MSB set */
48 u32 HopSet; /* to one if non-802.11 */
49 u32 DwellTime; /* units are Kusec */
53 * FW will only save the channel number in DSConfig.
54 * ODI Handler will convert the channel number to freq. number.
56 struct ndis_802_11_config {
57 u32 Length; /* Length of structure */
58 u32 BeaconPeriod; /* units are Kusec */
59 u32 ATIMWindow; /* units are Kusec */
60 u32 DSConfig; /* Frequency, units are kHz */
61 struct ndis_802_11_config_fh FHConfig;
64 enum ndis_802_11_network_infra {
66 Ndis802_11Infrastructure,
67 Ndis802_11AutoUnknown,
68 Ndis802_11InfrastructureMax, /* dummy upper bound */
72 struct ndis_802_11_fixed_ie {
80 struct ndis_802_11_var_ie {
87 * Length is the 4 bytes multiples of the sume of
88 * [ETH_ALEN] + 2 + sizeof (struct ndis_802_11_ssid) + sizeof (u32)
89 * + sizeof (NDIS_802_11_RSSI) + sizeof (enum NDIS_802_11_NETWORK_TYPE)
90 * + sizeof (struct ndis_802_11_config)
91 * + NDIS_802_11_LENGTH_RATES_EX + IELength
93 * Except the IELength, all other fields are fixed length.
94 * Therefore, we can define a macro to represent the partial sum. */
96 enum ndis_802_11_auth_mode {
97 Ndis802_11AuthModeOpen,
98 Ndis802_11AuthModeShared,
99 Ndis802_11AuthModeAutoSwitch,
100 Ndis802_11AuthModeWPA,
101 Ndis802_11AuthModeWPAPSK,
102 Ndis802_11AuthModeWPANone,
103 Ndis802_11AuthModeWAPI,
104 Ndis802_11AuthModeMax /* Not a real mode, upper bound */
107 enum ndis_802_11_wep_status {
108 Ndis802_11WEPEnabled,
109 Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
110 Ndis802_11WEPDisabled,
111 Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
112 Ndis802_11WEPKeyAbsent,
113 Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
114 Ndis802_11WEPNotSupported,
115 Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
116 Ndis802_11Encryption2Enabled,
117 Ndis802_11Encryption2KeyAbsent,
118 Ndis802_11Encryption3Enabled,
119 Ndis802_11Encryption3KeyAbsent,
120 Ndis802_11_EncryptionWAPI
123 #define NDIS_802_11_AI_REQFI_CAPABILITIES 1
124 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2
125 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4
127 #define NDIS_802_11_AI_RESFI_CAPABILITIES 1
128 #define NDIS_802_11_AI_RESFI_STATUSCODE 2
129 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4
131 struct ndis_802_11_ai_reqfi {
134 unsigned char CurrentAPAddress[ETH_ALEN];
137 struct ndis_802_11_ai_resfi {
143 struct ndis_802_11_assoc_info {
145 u16 AvailableRequestFixedIEs;
146 struct ndis_802_11_ai_reqfi RequestFixedIEs;
148 u32 OffsetRequestIEs;
149 u16 AvailableResponseFixedIEs;
150 struct ndis_802_11_ai_resfi ResponseFixedIEs;
151 u32 ResponseIELength;
152 u32 OffsetResponseIEs;
155 enum ndis_802_11_reload_def {
156 Ndis802_11ReloadWEPKeys
159 /* Key mapping keys require a BSSID */
160 struct ndis_802_11_key {
161 u32 Length; /* Length of this structure */
163 u32 KeyLength; /* length of key in bytes */
164 unsigned char BSSID[ETH_ALEN];
165 unsigned long long KeyRSC;
166 u8 KeyMaterial[32]; /* var len depending on above field */
169 struct ndis_802_11_remove_key {
170 u32 Length; /* Length */
172 unsigned char BSSID[ETH_ALEN];
175 struct ndis_802_11_wep {
176 u32 Length; /* Length of this structure */
177 u32 KeyIndex; /* 0 is the per-client key,
178 * 1-N are the global keys */
179 u32 KeyLength; /* length of key in bytes */
180 u8 KeyMaterial[16];/* variable len depending on above field */
183 struct ndis_802_11_auth_req {
184 u32 Length; /* Length of structure */
185 unsigned char Bssid[ETH_ALEN];
189 enum ndis_802_11_status_type {
190 Ndis802_11StatusType_Authentication,
191 Ndis802_11StatusType_MediaStreamMode,
192 Ndis802_11StatusType_PMKID_CandidateList,
193 Ndis802_11StatusTypeMax /* not a real type, defined as
197 struct ndis_802_11_status_ind {
198 enum ndis_802_11_status_type StatusType;
201 /* mask for authentication/integrity fields */
202 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
203 #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
204 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
205 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
206 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
208 /* MIC check time, 60 seconds. */
209 #define MIC_CHECK_TIME 60000000
211 struct ndis_802_11_auth_evt {
212 struct ndis_802_11_status_ind Status;
213 struct ndis_802_11_auth_req Request[1];
216 struct ndis_802_11_test {
220 struct ndis_802_11_auth_evt AuthenticationEvent;
221 NDIS_802_11_RSSI RssiTrigger;
226 #ifndef Ndis802_11APMode
227 #define Ndis802_11APMode (Ndis802_11InfrastructureMax+1)
230 struct wlan_phy_info {
231 u8 SignalStrength;/* in percentage) */
232 u8 SignalQuality;/* in percentage) */
233 u8 Optimum_antenna; /* for Antenna diversity */
237 struct wlan_bcn_info {
238 /* these infor get from rtw_get_encrypt_info when
239 * * translate scan to UI */
240 u8 encryp_protocol;/* ENCRYP_PROTOCOL_E: OPEN/WEP/WPA/WPA2/WAPI */
241 int group_cipher; /* WPA/WPA2 group cipher */
242 int pairwise_cipher;/* WPA/WPA2/WEP pairwise cipher */
245 /* bwmode 20/40 and ch_offset UP/LOW */
246 unsigned short ht_cap_info;
247 unsigned char ht_info_infos_0;
250 /* temporally add #pragma pack for structure alignment issue of
251 * struct wlan_bssid_ex and get_struct wlan_bssid_ex_sz()
253 struct wlan_bssid_ex {
255 unsigned char MacAddress[ETH_ALEN];
256 u8 Reserved[2];/* 0]: IS beacon frame */
257 struct ndis_802_11_ssid Ssid;
259 NDIS_802_11_RSSI Rssi;/* in dBM,raw data ,get from PHY) */
260 enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
261 struct ndis_802_11_config Configuration;
262 enum ndis_802_11_network_infra InfrastructureMode;
263 unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
264 struct wlan_phy_info PhyInfo;
266 u8 IEs[MAX_IE_SZ]; /* timestamp, beacon interval, and
267 * capability information) */
270 static inline uint get_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss)
272 return sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + bss->IELength;
275 struct wlan_network {
276 struct list_head list;
277 int network_type; /* refer to ieee80211.h for WIRELESS_11A/B/G */
278 int fixed; /* set fixed when not to be removed
279 * in site-surveying */
280 unsigned long last_scanned; /* timestamp for the network */
281 int aid; /* will only be valid when a BSS is joinned. */
283 struct wlan_bssid_ex network; /* must be the last item */
284 struct wlan_bcn_info BcnInfo;
287 enum VRTL_CARRIER_SENSE {
312 #define NUM_PRE_AUTH_KEY 16
313 #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY
319 struct pmkid_candidate {
320 unsigned char BSSID[ETH_ALEN];
324 struct ndis_802_11_pmkid_list {
325 u32 Version; /* Version of the structure */
326 u32 NumCandidates; /* No. of pmkid candidates */
327 struct pmkid_candidate CandidateList[1];
330 struct ndis_802_11_auth_encrypt {
331 enum ndis_802_11_auth_mode AuthModeSupported;
332 enum ndis_802_11_wep_status EncryptStatusSupported;
335 struct ndis_802_11_cap {
339 u32 NoOfAuthEncryptPairsSupported;
340 struct ndis_802_11_auth_encrypt AuthenticationEncryptionSupported[1];
343 #endif /* ifndef WLAN_BSSDEF_H_ */