xref: /onnv-gate/usr/src/uts/common/net/wpa.h (revision 4126:31652d91f33e)
1*4126Szf162725 /*
2*4126Szf162725  * CDDL HEADER START
3*4126Szf162725  *
4*4126Szf162725  * The contents of this file are subject to the terms of the
5*4126Szf162725  * Common Development and Distribution License (the "License").
6*4126Szf162725  * You may not use this file except in compliance with the License.
7*4126Szf162725  *
8*4126Szf162725  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*4126Szf162725  * or http://www.opensolaris.org/os/licensing.
10*4126Szf162725  * See the License for the specific language governing permissions
11*4126Szf162725  * and limitations under the License.
12*4126Szf162725  *
13*4126Szf162725  * When distributing Covered Code, include this CDDL HEADER in each
14*4126Szf162725  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*4126Szf162725  * If applicable, add the following below this CDDL HEADER, with the
16*4126Szf162725  * fields enclosed by brackets "[]" replaced with your own identifying
17*4126Szf162725  * information: Portions Copyright [yyyy] [name of copyright owner]
18*4126Szf162725  *
19*4126Szf162725  * CDDL HEADER END
20*4126Szf162725  */
21*4126Szf162725 /*
22*4126Szf162725  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23*4126Szf162725  * Use is subject to license terms.
24*4126Szf162725  */
25*4126Szf162725 
26*4126Szf162725 /*
27*4126Szf162725  * Macro and data structures defined for 802.11i.
28*4126Szf162725  */
29*4126Szf162725 
30*4126Szf162725 #ifndef	__WPA_H
31*4126Szf162725 #define	__WPA_H
32*4126Szf162725 
33*4126Szf162725 #pragma ident	"%Z%%M%	%I%	%E% SMI"
34*4126Szf162725 
35*4126Szf162725 #include <sys/types.h>
36*4126Szf162725 #include <inet/wifi_ioctl.h>
37*4126Szf162725 
38*4126Szf162725 #ifdef	__cplusplus
39*4126Szf162725 extern "C" {
40*4126Szf162725 #endif
41*4126Szf162725 
42*4126Szf162725 #define	SERVICE_NAME			"network/wpa"
43*4126Szf162725 #define	WPA_DOOR 			"/var/run/wpa_door"
44*4126Szf162725 #define	SVC_METHOD			"/usr/lib/inet/wpad"
45*4126Szf162725 
46*4126Szf162725 #define	IEEE80211_ADDR_LEN		6
47*4126Szf162725 #define	IEEE80211_MAX_WPA_IE		40	/* IEEE802.11i */
48*4126Szf162725 #define	WPA_STRSIZE			256
49*4126Szf162725 /*
50*4126Szf162725  * Max size of optional information elements.  We artificially
51*4126Szf162725  * constrain this; it's limited only by the max frame size (and
52*4126Szf162725  * the max parameter size of the wireless extensions).
53*4126Szf162725  */
54*4126Szf162725 #define	IEEE80211_MAX_OPT_IE		256
55*4126Szf162725 
56*4126Szf162725 /*
57*4126Szf162725  * Parameters.
58*4126Szf162725  * WL_WPA_BASE + 0x1, 5, 6 reserved to be compatible with FreeBSD.
59*4126Szf162725  */
60*4126Szf162725 #define	WL_WPA_BASE			(WL_PARAMETERS_BASE + 0x500)
61*4126Szf162725 #define	WL_SETOPTIE			(WL_WPA_BASE + 0x0)
62*4126Szf162725 #define	WL_WPA				(WL_WPA_BASE + 0x2)
63*4126Szf162725 #define	WL_KEY				(WL_WPA_BASE + 0x3)
64*4126Szf162725 #define	WL_DELKEY			(WL_WPA_BASE + 0x4)
65*4126Szf162725 #define	WL_SCANRESULTS			(WL_WPA_BASE + 0x7)
66*4126Szf162725 #define	WL_MLME				(WL_WPA_BASE + 0x8)
67*4126Szf162725 #define	WL_CAPABILITY			(WL_WPA_BASE + 0x9)
68*4126Szf162725 
69*4126Szf162725 typedef struct wl_wpa_ie {
70*4126Szf162725     uint32_t	wpa_ie_len;
71*4126Szf162725     char 	wpa_ie[1];	/* it's the head of wpa_ie */
72*4126Szf162725 } wl_wpa_ie_t;
73*4126Szf162725 
74*4126Szf162725 typedef struct wl_wpa {
75*4126Szf162725     uint32_t	wpa_flag;
76*4126Szf162725 } wl_wpa_t;
77*4126Szf162725 
78*4126Szf162725 typedef struct wl_capability {
79*4126Szf162725     uint32_t	caps;
80*4126Szf162725 } wl_capability_t;
81*4126Szf162725 
82*4126Szf162725 #define	IEEE80211_KEYBUF_SIZE		16	/* 128-bit TKIP & CCMP key */
83*4126Szf162725 #define	IEEE80211_MICBUF_SIZE		(8+8)	/* 8 byte tx, 8 byte rx */
84*4126Szf162725 
85*4126Szf162725 /*
86*4126Szf162725  * NB: these values are ordered carefully; there are lots of
87*4126Szf162725  * of implications in any reordering.  In particular beware
88*4126Szf162725  * that 4 is not used to avoid conflicting with IEEE80211_F_PRIVACY.
89*4126Szf162725  */
90*4126Szf162725 #define	IEEE80211_CIPHER_WEP		0
91*4126Szf162725 #define	IEEE80211_CIPHER_TKIP		1
92*4126Szf162725 #define	IEEE80211_CIPHER_AES_OCB	2
93*4126Szf162725 #define	IEEE80211_CIPHER_AES_CCM	3
94*4126Szf162725 #define	IEEE80211_CIPHER_CKIP		4
95*4126Szf162725 #define	IEEE80211_CIPHER_NONE		5	/* pseudo value */
96*4126Szf162725 
97*4126Szf162725 #define	IEEE80211_CIPHER_MAX		(IEEE80211_CIPHER_NONE+1)
98*4126Szf162725 
99*4126Szf162725 /* Key Flags */
100*4126Szf162725 #define	IEEE80211_KEY_XMIT		0x01	/* key used for xmit */
101*4126Szf162725 #define	IEEE80211_KEY_RECV		0x02	/* key used for recv */
102*4126Szf162725 
103*4126Szf162725 #define	IEEE80211_KEY_DEFAULT		0x80	/* default xmit key */
104*4126Szf162725 
105*4126Szf162725 /*
106*4126Szf162725  * WPA/RSN get/set key request.  Specify the key/cipher
107*4126Szf162725  * type and whether the key is to be used for sending and/or
108*4126Szf162725  * receiving.  The key index should be set only when working
109*4126Szf162725  * with global keys (use IEEE80211_KEYIX_NONE for ``no index'').
110*4126Szf162725  * Otherwise a unicast/pairwise key is specified by the bssid
111*4126Szf162725  * (on a station) or mac address (on an ap).  They key length
112*4126Szf162725  * must include any MIC key data; otherwise it should be no
113*4126Szf162725  * more than IEEE80211_KEYBUF_SIZE.
114*4126Szf162725  */
115*4126Szf162725 #pragma pack(1)
116*4126Szf162725 typedef struct wl_key {
117*4126Szf162725 	uint8_t		ik_type;	/* key/cipher type */
118*4126Szf162725 	uint8_t		ik_pad;
119*4126Szf162725 
120*4126Szf162725 	uint16_t	ik_keyix;	/* key index */
121*4126Szf162725 	uint8_t		ik_keylen;	/* key length in bytes */
122*4126Szf162725 	uint8_t		ik_flags;
123*4126Szf162725 
124*4126Szf162725 	uint8_t		ik_macaddr[IEEE80211_ADDR_LEN];
125*4126Szf162725 	uint64_t	ik_keyrsc;	/* key receive sequence counter */
126*4126Szf162725 	uint64_t	ik_keytsc;	/* key transmit sequence counter */
127*4126Szf162725 
128*4126Szf162725 	uint8_t ik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];
129*4126Szf162725 } wl_key_t;
130*4126Szf162725 #pragma pack()
131*4126Szf162725 
132*4126Szf162725 struct wpa_ess {
133*4126Szf162725 	uint8_t		bssid[IEEE80211_ADDR_LEN];
134*4126Szf162725 	uint8_t		ssid[MAX_ESSID_LENGTH];
135*4126Szf162725 	uint32_t	ssid_len;
136*4126Szf162725 
137*4126Szf162725 	uint8_t		wpa_ie[IEEE80211_MAX_WPA_IE];
138*4126Szf162725 	uint32_t	wpa_ie_len;
139*4126Szf162725 	int		freq;
140*4126Szf162725 };
141*4126Szf162725 
142*4126Szf162725 typedef struct wl_del_key {
143*4126Szf162725 	uint8_t		idk_keyix;	/* key index */
144*4126Szf162725 	uint8_t		idk_macaddr[IEEE80211_ADDR_LEN];
145*4126Szf162725 }wl_del_key_t;
146*4126Szf162725 
147*4126Szf162725 typedef struct wl_countermeasures {
148*4126Szf162725 	uint32_t	cm_flag;
149*4126Szf162725 } wl_countermeasures_t;
150*4126Szf162725 
151*4126Szf162725 typedef struct wl_drop_unenc {
152*4126Szf162725 	uint32_t	drop_flag;
153*4126Szf162725 } wl_drop_unenc_t;
154*4126Szf162725 
155*4126Szf162725 typedef struct wl_wpa_ess {
156*4126Szf162725 	uint32_t	count;
157*4126Szf162725 	struct wpa_ess	ess[1];
158*4126Szf162725 } wl_wpa_ess_t;
159*4126Szf162725 
160*4126Szf162725 #define	IEEE80211_MLME_ASSOC		1	/* associate station */
161*4126Szf162725 #define	IEEE80211_MLME_DISASSOC		2	/* disassociate station */
162*4126Szf162725 #define	IEEE80211_MLME_DEAUTH		3	/* deauthenticate station */
163*4126Szf162725 #define	IEEE80211_MLME_AUTHORIZE	4	/* authorize station */
164*4126Szf162725 #define	IEEE80211_MLME_UNAUTHORIZE	5	/* unauthorize station */
165*4126Szf162725 
166*4126Szf162725 /*
167*4126Szf162725  *  * MLME state manipulation request.  IEEE80211_MLME_ASSOC
168*4126Szf162725  *   * only makes sense when operating as a station.  The other
169*4126Szf162725  *    * requests can be used when operating as a station or an
170*4126Szf162725  *     * ap (to effect a station).
171*4126Szf162725  */
172*4126Szf162725 typedef struct wl_mlme {
173*4126Szf162725 	uint8_t		im_op;		/* operation to perform */
174*4126Szf162725 	uint16_t	im_reason;	/* 802.11 reason code */
175*4126Szf162725 	uint8_t		im_macaddr[IEEE80211_ADDR_LEN];
176*4126Szf162725 } wl_mlme_t;
177*4126Szf162725 
178*4126Szf162725 /*
179*4126Szf162725  * State machine events
180*4126Szf162725  */
181*4126Szf162725 typedef enum {
182*4126Szf162725 	EVENT_ASSOC,
183*4126Szf162725 	EVENT_DISASSOC,
184*4126Szf162725 	EVENT_SCAN_RESULTS
185*4126Szf162725 } wpa_event_type;
186*4126Szf162725 
187*4126Szf162725 typedef struct  wl_events {
188*4126Szf162725 	wpa_event_type	event;
189*4126Szf162725 } wl_events_t;
190*4126Szf162725 
191*4126Szf162725 #ifdef __cplusplus
192*4126Szf162725 }
193*4126Szf162725 #endif
194*4126Szf162725 
195*4126Szf162725 #endif /* __WPA_H */
196