2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
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.
22 * Purpose: Handles the Basic Service Set & Node Database functions
33 //#if !defined(__DEVICE_H__)
36 #include <linux/skbuff.h>
37 #if !defined(__80211HDR_H__)
40 #if !defined(__80211MGR_H__)
43 #if !defined(__CARD_H__)
49 /*--------------------- Export Definitions -------------------------*/
51 #define MAX_NODE_NUM 64
52 #define MAX_BSS_NUM 42
53 #define LOST_BEACON_COUNT 10 // 10 sec, XP defined
54 #define MAX_PS_TX_BUF 32 // sta max power saving tx buf
55 #define ADHOC_LOST_BEACON_COUNT 30 // 30 sec, beacon lost for adhoc only
56 #define MAX_INACTIVE_COUNT 300 // 300 sec, inactive STA node refresh
58 #define USE_PROTECT_PERIOD 10 // 10 sec, Use protect mode check period
59 #define ERP_RECOVER_COUNT 30 // 30 sec, ERP support callback check
60 #define BSS_CLEAR_COUNT 1
62 #define RSSI_STAT_COUNT 10
63 #define MAX_CHECK_RSSI_COUNT 8
66 #define WLAN_STA_AUTH BIT0
67 #define WLAN_STA_ASSOC BIT1
68 #define WLAN_STA_PS BIT2
69 #define WLAN_STA_TIM BIT3
70 // permanent; do not remove entry on expiration
71 #define WLAN_STA_PERM BIT4
72 // If 802.1X is used, this flag is
73 // controlling whether STA is authorized to
74 // send and receive non-IEEE 802.1X frames
75 #define WLAN_STA_AUTHORIZED BIT5
79 #define MAX_WPA_IE_LEN 64
82 /*--------------------- Export Classes ----------------------------*/
84 /*--------------------- Export Variables --------------------------*/
87 /*--------------------- Export Types ------------------------------*/
90 // IEEE 802.11 Structures and definitions
93 typedef enum _NDIS_802_11_NETWORK_TYPE
99 Ndis802_11NetworkTypeMax
// not a real type, defined as an upper bound
100 } NDIS_802_11_NETWORK_TYPE
, *PNDIS_802_11_NETWORK_TYPE
;
103 typedef struct tagSERPObject
{
106 } ERPObject
, DEF
* PERPObject
;
109 typedef struct tagSRSNCapObject
{
112 } SRSNCapObject
, DEF
* PSRSNCapObject
;
116 typedef struct tagKnownBSS
{
119 BYTE abyBSSID
[WLAN_BSSID_LEN
];
121 BYTE abySuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
+ 1];
122 BYTE abyExtSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
+ 1];
125 WORD wBeaconInterval
;
127 BYTE abySSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
132 LONG ldBmAverage
[RSSI_STAT_COUNT
];
134 //For any BSSID selection improvment
137 //++ WPA informations
144 BYTE byDefaultK_as_PK
;
148 //++ WPA2 informations
153 WORD wAKMSSAuthCount
;
154 BYTE abyAKMSSAuthType
[4];
157 BYTE byWPAIE
[MAX_WPA_IE_LEN
];
158 BYTE byRSNIE
[MAX_WPA_IE_LEN
];
164 // BYTE abyIEs[WLAN_BEACON_FR_MAXLEN];
166 QWORD qwBSSTimestamp
;
167 QWORD qwLocalTSF
; // local TSF timer
169 // NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
170 CARD_PHY_TYPE eNetworkTypeInUse
;
173 SRSNCapObject sRSNCapObj
;
174 BYTE abyIEs
[1024]; // don't move this field !!
176 }__attribute__ ((__packed__
))
177 KnownBSS
, DEF
* PKnownBSS
;
179 //2006-1116-01,<Add> by NomadZhao
182 typedef enum tagNODE_STATE
{
188 } NODE_STATE
, *PNODE_STATE
;
192 typedef struct tagKnownNodeDB
{
195 BYTE abyMACAddr
[WLAN_ADDR_LEN
];
196 BYTE abyCurrSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
];
197 BYTE abyCurrExtSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
];
203 WORD wMaxBasicRate
; //Get from byTopOFDMBasicRate or byTopCCKBasicRate which depends on packetTyp.
204 WORD wMaxSuppRate
; //Records the highest supported rate getting from SuppRates IE and ExtSuppRates IE in Beacon.
206 BYTE byTopOFDMBasicRate
;//Records the highest basic rate in OFDM mode
207 BYTE byTopCCKBasicRate
; //Records the highest basic rate in CCK mode
210 struct sk_buff_head sTxPSQueue
;
212 WORD wListenInterval
;
214 NODE_STATE eNodeState
;
218 ULONG ulLastRxJiffer
;
231 BYTE abyWepKey
[WLAN_WEPMAX_KEYLEN
];
233 // Auto rate fallback vars
236 UINT uRateRecoveryTimeout
;
237 UINT uRatePollTimeout
;
244 UINT uTxOk
[MAX_RATE
+1];
245 UINT uTxFail
[MAX_RATE
+1];
248 } KnownNodeDB
, DEF
* PKnownNodeDB
;
251 /*--------------------- Export Functions --------------------------*/
257 IN HANDLE hDeviceContext
,
258 IN PBYTE pbyDesireBSSID
,
259 IN PBYTE pbyDesireSSID
,
260 IN CARD_PHY_TYPE ePhyType
265 IN HANDLE hDeviceContext
,
267 IN PWLAN_IE_SSID pSSID
272 IN HANDLE hDeviceContext
,
273 IN BOOL bKeepCurrBSSID
278 IN HANDLE hDeviceContext
,
279 IN PBYTE abyBSSIDAddr
,
280 IN QWORD qwTimestamp
,
281 IN WORD wBeaconInterval
,
283 IN BYTE byCurrChannel
,
284 IN PWLAN_IE_SSID pSSID
,
285 IN PWLAN_IE_SUPP_RATES pSuppRates
,
286 IN PWLAN_IE_SUPP_RATES pExtSuppRates
,
288 IN PWLAN_IE_RSN pRSN
,
289 IN PWLAN_IE_RSN_EXT pRSNWPA
,
290 IN PWLAN_IE_COUNTRY pIE_Country
,
291 IN PWLAN_IE_QUIET pIE_Quiet
,
294 IN HANDLE pRxPacketContext
300 IN HANDLE hDeviceContext
,
301 IN QWORD qwTimestamp
,
302 IN WORD wBeaconInterval
,
304 IN BYTE byCurrChannel
,
306 IN PWLAN_IE_SSID pSSID
,
307 IN PWLAN_IE_SUPP_RATES pSuppRates
,
308 IN PWLAN_IE_SUPP_RATES pExtSuppRates
,
310 IN PWLAN_IE_RSN pRSN
,
311 IN PWLAN_IE_RSN_EXT pRSNWPA
,
312 IN PWLAN_IE_COUNTRY pIE_Country
,
313 IN PWLAN_IE_QUIET pIE_Quiet
,
314 IN PKnownBSS pBSSList
,
317 IN HANDLE pRxPacketContext
323 IN HANDLE hDeviceContext
,
325 OUT PUINT puNodeIndex
330 IN HANDLE hDeviceContext
,
331 OUT PUINT puNodeIndex
336 IN HANDLE hDeviceContext
,
338 IN PWLAN_IE_SUPP_RATES pItemRates
,
339 IN PWLAN_IE_SUPP_RATES pExtSuppRates
345 IN HANDLE hDeviceContext
349 BSSvUpdateNodeTxCounter(
350 IN HANDLE hDeviceContext
,
354 IN UINT uFIFOHeaderSize
359 IN HANDLE hDeviceContext
,
364 BSSvAddMulticastNode(
365 IN HANDLE hDeviceContext
370 BSSvClearNodeDBTable(
371 IN HANDLE hDeviceContext
,
376 BSSvClearAnyBSSJoinRecord(
377 IN HANDLE hDeviceContext