an, awi, cue and kue don't use the miibus interface.
[dragonfly.git] / contrib / wpa_supplicant-0.4.9 / config.h
1 /*
2  * WPA Supplicant / Configuration file structures
3  * Copyright (c) 2003-2005, Jouni Malinen <jkmaline@cc.hut.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 CONFIG_H
16 #define CONFIG_H
17
18 #ifdef CONFIG_CTRL_IFACE
19 #ifndef CONFIG_CTRL_IFACE_UDP
20 #include <grp.h>
21 #endif /* CONFIG_CTRL_IFACE_UDP */
22 #endif /* CONFIG_CTRL_IFACE */
23
24 #define DEFAULT_EAPOL_VERSION 1
25 #define DEFAULT_AP_SCAN 1
26 #define DEFAULT_FAST_REAUTH 1
27
28 #include "config_ssid.h"
29
30 /**
31  * struct wpa_config_blob - Named configuration blob
32  *
33  * This data structure is used to provide storage for binary objects to store
34  * abstract information like certificates and private keys inlined with the
35  * configuration data.
36  */
37 struct wpa_config_blob {
38         /**
39          * name - Blob name
40          */
41         char *name;
42
43         /**
44          * data - Pointer to binary data
45          */
46         u8 *data;
47
48         /**
49          * len - Length of binary data
50          */
51         size_t len;
52
53         /**
54          * next - Pointer to next blob in the configuration
55          */
56         struct wpa_config_blob *next;
57 };
58
59
60 /**
61  * struct wpa_config - wpa_supplicant configuration data
62  *
63  * This data structure is presents the per-interface (radio) configuration
64  * data. In many cases, there is only one struct wpa_config instance, but if
65  * more than one network interface is being controlled, one instance is used
66  * for each.
67  */
68 struct wpa_config {
69         /**
70          * ssid - Head of the global network list
71          *
72          * This is the head for the list of all the configured networks.
73          */
74         struct wpa_ssid *ssid;
75
76         /**
77          * pssid - Per-priority network lists (in priority order)
78          */
79         struct wpa_ssid **pssid;
80
81         /**
82          * num_prio - Number of different priorities used in the pssid lists
83          *
84          * This indicates how many per-priority network lists are included in
85          * pssid.
86          */
87         int num_prio;
88
89         /**
90          * eapol_version - IEEE 802.1X/EAPOL version number
91          *
92          * wpa_supplicant is implemented based on IEEE Std 802.1X-2004 which
93          * defines EAPOL version 2. However, there are many APs that do not
94          * handle the new version number correctly (they seem to drop the
95          * frames completely). In order to make wpa_supplicant interoperate
96          * with these APs, the version number is set to 1 by default. This
97          * configuration value can be used to set it to the new version (2).
98          */
99         int eapol_version;
100
101         /**
102          * ap_scan - AP scanning/selection
103          *
104          * By default, wpa_supplicant requests driver to perform AP
105          * scanning and then uses the scan results to select a
106          * suitable AP. Another alternative is to allow the driver to
107          * take care of AP scanning and selection and use
108          * wpa_supplicant just to process EAPOL frames based on IEEE
109          * 802.11 association information from the driver.
110          *
111          * 1: wpa_supplicant initiates scanning and AP selection (default).
112          *
113          * 0: Driver takes care of scanning, AP selection, and IEEE 802.11
114          * association parameters (e.g., WPA IE generation); this mode can
115          * also be used with non-WPA drivers when using IEEE 802.1X mode;
116          * do not try to associate with APs (i.e., external program needs
117          * to control association). This mode must also be used when using
118          * wired Ethernet drivers.
119          *
120          * 2: like 0, but associate with APs using security policy and SSID
121          * (but not BSSID); this can be used, e.g., with ndiswrapper and NDIS
122          * drivers to enable operation with hidden SSIDs and optimized roaming;
123          * in this mode, the network blocks in the configuration are tried
124          * one by one until the driver reports successful association; each
125          * network block should have explicit security policy (i.e., only one
126          * option in the lists) for key_mgmt, pairwise, group, proto variables.
127          */
128         int ap_scan;
129
130         /**
131          * ctrl_interface - Directory for UNIX domain sockets
132          *
133          * This variable is used to configure where the UNIX domain sockets
134          * for the control interface are created. If UDP-based ctrl_iface is
135          * used, this variable can be set to any string (i.e., %NULL is not
136          * allowed).
137          */
138         char *ctrl_interface;
139
140 #ifdef CONFIG_CTRL_IFACE
141 #ifndef CONFIG_CTRL_IFACE_UDP
142         /**
143          * ctrl_interface_gid - Group identity for the UNIX domain sockets
144          *
145          * Access control for the control interface can be configured
146          * by setting the directory to allow only members of a group
147          * to use sockets. This way, it is possible to run
148          * wpa_supplicant as root (since it needs to change network
149          * configuration and open raw sockets) and still allow GUI/CLI
150          * components to be run as non-root users. However, since the
151          * control interface can be used to change the network
152          * configuration, this access needs to be protected in many
153          * cases. By default, wpa_supplicant is configured to use gid
154          * 0 (root). If you want to allow non-root users to use the
155          * control interface, add a new group and change this value to
156          * match with that group. Add users that should have control
157          * interface access to this group.
158          */
159         gid_t ctrl_interface_gid;
160 #endif /* CONFIG_CTRL_IFACE_UDP */
161         /**
162          * ctrl_interface_gid_set - Whether ctrl_interface_gid is used
163          *
164          * If this variable is zero, ctrl_interface_gid value is not used and
165          * group will not be changed from the value it got by default
166          * when the directory or socket was created.
167          */
168         int ctrl_interface_gid_set;
169 #endif /* CONFIG_CTRL_IFACE */
170
171         /**
172          * fast_reauth - EAP fast re-authentication (session resumption)
173          *
174          * By default, fast re-authentication is enabled for all EAP methods
175          * that support it. This variable can be used to disable fast
176          * re-authentication (by setting fast_reauth=0). Normally, there is no
177          * need to disable fast re-authentication.
178          */
179         int fast_reauth;
180
181         /**
182          * opensc_engine_path - Path to the OpenSSL engine for opensc
183          *
184          * This is an OpenSSL specific configuration option for loading OpenSC
185          * engine (engine_opensc.so); if %NULL, this engine is not loaded.
186          */
187         char *opensc_engine_path;
188
189         /**
190          * pkcs11_engine_path - Path to the OpenSSL engine for PKCS#11
191          *
192          * This is an OpenSSL specific configuration option for loading PKCS#11
193          * engine (engine_pkcs11.so); if %NULL, this engine is not loaded.
194          */
195         char *pkcs11_engine_path;
196
197         /**
198          * pkcs11_module_path - Path to the OpenSSL OpenSC/PKCS#11 module
199          *
200          * This is an OpenSSL specific configuration option for configuring
201          * path to OpenSC/PKCS#11 engine (opensc-pkcs11.so); if %NULL, this
202          * module is not loaded.
203          */
204         char *pkcs11_module_path;
205
206         /**
207          * driver_param - Driver interface parameters
208          *
209          * This text string is passed to the selected driver interface with the
210          * optional struct wpa_driver_ops::set_param() handler. This can be
211          * used to configure driver specific options without having to add new
212          * driver interface functionality.
213          */
214         char *driver_param;
215
216         /**
217          * dot11RSNAConfigPMKLifetime - Maximum lifetime of a PMK
218          *
219          * dot11 MIB variable for the maximum lifetime of a PMK in the PMK
220          * cache (unit: seconds).
221          */
222         unsigned int dot11RSNAConfigPMKLifetime;
223
224         /**
225          * dot11RSNAConfigPMKReauthThreshold - PMK re-authentication threshold
226          *
227          * dot11 MIB variable for the percentage of the PMK lifetime
228          * that should expire before an IEEE 802.1X reauthentication occurs.
229          */
230         unsigned int dot11RSNAConfigPMKReauthThreshold;
231
232         /**
233          * dot11RSNAConfigSATimeout - Security association timeout
234          *
235          * dot11 MIB variable for the maximum time a security association
236          * shall take to set up (unit: seconds).
237          */
238         unsigned int dot11RSNAConfigSATimeout;
239
240         /**
241          * update_config - Is wpa_supplicant allowed to update configuration
242          *
243          * This variable control whether wpa_supplicant is allow to re-write
244          * its configuration with wpa_config_write(). If this is zero,
245          * configuration data is only changed in memory and the external data
246          * is not overriden. If this is non-zero, wpa_supplicant will update
247          * the configuration data (e.g., a file) whenever configuration is
248          * changed. This update may replace the old configuration which can
249          * remove comments from it in case of a text file configuration.
250          */
251         int update_config;
252
253         /**
254          * blobs - Configuration blobs
255          */
256         struct wpa_config_blob *blobs;
257 };
258
259
260 /* Prototypes for common functions from config.c */
261
262 void wpa_config_free(struct wpa_config *ssid);
263 void wpa_config_free_ssid(struct wpa_ssid *ssid);
264 struct wpa_ssid * wpa_config_get_network(struct wpa_config *config, int id);
265 struct wpa_ssid * wpa_config_add_network(struct wpa_config *config);
266 int wpa_config_remove_network(struct wpa_config *config, int id);
267 void wpa_config_set_network_defaults(struct wpa_ssid *ssid);
268 int wpa_config_set(struct wpa_ssid *ssid, const char *var, const char *value,
269                    int line);
270 char * wpa_config_get(struct wpa_ssid *ssid, const char *var);
271 void wpa_config_update_psk(struct wpa_ssid *ssid);
272 int wpa_config_add_prio_network(struct wpa_config *config,
273                                 struct wpa_ssid *ssid);
274
275 const struct wpa_config_blob * wpa_config_get_blob(struct wpa_config *config,
276                                                    const char *name);
277 void wpa_config_set_blob(struct wpa_config *config,
278                          struct wpa_config_blob *blob);
279 void wpa_config_free_blob(struct wpa_config_blob *blob);
280 int wpa_config_remove_blob(struct wpa_config *config, const char *name);
281 struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
282                                            const char *driver_param);
283
284
285 /* Prototypes for backend specific functions from the selected config_*.c */
286
287 /**
288  * wpa_config_read - Read and parse configuration database
289  * @name: Name of the configuration (e.g., path and file name for the
290  * configuration file)
291  * Returns: Pointer to allocated configuration data or %NULL on failure
292  *
293  * This function reads configuration data, parses its contents, and allocates
294  * data structures needed for storing configuration information. The allocated
295  * data can be freed with wpa_config_free().
296  *
297  * Each configuration backend needs to implement this function.
298  */
299 struct wpa_config * wpa_config_read(const char *name);
300
301 /**
302  * wpa_config_write - Write or update configuration data
303  * @name: Name of the configuration (e.g., path and file name for the
304  * configuration file)
305  * @config: Configuration data from wpa_config_read()
306  * Returns: 0 on success, -1 on failure
307  *
308  * This function write all configuration data into an external database (e.g.,
309  * a text file) in a format that can be read with wpa_config_read(). This can
310  * be used to allow wpa_supplicant to update its configuration, e.g., when a
311  * new network is added or a password is changed.
312  *
313  * Each configuration backend needs to implement this function.
314  */
315 int wpa_config_write(const char *name, struct wpa_config *config);
316
317 #endif /* CONFIG_H */