[ARM] pxa: update defconfig for Verdex Pro
[linux-2.6/verdex.git] / drivers / staging / vt6656 / bssdb.h
blobf365b6b8bf6a576a92ffb40c7d65c588a72e65b9
1 /*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
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.
20 * File: bssdb.h
22 * Purpose: Handles the Basic Service Set & Node Database functions
24 * Author: Lyndon Chen
26 * Date: July 16, 2002
30 #ifndef __BSSDB_H__
31 #define __BSSDB_H__
33 #include <linux/skbuff.h>
34 #include "80211hdr.h"
35 #include "80211mgr.h"
36 #include "card.h"
37 #include "mib.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
55 // STA dwflags
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_RATE 12
69 #define MAX_WPA_IE_LEN 64
72 /*--------------------- Export Classes ----------------------------*/
74 /*--------------------- Export Variables --------------------------*/
77 /*--------------------- Export Types ------------------------------*/
80 // IEEE 802.11 Structures and definitions
83 typedef struct tagSERPObject {
84 BOOL bERPExist;
85 BYTE byERP;
86 }ERPObject, *PERPObject;
89 typedef struct tagSRSNCapObject {
90 BOOL bRSNCapExist;
91 WORD wRSNCap;
92 }SRSNCapObject, *PSRSNCapObject;
94 // BSS info(AP)
95 #pragma pack(1)
96 typedef struct tagKnownBSS {
97 // BSS info
98 BOOL bActive;
99 BYTE abyBSSID[WLAN_BSSID_LEN];
100 UINT uChannel;
101 BYTE abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
102 BYTE abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
103 UINT uRSSI;
104 BYTE bySQ;
105 WORD wBeaconInterval;
106 WORD wCapInfo;
107 BYTE abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
108 BYTE byRxRate;
110 // WORD wATIMWindow;
111 BYTE byRSSIStatCnt;
112 LONG ldBmMAX;
113 LONG ldBmAverage[RSSI_STAT_COUNT];
114 LONG ldBmAverRange;
115 //For any BSSID selection improvment
116 BOOL bSelected;
118 //++ WPA informations
119 BOOL bWPAValid;
120 BYTE byGKType;
121 BYTE abyPKType[4];
122 WORD wPKCount;
123 BYTE abyAuthType[4];
124 WORD wAuthCount;
125 BYTE byDefaultK_as_PK;
126 BYTE byReplayIdx;
127 //--
129 //++ WPA2 informations
130 BOOL bWPA2Valid;
131 BYTE byCSSGK;
132 WORD wCSSPKCount;
133 BYTE abyCSSPK[4];
134 WORD wAKMSSAuthCount;
135 BYTE abyAKMSSAuthType[4];
137 //++ wpactl
138 BYTE byWPAIE[MAX_WPA_IE_LEN];
139 BYTE byRSNIE[MAX_WPA_IE_LEN];
140 WORD wWPALen;
141 WORD wRSNLen;
143 // Clear count
144 UINT uClearCount;
145 // BYTE abyIEs[WLAN_BEACON_FR_MAXLEN];
146 UINT uIELength;
147 QWORD qwBSSTimestamp;
148 QWORD qwLocalTSF; // local TSF timer
150 CARD_PHY_TYPE eNetworkTypeInUse;
152 ERPObject sERP;
153 SRSNCapObject sRSNCapObj;
154 BYTE abyIEs[1024]; // don't move this field !!
156 }__attribute__ ((__packed__))
157 KnownBSS , *PKnownBSS;
161 typedef enum tagNODE_STATE {
162 NODE_FREE,
163 NODE_AGED,
164 NODE_KNOWN,
165 NODE_AUTH,
166 NODE_ASSOC
167 } NODE_STATE, *PNODE_STATE;
170 // STA node info
171 typedef struct tagKnownNodeDB {
172 // STA info
173 BOOL bActive;
174 BYTE abyMACAddr[WLAN_ADDR_LEN];
175 BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
176 BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
177 WORD wTxDataRate;
178 BOOL bShortPreamble;
179 BOOL bERPExist;
180 BOOL bShortSlotTime;
181 UINT uInActiveCount;
182 WORD wMaxBasicRate; //Get from byTopOFDMBasicRate or byTopCCKBasicRate which depends on packetTyp.
183 WORD wMaxSuppRate; //Records the highest supported rate getting from SuppRates IE and ExtSuppRates IE in Beacon.
184 WORD wSuppRate;
185 BYTE byTopOFDMBasicRate;//Records the highest basic rate in OFDM mode
186 BYTE byTopCCKBasicRate; //Records the highest basic rate in CCK mode
188 // For AP mode
189 struct sk_buff_head sTxPSQueue;
190 WORD wCapInfo;
191 WORD wListenInterval;
192 WORD wAID;
193 NODE_STATE eNodeState;
194 BOOL bPSEnable;
195 BOOL bRxPSPoll;
196 BYTE byAuthSequence;
197 ULONG ulLastRxJiffer;
198 BYTE bySuppRate;
199 DWORD dwFlags;
200 WORD wEnQueueCnt;
202 BOOL bOnFly;
203 ULONGLONG KeyRSC;
204 BYTE byKeyIndex;
205 DWORD dwKeyIndex;
206 BYTE byCipherSuite;
207 DWORD dwTSC47_16;
208 WORD wTSC15_0;
209 UINT uWepKeyLength;
210 BYTE abyWepKey[WLAN_WEPMAX_KEYLEN];
212 // Auto rate fallback vars
213 BOOL bIsInFallback;
214 UINT uAverageRSSI;
215 UINT uRateRecoveryTimeout;
216 UINT uRatePollTimeout;
217 UINT uTxFailures;
218 UINT uTxAttempts;
220 UINT uTxRetry;
221 UINT uFailureRatio;
222 UINT uRetryRatio;
223 UINT uTxOk[MAX_RATE+1];
224 UINT uTxFail[MAX_RATE+1];
225 UINT uTimeCount;
227 } KnownNodeDB, *PKnownNodeDB;
230 /*--------------------- Export Functions --------------------------*/
234 PKnownBSS
235 BSSpSearchBSSList(
236 IN HANDLE hDeviceContext,
237 IN PBYTE pbyDesireBSSID,
238 IN PBYTE pbyDesireSSID,
239 IN CARD_PHY_TYPE ePhyType
242 PKnownBSS
243 BSSpAddrIsInBSSList(
244 IN HANDLE hDeviceContext,
245 IN PBYTE abyBSSID,
246 IN PWLAN_IE_SSID pSSID
249 VOID
250 BSSvClearBSSList(
251 IN HANDLE hDeviceContext,
252 IN BOOL bKeepCurrBSSID
255 BOOL
256 BSSbInsertToBSSList(
257 IN HANDLE hDeviceContext,
258 IN PBYTE abyBSSIDAddr,
259 IN QWORD qwTimestamp,
260 IN WORD wBeaconInterval,
261 IN WORD wCapInfo,
262 IN BYTE byCurrChannel,
263 IN PWLAN_IE_SSID pSSID,
264 IN PWLAN_IE_SUPP_RATES pSuppRates,
265 IN PWLAN_IE_SUPP_RATES pExtSuppRates,
266 IN PERPObject psERP,
267 IN PWLAN_IE_RSN pRSN,
268 IN PWLAN_IE_RSN_EXT pRSNWPA,
269 IN PWLAN_IE_COUNTRY pIE_Country,
270 IN PWLAN_IE_QUIET pIE_Quiet,
271 IN UINT uIELength,
272 IN PBYTE pbyIEs,
273 IN HANDLE pRxPacketContext
277 BOOL
278 BSSbUpdateToBSSList(
279 IN HANDLE hDeviceContext,
280 IN QWORD qwTimestamp,
281 IN WORD wBeaconInterval,
282 IN WORD wCapInfo,
283 IN BYTE byCurrChannel,
284 IN BOOL bChannelHit,
285 IN PWLAN_IE_SSID pSSID,
286 IN PWLAN_IE_SUPP_RATES pSuppRates,
287 IN PWLAN_IE_SUPP_RATES pExtSuppRates,
288 IN PERPObject psERP,
289 IN PWLAN_IE_RSN pRSN,
290 IN PWLAN_IE_RSN_EXT pRSNWPA,
291 IN PWLAN_IE_COUNTRY pIE_Country,
292 IN PWLAN_IE_QUIET pIE_Quiet,
293 IN PKnownBSS pBSSList,
294 IN UINT uIELength,
295 IN PBYTE pbyIEs,
296 IN HANDLE pRxPacketContext
300 BOOL
301 BSSbIsSTAInNodeDB(
302 IN HANDLE hDeviceContext,
303 IN PBYTE abyDstAddr,
304 OUT PUINT puNodeIndex
307 VOID
308 BSSvCreateOneNode(
309 IN HANDLE hDeviceContext,
310 OUT PUINT puNodeIndex
313 VOID
314 BSSvUpdateAPNode(
315 IN HANDLE hDeviceContext,
316 IN PWORD pwCapInfo,
317 IN PWLAN_IE_SUPP_RATES pItemRates,
318 IN PWLAN_IE_SUPP_RATES pExtSuppRates
322 VOID
323 BSSvSecondCallBack(
324 IN HANDLE hDeviceContext
328 VOID
329 BSSvUpdateNodeTxCounter(
330 IN HANDLE hDeviceContext,
331 IN PSStatCounter pStatistic,
332 IN BYTE byTSR,
333 IN BYTE byPktNO
336 VOID
337 BSSvRemoveOneNode(
338 IN HANDLE hDeviceContext,
339 IN UINT uNodeIndex
342 VOID
343 BSSvAddMulticastNode(
344 IN HANDLE hDeviceContext
348 VOID
349 BSSvClearNodeDBTable(
350 IN HANDLE hDeviceContext,
351 IN UINT uStartIndex
354 VOID
355 BSSvClearAnyBSSJoinRecord(
356 IN HANDLE hDeviceContext
359 #endif //__BSSDB_H__