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.
38 #if !defined(__TTYPE_H__)
41 #if !defined(__80211MGR_H__)
44 #if !defined(__80211HDR_H__)
47 #if !defined(__WCMD_H__)
50 #if !defined(__BSSDB_H__)
53 #if !defined(__CARD_H__)
56 #if !defined(__WPA2_H__)
59 #if !defined(__VNTWIFI_H__)
65 /*--------------------- Export Definitions -------------------------*/
70 #define PROBE_DELAY 100 // (us)
71 #define SWITCH_CHANNEL_DELAY 200 // (us)
72 #define WLAN_SCAN_MINITIME 25 // (ms)
73 #define WLAN_SCAN_MAXTIME 100 // (ms)
74 #define TRIVIAL_SYNC_DIFFERENCE 0 // (us)
75 #define DEFAULT_IBSS_BI 100 // (ms)
77 #define WCMD_ACTIVE_SCAN_TIME 50 //(ms)
78 #define WCMD_PASSIVE_SCAN_TIME 100 //(ms)
81 #define DEFAULT_MSDU_LIFETIME 512 // ms
82 #define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us
84 #define DEFAULT_MGN_LIFETIME 8 // ms
85 #define DEFAULT_MGN_LIFETIME_RES_64us 125 // 64us
87 #define MAKE_BEACON_RESERVED 10 //(us)
90 #define TIM_MULTICAST_MASK 0x01
91 #define TIM_BITMAPOFFSET_MASK 0xFE
92 #define DEFAULT_DTIM_PERIOD 1
94 #define AP_LONG_RETRY_LIMIT 4
96 #define DEFAULT_IBSS_CHANNEL 6 //2.4G
99 /*--------------------- Export Classes ----------------------------*/
101 /*--------------------- Export Variables --------------------------*/
103 /*--------------------- Export Types ------------------------------*/
104 #define timer_expire(timer,next_tick) mod_timer(&timer, RUN_AT(next_tick))
105 typedef void (*TimerFunction)(ULONG);
110 typedef UCHAR NDIS_802_11_MAC_ADDRESS[6];
111 typedef struct _NDIS_802_11_AI_REQFI
114 USHORT ListenInterval;
115 NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
116 } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
118 typedef struct _NDIS_802_11_AI_RESFI
122 USHORT AssociationId;
123 } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
125 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
128 USHORT AvailableRequestFixedIEs;
129 NDIS_802_11_AI_REQFI RequestFixedIEs;
130 ULONG RequestIELength;
131 ULONG OffsetRequestIEs;
132 USHORT AvailableResponseFixedIEs;
133 NDIS_802_11_AI_RESFI ResponseFixedIEs;
134 ULONG ResponseIELength;
135 ULONG OffsetResponseIEs;
136 } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
140 typedef struct tagSAssocInfo {
141 NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
142 BYTE abyIEs[WLAN_BEACON_FR_MAXLEN+WLAN_BEACON_FR_MAXLEN];
143 // store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION
144 ULONG RequestIELength;
145 BYTE abyReqIEs[WLAN_BEACON_FR_MAXLEN];
146 } SAssocInfo, DEF* PSAssocInfo;
151 typedef enum tagWMAC_AUTHENTICATION_MODE {
162 WMAC_AUTH_MAX // Not a real mode, defined as upper bound
165 } WMAC_AUTHENTICATION_MODE, *PWMAC_AUTHENTICATION_MODE;
169 // Pre-configured Mode (from XP)
171 typedef enum tagWMAC_CONFIG_MODE {
173 WMAC_CONFIG_IBSS_STA,
177 } WMAC_CONFIG_MODE, *PWMAC_CONFIG_MODE;
180 typedef enum tagWMAC_SCAN_TYPE {
186 } WMAC_SCAN_TYPE, *PWMAC_SCAN_TYPE;
189 typedef enum tagWMAC_SCAN_STATE {
195 } WMAC_SCAN_STATE, *PWMAC_SCAN_STATE;
200 // Basic Service Set state explained as following:
201 // WMAC_STATE_IDLE : no BSS is selected (Adhoc or Infra)
202 // WMAC_STATE_STARTED : no BSS is selected, start own IBSS (Adhoc only)
203 // WMAC_STATE_JOINTED : BSS is selected and synchronized (Adhoc or Infra)
204 // WMAC_STATE_AUTHPENDING : Authentication pending (Infra)
205 // WMAC_STATE_AUTH : Authenticated (Infra)
206 // WMAC_STATE_ASSOCPENDING : Association pending (Infra)
207 // WMAC_STATE_ASSOC : Associated (Infra)
209 typedef enum tagWMAC_BSS_STATE {
214 WMAC_STATE_AUTHPENDING,
216 WMAC_STATE_ASSOCPENDING,
219 } WMAC_BSS_STATE, *PWMAC_BSS_STATE;
221 // WMAC selected running mode
222 typedef enum tagWMAC_CURRENT_MODE {
229 } WMAC_CURRENT_MODE, *PWMAC_CURRENT_MODE;
232 typedef enum tagWMAC_POWER_MODE {
238 } WMAC_POWER_MODE, *PWMAC_POWER_MODE;
242 // Tx Managment Packet descriptor
243 typedef struct tagSTxMgmtPacket {
245 PUWLAN_80211HDR p80211Header;
249 } STxMgmtPacket, DEF* PSTxMgmtPacket;
252 // Rx Managment Packet descriptor
253 typedef struct tagSRxMgmtPacket {
255 PUWLAN_80211HDR p80211Header;
264 } SRxMgmtPacket, DEF* PSRxMgmtPacket;
268 typedef struct tagSMgmtObject
273 BYTE abyMACAddr[WLAN_ADDR_LEN];
275 // Configuration Mode
276 WMAC_CONFIG_MODE eConfigMode; // MAC pre-configed mode
277 CARD_PHY_TYPE eCurrentPHYMode;
278 CARD_PHY_TYPE eConfigPHYMode;
281 // Operation state variables
282 WMAC_CURRENT_MODE eCurrMode; // MAC current connection mode
283 WMAC_BSS_STATE eCurrState; // MAC current BSS state
289 // BYTE abyNewSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
290 // BYTE abyNewExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
292 // Current state vars
294 BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
295 BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
296 BYTE abyCurrSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
297 BYTE abyCurrBSSID[WLAN_BSSID_LEN];
300 WORD wCurrATIMWindow;
301 WORD wCurrBeaconPeriod;
305 CMD_STATE eCommandState;
308 // Desire joinning BSS vars
309 BYTE abyDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
310 BYTE abyDesireBSSID[WLAN_BSSID_LEN];
312 // Adhoc or AP configuration vars
313 //BYTE abyAdHocSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
314 WORD wIBSSBeaconPeriod;
315 WORD wIBSSATIMWindow;
317 BYTE abyIBSSSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
319 BYTE abyWPAIE[MAX_WPA_IE_LEN];
326 WMAC_SCAN_STATE eScanState;
327 WMAC_SCAN_TYPE eScanType;
332 // Desire scannig vars
333 BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
334 BYTE abyScanBSSID[WLAN_BSSID_LEN];
337 WMAC_AUTHENTICATION_MODE eAuthenMode;
338 WMAC_ENCRYPTION_MODE eEncryptionMode;
339 BOOL bShareKeyAlgorithm;
340 BYTE abyChallenge[WLAN_CHALLENGE_LEN];
341 BOOL bPrivacyInvoked;
343 // Received beacon state vars
349 // Power saving state vars
350 WMAC_POWER_MODE ePSMode;
351 WORD wListenInterval;
354 PBYTE pbyPSPacketPool;
355 BYTE byPSPacketPool[sizeof(STxMgmtPacket) + WLAN_NULLDATA_FR_MAXLEN];
356 BOOL bRxBeaconInTBTTWake;
357 BYTE abyPSTxMap[MAX_NODE_NUM + 1];
359 // managment command related
363 // managment packet pool
364 PBYTE pbyMgmtPacketPool;
365 BYTE byMgmtPacketPool[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
368 // One second callback timer
369 struct timer_list sTimerSecondCallback;
371 // Temporarily Rx Mgmt Packet Descriptor
372 SRxMgmtPacket sRxPacket;
374 // link list of known bss's (scan results)
375 KnownBSS sBSSList[MAX_BSS_NUM];
379 // table list of known node
380 // sNodeDBList[0] is reserved for AP under Infra mode
381 // sNodeDBList[0] is reserved for Multicast under adhoc/AP mode
382 KnownNodeDB sNodeDBTable[MAX_NODE_NUM + 1];
387 SPMKIDCache gsPMKIDCache;
390 // rate fall back vars
395 SAssocInfo sAssocInfo;
402 PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep;
403 UINT uLengthOfRepEIDs;
404 BYTE abyCurrentMSRReq[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
405 BYTE abyCurrentMSRRep[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
406 BYTE abyIECountry[WLAN_A3FR_MAXLEN];
407 BYTE abyIBSSDFSOwner[6];
408 BYTE byIBSSDFSRecovery;
412 } SMgmtObject, DEF *PSMgmtObject;
415 /*--------------------- Export Macros ------------------------------*/
418 /*--------------------- Export Functions --------------------------*/
423 IN HANDLE hDeviceContext
428 IN HANDLE hDeviceContext
433 IN HANDLE hDeviceContext
438 IN HANDLE hDeviceContext,
439 IN PSMgmtObject pMgmt,
440 OUT PCMD_STATUS pStatus
445 IN HANDLE hDeviceContext,
446 IN PSMgmtObject pMgmt,
447 OUT PCMD_STATUS pStatus
451 vMgrDisassocBeginSta(
452 IN HANDLE hDeviceContext,
453 IN PSMgmtObject pMgmt,
454 IN PBYTE abyDestAddress,
456 OUT PCMD_STATUS pStatus
461 IN HANDLE hDeviceContext,
462 IN PSMgmtObject pMgmt,
463 OUT PCMD_STATUS pStatus
468 IN HANDLE hDeviceContext,
469 OUT PCMD_STATUS pStatus
474 IN HANDLE hDeviceContext,
475 OUT PCMD_STATUS pStatus
480 IN HANDLE hDeviceContext,
481 IN PSMgmtObject pMgmt,
482 IN PSRxMgmtPacket pRxPacket
488 IN HANDLE hDeviceContext,
489 OUT PCMD_STATUS pStatus
494 vMgrDeAuthenBeginSta(
495 IN HANDLE hDeviceContext,
496 IN PSMgmtObject pMgmt,
497 IN PBYTE abyDestAddress,
499 OUT PCMD_STATUS pStatus
503 bMgrPrepareBeaconToSend(
504 IN HANDLE hDeviceContext,
505 IN PSMgmtObject pMgmt
510 bAdd_PMKID_Candidate (
511 IN HANDLE hDeviceContext,
513 IN PSRSNCapObject psRSNCapObj
517 vFlush_PMKID_Candidate (
518 IN HANDLE hDeviceContext