1*3871Syz147064 /*
2*3871Syz147064  * CDDL HEADER START
3*3871Syz147064  *
4*3871Syz147064  * The contents of this file are subject to the terms of the
5*3871Syz147064  * Common Development and Distribution License (the "License").
6*3871Syz147064  * You may not use this file except in compliance with the License.
7*3871Syz147064  *
8*3871Syz147064  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*3871Syz147064  * or http://www.opensolaris.org/os/licensing.
10*3871Syz147064  * See the License for the specific language governing permissions
11*3871Syz147064  * and limitations under the License.
12*3871Syz147064  *
13*3871Syz147064  * When distributing Covered Code, include this CDDL HEADER in each
14*3871Syz147064  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*3871Syz147064  * If applicable, add the following below this CDDL HEADER, with the
16*3871Syz147064  * fields enclosed by brackets "[]" replaced with your own identifying
17*3871Syz147064  * information: Portions Copyright [yyyy] [name of copyright owner]
18*3871Syz147064  *
19*3871Syz147064  * CDDL HEADER END
20*3871Syz147064  */
21*3871Syz147064 /*
22*3871Syz147064  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23*3871Syz147064  * Use is subject to license terms.
24*3871Syz147064  */
25*3871Syz147064 
26*3871Syz147064 #ifndef _LIBDLWLAN_IMPL_H
27*3871Syz147064 #define	_LIBDLWLAN_IMPL_H
28*3871Syz147064 
29*3871Syz147064 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*3871Syz147064 
31*3871Syz147064 #include <sys/types.h>
32*3871Syz147064 #include <inet/wifi_ioctl.h>
33*3871Syz147064 
34*3871Syz147064 /*
35*3871Syz147064  * Implementation-private data structures, macros, and constants.
36*3871Syz147064  */
37*3871Syz147064 
38*3871Syz147064 #ifdef	__cplusplus
39*3871Syz147064 extern "C" {
40*3871Syz147064 #endif
41*3871Syz147064 
42*3871Syz147064 /*
43*3871Syz147064  * Map a signal value from 0-15 into an enumerated strength.  Since there are
44*3871Syz147064  * 5 strengths but 16 values, by convention the "middle" strength gets the
45*3871Syz147064  * extra value.  Thus, the buckets are 0-2, 3-5, 6-9, 10-12, and 13-15.
46*3871Syz147064  */
47*3871Syz147064 #define	DLADM_WLAN_SIGNAL2STRENGTH(signal)			\
48*3871Syz147064 	    (((signal) > 12 ? DLADM_WLAN_STRENGTH_EXCELLENT :	\
49*3871Syz147064 	    ((signal) > 9 ? DLADM_WLAN_STRENGTH_VERY_GOOD : 	\
50*3871Syz147064 	    ((signal) > 5 ? DLADM_WLAN_STRENGTH_GOOD :		\
51*3871Syz147064 	    ((signal) > 2 ? DLADM_WLAN_STRENGTH_WEAK :		\
52*3871Syz147064 	    DLADM_WLAN_STRENGTH_VERY_WEAK)))))
53*3871Syz147064 
54*3871Syz147064 /*
55*3871Syz147064  * Convert between an OFDM MHz and a channel number.
56*3871Syz147064  */
57*3871Syz147064 #define	DLADM_WLAN_OFDM2CHAN(mhz)		(((mhz) - 5000) / 5)
58*3871Syz147064 
59*3871Syz147064 #define	DLADM_WLAN_CONNECT_POLLRATE		200 /* milliseconds */
60*3871Syz147064 #define	DLADM_WLAN_CONNECT_DEFAULT_CHANNEL	1
61*3871Syz147064 
62*3871Syz147064 #define	DLADM_WLAN_MAX_RATES	4
63*3871Syz147064 typedef	struct dladm_wlan_rates {
64*3871Syz147064 	uint8_t		wr_rates[DLADM_WLAN_MAX_RATES];
65*3871Syz147064 	int		wr_cnt;
66*3871Syz147064 } dladm_wlan_rates_t;
67*3871Syz147064 
68*3871Syz147064 typedef enum {
69*3871Syz147064 	DLADM_WLAN_RADIO_ON = 1,
70*3871Syz147064 	DLADM_WLAN_RADIO_OFF
71*3871Syz147064 } dladm_wlan_radio_t;
72*3871Syz147064 
73*3871Syz147064 typedef	enum {
74*3871Syz147064 	DLADM_WLAN_PM_OFF = 1,
75*3871Syz147064 	DLADM_WLAN_PM_MAX,
76*3871Syz147064 	DLADM_WLAN_PM_FAST
77*3871Syz147064 } dladm_wlan_powermode_t;
78*3871Syz147064 
79*3871Syz147064 #ifdef	__cplusplus
80*3871Syz147064 }
81*3871Syz147064 #endif
82*3871Syz147064 
83*3871Syz147064 #endif	/* _LIBDLWLAN_IMPL_H */
84