xref: /titanic_44/usr/src/uts/common/inet/wifi_ioctl.h (revision ebd1706e95186ddae1d4c0d63c47544cf33832ee)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * Macro and date structures defined for 802.11 wifi config tool.
29  */
30 
31 #ifndef	__WIFI_IOCTL_H
32 #define	__WIFI_IOCTL_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 #include <sys/types.h>
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 #define	MAX_KEY_LENGTH 26
43 #define	MAX_ESSID_LENGTH 32
44 #define	MAX_CHANNEL_NUM	99
45 #define	MAX_RSSI 15
46 #define	MAX_NWEPKEYS 4
47 #define	NET_802_11 80211
48 #define	MAX_BUF_LEN 65536
49 #define	MAX_SCAN_SUPPORT_RATES 8
50 
51 /*
52  * ioctls
53  */
54 #define	WLAN_IOCTL_BASE 0x1000
55 #define	WLAN_GET_VERSION (WLAN_IOCTL_BASE + 0x0)
56 #define	WLAN_SET_PARAM (WLAN_IOCTL_BASE + 0x2)
57 #define	WLAN_GET_PARAM (WLAN_IOCTL_BASE + 0x3)
58 #define	WLAN_COMMAND (WLAN_IOCTL_BASE + 0x4)
59 
60 /*
61  * parameters
62  */
63 #define	WL_PARAMETERS_BASE 0x2000
64 #define	WL_BSSID (WL_PARAMETERS_BASE + 0x0)
65 #define	WL_ESSID (WL_PARAMETERS_BASE + 0x1)
66 #define	WL_NODE_NAME (WL_PARAMETERS_BASE + 0x2)
67 #define	WL_PHY_SUPPORT (WL_PARAMETERS_BASE + 0x3)
68 #define	WL_PHY_CONFIG (WL_PARAMETERS_BASE + 0x4)
69 #define	WL_DOMAIN (WL_PARAMETERS_BASE + 0x5)
70 #define	WL_POWER_MODE (WL_PARAMETERS_BASE + 0x6)
71 #define	WL_TX_POWER (WL_PARAMETERS_BASE + 0x7)
72 #define	WL_RSSI (WL_PARAMETERS_BASE + 0x8)
73 #define	WL_RSSI_THRESHOLD (WL_PARAMETERS_BASE + 0x9)
74 #define	WL_ESS_LIST (WL_PARAMETERS_BASE + 0xa)
75 #define	WL_BSS_TYPE (WL_PARAMETERS_BASE + 0xb)
76 #define	WL_CREATE_IBSS (WL_PARAMETERS_BASE + 0xc)
77 #define	WL_RTS_THRESHOLD (WL_PARAMETERS_BASE + 0xd)
78 #define	WL_SHORT_RETRY (WL_PARAMETERS_BASE + 0xe)
79 #define	WL_LONG_RETRY (WL_PARAMETERS_BASE + 0xf)
80 #define	WL_BEACON_PERIOD (WL_PARAMETERS_BASE + 0x10)
81 #define	WL_TX_LIFETIME (WL_PARAMETERS_BASE + 0x11)
82 #define	WL_RX_LIFETIME (WL_PARAMETERS_BASE + 0x12)
83 #define	WL_FRAG_THRESHOLD (WL_PARAMETERS_BASE + 0x13)
84 #define	WL_VENDOR_ID (WL_PARAMETERS_BASE + 0x14)
85 #define	WL_PRODUCT_ID (WL_PARAMETERS_BASE + 0x15)
86 #define	WL_NUM_ANTS (WL_PARAMETERS_BASE + 0x16)
87 #define	WL_RX_ANTENNA (WL_PARAMETERS_BASE + 0x17)
88 #define	WL_TX_ANTENNA (WL_PARAMETERS_BASE + 0x18)
89 #define	WL_SUPPORTED_RATES (WL_PARAMETERS_BASE + 0x19)
90 #define	WL_DESIRED_RATES (WL_PARAMETERS_BASE + 0x1a)
91 #define	WL_WEP_KEY_TAB (WL_PARAMETERS_BASE + 0x1b)
92 #define	WL_WEP_KEY_ID (WL_PARAMETERS_BASE + 0x1c)
93 #define	WL_WEP_MAPPING_TAB (WL_PARAMETERS_BASE + 0x1d)
94 #define	WL_WEP_MAPPING_LEN (WL_PARAMETERS_BASE + 0x1e)
95 #define	WL_ENCRYPTION (WL_PARAMETERS_BASE + 0x1f)
96 #define	WL_AUTH_MODE (WL_PARAMETERS_BASE + 0x20)
97 #define	WL_EXCL_UNENC (WL_PARAMETERS_BASE + 0x21)
98 #define	WL_RFMON (WL_PARAMETERS_BASE + 0x22)
99 #define	WL_RADIO (WL_PARAMETERS_BASE + 0x23)
100 #define	WL_LINKSTATUS (WL_PARAMETERS_BASE + 0x24)
101 #define	WL_DEV_DEPEND (WL_PARAMETERS_BASE + 0x25)
102 /*
103  * commands
104  */
105 #define	WL_COMMAND_BASE 0x3000
106 #define	WL_SCAN (WL_COMMAND_BASE + 0x0)
107 #define	WL_DISASSOCIATE (WL_COMMAND_BASE + 0x1)
108 #define	WL_REASSOCIATE (WL_COMMAND_BASE + 0x2)
109 #define	WL_LOAD_DEFAULTS (WL_COMMAND_BASE + 0x3)
110 #define	WL_ASSOCIAT (WL_COMMAND_BASE + 0x4)
111 
112 /*
113  * domains
114  */
115 /* --USA */
116 #define	WL_DOMAIN_BASE 0x4000
117 #define	WL_DOMAIN_FCC (WL_DOMAIN_BASE + 0x0)
118 /* --Canada */
119 #define	WL_DOMAIN_DOC (WL_DOMAIN_BASE + 0x1)
120 /* --Most of Europe */
121 #define	WL_DOMAIN_ETSI (WL_DOMAIN_BASE + 0x2)
122 /* --Spain */
123 #define	WL_DOMAIN_SPAIN (WL_DOMAIN_BASE + 0x3)
124 /* --France */
125 #define	WL_DOMAIN_FRANCE (WL_DOMAIN_BASE + 0x4)
126 /* --Japan */
127 #define	WL_DOMAIN_MKK (WL_DOMAIN_BASE + 0x5)
128 
129 /*
130  * power mode
131  */
132 
133 #define	WL_PM_AM 0x0
134 #define	WL_PM_MPS 0x1
135 #define	WL_PM_FAST 0x2
136 #define	WL_PM_USER 0x3
137 
138 /*
139  * rates
140  */
141 #define	WL_RATE_BASIC_SET 0x80
142 #define	WL_RATE_1M 2
143 #define	WL_RATE_2M 4
144 #define	WL_RATE_5_5M 11
145 #define	WL_RATE_6M 12
146 #define	WL_RATE_9M 18
147 #define	WL_RATE_11M 22
148 #define	WL_RATE_12M 24
149 #define	WL_RATE_18M 36
150 #define	WL_RATE_22M 44
151 #define	WL_RATE_24M 48
152 #define	WL_RATE_33M 66
153 #define	WL_RATE_36M 72
154 #define	WL_RATE_48M 96
155 #define	WL_RATE_54M 108
156 /*
157  * wep operations
158  */
159 #define	WL_WEP_OPERATION_BASE 0x6000
160 #define	WL_ADD (WL_WEP_OPERATION_BASE + 0x0)
161 #define	WL_DEL (WL_WEP_OPERATION_BASE + 0x1)
162 #define	WL_NUL (WL_WEP_OPERATION_BASE + 0x2)
163 #define	WL_IND (WL_WEP_OPERATION_BASE + 0x3)
164 
165 #define	WL_NOENCRYPTION 0x0
166 #define	WL_ENC_WEP 0x1
167 #define	WL_OPENSYSTEM 0x1
168 #define	WL_SHAREDKEY 0x2
169 
170 /*
171  * linkstatus
172  */
173 #define	WL_CONNECTED 0x0
174 #define	WL_NOTCONNECTED 0x1
175 
176 /*
177  * prives
178  */
179 #define	WL_PRIV_BASE 0x7000
180 #define	WL_PRIV_RW (WL_PRIV_BASE + 0x0)
181 #define	WL_PRIV_R (WL_PRIV_BASE + 0x1)
182 #define	WL_PRIV_W (WL_PRIV_BASE + 0x2)
183 #define	WL_PRIV_INT (WL_PRIV_BASE + 0x3)
184 #define	WL_PRIV_INT_ARRAY (WL_PRIV_BASE + 0x4)
185 #define	WL_PRIV_BYTE (WL_PRIV_BASE + 0x5)
186 #define	WL_PRIV_BYTE_ARRAY (WL_PRIV_BASE + 0x6)
187 #define	WL_PRIV_STRING (WL_PRIV_BASE + 0x7)
188 #define	WL_PRIV_STRING_ARRAY (WL_PRIV_BASE + 0x8)
189 /*
190  * return values
191  */
192 #define	WL_SUCCESS 0x0
193 #define	WL_NOTSUPPORTED EINVAL
194 #define	WL_LACK_FEATURE ENOTSUP
195 #define	WL_HW_ERROR EIO
196 #define	WL_ACCESS_DENIED EACCES
197 #define	WL_RETURN_BASE	0x7000
198 #define	WL_READONLY (WL_RETURN_BASE + 0x1)
199 #define	WL_WRITEONLY (WL_RETURN_BASE + 0x2)
200 #define	WL_NOAP (WL_RETURN_BASE + 0x3)
201 /*
202  * other values
203  */
204 #define	WL_OTHER_BASE 0x8000
205 #define	WL_FHSS (WL_OTHER_BASE + 0x0)
206 #define	WL_DSSS (WL_OTHER_BASE + 0x1)
207 #define	WL_IRBASE (WL_OTHER_BASE + 0x2)
208 #define	WL_OFDM (WL_OTHER_BASE + 0x3)
209 #define	WL_HRDS (WL_OTHER_BASE + 0x4)
210 #define	WL_ERP (WL_OTHER_BASE + 0x5)
211 
212 #define	WL_BSS_BSS 1
213 #define	WL_BSS_IBSS 3
214 #define	WL_BSS_ANY 2
215 /*
216  * field_offset
217  */
218 #define	WIFI_BUF_OFFSET		offsetof(wldp_t, wldp_buf)
219 
220 /*
221  * type definationes
222  */
223 typedef boolean_t wl_create_ibss_t;
224 typedef char wl_bssid_t[6];
225 
226 typedef struct wl_essid {
227 	uint32_t wl_essid_length;
228 	char wl_essid_essid[34];
229 }wl_essid_t;
230 
231 typedef struct wl_nodename {
232 	uint32_t wl_nodename_length;
233 	char wl_nodename_name[34];
234 } wl_nodename_t;
235 
236 typedef struct wl_phy_supported {
237 	uint32_t wl_phy_support_num;
238 	uint32_t wl_phy_support_phy_types[1];
239 } wl_phy_supported_t;
240 
241 typedef struct wl_fhss {
242 	uint32_t wl_fhss_subtype;
243 	uint32_t wl_fhss_channel;
244 	uint32_t wl_fhss_hoptime;
245 	uint32_t wl_fhss_hoppattern;
246 	uint32_t wl_fhss_hopset;
247 	uint32_t wl_fhss_dwelltime;
248 } wl_fhss_t;
249 
250 typedef struct wl_dsss {
251 	uint32_t wl_dsss_subtype;
252 	uint32_t wl_dsss_channel;
253 	boolean_t wl_dsss_have_short_preamble;
254 	uint32_t wl_dsss_preamble_mode;
255 	boolean_t wl_dsss_agility_enabled;
256 	boolean_t wl_dsss_have_pbcc;
257 	boolean_t wl_dsss_pbcc_enable;
258 } wl_dsss_t;
259 
260 typedef struct wl_ofdm {
261 	uint32_t wl_ofdm_subtype;
262 	uint32_t wl_ofdm_frequency;
263 	uint32_t wl_ofdm_freq_supported;
264 } wl_ofdm_t;
265 
266 typedef struct wl_erp {
267 	uint32_t wl_erp_subtype;
268 	uint32_t wl_erp_channel;
269 	boolean_t wl_erp_have_short_preamble;
270 	uint32_t wl_erp_preamble_mode;
271 	boolean_t wl_erp_have_agility;
272 	boolean_t wl_erp_agility_enabled;
273 	boolean_t wl_erp_have_pbcc;
274 	boolean_t wl_erp_pbcc_enabled;
275 	boolean_t wl_erp_have_dsss_ofdm;
276 	boolean_t wl_erp_dsss_ofdm_enabled;
277 	boolean_t wl_erp_have_sst;
278 	boolean_t wl_erp_sst_enabled;
279 } wl_erp_t;
280 
281 typedef union wl_phy_conf {
282 	wl_fhss_t wl_phy_fhss_conf;
283 	wl_dsss_t wl_phy_dsss_conf;
284 	wl_ofdm_t wl_phy_ofdm_conf;
285 	wl_erp_t wl_phy_erp_conf;
286 } wl_phy_conf_t;
287 
288 typedef uint32_t wl_domain_t;
289 
290 typedef struct wl_ps_mode {
291 	uint32_t wl_ps_mode;
292 	uint32_t wl_ps_max_sleep;
293 	uint32_t wl_ps_min_sleep;
294 	uint32_t wl_ps_max_awake;
295 	uint32_t wl_ps_min_awake;
296 	boolean_t wl_ps_nobroadcast;
297 } wl_ps_mode_t;
298 
299 typedef uint32_t wl_linkstatus_t;
300 typedef uint32_t wl_tx_pwer_t;
301 typedef uint32_t wl_rssi_t;
302 typedef uint32_t wl_rssi_threshold_t;
303 typedef uint32_t wl_bss_type_t;
304 typedef uint32_t wl_authmode_t;
305 typedef uint32_t wl_encryption_t;
306 typedef uint32_t wl_wep_key_id_t;
307 typedef boolean_t wl_radio_t;
308 typedef uint32_t wl_rts_threshold_t;
309 typedef uint32_t wl_short_retry_t;
310 typedef uint32_t wl_long_retry_t;
311 typedef uint32_t wl_beacon_period_t;
312 typedef uint32_t wl_tx_lifetime_t;
313 typedef uint32_t wl_rx_lifetime_t;
314 typedef uint32_t wl_frag_threshold_t;
315 typedef char wl_vendor_t[128];
316 typedef char wl_product_t[128];
317 typedef uint32_t wl_num_ants_t;
318 typedef uint32_t wl_rx_antenna_t;
319 typedef uint32_t wl_tx_antenna_t;
320 
321 typedef struct wl_rates {
322 	uint32_t wl_rates_num;
323 	char wl_rates_rates[1];
324 } wl_rates_t;
325 
326 typedef struct wl_ess_conf {
327 	uint32_t wl_ess_conf_length;
328 	wl_essid_t wl_ess_conf_essid;
329 	wl_bssid_t wl_ess_conf_bssid;
330 	char wl_ess_conf_reserved[2];
331 	wl_bss_type_t wl_ess_conf_bsstype;
332 	wl_authmode_t wl_ess_conf_authmode;
333 	boolean_t wl_ess_conf_wepenabled;
334 	wl_rssi_t wl_ess_conf_sl;
335 	union {
336 		wl_fhss_t wl_phy_fhss_conf;
337 		wl_dsss_t wl_phy_dsss_conf;
338 		wl_ofdm_t wl_phy_ofdm_conf;
339 		wl_erp_t wl_phy_erp_conf;
340 	} wl_phy_conf;
341 	char wl_supported_rates[MAX_SCAN_SUPPORT_RATES];
342 } wl_ess_conf_t;
343 
344 typedef struct wl_ess_list {
345 	uint32_t wl_ess_list_num;
346 	wl_ess_conf_t wl_ess_list_ess[1];
347 } wl_ess_list_t;
348 
349 typedef struct wl_wep_key {
350 	uint32_t wl_wep_length;
351 	char wl_wep_key[MAX_KEY_LENGTH];
352 	uint32_t wl_wep_operation;
353 } wl_wep_key_t;
354 typedef wl_wep_key_t wl_wep_key_tab_t[MAX_NWEPKEYS];
355 
356 typedef struct wep_mapping {
357 	uint32_t wl_wep_map_index;
358 	boolean_t wl_wep_map_wepon;
359 	char wl_wep_map_mac_addr[6];
360 	char wl_wep_map_reserved[2];
361 	wl_wep_key_t wl_wep_map_wepkey;
362 } wep_mapping_t;
363 typedef wep_mapping_t wep_mapping_tab_t[1];
364 
365 typedef struct wl_priv_param {
366 	char wl_priv_name[8];
367 	uint32_t wl_priv_type;
368 	uint32_t wl_priv_size;
369 	char wl_priv_value[1];
370 } wl_priv_param_t;
371 
372 typedef struct wl_dev_depend {
373 	uint32_t wl_dev_depend_num;
374 	uint32_t wl_dev_depend_ret_idx;
375 	wl_priv_param_t wl_dev_depend_priv[1];
376 } wl_dev_depend_t;
377 
378 typedef struct wlan_ver {
379 	uint32_t wl_ver_major;
380 	uint32_t wl_ver_minor;
381 } wlan_ver_t;
382 
383 typedef struct wldp {
384 	uint32_t wldp_length;
385 	uint32_t wldp_type;
386 	uint32_t wldp_result;
387 	uint32_t wldp_id;
388 	uint32_t wldp_buf[1];
389 } wldp_t;
390 
391 #ifdef __cplusplus
392 }
393 #endif
394 
395 #endif /* __WIFI_IOCTL_H */
396