3 Copyright 2004 Broadcom Corp. All Rights Reserved.
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.
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
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.
20 /*****************************************************************************
23 ******************************************************************************
26 // Author: Peter T. Tran
27 // Creation Date: 10/17/02
29 ******************************************************************************
31 // Define the WlDefs functions.
33 *****************************************************************************/
38 /********************** Include Files ***************************************/
41 #include <netinet/in.h>
43 /********************** Global Constants ************************************/
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
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
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
75 #define WL_FLT_MAC_OFF "disabled"
76 #define WL_FLT_MAC_ALLOW "allow"
77 #define WL_FLT_MAC_DENY "deny"
79 #define WL_BRIDGE_RESTRICT_ENABLE 0
80 #define WL_BRIDGE_RESTRICT_DISABLE 1
81 #define WL_BRIDGE_RESTRICT_ENABLE_SCAN 2
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 */
101 /* wireless security bitvec */
102 #define WEP_ENABLED 1
103 #define TKIP_ENABLED 2
104 #define AES_ENABLED 4
105 #define WSEC_SWFLAG 8
107 #define TKIP_ONLY "tkip"
108 #define AES_ONLY "aes"
109 #define TKIP_AND_AES "tkip+aes"
112 #define WPA_CAP_WPA2_PREAUTH 1
114 #define WL_BIT_KEY_128 0
115 #define WL_BIT_KEY_64 1
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"
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"
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
140 #define WL_AUTO "auto"
143 #define WL_DISABLED "disabled"
144 #define WL_ENABLED "enabled"
149 #define WL_PREAUTH_ON 1
150 #define WL_PREAUTH_OFF 0
155 #define WL_CHANSPEC_2G 2
156 #define WL_CHANSPEC_5G 5
158 #define WIRELESS_APPID "WirelessCfg"
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
169 #define RESET_WLAN "/var/reset.wlan"
170 #define RELOAD_VARS_WLAN "/var/reloadvars.wlan"
172 #define MAIN_BSS_IDX 0
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 */
187 #define WL_OPMODE_AP "ap"
188 #define WL_OPMODE_WDS "wds"
189 #define WL_PREAMBLE_LONG "long"
190 #define WL_PREAMBLE_SHORT "short"
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
202 #define WL_TR69_BASIC_ENCRYPTIONMODE_NONE 0
203 #define WL_TR69_BASIC_ENCRYPTIONMODE_WEP 1
205 #define WL_TR69_BASIC_AUTHENTICATION_NONE 0
206 #define WL_TR69_BASIC_AUTHENTICATION_EAP 1
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
216 #define WL_TR69_WPA_AUTHENTICATION_MODE_PSK 0
217 #define WL_TR69_WPA_AUTHENTICATION_MODE_EAP 1
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
227 #define WL_TR69_IEEE11I_AUTHENTICATION_MODE_PSK 0
228 #define WL_TR69_IEEE11I_AUTHENTICATION_MODE_EAP 1
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
242 /* A chanspec holds the channel number, band, bandwidth and control sideband */
243 typedef int chanspec_t;
244 #define WL_CHANSPEC_CHAN_MASK 0x00ff
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
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
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
264 //swda add,06/06/2006
265 #define WL_KEY_ASCII 0
268 /********************** Global Structs ****************************************/
274 WL_STS_ERR_OBJECT_NOT_FOUND
284 WL_SETUP_SES /*SUPPORT_SES*/
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];
330 char wlSesStates[WL_SIZE_8_MAX];
331 char wlSesSsid[WL_SSID_SIZE_MAX];
332 char wlSesWpaPsk[WL_WPA_PSK_SIZE_MAX];
335 char wlSesAuthMode[WL_SIZE_8_MAX];
336 char wlSesWep[WL_SM_SIZE_MAX];
337 char wlSesWpa[WL_SM_SIZE_MAX];
341 char wlWdsWsec[WL_SIZE_132_MAX];
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];
355 } WIRELESS_VAR, *PWIRELESS_VAR;
358 char wlSsid[WL_SSID_SIZE_MAX];
359 //swda add,05/03/2005
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
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];
384 int wlNasWillrun; /*runtime*/
387 int tr69cBasicEncryptionModes;
388 int tr69cBasicAuthenticationMode;
389 int tr69cWPAEncryptionModes;
390 int tr69cWPAAuthenticationMode;
391 int tr69cIEEE11iEncryptionModes;
392 int tr69cIEEE11iAuthenticationMode;
394 } WIRELESS_MSSID_VAR, *PWIRELESS_MSSID_VAR;
400 } WIRELESS_ITEM, *PWIRELESS_ITEM;
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;
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;
414 char macAddress[WL_MID_SIZE_MAX];
417 } WL_STATION_LIST_ENTRY, *PWL_STATION_LIST_ENTRY;
422 WIRELESS_MSSID_VAR wlMssidVar[WL_NUM_SSID];