Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
wmgr.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3  * All rights reserved.
4  *
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.
9  *
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.
14  *
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.
18  *
19  *
20  * File: wmgr.h
21  *
22  * Purpose:
23  *
24  * Author: lyndon chen
25  *
26  * Date: Jan 2, 2003
27  *
28  * Functions:
29  *
30  * Revision History:
31  *
32  */
33 
34 #ifndef __WMGR_H__
35 #define __WMGR_H__
36 
37 #include "ttype.h"
38 #include "80211mgr.h"
39 #include "80211hdr.h"
40 #include "wcmd.h"
41 #include "bssdb.h"
42 #include "wpa2.h"
43 #include "vntwifi.h"
44 #include "card.h"
45 
46 /*--------------------- Export Definitions -------------------------*/
47 
48 
49 
50 // Scan time
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)
57 
58 #define WCMD_ACTIVE_SCAN_TIME 50 //(ms)
59 #define WCMD_PASSIVE_SCAN_TIME 100 //(ms)
60 
61 
62 #define DEFAULT_MSDU_LIFETIME 512 // ms
63 #define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us
64 
65 #define DEFAULT_MGN_LIFETIME 8 // ms
66 #define DEFAULT_MGN_LIFETIME_RES_64us 125 // 64us
67 
68 #define MAKE_BEACON_RESERVED 10 //(us)
69 
70 
71 #define TIM_MULTICAST_MASK 0x01
72 #define TIM_BITMAPOFFSET_MASK 0xFE
73 #define DEFAULT_DTIM_PERIOD 1
74 
75 #define AP_LONG_RETRY_LIMIT 4
76 
77 #define DEFAULT_IBSS_CHANNEL 6 //2.4G
78 
79 
80 /*--------------------- Export Classes ----------------------------*/
81 
82 /*--------------------- Export Variables --------------------------*/
83 
84 /*--------------------- Export Types ------------------------------*/
85 #define timer_expire(timer,next_tick) mod_timer(&timer, RUN_AT(next_tick))
86 typedef void (*TimerFunction)(unsigned long);
87 
88 
89 //+++ NDIS related
90 
91 typedef unsigned char NDIS_802_11_MAC_ADDRESS[6];
92 typedef struct _NDIS_802_11_AI_REQFI
93 {
94  unsigned short Capabilities;
95  unsigned short ListenInterval;
98 
99 typedef struct _NDIS_802_11_AI_RESFI
100 {
101  unsigned short Capabilities;
102  unsigned short StatusCode;
103  unsigned short AssociationId;
105 
107 {
108  unsigned long Length;
109  unsigned short AvailableRequestFixedIEs;
111  unsigned long RequestIELength;
112  unsigned long OffsetRequestIEs;
115  unsigned long ResponseIELength;
116  unsigned long OffsetResponseIEs;
118 
119 
120 
121 typedef struct tagSAssocInfo {
124  // store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION
125  unsigned long RequestIELength;
128 //---
129 
130 
131 /*
132 typedef enum tagWMAC_AUTHENTICATION_MODE {
133 
134 
135  WMAC_AUTH_OPEN,
136  WMAC_AUTH_SHAREKEY,
137  WMAC_AUTH_AUTO,
138  WMAC_AUTH_WPA,
139  WMAC_AUTH_WPAPSK,
140  WMAC_AUTH_WPANONE,
141  WMAC_AUTH_WPA2,
142  WMAC_AUTH_WPA2PSK,
143  WMAC_AUTH_MAX // Not a real mode, defined as upper bound
144 
145 
146 } WMAC_AUTHENTICATION_MODE, *PWMAC_AUTHENTICATION_MODE;
147 */
148 
149 
150 // Pre-configured Mode (from XP)
151 /*
152 typedef enum tagWMAC_CONFIG_MODE {
153  WMAC_CONFIG_ESS_STA,
154  WMAC_CONFIG_IBSS_STA,
155  WMAC_CONFIG_AUTO,
156  WMAC_CONFIG_AP
157 
158 } WMAC_CONFIG_MODE, *PWMAC_CONFIG_MODE;
159 */
160 
161 typedef enum tagWMAC_SCAN_TYPE {
162 
166 
168 
169 
170 typedef enum tagWMAC_SCAN_STATE {
171 
175 
177 
178 
179 
180 // Notes:
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)
189 
190 typedef enum tagWMAC_BSS_STATE {
191 
199 
201 
202 // WMAC selected running mode
203 typedef enum tagWMAC_CURRENT_MODE {
204 
209 
211 
212 /*
213 typedef enum tagWMAC_POWER_MODE {
214 
215  WMAC_POWER_CAM,
216  WMAC_POWER_FAST,
217  WMAC_POWER_MAX
218 
219 } WMAC_POWER_MODE, *PWMAC_POWER_MODE;
220 */
221 
222 
223 // Tx Management Packet descriptor
224 typedef struct tagSTxMgmtPacket {
225 
227  unsigned int cbMPDULen;
228  unsigned int cbPayloadLen;
229 
231 
232 
233 // Rx Management Packet descriptor
234 typedef struct tagSRxMgmtPacket {
235 
238  unsigned int cbMPDULen;
239  unsigned int cbPayloadLen;
240  unsigned int uRSSI;
241  unsigned char bySQ;
242  unsigned char byRxRate;
243  unsigned char byRxChannel;
244 
246 
247 
248 
249 typedef struct tagSMgmtObject
250 {
251 
252  void * pAdapter;
253  // MAC address
254  unsigned char abyMACAddr[WLAN_ADDR_LEN];
255 
256  // Configuration Mode
257  WMAC_CONFIG_MODE eConfigMode; // MAC pre-configed mode
260 
261 
262  // Operation state variables
263  WMAC_CURRENT_MODE eCurrMode; // MAC current connection mode
264  WMAC_BSS_STATE eCurrState; // MAC current BSS state
265 
267  unsigned char byCSSGK;
268  unsigned char byCSSPK;
269 
270 // unsigned char abyNewSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
271 // unsigned char abyNewExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
272 
273  // Current state vars
274  unsigned int uCurrChannel;
278  unsigned char abyCurrBSSID[WLAN_BSSID_LEN];
279  unsigned short wCurrCapInfo;
280  unsigned short wCurrAID;
281  unsigned short wCurrATIMWindow;
282  unsigned short wCurrBeaconPeriod;
283  bool bIsDS;
284  unsigned char byERPContext;
285 
287  unsigned int uScanChannel;
288 
289  // Desire joining BSS vars
292 
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;
299  unsigned char byAPBBType;
300  unsigned char abyWPAIE[MAX_WPA_IE_LEN];
301  unsigned short wWPAIELen;
302 
303  unsigned int uAssocCount;
304  bool bMoreData;
305 
306  // Scan state vars
309  unsigned int uScanStartCh;
310  unsigned int uScanEndCh;
311  unsigned short wScanSteps;
312  unsigned int uScanBSSType;
313  // Desire scanning vars
315  unsigned char abyScanBSSID[WLAN_BSSID_LEN];
316 
317  // Privacy
323 
324  // Received beacon state vars
325  bool bInTIM;
327  unsigned char byDTIMCount;
328  unsigned char byDTIMPeriod;
329 
330  // Power saving state vars
332  unsigned short wListenInterval;
333  unsigned short wCountToWakeUp;
335  unsigned char *pbyPSPacketPool;
338  unsigned char abyPSTxMap[MAX_NODE_NUM + 1];
339 
340  // management command related
341  unsigned int uCmdBusy;
342  unsigned int uCmdHostAPBusy;
343 
344  // management packet pool
345  unsigned char *pbyMgmtPacketPool;
347 
348 
349  // One second callback timer
351 
352  // Temporarily Rx Mgmt Packet Descriptor
354 
355  // link list of known bss's (scan results)
357 
358 
359 
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
364 
365 
366 
367  // WPA2 PMKID Cache
369  bool bRoaming;
370 
371  // rate fall back vars
372 
373 
374 
375  // associate info
377 
378 
379  // for 802.11h
382  unsigned char byNewChannel;
384  unsigned int uLengthOfRepEIDs;
388  unsigned char abyIBSSDFSOwner[6];
389  unsigned char byIBSSDFSRecovery;
390 
391  struct sk_buff skb;
392 
394 
395 
396 /*--------------------- Export Macros ------------------------------*/
397 
398 
399 /*--------------------- Export Functions --------------------------*/
400 
401 
402 void
404  void *hDeviceContext
405  );
406 
407 void
409  void *hDeviceContext
410  );
411 
412 void
414  void *hDeviceContext
415  );
416 
417 void
419  void *hDeviceContext,
420  PSMgmtObject pMgmt,
421  PCMD_STATUS pStatus
422  );
423 
424 void
426  void *hDeviceContext,
427  PSMgmtObject pMgmt,
428  PCMD_STATUS pStatus
429  );
430 
431 void
433  void *hDeviceContext,
434  PSMgmtObject pMgmt,
435  unsigned char *abyDestAddress,
436  unsigned short wReason,
437  PCMD_STATUS pStatus
438  );
439 
440 void
442  void *hDeviceContext,
443  PSMgmtObject pMgmt,
444  PCMD_STATUS pStatus
445  );
446 
447 void
449  void *hDeviceContext,
450  PCMD_STATUS pStatus
451  );
452 
453 void
455  void *hDeviceContext,
456  PCMD_STATUS pStatus
457  );
458 
459 void
461  void *hDeviceContext,
462  PSMgmtObject pMgmt,
463  PSRxMgmtPacket pRxPacket
464  );
465 
466 /*
467 void
468 vMgrScanBegin(
469  void *hDeviceContext,
470  PCMD_STATUS pStatus
471  );
472 */
473 
474 void
476  void *hDeviceContext,
477  PSMgmtObject pMgmt,
478  unsigned char *abyDestAddress,
479  unsigned short wReason,
480  PCMD_STATUS pStatus
481  );
482 
483 bool
485  void *hDeviceContext,
486  PSMgmtObject pMgmt
487  );
488 
489 
490 bool
492  void *hDeviceContext,
493  unsigned char *pbyBSSID,
494  PSRSNCapObject psRSNCapObj
495  );
496 
497 void
499  void *hDeviceContext
500  );
501 
502 #endif // __WMGR_H__