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.
45 /*--------------------- Export Definitions -------------------------*/
50 #define PROBE_DELAY 100 // (us)
51 #define SWITCH_CHANNEL_DELAY 200 // (us)
52 #define WLAN_SCAN_MINITIME 25 // (ms)
53 #define WLAN_SCAN_MAXTIME 100 // (ms)
54 #define TRIVIAL_SYNC_DIFFERENCE 0 // (us)
55 #define DEFAULT_IBSS_BI 100 // (ms)
57 #define WCMD_ACTIVE_SCAN_TIME 20 //(ms)
58 #define WCMD_PASSIVE_SCAN_TIME 100 //(ms)
61 #define DEFAULT_MSDU_LIFETIME 512 // ms
62 #define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us
64 #define DEFAULT_MGN_LIFETIME 8 // ms
65 #define DEFAULT_MGN_LIFETIME_RES_64us 125 // 64us
67 #define MAKE_BEACON_RESERVED 10 //(us)
70 #define TIM_MULTICAST_MASK 0x01
71 #define TIM_BITMAPOFFSET_MASK 0xFE
72 #define DEFAULT_DTIM_PERIOD 1
74 #define AP_LONG_RETRY_LIMIT 4
76 #define DEFAULT_IBSS_CHANNEL 6 //2.4G
79 /*--------------------- Export Classes ----------------------------*/
81 /*--------------------- Export Variables --------------------------*/
83 /*--------------------- Export Types ------------------------------*/
84 //mike define: make timer to expire after desired times
85 #define timer_expire(timer, next_tick) mod_timer(&timer, RUN_AT(next_tick))
87 typedef void (*TimerFunction
)(unsigned long);
92 typedef unsigned char NDIS_802_11_MAC_ADDRESS
[ETH_ALEN
];
93 typedef struct _NDIS_802_11_AI_REQFI
95 unsigned short Capabilities
;
96 unsigned short ListenInterval
;
97 NDIS_802_11_MAC_ADDRESS CurrentAPAddress
;
98 } NDIS_802_11_AI_REQFI
, *PNDIS_802_11_AI_REQFI
;
100 typedef struct _NDIS_802_11_AI_RESFI
102 unsigned short Capabilities
;
103 unsigned short StatusCode
;
104 unsigned short AssociationId
;
105 } NDIS_802_11_AI_RESFI
, *PNDIS_802_11_AI_RESFI
;
107 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
109 unsigned long Length
;
110 unsigned short AvailableRequestFixedIEs
;
111 NDIS_802_11_AI_REQFI RequestFixedIEs
;
112 unsigned long RequestIELength
;
113 unsigned long OffsetRequestIEs
;
114 unsigned short AvailableResponseFixedIEs
;
115 NDIS_802_11_AI_RESFI ResponseFixedIEs
;
116 unsigned long ResponseIELength
;
117 unsigned long OffsetResponseIEs
;
118 } NDIS_802_11_ASSOCIATION_INFORMATION
, *PNDIS_802_11_ASSOCIATION_INFORMATION
;
122 typedef struct tagSAssocInfo
{
123 NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo
;
124 BYTE abyIEs
[WLAN_BEACON_FR_MAXLEN
+WLAN_BEACON_FR_MAXLEN
];
125 // store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION
126 unsigned long RequestIELength
;
127 BYTE abyReqIEs
[WLAN_BEACON_FR_MAXLEN
];
128 } SAssocInfo
, *PSAssocInfo
;
133 typedef enum tagWMAC_AUTHENTICATION_MODE
{
143 WMAC_AUTH_MAX
// Not a real mode, defined as upper bound
144 } WMAC_AUTHENTICATION_MODE
, *PWMAC_AUTHENTICATION_MODE
;
148 // Pre-configured Mode (from XP)
150 typedef enum tagWMAC_CONFIG_MODE
{
152 WMAC_CONFIG_IBSS_STA
,
156 } WMAC_CONFIG_MODE
, *PWMAC_CONFIG_MODE
;
159 typedef enum tagWMAC_SCAN_TYPE
{
165 } WMAC_SCAN_TYPE
, *PWMAC_SCAN_TYPE
;
168 typedef enum tagWMAC_SCAN_STATE
{
174 } WMAC_SCAN_STATE
, *PWMAC_SCAN_STATE
;
179 // Basic Service Set state explained as following:
180 // WMAC_STATE_IDLE : no BSS is selected (Adhoc or Infra)
181 // WMAC_STATE_STARTED : no BSS is selected, start own IBSS (Adhoc only)
182 // WMAC_STATE_JOINTED : BSS is selected and synchronized (Adhoc or Infra)
183 // WMAC_STATE_AUTHPENDING : Authentication pending (Infra)
184 // WMAC_STATE_AUTH : Authenticated (Infra)
185 // WMAC_STATE_ASSOCPENDING : Association pending (Infra)
186 // WMAC_STATE_ASSOC : Associated (Infra)
188 typedef enum tagWMAC_BSS_STATE
{
193 WMAC_STATE_AUTHPENDING
,
195 WMAC_STATE_ASSOCPENDING
,
198 } WMAC_BSS_STATE
, *PWMAC_BSS_STATE
;
200 // WMAC selected running mode
201 typedef enum tagWMAC_CURRENT_MODE
{
208 } WMAC_CURRENT_MODE
, *PWMAC_CURRENT_MODE
;
211 typedef enum tagWMAC_POWER_MODE
{
217 } WMAC_POWER_MODE
, *PWMAC_POWER_MODE
;
221 // Tx Managment Packet descriptor
222 typedef struct tagSTxMgmtPacket
{
224 PUWLAN_80211HDR p80211Header
;
225 unsigned int cbMPDULen
;
226 unsigned int cbPayloadLen
;
228 } STxMgmtPacket
, *PSTxMgmtPacket
;
231 // Rx Managment Packet descriptor
232 typedef struct tagSRxMgmtPacket
{
234 PUWLAN_80211HDR p80211Header
;
236 unsigned int cbMPDULen
;
237 unsigned int cbPayloadLen
;
243 } SRxMgmtPacket
, *PSRxMgmtPacket
;
247 typedef struct tagSMgmtObject
251 BYTE abyMACAddr
[WLAN_ADDR_LEN
];
253 // Configuration Mode
254 WMAC_CONFIG_MODE eConfigMode
; // MAC pre-configed mode
256 CARD_PHY_TYPE eCurrentPHYMode
;
259 // Operation state variables
260 WMAC_CURRENT_MODE eCurrMode
; // MAC current connection mode
261 WMAC_BSS_STATE eCurrState
; // MAC current BSS state
262 WMAC_BSS_STATE eLastState
; // MAC last BSS state
268 // BYTE abyNewSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
269 // BYTE abyNewExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
270 BOOL bCurrBSSIDFilterOn
;
272 // Current state vars
273 unsigned int uCurrChannel
;
274 BYTE abyCurrSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
+ 1];
275 BYTE abyCurrExtSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
+ 1];
276 BYTE abyCurrSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
277 BYTE abyCurrBSSID
[WLAN_BSSID_LEN
];
280 unsigned int uRSSITrigger
;
281 WORD wCurrATIMWindow
;
282 WORD wCurrBeaconPeriod
;
286 CMD_STATE eCommandState
;
287 unsigned int uScanChannel
;
289 // Desire joinning BSS vars
290 BYTE abyDesireSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
291 BYTE abyDesireBSSID
[WLAN_BSSID_LEN
];
293 //restore BSS info for Ad-Hoc mode
294 BYTE abyAdHocSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
296 // Adhoc or AP configuration vars
297 WORD wIBSSBeaconPeriod
;
298 WORD wIBSSATIMWindow
;
299 unsigned int uIBSSChannel
;
300 BYTE abyIBSSSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
+ 1];
302 BYTE abyWPAIE
[MAX_WPA_IE_LEN
];
305 unsigned int uAssocCount
;
309 WMAC_SCAN_STATE eScanState
;
310 WMAC_SCAN_TYPE eScanType
;
311 unsigned int uScanStartCh
;
312 unsigned int uScanEndCh
;
314 unsigned int uScanBSSType
;
315 // Desire scannig vars
316 BYTE abyScanSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
317 BYTE abyScanBSSID
[WLAN_BSSID_LEN
];
320 WMAC_AUTHENTICATION_MODE eAuthenMode
;
321 BOOL bShareKeyAlgorithm
;
322 BYTE abyChallenge
[WLAN_CHALLENGE_LEN
];
323 BOOL bPrivacyInvoked
;
325 // Received beacon state vars
331 // Power saving state vars
332 WMAC_POWER_MODE ePSMode
;
333 WORD wListenInterval
;
336 PBYTE pbyPSPacketPool
;
337 BYTE byPSPacketPool
[sizeof(STxMgmtPacket
) + WLAN_NULLDATA_FR_MAXLEN
];
338 BOOL bRxBeaconInTBTTWake
;
339 BYTE abyPSTxMap
[MAX_NODE_NUM
+ 1];
341 // management command related
342 unsigned int uCmdBusy
;
343 unsigned int uCmdHostAPBusy
;
345 // management packet pool
346 PBYTE pbyMgmtPacketPool
;
347 BYTE byMgmtPacketPool
[sizeof(STxMgmtPacket
) + WLAN_A3FR_MAXLEN
];
350 // One second callback timer
351 struct timer_list sTimerSecondCallback
;
353 // Temporarily Rx Mgmt Packet Descriptor
354 SRxMgmtPacket sRxPacket
;
356 // link list of known bss's (scan results)
357 KnownBSS sBSSList
[MAX_BSS_NUM
];
358 /* link list of same bss's */
359 KnownBSS pSameBSS
[6] ;
363 // table list of known node
364 // sNodeDBList[0] is reserved for AP under Infra mode
365 // sNodeDBList[0] is reserved for Multicast under adhoc/AP mode
366 KnownNodeDB sNodeDBTable
[MAX_NODE_NUM
+ 1];
371 SPMKIDCache gsPMKIDCache
;
374 // rate fall back vars
379 SAssocInfo sAssocInfo
;
386 PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep
;
387 unsigned int uLengthOfRepEIDs
;
388 BYTE abyCurrentMSRReq
[sizeof(STxMgmtPacket
) + WLAN_A3FR_MAXLEN
];
389 BYTE abyCurrentMSRRep
[sizeof(STxMgmtPacket
) + WLAN_A3FR_MAXLEN
];
390 BYTE abyIECountry
[WLAN_A3FR_MAXLEN
];
391 BYTE abyIBSSDFSOwner
[6];
392 BYTE byIBSSDFSRecovery
;
396 } SMgmtObject
, *PSMgmtObject
;
398 /*--------------------- Export Macros ------------------------------*/
400 /*--------------------- Export Functions --------------------------*/
402 void vMgrObjectInit(void *hDeviceContext
);
404 void vMgrAssocBeginSta(void *hDeviceContext
,
406 PCMD_STATUS pStatus
);
408 void vMgrReAssocBeginSta(void *hDeviceContext
,
410 PCMD_STATUS pStatus
);
412 void vMgrDisassocBeginSta(void *hDeviceContext
,
414 PBYTE abyDestAddress
,
416 PCMD_STATUS pStatus
);
418 void vMgrAuthenBeginSta(void *hDeviceContext
,
420 PCMD_STATUS pStatus
);
422 void vMgrCreateOwnIBSS(void *hDeviceContext
,
423 PCMD_STATUS pStatus
);
425 void vMgrJoinBSSBegin(void *hDeviceContext
,
426 PCMD_STATUS pStatus
);
428 void vMgrRxManagePacket(void *hDeviceContext
,
430 PSRxMgmtPacket pRxPacket
);
435 void *hDeviceContext,
440 void vMgrDeAuthenBeginSta(void *hDeviceContext
,
442 PBYTE abyDestAddress
,
444 PCMD_STATUS pStatus
);
446 BOOL
bMgrPrepareBeaconToSend(void *hDeviceContext
,
449 BOOL
bAdd_PMKID_Candidate(void *hDeviceContext
,
451 PSRSNCapObject psRSNCapObj
);
453 void vFlush_PMKID_Candidate(void *hDeviceContext
);
455 #endif /* __WMGR_H__ */