1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
38
39
40#define MAX_NODE_NUM 64
41#define MAX_BSS_NUM 42
42#define LOST_BEACON_COUNT 10
43#define MAX_PS_TX_BUF 32
44#define ADHOC_LOST_BEACON_COUNT 30
45#define MAX_INACTIVE_COUNT 300
46
47#define USE_PROTECT_PERIOD 10
48#define ERP_RECOVER_COUNT 30
49#define BSS_CLEAR_COUNT 1
50
51#define RSSI_STAT_COUNT 10
52#define MAX_CHECK_RSSI_COUNT 8
53
54
55#define WLAN_STA_AUTH BIT0
56#define WLAN_STA_ASSOC BIT1
57#define WLAN_STA_PS BIT2
58#define WLAN_STA_TIM BIT3
59
60#define WLAN_STA_PERM BIT4
61
62
63
64#define WLAN_STA_AUTHORIZED BIT5
65
66#define MAX_RATE 12
67
68#define MAX_WPA_IE_LEN 64
69
70
71
72
73
74
75
76
77
78
79
80typedef enum _NDIS_802_11_NETWORK_TYPE
81{
82 Ndis802_11FH,
83 Ndis802_11DS,
84 Ndis802_11OFDM5,
85 Ndis802_11OFDM24,
86 Ndis802_11NetworkTypeMax
87} NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
88
89typedef struct tagSERPObject {
90 bool bERPExist;
91 unsigned char byERP;
92} ERPObject, *PERPObject;
93
94typedef struct tagSRSNCapObject {
95 bool bRSNCapExist;
96 unsigned short wRSNCap;
97} SRSNCapObject, *PSRSNCapObject;
98
99
100#pragma pack(1)
101typedef struct tagKnownBSS {
102
103 bool bActive;
104 unsigned char abyBSSID[WLAN_BSSID_LEN];
105 unsigned int uChannel;
106 unsigned char abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
107 unsigned char abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
108 unsigned int uRSSI;
109 unsigned char bySQ;
110 unsigned short wBeaconInterval;
111 unsigned short wCapInfo;
112 unsigned char abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
113 unsigned char byRxRate;
114
115
116 unsigned char byRSSIStatCnt;
117 long ldBmMAX;
118 long ldBmAverage[RSSI_STAT_COUNT];
119 long ldBmAverRange;
120
121 bool bSelected;
122
123
124 bool bWPAValid;
125 unsigned char byGKType;
126 unsigned char abyPKType[4];
127 unsigned short wPKCount;
128 unsigned char abyAuthType[4];
129 unsigned short wAuthCount;
130 unsigned char byDefaultK_as_PK;
131 unsigned char byReplayIdx;
132
133
134
135 bool bWPA2Valid;
136 unsigned char byCSSGK;
137 unsigned short wCSSPKCount;
138 unsigned char abyCSSPK[4];
139 unsigned short wAKMSSAuthCount;
140 unsigned char abyAKMSSAuthType[4];
141
142
143 unsigned char byWPAIE[MAX_WPA_IE_LEN];
144 unsigned char byRSNIE[MAX_WPA_IE_LEN];
145 unsigned short wWPALen;
146 unsigned short wRSNLen;
147
148
149 unsigned int uClearCount;
150
151 unsigned int uIELength;
152 QWORD qwBSSTimestamp;
153 QWORD qwLocalTSF;
154
155
156 CARD_PHY_TYPE eNetworkTypeInUse;
157
158 ERPObject sERP;
159 SRSNCapObject sRSNCapObj;
160 unsigned char abyIEs[1024];
161} __attribute__ ((__packed__))
162KnownBSS , *PKnownBSS;
163
164
165#pragma pack()
166
167typedef enum tagNODE_STATE {
168 NODE_FREE,
169 NODE_AGED,
170 NODE_KNOWN,
171 NODE_AUTH,
172 NODE_ASSOC
173} NODE_STATE, *PNODE_STATE;
174
175
176typedef struct tagKnownNodeDB {
177
178 bool bActive;
179 unsigned char abyMACAddr[WLAN_ADDR_LEN];
180 unsigned char abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
181 unsigned char abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
182 unsigned short wTxDataRate;
183 bool bShortPreamble;
184 bool bERPExist;
185 bool bShortSlotTime;
186 unsigned int uInActiveCount;
187 unsigned short wMaxBasicRate;
188 unsigned short wMaxSuppRate;
189 unsigned short wSuppRate;
190 unsigned char byTopOFDMBasicRate;
191 unsigned char byTopCCKBasicRate;
192
193
194 struct sk_buff_head sTxPSQueue;
195 unsigned short wCapInfo;
196 unsigned short wListenInterval;
197 unsigned short wAID;
198 NODE_STATE eNodeState;
199 bool bPSEnable;
200 bool bRxPSPoll;
201 unsigned char byAuthSequence;
202 unsigned long ulLastRxJiffer;
203 unsigned char bySuppRate;
204 unsigned long dwFlags;
205 unsigned short wEnQueueCnt;
206
207 bool bOnFly;
208 unsigned long long KeyRSC;
209 unsigned char byKeyIndex;
210 unsigned long dwKeyIndex;
211 unsigned char byCipherSuite;
212 unsigned long dwTSC47_16;
213 unsigned short wTSC15_0;
214 unsigned int uWepKeyLength;
215 unsigned char abyWepKey[WLAN_WEPMAX_KEYLEN];
216
217
218 bool bIsInFallback;
219 unsigned int uAverageRSSI;
220 unsigned int uRateRecoveryTimeout;
221 unsigned int uRatePollTimeout;
222 unsigned int uTxFailures;
223 unsigned int uTxAttempts;
224
225 unsigned int uTxRetry;
226 unsigned int uFailureRatio;
227 unsigned int uRetryRatio;
228 unsigned int uTxOk[MAX_RATE+1];
229 unsigned int uTxFail[MAX_RATE+1];
230 unsigned int uTimeCount;
231} KnownNodeDB, *PKnownNodeDB;
232
233
234
235PKnownBSS
236BSSpSearchBSSList(
237 void *hDeviceContext,
238 unsigned char *pbyDesireBSSID,
239 unsigned char *pbyDesireSSID,
240 CARD_PHY_TYPE ePhyType
241);
242
243PKnownBSS
244BSSpAddrIsInBSSList(
245 void *hDeviceContext,
246 unsigned char *abyBSSID,
247 PWLAN_IE_SSID pSSID
248);
249
250void
251BSSvClearBSSList(
252 void *hDeviceContext,
253 bool bKeepCurrBSSID
254);
255
256bool
257BSSbInsertToBSSList(
258 void *hDeviceContext,
259 unsigned char *abyBSSIDAddr,
260 QWORD qwTimestamp,
261 unsigned short wBeaconInterval,
262 unsigned short wCapInfo,
263 unsigned char byCurrChannel,
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 unsigned int uIELength,
273 unsigned char *pbyIEs,
274 void *pRxPacketContext
275);
276
277bool
278BSSbUpdateToBSSList(
279 void *hDeviceContext,
280 QWORD qwTimestamp,
281 unsigned short wBeaconInterval,
282 unsigned short wCapInfo,
283 unsigned char byCurrChannel,
284 bool bChannelHit,
285 PWLAN_IE_SSID pSSID,
286 PWLAN_IE_SUPP_RATES pSuppRates,
287 PWLAN_IE_SUPP_RATES pExtSuppRates,
288 PERPObject psERP,
289 PWLAN_IE_RSN pRSN,
290 PWLAN_IE_RSN_EXT pRSNWPA,
291 PWLAN_IE_COUNTRY pIE_Country,
292 PWLAN_IE_QUIET pIE_Quiet,
293 PKnownBSS pBSSList,
294 unsigned int uIELength,
295 unsigned char *pbyIEs,
296 void *pRxPacketContext
297);
298
299bool
300BSSDBbIsSTAInNodeDB(void *hDeviceContext, unsigned char *abyDstAddr,
301 unsigned int *puNodeIndex);
302
303void
304BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex);
305
306void
307BSSvUpdateAPNode(
308 void *hDeviceContext,
309 unsigned short *pwCapInfo,
310 PWLAN_IE_SUPP_RATES pItemRates,
311 PWLAN_IE_SUPP_RATES pExtSuppRates
312);
313
314void
315BSSvSecondCallBack(
316 void *hDeviceContext
317);
318
319void
320BSSvUpdateNodeTxCounter(
321 void *hDeviceContext,
322 unsigned char byTsr0,
323 unsigned char byTsr1,
324 unsigned char *pbyBuffer,
325 unsigned int uFIFOHeaderSize
326);
327
328void
329BSSvRemoveOneNode(
330 void *hDeviceContext,
331 unsigned int uNodeIndex
332);
333
334void
335BSSvAddMulticastNode(
336 void *hDeviceContext
337);
338
339void
340BSSvClearNodeDBTable(
341 void *hDeviceContext,
342 unsigned int uStartIndex
343);
344
345void
346BSSvClearAnyBSSJoinRecord(
347 void *hDeviceContext
348);
349
350#endif
351