1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
4 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
6 ******************************************************************************/
7 #ifndef __WLAN_BSSDEF_H__
8 #define __WLAN_BSSDEF_H__
14 #define NDIS_802_11_LENGTH_SSID 32
15 #define NDIS_802_11_LENGTH_RATES 8
16 #define NDIS_802_11_LENGTH_RATES_EX 16
18 typedef unsigned char NDIS_802_11_MAC_ADDRESS[6];
19 typedef unsigned char NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; /* Set of 8 data rates */
20 typedef unsigned char NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; /* Set of 16 data rates */
22 struct ndis_802_11_ssid {
27 enum NDIS_802_11_NETWORK_TYPE {
32 Ndis802_11NetworkTypeMax /* not a real type, defined as an upper bound */
35 struct ndis_802_11_conf_fh {
36 u32 Length; /* Length of structure */
37 u32 HopPattern; /* As defined by 802.11, MSB set */
38 u32 HopSet; /* to one if non-802.11 */
39 u32 DwellTime; /* units are Kusec */
43 FW will only save the channel number in DSConfig.
44 ODI Handler will convert the channel number to freq. number.
46 struct ndis_802_11_conf {
47 u32 Length; /* Length of structure */
48 u32 BeaconPeriod; /* units are Kusec */
49 u32 ATIMWindow; /* units are Kusec */
50 u32 DSConfig; /* Frequency, units are kHz */
51 struct ndis_802_11_conf_fh FHConfig;
54 enum NDIS_802_11_NETWORK_INFRASTRUCTURE {
56 Ndis802_11Infrastructure,
57 Ndis802_11AutoUnknown,
58 Ndis802_11InfrastructureMax, /* Not a real value, defined as upper bound */
62 struct ndis_802_11_fix_ie {
68 struct ndis_80211_var_ie {
74 /* Length is the 4 bytes multiples of the sum of
75 * sizeof (NDIS_802_11_MAC_ADDRESS) + 2 +
76 * sizeof (struct ndis_802_11_ssid) + sizeof (u32) +
77 * sizeof (long) + sizeof (enum NDIS_802_11_NETWORK_TYPE) +
78 * sizeof (struct ndis_802_11_conf) + sizeof (NDIS_802_11_RATES_EX) + IELength
80 * Except for IELength, all other fields are fixed length. Therefore, we can
81 * define a macro to present the partial sum.
83 enum NDIS_802_11_AUTHENTICATION_MODE {
84 Ndis802_11AuthModeOpen,
85 Ndis802_11AuthModeShared,
86 Ndis802_11AuthModeAutoSwitch,
87 Ndis802_11AuthModeWPA,
88 Ndis802_11AuthModeWPAPSK,
89 Ndis802_11AuthModeWPANone,
90 Ndis802_11AuthModeWAPI,
91 Ndis802_11AuthModeMax /* Not a real mode, defined as upper bound */
94 enum NDIS_802_11_WEP_STATUS {
96 Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
97 Ndis802_11WEPDisabled,
98 Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
99 Ndis802_11WEPKeyAbsent,
100 Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
101 Ndis802_11WEPNotSupported,
102 Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
103 Ndis802_11Encryption2Enabled,
104 Ndis802_11Encryption2KeyAbsent,
105 Ndis802_11Encryption3Enabled,
106 Ndis802_11Encryption3KeyAbsent,
107 Ndis802_11_EncrypteionWAPI
110 #define NDIS_802_11_AI_REQFI_CAPABILITIES 1
111 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2
112 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4
114 #define NDIS_802_11_AI_RESFI_CAPABILITIES 1
115 #define NDIS_802_11_AI_RESFI_STATUSCODE 2
116 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4
118 struct ndis_802_11_ai_reqfi {
121 NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
124 struct ndis_801_11_ai_resfi {
130 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION {
132 u16 AvailableRequestFixedIEs;
133 struct ndis_802_11_ai_reqfi RequestFixedIEs;
135 u32 OffsetRequestIEs;
136 u16 AvailableResponseFixedIEs;
137 struct ndis_801_11_ai_resfi ResponseFixedIEs;
138 u32 ResponseIELength;
139 u32 OffsetResponseIEs;
140 } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
142 enum NDIS_802_11_RELOAD_DEFAULTS {
143 Ndis802_11ReloadWEPKeys
147 /* Key mapping keys require a BSSID */
148 typedef struct _NDIS_802_11_KEY {
149 u32 Length; /* Length of this structure */
151 u32 KeyLength; /* length of key in bytes */
152 NDIS_802_11_MAC_ADDRESS BSSID;
153 unsigned long long KeyRSC;
154 u8 KeyMaterial[32]; /* variable length depending on above field */
155 } NDIS_802_11_KEY, *PNDIS_802_11_KEY;
157 typedef struct _NDIS_802_11_REMOVE_KEY {
158 u32 Length; /* Length of this structure */
160 NDIS_802_11_MAC_ADDRESS BSSID;
161 } NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY;
163 struct ndis_802_11_wep {
164 u32 Length; /* Length of this structure */
165 u32 KeyIndex; /* 0 is the per-client key, 1-N are the global keys */
166 u32 KeyLength; /* length of key in bytes */
167 u8 KeyMaterial[16];/* variable length depending on above field */
170 /* mask for authentication/integrity fields */
171 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
172 #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
173 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
174 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
175 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
177 /* MIC check time, 60 seconds. */
178 #define MIC_CHECK_TIME 60000000
180 #ifndef Ndis802_11APMode
181 #define Ndis802_11APMode (Ndis802_11InfrastructureMax + 1)
184 struct wlan_phy_info {
185 u8 SignalStrength;/* in percentage) */
186 u8 SignalQuality;/* in percentage) */
187 u8 Optimum_antenna; /* for Antenna diversity */
191 struct wlan_bcn_info {
192 /* these infor get from rtw_get_encrypt_info when
193 * * translate scan to UI */
194 u8 encryp_protocol;/* ENCRYP_PROTOCOL_E: OPEN/WEP/WPA/WPA2/WAPI */
195 int group_cipher; /* WPA/WPA2 group cipher */
196 int pairwise_cipher;/* WPA/WPA2/WEP pairwise cipher */
199 /* bwmode 20/40 and ch_offset UP/LOW */
200 unsigned short ht_cap_info;
201 unsigned char ht_info_infos_0;
204 /* temporally add #pragma pack for structure alignment issue of
205 * struct wlan_bssid_ex and get_wlan_bssid_ex_sz()
207 struct wlan_bssid_ex {
209 NDIS_802_11_MAC_ADDRESS MacAddress;
210 u8 Reserved[2];/* 0]: IS beacon frame */
211 struct ndis_802_11_ssid Ssid;
213 long Rssi;/* in dBM, raw data , get from PHY) */
214 enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
215 struct ndis_802_11_conf Configuration;
216 enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
217 NDIS_802_11_RATES_EX SupportedRates;
218 struct wlan_phy_info PhyInfo;
220 u8 IEs[MAX_IE_SZ]; /* timestamp, beacon interval, and capability information) */
223 static inline uint get_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss)
225 return (sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + bss->IELength);
228 struct wlan_network {
229 struct list_head list;
230 int network_type; /* refer to ieee80211.h for WIRELESS_11A/B/G */
231 int fixed; /* set to fixed when not to be removed as site-surveying */
232 unsigned long last_scanned; /* timestamp for the network */
233 int aid; /* will only be valid when a BSS is joinned. */
235 struct wlan_bssid_ex network; /* must be the last item */
236 struct wlan_bcn_info BcnInfo;
239 enum VRTL_CARRIER_SENSE {
264 #define NUM_PRE_AUTH_KEY 16
265 #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY
267 #endif /* ifndef WLAN_BSSDEF_H_ */