327f5baf0009179457c16da0449b038a7dc26f46
[bcm963xx.git] / userapps / broadcom / cfm / inc / wldefs.h
1 /*****************************************************************************
2 //
3 //  Copyright (c) 2000-2002  Broadcom Corporation
4 //  All Rights Reserved
5 //  No portions of this material may be reproduced in any form without the
6 //  written permission of:
7 //          Broadcom Corporation
8 //          16215 Alton Parkway
9 //          Irvine, California 92619
10 //  All information contained in this document is Broadcom Corporation
11 //  company private, proprietary, and trade secret.
12 //
13 ******************************************************************************
14 //
15 //  Filename:       wldefs.h
16 //  Author:         Peter T. Tran
17 //  Creation Date:  10/17/02
18 //
19 ******************************************************************************
20 //  Description:
21 //      Define the WlDefs functions.
22 //
23 *****************************************************************************/
24
25 #ifndef __WL_DEFS_H__
26 #define __WL_DEFS_H__
27
28 /********************** Include Files ***************************************/
29
30 #include <stdio.h>
31 #include <netinet/in.h>
32
33 /********************** Global Constants ************************************/
34
35 #define WL_NUM_SSID    2
36 #define WL_SIZE_2_MAX    2  
37 #define WL_SIZE_4_MAX    4  
38 #define WL_SIZE_8_MAX    8  
39 #define WL_SIZE_132_MAX  132
40 #define WL_SM_SIZE_MAX   16
41 #define WL_MID_SIZE_MAX  32
42 #define WL_SSID_SIZE_MAX 48
43 #define WL_MIN_PSK_LEN  8
44 #define WL_MAX_PSK_LEN  64
45 #define WL_WPA_PSK_SIZE_MAX  72  // max 64 hex or 63 char
46 #define WL_RADIUS_KEY_SIZE_MAX  88 // max is 80, limited by nas_wksp.h.  IAS allow up to 128 char
47 #define WL_LG_SIZE_MAX   1024
48 #define WL_MAC_ADDR_SIZE_MAX    18 // USR9108
49 #define WL_KEY_NUM       4
50 #define WL_WDS_NUM       4
51 #define WL_MIN_FRAGMENTATION_THRESHOLD  256
52 #define WL_MAX_FRAGMENTATION_THRESHOLD  2346
53 #define WL_MIN_RTS_THRESHOLD            0
54 #define WL_MAX_RTS_THRESHOLD            2347
55 #define WL_MIN_DTIM                     1
56 #define WL_MAX_DTIM                     255
57 #define WL_MIN_BEACON_INTERVAL          1
58 #define WL_MAX_BEACON_INTERVAL          65535
59 #define WL_KEY64_SIZE_HEX               10
60 #define WL_KEY64_SIZE_CHAR              5
61 #define WL_KEY128_SIZE_HEX              26
62 #define WL_KEY128_SIZE_CHAR             13
63
64 #define WL_FLT_MAC_OFF   "disabled"
65 #define WL_FLT_MAC_ALLOW "allow"
66 #define WL_FLT_MAC_DENY  "deny"
67
68 #define WL_BRIDGE_RESTRICT_ENABLE      0
69 #define WL_BRIDGE_RESTRICT_DISABLE     1
70 #define WL_BRIDGE_RESTRICT_ENABLE_SCAN 2
71
72 /* authentication mode */
73 #define WL_AUTH_OPEN                    "open"
74 #define WL_AUTH_SHARED                  "shared"
75 #define WL_AUTH_RADIUS                  "radius"
76 #define WL_AUTH_WPA                     "wpa"
77 #define WL_AUTH_WPA_PSK                 "psk"
78 #define WL_AUTH_WPA2                    "wpa2"
79 #define WL_AUTH_WPA2_PSK                "psk2"
80 #define WL_AUTH_WPA2_MIX                "wpa2mix"
81 #define WL_AUTH_WPA2_PSK_MIX    "psk2mix"
82 #define WL_WPA_AUTH_DISABLED            0x0000  /* Legacy (i.e., non-WPA) */
83 #define WL_WPA_AUTH_NONE                        0x0001  /* none (IBSS) */
84 #define WL_WPA_AUTH_UNSPECIFIED         0x0002  /* over 802.1x */
85 #define WL_WPA_AUTH_PSK                         0x0004  /* Pre-shared key */
86 #define WL_WPA_AUTH_8021X                       0x0020  /* 802.1x, reserved */
87 #define WL_WPA2_AUTH_UNSPECIFIED        0x0040  /* over 802.1x */
88 #define WL_WPA2_AUTH_PSK                        0x0080  /* Pre-shared key */
89
90 /* wireless security bitvec */
91 #define WEP_ENABLED      1
92 #define TKIP_ENABLED     2
93 #define AES_ENABLED      4
94 #define WSEC_SWFLAG      8
95
96 #define WPA_CAP_WPA2_PREAUTH            1
97
98 #define WL_BIT_KEY_128   0
99 #define WL_BIT_KEY_64    1
100
101 #define WL_PHY_TYPE_A    "a"
102 #define WL_PHY_TYPE_B    "b"
103 #define WL_PHY_TYPE_G    "g"
104
105 #define WL_BASIC_RATE_DEFAULT    "default"
106 #define WL_BASIC_RATE_ALL        "all"
107 #define WL_BASIC_RATE_1_2        "12"
108 #define WL_BASIC_RATE_WIFI_2     "wifi2"
109
110 #define WL_MODE_G_AUTO           1
111 #define WL_MODE_G_PERFORMANCE    4
112 #define WL_MODE_G_LRS            5
113 #define WL_MODE_B_ONLY           0
114
115 #define WL_AUTO                  "auto"
116 #define WL_OFF                   "off"
117 #define WL_ON                    "on"
118 #define WL_DISABLED              "disabled"
119 #define WL_ENABLED               "enabled"
120
121 #define WL_WME_ON                               1 
122 #define WL_WME_OFF                              0
123
124 #define WL_PREAUTH_ON                   1
125 #define WL_PREAUTH_OFF                  0
126
127 #define BAND_A                   1
128 #define BAND_B                   2
129
130 #define WIRELESS_APPID          "WirelessCfg"
131 #define WL_VARS_ID              1
132 #define WL_MSSID_VARS_NUM_ID    2
133 #define WL_MSSID_VARS_TBL_ID    3
134 #define WL_FLT_MAC_NUM_ID       4
135 #define WL_FLT_MAC_TBL_ID       5
136 #define WL_WDS_MAC_NUM_ID       6
137 #define WL_WDS_MAC_TBL_ID       7
138 #define WL_SCAN_WDS_MAC_NUM_ID  8
139 #define WL_SCAN_WDS_MAC_TBL_ID  9
140
141 #define RESET_WLAN      "/var/reset.wlan"
142
143
144 #define MAP_FROM_NVRAM  0
145 #define MAP_TO_NVRAM    1
146 #define WL_SES_ENTRY    99
147 #define MAX_NVPARSE 100
148 #define SES_WDS_MODE_DISABLED           0 /* disabled */
149 #define SES_WDS_MODE_AUTO               1 /* dynamic cf/cl selection */
150 #define SES_WDS_MODE_ENABLED_ALWAYS     2 /* enabled always */
151 #define SES_WDS_MODE_ENABLED_EXCL       3 /* WDS-only i.e no regular STAs */
152 #define SES_WDS_MODE_CLIENT             4 /* always wds client mode */
153 #define REG_MODE_OFF                    0 /* disabled 11h/d mode */
154 #define REG_MODE_H                      1 /* use 11h mode */
155 #define REG_MODE_D                      2 /* use 11d mode */
156 /********************** Global Structs ****************************************/
157
158 typedef enum {
159    WL_STS_OK = 0,
160    WL_STS_ERR_GENERAL,
161    WL_STS_ERR_MEMORY,
162    WL_STS_ERR_OBJECT_NOT_FOUND
163 } WL_STATUS;
164
165 typedef enum {
166    WL_SETUP_ALL = 0,
167    WL_SETUP_BASIC,
168    WL_SETUP_SECURITY,
169    WL_SETUP_MAC_FILTER,
170    WL_SETUP_WDS,
171    WL_SETUP_ADVANCED,
172    WL_SETUP_SES /*SUPPORT_SES*/
173 } WL_SETUP_TYPE;
174
175 typedef struct {
176    int wlSsidIdx;
177    char wlMode[WL_SM_SIZE_MAX];
178    char wlCountry[WL_SM_SIZE_MAX];
179    char wlFltMacMode[WL_SM_SIZE_MAX];
180    char wlPhyType[WL_SIZE_2_MAX];
181    char wlBasicRate[WL_SIZE_8_MAX];
182    char wlProtection[WL_SIZE_8_MAX];
183    char wlPreambleType[WL_SM_SIZE_MAX];
184    char wlAfterBurnerEn[WL_SIZE_8_MAX];
185    char wlFrameBurst[WL_SIZE_4_MAX];
186    char wlWlanIfName[WL_SIZE_4_MAX];
187    char wlWds[WL_WDS_NUM][WL_MID_SIZE_MAX];
188    int  wlCoreRev;
189    int  wlHide;
190    int  wlEnbl;
191    int  wlChannel;
192    int  wlFrgThrshld;
193    int  wlRtsThrshld;
194    int  wlDtmIntvl;
195    int  wlBcnIntvl;
196    long wlRate;
197    int  wlgMode;
198    int  wlLazyWds;
199    int  wlAPIsolation;
200    int  wlBand;
201    int  wlMCastRate;
202    int  ezc_version;
203    int  ezc_enable;
204    int  wlInfra;
205    int  wlAntDiv;
206    int  wlWme;
207    int  wlWmeNoAck;
208 #ifdef SUPPORT_SES   
209    int  wlSesEnable;
210    int  wlSesEvent;
211    char wlSesStates[WL_SIZE_8_MAX];
212    char wlSesSsid[WL_SSID_SIZE_MAX];
213    char wlSesWpaPsk[WL_WPA_PSK_SIZE_MAX];  
214    int  wlSesHide;
215    int  wlSesAuth; 
216    char wlSesAuthMode[WL_SIZE_8_MAX]; 
217    char wlSesWep[WL_SM_SIZE_MAX];   
218    char wlSesWpa[WL_SM_SIZE_MAX];      
219    int  wlSesWdsMode;      
220    int  wlSesClEnable;   
221    int  wlSesClEvent;   
222    char wlWdsWsec[WL_SIZE_132_MAX];      
223 #endif   
224    int  wlTxPwrPcnt;
225    int  wlRegMode;
226    int  wlDfsPreIsm;
227    int  wlDfsPostIsm; 
228    int  wlTpcDb;       
229 } WIRELESS_VAR, *PWIRELESS_VAR;
230
231 typedef struct {
232    char wlSsid[WL_SSID_SIZE_MAX];
233    char wlKeys128[WL_KEY_NUM][WL_MID_SIZE_MAX];
234    char wlKeys64[WL_KEY_NUM][WL_SM_SIZE_MAX];
235    char wlWpaPsk[WL_WPA_PSK_SIZE_MAX];
236    char wlRadiusKey[WL_RADIUS_KEY_SIZE_MAX];
237    char wlWep[WL_SM_SIZE_MAX];
238    char wlWpa[WL_SM_SIZE_MAX];
239    struct in_addr wlRadiusServerIP;
240    char wlAuthMode[WL_SIZE_8_MAX];
241    int  wlWpaGTKRekey;
242    int  wlRadiusPort;
243    int  wlAuth;
244    int  wlEnblSsid;
245    int  wlKeyIndex128;
246    int  wlKeyIndex64;
247    int  wlKeyBit;
248    int  is_default;
249    int  is_modified;
250    int  wlPreauth;
251    int  wlNetReauth;
252    int  wlNasWillrun; /*runtime*/
253    char wlSecurity[WL_SSID_SIZE_MAX];   // USR9108 Quick setup security.
254 } WIRELESS_MSSID_VAR, *PWIRELESS_MSSID_VAR;
255
256
257 typedef struct {
258    char *varName;
259    char *varValue;
260 } WIRELESS_ITEM, *PWIRELESS_ITEM;
261
262 typedef struct {
263    char macAddress[WL_MID_SIZE_MAX];
264    char ssid[WL_SSID_SIZE_MAX];
265 } WL_FLT_MAC_ENTRY, *PWL_FLT_MAC_ENTRY;
266
267 typedef struct { // don't want store ssid
268    char macAddress[WL_MID_SIZE_MAX];
269 } WL_FLT_MAC_STORE_ENTRY, *PWL_FLT_MAC_STORE_ENTRY;
270
271 typedef struct {
272    char macAddress[WL_MID_SIZE_MAX];
273    char associated;
274    char authorized;
275 } WL_STATION_LIST_ENTRY, *PWL_STATION_LIST_ENTRY;
276
277
278 #endif