blob: 0c90c2498addef498926fd50903fb95198fdf1eb [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 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07007 */
8
9#ifndef DEFS_H
10#define DEFS_H
11
12#ifdef FALSE
13#undef FALSE
14#endif
15#ifdef TRUE
16#undef TRUE
17#endif
18typedef enum { FALSE = 0, TRUE = 1 } Boolean;
19
20
21#define WPA_CIPHER_NONE BIT(0)
22#define WPA_CIPHER_WEP40 BIT(1)
23#define WPA_CIPHER_WEP104 BIT(2)
24#define WPA_CIPHER_TKIP BIT(3)
25#define WPA_CIPHER_CCMP BIT(4)
26#ifdef CONFIG_IEEE80211W
27#define WPA_CIPHER_AES_128_CMAC BIT(5)
28#endif /* CONFIG_IEEE80211W */
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070029#define WPA_CIPHER_GCMP BIT(6)
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080030#define WPA_CIPHER_SMS4 BIT(7)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070031
32#define WPA_KEY_MGMT_IEEE8021X BIT(0)
33#define WPA_KEY_MGMT_PSK BIT(1)
34#define WPA_KEY_MGMT_NONE BIT(2)
35#define WPA_KEY_MGMT_IEEE8021X_NO_WPA BIT(3)
36#define WPA_KEY_MGMT_WPA_NONE BIT(4)
37#define WPA_KEY_MGMT_FT_IEEE8021X BIT(5)
38#define WPA_KEY_MGMT_FT_PSK BIT(6)
39#define WPA_KEY_MGMT_IEEE8021X_SHA256 BIT(7)
40#define WPA_KEY_MGMT_PSK_SHA256 BIT(8)
41#define WPA_KEY_MGMT_WPS BIT(9)
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080042#define WPA_KEY_MGMT_SAE BIT(10)
43#define WPA_KEY_MGMT_FT_SAE BIT(11)
44#define WPA_KEY_MGMT_WAPI_PSK BIT(12)
45#define WPA_KEY_MGMT_WAPI_CERT BIT(13)
46#define WPA_KEY_MGMT_CCKM BIT(14)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070047
48static inline int wpa_key_mgmt_wpa_ieee8021x(int akm)
49{
50 return !!(akm & (WPA_KEY_MGMT_IEEE8021X |
51 WPA_KEY_MGMT_FT_IEEE8021X |
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080052 WPA_KEY_MGMT_CCKM |
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070053 WPA_KEY_MGMT_IEEE8021X_SHA256));
54}
55
56static inline int wpa_key_mgmt_wpa_psk(int akm)
57{
58 return !!(akm & (WPA_KEY_MGMT_PSK |
59 WPA_KEY_MGMT_FT_PSK |
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080060 WPA_KEY_MGMT_PSK_SHA256 |
61 WPA_KEY_MGMT_SAE));
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070062}
63
64static inline int wpa_key_mgmt_ft(int akm)
65{
66 return !!(akm & (WPA_KEY_MGMT_FT_PSK |
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080067 WPA_KEY_MGMT_FT_IEEE8021X |
68 WPA_KEY_MGMT_FT_SAE));
69}
70
71static inline int wpa_key_mgmt_sae(int akm)
72{
73 return !!(akm & (WPA_KEY_MGMT_SAE |
74 WPA_KEY_MGMT_FT_SAE));
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070075}
76
77static inline int wpa_key_mgmt_sha256(int akm)
78{
79 return !!(akm & (WPA_KEY_MGMT_PSK_SHA256 |
80 WPA_KEY_MGMT_IEEE8021X_SHA256));
81}
82
83static inline int wpa_key_mgmt_wpa(int akm)
84{
85 return wpa_key_mgmt_wpa_ieee8021x(akm) ||
86 wpa_key_mgmt_wpa_psk(akm);
87}
88
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -080089static inline int wpa_key_mgmt_wpa_any(int akm)
90{
91 return wpa_key_mgmt_wpa(akm) || (akm & WPA_KEY_MGMT_WPA_NONE);
92}
93
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080094static inline int wpa_key_mgmt_cckm(int akm)
95{
96 return akm == WPA_KEY_MGMT_CCKM;
97}
98
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070099
100#define WPA_PROTO_WPA BIT(0)
101#define WPA_PROTO_RSN BIT(1)
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800102#define WPA_PROTO_WAPI BIT(2)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700103
104#define WPA_AUTH_ALG_OPEN BIT(0)
105#define WPA_AUTH_ALG_SHARED BIT(1)
106#define WPA_AUTH_ALG_LEAP BIT(2)
107#define WPA_AUTH_ALG_FT BIT(3)
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800108#define WPA_AUTH_ALG_SAE BIT(4)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700109
110
111enum wpa_alg {
112 WPA_ALG_NONE,
113 WPA_ALG_WEP,
114 WPA_ALG_TKIP,
115 WPA_ALG_CCMP,
116 WPA_ALG_IGTK,
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700117 WPA_ALG_PMK,
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800118 WPA_ALG_GCMP,
119 WPA_ALG_SMS4,
120 WPA_ALG_KRK
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700121};
122
123/**
124 * enum wpa_cipher - Cipher suites
125 */
126enum wpa_cipher {
127 CIPHER_NONE,
128 CIPHER_WEP40,
129 CIPHER_TKIP,
130 CIPHER_CCMP,
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700131 CIPHER_WEP104,
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800132 CIPHER_GCMP,
133 CIPHER_SMS4
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700134};
135
136/**
137 * enum wpa_key_mgmt - Key management suites
138 */
139enum wpa_key_mgmt {
140 KEY_MGMT_802_1X,
141 KEY_MGMT_PSK,
142 KEY_MGMT_NONE,
143 KEY_MGMT_802_1X_NO_WPA,
144 KEY_MGMT_WPA_NONE,
145 KEY_MGMT_FT_802_1X,
146 KEY_MGMT_FT_PSK,
147 KEY_MGMT_802_1X_SHA256,
148 KEY_MGMT_PSK_SHA256,
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800149 KEY_MGMT_WPS,
150 KEY_MGMT_SAE,
151 KEY_MGMT_FT_SAE,
152 KEY_MGMT_WAPI_PSK,
153 KEY_MGMT_WAPI_CERT,
154 KEY_MGMT_CCKM
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700155};
156
157/**
158 * enum wpa_states - wpa_supplicant state
159 *
160 * These enumeration values are used to indicate the current wpa_supplicant
161 * state (wpa_s->wpa_state). The current state can be retrieved with
162 * wpa_supplicant_get_state() function and the state can be changed by calling
163 * wpa_supplicant_set_state(). In WPA state machine (wpa.c and preauth.c), the
164 * wrapper functions wpa_sm_get_state() and wpa_sm_set_state() should be used
165 * to access the state variable.
166 */
167enum wpa_states {
168 /**
169 * WPA_DISCONNECTED - Disconnected state
170 *
171 * This state indicates that client is not associated, but is likely to
172 * start looking for an access point. This state is entered when a
173 * connection is lost.
174 */
175 WPA_DISCONNECTED,
176
177 /**
178 * WPA_INTERFACE_DISABLED - Interface disabled
179 *
180 * This stat eis entered if the network interface is disabled, e.g.,
181 * due to rfkill. wpa_supplicant refuses any new operations that would
182 * use the radio until the interface has been enabled.
183 */
184 WPA_INTERFACE_DISABLED,
185
186 /**
187 * WPA_INACTIVE - Inactive state (wpa_supplicant disabled)
188 *
189 * This state is entered if there are no enabled networks in the
190 * configuration. wpa_supplicant is not trying to associate with a new
191 * network and external interaction (e.g., ctrl_iface call to add or
192 * enable a network) is needed to start association.
193 */
194 WPA_INACTIVE,
195
196 /**
197 * WPA_SCANNING - Scanning for a network
198 *
199 * This state is entered when wpa_supplicant starts scanning for a
200 * network.
201 */
202 WPA_SCANNING,
203
204 /**
205 * WPA_AUTHENTICATING - Trying to authenticate with a BSS/SSID
206 *
207 * This state is entered when wpa_supplicant has found a suitable BSS
208 * to authenticate with and the driver is configured to try to
209 * authenticate with this BSS. This state is used only with drivers
210 * that use wpa_supplicant as the SME.
211 */
212 WPA_AUTHENTICATING,
213
214 /**
215 * WPA_ASSOCIATING - Trying to associate with a BSS/SSID
216 *
217 * This state is entered when wpa_supplicant has found a suitable BSS
218 * to associate with and the driver is configured to try to associate
219 * with this BSS in ap_scan=1 mode. When using ap_scan=2 mode, this
220 * state is entered when the driver is configured to try to associate
221 * with a network using the configured SSID and security policy.
222 */
223 WPA_ASSOCIATING,
224
225 /**
226 * WPA_ASSOCIATED - Association completed
227 *
228 * This state is entered when the driver reports that association has
229 * been successfully completed with an AP. If IEEE 802.1X is used
230 * (with or without WPA/WPA2), wpa_supplicant remains in this state
231 * until the IEEE 802.1X/EAPOL authentication has been completed.
232 */
233 WPA_ASSOCIATED,
234
235 /**
236 * WPA_4WAY_HANDSHAKE - WPA 4-Way Key Handshake in progress
237 *
238 * This state is entered when WPA/WPA2 4-Way Handshake is started. In
239 * case of WPA-PSK, this happens when receiving the first EAPOL-Key
240 * frame after association. In case of WPA-EAP, this state is entered
241 * when the IEEE 802.1X/EAPOL authentication has been completed.
242 */
243 WPA_4WAY_HANDSHAKE,
244
245 /**
246 * WPA_GROUP_HANDSHAKE - WPA Group Key Handshake in progress
247 *
248 * This state is entered when 4-Way Key Handshake has been completed
249 * (i.e., when the supplicant sends out message 4/4) and when Group
250 * Key rekeying is started by the AP (i.e., when supplicant receives
251 * message 1/2).
252 */
253 WPA_GROUP_HANDSHAKE,
254
255 /**
256 * WPA_COMPLETED - All authentication completed
257 *
258 * This state is entered when the full authentication process is
259 * completed. In case of WPA2, this happens when the 4-Way Handshake is
260 * successfully completed. With WPA, this state is entered after the
261 * Group Key Handshake; with IEEE 802.1X (non-WPA) connection is
262 * completed after dynamic keys are received (or if not used, after
263 * the EAP authentication has been completed). With static WEP keys and
264 * plaintext connections, this state is entered when an association
265 * has been completed.
266 *
267 * This state indicates that the supplicant has completed its
268 * processing for the association phase and that data connection is
269 * fully configured.
270 */
271 WPA_COMPLETED
272};
273
274#define MLME_SETPROTECTION_PROTECT_TYPE_NONE 0
275#define MLME_SETPROTECTION_PROTECT_TYPE_RX 1
276#define MLME_SETPROTECTION_PROTECT_TYPE_TX 2
277#define MLME_SETPROTECTION_PROTECT_TYPE_RX_TX 3
278
279#define MLME_SETPROTECTION_KEY_TYPE_GROUP 0
280#define MLME_SETPROTECTION_KEY_TYPE_PAIRWISE 1
281
282
283/**
284 * enum mfp_options - Management frame protection (IEEE 802.11w) options
285 */
286enum mfp_options {
287 NO_MGMT_FRAME_PROTECTION = 0,
288 MGMT_FRAME_PROTECTION_OPTIONAL = 1,
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800289 MGMT_FRAME_PROTECTION_REQUIRED = 2,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700290};
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800291#define MGMT_FRAME_PROTECTION_DEFAULT 3
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700292
293/**
294 * enum hostapd_hw_mode - Hardware mode
295 */
296enum hostapd_hw_mode {
297 HOSTAPD_MODE_IEEE80211B,
298 HOSTAPD_MODE_IEEE80211G,
299 HOSTAPD_MODE_IEEE80211A,
Dmitry Shmidta54fa5f2013-01-15 13:53:35 -0800300 HOSTAPD_MODE_IEEE80211AD,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700301 NUM_HOSTAPD_MODES
302};
303
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800304/**
305 * enum wpa_ctrl_req_type - Control interface request types
306 */
307enum wpa_ctrl_req_type {
308 WPA_CTRL_REQ_UNKNOWN,
309 WPA_CTRL_REQ_EAP_IDENTITY,
310 WPA_CTRL_REQ_EAP_PASSWORD,
311 WPA_CTRL_REQ_EAP_NEW_PASSWORD,
312 WPA_CTRL_REQ_EAP_PIN,
313 WPA_CTRL_REQ_EAP_OTP,
314 WPA_CTRL_REQ_EAP_PASSPHRASE,
Dmitry Shmidt051af732013-10-22 13:52:46 -0700315 WPA_CTRL_REQ_SIM,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800316 NUM_WPA_CTRL_REQS
317};
318
319/* Maximum number of EAP methods to store for EAP server user information */
320#define EAP_MAX_METHODS 8
321
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700322#endif /* DEFS_H */