blob: 3e658cbcf4ac55d6703eb19dd41f09635dd9bc16 [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * WPA Supplicant - Common definitions
Roshan Pius3a1667e2018-07-03 15:17:14 -07003 * Copyright (c) 2004-2018, Jouni Malinen <j@w1.fi>
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004 *
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
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070012#define WPA_CIPHER_NONE BIT(0)
13#define WPA_CIPHER_WEP40 BIT(1)
14#define WPA_CIPHER_WEP104 BIT(2)
15#define WPA_CIPHER_TKIP BIT(3)
16#define WPA_CIPHER_CCMP BIT(4)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070017#define WPA_CIPHER_AES_128_CMAC BIT(5)
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070018#define WPA_CIPHER_GCMP BIT(6)
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080019#define WPA_CIPHER_SMS4 BIT(7)
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -080020#define WPA_CIPHER_GCMP_256 BIT(8)
21#define WPA_CIPHER_CCMP_256 BIT(9)
22#define WPA_CIPHER_BIP_GMAC_128 BIT(11)
23#define WPA_CIPHER_BIP_GMAC_256 BIT(12)
24#define WPA_CIPHER_BIP_CMAC_256 BIT(13)
25#define WPA_CIPHER_GTK_NOT_USED BIT(14)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070026
27#define WPA_KEY_MGMT_IEEE8021X BIT(0)
28#define WPA_KEY_MGMT_PSK BIT(1)
29#define WPA_KEY_MGMT_NONE BIT(2)
30#define WPA_KEY_MGMT_IEEE8021X_NO_WPA BIT(3)
31#define WPA_KEY_MGMT_WPA_NONE BIT(4)
32#define WPA_KEY_MGMT_FT_IEEE8021X BIT(5)
33#define WPA_KEY_MGMT_FT_PSK BIT(6)
34#define WPA_KEY_MGMT_IEEE8021X_SHA256 BIT(7)
35#define WPA_KEY_MGMT_PSK_SHA256 BIT(8)
36#define WPA_KEY_MGMT_WPS BIT(9)
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080037#define WPA_KEY_MGMT_SAE BIT(10)
38#define WPA_KEY_MGMT_FT_SAE BIT(11)
39#define WPA_KEY_MGMT_WAPI_PSK BIT(12)
40#define WPA_KEY_MGMT_WAPI_CERT BIT(13)
41#define WPA_KEY_MGMT_CCKM BIT(14)
Dmitry Shmidtf21452a2014-02-26 10:55:25 -080042#define WPA_KEY_MGMT_OSEN BIT(15)
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080043#define WPA_KEY_MGMT_IEEE8021X_SUITE_B BIT(16)
Dmitry Shmidt807291d2015-01-27 13:40:23 -080044#define WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 BIT(17)
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -080045#define WPA_KEY_MGMT_FILS_SHA256 BIT(18)
46#define WPA_KEY_MGMT_FILS_SHA384 BIT(19)
47#define WPA_KEY_MGMT_FT_FILS_SHA256 BIT(20)
48#define WPA_KEY_MGMT_FT_FILS_SHA384 BIT(21)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070049#define WPA_KEY_MGMT_OWE BIT(22)
50#define WPA_KEY_MGMT_DPP BIT(23)
Roshan Pius3a1667e2018-07-03 15:17:14 -070051#define WPA_KEY_MGMT_FT_IEEE8021X_SHA384 BIT(24)
Hai Shalom60840252021-02-19 19:02:11 -080052#define WPA_KEY_MGMT_PASN BIT(25)
Sunil Ravi89eba102022-09-13 21:04:37 -070053#define WPA_KEY_MGMT_SAE_EXT_KEY BIT(26)
54#define WPA_KEY_MGMT_FT_SAE_EXT_KEY BIT(27)
Hai Shalom60840252021-02-19 19:02:11 -080055
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070056
Hai Shalom74f70d42019-02-11 14:42:39 -080057#define WPA_KEY_MGMT_FT (WPA_KEY_MGMT_FT_PSK | \
58 WPA_KEY_MGMT_FT_IEEE8021X | \
59 WPA_KEY_MGMT_FT_IEEE8021X_SHA384 | \
60 WPA_KEY_MGMT_FT_SAE | \
Sunil Ravi89eba102022-09-13 21:04:37 -070061 WPA_KEY_MGMT_FT_SAE_EXT_KEY | \
Hai Shalom74f70d42019-02-11 14:42:39 -080062 WPA_KEY_MGMT_FT_FILS_SHA256 | \
63 WPA_KEY_MGMT_FT_FILS_SHA384)
64
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070065static inline int wpa_key_mgmt_wpa_ieee8021x(int akm)
66{
67 return !!(akm & (WPA_KEY_MGMT_IEEE8021X |
68 WPA_KEY_MGMT_FT_IEEE8021X |
Roshan Pius3a1667e2018-07-03 15:17:14 -070069 WPA_KEY_MGMT_FT_IEEE8021X_SHA384 |
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080070 WPA_KEY_MGMT_CCKM |
Dmitry Shmidtf21452a2014-02-26 10:55:25 -080071 WPA_KEY_MGMT_OSEN |
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080072 WPA_KEY_MGMT_IEEE8021X_SHA256 |
Dmitry Shmidt807291d2015-01-27 13:40:23 -080073 WPA_KEY_MGMT_IEEE8021X_SUITE_B |
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -080074 WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 |
75 WPA_KEY_MGMT_FILS_SHA256 |
76 WPA_KEY_MGMT_FILS_SHA384 |
77 WPA_KEY_MGMT_FT_FILS_SHA256 |
78 WPA_KEY_MGMT_FT_FILS_SHA384));
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070079}
80
Hai Shalomfdcde762020-04-02 11:19:20 -070081static inline int wpa_key_mgmt_wpa_psk_no_sae(int akm)
82{
83 return !!(akm & (WPA_KEY_MGMT_PSK |
84 WPA_KEY_MGMT_FT_PSK |
85 WPA_KEY_MGMT_PSK_SHA256));
86}
87
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070088static inline int wpa_key_mgmt_wpa_psk(int akm)
89{
90 return !!(akm & (WPA_KEY_MGMT_PSK |
91 WPA_KEY_MGMT_FT_PSK |
Dmitry Shmidtd5e49232012-12-03 15:08:10 -080092 WPA_KEY_MGMT_PSK_SHA256 |
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -080093 WPA_KEY_MGMT_SAE |
Sunil Ravi89eba102022-09-13 21:04:37 -070094 WPA_KEY_MGMT_SAE_EXT_KEY |
95 WPA_KEY_MGMT_FT_SAE |
96 WPA_KEY_MGMT_FT_SAE_EXT_KEY));
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070097}
98
99static inline int wpa_key_mgmt_ft(int akm)
100{
Hai Shalom74f70d42019-02-11 14:42:39 -0800101 return !!(akm & WPA_KEY_MGMT_FT);
102}
103
104static inline int wpa_key_mgmt_only_ft(int akm)
105{
106 int ft = wpa_key_mgmt_ft(akm);
107 akm &= ~WPA_KEY_MGMT_FT;
108 return ft && !akm;
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800109}
110
111static inline int wpa_key_mgmt_ft_psk(int akm)
112{
113 return !!(akm & WPA_KEY_MGMT_FT_PSK);
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800114}
115
116static inline int wpa_key_mgmt_sae(int akm)
117{
118 return !!(akm & (WPA_KEY_MGMT_SAE |
Sunil Ravi89eba102022-09-13 21:04:37 -0700119 WPA_KEY_MGMT_SAE_EXT_KEY |
120 WPA_KEY_MGMT_FT_SAE |
121 WPA_KEY_MGMT_FT_SAE_EXT_KEY));
122}
123
124static inline int wpa_key_mgmt_sae_ext_key(int akm)
125{
126 return !!(akm & (WPA_KEY_MGMT_SAE_EXT_KEY |
127 WPA_KEY_MGMT_FT_SAE_EXT_KEY));
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700128}
129
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800130static inline int wpa_key_mgmt_fils(int akm)
131{
132 return !!(akm & (WPA_KEY_MGMT_FILS_SHA256 |
133 WPA_KEY_MGMT_FILS_SHA384 |
134 WPA_KEY_MGMT_FT_FILS_SHA256 |
135 WPA_KEY_MGMT_FT_FILS_SHA384));
136}
137
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700138static inline int wpa_key_mgmt_sha256(int akm)
139{
140 return !!(akm & (WPA_KEY_MGMT_PSK_SHA256 |
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800141 WPA_KEY_MGMT_IEEE8021X_SHA256 |
Roshan Pius3a1667e2018-07-03 15:17:14 -0700142 WPA_KEY_MGMT_SAE |
143 WPA_KEY_MGMT_FT_SAE |
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800144 WPA_KEY_MGMT_OSEN |
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800145 WPA_KEY_MGMT_IEEE8021X_SUITE_B |
146 WPA_KEY_MGMT_FILS_SHA256 |
147 WPA_KEY_MGMT_FT_FILS_SHA256));
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800148}
149
Dmitry Shmidt807291d2015-01-27 13:40:23 -0800150static inline int wpa_key_mgmt_sha384(int akm)
151{
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800152 return !!(akm & (WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 |
Roshan Pius3a1667e2018-07-03 15:17:14 -0700153 WPA_KEY_MGMT_FT_IEEE8021X_SHA384 |
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800154 WPA_KEY_MGMT_FILS_SHA384 |
155 WPA_KEY_MGMT_FT_FILS_SHA384));
Dmitry Shmidt807291d2015-01-27 13:40:23 -0800156}
157
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800158static inline int wpa_key_mgmt_suite_b(int akm)
159{
Dmitry Shmidt807291d2015-01-27 13:40:23 -0800160 return !!(akm & (WPA_KEY_MGMT_IEEE8021X_SUITE_B |
161 WPA_KEY_MGMT_IEEE8021X_SUITE_B_192));
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700162}
163
164static inline int wpa_key_mgmt_wpa(int akm)
165{
166 return wpa_key_mgmt_wpa_ieee8021x(akm) ||
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800167 wpa_key_mgmt_wpa_psk(akm) ||
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800168 wpa_key_mgmt_fils(akm) ||
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700169 wpa_key_mgmt_sae(akm) ||
170 akm == WPA_KEY_MGMT_OWE ||
171 akm == WPA_KEY_MGMT_DPP;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700172}
173
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800174static inline int wpa_key_mgmt_wpa_any(int akm)
175{
176 return wpa_key_mgmt_wpa(akm) || (akm & WPA_KEY_MGMT_WPA_NONE);
177}
178
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800179static inline int wpa_key_mgmt_cckm(int akm)
180{
181 return akm == WPA_KEY_MGMT_CCKM;
182}
183
Sunil Ravi89eba102022-09-13 21:04:37 -0700184static inline int wpa_key_mgmt_cross_akm(int akm)
185{
186 return !!(akm & (WPA_KEY_MGMT_PSK |
187 WPA_KEY_MGMT_PSK_SHA256 |
188 WPA_KEY_MGMT_SAE |
189 WPA_KEY_MGMT_SAE_EXT_KEY));
190}
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700191
192#define WPA_PROTO_WPA BIT(0)
193#define WPA_PROTO_RSN BIT(1)
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800194#define WPA_PROTO_WAPI BIT(2)
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800195#define WPA_PROTO_OSEN BIT(3)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700196
197#define WPA_AUTH_ALG_OPEN BIT(0)
198#define WPA_AUTH_ALG_SHARED BIT(1)
199#define WPA_AUTH_ALG_LEAP BIT(2)
200#define WPA_AUTH_ALG_FT BIT(3)
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800201#define WPA_AUTH_ALG_SAE BIT(4)
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800202#define WPA_AUTH_ALG_FILS BIT(5)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700203#define WPA_AUTH_ALG_FILS_SK_PFS BIT(6)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700204
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700205static inline int wpa_auth_alg_fils(int alg)
206{
207 return !!(alg & (WPA_AUTH_ALG_FILS | WPA_AUTH_ALG_FILS_SK_PFS));
208}
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700209
210enum wpa_alg {
211 WPA_ALG_NONE,
212 WPA_ALG_WEP,
213 WPA_ALG_TKIP,
214 WPA_ALG_CCMP,
Hai Shalom4fbc08f2020-05-18 12:37:00 -0700215 WPA_ALG_BIP_CMAC_128,
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800216 WPA_ALG_GCMP,
217 WPA_ALG_SMS4,
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800218 WPA_ALG_KRK,
219 WPA_ALG_GCMP_256,
220 WPA_ALG_CCMP_256,
221 WPA_ALG_BIP_GMAC_128,
222 WPA_ALG_BIP_GMAC_256,
223 WPA_ALG_BIP_CMAC_256
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700224};
225
Hai Shalom4fbc08f2020-05-18 12:37:00 -0700226static inline int wpa_alg_bip(enum wpa_alg alg)
227{
228 return alg == WPA_ALG_BIP_CMAC_128 ||
229 alg == WPA_ALG_BIP_GMAC_128 ||
230 alg == WPA_ALG_BIP_GMAC_256 ||
231 alg == WPA_ALG_BIP_CMAC_256;
232}
233
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700234/**
235 * enum wpa_states - wpa_supplicant state
236 *
237 * These enumeration values are used to indicate the current wpa_supplicant
238 * state (wpa_s->wpa_state). The current state can be retrieved with
239 * wpa_supplicant_get_state() function and the state can be changed by calling
240 * wpa_supplicant_set_state(). In WPA state machine (wpa.c and preauth.c), the
241 * wrapper functions wpa_sm_get_state() and wpa_sm_set_state() should be used
242 * to access the state variable.
243 */
244enum wpa_states {
245 /**
246 * WPA_DISCONNECTED - Disconnected state
247 *
248 * This state indicates that client is not associated, but is likely to
249 * start looking for an access point. This state is entered when a
250 * connection is lost.
251 */
252 WPA_DISCONNECTED,
253
254 /**
255 * WPA_INTERFACE_DISABLED - Interface disabled
256 *
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800257 * This state is entered if the network interface is disabled, e.g.,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700258 * due to rfkill. wpa_supplicant refuses any new operations that would
259 * use the radio until the interface has been enabled.
260 */
261 WPA_INTERFACE_DISABLED,
262
263 /**
264 * WPA_INACTIVE - Inactive state (wpa_supplicant disabled)
265 *
266 * This state is entered if there are no enabled networks in the
267 * configuration. wpa_supplicant is not trying to associate with a new
268 * network and external interaction (e.g., ctrl_iface call to add or
269 * enable a network) is needed to start association.
270 */
271 WPA_INACTIVE,
272
273 /**
274 * WPA_SCANNING - Scanning for a network
275 *
276 * This state is entered when wpa_supplicant starts scanning for a
277 * network.
278 */
279 WPA_SCANNING,
280
281 /**
282 * WPA_AUTHENTICATING - Trying to authenticate with a BSS/SSID
283 *
284 * This state is entered when wpa_supplicant has found a suitable BSS
285 * to authenticate with and the driver is configured to try to
286 * authenticate with this BSS. This state is used only with drivers
287 * that use wpa_supplicant as the SME.
288 */
289 WPA_AUTHENTICATING,
290
291 /**
292 * WPA_ASSOCIATING - Trying to associate with a BSS/SSID
293 *
294 * This state is entered when wpa_supplicant has found a suitable BSS
295 * to associate with and the driver is configured to try to associate
296 * with this BSS in ap_scan=1 mode. When using ap_scan=2 mode, this
297 * state is entered when the driver is configured to try to associate
298 * with a network using the configured SSID and security policy.
299 */
300 WPA_ASSOCIATING,
301
302 /**
303 * WPA_ASSOCIATED - Association completed
304 *
305 * This state is entered when the driver reports that association has
306 * been successfully completed with an AP. If IEEE 802.1X is used
307 * (with or without WPA/WPA2), wpa_supplicant remains in this state
308 * until the IEEE 802.1X/EAPOL authentication has been completed.
309 */
310 WPA_ASSOCIATED,
311
312 /**
313 * WPA_4WAY_HANDSHAKE - WPA 4-Way Key Handshake in progress
314 *
315 * This state is entered when WPA/WPA2 4-Way Handshake is started. In
316 * case of WPA-PSK, this happens when receiving the first EAPOL-Key
317 * frame after association. In case of WPA-EAP, this state is entered
318 * when the IEEE 802.1X/EAPOL authentication has been completed.
319 */
320 WPA_4WAY_HANDSHAKE,
321
322 /**
323 * WPA_GROUP_HANDSHAKE - WPA Group Key Handshake in progress
324 *
325 * This state is entered when 4-Way Key Handshake has been completed
326 * (i.e., when the supplicant sends out message 4/4) and when Group
327 * Key rekeying is started by the AP (i.e., when supplicant receives
328 * message 1/2).
329 */
330 WPA_GROUP_HANDSHAKE,
331
332 /**
333 * WPA_COMPLETED - All authentication completed
334 *
335 * This state is entered when the full authentication process is
336 * completed. In case of WPA2, this happens when the 4-Way Handshake is
337 * successfully completed. With WPA, this state is entered after the
338 * Group Key Handshake; with IEEE 802.1X (non-WPA) connection is
339 * completed after dynamic keys are received (or if not used, after
340 * the EAP authentication has been completed). With static WEP keys and
341 * plaintext connections, this state is entered when an association
342 * has been completed.
343 *
344 * This state indicates that the supplicant has completed its
345 * processing for the association phase and that data connection is
346 * fully configured.
347 */
348 WPA_COMPLETED
349};
350
351#define MLME_SETPROTECTION_PROTECT_TYPE_NONE 0
352#define MLME_SETPROTECTION_PROTECT_TYPE_RX 1
353#define MLME_SETPROTECTION_PROTECT_TYPE_TX 2
354#define MLME_SETPROTECTION_PROTECT_TYPE_RX_TX 3
355
356#define MLME_SETPROTECTION_KEY_TYPE_GROUP 0
357#define MLME_SETPROTECTION_KEY_TYPE_PAIRWISE 1
358
359
360/**
361 * enum mfp_options - Management frame protection (IEEE 802.11w) options
362 */
363enum mfp_options {
364 NO_MGMT_FRAME_PROTECTION = 0,
365 MGMT_FRAME_PROTECTION_OPTIONAL = 1,
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800366 MGMT_FRAME_PROTECTION_REQUIRED = 2,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700367};
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800368#define MGMT_FRAME_PROTECTION_DEFAULT 3
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700369
370/**
371 * enum hostapd_hw_mode - Hardware mode
372 */
373enum hostapd_hw_mode {
374 HOSTAPD_MODE_IEEE80211B,
375 HOSTAPD_MODE_IEEE80211G,
376 HOSTAPD_MODE_IEEE80211A,
Dmitry Shmidta54fa5f2013-01-15 13:53:35 -0800377 HOSTAPD_MODE_IEEE80211AD,
Dmitry Shmidtb1e52102015-05-29 12:36:29 -0700378 HOSTAPD_MODE_IEEE80211ANY,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700379 NUM_HOSTAPD_MODES
380};
381
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800382/**
383 * enum wpa_ctrl_req_type - Control interface request types
384 */
385enum wpa_ctrl_req_type {
386 WPA_CTRL_REQ_UNKNOWN,
387 WPA_CTRL_REQ_EAP_IDENTITY,
388 WPA_CTRL_REQ_EAP_PASSWORD,
389 WPA_CTRL_REQ_EAP_NEW_PASSWORD,
390 WPA_CTRL_REQ_EAP_PIN,
391 WPA_CTRL_REQ_EAP_OTP,
392 WPA_CTRL_REQ_EAP_PASSPHRASE,
Dmitry Shmidt051af732013-10-22 13:52:46 -0700393 WPA_CTRL_REQ_SIM,
Dmitry Shmidt912c6ec2015-03-30 13:16:51 -0700394 WPA_CTRL_REQ_PSK_PASSPHRASE,
Dmitry Shmidt55840ad2015-12-14 12:45:46 -0800395 WPA_CTRL_REQ_EXT_CERT_CHECK,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800396 NUM_WPA_CTRL_REQS
397};
398
399/* Maximum number of EAP methods to store for EAP server user information */
400#define EAP_MAX_METHODS 8
401
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800402enum mesh_plink_state {
Dmitry Shmidt58d12ad2016-07-28 10:07:03 -0700403 PLINK_IDLE = 1,
404 PLINK_OPN_SNT,
405 PLINK_OPN_RCVD,
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800406 PLINK_CNF_RCVD,
407 PLINK_ESTAB,
408 PLINK_HOLDING,
Dmitry Shmidt58d12ad2016-07-28 10:07:03 -0700409 PLINK_BLOCKED, /* not defined in the IEEE 802.11 standard */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800410};
411
Ravi Joshie6ccb162015-07-16 17:45:41 -0700412enum set_band {
Hai Shalom60840252021-02-19 19:02:11 -0800413 WPA_SETBAND_AUTO = 0,
414 WPA_SETBAND_5G = BIT(0),
415 WPA_SETBAND_2G = BIT(1),
416 WPA_SETBAND_6G = BIT(2),
Ravi Joshie6ccb162015-07-16 17:45:41 -0700417};
418
Dmitry Shmidt9c175262016-03-03 10:20:07 -0800419enum wpa_radio_work_band {
420 BAND_2_4_GHZ = BIT(0),
421 BAND_5_GHZ = BIT(1),
422 BAND_60_GHZ = BIT(2),
423};
424
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800425enum beacon_rate_type {
426 BEACON_RATE_LEGACY,
427 BEACON_RATE_HT,
Hai Shalom60840252021-02-19 19:02:11 -0800428 BEACON_RATE_VHT,
429 BEACON_RATE_HE
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800430};
431
Dmitry Shmidt29333592017-01-09 12:27:11 -0800432enum eap_proxy_sim_state {
433 SIM_STATE_ERROR,
434};
435
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700436#define OCE_STA BIT(0)
437#define OCE_STA_CFON BIT(1)
438#define OCE_AP BIT(2)
439
Hai Shalom74f70d42019-02-11 14:42:39 -0800440/* enum chan_width - Channel width definitions */
441enum chan_width {
442 CHAN_WIDTH_20_NOHT,
443 CHAN_WIDTH_20,
444 CHAN_WIDTH_40,
445 CHAN_WIDTH_80,
446 CHAN_WIDTH_80P80,
447 CHAN_WIDTH_160,
Ahmed ElArabawy0ff61c52019-12-26 12:38:39 -0800448 CHAN_WIDTH_2160,
449 CHAN_WIDTH_4320,
450 CHAN_WIDTH_6480,
451 CHAN_WIDTH_8640,
Sunil8cd6f4d2022-06-28 18:40:46 +0000452 CHAN_WIDTH_320,
Hai Shalom74f70d42019-02-11 14:42:39 -0800453 CHAN_WIDTH_UNKNOWN
454};
455
Sunil8cd6f4d2022-06-28 18:40:46 +0000456/* VHT/EDMG/etc. channel widths
457 * Note: The first four values are used in hostapd.conf and as such, must
458 * maintain their defined values. Other values are used internally. */
459enum oper_chan_width {
460 CONF_OPER_CHWIDTH_USE_HT = 0,
461 CONF_OPER_CHWIDTH_80MHZ = 1,
462 CONF_OPER_CHWIDTH_160MHZ = 2,
463 CONF_OPER_CHWIDTH_80P80MHZ = 3,
464 CONF_OPER_CHWIDTH_2160MHZ,
465 CONF_OPER_CHWIDTH_4320MHZ,
466 CONF_OPER_CHWIDTH_6480MHZ,
467 CONF_OPER_CHWIDTH_8640MHZ,
468 CONF_OPER_CHWIDTH_40MHZ_6GHZ,
469 CONF_OPER_CHWIDTH_320MHZ,
470};
471
Hai Shalomfdcde762020-04-02 11:19:20 -0700472enum key_flag {
473 KEY_FLAG_MODIFY = BIT(0),
474 KEY_FLAG_DEFAULT = BIT(1),
475 KEY_FLAG_RX = BIT(2),
476 KEY_FLAG_TX = BIT(3),
477 KEY_FLAG_GROUP = BIT(4),
478 KEY_FLAG_PAIRWISE = BIT(5),
479 KEY_FLAG_PMK = BIT(6),
480 /* Used flag combinations */
481 KEY_FLAG_RX_TX = KEY_FLAG_RX | KEY_FLAG_TX,
482 KEY_FLAG_GROUP_RX_TX = KEY_FLAG_GROUP | KEY_FLAG_RX_TX,
483 KEY_FLAG_GROUP_RX_TX_DEFAULT = KEY_FLAG_GROUP_RX_TX |
484 KEY_FLAG_DEFAULT,
485 KEY_FLAG_GROUP_RX = KEY_FLAG_GROUP | KEY_FLAG_RX,
486 KEY_FLAG_GROUP_TX_DEFAULT = KEY_FLAG_GROUP | KEY_FLAG_TX |
487 KEY_FLAG_DEFAULT,
488 KEY_FLAG_PAIRWISE_RX_TX = KEY_FLAG_PAIRWISE | KEY_FLAG_RX_TX,
489 KEY_FLAG_PAIRWISE_RX = KEY_FLAG_PAIRWISE | KEY_FLAG_RX,
490 KEY_FLAG_PAIRWISE_RX_TX_MODIFY = KEY_FLAG_PAIRWISE_RX_TX |
491 KEY_FLAG_MODIFY,
492 /* Max allowed flags for each key type */
493 KEY_FLAG_PAIRWISE_MASK = KEY_FLAG_PAIRWISE_RX_TX_MODIFY,
494 KEY_FLAG_GROUP_MASK = KEY_FLAG_GROUP_RX_TX_DEFAULT,
495 KEY_FLAG_PMK_MASK = KEY_FLAG_PMK,
496};
497
498static inline int check_key_flag(enum key_flag key_flag)
499{
500 return !!(!key_flag ||
501 ((key_flag & (KEY_FLAG_PAIRWISE | KEY_FLAG_MODIFY)) &&
502 (key_flag & ~KEY_FLAG_PAIRWISE_MASK)) ||
503 ((key_flag & KEY_FLAG_GROUP) &&
504 (key_flag & ~KEY_FLAG_GROUP_MASK)) ||
505 ((key_flag & KEY_FLAG_PMK) &&
506 (key_flag & ~KEY_FLAG_PMK_MASK)));
507}
508
509enum ptk0_rekey_handling {
510 PTK0_REKEY_ALLOW_ALWAYS,
511 PTK0_REKEY_ALLOW_LOCAL_OK,
512 PTK0_REKEY_ALLOW_NEVER
513};
514
Sunil8cd6f4d2022-06-28 18:40:46 +0000515enum frame_encryption {
516 FRAME_ENCRYPTION_UNKNOWN = -1,
517 FRAME_NOT_ENCRYPTED = 0,
518 FRAME_ENCRYPTED = 1
519};
520
Sunil Ravi89eba102022-09-13 21:04:37 -0700521#define MAX_NUM_MLD_LINKS 15
522
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700523#endif /* DEFS_H */