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;
93 typedef struct tagKnownBSS {
96 BYTE abyBSSID[WLAN_BSSID_LEN];
97 unsigned int uChannel;
98 BYTE abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
99 BYTE abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
102 WORD wBeaconInterval;
104 BYTE abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
110 signed long ldBmAverage[RSSI_STAT_COUNT];
111 signed long ldBmAverRange;
112 //For any BSSID selection improvment
115 //++ WPA informations
122 BYTE byDefaultK_as_PK;
126 //++ WPA2 informations
131 WORD wAKMSSAuthCount;
132 BYTE abyAKMSSAuthType[4];
135 BYTE byWPAIE[MAX_WPA_IE_LEN];
136 BYTE byRSNIE[MAX_WPA_IE_LEN];
141 unsigned int uClearCount;
142 // BYTE abyIEs[WLAN_BEACON_FR_MAXLEN];
143 unsigned int uIELength;
144 QWORD qwBSSTimestamp;
145 QWORD qwLocalTSF; // local TSF timer
147 CARD_PHY_TYPE eNetworkTypeInUse;
150 SRSNCapObject sRSNCapObj;
151 BYTE abyIEs[1024]; // don't move this field !!
153 } __attribute__ ((__packed__))
154 KnownBSS , *PKnownBSS;
158 typedef enum tagNODE_STATE {
164 } NODE_STATE, *PNODE_STATE;
168 typedef struct tagKnownNodeDB {
171 BYTE abyMACAddr[WLAN_ADDR_LEN];
172 BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
173 BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
178 unsigned int uInActiveCount;
179 WORD wMaxBasicRate; //Get from byTopOFDMBasicRate or byTopCCKBasicRate which depends on packetTyp.
180 WORD wMaxSuppRate; //Records the highest supported rate getting from SuppRates IE and ExtSuppRates IE in Beacon.
182 BYTE byTopOFDMBasicRate;//Records the highest basic rate in OFDM mode
183 BYTE byTopCCKBasicRate; //Records the highest basic rate in CCK mode
186 struct sk_buff_head sTxPSQueue;
188 WORD wListenInterval;
190 NODE_STATE eNodeState;
194 unsigned long ulLastRxJiffer;
200 unsigned long long KeyRSC;
206 unsigned int uWepKeyLength;
207 BYTE abyWepKey[WLAN_WEPMAX_KEYLEN];
209 // Auto rate fallback vars
211 unsigned int uAverageRSSI;
212 unsigned int uRateRecoveryTimeout;
213 unsigned int uRatePollTimeout;
214 unsigned int uTxFailures;
215 unsigned int uTxAttempts;
217 unsigned int uTxRetry;
218 unsigned int uFailureRatio;
219 unsigned int uRetryRatio;
220 unsigned int uTxOk[MAX_RATE+1];
221 unsigned int uTxFail[MAX_RATE+1];
222 unsigned int uTimeCount;
224 } KnownNodeDB, *PKnownNodeDB;
226 /*--------------------- Export Functions --------------------------*/
228 PKnownBSS BSSpSearchBSSList(void *hDeviceContext,
229 PBYTE pbyDesireBSSID,
231 CARD_PHY_TYPE ePhyType);
233 PKnownBSS BSSpAddrIsInBSSList(void *hDeviceContext,
235 PWLAN_IE_SSID pSSID);
237 void BSSvClearBSSList(void *hDeviceContext, BOOL bKeepCurrBSSID);
239 BOOL BSSbInsertToBSSList(void *hDeviceContext,
242 WORD wBeaconInterval,
246 PWLAN_IE_SUPP_RATES pSuppRates,
247 PWLAN_IE_SUPP_RATES pExtSuppRates,
250 PWLAN_IE_RSN_EXT pRSNWPA,
251 PWLAN_IE_COUNTRY pIE_Country,
252 PWLAN_IE_QUIET pIE_Quiet,
253 unsigned int uIELength,
255 void *pRxPacketContext);
257 BOOL BSSbUpdateToBSSList(void *hDeviceContext,
259 WORD wBeaconInterval,
264 PWLAN_IE_SUPP_RATES pSuppRates,
265 PWLAN_IE_SUPP_RATES pExtSuppRates,
268 PWLAN_IE_RSN_EXT pRSNWPA,
269 PWLAN_IE_COUNTRY pIE_Country,
270 PWLAN_IE_QUIET pIE_Quiet,
272 unsigned int uIELength,
274 void *pRxPacketContext);
276 BOOL BSSbIsSTAInNodeDB(void *hDeviceContext,
278 unsigned int *puNodeIndex);
280 void BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex);
282 void BSSvUpdateAPNode(void *hDeviceContext,
284 PWLAN_IE_SUPP_RATES pItemRates,
285 PWLAN_IE_SUPP_RATES pExtSuppRates);
287 void BSSvSecondCallBack(void *hDeviceContext);
289 void BSSvUpdateNodeTxCounter(void *hDeviceContext,
290 PSStatCounter pStatistic,
294 void BSSvRemoveOneNode(void *hDeviceContext,
295 unsigned int uNodeIndex);
297 void BSSvAddMulticastNode(void *hDeviceContext);
299 void BSSvClearNodeDBTable(void *hDeviceContext,
300 unsigned int uStartIndex);
302 void BSSvClearAnyBSSJoinRecord(void *hDeviceContext);
304 #endif /* __BSSDB_H__ */