blob: 60820536f31ed9eeb549836d0eb8060e529097fc [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * WPA Supplicant - Common definitions
3 * Copyright (c) 2004-2008, Jouni Malinen <j@w1.fi>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
11 *
12 * See README and COPYING for more details.
13 */
14
15#ifndef DEFS_H
16#define DEFS_H
17
18#ifdef FALSE
19#undef FALSE
20#endif
21#ifdef TRUE
22#undef TRUE
23#endif
24typedef enum { FALSE = 0, TRUE = 1 } Boolean;
25
26
27#define WPA_CIPHER_NONE BIT(0)
28#define WPA_CIPHER_WEP40 BIT(1)
29#define WPA_CIPHER_WEP104 BIT(2)
30#define WPA_CIPHER_TKIP BIT(3)
31#define WPA_CIPHER_CCMP BIT(4)
32#ifdef CONFIG_IEEE80211W
33#define WPA_CIPHER_AES_128_CMAC BIT(5)
34#endif /* CONFIG_IEEE80211W */
35
36#define WPA_KEY_MGMT_IEEE8021X BIT(0)
37#define WPA_KEY_MGMT_PSK BIT(1)
38#define WPA_KEY_MGMT_NONE BIT(2)
39#define WPA_KEY_MGMT_IEEE8021X_NO_WPA BIT(3)
40#define WPA_KEY_MGMT_WPA_NONE BIT(4)
41#define WPA_KEY_MGMT_FT_IEEE8021X BIT(5)
42#define WPA_KEY_MGMT_FT_PSK BIT(6)
43#define WPA_KEY_MGMT_IEEE8021X_SHA256 BIT(7)
44#define WPA_KEY_MGMT_PSK_SHA256 BIT(8)
45#define WPA_KEY_MGMT_WPS BIT(9)
46
47static inline int wpa_key_mgmt_wpa_ieee8021x(int akm)
48{
49 return !!(akm & (WPA_KEY_MGMT_IEEE8021X |
50 WPA_KEY_MGMT_FT_IEEE8021X |
51 WPA_KEY_MGMT_IEEE8021X_SHA256));
52}
53
54static inline int wpa_key_mgmt_wpa_psk(int akm)
55{
56 return !!(akm & (WPA_KEY_MGMT_PSK |
57 WPA_KEY_MGMT_FT_PSK |
58 WPA_KEY_MGMT_PSK_SHA256));
59}
60
61static inline int wpa_key_mgmt_ft(int akm)
62{
63 return !!(akm & (WPA_KEY_MGMT_FT_PSK |
64 WPA_KEY_MGMT_FT_IEEE8021X));
65}
66
67static inline int wpa_key_mgmt_sha256(int akm)
68{
69 return !!(akm & (WPA_KEY_MGMT_PSK_SHA256 |
70 WPA_KEY_MGMT_IEEE8021X_SHA256));
71}
72
73static inline int wpa_key_mgmt_wpa(int akm)
74{
75 return wpa_key_mgmt_wpa_ieee8021x(akm) ||
76 wpa_key_mgmt_wpa_psk(akm);
77}
78
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -080079static inline int wpa_key_mgmt_wpa_any(int akm)
80{
81 return wpa_key_mgmt_wpa(akm) || (akm & WPA_KEY_MGMT_WPA_NONE);
82}
83
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070084
85#define WPA_PROTO_WPA BIT(0)
86#define WPA_PROTO_RSN BIT(1)
87
88#define WPA_AUTH_ALG_OPEN BIT(0)
89#define WPA_AUTH_ALG_SHARED BIT(1)
90#define WPA_AUTH_ALG_LEAP BIT(2)
91#define WPA_AUTH_ALG_FT BIT(3)
92
93
94enum wpa_alg {
95 WPA_ALG_NONE,
96 WPA_ALG_WEP,
97 WPA_ALG_TKIP,
98 WPA_ALG_CCMP,
99 WPA_ALG_IGTK,
100 WPA_ALG_PMK
101};
102
103/**
104 * enum wpa_cipher - Cipher suites
105 */
106enum wpa_cipher {
107 CIPHER_NONE,
108 CIPHER_WEP40,
109 CIPHER_TKIP,
110 CIPHER_CCMP,
111 CIPHER_WEP104
112};
113
114/**
115 * enum wpa_key_mgmt - Key management suites
116 */
117enum wpa_key_mgmt {
118 KEY_MGMT_802_1X,
119 KEY_MGMT_PSK,
120 KEY_MGMT_NONE,
121 KEY_MGMT_802_1X_NO_WPA,
122 KEY_MGMT_WPA_NONE,
123 KEY_MGMT_FT_802_1X,
124 KEY_MGMT_FT_PSK,
125 KEY_MGMT_802_1X_SHA256,
126 KEY_MGMT_PSK_SHA256,
127 KEY_MGMT_WPS
128};
129
130/**
131 * enum wpa_states - wpa_supplicant state
132 *
133 * These enumeration values are used to indicate the current wpa_supplicant
134 * state (wpa_s->wpa_state). The current state can be retrieved with
135 * wpa_supplicant_get_state() function and the state can be changed by calling
136 * wpa_supplicant_set_state(). In WPA state machine (wpa.c and preauth.c), the
137 * wrapper functions wpa_sm_get_state() and wpa_sm_set_state() should be used
138 * to access the state variable.
139 */
140enum wpa_states {
141 /**
142 * WPA_DISCONNECTED - Disconnected state
143 *
144 * This state indicates that client is not associated, but is likely to
145 * start looking for an access point. This state is entered when a
146 * connection is lost.
147 */
148 WPA_DISCONNECTED,
149
150 /**
151 * WPA_INTERFACE_DISABLED - Interface disabled
152 *
153 * This stat eis entered if the network interface is disabled, e.g.,
154 * due to rfkill. wpa_supplicant refuses any new operations that would
155 * use the radio until the interface has been enabled.
156 */
157 WPA_INTERFACE_DISABLED,
158
159 /**
160 * WPA_INACTIVE - Inactive state (wpa_supplicant disabled)
161 *
162 * This state is entered if there are no enabled networks in the
163 * configuration. wpa_supplicant is not trying to associate with a new
164 * network and external interaction (e.g., ctrl_iface call to add or
165 * enable a network) is needed to start association.
166 */
167 WPA_INACTIVE,
168
169 /**
170 * WPA_SCANNING - Scanning for a network
171 *
172 * This state is entered when wpa_supplicant starts scanning for a
173 * network.
174 */
175 WPA_SCANNING,
176
177 /**
178 * WPA_AUTHENTICATING - Trying to authenticate with a BSS/SSID
179 *
180 * This state is entered when wpa_supplicant has found a suitable BSS
181 * to authenticate with and the driver is configured to try to
182 * authenticate with this BSS. This state is used only with drivers
183 * that use wpa_supplicant as the SME.
184 */
185 WPA_AUTHENTICATING,
186
187 /**
188 * WPA_ASSOCIATING - Trying to associate with a BSS/SSID
189 *
190 * This state is entered when wpa_supplicant has found a suitable BSS
191 * to associate with and the driver is configured to try to associate
192 * with this BSS in ap_scan=1 mode. When using ap_scan=2 mode, this
193 * state is entered when the driver is configured to try to associate
194 * with a network using the configured SSID and security policy.
195 */
196 WPA_ASSOCIATING,
197
198 /**
199 * WPA_ASSOCIATED - Association completed
200 *
201 * This state is entered when the driver reports that association has
202 * been successfully completed with an AP. If IEEE 802.1X is used
203 * (with or without WPA/WPA2), wpa_supplicant remains in this state
204 * until the IEEE 802.1X/EAPOL authentication has been completed.
205 */
206 WPA_ASSOCIATED,
207
208 /**
209 * WPA_4WAY_HANDSHAKE - WPA 4-Way Key Handshake in progress
210 *
211 * This state is entered when WPA/WPA2 4-Way Handshake is started. In
212 * case of WPA-PSK, this happens when receiving the first EAPOL-Key
213 * frame after association. In case of WPA-EAP, this state is entered
214 * when the IEEE 802.1X/EAPOL authentication has been completed.
215 */
216 WPA_4WAY_HANDSHAKE,
217
218 /**
219 * WPA_GROUP_HANDSHAKE - WPA Group Key Handshake in progress
220 *
221 * This state is entered when 4-Way Key Handshake has been completed
222 * (i.e., when the supplicant sends out message 4/4) and when Group
223 * Key rekeying is started by the AP (i.e., when supplicant receives
224 * message 1/2).
225 */
226 WPA_GROUP_HANDSHAKE,
227
228 /**
229 * WPA_COMPLETED - All authentication completed
230 *
231 * This state is entered when the full authentication process is
232 * completed. In case of WPA2, this happens when the 4-Way Handshake is
233 * successfully completed. With WPA, this state is entered after the
234 * Group Key Handshake; with IEEE 802.1X (non-WPA) connection is
235 * completed after dynamic keys are received (or if not used, after
236 * the EAP authentication has been completed). With static WEP keys and
237 * plaintext connections, this state is entered when an association
238 * has been completed.
239 *
240 * This state indicates that the supplicant has completed its
241 * processing for the association phase and that data connection is
242 * fully configured.
243 */
244 WPA_COMPLETED
245};
246
247#define MLME_SETPROTECTION_PROTECT_TYPE_NONE 0
248#define MLME_SETPROTECTION_PROTECT_TYPE_RX 1
249#define MLME_SETPROTECTION_PROTECT_TYPE_TX 2
250#define MLME_SETPROTECTION_PROTECT_TYPE_RX_TX 3
251
252#define MLME_SETPROTECTION_KEY_TYPE_GROUP 0
253#define MLME_SETPROTECTION_KEY_TYPE_PAIRWISE 1
254
255
256/**
257 * enum mfp_options - Management frame protection (IEEE 802.11w) options
258 */
259enum mfp_options {
260 NO_MGMT_FRAME_PROTECTION = 0,
261 MGMT_FRAME_PROTECTION_OPTIONAL = 1,
262 MGMT_FRAME_PROTECTION_REQUIRED = 2
263};
264
265/**
266 * enum hostapd_hw_mode - Hardware mode
267 */
268enum hostapd_hw_mode {
269 HOSTAPD_MODE_IEEE80211B,
270 HOSTAPD_MODE_IEEE80211G,
271 HOSTAPD_MODE_IEEE80211A,
272 NUM_HOSTAPD_MODES
273};
274
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800275/**
276 * enum wpa_ctrl_req_type - Control interface request types
277 */
278enum wpa_ctrl_req_type {
279 WPA_CTRL_REQ_UNKNOWN,
280 WPA_CTRL_REQ_EAP_IDENTITY,
281 WPA_CTRL_REQ_EAP_PASSWORD,
282 WPA_CTRL_REQ_EAP_NEW_PASSWORD,
283 WPA_CTRL_REQ_EAP_PIN,
284 WPA_CTRL_REQ_EAP_OTP,
285 WPA_CTRL_REQ_EAP_PASSPHRASE,
286 NUM_WPA_CTRL_REQS
287};
288
289/* Maximum number of EAP methods to store for EAP server user information */
290#define EAP_MAX_METHODS 8
291
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700292#endif /* DEFS_H */