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_MAX_ASSOC_STA 128
74 #define WL_FLT_MAC_OFF "disabled"
75 #define WL_FLT_MAC_ALLOW "allow"
76 #define WL_FLT_MAC_DENY "deny"
78 #define WL_BRIDGE_RESTRICT_ENABLE 0
79 #define WL_BRIDGE_RESTRICT_DISABLE 1
80 #define WL_BRIDGE_RESTRICT_ENABLE_SCAN 2
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 */
100 /* wireless security bitvec */
101 #define WEP_ENABLED 1
102 #define TKIP_ENABLED 2
103 #define AES_ENABLED 4
104 #define WSEC_SWFLAG 8
106 #define TKIP_ONLY "tkip"
107 #define AES_ONLY "aes"
108 #define TKIP_AND_AES "tkip+aes"
111 #define WPA_CAP_WPA2_PREAUTH 1
113 #define WL_BIT_KEY_128 0
114 #define WL_BIT_KEY_64 1
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"
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"
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
131 #define WL_AUTO "auto"
134 #define WL_DISABLED "disabled"
135 #define WL_ENABLED "enabled"
140 #define WL_PREAUTH_ON 1
141 #define WL_PREAUTH_OFF 0
146 #define WL_CHANSPEC_2G 2
147 #define WL_CHANSPEC_5G 5
149 #define WIRELESS_APPID "WirelessCfg"
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
160 #define RESET_WLAN "/var/reset.wlan"
161 #define RELOAD_VARS_WLAN "/var/reloadvars.wlan"
163 #define MAIN_BSS_IDX 0
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 */
178 #define WL_OPMODE_AP "ap"
179 #define WL_OPMODE_WDS "wds"
180 #define WL_PREAMBLE_LONG "long"
181 #define WL_PREAMBLE_SHORT "short"
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
193 #define WL_TR69_BASIC_ENCRYPTIONMODE_NONE 0
194 #define WL_TR69_BASIC_ENCRYPTIONMODE_WEP 1
196 #define WL_TR69_BASIC_AUTHENTICATION_NONE 0
197 #define WL_TR69_BASIC_AUTHENTICATION_EAP 1
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
207 #define WL_TR69_WPA_AUTHENTICATION_MODE_PSK 0
208 #define WL_TR69_WPA_AUTHENTICATION_MODE_EAP 1
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
218 #define WL_TR69_IEEE11I_AUTHENTICATION_MODE_PSK 0
219 #define WL_TR69_IEEE11I_AUTHENTICATION_MODE_EAP 1
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
233 /* A chanspec holds the channel number, band, bandwidth and control sideband */
234 typedef int chanspec_t;
235 #define WL_CHANSPEC_CHAN_MASK 0x00ff
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
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
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
255 /********************** Global Structs ****************************************/
261 WL_STS_ERR_OBJECT_NOT_FOUND
271 WL_SETUP_SES /*SUPPORT_SES*/
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];
317 char wlSesStates[WL_SIZE_8_MAX];
318 char wlSesSsid[WL_SSID_SIZE_MAX];
319 char wlSesWpaPsk[WL_WPA_PSK_SIZE_MAX];
322 char wlSesAuthMode[WL_SIZE_8_MAX];
323 char wlSesWep[WL_SM_SIZE_MAX];
324 char wlSesWpa[WL_SM_SIZE_MAX];
328 char wlWdsWsec[WL_SIZE_132_MAX];
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];
342 } WIRELESS_VAR, *PWIRELESS_VAR;
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];
365 int wlNasWillrun; /*runtime*/
368 int tr69cBasicEncryptionModes;
369 int tr69cBasicAuthenticationMode;
370 int tr69cWPAEncryptionModes;
371 int tr69cWPAAuthenticationMode;
372 int tr69cIEEE11iEncryptionModes;
373 int tr69cIEEE11iAuthenticationMode;
375 } WIRELESS_MSSID_VAR, *PWIRELESS_MSSID_VAR;
381 } WIRELESS_ITEM, *PWIRELESS_ITEM;
384 char macAddress[WL_MID_SIZE_MAX];
385 char ssid[WL_SSID_SIZE_MAX];
386 } WL_FLT_MAC_ENTRY, *PWL_FLT_MAC_ENTRY;
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;
393 char macAddress[WL_MID_SIZE_MAX];
396 } WL_STATION_LIST_ENTRY, *PWL_STATION_LIST_ENTRY;
401 WIRELESS_MSSID_VAR wlMssidVar[WL_NUM_SSID];