http://downloads.netgear.com/files/GPL/DM111PSP_v3.61d_GPL.tar.gz
[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_MAX_ASSOC_STA                128
73
74 #define WL_FLT_MAC_OFF   "disabled"
75 #define WL_FLT_MAC_ALLOW "allow"
76 #define WL_FLT_MAC_DENY  "deny"
77
78 #define WL_BRIDGE_RESTRICT_ENABLE      0
79 #define WL_BRIDGE_RESTRICT_DISABLE     1
80 #define WL_BRIDGE_RESTRICT_ENABLE_SCAN 2
81
82 /* authentication mode */
83 #define WL_AUTH_OPEN                    "open"
84 #define WL_AUTH_SHARED                  "shared"
85 #define WL_AUTH_RADIUS                  "radius"
86 #define WL_AUTH_WPA                     "wpa"
87 #define WL_AUTH_WPA_PSK                 "psk"
88 #define WL_AUTH_WPA2                    "wpa2"
89 #define WL_AUTH_WPA2_PSK                "psk2"
90 #define WL_AUTH_WPA2_MIX                "wpa2mix"
91 #define WL_AUTH_WPA2_PSK_MIX    "psk2mix"
92 #define WL_WPA_AUTH_DISABLED            0x0000  /* Legacy (i.e., non-WPA) */
93 #define WL_WPA_AUTH_NONE                        0x0001  /* none (IBSS) */
94 #define WL_WPA_AUTH_UNSPECIFIED         0x0002  /* over 802.1x */
95 #define WL_WPA_AUTH_PSK                         0x0004  /* Pre-shared key */
96 #define WL_WPA_AUTH_8021X                       0x0020  /* 802.1x, reserved */
97 #define WL_WPA2_AUTH_UNSPECIFIED        0x0040  /* over 802.1x */
98 #define WL_WPA2_AUTH_PSK                        0x0080  /* Pre-shared key */
99
100 /* wireless security bitvec */
101 #define WEP_ENABLED      1
102 #define TKIP_ENABLED     2
103 #define AES_ENABLED      4
104 #define WSEC_SWFLAG      8
105
106 #define TKIP_ONLY       "tkip"
107 #define AES_ONLY        "aes"
108 #define TKIP_AND_AES    "tkip+aes"
109
110
111 #define WPA_CAP_WPA2_PREAUTH            1
112
113 #define WL_BIT_KEY_128   0
114 #define WL_BIT_KEY_64    1
115
116 #define WL_PHY_TYPE_A    "a"
117 #define WL_PHY_TYPE_B    "b"
118 #define WL_PHY_TYPE_G    "g"
119 #define WL_PHY_TYPE_N    "n"
120
121 #define WL_BASIC_RATE_DEFAULT    "default"
122 #define WL_BASIC_RATE_ALL        "all"
123 #define WL_BASIC_RATE_1_2        "12"
124 #define WL_BASIC_RATE_WIFI_2     "wifi2"
125
126 #define WL_MODE_G_AUTO           1
127 #define WL_MODE_G_PERFORMANCE    4
128 #define WL_MODE_G_LRS            5
129 #define WL_MODE_B_ONLY           0
130
131 #define WL_AUTO                  "auto"
132 #define WL_OFF                   "off"
133 #define WL_ON                    "on"
134 #define WL_DISABLED              "disabled"
135 #define WL_ENABLED               "enabled"
136
137 #define WL_WME_ON                               1 
138 #define WL_WME_OFF                              0
139
140 #define WL_PREAUTH_ON                   1
141 #define WL_PREAUTH_OFF                  0
142
143 #define BAND_A                   1
144 #define BAND_B                   2
145
146 #define WL_CHANSPEC_2G          2
147 #define WL_CHANSPEC_5G          5
148
149 #define WIRELESS_APPID          "WirelessCfg"
150 #define WL_VARS_ID              1
151 #define WL_MSSID_VARS_NUM_ID    2
152 #define WL_MSSID_VARS_TBL_ID    3
153 #define WL_FLT_MAC_NUM_ID       4
154 #define WL_FLT_MAC_TBL_ID       5
155 #define WL_WDS_MAC_NUM_ID       6
156 #define WL_WDS_MAC_TBL_ID       7
157 #define WL_SCAN_WDS_MAC_NUM_ID  8
158 #define WL_SCAN_WDS_MAC_TBL_ID  9
159
160 #define RESET_WLAN       "/var/reset.wlan"
161 #define RELOAD_VARS_WLAN "/var/reloadvars.wlan"
162
163 #define MAIN_BSS_IDX    0
164
165 #define MAP_FROM_NVRAM  0
166 #define MAP_TO_NVRAM    1
167 #define WL_SES_ENTRY    99
168 #define MAX_NVPARSE 100
169 #define SES_WDS_MODE_DISABLED           0 /* disabled */
170 #define SES_WDS_MODE_AUTO               1 /* dynamic cf/cl selection */
171 #define SES_WDS_MODE_ENABLED_ALWAYS     2 /* enabled always */
172 #define SES_WDS_MODE_ENABLED_EXCL       3 /* WDS-only i.e no regular STAs */
173 #define SES_WDS_MODE_CLIENT             4 /* always wds client mode */
174 #define REG_MODE_OFF                    0 /* disabled 11h/d mode */
175 #define REG_MODE_H                      1 /* use 11h mode */
176 #define REG_MODE_D                      2 /* use 11d mode */
177
178 #define WL_OPMODE_AP                    "ap" 
179 #define WL_OPMODE_WDS                   "wds" 
180 #define WL_PREAMBLE_LONG                "long"
181 #define WL_PREAMBLE_SHORT               "short"
182
183 // TR69 overrides
184 #define WL_TR69_BEACONTYPE_NONE                             0
185 #define WL_TR69_BEACONTYPE_BASIC                            1
186 #define WL_TR69_BEACONTYPE_WPA                              2
187 #define WL_TR69_BEACONTYPE_11I                              3
188 #define WL_TR69_BEACONTYPE_BASIC_AND_WPA                    4
189 #define WL_TR69_BEACONTYPE_BASIC_AND_11I                    5
190 #define WL_TR69_BEACONTYPE_WPA_AND_11I                      6
191 #define WL_TR69_BEACONTYPE_BASIC_AND_WPA_AND_11I            7
192
193 #define WL_TR69_BASIC_ENCRYPTIONMODE_NONE                   0
194 #define WL_TR69_BASIC_ENCRYPTIONMODE_WEP                    1
195
196 #define WL_TR69_BASIC_AUTHENTICATION_NONE                   0
197 #define WL_TR69_BASIC_AUTHENTICATION_EAP                    1
198
199 #define WL_TR69_WPA_ENCRYPTION_MODES_WEP                    0
200 #define WL_TR69_WPA_ENCRYPTION_MODES_TKIP                   1
201 #define WL_TR69_WPA_ENCRYPTION_MODES_WEP_AND_TKIP           2
202 #define WL_TR69_WPA_ENCRYPTION_MODES_AES                    3
203 #define WL_TR69_WPA_ENCRYPTION_MODES_WEP_AND_AES            4
204 #define WL_TR69_WPA_ENCRYPTION_MODES_TKIP_AND_AES           5
205 #define WL_TR69_WPA_ENCRYPTION_MODES_WEP_AND_TKIP_AES       6
206
207 #define WL_TR69_WPA_AUTHENTICATION_MODE_PSK                 0
208 #define WL_TR69_WPA_AUTHENTICATION_MODE_EAP                 1
209
210 #define WL_TR69_IEEE11I_ENCRYPTION_MODES_WEP                0
211 #define WL_TR69_IEEE11I_ENCRYPTION_MODES_TKIP               1
212 #define WL_TR69_IEEE11I_ENCRYPTION_MODES_WEP_AND_TKIP       2
213 #define WL_TR69_IEEE11I_ENCRYPTION_MODES_AES                3
214 #define WL_TR69_IEEE11I_ENCRYPTION_MODES_WEP_AND_AES        4
215 #define WL_TR69_IEEE11I_ENCRYPTION_MODES_TKIP_AND_AES       5
216 #define WL_TR69_IEEE11I_ENCRYPTION_MODES_WEP_AND_TKIP_AES   6
217
218 #define WL_TR69_IEEE11I_AUTHENTICATION_MODE_PSK             0
219 #define WL_TR69_IEEE11I_AUTHENTICATION_MODE_EAP             1
220
221 /* mimo */
222 #define WL_CTL_SB_LOWER         -1
223 #define WL_CTL_SB_NONE           0
224 #define WL_CTL_SB_UPPER          1
225 /* defines used by the nrate iovar */
226 #define NRATE_STF_MASK  0x0000ff00      /* stf mode mask: siso, cdd, stbc, sdm */
227 #define NRATE_STF_SHIFT 8               /* stf mode shift */
228 #define NRATE_MCS_INUSE 0x00000080      /* MSC in use,indicates b0-6 holds an mcs */
229 #define NRATE_RATE_MASK 0x0000007f      /* rate/mcs value */
230 /* notify the average dma xfer rate (in kbps) to the driver */
231 #define AVG_DMA_XFER_RATE 100000
232
233 /* A chanspec holds the channel number, band, bandwidth and control sideband */
234 typedef int chanspec_t;
235 #define WL_CHANSPEC_CHAN_MASK           0x00ff
236
237 #define WL_CHANSPEC_CTL_SB_MASK         0x0300
238 #define WL_CHANSPEC_CTL_SB_SHIFT             8
239 #define WL_CHANSPEC_CTL_SB_LOWER        0x0100
240 #define WL_CHANSPEC_CTL_SB_UPPER        0x0200
241 #define WL_CHANSPEC_CTL_SB_NONE         0x0300
242
243 #define WL_CHANSPEC_BW_MASK             0x0C00
244 #define WL_CHANSPEC_BW_SHIFT                10
245 #define WL_CHANSPEC_BW_10               0x0400
246 #define WL_CHANSPEC_BW_20               0x0800
247 #define WL_CHANSPEC_BW_40               0x0C00
248
249 #define WL_CHANSPEC_BAND_MASK           0xf000
250 #define WL_CHANSPEC_BAND_SHIFT          12
251 #define WL_CHANSPEC_BAND_5G             0x1000
252 #define WL_CHANSPEC_BAND_2G             0x2000
253 #define INVCHANSPEC     255
254
255 /********************** Global Structs ****************************************/
256
257 typedef enum {
258    WL_STS_OK = 0,
259    WL_STS_ERR_GENERAL,
260    WL_STS_ERR_MEMORY,
261    WL_STS_ERR_OBJECT_NOT_FOUND
262 } WL_STATUS;
263
264 typedef enum {
265    WL_SETUP_ALL = 0,
266    WL_SETUP_BASIC,
267    WL_SETUP_SECURITY,
268    WL_SETUP_MAC_FILTER,
269    WL_SETUP_WDS,
270    WL_SETUP_ADVANCED,
271    WL_SETUP_SES /*SUPPORT_SES*/
272 } WL_SETUP_TYPE;
273
274 typedef struct {
275    int wlSsidIdx;
276    char wlMode[WL_SM_SIZE_MAX];
277    char wlCountry[WL_SM_SIZE_MAX];
278    char wlFltMacMode[WL_SM_SIZE_MAX];
279    char wlPhyType[WL_SIZE_2_MAX];
280    char wlBasicRate[WL_SIZE_8_MAX];
281    char wlProtection[WL_SIZE_8_MAX];
282    char wlPreambleType[WL_SM_SIZE_MAX];
283    char wlAfterBurnerEn[WL_SIZE_8_MAX];
284    char wlFrameBurst[WL_SIZE_4_MAX];
285    char wlWlanIfName[WL_SIZE_4_MAX];
286    char wlWds[WL_WDS_NUM][WL_MID_SIZE_MAX];
287    int  wlCoreRev;
288    int  wlHide;
289    int  wlEnbl;
290    int  wlChannel;
291    int  wlFrgThrshld;
292    int  wlRtsThrshld;
293    int  wlDtmIntvl;
294    int  wlBcnIntvl;
295    long wlRate;
296    int  wlgMode;
297    int  wlLazyWds;
298    int  wlAPIsolation;
299    int  wlBand;
300    int  wlMCastRate;
301    int  ezc_version;
302    int  ezc_enable;
303    int  wlInfra;
304    int  wlAntDiv;
305    int  wlWme;
306    int  wlWmeNoAck;
307    int  wlTxPwrPcnt;
308    int  wlRegMode;
309    int  wlDfsPreIsm;
310    int  wlDfsPostIsm; 
311    int  wlTpcDb;       
312    int  wlCsScanTimer;
313    int  wlMaxAssoc;   
314 #ifdef SUPPORT_SES   
315    int  wlSesEnable;
316    int  wlSesEvent;
317    char wlSesStates[WL_SIZE_8_MAX];
318    char wlSesSsid[WL_SSID_SIZE_MAX];
319    char wlSesWpaPsk[WL_WPA_PSK_SIZE_MAX];  
320    int  wlSesHide;
321    int  wlSesAuth; 
322    char wlSesAuthMode[WL_SIZE_8_MAX]; 
323    char wlSesWep[WL_SM_SIZE_MAX];   
324    char wlSesWpa[WL_SM_SIZE_MAX];      
325    int  wlSesWdsMode;      
326    int  wlSesClEnable;   
327    int  wlSesClEvent;   
328    char wlWdsWsec[WL_SIZE_132_MAX];   
329 #endif   
330 #ifdef SUPPORT_MIMO
331    int wlNBw;
332    int wlNCtrlsb;
333    int wlNBand;
334    int wlNMcsidx;
335    char wlNProtection[WL_SIZE_8_MAX];
336    char wlRifs[WL_SIZE_8_MAX];
337    char wlAmpdu[WL_SIZE_8_MAX];
338    char wlAmsdu[WL_SIZE_8_MAX];
339    char wlNmode[WL_SIZE_8_MAX];
340    int wlNReqd;
341 #endif      
342 } WIRELESS_VAR, *PWIRELESS_VAR;
343
344 typedef struct {
345    char wlSsid[WL_SSID_SIZE_MAX];
346    char wlKeys128[WL_KEY_NUM][WL_MID_SIZE_MAX];
347    char wlKeys64[WL_KEY_NUM][WL_SM_SIZE_MAX];
348    char wlWpaPsk[WL_WPA_PSK_SIZE_MAX];
349    char wlRadiusKey[WL_RADIUS_KEY_SIZE_MAX];
350    char wlWep[WL_SM_SIZE_MAX];
351    char wlWpa[WL_SM_SIZE_MAX];
352    struct in_addr wlRadiusServerIP;
353    char wlAuthMode[WL_SIZE_8_MAX];
354    int  wlWpaGTKRekey;
355    int  wlRadiusPort;
356    int  wlAuth;
357    int  wlEnblSsid;
358    int  wlKeyIndex128;
359    int  wlKeyIndex64;
360    int  wlKeyBit;
361    int  is_default;
362    int  is_modified;
363    int  wlPreauth;
364    int  wlNetReauth;
365    int  wlNasWillrun; /*runtime*/
366 #ifdef SUPPORT_TR69C   
367    int  tr69cBeaconType;                 
368    int  tr69cBasicEncryptionModes;
369    int  tr69cBasicAuthenticationMode;   
370    int  tr69cWPAEncryptionModes;
371    int  tr69cWPAAuthenticationMode;
372    int  tr69cIEEE11iEncryptionModes;
373    int  tr69cIEEE11iAuthenticationMode;
374 #endif    
375 } WIRELESS_MSSID_VAR, *PWIRELESS_MSSID_VAR;
376
377
378 typedef struct {
379    char *varName;
380    char *varValue;
381 } WIRELESS_ITEM, *PWIRELESS_ITEM;
382
383 typedef struct {
384    char macAddress[WL_MID_SIZE_MAX];
385    char ssid[WL_SSID_SIZE_MAX];
386 } WL_FLT_MAC_ENTRY, *PWL_FLT_MAC_ENTRY;
387
388 typedef struct { // don't want store ssid
389    char macAddress[WL_MID_SIZE_MAX];
390 } WL_FLT_MAC_STORE_ENTRY, *PWL_FLT_MAC_STORE_ENTRY;
391
392 typedef struct {
393    char macAddress[WL_MID_SIZE_MAX];
394    char associated;
395    char authorized;
396 } WL_STATION_LIST_ENTRY, *PWL_STATION_LIST_ENTRY;
397
398 // PSI Data
399 typedef struct {
400    WIRELESS_VAR wlVar;
401    WIRELESS_MSSID_VAR wlMssidVar[WL_NUM_SSID];  
402 } WIRELESS_PSI_VARS;
403
404 #endif