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>
39 /*--------------------- Export Definitions -------------------------*/
41 #define MAX_NODE_NUM 64
42 #define MAX_BSS_NUM 42
43 #define LOST_BEACON_COUNT 10 /* 10 sec, XP defined */
44 #define MAX_PS_TX_BUF 32 // sta max power saving tx buf
45 #define ADHOC_LOST_BEACON_COUNT 30 // 30 sec, beacon lost for adhoc only
46 #define MAX_INACTIVE_COUNT 300 // 300 sec, inactive STA node refresh
48 #define USE_PROTECT_PERIOD 10 // 10 sec, Use protect mode check period
49 #define ERP_RECOVER_COUNT 30 // 30 sec, ERP support callback check
50 #define BSS_CLEAR_COUNT 1
52 #define RSSI_STAT_COUNT 10
53 #define MAX_CHECK_RSSI_COUNT 8
56 #define WLAN_STA_AUTH BIT0
57 #define WLAN_STA_ASSOC BIT1
58 #define WLAN_STA_PS BIT2
59 #define WLAN_STA_TIM BIT3
60 // permanent; do not remove entry on expiration
61 #define WLAN_STA_PERM BIT4
62 // If 802.1X is used, this flag is
63 // controlling whether STA is authorized to
64 // send and receive non-IEEE 802.1X frames
65 #define WLAN_STA_AUTHORIZED BIT5
67 #define MAX_WPA_IE_LEN 64
70 /*--------------------- Export Classes ----------------------------*/
72 /*--------------------- Export Variables --------------------------*/
75 /*--------------------- Export Types ------------------------------*/
78 // IEEE 802.11 Structures and definitions
81 typedef struct tagSERPObject
{
84 } ERPObject
, *PERPObject
;
87 typedef struct tagSRSNCapObject
{
90 } SRSNCapObject
, *PSRSNCapObject
;
94 typedef struct tagKnownBSS
{
97 BYTE abyBSSID
[WLAN_BSSID_LEN
];
98 unsigned int uChannel
;
99 BYTE abySuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
+ 1];
100 BYTE abyExtSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
+ 1];
103 WORD wBeaconInterval
;
105 BYTE abySSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
111 signed long ldBmAverage
[RSSI_STAT_COUNT
];
112 signed long ldBmAverRange
;
113 //For any BSSID selection improvment
116 //++ WPA informations
123 BYTE byDefaultK_as_PK
;
127 //++ WPA2 informations
132 WORD wAKMSSAuthCount
;
133 BYTE abyAKMSSAuthType
[4];
136 BYTE byWPAIE
[MAX_WPA_IE_LEN
];
137 BYTE byRSNIE
[MAX_WPA_IE_LEN
];
142 unsigned int uClearCount
;
143 // BYTE abyIEs[WLAN_BEACON_FR_MAXLEN];
144 unsigned int uIELength
;
145 QWORD qwBSSTimestamp
;
146 QWORD qwLocalTSF
; // local TSF timer
148 CARD_PHY_TYPE eNetworkTypeInUse
;
151 SRSNCapObject sRSNCapObj
;
152 BYTE abyIEs
[1024]; // don't move this field !!
154 } __attribute__ ((__packed__
))
155 KnownBSS
, *PKnownBSS
;
159 typedef enum tagNODE_STATE
{
165 } NODE_STATE
, *PNODE_STATE
;
169 typedef struct tagKnownNodeDB
{
172 BYTE abyMACAddr
[WLAN_ADDR_LEN
];
173 BYTE abyCurrSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
];
174 BYTE abyCurrExtSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
];
179 unsigned int uInActiveCount
;
180 WORD wMaxBasicRate
; //Get from byTopOFDMBasicRate or byTopCCKBasicRate which depends on packetTyp.
181 WORD wMaxSuppRate
; //Records the highest supported rate getting from SuppRates IE and ExtSuppRates IE in Beacon.
183 BYTE byTopOFDMBasicRate
;//Records the highest basic rate in OFDM mode
184 BYTE byTopCCKBasicRate
; //Records the highest basic rate in CCK mode
187 struct sk_buff_head sTxPSQueue
;
189 WORD wListenInterval
;
191 NODE_STATE eNodeState
;
195 unsigned long ulLastRxJiffer
;
201 unsigned long long KeyRSC
;
207 unsigned int uWepKeyLength
;
208 BYTE abyWepKey
[WLAN_WEPMAX_KEYLEN
];
210 // Auto rate fallback vars
212 unsigned int uAverageRSSI
;
213 unsigned int uRateRecoveryTimeout
;
214 unsigned int uRatePollTimeout
;
215 unsigned int uTxFailures
;
216 unsigned int uTxAttempts
;
218 unsigned int uTxRetry
;
219 unsigned int uFailureRatio
;
220 unsigned int uRetryRatio
;
221 unsigned int uTxOk
[MAX_RATE
+1];
222 unsigned int uTxFail
[MAX_RATE
+1];
223 unsigned int uTimeCount
;
225 } KnownNodeDB
, *PKnownNodeDB
;
227 /*--------------------- Export Functions --------------------------*/
229 PKnownBSS
BSSpSearchBSSList(void *hDeviceContext
,
230 PBYTE pbyDesireBSSID
,
232 CARD_PHY_TYPE ePhyType
);
234 PKnownBSS
BSSpAddrIsInBSSList(void *hDeviceContext
,
236 PWLAN_IE_SSID pSSID
);
238 void BSSvClearBSSList(void *hDeviceContext
, BOOL bKeepCurrBSSID
);
240 BOOL
BSSbInsertToBSSList(void *hDeviceContext
,
243 WORD wBeaconInterval
,
247 PWLAN_IE_SUPP_RATES pSuppRates
,
248 PWLAN_IE_SUPP_RATES pExtSuppRates
,
251 PWLAN_IE_RSN_EXT pRSNWPA
,
252 PWLAN_IE_COUNTRY pIE_Country
,
253 PWLAN_IE_QUIET pIE_Quiet
,
254 unsigned int uIELength
,
256 void *pRxPacketContext
);
258 BOOL
BSSbUpdateToBSSList(void *hDeviceContext
,
260 WORD wBeaconInterval
,
265 PWLAN_IE_SUPP_RATES pSuppRates
,
266 PWLAN_IE_SUPP_RATES pExtSuppRates
,
269 PWLAN_IE_RSN_EXT pRSNWPA
,
270 PWLAN_IE_COUNTRY pIE_Country
,
271 PWLAN_IE_QUIET pIE_Quiet
,
273 unsigned int uIELength
,
275 void *pRxPacketContext
);
277 BOOL
BSSbIsSTAInNodeDB(void *hDeviceContext
,
279 unsigned int *puNodeIndex
);
281 void BSSvCreateOneNode(void *hDeviceContext
, unsigned int *puNodeIndex
);
283 void BSSvUpdateAPNode(void *hDeviceContext
,
285 PWLAN_IE_SUPP_RATES pItemRates
,
286 PWLAN_IE_SUPP_RATES pExtSuppRates
);
288 void BSSvSecondCallBack(void *hDeviceContext
);
290 void BSSvUpdateNodeTxCounter(void *hDeviceContext
,
291 PSStatCounter pStatistic
,
295 void BSSvRemoveOneNode(void *hDeviceContext
,
296 unsigned int uNodeIndex
);
298 void BSSvAddMulticastNode(void *hDeviceContext
);
300 void BSSvClearNodeDBTable(void *hDeviceContext
,
301 unsigned int uStartIndex
);
303 void BSSvClearAnyBSSJoinRecord(void *hDeviceContext
);
305 #endif /* __BSSDB_H__ */