http://downloads.netgear.com/files/GPL/GPL_Source_V361j_DM111PSP_series_consumer_rele...
[bcm963xx.git] / userapps / broadcom / cfm / inc / wldefs.h
1 /*
2 <:copyright-gpl
3  Copyright 2004 Broadcom Corp. All Rights Reserved.
4
5  This program is free software; you can distribute it and/or modify it
6  under the terms of the GNU General Public License (Version 2) as
7  published by the Free Software Foundation.
8
9  This program is distributed in the hope it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  for more details.
13
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 :>
18 */
19
20 /*****************************************************************************
21 //
22 //
23 ******************************************************************************
24 //
25 //  Filename:       wldefs.h
26 //  Author:         Peter T. Tran
27 //  Creation Date:  10/17/02
28 //
29 ******************************************************************************
30 //  Description:
31 //      Define the WlDefs functions.
32 //
33 *****************************************************************************/
34
35 #ifndef __WL_DEFS_H__
36 #define __WL_DEFS_H__
37
38 /********************** Include Files ***************************************/
39
40 #include <stdio.h>
41 #include <netinet/in.h>
42
43 /********************** Global Constants ************************************/
44
45 #define WL_NUM_SSID    2
46 #define WL_SIZE_2_MAX    2  
47 #define WL_SIZE_4_MAX    4  
48 #define WL_SIZE_8_MAX    8  
49 #define WL_SIZE_132_MAX  132
50 #define WL_SM_SIZE_MAX   16
51 #define WL_MID_SIZE_MAX  32
52 #define WL_SSID_SIZE_MAX 48
53 #define WL_MIN_PSK_LEN  8
54 #define WL_MAX_PSK_LEN  64
55 #define WL_WPA_PSK_SIZE_MAX  72  // max 64 hex or 63 char
56 #define WL_RADIUS_KEY_SIZE_MAX  88 // max is 80, limited by nas_wksp.h.  IAS allow up to 128 char
57 #define WL_LG_SIZE_MAX   1024
58 #define WL_KEY_NUM       4
59 #define WL_WDS_NUM       4
60 #define WL_MIN_FRAGMENTATION_THRESHOLD  256
61 #define WL_MAX_FRAGMENTATION_THRESHOLD  2346
62 #define WL_MIN_RTS_THRESHOLD            0
63 #define WL_MAX_RTS_THRESHOLD            2347
64 #define WL_MIN_DTIM                     1
65 #define WL_MAX_DTIM                     255
66 #define WL_MIN_BEACON_INTERVAL          1
67 #define WL_MAX_BEACON_INTERVAL          65535
68 #define WL_KEY64_SIZE_HEX               10
69 #define WL_KEY64_SIZE_CHAR              5
70 #define WL_KEY128_SIZE_HEX              26
71 #define WL_KEY128_SIZE_CHAR             13
72 #define WL_KEY64_SIZE_ASCII             5
73 #define WL_MAX_ASSOC_STA                128
74
75 #define WL_FLT_MAC_OFF   "disabled"
76 #define WL_FLT_MAC_ALLOW "allow"
77 #define WL_FLT_MAC_DENY  "deny"
78
79 #define WL_BRIDGE_RESTRICT_ENABLE      0
80 #define WL_BRIDGE_RESTRICT_DISABLE     1
81 #define WL_BRIDGE_RESTRICT_ENABLE_SCAN 2
82
83 /* authentication mode */
84 #define WL_AUTH_OPEN                    "open"
85 #define WL_AUTH_SHARED                  "shared"
86 #define WL_AUTH_RADIUS                  "radius"
87 #define WL_AUTH_WPA                     "wpa"
88 #define WL_AUTH_WPA_PSK                 "psk"
89 #define WL_AUTH_WPA2                    "wpa2"
90 #define WL_AUTH_WPA2_PSK                "psk2"
91 #define WL_AUTH_WPA2_MIX                "wpa2mix"
92 #define WL_AUTH_WPA2_PSK_MIX    "psk2mix"
93 #define WL_WPA_AUTH_DISABLED            0x0000  /* Legacy (i.e., non-WPA) */
94 #define WL_WPA_AUTH_NONE                        0x0001  /* none (IBSS) */
95 #define WL_WPA_AUTH_UNSPECIFIED         0x0002  /* over 802.1x */
96 #define WL_WPA_AUTH_PSK                         0x0004  /* Pre-shared key */
97 #define WL_WPA_AUTH_8021X                       0x0020  /* 802.1x, reserved */
98 #define WL_WPA2_AUTH_UNSPECIFIED        0x0040  /* over 802.1x */
99 #define WL_WPA2_AUTH_PSK                        0x0080  /* Pre-shared key */
100
101 /* wireless security bitvec */
102 #define WEP_ENABLED      1
103 #define TKIP_ENABLED     2
104 #define AES_ENABLED      4
105 #define WSEC_SWFLAG      8
106
107 #define TKIP_ONLY       "tkip"
108 #define AES_ONLY        "aes"
109 #define TKIP_AND_AES    "tkip+aes"
110
111
112 #define WPA_CAP_WPA2_PREAUTH            1
113
114 #define WL_BIT_KEY_128   0
115 #define WL_BIT_KEY_64    1
116
117 #define WL_PHY_TYPE_A    "a"
118 #define WL_PHY_TYPE_B    "b"
119 #define WL_PHY_TYPE_G    "g"
120 #define WL_PHY_TYPE_N    "n"
121
122 #define WL_BASIC_RATE_DEFAULT    "default"
123 #define WL_BASIC_RATE_ALL        "all"
124 #define WL_BASIC_RATE_1_2        "12"
125 #define WL_BASIC_RATE_WIFI_2     "wifi2"
126
127 #if 0 //swda remove,05/03/2005
128 #define WL_MODE_G_AUTO           1
129 #define WL_MODE_G_PERFORMANCE    4
130 #define WL_MODE_G_LRS            5
131 #define WL_MODE_B_ONLY           0
132 #else //swda add,05/03/2005
133 #define WL_MODE_G_AUTO           0
134 #define WL_MODE_G_PERFORMANCE    1
135 #define WL_MODE_G_LRS            2
136 #define WL_MODE_G_GONLY          3
137 #define WL_MODE_B_ONLY           4
138 #endif
139
140 #define WL_AUTO                  "auto"
141 #define WL_OFF                   "off"
142 #define WL_ON                    "on"
143 #define WL_DISABLED              "disabled"
144 #define WL_ENABLED               "enabled"
145
146 #define WL_WME_ON                               1 
147 #define WL_WME_OFF                              0
148
149 #define WL_PREAUTH_ON                   1
150 #define WL_PREAUTH_OFF                  0
151
152 #define BAND_A                   1
153 #define BAND_B                   2
154
155 #define WL_CHANSPEC_2G          2
156 #define WL_CHANSPEC_5G          5
157
158 #define WIRELESS_APPID          "WirelessCfg"
159 #define WL_VARS_ID              1
160 #define WL_MSSID_VARS_NUM_ID    2
161 #define WL_MSSID_VARS_TBL_ID    3
162 #define WL_FLT_MAC_NUM_ID       4
163 #define WL_FLT_MAC_TBL_ID       5
164 #define WL_WDS_MAC_NUM_ID       6
165 #define WL_WDS_MAC_TBL_ID       7
166 #define WL_SCAN_WDS_MAC_NUM_ID  8
167 #define WL_SCAN_WDS_MAC_TBL_ID  9
168
169 #define RESET_WLAN       "/var/reset.wlan"
170 #define RELOAD_VARS_WLAN "/var/reloadvars.wlan"
171
172 #define MAIN_BSS_IDX    0
173
174 #define MAP_FROM_NVRAM  0
175 #define MAP_TO_NVRAM    1
176 #define WL_SES_ENTRY    99
177 #define MAX_NVPARSE 100
178 #define SES_WDS_MODE_DISABLED           0 /* disabled */
179 #define SES_WDS_MODE_AUTO               1 /* dynamic cf/cl selection */
180 #define SES_WDS_MODE_ENABLED_ALWAYS     2 /* enabled always */
181 #define SES_WDS_MODE_ENABLED_EXCL       3 /* WDS-only i.e no regular STAs */
182 #define SES_WDS_MODE_CLIENT             4 /* always wds client mode */
183 #define REG_MODE_OFF                    0 /* disabled 11h/d mode */
184 #define REG_MODE_H                      1 /* use 11h mode */
185 #define REG_MODE_D                      2 /* use 11d mode */
186
187 #define WL_OPMODE_AP                    "ap" 
188 #define WL_OPMODE_WDS                   "wds" 
189 #define WL_PREAMBLE_LONG                "long"
190 #define WL_PREAMBLE_SHORT               "short"
191
192 // TR69 overrides
193 #define WL_TR69_BEACONTYPE_NONE                             0
194 #define WL_TR69_BEACONTYPE_BASIC                            1
195 #define WL_TR69_BEACONTYPE_WPA                              2
196 #define WL_TR69_BEACONTYPE_11I                              3
197 #define WL_TR69_BEACONTYPE_BASIC_AND_WPA                    4
198 #define WL_TR69_BEACONTYPE_BASIC_AND_11I                    5
199 #define WL_TR69_BEACONTYPE_WPA_AND_11I                      6
200 #define WL_TR69_BEACONTYPE_BASIC_AND_WPA_AND_11I            7
201
202 #define WL_TR69_BASIC_ENCRYPTIONMODE_NONE                   0
203 #define WL_TR69_BASIC_ENCRYPTIONMODE_WEP                    1
204
205 #define WL_TR69_BASIC_AUTHENTICATION_NONE                   0
206 #define WL_TR69_BASIC_AUTHENTICATION_EAP                    1
207
208 #define WL_TR69_WPA_ENCRYPTION_MODES_WEP                    0
209 #define WL_TR69_WPA_ENCRYPTION_MODES_TKIP                   1
210 #define WL_TR69_WPA_ENCRYPTION_MODES_WEP_AND_TKIP           2
211 #define WL_TR69_WPA_ENCRYPTION_MODES_AES                    3
212 #define WL_TR69_WPA_ENCRYPTION_MODES_WEP_AND_AES            4
213 #define WL_TR69_WPA_ENCRYPTION_MODES_TKIP_AND_AES           5
214 #define WL_TR69_WPA_ENCRYPTION_MODES_WEP_AND_TKIP_AES       6
215
216 #define WL_TR69_WPA_AUTHENTICATION_MODE_PSK                 0
217 #define WL_TR69_WPA_AUTHENTICATION_MODE_EAP                 1
218
219 #define WL_TR69_IEEE11I_ENCRYPTION_MODES_WEP                0
220 #define WL_TR69_IEEE11I_ENCRYPTION_MODES_TKIP               1
221 #define WL_TR69_IEEE11I_ENCRYPTION_MODES_WEP_AND_TKIP       2
222 #define WL_TR69_IEEE11I_ENCRYPTION_MODES_AES                3
223 #define WL_TR69_IEEE11I_ENCRYPTION_MODES_WEP_AND_AES        4
224 #define WL_TR69_IEEE11I_ENCRYPTION_MODES_TKIP_AND_AES       5
225 #define WL_TR69_IEEE11I_ENCRYPTION_MODES_WEP_AND_TKIP_AES   6
226
227 #define WL_TR69_IEEE11I_AUTHENTICATION_MODE_PSK             0
228 #define WL_TR69_IEEE11I_AUTHENTICATION_MODE_EAP             1
229
230 /* mimo */
231 #define WL_CTL_SB_LOWER         -1
232 #define WL_CTL_SB_NONE           0
233 #define WL_CTL_SB_UPPER          1
234 /* defines used by the nrate iovar */
235 #define NRATE_STF_MASK  0x0000ff00      /* stf mode mask: siso, cdd, stbc, sdm */
236 #define NRATE_STF_SHIFT 8               /* stf mode shift */
237 #define NRATE_MCS_INUSE 0x00000080      /* MSC in use,indicates b0-6 holds an mcs */
238 #define NRATE_RATE_MASK 0x0000007f      /* rate/mcs value */
239 /* notify the average dma xfer rate (in kbps) to the driver */
240 #define AVG_DMA_XFER_RATE 100000
241
242 /* A chanspec holds the channel number, band, bandwidth and control sideband */
243 typedef int chanspec_t;
244 #define WL_CHANSPEC_CHAN_MASK           0x00ff
245
246 #define WL_CHANSPEC_CTL_SB_MASK         0x0300
247 #define WL_CHANSPEC_CTL_SB_SHIFT             8
248 #define WL_CHANSPEC_CTL_SB_LOWER        0x0100
249 #define WL_CHANSPEC_CTL_SB_UPPER        0x0200
250 #define WL_CHANSPEC_CTL_SB_NONE         0x0300
251
252 #define WL_CHANSPEC_BW_MASK             0x0C00
253 #define WL_CHANSPEC_BW_SHIFT                10
254 #define WL_CHANSPEC_BW_10               0x0400
255 #define WL_CHANSPEC_BW_20               0x0800
256 #define WL_CHANSPEC_BW_40               0x0C00
257
258 #define WL_CHANSPEC_BAND_MASK           0xf000
259 #define WL_CHANSPEC_BAND_SHIFT          12
260 #define WL_CHANSPEC_BAND_5G             0x1000
261 #define WL_CHANSPEC_BAND_2G             0x2000
262 #define INVCHANSPEC     255
263
264 //swda add,06/06/2006
265 #define WL_KEY_ASCII 0
266 #define WL_KEY_HEX   1
267 //swda add end
268 /********************** Global Structs ****************************************/
269
270 typedef enum {
271    WL_STS_OK = 0,
272    WL_STS_ERR_GENERAL,
273    WL_STS_ERR_MEMORY,
274    WL_STS_ERR_OBJECT_NOT_FOUND
275 } WL_STATUS;
276
277 typedef enum {
278    WL_SETUP_ALL = 0,
279    WL_SETUP_BASIC,
280    WL_SETUP_SECURITY,
281    WL_SETUP_MAC_FILTER,
282    WL_SETUP_WDS,
283    WL_SETUP_ADVANCED,
284    WL_SETUP_SES /*SUPPORT_SES*/
285 } WL_SETUP_TYPE;
286
287 typedef struct {
288    int wlSsidIdx;
289    char wlMode[WL_SM_SIZE_MAX];
290    char wlCountry[WL_SM_SIZE_MAX];
291    char wlFltMacMode[WL_SM_SIZE_MAX];
292    char wlPhyType[WL_SIZE_2_MAX];
293    char wlBasicRate[WL_SIZE_8_MAX];
294    char wlProtection[WL_SIZE_8_MAX];
295    char wlPreambleType[WL_SM_SIZE_MAX];
296    char wlAfterBurnerEn[WL_SIZE_8_MAX];
297    char wlFrameBurst[WL_SIZE_4_MAX];
298    char wlWlanIfName[WL_SIZE_4_MAX];
299    char wlWds[WL_WDS_NUM][WL_MID_SIZE_MAX];
300    int  wlCoreRev;
301    int  wlHide;
302    int  wlEnbl;
303    int  wlChannel;
304    int  wlFrgThrshld;
305    int  wlRtsThrshld;
306    int  wlDtmIntvl;
307    int  wlBcnIntvl;
308    long wlRate;
309    int  wlgMode;
310    int  wlLazyWds;
311    int  wlAPIsolation;
312    int  wlBand;
313    int  wlMCastRate;
314    int  ezc_version;
315    int  ezc_enable;
316    int  wlInfra;
317    int  wlAntDiv;
318    int  wlWme;
319    int  wlWmeNoAck;
320    int  wlTxPwrPcnt;
321    int  wlRegMode;
322    int  wlDfsPreIsm;
323    int  wlDfsPostIsm; 
324    int  wlTpcDb;       
325    int  wlCsScanTimer;
326    int  wlMaxAssoc;   
327 #ifdef SUPPORT_SES   
328    int  wlSesEnable;
329    int  wlSesEvent;
330    char wlSesStates[WL_SIZE_8_MAX];
331    char wlSesSsid[WL_SSID_SIZE_MAX];
332    char wlSesWpaPsk[WL_WPA_PSK_SIZE_MAX];  
333    int  wlSesHide;
334    int  wlSesAuth; 
335    char wlSesAuthMode[WL_SIZE_8_MAX]; 
336    char wlSesWep[WL_SM_SIZE_MAX];   
337    char wlSesWpa[WL_SM_SIZE_MAX];      
338    int  wlSesWdsMode;      
339    int  wlSesClEnable;   
340    int  wlSesClEvent;   
341    char wlWdsWsec[WL_SIZE_132_MAX];   
342 #endif   
343 #ifdef SUPPORT_MIMO
344    int wlNBw;
345    int wlNCtrlsb;
346    int wlNBand;
347    int wlNMcsidx;
348    char wlNProtection[WL_SIZE_8_MAX];
349    char wlRifs[WL_SIZE_8_MAX];
350    char wlAmpdu[WL_SIZE_8_MAX];
351    char wlAmsdu[WL_SIZE_8_MAX];
352    char wlNmode[WL_SIZE_8_MAX];        
353    int wlNReqd;
354 #endif      
355 } WIRELESS_VAR, *PWIRELESS_VAR;
356
357 typedef struct {
358    char wlSsid[WL_SSID_SIZE_MAX];
359    //swda add,05/03/2005
360    int  wlHide;
361    int  wlKeyType;// 0:ASCII  1:Hex
362    char wlKeys128_ascii[WL_KEY_NUM][15];//ASCII
363    char wlKeys64_ascii[WL_KEY_NUM][7];//ASCII
364    //swda add end
365    char wlKeys128[WL_KEY_NUM][WL_MID_SIZE_MAX];
366    char wlKeys64[WL_KEY_NUM][WL_SM_SIZE_MAX];
367    char wlWpaPsk[WL_WPA_PSK_SIZE_MAX];
368    char wlRadiusKey[WL_RADIUS_KEY_SIZE_MAX];
369    char wlWep[WL_SM_SIZE_MAX];
370    char wlWpa[WL_SM_SIZE_MAX];
371    struct in_addr wlRadiusServerIP;
372    char wlAuthMode[WL_SIZE_8_MAX];
373    int  wlWpaGTKRekey;
374    int  wlRadiusPort;
375    int  wlAuth;
376    int  wlEnblSsid;
377    int  wlKeyIndex128;
378    int  wlKeyIndex64;
379    int  wlKeyBit;
380    int  is_default;
381    int  is_modified;
382    int  wlPreauth;
383    int  wlNetReauth;
384    int  wlNasWillrun; /*runtime*/
385 #ifdef SUPPORT_TR69C   
386    int  tr69cBeaconType;                 
387    int  tr69cBasicEncryptionModes;
388    int  tr69cBasicAuthenticationMode;   
389    int  tr69cWPAEncryptionModes;
390    int  tr69cWPAAuthenticationMode;
391    int  tr69cIEEE11iEncryptionModes;
392    int  tr69cIEEE11iAuthenticationMode;
393 #endif    
394 } WIRELESS_MSSID_VAR, *PWIRELESS_MSSID_VAR;
395
396
397 typedef struct {
398    char *varName;
399    char *varValue;
400 } WIRELESS_ITEM, *PWIRELESS_ITEM;
401
402 typedef struct {
403    char macAddress[WL_MID_SIZE_MAX];
404    char ssid[WL_SSID_SIZE_MAX];
405    char aptxmode;//swda add,05/03/2005
406    int channel;//swda add,05/03/2005
407 } WL_FLT_MAC_ENTRY, *PWL_FLT_MAC_ENTRY;
408
409 typedef struct { // don't want store ssid
410    char macAddress[WL_MID_SIZE_MAX];
411 } WL_FLT_MAC_STORE_ENTRY, *PWL_FLT_MAC_STORE_ENTRY;
412
413 typedef struct {
414    char macAddress[WL_MID_SIZE_MAX];
415    char associated;
416    char authorized;
417 } WL_STATION_LIST_ENTRY, *PWL_STATION_LIST_ENTRY;
418
419 // PSI Data
420 typedef struct {
421    WIRELESS_VAR wlVar;
422    WIRELESS_MSSID_VAR wlMssidVar[WL_NUM_SSID];  
423 } WIRELESS_PSI_VARS;
424
425 #endif