]> git.proxmox.com Git - mirror_ubuntu-kernels.git/blame - drivers/staging/vt6655/bssdb.h
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc
[mirror_ubuntu-kernels.git] / drivers / staging / vt6655 / bssdb.h
CommitLineData
5449c685
FB
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
5449c685 33#include <linux/skbuff.h>
5449c685 34#include "80211hdr.h"
5449c685 35#include "80211mgr.h"
5449c685 36#include "card.h"
5449c685
FB
37
38/*--------------------- Export Definitions -------------------------*/
39
40#define MAX_NODE_NUM 64
41#define MAX_BSS_NUM 42
42#define LOST_BEACON_COUNT 10 // 10 sec, XP defined
43#define MAX_PS_TX_BUF 32 // sta max power saving tx buf
44#define ADHOC_LOST_BEACON_COUNT 30 // 30 sec, beacon lost for adhoc only
45#define MAX_INACTIVE_COUNT 300 // 300 sec, inactive STA node refresh
46
47#define USE_PROTECT_PERIOD 10 // 10 sec, Use protect mode check period
48#define ERP_RECOVER_COUNT 30 // 30 sec, ERP support callback check
49#define BSS_CLEAR_COUNT 1
50
51#define RSSI_STAT_COUNT 10
52#define MAX_CHECK_RSSI_COUNT 8
53
54// STA dwflags
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// permanent; do not remove entry on expiration
60#define WLAN_STA_PERM BIT4
61// If 802.1X is used, this flag is
62// controlling whether STA is authorized to
63// send and receive non-IEEE 802.1X frames
64#define WLAN_STA_AUTHORIZED BIT5
65
66#define MAX_RATE 12
67
68#define MAX_WPA_IE_LEN 64
69
70
71/*--------------------- Export Classes ----------------------------*/
72
73/*--------------------- Export Variables --------------------------*/
74
75
76/*--------------------- Export Types ------------------------------*/
77
78//
79// IEEE 802.11 Structures and definitions
80//
81
82typedef enum _NDIS_802_11_NETWORK_TYPE
83{
84 Ndis802_11FH,
85 Ndis802_11DS,
86 Ndis802_11OFDM5,
87 Ndis802_11OFDM24,
88 Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound
89} NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
90
91
92typedef struct tagSERPObject {
7b6a0013 93 bool bERPExist;
3fc9b584 94 unsigned char byERP;
a884847a 95}ERPObject, *PERPObject;
5449c685
FB
96
97
98typedef struct tagSRSNCapObject {
7b6a0013 99 bool bRSNCapExist;
2986db5f 100 unsigned short wRSNCap;
a884847a 101}SRSNCapObject, *PSRSNCapObject;
5449c685
FB
102
103// BSS info(AP)
104#pragma pack(1)
105typedef struct tagKnownBSS {
106 // BSS info
7b6a0013 107 bool bActive;
3fc9b584 108 unsigned char abyBSSID[WLAN_BSSID_LEN];
b6e95cd5 109 unsigned int uChannel;
3fc9b584
CC
110 unsigned char abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
111 unsigned char abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
b6e95cd5 112 unsigned int uRSSI;
3fc9b584 113 unsigned char bySQ;
2986db5f
CC
114 unsigned short wBeaconInterval;
115 unsigned short wCapInfo;
3fc9b584
CC
116 unsigned char abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
117 unsigned char byRxRate;
612822f5 118
2986db5f 119// unsigned short wATIMWindow;
3fc9b584 120 unsigned char byRSSIStatCnt;
b83cc2ed
CC
121 long ldBmMAX;
122 long ldBmAverage[RSSI_STAT_COUNT];
123 long ldBmAverRange;
5449c685 124 //For any BSSID selection improvment
7b6a0013 125 bool bSelected;
5449c685
FB
126
127 //++ WPA informations
7b6a0013 128 bool bWPAValid;
3fc9b584
CC
129 unsigned char byGKType;
130 unsigned char abyPKType[4];
2986db5f 131 unsigned short wPKCount;
3fc9b584 132 unsigned char abyAuthType[4];
2986db5f 133 unsigned short wAuthCount;
3fc9b584
CC
134 unsigned char byDefaultK_as_PK;
135 unsigned char byReplayIdx;
5449c685
FB
136 //--
137
138 //++ WPA2 informations
7b6a0013 139 bool bWPA2Valid;
3fc9b584 140 unsigned char byCSSGK;
2986db5f 141 unsigned short wCSSPKCount;
3fc9b584 142 unsigned char abyCSSPK[4];
2986db5f 143 unsigned short wAKMSSAuthCount;
3fc9b584 144 unsigned char abyAKMSSAuthType[4];
5449c685
FB
145
146 //++ wpactl
3fc9b584
CC
147 unsigned char byWPAIE[MAX_WPA_IE_LEN];
148 unsigned char byRSNIE[MAX_WPA_IE_LEN];
2986db5f
CC
149 unsigned short wWPALen;
150 unsigned short wRSNLen;
5449c685
FB
151
152 // Clear count
b6e95cd5 153 unsigned int uClearCount;
3fc9b584 154// unsigned char abyIEs[WLAN_BEACON_FR_MAXLEN];
b6e95cd5 155 unsigned int uIELength;
5449c685
FB
156 QWORD qwBSSTimestamp;
157 QWORD qwLocalTSF; // local TSF timer
158
159// NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
160 CARD_PHY_TYPE eNetworkTypeInUse;
161
162 ERPObject sERP;
163 SRSNCapObject sRSNCapObj;
3fc9b584 164 unsigned char abyIEs[1024]; // don't move this field !!
5449c685
FB
165
166}__attribute__ ((__packed__))
a884847a 167KnownBSS , *PKnownBSS;
5449c685
FB
168
169//2006-1116-01,<Add> by NomadZhao
170#pragma pack()
171
172typedef enum tagNODE_STATE {
173 NODE_FREE,
174 NODE_AGED,
175 NODE_KNOWN,
176 NODE_AUTH,
177 NODE_ASSOC
178} NODE_STATE, *PNODE_STATE;
179
180
181// STA node info
182typedef struct tagKnownNodeDB {
183 // STA info
7b6a0013 184 bool bActive;
3fc9b584
CC
185 unsigned char abyMACAddr[WLAN_ADDR_LEN];
186 unsigned char abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
187 unsigned char abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
2986db5f 188 unsigned short wTxDataRate;
7b6a0013
CC
189 bool bShortPreamble;
190 bool bERPExist;
191 bool bShortSlotTime;
b6e95cd5 192 unsigned int uInActiveCount;
2986db5f
CC
193 unsigned short wMaxBasicRate; //Get from byTopOFDMBasicRate or byTopCCKBasicRate which depends on packetTyp.
194 unsigned short wMaxSuppRate; //Records the highest supported rate getting from SuppRates IE and ExtSuppRates IE in Beacon.
195 unsigned short wSuppRate;
3fc9b584
CC
196 unsigned char byTopOFDMBasicRate;//Records the highest basic rate in OFDM mode
197 unsigned char byTopCCKBasicRate; //Records the highest basic rate in CCK mode
5449c685
FB
198
199 // For AP mode
200 struct sk_buff_head sTxPSQueue;
2986db5f
CC
201 unsigned short wCapInfo;
202 unsigned short wListenInterval;
203 unsigned short wAID;
5449c685 204 NODE_STATE eNodeState;
7b6a0013
CC
205 bool bPSEnable;
206 bool bRxPSPoll;
3fc9b584 207 unsigned char byAuthSequence;
e3fd16d0 208 unsigned long ulLastRxJiffer;
3fc9b584 209 unsigned char bySuppRate;
0f4c60d6 210 unsigned long dwFlags;
2986db5f 211 unsigned short wEnQueueCnt;
5449c685 212
7b6a0013 213 bool bOnFly;
b2e876b6 214 unsigned long long KeyRSC;
3fc9b584 215 unsigned char byKeyIndex;
0f4c60d6 216 unsigned long dwKeyIndex;
3fc9b584 217 unsigned char byCipherSuite;
0f4c60d6 218 unsigned long dwTSC47_16;
2986db5f 219 unsigned short wTSC15_0;
b6e95cd5 220 unsigned int uWepKeyLength;
3fc9b584 221 unsigned char abyWepKey[WLAN_WEPMAX_KEYLEN];
5449c685
FB
222 //
223 // Auto rate fallback vars
7b6a0013 224 bool bIsInFallback;
b6e95cd5
CC
225 unsigned int uAverageRSSI;
226 unsigned int uRateRecoveryTimeout;
227 unsigned int uRatePollTimeout;
228 unsigned int uTxFailures;
229 unsigned int uTxAttempts;
230
231 unsigned int uTxRetry;
232 unsigned int uFailureRatio;
233 unsigned int uRetryRatio;
234 unsigned int uTxOk[MAX_RATE+1];
235 unsigned int uTxFail[MAX_RATE+1];
236 unsigned int uTimeCount;
5449c685 237
a884847a 238} KnownNodeDB, *PKnownNodeDB;
5449c685
FB
239
240
241/*--------------------- Export Functions --------------------------*/
242
243
244
245PKnownBSS
246BSSpSearchBSSList(
3a215e0f 247 void *hDeviceContext,
2989e96f
CC
248 unsigned char *pbyDesireBSSID,
249 unsigned char *pbyDesireSSID,
3a215e0f 250 CARD_PHY_TYPE ePhyType
5449c685
FB
251 );
252
253PKnownBSS
254BSSpAddrIsInBSSList(
3a215e0f 255 void *hDeviceContext,
2989e96f 256 unsigned char *abyBSSID,
3a215e0f 257 PWLAN_IE_SSID pSSID
5449c685
FB
258 );
259
6b35b7b3 260void
5449c685 261BSSvClearBSSList(
3a215e0f 262 void *hDeviceContext,
7b6a0013 263 bool bKeepCurrBSSID
5449c685
FB
264 );
265
7b6a0013 266bool
5449c685 267BSSbInsertToBSSList(
3a215e0f 268 void *hDeviceContext,
2989e96f 269 unsigned char *abyBSSIDAddr,
3a215e0f 270 QWORD qwTimestamp,
2986db5f
CC
271 unsigned short wBeaconInterval,
272 unsigned short wCapInfo,
3fc9b584 273 unsigned char byCurrChannel,
3a215e0f
CC
274 PWLAN_IE_SSID pSSID,
275 PWLAN_IE_SUPP_RATES pSuppRates,
276 PWLAN_IE_SUPP_RATES pExtSuppRates,
277 PERPObject psERP,
278 PWLAN_IE_RSN pRSN,
279 PWLAN_IE_RSN_EXT pRSNWPA,
280 PWLAN_IE_COUNTRY pIE_Country,
281 PWLAN_IE_QUIET pIE_Quiet,
b6e95cd5 282 unsigned int uIELength,
2989e96f 283 unsigned char *pbyIEs,
3a215e0f 284 void *pRxPacketContext
5449c685
FB
285 );
286
287
7b6a0013 288bool
5449c685 289BSSbUpdateToBSSList(
3a215e0f
CC
290 void *hDeviceContext,
291 QWORD qwTimestamp,
2986db5f
CC
292 unsigned short wBeaconInterval,
293 unsigned short wCapInfo,
3fc9b584 294 unsigned char byCurrChannel,
7b6a0013 295 bool bChannelHit,
3a215e0f
CC
296 PWLAN_IE_SSID pSSID,
297 PWLAN_IE_SUPP_RATES pSuppRates,
298 PWLAN_IE_SUPP_RATES pExtSuppRates,
299 PERPObject psERP,
300 PWLAN_IE_RSN pRSN,
301 PWLAN_IE_RSN_EXT pRSNWPA,
302 PWLAN_IE_COUNTRY pIE_Country,
303 PWLAN_IE_QUIET pIE_Quiet,
304 PKnownBSS pBSSList,
b6e95cd5 305 unsigned int uIELength,
2989e96f 306 unsigned char *pbyIEs,
3a215e0f 307 void *pRxPacketContext
5449c685
FB
308 );
309
310
7b6a0013 311bool
fe4f34bd
CC
312BSSDBbIsSTAInNodeDB(void *hDeviceContext, unsigned char *abyDstAddr,
313 unsigned int *puNodeIndex);
5449c685 314
6b35b7b3 315void
fe4f34bd 316BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex);
5449c685 317
6b35b7b3 318void
5449c685 319BSSvUpdateAPNode(
3a215e0f 320 void *hDeviceContext,
15df6c2b 321 unsigned short *pwCapInfo,
3a215e0f
CC
322 PWLAN_IE_SUPP_RATES pItemRates,
323 PWLAN_IE_SUPP_RATES pExtSuppRates
5449c685
FB
324 );
325
326
6b35b7b3 327void
5449c685 328BSSvSecondCallBack(
3a215e0f 329 void *hDeviceContext
5449c685
FB
330 );
331
612822f5 332
6b35b7b3 333void
5449c685 334BSSvUpdateNodeTxCounter(
3a215e0f 335 void *hDeviceContext,
3fc9b584
CC
336 unsigned char byTsr0,
337 unsigned char byTsr1,
2989e96f 338 unsigned char *pbyBuffer,
b6e95cd5 339 unsigned int uFIFOHeaderSize
5449c685
FB
340 );
341
6b35b7b3 342void
5449c685 343BSSvRemoveOneNode(
3a215e0f 344 void *hDeviceContext,
b6e95cd5 345 unsigned int uNodeIndex
5449c685
FB
346 );
347
6b35b7b3 348void
5449c685 349BSSvAddMulticastNode(
3a215e0f 350 void *hDeviceContext
5449c685
FB
351 );
352
353
6b35b7b3 354void
5449c685 355BSSvClearNodeDBTable(
3a215e0f 356 void *hDeviceContext,
b6e95cd5 357 unsigned int uStartIndex
5449c685
FB
358 );
359
6b35b7b3 360void
5449c685 361BSSvClearAnyBSSJoinRecord(
3a215e0f 362 void *hDeviceContext
5449c685
FB
363 );
364
365#endif //__BSSDB_H__