xref: /titanic_50/usr/src/uts/common/net/wpa.h (revision 895ca178e38ac3583d0c0d8317d51dc5f388df6e)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
34 
35 #include <inet/wifi_ioctl.h>
36 #include <sys/net80211_crypto.h>
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 #define	SERVICE_NAME		"network/wpa"
43 #define	WPA_DOOR 		"/var/run/wpa_door"
44 #define	SVC_METHOD		"/usr/lib/inet/wpad"
45 
46 /*
47  * Parameters.
48  */
49 #define	WL_WPA_BASE		(WL_PARAMETERS_BASE + 0x500)
50 #define	WL_SETOPTIE		(WL_WPA_BASE + 0x0)
51 #define	WL_WPA			(WL_WPA_BASE + 0x2)
52 #define	WL_KEY			(WL_WPA_BASE + 0x3)
53 #define	WL_DELKEY		(WL_WPA_BASE + 0x4)
54 #define	WL_SCANRESULTS		(WL_WPA_BASE + 0x7)
55 #define	WL_MLME			(WL_WPA_BASE + 0x8)
56 #define	WL_CAPABILITY		(WL_WPA_BASE + 0x9)
57 
58 typedef struct wl_wpa_ie {
59 	uint32_t	wpa_ie_len;
60 	char		wpa_ie[1];	/* it's the head of wpa_ie */
61 } wl_wpa_ie_t;
62 
63 typedef struct wl_wpa {
64 	uint32_t	wpa_flag;
65 } wl_wpa_t;
66 
67 typedef struct wl_capability {
68 	uint32_t	caps;
69 } wl_capability_t;
70 
71 /*
72  * WPA/RSN get/set key request.
73  * ik_type  : wep/tkip/aes
74  * ik_keyix : should be between 0 and 3, 0 will be used as default key.
75  * ik_keylen: key length in bytes.
76  * ik_keydata and ik_keylen include the DATA key and MIC key.
77  * ik_keyrsc/ik_keytsc: rx/tx seq number.
78  */
79 #pragma pack(1)
80 typedef struct wl_key {
81 	uint8_t		ik_type;
82 	uint8_t		ik_pad;
83 
84 	uint16_t	ik_keyix;
85 	uint8_t		ik_keylen;
86 	uint8_t		ik_flags;
87 
88 	uint8_t		ik_macaddr[IEEE80211_ADDR_LEN];
89 	uint64_t	ik_keyrsc;
90 	uint64_t	ik_keytsc;
91 
92 	uint8_t ik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];
93 } wl_key_t;
94 #pragma pack()
95 
96 typedef struct wl_del_key {
97 	uint8_t		idk_keyix;
98 	uint8_t		idk_macaddr[IEEE80211_ADDR_LEN];
99 } wl_del_key_t;
100 
101 struct wpa_ess {
102 	uint8_t		bssid[IEEE80211_ADDR_LEN];
103 	uint8_t		ssid[MAX_ESSID_LENGTH];
104 	uint32_t	ssid_len;
105 
106 	uint8_t		wpa_ie[IEEE80211_MAX_WPA_IE];
107 	uint32_t	wpa_ie_len;
108 	int		freq;
109 };
110 
111 typedef struct wl_wpa_ess {
112 	uint32_t	count;
113 	struct wpa_ess	ess[1];
114 } wl_wpa_ess_t;
115 
116 /*
117  * structure for WL_MLME state manipulation request.
118  * im_op: operations include auth/deauth/assoc/disassoc,
119  * im_reason: 802.11 reason code
120  */
121 typedef struct wl_mlme {
122 	uint8_t		im_op;
123 	uint16_t	im_reason;
124 	uint8_t		im_macaddr[IEEE80211_ADDR_LEN];
125 } wl_mlme_t;
126 
127 /*
128  * State machine events
129  */
130 typedef enum {
131 	EVENT_ASSOC,
132 	EVENT_DISASSOC,
133 	EVENT_SCAN_RESULTS
134 } wpa_event_type;
135 
136 typedef struct  wl_events {
137 	wpa_event_type	event;
138 } wl_events_t;
139 
140 #ifdef __cplusplus
141 }
142 #endif
143 
144 #endif /* __WPA_H */
145