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.
46 /*--------------------- Export Definitions -------------------------*/
51 #define PROBE_DELAY 100 // (us)
52 #define SWITCH_CHANNEL_DELAY 200 // (us)
53 #define WLAN_SCAN_MINITIME 25 // (ms)
54 #define WLAN_SCAN_MAXTIME 100 // (ms)
55 #define TRIVIAL_SYNC_DIFFERENCE 0 // (us)
56 #define DEFAULT_IBSS_BI 100 // (ms)
58 #define WCMD_ACTIVE_SCAN_TIME 50 //(ms)
59 #define WCMD_PASSIVE_SCAN_TIME 100 //(ms)
62 #define DEFAULT_MSDU_LIFETIME 512 // ms
63 #define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us
65 #define DEFAULT_MGN_LIFETIME 8 // ms
66 #define DEFAULT_MGN_LIFETIME_RES_64us 125 // 64us
68 #define MAKE_BEACON_RESERVED 10 //(us)
71 #define TIM_MULTICAST_MASK 0x01
72 #define TIM_BITMAPOFFSET_MASK 0xFE
73 #define DEFAULT_DTIM_PERIOD 1
75 #define AP_LONG_RETRY_LIMIT 4
77 #define DEFAULT_IBSS_CHANNEL 6 //2.4G
80 /*--------------------- Export Classes ----------------------------*/
82 /*--------------------- Export Variables --------------------------*/
84 /*--------------------- Export Types ------------------------------*/
85 #define timer_expire(timer,next_tick) mod_timer(&timer, RUN_AT(next_tick))
86 typedef void (*TimerFunction
)(unsigned long);
91 typedef unsigned char NDIS_802_11_MAC_ADDRESS
[6];
92 typedef struct _NDIS_802_11_AI_REQFI
94 unsigned short Capabilities
;
95 unsigned short ListenInterval
;
96 NDIS_802_11_MAC_ADDRESS CurrentAPAddress
;
97 } NDIS_802_11_AI_REQFI
, *PNDIS_802_11_AI_REQFI
;
99 typedef struct _NDIS_802_11_AI_RESFI
101 unsigned short Capabilities
;
102 unsigned short StatusCode
;
103 unsigned short AssociationId
;
104 } NDIS_802_11_AI_RESFI
, *PNDIS_802_11_AI_RESFI
;
106 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
108 unsigned long Length
;
109 unsigned short AvailableRequestFixedIEs
;
110 NDIS_802_11_AI_REQFI RequestFixedIEs
;
111 unsigned long RequestIELength
;
112 unsigned long OffsetRequestIEs
;
113 unsigned short AvailableResponseFixedIEs
;
114 NDIS_802_11_AI_RESFI ResponseFixedIEs
;
115 unsigned long ResponseIELength
;
116 unsigned long OffsetResponseIEs
;
117 } NDIS_802_11_ASSOCIATION_INFORMATION
, *PNDIS_802_11_ASSOCIATION_INFORMATION
;
121 typedef struct tagSAssocInfo
{
122 NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo
;
123 unsigned char abyIEs
[WLAN_BEACON_FR_MAXLEN
+WLAN_BEACON_FR_MAXLEN
];
124 // store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION
125 unsigned long RequestIELength
;
126 unsigned char abyReqIEs
[WLAN_BEACON_FR_MAXLEN
];
127 } SAssocInfo
, *PSAssocInfo
;
132 typedef enum tagWMAC_AUTHENTICATION_MODE {
143 WMAC_AUTH_MAX // Not a real mode, defined as upper bound
146 } WMAC_AUTHENTICATION_MODE, *PWMAC_AUTHENTICATION_MODE;
150 // Pre-configured Mode (from XP)
152 typedef enum tagWMAC_CONFIG_MODE {
154 WMAC_CONFIG_IBSS_STA,
158 } WMAC_CONFIG_MODE, *PWMAC_CONFIG_MODE;
161 typedef enum tagWMAC_SCAN_TYPE
{
167 } WMAC_SCAN_TYPE
, *PWMAC_SCAN_TYPE
;
170 typedef enum tagWMAC_SCAN_STATE
{
176 } WMAC_SCAN_STATE
, *PWMAC_SCAN_STATE
;
181 // Basic Service Set state explained as following:
182 // WMAC_STATE_IDLE : no BSS is selected (Adhoc or Infra)
183 // WMAC_STATE_STARTED : no BSS is selected, start own IBSS (Adhoc only)
184 // WMAC_STATE_JOINTED : BSS is selected and synchronized (Adhoc or Infra)
185 // WMAC_STATE_AUTHPENDING : Authentication pending (Infra)
186 // WMAC_STATE_AUTH : Authenticated (Infra)
187 // WMAC_STATE_ASSOCPENDING : Association pending (Infra)
188 // WMAC_STATE_ASSOC : Associated (Infra)
190 typedef enum tagWMAC_BSS_STATE
{
195 WMAC_STATE_AUTHPENDING
,
197 WMAC_STATE_ASSOCPENDING
,
200 } WMAC_BSS_STATE
, *PWMAC_BSS_STATE
;
202 // WMAC selected running mode
203 typedef enum tagWMAC_CURRENT_MODE
{
210 } WMAC_CURRENT_MODE
, *PWMAC_CURRENT_MODE
;
213 typedef enum tagWMAC_POWER_MODE {
219 } WMAC_POWER_MODE, *PWMAC_POWER_MODE;
223 // Tx Management Packet descriptor
224 typedef struct tagSTxMgmtPacket
{
226 PUWLAN_80211HDR p80211Header
;
227 unsigned int cbMPDULen
;
228 unsigned int cbPayloadLen
;
230 } STxMgmtPacket
, *PSTxMgmtPacket
;
233 // Rx Management Packet descriptor
234 typedef struct tagSRxMgmtPacket
{
236 PUWLAN_80211HDR p80211Header
;
238 unsigned int cbMPDULen
;
239 unsigned int cbPayloadLen
;
242 unsigned char byRxRate
;
243 unsigned char byRxChannel
;
245 } SRxMgmtPacket
, *PSRxMgmtPacket
;
249 typedef struct tagSMgmtObject
254 unsigned char abyMACAddr
[WLAN_ADDR_LEN
];
256 // Configuration Mode
257 WMAC_CONFIG_MODE eConfigMode
; // MAC pre-configed mode
258 CARD_PHY_TYPE eCurrentPHYMode
;
259 CARD_PHY_TYPE eConfigPHYMode
;
262 // Operation state variables
263 WMAC_CURRENT_MODE eCurrMode
; // MAC current connection mode
264 WMAC_BSS_STATE eCurrState
; // MAC current BSS state
267 unsigned char byCSSGK
;
268 unsigned char byCSSPK
;
270 // unsigned char abyNewSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
271 // unsigned char abyNewExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
273 // Current state vars
274 unsigned int uCurrChannel
;
275 unsigned char abyCurrSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
+ 1];
276 unsigned char abyCurrExtSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
+ 1];
277 unsigned char abyCurrSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
278 unsigned char abyCurrBSSID
[WLAN_BSSID_LEN
];
279 unsigned short wCurrCapInfo
;
280 unsigned short wCurrAID
;
281 unsigned short wCurrATIMWindow
;
282 unsigned short wCurrBeaconPeriod
;
284 unsigned char byERPContext
;
286 CMD_STATE eCommandState
;
287 unsigned int uScanChannel
;
289 // Desire joinning BSS vars
290 unsigned char abyDesireSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
291 unsigned char abyDesireBSSID
[WLAN_BSSID_LEN
];
293 // Adhoc or AP configuration vars
294 //unsigned char abyAdHocSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
295 unsigned short wIBSSBeaconPeriod
;
296 unsigned short wIBSSATIMWindow
;
297 unsigned int uIBSSChannel
;
298 unsigned char abyIBSSSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
+ 1];
299 unsigned char byAPBBType
;
300 unsigned char abyWPAIE
[MAX_WPA_IE_LEN
];
301 unsigned short wWPAIELen
;
303 unsigned int uAssocCount
;
307 WMAC_SCAN_STATE eScanState
;
308 WMAC_SCAN_TYPE eScanType
;
309 unsigned int uScanStartCh
;
310 unsigned int uScanEndCh
;
311 unsigned short wScanSteps
;
312 unsigned int uScanBSSType
;
313 // Desire scannig vars
314 unsigned char abyScanSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
315 unsigned char abyScanBSSID
[WLAN_BSSID_LEN
];
318 WMAC_AUTHENTICATION_MODE eAuthenMode
;
319 WMAC_ENCRYPTION_MODE eEncryptionMode
;
320 bool bShareKeyAlgorithm
;
321 unsigned char abyChallenge
[WLAN_CHALLENGE_LEN
];
322 bool bPrivacyInvoked
;
324 // Received beacon state vars
327 unsigned char byDTIMCount
;
328 unsigned char byDTIMPeriod
;
330 // Power saving state vars
331 WMAC_POWER_MODE ePSMode
;
332 unsigned short wListenInterval
;
333 unsigned short wCountToWakeUp
;
335 unsigned char *pbyPSPacketPool
;
336 unsigned char byPSPacketPool
[sizeof(STxMgmtPacket
) + WLAN_NULLDATA_FR_MAXLEN
];
337 bool bRxBeaconInTBTTWake
;
338 unsigned char abyPSTxMap
[MAX_NODE_NUM
+ 1];
340 // management command related
341 unsigned int uCmdBusy
;
342 unsigned int uCmdHostAPBusy
;
344 // management packet pool
345 unsigned char *pbyMgmtPacketPool
;
346 unsigned char byMgmtPacketPool
[sizeof(STxMgmtPacket
) + WLAN_A3FR_MAXLEN
];
349 // One second callback timer
350 struct timer_list sTimerSecondCallback
;
352 // Temporarily Rx Mgmt Packet Descriptor
353 SRxMgmtPacket sRxPacket
;
355 // link list of known bss's (scan results)
356 KnownBSS sBSSList
[MAX_BSS_NUM
];
360 // table list of known node
361 // sNodeDBList[0] is reserved for AP under Infra mode
362 // sNodeDBList[0] is reserved for Multicast under adhoc/AP mode
363 KnownNodeDB sNodeDBTable
[MAX_NODE_NUM
+ 1];
368 SPMKIDCache gsPMKIDCache
;
371 // rate fall back vars
376 SAssocInfo sAssocInfo
;
382 unsigned char byNewChannel
;
383 PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep
;
384 unsigned int uLengthOfRepEIDs
;
385 unsigned char abyCurrentMSRReq
[sizeof(STxMgmtPacket
) + WLAN_A3FR_MAXLEN
];
386 unsigned char abyCurrentMSRRep
[sizeof(STxMgmtPacket
) + WLAN_A3FR_MAXLEN
];
387 unsigned char abyIECountry
[WLAN_A3FR_MAXLEN
];
388 unsigned char abyIBSSDFSOwner
[6];
389 unsigned char byIBSSDFSRecovery
;
393 } SMgmtObject
, *PSMgmtObject
;
396 /*--------------------- Export Macros ------------------------------*/
399 /*--------------------- Export Functions --------------------------*/
419 void *hDeviceContext
,
426 void *hDeviceContext
,
432 vMgrDisassocBeginSta(
433 void *hDeviceContext
,
435 unsigned char *abyDestAddress
,
436 unsigned short wReason
,
442 void *hDeviceContext
,
449 void *hDeviceContext
,
455 void *hDeviceContext
,
461 void *hDeviceContext
,
463 PSRxMgmtPacket pRxPacket
469 void *hDeviceContext,
475 vMgrDeAuthenBeginSta(
476 void *hDeviceContext
,
478 unsigned char *abyDestAddress
,
479 unsigned short wReason
,
484 bMgrPrepareBeaconToSend(
485 void *hDeviceContext
,
491 bAdd_PMKID_Candidate (
492 void *hDeviceContext
,
493 unsigned char *pbyBSSID
,
494 PSRSNCapObject psRSNCapObj
498 vFlush_PMKID_Candidate (