hostapd: remove version tag from directory
[dragonfly.git] / contrib / hostapd / config.h
blobfafe8e041106d68077a6bfaa90c4c257cdd9eaf5
1 /*
2 * hostapd / Configuration file
3 * Copyright (c) 2003-2006, Jouni Malinen <j@w1.fi>
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.
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
12 * See README and COPYING for more details.
15 #ifndef CONFIG_H
16 #define CONFIG_H
18 #include "config_types.h"
20 typedef u8 macaddr[ETH_ALEN];
22 struct hostapd_radius_servers;
24 #define HOSTAPD_MAX_SSID_LEN 32
26 #define NUM_WEP_KEYS 4
27 struct hostapd_wep_keys {
28 u8 idx;
29 u8 *key[NUM_WEP_KEYS];
30 size_t len[NUM_WEP_KEYS];
31 int keys_set;
32 size_t default_len; /* key length used for dynamic key generation */
35 typedef enum hostap_security_policy {
36 SECURITY_PLAINTEXT = 0,
37 SECURITY_STATIC_WEP = 1,
38 SECURITY_IEEE_802_1X = 2,
39 SECURITY_WPA_PSK = 3,
40 SECURITY_WPA = 4
41 } secpolicy;
43 struct hostapd_ssid {
44 char ssid[HOSTAPD_MAX_SSID_LEN + 1];
45 size_t ssid_len;
46 int ssid_set;
48 char vlan[IFNAMSIZ + 1];
49 secpolicy security_policy;
51 struct hostapd_wpa_psk *wpa_psk;
52 char *wpa_passphrase;
53 char *wpa_psk_file;
55 struct hostapd_wep_keys wep;
57 #define DYNAMIC_VLAN_DISABLED 0
58 #define DYNAMIC_VLAN_OPTIONAL 1
59 #define DYNAMIC_VLAN_REQUIRED 2
60 int dynamic_vlan;
61 #ifdef CONFIG_FULL_DYNAMIC_VLAN
62 char *vlan_tagged_interface;
63 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
64 struct hostapd_wep_keys **dyn_vlan_keys;
65 size_t max_dyn_vlan_keys;
69 #define VLAN_ID_WILDCARD -1
71 struct hostapd_vlan {
72 struct hostapd_vlan *next;
73 int vlan_id; /* VLAN ID or -1 (VLAN_ID_WILDCARD) for wildcard entry */
74 char ifname[IFNAMSIZ + 1];
75 int dynamic_vlan;
76 #ifdef CONFIG_FULL_DYNAMIC_VLAN
78 #define DVLAN_CLEAN_BR 0x1
79 #define DVLAN_CLEAN_VLAN 0x2
80 #define DVLAN_CLEAN_VLAN_PORT 0x4
81 #define DVLAN_CLEAN_WLAN_PORT 0x8
82 int clean;
83 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
86 #define PMK_LEN 32
87 struct hostapd_wpa_psk {
88 struct hostapd_wpa_psk *next;
89 int group;
90 u8 psk[PMK_LEN];
91 u8 addr[ETH_ALEN];
94 #define EAP_USER_MAX_METHODS 8
95 struct hostapd_eap_user {
96 struct hostapd_eap_user *next;
97 u8 *identity;
98 size_t identity_len;
99 struct {
100 int vendor;
101 u32 method;
102 } methods[EAP_USER_MAX_METHODS];
103 u8 *password;
104 size_t password_len;
105 int phase2;
106 int force_version;
107 unsigned int wildcard_prefix:1;
108 unsigned int password_hash:1; /* whether password is hashed with
109 * nt_password_hash() */
113 #define NUM_TX_QUEUES 8
115 struct hostapd_tx_queue_params {
116 int aifs;
117 int cwmin;
118 int cwmax;
119 int burst; /* maximum burst time in 0.1 ms, i.e., 10 = 1 ms */
120 int configured;
123 struct hostapd_wme_ac_params {
124 int cwmin;
125 int cwmax;
126 int aifs;
127 int txopLimit; /* in units of 32us */
128 int admission_control_mandatory;
133 * struct hostapd_bss_config - Per-BSS configuration
135 struct hostapd_bss_config {
136 char iface[IFNAMSIZ + 1];
137 char bridge[IFNAMSIZ + 1];
139 enum {
140 HOSTAPD_LEVEL_DEBUG_VERBOSE = 0,
141 HOSTAPD_LEVEL_DEBUG = 1,
142 HOSTAPD_LEVEL_INFO = 2,
143 HOSTAPD_LEVEL_NOTICE = 3,
144 HOSTAPD_LEVEL_WARNING = 4
145 } logger_syslog_level, logger_stdout_level;
147 #define HOSTAPD_MODULE_IEEE80211 BIT(0)
148 #define HOSTAPD_MODULE_IEEE8021X BIT(1)
149 #define HOSTAPD_MODULE_RADIUS BIT(2)
150 #define HOSTAPD_MODULE_WPA BIT(3)
151 #define HOSTAPD_MODULE_DRIVER BIT(4)
152 #define HOSTAPD_MODULE_IAPP BIT(5)
153 #define HOSTAPD_MODULE_MLME BIT(6)
154 unsigned int logger_syslog; /* module bitfield */
155 unsigned int logger_stdout; /* module bitfield */
157 enum { HOSTAPD_DEBUG_NO = 0, HOSTAPD_DEBUG_MINIMAL = 1,
158 HOSTAPD_DEBUG_VERBOSE = 2,
159 HOSTAPD_DEBUG_MSGDUMPS = 3,
160 HOSTAPD_DEBUG_EXCESSIVE = 4 } debug; /* debug verbosity level */
161 char *dump_log_name; /* file name for state dump (SIGUSR1) */
163 int max_num_sta; /* maximum number of STAs in station table */
165 int dtim_period;
167 int ieee802_1x; /* use IEEE 802.1X */
168 int eapol_version;
169 int eap_server; /* Use internal EAP server instead of external
170 * RADIUS server */
171 struct hostapd_eap_user *eap_user;
172 char *eap_sim_db;
173 struct hostapd_ip_addr own_ip_addr;
174 char *nas_identifier;
175 struct hostapd_radius_servers *radius;
177 struct hostapd_ssid ssid;
179 char *eap_req_id_text; /* optional displayable message sent with
180 * EAP Request-Identity */
181 size_t eap_req_id_text_len;
182 int eapol_key_index_workaround;
184 size_t default_wep_key_len;
185 int individual_wep_key_len;
186 int wep_rekeying_period;
187 int broadcast_key_idx_min, broadcast_key_idx_max;
188 int eap_reauth_period;
190 int ieee802_11f; /* use IEEE 802.11f (IAPP) */
191 char iapp_iface[IFNAMSIZ + 1]; /* interface used with IAPP broadcast
192 * frames */
194 u8 assoc_ap_addr[ETH_ALEN];
195 int assoc_ap; /* whether assoc_ap_addr is set */
197 enum {
198 ACCEPT_UNLESS_DENIED = 0,
199 DENY_UNLESS_ACCEPTED = 1,
200 USE_EXTERNAL_RADIUS_AUTH = 2
201 } macaddr_acl;
202 macaddr *accept_mac;
203 int num_accept_mac;
204 macaddr *deny_mac;
205 int num_deny_mac;
207 #define HOSTAPD_AUTH_OPEN BIT(0)
208 #define HOSTAPD_AUTH_SHARED_KEY BIT(1)
209 int auth_algs; /* bitfield of allowed IEEE 802.11 authentication
210 * algorithms */
212 #define HOSTAPD_WPA_VERSION_WPA BIT(0)
213 #define HOSTAPD_WPA_VERSION_WPA2 BIT(1)
214 int wpa;
215 #define WPA_KEY_MGMT_IEEE8021X BIT(0)
216 #define WPA_KEY_MGMT_PSK BIT(1)
217 int wpa_key_mgmt;
218 #define WPA_CIPHER_NONE BIT(0)
219 #define WPA_CIPHER_WEP40 BIT(1)
220 #define WPA_CIPHER_WEP104 BIT(2)
221 #define WPA_CIPHER_TKIP BIT(3)
222 #define WPA_CIPHER_CCMP BIT(4)
223 #ifdef CONFIG_IEEE80211W
224 #define WPA_CIPHER_AES_128_CMAC BIT(5)
225 enum {
226 NO_IEEE80211W = 0,
227 IEEE80211W_OPTIONAL = 1,
228 IEEE80211W_REQUIRED = 2
229 } ieee80211w;
230 #endif /* CONFIG_IEEE80211W */
231 int wpa_pairwise;
232 int wpa_group;
233 int wpa_group_rekey;
234 int wpa_strict_rekey;
235 int wpa_gmk_rekey;
236 int rsn_preauth;
237 char *rsn_preauth_interfaces;
238 int peerkey;
240 char *ctrl_interface; /* directory for UNIX domain sockets */
241 gid_t ctrl_interface_gid;
242 int ctrl_interface_gid_set;
244 char *ca_cert;
245 char *server_cert;
246 char *private_key;
247 char *private_key_passwd;
248 int check_crl;
250 char *radius_server_clients;
251 int radius_server_auth_port;
252 int radius_server_ipv6;
254 char *test_socket; /* UNIX domain socket path for driver_test */
256 int use_pae_group_addr; /* Whether to send EAPOL frames to PAE group
257 * address instead of individual address
258 * (for driver_wired.c).
261 int ap_max_inactivity;
262 int ignore_broadcast_ssid;
264 int wme_enabled;
266 struct hostapd_vlan *vlan, *vlan_tail;
268 macaddr bssid;
272 typedef enum {
273 HOSTAPD_MODE_IEEE80211B,
274 HOSTAPD_MODE_IEEE80211G,
275 HOSTAPD_MODE_IEEE80211A,
276 NUM_HOSTAPD_MODES
277 } hostapd_hw_mode;
281 * struct hostapd_config - Per-radio interface configuration
283 struct hostapd_config {
284 struct hostapd_bss_config *bss, *last_bss;
285 struct hostapd_radius_servers *radius;
286 size_t num_bss;
288 u16 beacon_int;
289 int rts_threshold;
290 int fragm_threshold;
291 u8 send_probe_response;
292 u8 channel;
293 hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
294 enum {
295 LONG_PREAMBLE = 0,
296 SHORT_PREAMBLE = 1
297 } preamble;
298 enum {
299 CTS_PROTECTION_AUTOMATIC = 0,
300 CTS_PROTECTION_FORCE_ENABLED = 1,
301 CTS_PROTECTION_FORCE_DISABLED = 2,
302 CTS_PROTECTION_AUTOMATIC_NO_OLBC = 3,
303 } cts_protection_type;
305 int *supported_rates;
306 int *basic_rates;
308 const struct driver_ops *driver;
310 int passive_scan_interval; /* seconds, 0 = disabled */
311 int passive_scan_listen; /* usec */
312 int passive_scan_mode;
313 int ap_table_max_size;
314 int ap_table_expiration_time;
316 char country[3]; /* first two octets: country code as described in
317 * ISO/IEC 3166-1. Third octet:
318 * ' ' (ascii 32): all environments
319 * 'O': Outdoor environemnt only
320 * 'I': Indoor environment only
323 int ieee80211d;
324 unsigned int ieee80211h; /* Enable/Disable 80211h */
326 struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
329 * WME AC parameters, in same order as 802.1D, i.e.
330 * 0 = BE (best effort)
331 * 1 = BK (background)
332 * 2 = VI (video)
333 * 3 = VO (voice)
335 struct hostapd_wme_ac_params wme_ac_params[4];
337 enum {
338 INTERNAL_BRIDGE_DO_NOT_CONTROL = -1,
339 INTERNAL_BRIDGE_DISABLED = 0,
340 INTERNAL_BRIDGE_ENABLED = 1
341 } bridge_packets;
345 int hostapd_mac_comp(const void *a, const void *b);
346 int hostapd_mac_comp_empty(const void *a);
347 struct hostapd_config * hostapd_config_read(const char *fname);
348 void hostapd_config_free(struct hostapd_config *conf);
349 int hostapd_maclist_found(macaddr *list, int num_entries, const u8 *addr);
350 int hostapd_rate_found(int *list, int rate);
351 int hostapd_wep_key_cmp(struct hostapd_wep_keys *a,
352 struct hostapd_wep_keys *b);
353 const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
354 const u8 *addr, const u8 *prev_psk);
355 int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
356 const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan,
357 int vlan_id);
358 const struct hostapd_eap_user *
359 hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
360 size_t identity_len, int phase2);
362 #endif /* CONFIG_H */