defs.h revision 214734
1189251Ssam/* 2189251Ssam * WPA Supplicant - Common definitions 3189251Ssam * Copyright (c) 2004-2008, Jouni Malinen <j@w1.fi> 4189251Ssam * 5189251Ssam * This program is free software; you can redistribute it and/or modify 6189251Ssam * it under the terms of the GNU General Public License version 2 as 7189251Ssam * published by the Free Software Foundation. 8189251Ssam * 9189251Ssam * Alternatively, this software may be distributed under the terms of BSD 10189251Ssam * license. 11189251Ssam * 12189251Ssam * See README and COPYING for more details. 13189251Ssam */ 14189251Ssam 15189251Ssam#ifndef DEFS_H 16189251Ssam#define DEFS_H 17189251Ssam 18189251Ssam#ifdef FALSE 19189251Ssam#undef FALSE 20189251Ssam#endif 21189251Ssam#ifdef TRUE 22189251Ssam#undef TRUE 23189251Ssam#endif 24189251Ssamtypedef enum { FALSE = 0, TRUE = 1 } Boolean; 25189251Ssam 26189251Ssam 27189251Ssam#define WPA_CIPHER_NONE BIT(0) 28189251Ssam#define WPA_CIPHER_WEP40 BIT(1) 29189251Ssam#define WPA_CIPHER_WEP104 BIT(2) 30189251Ssam#define WPA_CIPHER_TKIP BIT(3) 31189251Ssam#define WPA_CIPHER_CCMP BIT(4) 32189251Ssam#ifdef CONFIG_IEEE80211W 33189251Ssam#define WPA_CIPHER_AES_128_CMAC BIT(5) 34189251Ssam#endif /* CONFIG_IEEE80211W */ 35189251Ssam 36189251Ssam#define WPA_KEY_MGMT_IEEE8021X BIT(0) 37189251Ssam#define WPA_KEY_MGMT_PSK BIT(1) 38189251Ssam#define WPA_KEY_MGMT_NONE BIT(2) 39189251Ssam#define WPA_KEY_MGMT_IEEE8021X_NO_WPA BIT(3) 40189251Ssam#define WPA_KEY_MGMT_WPA_NONE BIT(4) 41189251Ssam#define WPA_KEY_MGMT_FT_IEEE8021X BIT(5) 42189251Ssam#define WPA_KEY_MGMT_FT_PSK BIT(6) 43189251Ssam#define WPA_KEY_MGMT_IEEE8021X_SHA256 BIT(7) 44189251Ssam#define WPA_KEY_MGMT_PSK_SHA256 BIT(8) 45189251Ssam#define WPA_KEY_MGMT_WPS BIT(9) 46189251Ssam 47189251Ssamstatic inline int wpa_key_mgmt_wpa_ieee8021x(int akm) 48189251Ssam{ 49189251Ssam return akm == WPA_KEY_MGMT_IEEE8021X || 50189251Ssam akm == WPA_KEY_MGMT_FT_IEEE8021X || 51189251Ssam akm == WPA_KEY_MGMT_IEEE8021X_SHA256; 52189251Ssam} 53189251Ssam 54189251Ssamstatic inline int wpa_key_mgmt_wpa_psk(int akm) 55189251Ssam{ 56189251Ssam return akm == WPA_KEY_MGMT_PSK || 57189251Ssam akm == WPA_KEY_MGMT_FT_PSK || 58189251Ssam akm == WPA_KEY_MGMT_PSK_SHA256; 59189251Ssam} 60189251Ssam 61189251Ssamstatic inline int wpa_key_mgmt_ft(int akm) 62189251Ssam{ 63189251Ssam return akm == WPA_KEY_MGMT_FT_PSK || 64189251Ssam akm == WPA_KEY_MGMT_FT_IEEE8021X; 65189251Ssam} 66189251Ssam 67189251Ssamstatic inline int wpa_key_mgmt_sha256(int akm) 68189251Ssam{ 69189251Ssam return akm == WPA_KEY_MGMT_PSK_SHA256 || 70189251Ssam akm == WPA_KEY_MGMT_IEEE8021X_SHA256; 71189251Ssam} 72189251Ssam 73189251Ssam 74189251Ssam#define WPA_PROTO_WPA BIT(0) 75189251Ssam#define WPA_PROTO_RSN BIT(1) 76189251Ssam 77189251Ssam#define WPA_AUTH_ALG_OPEN BIT(0) 78189251Ssam#define WPA_AUTH_ALG_SHARED BIT(1) 79189251Ssam#define WPA_AUTH_ALG_LEAP BIT(2) 80214734Srpaulo#define WPA_AUTH_ALG_FT BIT(3) 81189251Ssam 82189251Ssam 83214734Srpauloenum wpa_alg { 84214734Srpaulo WPA_ALG_NONE, 85214734Srpaulo WPA_ALG_WEP, 86214734Srpaulo WPA_ALG_TKIP, 87214734Srpaulo WPA_ALG_CCMP, 88214734Srpaulo WPA_ALG_IGTK, 89214734Srpaulo WPA_ALG_PMK 90214734Srpaulo}; 91189251Ssam 92189251Ssam/** 93214734Srpaulo * enum wpa_cipher - Cipher suites 94214734Srpaulo */ 95214734Srpauloenum wpa_cipher { 96214734Srpaulo CIPHER_NONE, 97214734Srpaulo CIPHER_WEP40, 98214734Srpaulo CIPHER_TKIP, 99214734Srpaulo CIPHER_CCMP, 100214734Srpaulo CIPHER_WEP104 101214734Srpaulo}; 102214734Srpaulo 103214734Srpaulo/** 104214734Srpaulo * enum wpa_key_mgmt - Key management suites 105214734Srpaulo */ 106214734Srpauloenum wpa_key_mgmt { 107214734Srpaulo KEY_MGMT_802_1X, 108214734Srpaulo KEY_MGMT_PSK, 109214734Srpaulo KEY_MGMT_NONE, 110214734Srpaulo KEY_MGMT_802_1X_NO_WPA, 111214734Srpaulo KEY_MGMT_WPA_NONE, 112214734Srpaulo KEY_MGMT_FT_802_1X, 113214734Srpaulo KEY_MGMT_FT_PSK, 114214734Srpaulo KEY_MGMT_802_1X_SHA256, 115214734Srpaulo KEY_MGMT_PSK_SHA256, 116214734Srpaulo KEY_MGMT_WPS 117214734Srpaulo}; 118214734Srpaulo 119214734Srpaulo/** 120189251Ssam * enum wpa_states - wpa_supplicant state 121189251Ssam * 122189251Ssam * These enumeration values are used to indicate the current wpa_supplicant 123189251Ssam * state (wpa_s->wpa_state). The current state can be retrieved with 124189251Ssam * wpa_supplicant_get_state() function and the state can be changed by calling 125189251Ssam * wpa_supplicant_set_state(). In WPA state machine (wpa.c and preauth.c), the 126189251Ssam * wrapper functions wpa_sm_get_state() and wpa_sm_set_state() should be used 127189251Ssam * to access the state variable. 128189251Ssam */ 129214734Srpauloenum wpa_states { 130189251Ssam /** 131189251Ssam * WPA_DISCONNECTED - Disconnected state 132189251Ssam * 133189251Ssam * This state indicates that client is not associated, but is likely to 134189251Ssam * start looking for an access point. This state is entered when a 135189251Ssam * connection is lost. 136189251Ssam */ 137189251Ssam WPA_DISCONNECTED, 138189251Ssam 139189251Ssam /** 140189251Ssam * WPA_INACTIVE - Inactive state (wpa_supplicant disabled) 141189251Ssam * 142189251Ssam * This state is entered if there are no enabled networks in the 143189251Ssam * configuration. wpa_supplicant is not trying to associate with a new 144189251Ssam * network and external interaction (e.g., ctrl_iface call to add or 145189251Ssam * enable a network) is needed to start association. 146189251Ssam */ 147189251Ssam WPA_INACTIVE, 148189251Ssam 149189251Ssam /** 150189251Ssam * WPA_SCANNING - Scanning for a network 151189251Ssam * 152189251Ssam * This state is entered when wpa_supplicant starts scanning for a 153189251Ssam * network. 154189251Ssam */ 155189251Ssam WPA_SCANNING, 156189251Ssam 157189251Ssam /** 158214734Srpaulo * WPA_AUTHENTICATING - Trying to authenticate with a BSS/SSID 159214734Srpaulo * 160214734Srpaulo * This state is entered when wpa_supplicant has found a suitable BSS 161214734Srpaulo * to authenticate with and the driver is configured to try to 162214734Srpaulo * authenticate with this BSS. This state is used only with drivers 163214734Srpaulo * that use wpa_supplicant as the SME. 164214734Srpaulo */ 165214734Srpaulo WPA_AUTHENTICATING, 166214734Srpaulo 167214734Srpaulo /** 168189251Ssam * WPA_ASSOCIATING - Trying to associate with a BSS/SSID 169189251Ssam * 170189251Ssam * This state is entered when wpa_supplicant has found a suitable BSS 171189251Ssam * to associate with and the driver is configured to try to associate 172189251Ssam * with this BSS in ap_scan=1 mode. When using ap_scan=2 mode, this 173189251Ssam * state is entered when the driver is configured to try to associate 174189251Ssam * with a network using the configured SSID and security policy. 175189251Ssam */ 176189251Ssam WPA_ASSOCIATING, 177189251Ssam 178189251Ssam /** 179189251Ssam * WPA_ASSOCIATED - Association completed 180189251Ssam * 181189251Ssam * This state is entered when the driver reports that association has 182189251Ssam * been successfully completed with an AP. If IEEE 802.1X is used 183189251Ssam * (with or without WPA/WPA2), wpa_supplicant remains in this state 184189251Ssam * until the IEEE 802.1X/EAPOL authentication has been completed. 185189251Ssam */ 186189251Ssam WPA_ASSOCIATED, 187189251Ssam 188189251Ssam /** 189189251Ssam * WPA_4WAY_HANDSHAKE - WPA 4-Way Key Handshake in progress 190189251Ssam * 191189251Ssam * This state is entered when WPA/WPA2 4-Way Handshake is started. In 192189251Ssam * case of WPA-PSK, this happens when receiving the first EAPOL-Key 193189251Ssam * frame after association. In case of WPA-EAP, this state is entered 194189251Ssam * when the IEEE 802.1X/EAPOL authentication has been completed. 195189251Ssam */ 196189251Ssam WPA_4WAY_HANDSHAKE, 197189251Ssam 198189251Ssam /** 199189251Ssam * WPA_GROUP_HANDSHAKE - WPA Group Key Handshake in progress 200189251Ssam * 201189251Ssam * This state is entered when 4-Way Key Handshake has been completed 202189251Ssam * (i.e., when the supplicant sends out message 4/4) and when Group 203189251Ssam * Key rekeying is started by the AP (i.e., when supplicant receives 204189251Ssam * message 1/2). 205189251Ssam */ 206189251Ssam WPA_GROUP_HANDSHAKE, 207189251Ssam 208189251Ssam /** 209189251Ssam * WPA_COMPLETED - All authentication completed 210189251Ssam * 211189251Ssam * This state is entered when the full authentication process is 212189251Ssam * completed. In case of WPA2, this happens when the 4-Way Handshake is 213189251Ssam * successfully completed. With WPA, this state is entered after the 214189251Ssam * Group Key Handshake; with IEEE 802.1X (non-WPA) connection is 215189251Ssam * completed after dynamic keys are received (or if not used, after 216189251Ssam * the EAP authentication has been completed). With static WEP keys and 217189251Ssam * plaintext connections, this state is entered when an association 218189251Ssam * has been completed. 219189251Ssam * 220189251Ssam * This state indicates that the supplicant has completed its 221189251Ssam * processing for the association phase and that data connection is 222189251Ssam * fully configured. 223189251Ssam */ 224189251Ssam WPA_COMPLETED 225214734Srpaulo}; 226189251Ssam 227189251Ssam#define MLME_SETPROTECTION_PROTECT_TYPE_NONE 0 228189251Ssam#define MLME_SETPROTECTION_PROTECT_TYPE_RX 1 229189251Ssam#define MLME_SETPROTECTION_PROTECT_TYPE_TX 2 230189251Ssam#define MLME_SETPROTECTION_PROTECT_TYPE_RX_TX 3 231189251Ssam 232189251Ssam#define MLME_SETPROTECTION_KEY_TYPE_GROUP 0 233189251Ssam#define MLME_SETPROTECTION_KEY_TYPE_PAIRWISE 1 234189251Ssam 235214734Srpaulo 236214734Srpaulo/** 237214734Srpaulo * enum mfp_options - Management frame protection (IEEE 802.11w) options 238214734Srpaulo */ 239214734Srpauloenum mfp_options { 240214734Srpaulo NO_MGMT_FRAME_PROTECTION = 0, 241214734Srpaulo MGMT_FRAME_PROTECTION_OPTIONAL = 1, 242214734Srpaulo MGMT_FRAME_PROTECTION_REQUIRED = 2 243214734Srpaulo}; 244214734Srpaulo 245214734Srpaulo/** 246214734Srpaulo * enum hostapd_hw_mode - Hardware mode 247214734Srpaulo */ 248214734Srpauloenum hostapd_hw_mode { 249214734Srpaulo HOSTAPD_MODE_IEEE80211B, 250214734Srpaulo HOSTAPD_MODE_IEEE80211G, 251214734Srpaulo HOSTAPD_MODE_IEEE80211A, 252214734Srpaulo NUM_HOSTAPD_MODES 253214734Srpaulo}; 254214734Srpaulo 255189251Ssam#endif /* DEFS_H */ 256