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 #define PROBE_DELAY 100 // (us)
46 #define SWITCH_CHANNEL_DELAY 200 // (us)
47 #define WLAN_SCAN_MINITIME 25 // (ms)
48 #define WLAN_SCAN_MAXTIME 100 // (ms)
49 #define TRIVIAL_SYNC_DIFFERENCE 0 // (us)
50 #define DEFAULT_IBSS_BI 100 // (ms)
52 #define WCMD_ACTIVE_SCAN_TIME 20 //(ms)
53 #define WCMD_PASSIVE_SCAN_TIME 100 //(ms)
55 #define DEFAULT_MSDU_LIFETIME 512 // ms
56 #define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us
58 #define DEFAULT_MGN_LIFETIME 8 // ms
59 #define DEFAULT_MGN_LIFETIME_RES_64us 125 // 64us
61 #define MAKE_BEACON_RESERVED 10 //(us)
63 #define TIM_MULTICAST_MASK 0x01
64 #define TIM_BITMAPOFFSET_MASK 0xFE
65 #define DEFAULT_DTIM_PERIOD 1
67 #define AP_LONG_RETRY_LIMIT 4
69 #define DEFAULT_IBSS_CHANNEL 6 //2.4G
71 //mike define: make timer to expire after desired times
72 #define timer_expire(timer, next_tick) mod_timer(&timer, RUN_AT(next_tick))
74 typedef void (*TimerFunction
)(unsigned long);
78 typedef u8 NDIS_802_11_MAC_ADDRESS
[ETH_ALEN
];
79 typedef struct _NDIS_802_11_AI_REQFI
83 NDIS_802_11_MAC_ADDRESS CurrentAPAddress
;
84 } NDIS_802_11_AI_REQFI
, *PNDIS_802_11_AI_REQFI
;
86 typedef struct _NDIS_802_11_AI_RESFI
91 } NDIS_802_11_AI_RESFI
, *PNDIS_802_11_AI_RESFI
;
93 typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
96 u16 AvailableRequestFixedIEs
;
97 NDIS_802_11_AI_REQFI RequestFixedIEs
;
100 u16 AvailableResponseFixedIEs
;
101 NDIS_802_11_AI_RESFI ResponseFixedIEs
;
102 u32 ResponseIELength
;
103 u32 OffsetResponseIEs
;
104 } NDIS_802_11_ASSOCIATION_INFORMATION
, *PNDIS_802_11_ASSOCIATION_INFORMATION
;
106 typedef struct tagSAssocInfo
{
107 NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo
;
108 u8 abyIEs
[WLAN_BEACON_FR_MAXLEN
+WLAN_BEACON_FR_MAXLEN
];
109 /* store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION */
111 u8 abyReqIEs
[WLAN_BEACON_FR_MAXLEN
];
112 } SAssocInfo
, *PSAssocInfo
;
114 typedef enum tagWMAC_AUTHENTICATION_MODE
{
124 WMAC_AUTH_MAX
// Not a real mode, defined as upper bound
125 } WMAC_AUTHENTICATION_MODE
, *PWMAC_AUTHENTICATION_MODE
;
127 // Pre-configured Mode (from XP)
129 typedef enum tagWMAC_CONFIG_MODE
{
131 WMAC_CONFIG_IBSS_STA
,
135 } WMAC_CONFIG_MODE
, *PWMAC_CONFIG_MODE
;
137 typedef enum tagWMAC_SCAN_TYPE
{
143 } WMAC_SCAN_TYPE
, *PWMAC_SCAN_TYPE
;
145 typedef enum tagWMAC_SCAN_STATE
{
151 } WMAC_SCAN_STATE
, *PWMAC_SCAN_STATE
;
154 // Basic Service Set state explained as following:
155 // WMAC_STATE_IDLE : no BSS is selected (Adhoc or Infra)
156 // WMAC_STATE_STARTED : no BSS is selected, start own IBSS (Adhoc only)
157 // WMAC_STATE_JOINTED : BSS is selected and synchronized (Adhoc or Infra)
158 // WMAC_STATE_AUTHPENDING : Authentication pending (Infra)
159 // WMAC_STATE_AUTH : Authenticated (Infra)
160 // WMAC_STATE_ASSOCPENDING : Association pending (Infra)
161 // WMAC_STATE_ASSOC : Associated (Infra)
163 typedef enum tagWMAC_BSS_STATE
{
168 WMAC_STATE_AUTHPENDING
,
170 WMAC_STATE_ASSOCPENDING
,
173 } WMAC_BSS_STATE
, *PWMAC_BSS_STATE
;
175 // WMAC selected running mode
176 typedef enum tagWMAC_CURRENT_MODE
{
183 } WMAC_CURRENT_MODE
, *PWMAC_CURRENT_MODE
;
185 typedef enum tagWMAC_POWER_MODE
{
191 } WMAC_POWER_MODE
, *PWMAC_POWER_MODE
;
193 /* Tx Management Packet descriptor */
195 PUWLAN_80211HDR p80211Header
;
200 /* Rx Management Packet descriptor */
202 PUWLAN_80211HDR p80211Header
;
216 u8 abyMACAddr
[WLAN_ADDR_LEN
];
218 /* Configuration Mode */
219 WMAC_CONFIG_MODE eConfigMode
; /* MAC pre-configed mode */
221 CARD_PHY_TYPE eCurrentPHYMode
;
223 /* Operation state variables */
224 WMAC_CURRENT_MODE eCurrMode
; /* MAC current connection mode */
225 WMAC_BSS_STATE eCurrState
; /* MAC current BSS state */
226 WMAC_BSS_STATE eLastState
; /* MAC last BSS state */
232 int bCurrBSSIDFilterOn
;
234 /* Current state vars */
236 u8 abyCurrSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
+ 1];
237 u8 abyCurrExtSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
+ 1];
238 u8 abyCurrSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
239 u8 abyCurrBSSID
[WLAN_BSSID_LEN
];
244 u16 wCurrBeaconPeriod
;
248 CMD_STATE eCommandState
;
251 /* Desire joinning BSS vars */
252 u8 abyDesireSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
253 u8 abyDesireBSSID
[WLAN_BSSID_LEN
];
255 /*restore BSS info for Ad-Hoc mode */
256 u8 abyAdHocSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
258 /* Adhoc or AP configuration vars */
259 u16 wIBSSBeaconPeriod
;
262 u8 abyIBSSSuppRates
[WLAN_IEHDR_LEN
+ WLAN_RATES_MAXLEN
+ 1];
264 u8 abyWPAIE
[MAX_WPA_IE_LEN
];
270 /* Scan state vars */
271 WMAC_SCAN_STATE eScanState
;
272 WMAC_SCAN_TYPE eScanType
;
277 /* Desire scannig vars */
278 u8 abyScanSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
279 u8 abyScanBSSID
[WLAN_BSSID_LEN
];
282 WMAC_AUTHENTICATION_MODE eAuthenMode
;
283 int bShareKeyAlgorithm
;
284 u8 abyChallenge
[WLAN_CHALLENGE_LEN
];
287 /* Received beacon state vars */
293 /* Power saving state vars */
294 WMAC_POWER_MODE ePSMode
;
299 u8 byPSPacketPool
[sizeof(struct vnt_tx_mgmt
)
300 + WLAN_NULLDATA_FR_MAXLEN
];
301 int bRxBeaconInTBTTWake
;
302 u8 abyPSTxMap
[MAX_NODE_NUM
+ 1];
304 /* management command related */
308 /* management packet pool */
309 u8
*pbyMgmtPacketPool
;
310 u8 byMgmtPacketPool
[sizeof(struct vnt_tx_mgmt
)
313 /* Temporarily Rx Mgmt Packet Descriptor */
314 struct vnt_rx_mgmt sRxPacket
;
316 /* link list of known bss's (scan results) */
317 KnownBSS sBSSList
[MAX_BSS_NUM
];
318 /* link list of same bss's */
319 KnownBSS pSameBSS
[6];
323 /* table list of known node */
324 /* sNodeDBList[0] is reserved for AP under Infra mode */
325 /* sNodeDBList[0] is reserved for Multicast under adhoc/AP mode */
326 KnownNodeDB sNodeDBTable
[MAX_NODE_NUM
+ 1];
328 /* WPA2 PMKID Cache */
329 SPMKIDCache gsPMKIDCache
;
333 SAssocInfo sAssocInfo
;
339 PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep
;
340 u32 uLengthOfRepEIDs
;
341 u8 abyCurrentMSRReq
[sizeof(struct vnt_tx_mgmt
)
343 u8 abyCurrentMSRRep
[sizeof(struct vnt_tx_mgmt
)
345 u8 abyIECountry
[WLAN_A3FR_MAXLEN
];
346 u8 abyIBSSDFSOwner
[6];
347 u8 byIBSSDFSRecovery
;
353 void vMgrObjectInit(struct vnt_private
*pDevice
);
355 void vMgrAssocBeginSta(struct vnt_private
*pDevice
,
356 struct vnt_manager
*, PCMD_STATUS pStatus
);
358 void vMgrReAssocBeginSta(struct vnt_private
*pDevice
,
359 struct vnt_manager
*, PCMD_STATUS pStatus
);
361 void vMgrDisassocBeginSta(struct vnt_private
*pDevice
,
362 struct vnt_manager
*, u8
*abyDestAddress
, u16 wReason
,
363 PCMD_STATUS pStatus
);
365 void vMgrAuthenBeginSta(struct vnt_private
*pDevice
,
366 struct vnt_manager
*, PCMD_STATUS pStatus
);
368 void vMgrCreateOwnIBSS(struct vnt_private
*pDevice
,
369 PCMD_STATUS pStatus
);
371 void vMgrJoinBSSBegin(struct vnt_private
*pDevice
,
372 PCMD_STATUS pStatus
);
374 void vMgrRxManagePacket(struct vnt_private
*pDevice
,
375 struct vnt_manager
*, struct vnt_rx_mgmt
*);
380 void *hDeviceContext,
385 void vMgrDeAuthenBeginSta(struct vnt_private
*pDevice
,
386 struct vnt_manager
*, u8
*abyDestAddress
, u16 wReason
,
387 PCMD_STATUS pStatus
);
389 int bMgrPrepareBeaconToSend(struct vnt_private
*pDevice
,
390 struct vnt_manager
*);
392 int bAdd_PMKID_Candidate(struct vnt_private
*pDevice
,
393 u8
*pbyBSSID
, PSRSNCapObject psRSNCapObj
);
395 void vFlush_PMKID_Candidate(struct vnt_private
*pDevice
);
397 #endif /* __WMGR_H__ */