]> git.ipfire.org Git - thirdparty/hostap.git/blame - src/common/defs.h
OCE: Add hostapd mode OCE capability indication if enabled
[thirdparty/hostap.git] / src / common / defs.h
CommitLineData
6fc6879b
JM
1/*
2 * WPA Supplicant - Common definitions
5e3b5197 3 * Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi>
6fc6879b 4 *
0f3d578e
JM
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
6fc6879b
JM
7 */
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)
6fc6879b 26#define WPA_CIPHER_AES_128_CMAC BIT(5)
eb7719ff 27#define WPA_CIPHER_GCMP BIT(6)
369c8d7b 28#define WPA_CIPHER_SMS4 BIT(7)
30675c34
JM
29#define WPA_CIPHER_GCMP_256 BIT(8)
30#define WPA_CIPHER_CCMP_256 BIT(9)
31#define WPA_CIPHER_BIP_GMAC_128 BIT(11)
32#define WPA_CIPHER_BIP_GMAC_256 BIT(12)
33#define WPA_CIPHER_BIP_CMAC_256 BIT(13)
dff1e285 34#define WPA_CIPHER_GTK_NOT_USED BIT(14)
6fc6879b
JM
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)
56586197
JM
43#define WPA_KEY_MGMT_IEEE8021X_SHA256 BIT(7)
44#define WPA_KEY_MGMT_PSK_SHA256 BIT(8)
ad08c363 45#define WPA_KEY_MGMT_WPS BIT(9)
c10347f2
JM
46#define WPA_KEY_MGMT_SAE BIT(10)
47#define WPA_KEY_MGMT_FT_SAE BIT(11)
369c8d7b
JM
48#define WPA_KEY_MGMT_WAPI_PSK BIT(12)
49#define WPA_KEY_MGMT_WAPI_CERT BIT(13)
50#define WPA_KEY_MGMT_CCKM BIT(14)
a5d75636 51#define WPA_KEY_MGMT_OSEN BIT(15)
666497c8 52#define WPA_KEY_MGMT_IEEE8021X_SUITE_B BIT(16)
5e3b5197 53#define WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 BIT(17)
94318a0d
JM
54#define WPA_KEY_MGMT_FILS_SHA256 BIT(18)
55#define WPA_KEY_MGMT_FILS_SHA384 BIT(19)
56#define WPA_KEY_MGMT_FT_FILS_SHA256 BIT(20)
57#define WPA_KEY_MGMT_FT_FILS_SHA384 BIT(21)
a1ea1b45 58#define WPA_KEY_MGMT_OWE BIT(22)
567da5bb 59#define WPA_KEY_MGMT_DPP BIT(23)
56586197
JM
60
61static inline int wpa_key_mgmt_wpa_ieee8021x(int akm)
62{
03d3f28a
JM
63 return !!(akm & (WPA_KEY_MGMT_IEEE8021X |
64 WPA_KEY_MGMT_FT_IEEE8021X |
369c8d7b 65 WPA_KEY_MGMT_CCKM |
a5d75636 66 WPA_KEY_MGMT_OSEN |
666497c8 67 WPA_KEY_MGMT_IEEE8021X_SHA256 |
5e3b5197 68 WPA_KEY_MGMT_IEEE8021X_SUITE_B |
94318a0d
JM
69 WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 |
70 WPA_KEY_MGMT_FILS_SHA256 |
71 WPA_KEY_MGMT_FILS_SHA384 |
72 WPA_KEY_MGMT_FT_FILS_SHA256 |
73 WPA_KEY_MGMT_FT_FILS_SHA384));
56586197
JM
74}
75
76static inline int wpa_key_mgmt_wpa_psk(int akm)
77{
03d3f28a
JM
78 return !!(akm & (WPA_KEY_MGMT_PSK |
79 WPA_KEY_MGMT_FT_PSK |
c10347f2 80 WPA_KEY_MGMT_PSK_SHA256 |
aa189ac9
JM
81 WPA_KEY_MGMT_SAE |
82 WPA_KEY_MGMT_FT_SAE));
56586197
JM
83}
84
85static inline int wpa_key_mgmt_ft(int akm)
86{
03d3f28a 87 return !!(akm & (WPA_KEY_MGMT_FT_PSK |
c10347f2 88 WPA_KEY_MGMT_FT_IEEE8021X |
94318a0d
JM
89 WPA_KEY_MGMT_FT_SAE |
90 WPA_KEY_MGMT_FT_FILS_SHA256 |
91 WPA_KEY_MGMT_FT_FILS_SHA384));
c10347f2
JM
92}
93
96590564
MB
94static inline int wpa_key_mgmt_ft_psk(int akm)
95{
96 return !!(akm & WPA_KEY_MGMT_FT_PSK);
97}
98
c10347f2
JM
99static inline int wpa_key_mgmt_sae(int akm)
100{
101 return !!(akm & (WPA_KEY_MGMT_SAE |
102 WPA_KEY_MGMT_FT_SAE));
56586197
JM
103}
104
94318a0d
JM
105static inline int wpa_key_mgmt_fils(int akm)
106{
107 return !!(akm & (WPA_KEY_MGMT_FILS_SHA256 |
108 WPA_KEY_MGMT_FILS_SHA384 |
109 WPA_KEY_MGMT_FT_FILS_SHA256 |
110 WPA_KEY_MGMT_FT_FILS_SHA384));
111}
112
56586197
JM
113static inline int wpa_key_mgmt_sha256(int akm)
114{
03d3f28a 115 return !!(akm & (WPA_KEY_MGMT_PSK_SHA256 |
a5d75636 116 WPA_KEY_MGMT_IEEE8021X_SHA256 |
666497c8 117 WPA_KEY_MGMT_OSEN |
94318a0d
JM
118 WPA_KEY_MGMT_IEEE8021X_SUITE_B |
119 WPA_KEY_MGMT_FILS_SHA256 |
120 WPA_KEY_MGMT_FT_FILS_SHA256));
666497c8
JM
121}
122
5e3b5197
JM
123static inline int wpa_key_mgmt_sha384(int akm)
124{
94318a0d
JM
125 return !!(akm & (WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 |
126 WPA_KEY_MGMT_FILS_SHA384 |
127 WPA_KEY_MGMT_FT_FILS_SHA384));
5e3b5197
JM
128}
129
666497c8
JM
130static inline int wpa_key_mgmt_suite_b(int akm)
131{
5e3b5197
JM
132 return !!(akm & (WPA_KEY_MGMT_IEEE8021X_SUITE_B |
133 WPA_KEY_MGMT_IEEE8021X_SUITE_B_192));
56586197
JM
134}
135
43882f1e
JM
136static inline int wpa_key_mgmt_wpa(int akm)
137{
138 return wpa_key_mgmt_wpa_ieee8021x(akm) ||
aa189ac9 139 wpa_key_mgmt_wpa_psk(akm) ||
94318a0d 140 wpa_key_mgmt_fils(akm) ||
a1ea1b45 141 wpa_key_mgmt_sae(akm) ||
567da5bb
JM
142 akm == WPA_KEY_MGMT_OWE ||
143 akm == WPA_KEY_MGMT_DPP;
43882f1e
JM
144}
145
0bf927a0
JM
146static inline int wpa_key_mgmt_wpa_any(int akm)
147{
148 return wpa_key_mgmt_wpa(akm) || (akm & WPA_KEY_MGMT_WPA_NONE);
149}
150
369c8d7b
JM
151static inline int wpa_key_mgmt_cckm(int akm)
152{
153 return akm == WPA_KEY_MGMT_CCKM;
154}
155
6fc6879b
JM
156
157#define WPA_PROTO_WPA BIT(0)
158#define WPA_PROTO_RSN BIT(1)
369c8d7b 159#define WPA_PROTO_WAPI BIT(2)
a5d75636 160#define WPA_PROTO_OSEN BIT(3)
6fc6879b
JM
161
162#define WPA_AUTH_ALG_OPEN BIT(0)
163#define WPA_AUTH_ALG_SHARED BIT(1)
164#define WPA_AUTH_ALG_LEAP BIT(2)
f400f4f3 165#define WPA_AUTH_ALG_FT BIT(3)
c10347f2 166#define WPA_AUTH_ALG_SAE BIT(4)
274d8b77 167#define WPA_AUTH_ALG_FILS BIT(5)
cad291d6 168#define WPA_AUTH_ALG_FILS_SK_PFS BIT(6)
6fc6879b 169
da6a28ba
VK
170static inline int wpa_auth_alg_fils(int alg)
171{
172 return !!(alg & (WPA_AUTH_ALG_FILS | WPA_AUTH_ALG_FILS_SK_PFS));
173}
6fc6879b 174
71934751
JM
175enum wpa_alg {
176 WPA_ALG_NONE,
177 WPA_ALG_WEP,
178 WPA_ALG_TKIP,
179 WPA_ALG_CCMP,
180 WPA_ALG_IGTK,
eb7719ff 181 WPA_ALG_PMK,
369c8d7b
JM
182 WPA_ALG_GCMP,
183 WPA_ALG_SMS4,
30675c34
JM
184 WPA_ALG_KRK,
185 WPA_ALG_GCMP_256,
186 WPA_ALG_CCMP_256,
187 WPA_ALG_BIP_GMAC_128,
188 WPA_ALG_BIP_GMAC_256,
189 WPA_ALG_BIP_CMAC_256
71934751
JM
190};
191
6fc6879b
JM
192/**
193 * enum wpa_states - wpa_supplicant state
194 *
195 * These enumeration values are used to indicate the current wpa_supplicant
196 * state (wpa_s->wpa_state). The current state can be retrieved with
197 * wpa_supplicant_get_state() function and the state can be changed by calling
198 * wpa_supplicant_set_state(). In WPA state machine (wpa.c and preauth.c), the
199 * wrapper functions wpa_sm_get_state() and wpa_sm_set_state() should be used
200 * to access the state variable.
201 */
71934751 202enum wpa_states {
6fc6879b
JM
203 /**
204 * WPA_DISCONNECTED - Disconnected state
205 *
206 * This state indicates that client is not associated, but is likely to
207 * start looking for an access point. This state is entered when a
208 * connection is lost.
209 */
210 WPA_DISCONNECTED,
211
8401a6b0
JM
212 /**
213 * WPA_INTERFACE_DISABLED - Interface disabled
214 *
6995536f 215 * This state is entered if the network interface is disabled, e.g.,
8401a6b0
JM
216 * due to rfkill. wpa_supplicant refuses any new operations that would
217 * use the radio until the interface has been enabled.
218 */
219 WPA_INTERFACE_DISABLED,
220
6fc6879b
JM
221 /**
222 * WPA_INACTIVE - Inactive state (wpa_supplicant disabled)
223 *
224 * This state is entered if there are no enabled networks in the
225 * configuration. wpa_supplicant is not trying to associate with a new
226 * network and external interaction (e.g., ctrl_iface call to add or
227 * enable a network) is needed to start association.
228 */
229 WPA_INACTIVE,
230
231 /**
232 * WPA_SCANNING - Scanning for a network
233 *
234 * This state is entered when wpa_supplicant starts scanning for a
235 * network.
236 */
237 WPA_SCANNING,
238
c2a04078
JM
239 /**
240 * WPA_AUTHENTICATING - Trying to authenticate with a BSS/SSID
241 *
242 * This state is entered when wpa_supplicant has found a suitable BSS
243 * to authenticate with and the driver is configured to try to
244 * authenticate with this BSS. This state is used only with drivers
245 * that use wpa_supplicant as the SME.
246 */
247 WPA_AUTHENTICATING,
248
6fc6879b
JM
249 /**
250 * WPA_ASSOCIATING - Trying to associate with a BSS/SSID
251 *
252 * This state is entered when wpa_supplicant has found a suitable BSS
253 * to associate with and the driver is configured to try to associate
254 * with this BSS in ap_scan=1 mode. When using ap_scan=2 mode, this
255 * state is entered when the driver is configured to try to associate
256 * with a network using the configured SSID and security policy.
257 */
258 WPA_ASSOCIATING,
259
260 /**
261 * WPA_ASSOCIATED - Association completed
262 *
263 * This state is entered when the driver reports that association has
264 * been successfully completed with an AP. If IEEE 802.1X is used
265 * (with or without WPA/WPA2), wpa_supplicant remains in this state
266 * until the IEEE 802.1X/EAPOL authentication has been completed.
267 */
268 WPA_ASSOCIATED,
269
270 /**
271 * WPA_4WAY_HANDSHAKE - WPA 4-Way Key Handshake in progress
272 *
273 * This state is entered when WPA/WPA2 4-Way Handshake is started. In
274 * case of WPA-PSK, this happens when receiving the first EAPOL-Key
275 * frame after association. In case of WPA-EAP, this state is entered
276 * when the IEEE 802.1X/EAPOL authentication has been completed.
277 */
278 WPA_4WAY_HANDSHAKE,
279
280 /**
281 * WPA_GROUP_HANDSHAKE - WPA Group Key Handshake in progress
282 *
283 * This state is entered when 4-Way Key Handshake has been completed
284 * (i.e., when the supplicant sends out message 4/4) and when Group
285 * Key rekeying is started by the AP (i.e., when supplicant receives
286 * message 1/2).
287 */
288 WPA_GROUP_HANDSHAKE,
289
290 /**
291 * WPA_COMPLETED - All authentication completed
292 *
293 * This state is entered when the full authentication process is
294 * completed. In case of WPA2, this happens when the 4-Way Handshake is
295 * successfully completed. With WPA, this state is entered after the
296 * Group Key Handshake; with IEEE 802.1X (non-WPA) connection is
297 * completed after dynamic keys are received (or if not used, after
298 * the EAP authentication has been completed). With static WEP keys and
299 * plaintext connections, this state is entered when an association
300 * has been completed.
301 *
302 * This state indicates that the supplicant has completed its
303 * processing for the association phase and that data connection is
304 * fully configured.
305 */
306 WPA_COMPLETED
71934751 307};
6fc6879b
JM
308
309#define MLME_SETPROTECTION_PROTECT_TYPE_NONE 0
310#define MLME_SETPROTECTION_PROTECT_TYPE_RX 1
311#define MLME_SETPROTECTION_PROTECT_TYPE_TX 2
312#define MLME_SETPROTECTION_PROTECT_TYPE_RX_TX 3
313
314#define MLME_SETPROTECTION_KEY_TYPE_GROUP 0
315#define MLME_SETPROTECTION_KEY_TYPE_PAIRWISE 1
316
c746331b 317
70f8cc8e
JM
318/**
319 * enum mfp_options - Management frame protection (IEEE 802.11w) options
320 */
c746331b 321enum mfp_options {
70f8cc8e
JM
322 NO_MGMT_FRAME_PROTECTION = 0,
323 MGMT_FRAME_PROTECTION_OPTIONAL = 1,
62d49803 324 MGMT_FRAME_PROTECTION_REQUIRED = 2,
c746331b 325};
62d49803 326#define MGMT_FRAME_PROTECTION_DEFAULT 3
c746331b 327
e0498677
JM
328/**
329 * enum hostapd_hw_mode - Hardware mode
330 */
71934751 331enum hostapd_hw_mode {
6caf9ca6
JM
332 HOSTAPD_MODE_IEEE80211B,
333 HOSTAPD_MODE_IEEE80211G,
334 HOSTAPD_MODE_IEEE80211A,
7829894c 335 HOSTAPD_MODE_IEEE80211AD,
3784c058 336 HOSTAPD_MODE_IEEE80211ANY,
6caf9ca6 337 NUM_HOSTAPD_MODES
71934751 338};
6caf9ca6 339
9ef1aaae
DW
340/**
341 * enum wpa_ctrl_req_type - Control interface request types
342 */
343enum wpa_ctrl_req_type {
81c57e22 344 WPA_CTRL_REQ_UNKNOWN,
9ef1aaae
DW
345 WPA_CTRL_REQ_EAP_IDENTITY,
346 WPA_CTRL_REQ_EAP_PASSWORD,
347 WPA_CTRL_REQ_EAP_NEW_PASSWORD,
348 WPA_CTRL_REQ_EAP_PIN,
349 WPA_CTRL_REQ_EAP_OTP,
350 WPA_CTRL_REQ_EAP_PASSPHRASE,
a5d44ac0 351 WPA_CTRL_REQ_SIM,
a52410c2 352 WPA_CTRL_REQ_PSK_PASSPHRASE,
3c108b75 353 WPA_CTRL_REQ_EXT_CERT_CHECK,
9ef1aaae
DW
354 NUM_WPA_CTRL_REQS
355};
356
e9447a94
JM
357/* Maximum number of EAP methods to store for EAP server user information */
358#define EAP_MAX_METHODS 8
359
7c7e7877 360enum mesh_plink_state {
d02e5498
JM
361 PLINK_IDLE = 1,
362 PLINK_OPN_SNT,
363 PLINK_OPN_RCVD,
7c7e7877
BC
364 PLINK_CNF_RCVD,
365 PLINK_ESTAB,
366 PLINK_HOLDING,
d02e5498 367 PLINK_BLOCKED, /* not defined in the IEEE 802.11 standard */
7c7e7877
BC
368};
369
844dfeb8
SD
370enum set_band {
371 WPA_SETBAND_AUTO,
372 WPA_SETBAND_5G,
373 WPA_SETBAND_2G
374};
375
2b6e9f91
LD
376enum wpa_radio_work_band {
377 BAND_2_4_GHZ = BIT(0),
378 BAND_5_GHZ = BIT(1),
379 BAND_60_GHZ = BIT(2),
380};
381
29483a56
PK
382enum beacon_rate_type {
383 BEACON_RATE_LEGACY,
384 BEACON_RATE_HT,
385 BEACON_RATE_VHT
386};
387
a6f3761f
PK
388enum eap_proxy_sim_state {
389 SIM_STATE_ERROR,
390};
391
332aadb8
AP
392#define OCE_STA BIT(0)
393#define OCE_STA_CFON BIT(1)
65833d71 394#define OCE_AP BIT(2)
332aadb8 395
6fc6879b 396#endif /* DEFS_H */