Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
bssdb.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3  * All rights reserved.
4  *
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.
9  *
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.
14  *
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.
18  *
19  *
20  * File: bssdb.h
21  *
22  * Purpose: Handles the Basic Service Set & Node Database functions
23  *
24  * Author: Lyndon Chen
25  *
26  * Date: July 16, 2002
27  *
28  */
29 
30 #ifndef __BSSDB_H__
31 #define __BSSDB_H__
32 
33 #include <linux/skbuff.h>
34 #include "80211hdr.h"
35 #include "80211mgr.h"
36 #include "card.h"
37 #include "mib.h"
38 
39 /*--------------------- Export Definitions -------------------------*/
40 
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
47 
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
51 
52 #define RSSI_STAT_COUNT 10
53 #define MAX_CHECK_RSSI_COUNT 8
54 
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
66 
67 #define MAX_WPA_IE_LEN 64
68 
69 
70 /*--------------------- Export Classes ----------------------------*/
71 
72 /*--------------------- Export Variables --------------------------*/
73 
74 
75 /*--------------------- Export Types ------------------------------*/
76 
77 //
78 // IEEE 802.11 Structures and definitions
79 //
80 
81 typedef struct tagSERPObject {
85 
86 
87 typedef struct tagSRSNCapObject {
91 
92 // BSS info(AP)
93 #pragma pack(1)
94 typedef struct tagKnownBSS {
95  // BSS info
98  unsigned int uChannel;
101  unsigned int uRSSI;
107 
108 // WORD wATIMWindow;
110  signed long ldBmMAX;
112  signed long ldBmAverRange;
113  //For any BSSID selection improvment
115 
116  //++ WPA informations
125  //--
126 
127  //++ WPA2 informations
134 
135  //++ wpactl
140 
141  // Clear count
142  unsigned int uClearCount;
143 // BYTE abyIEs[WLAN_BEACON_FR_MAXLEN];
144  unsigned int uIELength;
146  QWORD qwLocalTSF; // local TSF timer
147 
149 
150  ERPObject sERP;
152  BYTE abyIEs[1024]; // don't move this field !!
153 
154 } __attribute__ ((__packed__))
155 KnownBSS , *PKnownBSS;
156 
159 typedef enum tagNODE_STATE {
168 // STA node info
169 typedef struct tagKnownNodeDB {
170  // STA info
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
186  // For AP mode
187  struct sk_buff_head sTxPSQueue;
195  unsigned long ulLastRxJiffer;
201  unsigned long long KeyRSC;
207  unsigned int uWepKeyLength;
209  //
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;
217 
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;
224 
226 
227 /*--------------------- Export Functions --------------------------*/
228 
229 PKnownBSS BSSpSearchBSSList(void *hDeviceContext,
230  PBYTE pbyDesireBSSID,
231  PBYTE pbyDesireSSID,
232  CARD_PHY_TYPE ePhyType);
233 
234 PKnownBSS BSSpAddrIsInBSSList(void *hDeviceContext,
235  PBYTE abyBSSID,
236  PWLAN_IE_SSID pSSID);
237 
238 void BSSvClearBSSList(void *hDeviceContext, BOOL bKeepCurrBSSID);
239 
240 BOOL BSSbInsertToBSSList(void *hDeviceContext,
241  PBYTE abyBSSIDAddr,
242  QWORD qwTimestamp,
244  WORD wCapInfo,
246  PWLAN_IE_SSID pSSID,
247  PWLAN_IE_SUPP_RATES pSuppRates,
248  PWLAN_IE_SUPP_RATES pExtSuppRates,
249  PERPObject psERP,
250  PWLAN_IE_RSN pRSN,
251  PWLAN_IE_RSN_EXT pRSNWPA,
252  PWLAN_IE_COUNTRY pIE_Country,
253  PWLAN_IE_QUIET pIE_Quiet,
254  unsigned int uIELength,
255  PBYTE pbyIEs,
256  void *pRxPacketContext);
257 
258 BOOL BSSbUpdateToBSSList(void *hDeviceContext,
259  QWORD qwTimestamp,
261  WORD wCapInfo,
263  BOOL bChannelHit,
264  PWLAN_IE_SSID pSSID,
265  PWLAN_IE_SUPP_RATES pSuppRates,
266  PWLAN_IE_SUPP_RATES pExtSuppRates,
267  PERPObject psERP,
268  PWLAN_IE_RSN pRSN,
269  PWLAN_IE_RSN_EXT pRSNWPA,
270  PWLAN_IE_COUNTRY pIE_Country,
271  PWLAN_IE_QUIET pIE_Quiet,
272  PKnownBSS pBSSList,
273  unsigned int uIELength,
274  PBYTE pbyIEs,
275  void *pRxPacketContext);
276 
277 BOOL BSSbIsSTAInNodeDB(void *hDeviceContext,
279  unsigned int *puNodeIndex);
280 
281 void BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex);
282 
283 void BSSvUpdateAPNode(void *hDeviceContext,
284  PWORD pwCapInfo,
285  PWLAN_IE_SUPP_RATES pItemRates,
286  PWLAN_IE_SUPP_RATES pExtSuppRates);
287 
288 void BSSvSecondCallBack(void *hDeviceContext);
289 
290 void BSSvUpdateNodeTxCounter(void *hDeviceContext,
291  PSStatCounter pStatistic,
292  BYTE byTSR,
293  BYTE byPktNO);
294 
295 void BSSvRemoveOneNode(void *hDeviceContext,
296  unsigned int uNodeIndex);
297 
298 void BSSvAddMulticastNode(void *hDeviceContext);
299 
300 void BSSvClearNodeDBTable(void *hDeviceContext,
301  unsigned int uStartIndex);
302 
303 void BSSvClearAnyBSSJoinRecord(void *hDeviceContext);
304 
305 #endif /* __BSSDB_H__ */