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__
12 #define NDIS_802_11_LENGTH_SSID 32
13 #define NDIS_802_11_LENGTH_RATES 8
14 #define NDIS_802_11_LENGTH_RATES_EX 16
16 #define NDIS_802_11_RSSI long /* in dBm */
18 struct ndis_802_11_ssid {
23 enum NDIS_802_11_NETWORK_TYPE {
28 Ndis802_11NetworkTypeMax /* dummy upper bound */
31 struct ndis_802_11_config_fh {
32 u32 Length; /* Length of structure */
33 u32 HopPattern; /* As defined by 802.11, MSB set */
34 u32 HopSet; /* to one if non-802.11 */
35 u32 DwellTime; /* units are Kusec */
39 * FW will only save the channel number in DSConfig.
40 * ODI Handler will convert the channel number to freq. number.
42 struct ndis_802_11_config {
43 u32 Length; /* Length of structure */
44 u32 BeaconPeriod; /* units are Kusec */
45 u32 ATIMWindow; /* units are Kusec */
46 u32 DSConfig; /* Frequency, units are kHz */
47 struct ndis_802_11_config_fh FHConfig;
50 enum ndis_802_11_network_infra {
52 Ndis802_11Infrastructure,
53 Ndis802_11AutoUnknown,
54 Ndis802_11InfrastructureMax, /* dummy upper bound */
58 struct ndis_802_11_fixed_ie {
64 struct ndis_802_11_var_ie {
71 * Length is the 4 bytes multiples of the sume of
72 * [ETH_ALEN] + 2 + sizeof (struct ndis_802_11_ssid) + sizeof (u32)
73 * + sizeof (NDIS_802_11_RSSI) + sizeof (enum NDIS_802_11_NETWORK_TYPE)
74 * + sizeof (struct ndis_802_11_config)
75 * + NDIS_802_11_LENGTH_RATES_EX + ie_length
77 * Except the ie_length, all other fields are fixed length.
78 * Therefore, we can define a macro to represent the partial sum.
81 enum ndis_802_11_auth_mode {
82 Ndis802_11AuthModeOpen,
83 Ndis802_11AuthModeShared,
84 Ndis802_11AuthModeAutoSwitch,
85 Ndis802_11AuthModeWPA,
86 Ndis802_11AuthModeWPAPSK,
87 Ndis802_11AuthModeWPANone,
88 Ndis802_11AuthModeWAPI,
89 Ndis802_11AuthModeMax /* Not a real mode, upper bound */
92 enum ndis_802_11_wep_status {
94 Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
95 Ndis802_11WEPDisabled,
96 Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
97 Ndis802_11WEPKeyAbsent,
98 Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
99 Ndis802_11WEPNotSupported,
100 Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
101 Ndis802_11Encryption2Enabled,
102 Ndis802_11Encryption2KeyAbsent,
103 Ndis802_11Encryption3Enabled,
104 Ndis802_11Encryption3KeyAbsent,
105 Ndis802_11_EncryptionWAPI
108 #define NDIS_802_11_AI_REQFI_CAPABILITIES 1
109 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2
110 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4
112 #define NDIS_802_11_AI_RESFI_CAPABILITIES 1
113 #define NDIS_802_11_AI_RESFI_STATUSCODE 2
114 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4
116 enum ndis_802_11_reload_def {
117 Ndis802_11ReloadWEPKeys
120 struct ndis_802_11_wep {
121 u32 Length; /* Length of this structure */
122 u32 KeyIndex; /* 0 is the per-client key,
123 * 1-N are the global keys
125 u32 KeyLength; /* length of key in bytes */
126 u8 KeyMaterial[16];/* variable len depending on above field */
129 enum ndis_802_11_status_type {
130 Ndis802_11StatusType_Authentication,
131 Ndis802_11StatusType_MediaStreamMode,
132 Ndis802_11StatusType_PMKID_CandidateList,
133 Ndis802_11StatusTypeMax /* not a real type, defined as
138 /* mask for authentication/integrity fields */
139 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
140 #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
141 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
142 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
143 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
145 /* MIC check time, 60 seconds. */
146 #define MIC_CHECK_TIME 60000000
148 #ifndef Ndis802_11APMode
149 #define Ndis802_11APMode (Ndis802_11InfrastructureMax + 1)
152 struct wlan_phy_info {
153 u8 SignalStrength;/* in percentage) */
154 u8 SignalQuality;/* in percentage) */
155 u8 Optimum_antenna; /* for Antenna diversity */
159 struct wlan_bcn_info {
160 /* these infor get from rtw_get_encrypt_info when
161 * * translate scan to UI
163 u8 encryp_protocol;/* ENCRYP_PROTOCOL_E: OPEN/WEP/WPA/WPA2/WAPI */
164 int group_cipher; /* WPA/WPA2 group cipher */
165 int pairwise_cipher;/* WPA/WPA2/WEP pairwise cipher */
168 /* bwmode 20/40 and ch_offset UP/LOW */
169 unsigned short ht_cap_info;
170 unsigned char ht_info_infos_0;
173 /* temporally add #pragma pack for structure alignment issue of
174 * struct wlan_bssid_ex and get_struct wlan_bssid_ex_sz()
176 struct wlan_bssid_ex {
178 unsigned char MacAddress[ETH_ALEN];
179 u8 Reserved[2];/* 0]: IS beacon frame */
180 struct ndis_802_11_ssid ssid;
182 NDIS_802_11_RSSI Rssi;/* in dBM,raw data ,get from PHY) */
183 enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
184 struct ndis_802_11_config Configuration;
185 enum ndis_802_11_network_infra InfrastructureMode;
186 unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
187 struct wlan_phy_info PhyInfo;
189 u8 ies[MAX_IE_SZ]; /* timestamp, beacon interval, and
190 * capability information)
194 static inline uint get_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss)
196 return sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + bss->ie_length;
199 struct wlan_network {
200 struct list_head list;
201 int network_type; /* refer to ieee80211.h for WIRELESS_11A/B/G */
202 int fixed; /* set fixed when not to be removed
205 unsigned long last_scanned; /* timestamp for the network */
206 int aid; /* will only be valid when a BSS is joinned. */
208 struct wlan_bssid_ex network; /* must be the last item */
209 struct wlan_bcn_info BcnInfo;
212 enum VRTL_CARRIER_SENSE {
237 #define NUM_PRE_AUTH_KEY 16
238 #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY
240 #endif /* ifndef WLAN_BSSDEF_H_ */