1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright(c) 2007 - 2011 Realtek Corporation. */
4 #ifndef __WLAN_BSSDEF_H__
5 #define __WLAN_BSSDEF_H__
9 #define NDIS_802_11_LENGTH_SSID 32
10 #define NDIS_802_11_LENGTH_RATES 8
11 #define NDIS_802_11_LENGTH_RATES_EX 16
13 #define NDIS_802_11_RSSI long /* in dBm */
15 struct ndis_802_11_ssid {
20 enum NDIS_802_11_NETWORK_TYPE {
25 Ndis802_11NetworkTypeMax /* dummy upper bound */
28 struct ndis_802_11_config_fh {
29 u32 Length; /* Length of structure */
30 u32 HopPattern; /* As defined by 802.11, MSB set */
31 u32 HopSet; /* to one if non-802.11 */
32 u32 DwellTime; /* units are Kusec */
36 * FW will only save the channel number in DSConfig.
37 * ODI Handler will convert the channel number to freq. number.
39 struct ndis_802_11_config {
40 u32 Length; /* Length of structure */
41 u32 BeaconPeriod; /* units are Kusec */
42 u32 ATIMWindow; /* units are Kusec */
43 u32 DSConfig; /* Frequency, units are kHz */
44 struct ndis_802_11_config_fh FHConfig;
47 enum ndis_802_11_network_infra {
49 Ndis802_11Infrastructure,
50 Ndis802_11AutoUnknown,
51 Ndis802_11InfrastructureMax, /* dummy upper bound */
55 struct ndis_802_11_fixed_ie {
61 struct ndis_802_11_var_ie {
68 * Length is the 4 bytes multiples of the sume of
69 * [ETH_ALEN] + 2 + sizeof (struct ndis_802_11_ssid) + sizeof (u32)
70 * + sizeof (NDIS_802_11_RSSI) + sizeof (enum NDIS_802_11_NETWORK_TYPE)
71 * + sizeof (struct ndis_802_11_config)
72 * + NDIS_802_11_LENGTH_RATES_EX + IELength
74 * Except the IELength, all other fields are fixed length.
75 * Therefore, we can define a macro to represent the partial sum. */
77 enum ndis_802_11_auth_mode {
78 Ndis802_11AuthModeOpen,
79 Ndis802_11AuthModeShared,
80 Ndis802_11AuthModeAutoSwitch,
81 Ndis802_11AuthModeWPA,
82 Ndis802_11AuthModeWPAPSK,
83 Ndis802_11AuthModeWPANone,
84 Ndis802_11AuthModeWAPI,
85 Ndis802_11AuthModeMax /* Not a real mode, upper bound */
88 enum ndis_802_11_wep_status {
90 Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
91 Ndis802_11WEPDisabled,
92 Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
93 Ndis802_11WEPKeyAbsent,
94 Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
95 Ndis802_11WEPNotSupported,
96 Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
97 Ndis802_11Encryption2Enabled,
98 Ndis802_11Encryption2KeyAbsent,
99 Ndis802_11Encryption3Enabled,
100 Ndis802_11Encryption3KeyAbsent,
101 Ndis802_11_EncryptionWAPI
104 #define NDIS_802_11_AI_REQFI_CAPABILITIES 1
105 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2
106 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4
108 #define NDIS_802_11_AI_RESFI_CAPABILITIES 1
109 #define NDIS_802_11_AI_RESFI_STATUSCODE 2
110 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4
112 struct ndis_802_11_ai_reqfi {
115 unsigned char CurrentAPAddress[ETH_ALEN];
118 struct ndis_802_11_ai_resfi {
124 struct ndis_802_11_assoc_info {
126 u16 AvailableRequestFixedIEs;
127 struct ndis_802_11_ai_reqfi RequestFixedIEs;
129 u32 OffsetRequestIEs;
130 u16 AvailableResponseFixedIEs;
131 struct ndis_802_11_ai_resfi ResponseFixedIEs;
132 u32 ResponseIELength;
133 u32 OffsetResponseIEs;
136 enum ndis_802_11_reload_def {
137 Ndis802_11ReloadWEPKeys
140 /* Key mapping keys require a BSSID */
141 struct ndis_802_11_key {
142 u32 Length; /* Length of this structure */
144 u32 KeyLength; /* length of key in bytes */
145 unsigned char BSSID[ETH_ALEN];
146 unsigned long long KeyRSC;
147 u8 KeyMaterial[32]; /* var len depending on above field */
150 struct ndis_802_11_remove_key {
151 u32 Length; /* Length */
153 unsigned char BSSID[ETH_ALEN];
156 struct ndis_802_11_wep {
157 u32 Length; /* Length of this structure */
158 u32 KeyIndex; /* 0 is the per-client key,
159 * 1-N are the global keys */
160 u32 KeyLength; /* length of key in bytes */
161 u8 KeyMaterial[16];/* variable len depending on above field */
164 struct ndis_802_11_auth_req {
165 u32 Length; /* Length of structure */
166 unsigned char Bssid[ETH_ALEN];
170 enum ndis_802_11_status_type {
171 Ndis802_11StatusType_Authentication,
172 Ndis802_11StatusType_MediaStreamMode,
173 Ndis802_11StatusType_PMKID_CandidateList,
174 Ndis802_11StatusTypeMax /* not a real type, defined as
178 struct ndis_802_11_status_ind {
179 enum ndis_802_11_status_type StatusType;
182 /* mask for authentication/integrity fields */
183 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
184 #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
185 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
186 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
187 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
189 /* MIC check time, 60 seconds. */
190 #define MIC_CHECK_TIME 60000000
192 struct ndis_802_11_auth_evt {
193 struct ndis_802_11_status_ind Status;
194 struct ndis_802_11_auth_req Request[1];
197 struct ndis_802_11_test {
201 struct ndis_802_11_auth_evt AuthenticationEvent;
202 NDIS_802_11_RSSI RssiTrigger;
206 #ifndef Ndis802_11APMode
207 #define Ndis802_11APMode (Ndis802_11InfrastructureMax+1)
210 struct wlan_phy_info {
211 u8 SignalStrength;/* in percentage) */
212 u8 SignalQuality;/* in percentage) */
213 u8 Optimum_antenna; /* for Antenna diversity */
217 struct wlan_bcn_info {
218 /* these infor get from rtw_get_encrypt_info when
219 * * translate scan to UI */
220 u8 encryp_protocol;/* ENCRYP_PROTOCOL_E: OPEN/WEP/WPA/WPA2/WAPI */
221 int group_cipher; /* WPA/WPA2 group cipher */
222 int pairwise_cipher;/* WPA/WPA2/WEP pairwise cipher */
225 /* bwmode 20/40 and ch_offset UP/LOW */
226 unsigned short ht_cap_info;
227 unsigned char ht_info_infos_0;
230 /* temporally add #pragma pack for structure alignment issue of
231 * struct wlan_bssid_ex and get_struct wlan_bssid_ex_sz()
233 struct wlan_bssid_ex {
235 unsigned char MacAddress[ETH_ALEN];
236 u8 Reserved[2];/* 0]: IS beacon frame */
237 struct ndis_802_11_ssid Ssid;
239 NDIS_802_11_RSSI Rssi;/* in dBM,raw data ,get from PHY) */
240 enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
241 struct ndis_802_11_config Configuration;
242 enum ndis_802_11_network_infra InfrastructureMode;
243 unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
244 struct wlan_phy_info PhyInfo;
246 u8 IEs[MAX_IE_SZ]; /* timestamp, beacon interval, and
247 * capability information) */
250 static inline uint get_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss)
252 return sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + bss->IELength;
255 struct wlan_network {
256 struct list_head list;
257 int network_type; /* refer to ieee80211.h for WIRELESS_11A/B/G */
258 int fixed; /* set fixed when not to be removed
259 * in site-surveying */
260 unsigned long last_scanned; /* timestamp for the network */
261 int aid; /* will only be valid when a BSS is joinned. */
263 struct wlan_bssid_ex network; /* must be the last item */
264 struct wlan_bcn_info BcnInfo;
267 enum VRTL_CARRIER_SENSE {
292 #define NUM_PRE_AUTH_KEY 16
293 #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY
299 struct pmkid_candidate {
300 unsigned char BSSID[ETH_ALEN];
304 struct ndis_802_11_pmkid_list {
305 u32 Version; /* Version of the structure */
306 u32 NumCandidates; /* No. of pmkid candidates */
307 struct pmkid_candidate CandidateList[1];
310 struct ndis_802_11_auth_encrypt {
311 enum ndis_802_11_auth_mode AuthModeSupported;
312 enum ndis_802_11_wep_status EncryptStatusSupported;
315 struct ndis_802_11_cap {
319 u32 NoOfAuthEncryptPairsSupported;
320 struct ndis_802_11_auth_encrypt AuthenticationEncryptionSupported[1];
323 u8 key_2char2num(u8 hch, u8 lch);
324 u8 key_char2num(u8 ch);
325 u8 str_2char2num(u8 hch, u8 lch);
327 #endif /* ifndef WLAN_BSSDEF_H_ */