Staging: vt665x: Typedef and macro cleanup Part 1
[linux-2.6/mini2440.git] / drivers / staging / vt6656 / bssdb.h
blobb9bd1fb436ce15cfbb39b923249e86ee1c98a2dd
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__
34 #include <linux/skbuff.h>
36 #if !defined(__80211HDR_H__)
37 #include "80211hdr.h"
38 #endif
39 #if !defined(__80211MGR_H__)
40 #include "80211mgr.h"
41 #endif
42 #if !defined(__CARD_H__)
43 #include "card.h"
44 #endif
45 #if !defined(__MIB_H__)
46 #include "mib.h"
47 #endif
50 /*--------------------- Export Definitions -------------------------*/
52 #define MAX_NODE_NUM 64
53 #define MAX_BSS_NUM 42
54 #define LOST_BEACON_COUNT 10 // 10 sec, XP defined
55 #define MAX_PS_TX_BUF 32 // sta max power saving tx buf
56 #define ADHOC_LOST_BEACON_COUNT 30 // 30 sec, beacon lost for adhoc only
57 #define MAX_INACTIVE_COUNT 300 // 300 sec, inactive STA node refresh
59 #define USE_PROTECT_PERIOD 10 // 10 sec, Use protect mode check period
60 #define ERP_RECOVER_COUNT 30 // 30 sec, ERP support callback check
61 #define BSS_CLEAR_COUNT 1
63 #define RSSI_STAT_COUNT 10
64 #define MAX_CHECK_RSSI_COUNT 8
66 // STA dwflags
67 #define WLAN_STA_AUTH BIT0
68 #define WLAN_STA_ASSOC BIT1
69 #define WLAN_STA_PS BIT2
70 #define WLAN_STA_TIM BIT3
71 // permanent; do not remove entry on expiration
72 #define WLAN_STA_PERM BIT4
73 // If 802.1X is used, this flag is
74 // controlling whether STA is authorized to
75 // send and receive non-IEEE 802.1X frames
76 #define WLAN_STA_AUTHORIZED BIT5
78 //#define MAX_RATE 12
80 #define MAX_WPA_IE_LEN 64
83 /*--------------------- Export Classes ----------------------------*/
85 /*--------------------- Export Variables --------------------------*/
88 /*--------------------- Export Types ------------------------------*/
91 // IEEE 802.11 Structures and definitions
94 typedef struct tagSERPObject {
95 BOOL bERPExist;
96 BYTE byERP;
97 }ERPObject, *PERPObject;
100 typedef struct tagSRSNCapObject {
101 BOOL bRSNCapExist;
102 WORD wRSNCap;
103 }SRSNCapObject, *PSRSNCapObject;
105 // BSS info(AP)
106 #pragma pack(1)
107 typedef struct tagKnownBSS {
108 // BSS info
109 BOOL bActive;
110 BYTE abyBSSID[WLAN_BSSID_LEN];
111 UINT uChannel;
112 BYTE abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
113 BYTE abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
114 UINT uRSSI;
115 BYTE bySQ;
116 WORD wBeaconInterval;
117 WORD wCapInfo;
118 BYTE abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
119 BYTE byRxRate;
121 // WORD wATIMWindow;
122 BYTE byRSSIStatCnt;
123 LONG ldBmMAX;
124 LONG ldBmAverage[RSSI_STAT_COUNT];
125 LONG ldBmAverRange;
126 //For any BSSID selection improvment
127 BOOL bSelected;
129 //++ WPA informations
130 BOOL bWPAValid;
131 BYTE byGKType;
132 BYTE abyPKType[4];
133 WORD wPKCount;
134 BYTE abyAuthType[4];
135 WORD wAuthCount;
136 BYTE byDefaultK_as_PK;
137 BYTE byReplayIdx;
138 //--
140 //++ WPA2 informations
141 BOOL bWPA2Valid;
142 BYTE byCSSGK;
143 WORD wCSSPKCount;
144 BYTE abyCSSPK[4];
145 WORD wAKMSSAuthCount;
146 BYTE abyAKMSSAuthType[4];
148 //++ wpactl
149 BYTE byWPAIE[MAX_WPA_IE_LEN];
150 BYTE byRSNIE[MAX_WPA_IE_LEN];
151 WORD wWPALen;
152 WORD wRSNLen;
154 // Clear count
155 UINT uClearCount;
156 // BYTE abyIEs[WLAN_BEACON_FR_MAXLEN];
157 UINT uIELength;
158 QWORD qwBSSTimestamp;
159 QWORD qwLocalTSF; // local TSF timer
161 CARD_PHY_TYPE eNetworkTypeInUse;
163 ERPObject sERP;
164 SRSNCapObject sRSNCapObj;
165 BYTE abyIEs[1024]; // don't move this field !!
167 }__attribute__ ((__packed__))
168 KnownBSS , *PKnownBSS;
172 typedef enum tagNODE_STATE {
173 NODE_FREE,
174 NODE_AGED,
175 NODE_KNOWN,
176 NODE_AUTH,
177 NODE_ASSOC
178 } NODE_STATE, *PNODE_STATE;
181 // STA node info
182 typedef struct tagKnownNodeDB {
183 // STA info
184 BOOL bActive;
185 BYTE abyMACAddr[WLAN_ADDR_LEN];
186 BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
187 BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
188 WORD wTxDataRate;
189 BOOL bShortPreamble;
190 BOOL bERPExist;
191 BOOL bShortSlotTime;
192 UINT uInActiveCount;
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.
195 WORD wSuppRate;
196 BYTE byTopOFDMBasicRate;//Records the highest basic rate in OFDM mode
197 BYTE byTopCCKBasicRate; //Records the highest basic rate in CCK mode
199 // For AP mode
200 struct sk_buff_head sTxPSQueue;
201 WORD wCapInfo;
202 WORD wListenInterval;
203 WORD wAID;
204 NODE_STATE eNodeState;
205 BOOL bPSEnable;
206 BOOL bRxPSPoll;
207 BYTE byAuthSequence;
208 ULONG ulLastRxJiffer;
209 BYTE bySuppRate;
210 DWORD dwFlags;
211 WORD wEnQueueCnt;
213 BOOL bOnFly;
214 ULONGLONG KeyRSC;
215 BYTE byKeyIndex;
216 DWORD dwKeyIndex;
217 BYTE byCipherSuite;
218 DWORD dwTSC47_16;
219 WORD wTSC15_0;
220 UINT uWepKeyLength;
221 BYTE abyWepKey[WLAN_WEPMAX_KEYLEN];
223 // Auto rate fallback vars
224 BOOL bIsInFallback;
225 UINT uAverageRSSI;
226 UINT uRateRecoveryTimeout;
227 UINT uRatePollTimeout;
228 UINT uTxFailures;
229 UINT uTxAttempts;
231 UINT uTxRetry;
232 UINT uFailureRatio;
233 UINT uRetryRatio;
234 UINT uTxOk[MAX_RATE+1];
235 UINT uTxFail[MAX_RATE+1];
236 UINT uTimeCount;
238 } KnownNodeDB, *PKnownNodeDB;
241 /*--------------------- Export Functions --------------------------*/
245 PKnownBSS
246 BSSpSearchBSSList(
247 IN HANDLE hDeviceContext,
248 IN PBYTE pbyDesireBSSID,
249 IN PBYTE pbyDesireSSID,
250 IN CARD_PHY_TYPE ePhyType
253 PKnownBSS
254 BSSpAddrIsInBSSList(
255 IN HANDLE hDeviceContext,
256 IN PBYTE abyBSSID,
257 IN PWLAN_IE_SSID pSSID
260 VOID
261 BSSvClearBSSList(
262 IN HANDLE hDeviceContext,
263 IN BOOL bKeepCurrBSSID
266 BOOL
267 BSSbInsertToBSSList(
268 IN HANDLE hDeviceContext,
269 IN PBYTE abyBSSIDAddr,
270 IN QWORD qwTimestamp,
271 IN WORD wBeaconInterval,
272 IN WORD wCapInfo,
273 IN BYTE byCurrChannel,
274 IN PWLAN_IE_SSID pSSID,
275 IN PWLAN_IE_SUPP_RATES pSuppRates,
276 IN PWLAN_IE_SUPP_RATES pExtSuppRates,
277 IN PERPObject psERP,
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,
282 IN UINT uIELength,
283 IN PBYTE pbyIEs,
284 IN HANDLE pRxPacketContext
288 BOOL
289 BSSbUpdateToBSSList(
290 IN HANDLE hDeviceContext,
291 IN QWORD qwTimestamp,
292 IN WORD wBeaconInterval,
293 IN WORD wCapInfo,
294 IN BYTE byCurrChannel,
295 IN BOOL bChannelHit,
296 IN PWLAN_IE_SSID pSSID,
297 IN PWLAN_IE_SUPP_RATES pSuppRates,
298 IN PWLAN_IE_SUPP_RATES pExtSuppRates,
299 IN PERPObject psERP,
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,
305 IN UINT uIELength,
306 IN PBYTE pbyIEs,
307 IN HANDLE pRxPacketContext
311 BOOL
312 BSSbIsSTAInNodeDB(
313 IN HANDLE hDeviceContext,
314 IN PBYTE abyDstAddr,
315 OUT PUINT puNodeIndex
318 VOID
319 BSSvCreateOneNode(
320 IN HANDLE hDeviceContext,
321 OUT PUINT puNodeIndex
324 VOID
325 BSSvUpdateAPNode(
326 IN HANDLE hDeviceContext,
327 IN PWORD pwCapInfo,
328 IN PWLAN_IE_SUPP_RATES pItemRates,
329 IN PWLAN_IE_SUPP_RATES pExtSuppRates
333 VOID
334 BSSvSecondCallBack(
335 IN HANDLE hDeviceContext
339 VOID
340 BSSvUpdateNodeTxCounter(
341 IN HANDLE hDeviceContext,
342 IN PSStatCounter pStatistic,
343 IN BYTE byTSR,
344 IN BYTE byPktNO
347 VOID
348 BSSvRemoveOneNode(
349 IN HANDLE hDeviceContext,
350 IN UINT uNodeIndex
353 VOID
354 BSSvAddMulticastNode(
355 IN HANDLE hDeviceContext
359 VOID
360 BSSvClearNodeDBTable(
361 IN HANDLE hDeviceContext,
362 IN UINT uStartIndex
365 VOID
366 BSSvClearAnyBSSJoinRecord(
367 IN HANDLE hDeviceContext
370 #endif //__BSSDB_H__