1/*
2 * WPA Supplicant - Common definitions
3 * Copyright (c) 2004-2006, 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
27typedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP,
28	       WPA_ALG_IGTK, WPA_ALG_DHV } wpa_alg;
29typedef enum { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP,
30	       CIPHER_WEP104 } wpa_cipher;
31typedef enum { KEY_MGMT_802_1X, KEY_MGMT_PSK, KEY_MGMT_NONE,
32	       KEY_MGMT_802_1X_NO_WPA, KEY_MGMT_WPA_NONE } wpa_key_mgmt;
33
34/**
35 * enum wpa_states - wpa_supplicant state
36 *
37 * These enumeration values are used to indicate the current wpa_supplicant
38 * state (wpa_s->wpa_state). The current state can be retrieved with
39 * wpa_supplicant_get_state() function and the state can be changed by calling
40 * wpa_supplicant_set_state(). In WPA state machine (wpa.c and preauth.c), the
41 * wrapper functions wpa_sm_get_state() and wpa_sm_set_state() should be used
42 * to access the state variable.
43 */
44typedef enum {
45	/**
46	 * WPA_DISCONNECTED - Disconnected state
47	 *
48	 * This state indicates that client is not associated, but is likely to
49	 * start looking for an access point. This state is entered when a
50	 * connection is lost.
51	 */
52	WPA_DISCONNECTED,
53
54	/**
55	 * WPA_INACTIVE - Inactive state (wpa_supplicant disabled)
56	 *
57	 * This state is entered if there are no enabled networks in the
58	 * configuration. wpa_supplicant is not trying to associate with a new
59	 * network and external interaction (e.g., ctrl_iface call to add or
60	 * enable a network) is needed to start association.
61	 */
62	WPA_INACTIVE,
63
64	/**
65	 * WPA_SCANNING - Scanning for a network
66	 *
67	 * This state is entered when wpa_supplicant starts scanning for a
68	 * network.
69	 */
70	WPA_SCANNING,
71
72	/**
73	 * WPA_ASSOCIATING - Trying to associate with a BSS/SSID
74	 *
75	 * This state is entered when wpa_supplicant has found a suitable BSS
76	 * to associate with and the driver is configured to try to associate
77	 * with this BSS in ap_scan=1 mode. When using ap_scan=2 mode, this
78	 * state is entered when the driver is configured to try to associate
79	 * with a network using the configured SSID and security policy.
80	 */
81	WPA_ASSOCIATING,
82
83	/**
84	 * WPA_ASSOCIATED - Association completed
85	 *
86	 * This state is entered when the driver reports that association has
87	 * been successfully completed with an AP. If IEEE 802.1X is used
88	 * (with or without WPA/WPA2), wpa_supplicant remains in this state
89	 * until the IEEE 802.1X/EAPOL authentication has been completed.
90	 */
91	WPA_ASSOCIATED,
92
93	/**
94	 * WPA_4WAY_HANDSHAKE - WPA 4-Way Key Handshake in progress
95	 *
96	 * This state is entered when WPA/WPA2 4-Way Handshake is started. In
97	 * case of WPA-PSK, this happens when receiving the first EAPOL-Key
98	 * frame after association. In case of WPA-EAP, this state is entered
99	 * when the IEEE 802.1X/EAPOL authentication has been completed.
100	 */
101	WPA_4WAY_HANDSHAKE,
102
103	/**
104	 * WPA_GROUP_HANDSHAKE - WPA Group Key Handshake in progress
105	 *
106	 * This state is entered when 4-Way Key Handshake has been completed
107	 * (i.e., when the supplicant sends out message 4/4) and when Group
108	 * Key rekeying is started by the AP (i.e., when supplicant receives
109	 * message 1/2).
110	 */
111	WPA_GROUP_HANDSHAKE,
112
113	/**
114	 * WPA_COMPLETED - All authentication completed
115	 *
116	 * This state is entered when the full authentication process is
117	 * completed. In case of WPA2, this happens when the 4-Way Handshake is
118	 * successfully completed. With WPA, this state is entered after the
119	 * Group Key Handshake; with IEEE 802.1X (non-WPA) connection is
120	 * completed after dynamic keys are received (or if not used, after
121	 * the EAP authentication has been completed). With static WEP keys and
122	 * plaintext connections, this state is entered when an association
123	 * has been completed.
124	 *
125	 * This state indicates that the supplicant has completed its
126	 * processing for the association phase and that data connection is
127	 * fully configured.
128	 */
129	WPA_COMPLETED
130#ifdef ANDROID
131	/**
132	 * WPA_IDLE - Eeplicit disconnect was performed
133	 *
134	 * This state is entered when a disconnect command is issued to the
135	 * supplicant. In this case, the supplicant not only disassociates
136	 * from the current network, but it also stops trying to associate
137	 * with any AP until a subsequent reconnect or reassociate command
138	 * is issued. This state was added to distinguish it from the
139	 * WPA_DISCONNECTED state, which is now reserved for disconnects
140	 * that were not explicitly requested by a client.
141	 * This state is reported to clients, but it is not internally stored.
142	 */
143	, WPA_IDLE
144#endif /* ANDROID */
145} wpa_states;
146
147#define MLME_SETPROTECTION_PROTECT_TYPE_NONE 0
148#define MLME_SETPROTECTION_PROTECT_TYPE_RX 1
149#define MLME_SETPROTECTION_PROTECT_TYPE_TX 2
150#define MLME_SETPROTECTION_PROTECT_TYPE_RX_TX 3
151
152#define MLME_SETPROTECTION_KEY_TYPE_GROUP 0
153#define MLME_SETPROTECTION_KEY_TYPE_PAIRWISE 1
154
155#endif /* DEFS_H */
156