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 struct ndis_802_11_remove_key {
160 u32 Length; /* Length */
162 unsigned char BSSID[ETH_ALEN];
165 struct ndis_802_11_wep {
166 u32 Length; /* Length of this structure */
167 u32 KeyIndex; /* 0 is the per-client key,
168 * 1-N are the global keys */
169 u32 KeyLength; /* length of key in bytes */
170 u8 KeyMaterial[16];/* variable len depending on above field */
173 struct ndis_802_11_auth_req {
174 u32 Length; /* Length of structure */
175 unsigned char Bssid[ETH_ALEN];
179 enum ndis_802_11_status_type {
180 Ndis802_11StatusType_Authentication,
181 Ndis802_11StatusType_MediaStreamMode,
182 Ndis802_11StatusType_PMKID_CandidateList,
183 Ndis802_11StatusTypeMax /* not a real type, defined as
187 struct ndis_802_11_status_ind {
188 enum ndis_802_11_status_type StatusType;
191 /* mask for authentication/integrity fields */
192 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
193 #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
194 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
195 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
196 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
198 /* MIC check time, 60 seconds. */
199 #define MIC_CHECK_TIME 60000000
201 struct ndis_802_11_auth_evt {
202 struct ndis_802_11_status_ind Status;
203 struct ndis_802_11_auth_req Request[1];
206 struct ndis_802_11_test {
210 struct ndis_802_11_auth_evt AuthenticationEvent;
211 NDIS_802_11_RSSI RssiTrigger;
216 #ifndef Ndis802_11APMode
217 #define Ndis802_11APMode (Ndis802_11InfrastructureMax+1)
220 struct wlan_phy_info {
221 u8 SignalStrength;/* in percentage) */
222 u8 SignalQuality;/* in percentage) */
223 u8 Optimum_antenna; /* for Antenna diversity */
227 struct wlan_bcn_info {
228 /* these infor get from rtw_get_encrypt_info when
229 * * translate scan to UI */
230 u8 encryp_protocol;/* ENCRYP_PROTOCOL_E: OPEN/WEP/WPA/WPA2/WAPI */
231 int group_cipher; /* WPA/WPA2 group cipher */
232 int pairwise_cipher;/* WPA/WPA2/WEP pairwise cipher */
235 /* bwmode 20/40 and ch_offset UP/LOW */
236 unsigned short ht_cap_info;
237 unsigned char ht_info_infos_0;
240 /* temporally add #pragma pack for structure alignment issue of
241 * struct wlan_bssid_ex and get_struct wlan_bssid_ex_sz()
243 struct wlan_bssid_ex {
245 unsigned char MacAddress[ETH_ALEN];
246 u8 Reserved[2];/* 0]: IS beacon frame */
247 struct ndis_802_11_ssid Ssid;
249 NDIS_802_11_RSSI Rssi;/* in dBM,raw data ,get from PHY) */
250 enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
251 struct ndis_802_11_config Configuration;
252 enum ndis_802_11_network_infra InfrastructureMode;
253 unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
254 struct wlan_phy_info PhyInfo;
256 u8 IEs[MAX_IE_SZ]; /* timestamp, beacon interval, and
257 * capability information) */
260 static inline uint get_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss)
262 return sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + bss->IELength;
265 struct wlan_network {
266 struct list_head list;
267 int network_type; /* refer to ieee80211.h for WIRELESS_11A/B/G */
268 int fixed; /* set fixed when not to be removed
269 * in site-surveying */
270 unsigned long last_scanned; /* timestamp for the network */
271 int aid; /* will only be valid when a BSS is joinned. */
273 struct wlan_bssid_ex network; /* must be the last item */
274 struct wlan_bcn_info BcnInfo;
277 enum VRTL_CARRIER_SENSE {
302 #define NUM_PRE_AUTH_KEY 16
303 #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY
309 struct pmkid_candidate {
310 unsigned char BSSID[ETH_ALEN];
314 struct ndis_802_11_pmkid_list {
315 u32 Version; /* Version of the structure */
316 u32 NumCandidates; /* No. of pmkid candidates */
317 struct pmkid_candidate CandidateList[1];
320 struct ndis_802_11_auth_encrypt {
321 enum ndis_802_11_auth_mode AuthModeSupported;
322 enum ndis_802_11_wep_status EncryptStatusSupported;
325 struct ndis_802_11_cap {
329 u32 NoOfAuthEncryptPairsSupported;
330 struct ndis_802_11_auth_encrypt AuthenticationEncryptionSupported[1];
333 #endif /* ifndef WLAN_BSSDEF_H_ */