xref: /illumos-gate/usr/src/uts/common/net/wpa.h (revision fb91fd8a)
1a399b765Szf /*
2a399b765Szf  * CDDL HEADER START
3a399b765Szf  *
4a399b765Szf  * The contents of this file are subject to the terms of the
5a399b765Szf  * Common Development and Distribution License (the "License").
6a399b765Szf  * You may not use this file except in compliance with the License.
7a399b765Szf  *
8a399b765Szf  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9a399b765Szf  * or http://www.opensolaris.org/os/licensing.
10a399b765Szf  * See the License for the specific language governing permissions
11a399b765Szf  * and limitations under the License.
12a399b765Szf  *
13a399b765Szf  * When distributing Covered Code, include this CDDL HEADER in each
14a399b765Szf  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15a399b765Szf  * If applicable, add the following below this CDDL HEADER, with the
16a399b765Szf  * fields enclosed by brackets "[]" replaced with your own identifying
17a399b765Szf  * information: Portions Copyright [yyyy] [name of copyright owner]
18a399b765Szf  *
19a399b765Szf  * CDDL HEADER END
20a399b765Szf  */
21a399b765Szf /*
22*fb91fd8aSzf  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23a399b765Szf  * Use is subject to license terms.
24a399b765Szf  */
25a399b765Szf 
26a399b765Szf /*
27a399b765Szf  * Macro and data structures defined for 802.11i.
28a399b765Szf  */
29a399b765Szf 
30a399b765Szf #ifndef	__WPA_H
31a399b765Szf #define	__WPA_H
32a399b765Szf 
33a399b765Szf #pragma ident	"%Z%%M%	%I%	%E% SMI"
34a399b765Szf 
35a399b765Szf #include <inet/wifi_ioctl.h>
36*fb91fd8aSzf #include <sys/net80211_crypto.h>
37a399b765Szf 
38a399b765Szf #ifdef	__cplusplus
39a399b765Szf extern "C" {
40a399b765Szf #endif
41a399b765Szf 
42*fb91fd8aSzf #define	SERVICE_NAME		"network/wpa"
43*fb91fd8aSzf #define	WPA_DOOR 		"/var/run/wpa_door"
44*fb91fd8aSzf #define	SVC_METHOD		"/usr/lib/inet/wpad"
45a399b765Szf 
46a399b765Szf /*
47a399b765Szf  * Parameters.
48a399b765Szf  */
49*fb91fd8aSzf #define	WL_WPA_BASE		(WL_PARAMETERS_BASE + 0x500)
50*fb91fd8aSzf #define	WL_SETOPTIE		(WL_WPA_BASE + 0x0)
51*fb91fd8aSzf #define	WL_WPA			(WL_WPA_BASE + 0x2)
52*fb91fd8aSzf #define	WL_KEY			(WL_WPA_BASE + 0x3)
53*fb91fd8aSzf #define	WL_DELKEY		(WL_WPA_BASE + 0x4)
54*fb91fd8aSzf #define	WL_SCANRESULTS		(WL_WPA_BASE + 0x7)
55*fb91fd8aSzf #define	WL_MLME			(WL_WPA_BASE + 0x8)
56*fb91fd8aSzf #define	WL_CAPABILITY		(WL_WPA_BASE + 0x9)
57a399b765Szf 
58a399b765Szf typedef struct wl_wpa_ie {
59*fb91fd8aSzf 	uint32_t	wpa_ie_len;
60*fb91fd8aSzf 	char		wpa_ie[1];	/* it's the head of wpa_ie */
61a399b765Szf } wl_wpa_ie_t;
62a399b765Szf 
63a399b765Szf typedef struct wl_wpa {
64*fb91fd8aSzf 	uint32_t	wpa_flag;
65a399b765Szf } wl_wpa_t;
66a399b765Szf 
67a399b765Szf typedef struct wl_capability {
68*fb91fd8aSzf 	uint32_t	caps;
69a399b765Szf } wl_capability_t;
70a399b765Szf 
71a399b765Szf /*
72*fb91fd8aSzf  * WPA/RSN get/set key request.
73*fb91fd8aSzf  * ik_type  : wep/tkip/aes
74*fb91fd8aSzf  * ik_keyix : should be between 0 and 3, 0 will be used as default key.
75*fb91fd8aSzf  * ik_keylen: key length in bytes.
76*fb91fd8aSzf  * ik_keydata and ik_keylen include the DATA key and MIC key.
77*fb91fd8aSzf  * ik_keyrsc/ik_keytsc: rx/tx seq number.
78a399b765Szf  */
79a399b765Szf #pragma pack(1)
80a399b765Szf typedef struct wl_key {
81*fb91fd8aSzf 	uint8_t		ik_type;
82a399b765Szf 	uint8_t		ik_pad;
83a399b765Szf 
84*fb91fd8aSzf 	uint16_t	ik_keyix;
85*fb91fd8aSzf 	uint8_t		ik_keylen;
86a399b765Szf 	uint8_t		ik_flags;
87a399b765Szf 
88a399b765Szf 	uint8_t		ik_macaddr[IEEE80211_ADDR_LEN];
89*fb91fd8aSzf 	uint64_t	ik_keyrsc;
90*fb91fd8aSzf 	uint64_t	ik_keytsc;
91a399b765Szf 
92a399b765Szf 	uint8_t ik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];
93a399b765Szf } wl_key_t;
94a399b765Szf #pragma pack()
95a399b765Szf 
96*fb91fd8aSzf typedef struct wl_del_key {
97*fb91fd8aSzf 	uint8_t		idk_keyix;
98*fb91fd8aSzf 	uint8_t		idk_macaddr[IEEE80211_ADDR_LEN];
99*fb91fd8aSzf } wl_del_key_t;
100*fb91fd8aSzf 
101a399b765Szf struct wpa_ess {
102a399b765Szf 	uint8_t		bssid[IEEE80211_ADDR_LEN];
103a399b765Szf 	uint8_t		ssid[MAX_ESSID_LENGTH];
104a399b765Szf 	uint32_t	ssid_len;
105a399b765Szf 
106a399b765Szf 	uint8_t		wpa_ie[IEEE80211_MAX_WPA_IE];
107a399b765Szf 	uint32_t	wpa_ie_len;
108a399b765Szf 	int		freq;
109a399b765Szf };
110a399b765Szf 
111a399b765Szf typedef struct wl_wpa_ess {
112a399b765Szf 	uint32_t	count;
113a399b765Szf 	struct wpa_ess	ess[1];
114a399b765Szf } wl_wpa_ess_t;
115a399b765Szf 
116a399b765Szf /*
117*fb91fd8aSzf  * structure for WL_MLME state manipulation request.
118*fb91fd8aSzf  * im_op: operations include auth/deauth/assoc/disassoc,
119*fb91fd8aSzf  * im_reason: 802.11 reason code
120a399b765Szf  */
121a399b765Szf typedef struct wl_mlme {
122*fb91fd8aSzf 	uint8_t		im_op;
123*fb91fd8aSzf 	uint16_t	im_reason;
124a399b765Szf 	uint8_t		im_macaddr[IEEE80211_ADDR_LEN];
125a399b765Szf } wl_mlme_t;
126a399b765Szf 
127a399b765Szf /*
128a399b765Szf  * State machine events
129a399b765Szf  */
130a399b765Szf typedef enum {
131a399b765Szf 	EVENT_ASSOC,
132a399b765Szf 	EVENT_DISASSOC,
133a399b765Szf 	EVENT_SCAN_RESULTS
134a399b765Szf } wpa_event_type;
135a399b765Szf 
136a399b765Szf typedef struct  wl_events {
137a399b765Szf 	wpa_event_type	event;
138a399b765Szf } wl_events_t;
139a399b765Szf 
140a399b765Szf #ifdef __cplusplus
141a399b765Szf }
142a399b765Szf #endif
143a399b765Szf 
144a399b765Szf #endif /* __WPA_H */
145