2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 * Purpose: Handles the Basic Service Set & Node Database functions
33 #include <linux/skbuff.h>
38 /*--------------------- Export Definitions -------------------------*/
40 #define MAX_NODE_NUM 64
41 #define MAX_BSS_NUM 42
42 #define LOST_BEACON_COUNT 10 // 10 sec, XP defined
43 #define MAX_PS_TX_BUF 32 // sta max power saving tx buf
44 #define ADHOC_LOST_BEACON_COUNT 30 // 30 sec, beacon lost for adhoc only
45 #define MAX_INACTIVE_COUNT 300 // 300 sec, inactive STA node refresh
47 #define USE_PROTECT_PERIOD 10 // 10 sec, Use protect mode check period
48 #define ERP_RECOVER_COUNT 30 // 30 sec, ERP support callback check
49 #define BSS_CLEAR_COUNT 1
51 #define RSSI_STAT_COUNT 10
52 #define MAX_CHECK_RSSI_COUNT 8
55 #define WLAN_STA_AUTH BIT0
56 #define WLAN_STA_ASSOC BIT1
57 #define WLAN_STA_PS BIT2
58 #define WLAN_STA_TIM BIT3
59 // permanent; do not remove entry on expiration
60 #define WLAN_STA_PERM BIT4
61 // If 802.1X is used, this flag is
62 // controlling whether STA is authorized to
63 // send and receive non-IEEE 802.1X frames
64 #define WLAN_STA_AUTHORIZED BIT5
68 #define MAX_WPA_IE_LEN 64
71 /*--------------------- Export Classes ----------------------------*/
73 /*--------------------- Export Variables --------------------------*/
76 /*--------------------- Export Types ------------------------------*/
79 // IEEE 802.11 Structures and definitions
82 typedef enum _NDIS_802_11_NETWORK_TYPE
88 Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound
89 } NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
92 typedef struct tagSERPObject {
95 }ERPObject, *PERPObject;
98 typedef struct tagSRSNCapObject {
101 }SRSNCapObject, *PSRSNCapObject;
105 typedef struct tagKnownBSS {
108 BYTE abyBSSID[WLAN_BSSID_LEN];
110 BYTE abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
111 BYTE abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
114 WORD wBeaconInterval;
116 BYTE abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
122 LONG ldBmAverage[RSSI_STAT_COUNT];
124 //For any BSSID selection improvment
127 //++ WPA informations
134 BYTE byDefaultK_as_PK;
138 //++ WPA2 informations
143 WORD wAKMSSAuthCount;
144 BYTE abyAKMSSAuthType[4];
147 BYTE byWPAIE[MAX_WPA_IE_LEN];
148 BYTE byRSNIE[MAX_WPA_IE_LEN];
154 // BYTE abyIEs[WLAN_BEACON_FR_MAXLEN];
156 QWORD qwBSSTimestamp;
157 QWORD qwLocalTSF; // local TSF timer
159 // NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
160 CARD_PHY_TYPE eNetworkTypeInUse;
163 SRSNCapObject sRSNCapObj;
164 BYTE abyIEs[1024]; // don't move this field !!
166 }__attribute__ ((__packed__))
167 KnownBSS , *PKnownBSS;
169 //2006-1116-01,<Add> by NomadZhao
172 typedef enum tagNODE_STATE {
178 } NODE_STATE, *PNODE_STATE;
182 typedef struct tagKnownNodeDB {
185 BYTE abyMACAddr[WLAN_ADDR_LEN];
186 BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
187 BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
193 WORD wMaxBasicRate; //Get from byTopOFDMBasicRate or byTopCCKBasicRate which depends on packetTyp.
194 WORD wMaxSuppRate; //Records the highest supported rate getting from SuppRates IE and ExtSuppRates IE in Beacon.
196 BYTE byTopOFDMBasicRate;//Records the highest basic rate in OFDM mode
197 BYTE byTopCCKBasicRate; //Records the highest basic rate in CCK mode
200 struct sk_buff_head sTxPSQueue;
202 WORD wListenInterval;
204 NODE_STATE eNodeState;
208 ULONG ulLastRxJiffer;
221 BYTE abyWepKey[WLAN_WEPMAX_KEYLEN];
223 // Auto rate fallback vars
226 UINT uRateRecoveryTimeout;
227 UINT uRatePollTimeout;
234 UINT uTxOk[MAX_RATE+1];
235 UINT uTxFail[MAX_RATE+1];
238 } KnownNodeDB, *PKnownNodeDB;
241 /*--------------------- Export Functions --------------------------*/
247 IN HANDLE hDeviceContext,
248 IN PBYTE pbyDesireBSSID,
249 IN PBYTE pbyDesireSSID,
250 IN CARD_PHY_TYPE ePhyType
255 IN HANDLE hDeviceContext,
257 IN PWLAN_IE_SSID pSSID
262 IN HANDLE hDeviceContext,
263 IN BOOL bKeepCurrBSSID
268 IN HANDLE hDeviceContext,
269 IN PBYTE abyBSSIDAddr,
270 IN QWORD qwTimestamp,
271 IN WORD wBeaconInterval,
273 IN BYTE byCurrChannel,
274 IN PWLAN_IE_SSID pSSID,
275 IN PWLAN_IE_SUPP_RATES pSuppRates,
276 IN PWLAN_IE_SUPP_RATES pExtSuppRates,
278 IN PWLAN_IE_RSN pRSN,
279 IN PWLAN_IE_RSN_EXT pRSNWPA,
280 IN PWLAN_IE_COUNTRY pIE_Country,
281 IN PWLAN_IE_QUIET pIE_Quiet,
284 IN HANDLE pRxPacketContext
290 IN HANDLE hDeviceContext,
291 IN QWORD qwTimestamp,
292 IN WORD wBeaconInterval,
294 IN BYTE byCurrChannel,
296 IN PWLAN_IE_SSID pSSID,
297 IN PWLAN_IE_SUPP_RATES pSuppRates,
298 IN PWLAN_IE_SUPP_RATES pExtSuppRates,
300 IN PWLAN_IE_RSN pRSN,
301 IN PWLAN_IE_RSN_EXT pRSNWPA,
302 IN PWLAN_IE_COUNTRY pIE_Country,
303 IN PWLAN_IE_QUIET pIE_Quiet,
304 IN PKnownBSS pBSSList,
307 IN HANDLE pRxPacketContext
313 IN HANDLE hDeviceContext,
315 OUT PUINT puNodeIndex
320 IN HANDLE hDeviceContext,
321 OUT PUINT puNodeIndex
326 IN HANDLE hDeviceContext,
328 IN PWLAN_IE_SUPP_RATES pItemRates,
329 IN PWLAN_IE_SUPP_RATES pExtSuppRates
335 IN HANDLE hDeviceContext
340 BSSvUpdateNodeTxCounter(
341 IN HANDLE hDeviceContext,
345 IN UINT uFIFOHeaderSize
350 IN HANDLE hDeviceContext,
355 BSSvAddMulticastNode(
356 IN HANDLE hDeviceContext
361 BSSvClearNodeDBTable(
362 IN HANDLE hDeviceContext,
367 BSSvClearAnyBSSJoinRecord(
368 IN HANDLE hDeviceContext