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#include "mib.h"
38
39#define MAX_NODE_NUM 64
40#define MAX_BSS_NUM 42
41#define LOST_BEACON_COUNT 10
42#define MAX_PS_TX_BUF 32
43#define ADHOC_LOST_BEACON_COUNT 30
44#define MAX_INACTIVE_COUNT 300
45
46#define USE_PROTECT_PERIOD 10
47#define ERP_RECOVER_COUNT 30
48#define BSS_CLEAR_COUNT 1
49
50#define RSSI_STAT_COUNT 10
51#define MAX_CHECK_RSSI_COUNT 8
52
53
54#define WLAN_STA_AUTH BIT0
55#define WLAN_STA_ASSOC BIT1
56#define WLAN_STA_PS BIT2
57#define WLAN_STA_TIM BIT3
58
59#define WLAN_STA_PERM BIT4
60
61
62
63#define WLAN_STA_AUTHORIZED BIT5
64
65#define MAX_WPA_IE_LEN 64
66
67
68
69
70
71typedef struct tagSERPObject {
72 bool bERPExist;
73 u8 byERP;
74} ERPObject, *PERPObject;
75
76typedef struct tagSRSNCapObject {
77 bool bRSNCapExist;
78 u16 wRSNCap;
79} SRSNCapObject, *PSRSNCapObject;
80
81
82typedef struct tagKnownBSS {
83
84 bool bActive;
85 u8 abyBSSID[WLAN_BSSID_LEN];
86 unsigned int uChannel;
87 u8 abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
88 u8 abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
89 unsigned int uRSSI;
90 u8 bySQ;
91 u16 wBeaconInterval;
92 u16 wCapInfo;
93 u8 abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
94 u8 byRxRate;
95
96
97 u8 byRSSIStatCnt;
98 signed long ldBmMAX;
99 signed long ldBmAverage[RSSI_STAT_COUNT];
100 signed long ldBmAverRange;
101
102 bool bSelected;
103
104
105 bool bWPAValid;
106 u8 byGKType;
107 u8 abyPKType[4];
108 u16 wPKCount;
109 u8 abyAuthType[4];
110 u16 wAuthCount;
111 u8 byDefaultK_as_PK;
112 u8 byReplayIdx;
113
114
115
116 bool bWPA2Valid;
117 u8 byCSSGK;
118 u16 wCSSPKCount;
119 u8 abyCSSPK[4];
120 u16 wAKMSSAuthCount;
121 u8 abyAKMSSAuthType[4];
122
123
124 u8 byWPAIE[MAX_WPA_IE_LEN];
125 u8 byRSNIE[MAX_WPA_IE_LEN];
126 u16 wWPALen;
127 u16 wRSNLen;
128
129
130 unsigned int uClearCount;
131
132 unsigned int uIELength;
133 u64 qwBSSTimestamp;
134 u64 qwLocalTSF;
135
136 CARD_PHY_TYPE eNetworkTypeInUse;
137
138 ERPObject sERP;
139 SRSNCapObject sRSNCapObj;
140 u8 abyIEs[1024];
141
142} __attribute__ ((__packed__))
143KnownBSS , *PKnownBSS;
144
145typedef enum tagNODE_STATE {
146 NODE_FREE,
147 NODE_AGED,
148 NODE_KNOWN,
149 NODE_AUTH,
150 NODE_ASSOC
151} NODE_STATE, *PNODE_STATE;
152
153
154typedef struct tagKnownNodeDB {
155
156 bool bActive;
157 u8 abyMACAddr[WLAN_ADDR_LEN];
158 u8 abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
159 u8 abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
160 u16 wTxDataRate;
161 bool bShortPreamble;
162 bool bERPExist;
163 bool bShortSlotTime;
164 unsigned int uInActiveCount;
165 u16 wMaxBasicRate;
166 u16 wMaxSuppRate;
167 u16 wSuppRate;
168 u8 byTopOFDMBasicRate;
169 u8 byTopCCKBasicRate;
170
171
172 struct sk_buff_head sTxPSQueue;
173 u16 wCapInfo;
174 u16 wListenInterval;
175 u16 wAID;
176 NODE_STATE eNodeState;
177 bool bPSEnable;
178 bool bRxPSPoll;
179 u8 byAuthSequence;
180 unsigned long ulLastRxJiffer;
181 u8 bySuppRate;
182 u32 dwFlags;
183 u16 wEnQueueCnt;
184
185 bool bOnFly;
186 unsigned long long KeyRSC;
187 u8 byKeyIndex;
188 u32 dwKeyIndex;
189 u8 byCipherSuite;
190 u32 dwTSC47_16;
191 u16 wTSC15_0;
192 unsigned int uWepKeyLength;
193 u8 abyWepKey[WLAN_WEPMAX_KEYLEN];
194
195
196 bool bIsInFallback;
197 unsigned int uAverageRSSI;
198 unsigned int uRateRecoveryTimeout;
199 unsigned int uRatePollTimeout;
200 unsigned int uTxFailures;
201 unsigned int uTxAttempts;
202
203 unsigned int uTxRetry;
204 unsigned int uFailureRatio;
205 unsigned int uRetryRatio;
206 unsigned int uTxOk[MAX_RATE+1];
207 unsigned int uTxFail[MAX_RATE+1];
208 unsigned int uTimeCount;
209
210} KnownNodeDB, *PKnownNodeDB;
211
212PKnownBSS BSSpSearchBSSList(struct vnt_private *, u8 *pbyDesireBSSID,
213 u8 *pbyDesireSSID, CARD_PHY_TYPE ePhyType);
214
215PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *, u8 *abyBSSID,
216 PWLAN_IE_SSID pSSID);
217
218void BSSvClearBSSList(struct vnt_private *, int bKeepCurrBSSID);
219
220int BSSbInsertToBSSList(struct vnt_private *,
221 u8 *abyBSSIDAddr,
222 u64 qwTimestamp,
223 u16 wBeaconInterval,
224 u16 wCapInfo,
225 u8 byCurrChannel,
226 PWLAN_IE_SSID pSSID,
227 PWLAN_IE_SUPP_RATES pSuppRates,
228 PWLAN_IE_SUPP_RATES pExtSuppRates,
229 PERPObject psERP,
230 PWLAN_IE_RSN pRSN,
231 PWLAN_IE_RSN_EXT pRSNWPA,
232 PWLAN_IE_COUNTRY pIE_Country,
233 PWLAN_IE_QUIET pIE_Quiet,
234 u32 uIELength,
235 u8 *pbyIEs,
236 void *pRxPacketContext);
237
238int BSSbUpdateToBSSList(struct vnt_private *,
239 u64 qwTimestamp,
240 u16 wBeaconInterval,
241 u16 wCapInfo,
242 u8 byCurrChannel,
243 int bChannelHit,
244 PWLAN_IE_SSID pSSID,
245 PWLAN_IE_SUPP_RATES pSuppRates,
246 PWLAN_IE_SUPP_RATES pExtSuppRates,
247 PERPObject psERP,
248 PWLAN_IE_RSN pRSN,
249 PWLAN_IE_RSN_EXT pRSNWPA,
250 PWLAN_IE_COUNTRY pIE_Country,
251 PWLAN_IE_QUIET pIE_Quiet,
252 PKnownBSS pBSSList,
253 u32 uIELength,
254 u8 *pbyIEs,
255 void *pRxPacketContext);
256
257int BSSbIsSTAInNodeDB(struct vnt_private *, u8 * abyDstAddr,
258 u32 *puNodeIndex);
259
260void BSSvCreateOneNode(struct vnt_private *, u32 *puNodeIndex);
261
262void BSSvUpdateAPNode(struct vnt_private *, u16 *pwCapInfo,
263 PWLAN_IE_SUPP_RATES pItemRates, PWLAN_IE_SUPP_RATES pExtSuppRates);
264
265void BSSvSecondCallBack(struct vnt_private *);
266
267void BSSvUpdateNodeTxCounter(struct vnt_private *, PSStatCounter pStatistic,
268 u8 byTSR, u8 byPktNO);
269
270void BSSvRemoveOneNode(struct vnt_private *, u32 uNodeIndex);
271
272void BSSvAddMulticastNode(struct vnt_private *);
273
274void BSSvClearNodeDBTable(struct vnt_private *, u32 uStartIndex);
275
276void BSSvClearAnyBSSJoinRecord(struct vnt_private *);
277
278#endif
279