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