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__
13 #define NDIS_802_11_LENGTH_SSID 32
14 #define NDIS_802_11_LENGTH_RATES 8
15 #define NDIS_802_11_LENGTH_RATES_EX 16
17 #define NDIS_802_11_RSSI long /* in dBm */
19 struct ndis_802_11_ssid {
24 enum NDIS_802_11_NETWORK_TYPE {
29 Ndis802_11NetworkTypeMax /* dummy upper bound */
32 struct ndis_802_11_config_fh {
33 u32 Length; /* Length of structure */
34 u32 HopPattern; /* As defined by 802.11, MSB set */
35 u32 HopSet; /* to one if non-802.11 */
36 u32 DwellTime; /* units are Kusec */
40 * FW will only save the channel number in DSConfig.
41 * ODI Handler will convert the channel number to freq. number.
43 struct ndis_802_11_config {
44 u32 Length; /* Length of structure */
45 u32 BeaconPeriod; /* units are Kusec */
46 u32 ATIMWindow; /* units are Kusec */
47 u32 DSConfig; /* Frequency, units are kHz */
48 struct ndis_802_11_config_fh FHConfig;
51 enum ndis_802_11_network_infra {
53 Ndis802_11Infrastructure,
54 Ndis802_11AutoUnknown,
55 Ndis802_11InfrastructureMax, /* dummy upper bound */
59 struct ndis_802_11_fixed_ie {
67 struct ndis_802_11_var_ie {
74 * Length is the 4 bytes multiples of the sume of
75 * [ETH_ALEN] + 2 + sizeof (struct ndis_802_11_ssid) + sizeof (u32)
76 * + sizeof (NDIS_802_11_RSSI) + sizeof (enum NDIS_802_11_NETWORK_TYPE)
77 * + sizeof (struct ndis_802_11_config)
78 * + NDIS_802_11_LENGTH_RATES_EX + ie_length
80 * Except the ie_length, all other fields are fixed length.
81 * Therefore, we can define a macro to represent the partial sum.
84 enum ndis_802_11_auth_mode {
85 Ndis802_11AuthModeOpen,
86 Ndis802_11AuthModeShared,
87 Ndis802_11AuthModeAutoSwitch,
88 Ndis802_11AuthModeWPA,
89 Ndis802_11AuthModeWPAPSK,
90 Ndis802_11AuthModeWPANone,
91 Ndis802_11AuthModeWAPI,
92 Ndis802_11AuthModeMax /* Not a real mode, upper bound */
95 enum ndis_802_11_wep_status {
97 Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
98 Ndis802_11WEPDisabled,
99 Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
100 Ndis802_11WEPKeyAbsent,
101 Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
102 Ndis802_11WEPNotSupported,
103 Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
104 Ndis802_11Encryption2Enabled,
105 Ndis802_11Encryption2KeyAbsent,
106 Ndis802_11Encryption3Enabled,
107 Ndis802_11Encryption3KeyAbsent,
108 Ndis802_11_EncryptionWAPI
111 #define NDIS_802_11_AI_REQFI_CAPABILITIES 1
112 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2
113 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4
115 #define NDIS_802_11_AI_RESFI_CAPABILITIES 1
116 #define NDIS_802_11_AI_RESFI_STATUSCODE 2
117 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4
119 enum ndis_802_11_reload_def {
120 Ndis802_11ReloadWEPKeys
123 struct ndis_802_11_wep {
124 u32 Length; /* Length of this structure */
125 u32 KeyIndex; /* 0 is the per-client key,
126 * 1-N are the global keys
128 u32 KeyLength; /* length of key in bytes */
129 u8 KeyMaterial[16];/* variable len depending on above field */
132 enum ndis_802_11_status_type {
133 Ndis802_11StatusType_Authentication,
134 Ndis802_11StatusType_MediaStreamMode,
135 Ndis802_11StatusType_PMKID_CandidateList,
136 Ndis802_11StatusTypeMax /* not a real type, defined as
141 /* mask for authentication/integrity fields */
142 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
143 #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
144 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
145 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
146 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
148 /* MIC check time, 60 seconds. */
149 #define MIC_CHECK_TIME 60000000
151 #ifndef Ndis802_11APMode
152 #define Ndis802_11APMode (Ndis802_11InfrastructureMax+1)
155 struct wlan_phy_info {
156 u8 SignalStrength;/* in percentage) */
157 u8 SignalQuality;/* in percentage) */
158 u8 Optimum_antenna; /* for Antenna diversity */
162 struct wlan_bcn_info {
163 /* these infor get from rtw_get_encrypt_info when
164 * * translate scan to UI
166 u8 encryp_protocol;/* ENCRYP_PROTOCOL_E: OPEN/WEP/WPA/WPA2/WAPI */
167 int group_cipher; /* WPA/WPA2 group cipher */
168 int pairwise_cipher;/* WPA/WPA2/WEP pairwise cipher */
171 /* bwmode 20/40 and ch_offset UP/LOW */
172 unsigned short ht_cap_info;
173 unsigned char ht_info_infos_0;
176 /* temporally add #pragma pack for structure alignment issue of
177 * struct wlan_bssid_ex and get_struct wlan_bssid_ex_sz()
179 struct wlan_bssid_ex {
181 unsigned char MacAddress[ETH_ALEN];
182 u8 Reserved[2];/* 0]: IS beacon frame */
183 struct ndis_802_11_ssid Ssid;
185 NDIS_802_11_RSSI Rssi;/* in dBM,raw data ,get from PHY) */
186 enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
187 struct ndis_802_11_config Configuration;
188 enum ndis_802_11_network_infra InfrastructureMode;
189 unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
190 struct wlan_phy_info PhyInfo;
192 u8 ies[MAX_IE_SZ]; /* timestamp, beacon interval, and
193 * capability information)
197 static inline uint get_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss)
199 return sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + bss->ie_length;
202 struct wlan_network {
203 struct list_head list;
204 int network_type; /* refer to ieee80211.h for WIRELESS_11A/B/G */
205 int fixed; /* set fixed when not to be removed
208 unsigned long last_scanned; /* timestamp for the network */
209 int aid; /* will only be valid when a BSS is joinned. */
211 struct wlan_bssid_ex network; /* must be the last item */
212 struct wlan_bcn_info BcnInfo;
215 enum VRTL_CARRIER_SENSE {
240 #define NUM_PRE_AUTH_KEY 16
241 #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY
243 #endif /* ifndef WLAN_BSSDEF_H_ */