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 ******************************************************************************/
15 #ifndef __WLAN_BSSDEF_H__
16 #define __WLAN_BSSDEF_H__
22 #define NDIS_802_11_LENGTH_SSID 32
23 #define NDIS_802_11_LENGTH_RATES 8
24 #define NDIS_802_11_LENGTH_RATES_EX 16
26 typedef unsigned char NDIS_802_11_MAC_ADDRESS[6];
27 typedef unsigned char NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; /* Set of 8 data rates */
28 typedef unsigned char NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; /* Set of 16 data rates */
30 struct ndis_802_11_ssid {
35 enum NDIS_802_11_NETWORK_TYPE {
40 Ndis802_11NetworkTypeMax /* not a real type, defined as an upper bound */
43 struct ndis_802_11_conf_fh {
44 u32 Length; /* Length of structure */
45 u32 HopPattern; /* As defined by 802.11, MSB set */
46 u32 HopSet; /* to one if non-802.11 */
47 u32 DwellTime; /* units are Kusec */
51 FW will only save the channel number in DSConfig.
52 ODI Handler will convert the channel number to freq. number.
54 struct ndis_802_11_conf {
55 u32 Length; /* Length of structure */
56 u32 BeaconPeriod; /* units are Kusec */
57 u32 ATIMWindow; /* units are Kusec */
58 u32 DSConfig; /* Frequency, units are kHz */
59 struct ndis_802_11_conf_fh FHConfig;
62 enum NDIS_802_11_NETWORK_INFRASTRUCTURE {
64 Ndis802_11Infrastructure,
65 Ndis802_11AutoUnknown,
66 Ndis802_11InfrastructureMax, /* Not a real value, defined as upper bound */
70 struct ndis_802_11_fix_ie {
76 struct ndis_80211_var_ie {
82 /* Length is the 4 bytes multiples of the sum of
83 * sizeof (NDIS_802_11_MAC_ADDRESS) + 2 +
84 * sizeof (struct ndis_802_11_ssid) + sizeof (u32) +
85 * sizeof (long) + sizeof (enum NDIS_802_11_NETWORK_TYPE) +
86 * sizeof (struct ndis_802_11_conf) + sizeof (NDIS_802_11_RATES_EX) + IELength
88 * Except for IELength, all other fields are fixed length. Therefore, we can
89 * define a macro to present the partial sum.
91 enum NDIS_802_11_AUTHENTICATION_MODE {
92 Ndis802_11AuthModeOpen,
93 Ndis802_11AuthModeShared,
94 Ndis802_11AuthModeAutoSwitch,
95 Ndis802_11AuthModeWPA,
96 Ndis802_11AuthModeWPAPSK,
97 Ndis802_11AuthModeWPANone,
98 Ndis802_11AuthModeWAPI,
99 Ndis802_11AuthModeMax /* Not a real mode, defined as upper bound */
102 enum NDIS_802_11_WEP_STATUS {
103 Ndis802_11WEPEnabled,
104 Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
105 Ndis802_11WEPDisabled,
106 Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
107 Ndis802_11WEPKeyAbsent,
108 Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
109 Ndis802_11WEPNotSupported,
110 Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
111 Ndis802_11Encryption2Enabled,
112 Ndis802_11Encryption2KeyAbsent,
113 Ndis802_11Encryption3Enabled,
114 Ndis802_11Encryption3KeyAbsent,
115 Ndis802_11_EncrypteionWAPI
118 #define NDIS_802_11_AI_REQFI_CAPABILITIES 1
119 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2
120 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4
122 #define NDIS_802_11_AI_RESFI_CAPABILITIES 1
123 #define NDIS_802_11_AI_RESFI_STATUSCODE 2
124 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4
126 struct ndis_802_11_ai_reqfi {
129 NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
132 struct ndis_801_11_ai_resfi {
138 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
141 u16 AvailableRequestFixedIEs;
142 struct ndis_802_11_ai_reqfi RequestFixedIEs;
144 u32 OffsetRequestIEs;
145 u16 AvailableResponseFixedIEs;
146 struct ndis_801_11_ai_resfi ResponseFixedIEs;
147 u32 ResponseIELength;
148 u32 OffsetResponseIEs;
149 } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
151 enum NDIS_802_11_RELOAD_DEFAULTS {
152 Ndis802_11ReloadWEPKeys
156 /* Key mapping keys require a BSSID */
157 typedef struct _NDIS_802_11_KEY
159 u32 Length; /* Length of this structure */
161 u32 KeyLength; /* length of key in bytes */
162 NDIS_802_11_MAC_ADDRESS BSSID;
163 unsigned long long KeyRSC;
164 u8 KeyMaterial[32]; /* variable length depending on above field */
165 } NDIS_802_11_KEY, *PNDIS_802_11_KEY;
167 typedef struct _NDIS_802_11_REMOVE_KEY
169 u32 Length; /* Length of this structure */
171 NDIS_802_11_MAC_ADDRESS BSSID;
172 } NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY;
174 struct ndis_802_11_wep {
175 u32 Length; /* Length of this structure */
176 u32 KeyIndex; /* 0 is the per-client key, 1-N are the global keys */
177 u32 KeyLength; /* length of key in bytes */
178 u8 KeyMaterial[16];/* variable length depending on above field */
181 /* mask for authentication/integrity fields */
182 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
183 #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
184 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
185 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
186 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
188 /* MIC check time, 60 seconds. */
189 #define MIC_CHECK_TIME 60000000
191 #ifndef Ndis802_11APMode
192 #define Ndis802_11APMode (Ndis802_11InfrastructureMax+1)
195 struct wlan_phy_info {
196 u8 SignalStrength;/* in percentage) */
197 u8 SignalQuality;/* in percentage) */
198 u8 Optimum_antenna; /* for Antenna diversity */
202 struct wlan_bcn_info {
203 /* these infor get from rtw_get_encrypt_info when
204 * * translate scan to UI */
205 u8 encryp_protocol;/* ENCRYP_PROTOCOL_E: OPEN/WEP/WPA/WPA2/WAPI */
206 int group_cipher; /* WPA/WPA2 group cipher */
207 int pairwise_cipher;/* WPA/WPA2/WEP pairwise cipher */
210 /* bwmode 20/40 and ch_offset UP/LOW */
211 unsigned short ht_cap_info;
212 unsigned char ht_info_infos_0;
215 /* temporally add #pragma pack for structure alignment issue of
216 * struct wlan_bssid_ex and get_wlan_bssid_ex_sz()
218 struct wlan_bssid_ex {
220 NDIS_802_11_MAC_ADDRESS MacAddress;
221 u8 Reserved[2];/* 0]: IS beacon frame */
222 struct ndis_802_11_ssid Ssid;
224 long Rssi;/* in dBM, raw data , get from PHY) */
225 enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
226 struct ndis_802_11_conf Configuration;
227 enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
228 NDIS_802_11_RATES_EX SupportedRates;
229 struct wlan_phy_info PhyInfo;
231 u8 IEs[MAX_IE_SZ]; /* timestamp, beacon interval, and capability information) */
234 __inline static uint get_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss)
236 return (sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + bss->IELength);
239 struct wlan_network {
240 struct list_head list;
241 int network_type; /* refer to ieee80211.h for WIRELESS_11A/B/G */
242 int fixed; /* set to fixed when not to be removed as site-surveying */
243 unsigned long last_scanned; /* timestamp for the network */
244 int aid; /* will only be valid when a BSS is joinned. */
246 struct wlan_bssid_ex network; /* must be the last item */
247 struct wlan_bcn_info BcnInfo;
250 enum VRTL_CARRIER_SENSE {
275 #define NUM_PRE_AUTH_KEY 16
276 #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY
278 #endif /* ifndef WLAN_BSSDEF_H_ */