HS 2.0R2: Add support for Policy/MaximumBSSLoadValue
[mech_eap.git] / wpa_supplicant / config.h
1 /*
2  * WPA Supplicant / Configuration file structures
3  * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8
9 #ifndef CONFIG_H
10 #define CONFIG_H
11
12 #define DEFAULT_EAPOL_VERSION 1
13 #ifdef CONFIG_NO_SCAN_PROCESSING
14 #define DEFAULT_AP_SCAN 2
15 #else /* CONFIG_NO_SCAN_PROCESSING */
16 #define DEFAULT_AP_SCAN 1
17 #endif /* CONFIG_NO_SCAN_PROCESSING */
18 #define DEFAULT_FAST_REAUTH 1
19 #define DEFAULT_P2P_GO_INTENT 7
20 #define DEFAULT_P2P_INTRA_BSS 1
21 #define DEFAULT_P2P_GO_MAX_INACTIVITY (5 * 60)
22 #define DEFAULT_BSS_MAX_COUNT 200
23 #define DEFAULT_BSS_EXPIRATION_AGE 180
24 #define DEFAULT_BSS_EXPIRATION_SCAN_COUNT 2
25 #define DEFAULT_MAX_NUM_STA 128
26 #define DEFAULT_ACCESS_NETWORK_TYPE 15
27 #define DEFAULT_SCAN_CUR_FREQ 0
28
29 #include "config_ssid.h"
30 #include "wps/wps.h"
31 #include "common/ieee802_11_common.h"
32
33
34 struct wpa_cred {
35         /**
36          * next - Next credential in the list
37          *
38          * This pointer can be used to iterate over all credentials. The head
39          * of this list is stored in the cred field of struct wpa_config.
40          */
41         struct wpa_cred *next;
42
43         /**
44          * id - Unique id for the credential
45          *
46          * This identifier is used as a unique identifier for each credential
47          * block when using the control interface. Each credential is allocated
48          * an id when it is being created, either when reading the
49          * configuration file or when a new credential is added through the
50          * control interface.
51          */
52         int id;
53
54         /**
55          * temporary - Whether this credential is temporary and not to be saved
56          */
57         int temporary;
58
59         /**
60          * priority - Priority group
61          *
62          * By default, all networks and credentials get the same priority group
63          * (0). This field can be used to give higher priority for credentials
64          * (and similarly in struct wpa_ssid for network blocks) to change the
65          * Interworking automatic networking selection behavior. The matching
66          * network (based on either an enabled network block or a credential)
67          * with the highest priority value will be selected.
68          */
69         int priority;
70
71         /**
72          * pcsc - Use PC/SC and SIM/USIM card
73          */
74         int pcsc;
75
76         /**
77          * realm - Home Realm for Interworking
78          */
79         char *realm;
80
81         /**
82          * username - Username for Interworking network selection
83          */
84         char *username;
85
86         /**
87          * password - Password for Interworking network selection
88          */
89         char *password;
90
91         /**
92          * ext_password - Whether password is a name for external storage
93          */
94         int ext_password;
95
96         /**
97          * ca_cert - CA certificate for Interworking network selection
98          */
99         char *ca_cert;
100
101         /**
102          * client_cert - File path to client certificate file (PEM/DER)
103          *
104          * This field is used with Interworking networking selection for a case
105          * where client certificate/private key is used for authentication
106          * (EAP-TLS). Full path to the file should be used since working
107          * directory may change when wpa_supplicant is run in the background.
108          *
109          * Alternatively, a named configuration blob can be used by setting
110          * this to blob://blob_name.
111          */
112         char *client_cert;
113
114         /**
115          * private_key - File path to client private key file (PEM/DER/PFX)
116          *
117          * When PKCS#12/PFX file (.p12/.pfx) is used, client_cert should be
118          * commented out. Both the private key and certificate will be read
119          * from the PKCS#12 file in this case. Full path to the file should be
120          * used since working directory may change when wpa_supplicant is run
121          * in the background.
122          *
123          * Windows certificate store can be used by leaving client_cert out and
124          * configuring private_key in one of the following formats:
125          *
126          * cert://substring_to_match
127          *
128          * hash://certificate_thumbprint_in_hex
129          *
130          * For example: private_key="hash://63093aa9c47f56ae88334c7b65a4"
131          *
132          * Note that when running wpa_supplicant as an application, the user
133          * certificate store (My user account) is used, whereas computer store
134          * (Computer account) is used when running wpasvc as a service.
135          *
136          * Alternatively, a named configuration blob can be used by setting
137          * this to blob://blob_name.
138          */
139         char *private_key;
140
141         /**
142          * private_key_passwd - Password for private key file
143          */
144         char *private_key_passwd;
145
146         /**
147          * imsi - IMSI in <MCC> | <MNC> | '-' | <MSIN> format
148          */
149         char *imsi;
150
151         /**
152          * milenage - Milenage parameters for SIM/USIM simulator in
153          *      <Ki>:<OPc>:<SQN> format
154          */
155         char *milenage;
156
157         /**
158          * domain_suffix_match - Constraint for server domain name
159          *
160          * If set, this FQDN is used as a suffix match requirement for the AAA
161          * server certificate in SubjectAltName dNSName element(s). If a
162          * matching dNSName is found, this constraint is met. If no dNSName
163          * values are present, this constraint is matched against SubjetName CN
164          * using same suffix match comparison. Suffix match here means that the
165          * host/domain name is compared one label at a time starting from the
166          * top-level domain and all the labels in @domain_suffix_match shall be
167          * included in the certificate. The certificate may include additional
168          * sub-level labels in addition to the required labels.
169          *
170          * For example, domain_suffix_match=example.com would match
171          * test.example.com but would not match test-example.com.
172          */
173         char *domain_suffix_match;
174
175         /**
176          * domain - Home service provider FQDN(s)
177          *
178          * This is used to compare against the Domain Name List to figure out
179          * whether the AP is operated by the Home SP. Multiple domain entries
180          * can be used to configure alternative FQDNs that will be considered
181          * home networks.
182          */
183         char **domain;
184
185         /**
186          * num_domain - Number of FQDNs in the domain array
187          */
188         size_t num_domain;
189
190         /**
191          * roaming_consortium - Roaming Consortium OI
192          *
193          * If roaming_consortium_len is non-zero, this field contains the
194          * Roaming Consortium OI that can be used to determine which access
195          * points support authentication with this credential. This is an
196          * alternative to the use of the realm parameter. When using Roaming
197          * Consortium to match the network, the EAP parameters need to be
198          * pre-configured with the credential since the NAI Realm information
199          * may not be available or fetched.
200          */
201         u8 roaming_consortium[15];
202
203         /**
204          * roaming_consortium_len - Length of roaming_consortium
205          */
206         size_t roaming_consortium_len;
207
208         u8 required_roaming_consortium[15];
209         size_t required_roaming_consortium_len;
210
211         /**
212          * eap_method - EAP method to use
213          *
214          * Pre-configured EAP method to use with this credential or %NULL to
215          * indicate no EAP method is selected, i.e., the method will be
216          * selected automatically based on ANQP information.
217          */
218         struct eap_method_type *eap_method;
219
220         /**
221          * phase1 - Phase 1 (outer authentication) parameters
222          *
223          * Pre-configured EAP parameters or %NULL.
224          */
225         char *phase1;
226
227         /**
228          * phase2 - Phase 2 (inner authentication) parameters
229          *
230          * Pre-configured EAP parameters or %NULL.
231          */
232         char *phase2;
233
234         struct excluded_ssid {
235                 u8 ssid[MAX_SSID_LEN];
236                 size_t ssid_len;
237         } *excluded_ssid;
238         size_t num_excluded_ssid;
239
240         struct roaming_partner {
241                 char fqdn[128];
242                 int exact_match;
243                 u8 priority;
244                 char country[3];
245         } *roaming_partner;
246         size_t num_roaming_partner;
247
248         int update_identifier;
249
250         /**
251          * provisioning_sp - FQDN of the SP that provisioned the credential
252          */
253         char *provisioning_sp;
254
255         unsigned int min_dl_bandwidth_home;
256         unsigned int min_ul_bandwidth_home;
257         unsigned int min_dl_bandwidth_roaming;
258         unsigned int min_ul_bandwidth_roaming;
259
260         /**
261          * max_bss_load - Maximum BSS Load Channel Utilization (1..255)
262          * This value is used as the maximum channel utilization for network
263          * selection purposes for home networks. If the AP does not advertise
264          * BSS Load or if the limit would prevent any connection, this
265          * constraint will be ignored.
266          */
267         unsigned int max_bss_load;
268 };
269
270
271 #define CFG_CHANGED_DEVICE_NAME BIT(0)
272 #define CFG_CHANGED_CONFIG_METHODS BIT(1)
273 #define CFG_CHANGED_DEVICE_TYPE BIT(2)
274 #define CFG_CHANGED_OS_VERSION BIT(3)
275 #define CFG_CHANGED_UUID BIT(4)
276 #define CFG_CHANGED_COUNTRY BIT(5)
277 #define CFG_CHANGED_SEC_DEVICE_TYPE BIT(6)
278 #define CFG_CHANGED_P2P_SSID_POSTFIX BIT(7)
279 #define CFG_CHANGED_WPS_STRING BIT(8)
280 #define CFG_CHANGED_P2P_INTRA_BSS BIT(9)
281 #define CFG_CHANGED_VENDOR_EXTENSION BIT(10)
282 #define CFG_CHANGED_P2P_LISTEN_CHANNEL BIT(11)
283 #define CFG_CHANGED_P2P_OPER_CHANNEL BIT(12)
284 #define CFG_CHANGED_P2P_PREF_CHAN BIT(13)
285 #define CFG_CHANGED_EXT_PW_BACKEND BIT(14)
286 #define CFG_CHANGED_NFC_PASSWORD_TOKEN BIT(15)
287
288 /**
289  * struct wpa_config - wpa_supplicant configuration data
290  *
291  * This data structure is presents the per-interface (radio) configuration
292  * data. In many cases, there is only one struct wpa_config instance, but if
293  * more than one network interface is being controlled, one instance is used
294  * for each.
295  */
296 struct wpa_config {
297         /**
298          * ssid - Head of the global network list
299          *
300          * This is the head for the list of all the configured networks.
301          */
302         struct wpa_ssid *ssid;
303
304         /**
305          * pssid - Per-priority network lists (in priority order)
306          */
307         struct wpa_ssid **pssid;
308
309         /**
310          * num_prio - Number of different priorities used in the pssid lists
311          *
312          * This indicates how many per-priority network lists are included in
313          * pssid.
314          */
315         int num_prio;
316
317         /**
318          * cred - Head of the credential list
319          *
320          * This is the head for the list of all the configured credentials.
321          */
322         struct wpa_cred *cred;
323
324         /**
325          * eapol_version - IEEE 802.1X/EAPOL version number
326          *
327          * wpa_supplicant is implemented based on IEEE Std 802.1X-2004 which
328          * defines EAPOL version 2. However, there are many APs that do not
329          * handle the new version number correctly (they seem to drop the
330          * frames completely). In order to make wpa_supplicant interoperate
331          * with these APs, the version number is set to 1 by default. This
332          * configuration value can be used to set it to the new version (2).
333          */
334         int eapol_version;
335
336         /**
337          * ap_scan - AP scanning/selection
338          *
339          * By default, wpa_supplicant requests driver to perform AP
340          * scanning and then uses the scan results to select a
341          * suitable AP. Another alternative is to allow the driver to
342          * take care of AP scanning and selection and use
343          * wpa_supplicant just to process EAPOL frames based on IEEE
344          * 802.11 association information from the driver.
345          *
346          * 1: wpa_supplicant initiates scanning and AP selection (default).
347          *
348          * 0: Driver takes care of scanning, AP selection, and IEEE 802.11
349          * association parameters (e.g., WPA IE generation); this mode can
350          * also be used with non-WPA drivers when using IEEE 802.1X mode;
351          * do not try to associate with APs (i.e., external program needs
352          * to control association). This mode must also be used when using
353          * wired Ethernet drivers.
354          *
355          * 2: like 0, but associate with APs using security policy and SSID
356          * (but not BSSID); this can be used, e.g., with ndiswrapper and NDIS
357          * drivers to enable operation with hidden SSIDs and optimized roaming;
358          * in this mode, the network blocks in the configuration are tried
359          * one by one until the driver reports successful association; each
360          * network block should have explicit security policy (i.e., only one
361          * option in the lists) for key_mgmt, pairwise, group, proto variables.
362          */
363         int ap_scan;
364
365         /**
366          * bgscan - Background scan and roaming parameters or %NULL if none
367          *
368          * This is an optional set of parameters for background scanning and
369          * roaming within a network (ESS). For more detailed information see
370          * ssid block documentation.
371          *
372          * The variable defines default bgscan behavior for all BSS station
373          * networks except for those which have their own bgscan configuration.
374          */
375          char *bgscan;
376
377         /**
378          * disable_scan_offload - Disable automatic offloading of scan requests
379          *
380          * By default, %wpa_supplicant tries to offload scanning if the driver
381          * indicates support for this (sched_scan). This configuration
382          * parameter can be used to disable this offloading mechanism.
383          */
384         int disable_scan_offload;
385
386         /**
387          * ctrl_interface - Parameters for the control interface
388          *
389          * If this is specified, %wpa_supplicant will open a control interface
390          * that is available for external programs to manage %wpa_supplicant.
391          * The meaning of this string depends on which control interface
392          * mechanism is used. For all cases, the existence of this parameter
393          * in configuration is used to determine whether the control interface
394          * is enabled.
395          *
396          * For UNIX domain sockets (default on Linux and BSD): This is a
397          * directory that will be created for UNIX domain sockets for listening
398          * to requests from external programs (CLI/GUI, etc.) for status
399          * information and configuration. The socket file will be named based
400          * on the interface name, so multiple %wpa_supplicant processes can be
401          * run at the same time if more than one interface is used.
402          * /var/run/wpa_supplicant is the recommended directory for sockets and
403          * by default, wpa_cli will use it when trying to connect with
404          * %wpa_supplicant.
405          *
406          * Access control for the control interface can be configured
407          * by setting the directory to allow only members of a group
408          * to use sockets. This way, it is possible to run
409          * %wpa_supplicant as root (since it needs to change network
410          * configuration and open raw sockets) and still allow GUI/CLI
411          * components to be run as non-root users. However, since the
412          * control interface can be used to change the network
413          * configuration, this access needs to be protected in many
414          * cases. By default, %wpa_supplicant is configured to use gid
415          * 0 (root). If you want to allow non-root users to use the
416          * control interface, add a new group and change this value to
417          * match with that group. Add users that should have control
418          * interface access to this group.
419          *
420          * When configuring both the directory and group, use following format:
421          * DIR=/var/run/wpa_supplicant GROUP=wheel
422          * DIR=/var/run/wpa_supplicant GROUP=0
423          * (group can be either group name or gid)
424          *
425          * For UDP connections (default on Windows): The value will be ignored.
426          * This variable is just used to select that the control interface is
427          * to be created. The value can be set to, e.g., udp
428          * (ctrl_interface=udp).
429          *
430          * For Windows Named Pipe: This value can be used to set the security
431          * descriptor for controlling access to the control interface. Security
432          * descriptor can be set using Security Descriptor String Format (see
433          * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/security_descriptor_string_format.asp).
434          * The descriptor string needs to be prefixed with SDDL=. For example,
435          * ctrl_interface=SDDL=D: would set an empty DACL (which will reject
436          * all connections).
437          */
438         char *ctrl_interface;
439
440         /**
441          * ctrl_interface_group - Control interface group (DEPRECATED)
442          *
443          * This variable is only used for backwards compatibility. Group for
444          * UNIX domain sockets should now be specified using GROUP=group in
445          * ctrl_interface variable.
446          */
447         char *ctrl_interface_group;
448
449         /**
450          * fast_reauth - EAP fast re-authentication (session resumption)
451          *
452          * By default, fast re-authentication is enabled for all EAP methods
453          * that support it. This variable can be used to disable fast
454          * re-authentication (by setting fast_reauth=0). Normally, there is no
455          * need to disable fast re-authentication.
456          */
457         int fast_reauth;
458
459         /**
460          * opensc_engine_path - Path to the OpenSSL engine for opensc
461          *
462          * This is an OpenSSL specific configuration option for loading OpenSC
463          * engine (engine_opensc.so); if %NULL, this engine is not loaded.
464          */
465         char *opensc_engine_path;
466
467         /**
468          * pkcs11_engine_path - Path to the OpenSSL engine for PKCS#11
469          *
470          * This is an OpenSSL specific configuration option for loading PKCS#11
471          * engine (engine_pkcs11.so); if %NULL, this engine is not loaded.
472          */
473         char *pkcs11_engine_path;
474
475         /**
476          * pkcs11_module_path - Path to the OpenSSL OpenSC/PKCS#11 module
477          *
478          * This is an OpenSSL specific configuration option for configuring
479          * path to OpenSC/PKCS#11 engine (opensc-pkcs11.so); if %NULL, this
480          * module is not loaded.
481          */
482         char *pkcs11_module_path;
483
484         /**
485          * pcsc_reader - PC/SC reader name prefix
486          *
487          * If not %NULL, PC/SC reader with a name that matches this prefix is
488          * initialized for SIM/USIM access. Empty string can be used to match
489          * the first available reader.
490          */
491         char *pcsc_reader;
492
493         /**
494          * pcsc_pin - PIN for USIM, GSM SIM, and smartcards
495          *
496          * This field is used to configure PIN for SIM/USIM for EAP-SIM and
497          * EAP-AKA. If left out, this will be asked through control interface.
498          */
499         char *pcsc_pin;
500
501         /**
502          * external_sim - Use external processing for SIM/USIM operations
503          */
504         int external_sim;
505
506         /**
507          * driver_param - Driver interface parameters
508          *
509          * This text string is passed to the selected driver interface with the
510          * optional struct wpa_driver_ops::set_param() handler. This can be
511          * used to configure driver specific options without having to add new
512          * driver interface functionality.
513          */
514         char *driver_param;
515
516         /**
517          * dot11RSNAConfigPMKLifetime - Maximum lifetime of a PMK
518          *
519          * dot11 MIB variable for the maximum lifetime of a PMK in the PMK
520          * cache (unit: seconds).
521          */
522         unsigned int dot11RSNAConfigPMKLifetime;
523
524         /**
525          * dot11RSNAConfigPMKReauthThreshold - PMK re-authentication threshold
526          *
527          * dot11 MIB variable for the percentage of the PMK lifetime
528          * that should expire before an IEEE 802.1X reauthentication occurs.
529          */
530         unsigned int dot11RSNAConfigPMKReauthThreshold;
531
532         /**
533          * dot11RSNAConfigSATimeout - Security association timeout
534          *
535          * dot11 MIB variable for the maximum time a security association
536          * shall take to set up (unit: seconds).
537          */
538         unsigned int dot11RSNAConfigSATimeout;
539
540         /**
541          * update_config - Is wpa_supplicant allowed to update configuration
542          *
543          * This variable control whether wpa_supplicant is allow to re-write
544          * its configuration with wpa_config_write(). If this is zero,
545          * configuration data is only changed in memory and the external data
546          * is not overriden. If this is non-zero, wpa_supplicant will update
547          * the configuration data (e.g., a file) whenever configuration is
548          * changed. This update may replace the old configuration which can
549          * remove comments from it in case of a text file configuration.
550          */
551         int update_config;
552
553         /**
554          * blobs - Configuration blobs
555          */
556         struct wpa_config_blob *blobs;
557
558         /**
559          * uuid - Universally Unique IDentifier (UUID; see RFC 4122) for WPS
560          */
561         u8 uuid[16];
562
563         /**
564          * device_name - Device Name (WPS)
565          * User-friendly description of device; up to 32 octets encoded in
566          * UTF-8
567          */
568         char *device_name;
569
570         /**
571          * manufacturer - Manufacturer (WPS)
572          * The manufacturer of the device (up to 64 ASCII characters)
573          */
574         char *manufacturer;
575
576         /**
577          * model_name - Model Name (WPS)
578          * Model of the device (up to 32 ASCII characters)
579          */
580         char *model_name;
581
582         /**
583          * model_number - Model Number (WPS)
584          * Additional device description (up to 32 ASCII characters)
585          */
586         char *model_number;
587
588         /**
589          * serial_number - Serial Number (WPS)
590          * Serial number of the device (up to 32 characters)
591          */
592         char *serial_number;
593
594         /**
595          * device_type - Primary Device Type (WPS)
596          */
597         u8 device_type[WPS_DEV_TYPE_LEN];
598
599         /**
600          * config_methods - Config Methods
601          *
602          * This is a space-separated list of supported WPS configuration
603          * methods. For example, "label virtual_display virtual_push_button
604          * keypad".
605          * Available methods: usba ethernet label display ext_nfc_token
606          * int_nfc_token nfc_interface push_button keypad
607          * virtual_display physical_display
608          * virtual_push_button physical_push_button.
609          */
610         char *config_methods;
611
612         /**
613          * os_version - OS Version (WPS)
614          * 4-octet operating system version number
615          */
616         u8 os_version[4];
617
618         /**
619          * country - Country code
620          *
621          * This is the ISO/IEC alpha2 country code for which we are operating
622          * in
623          */
624         char country[2];
625
626         /**
627          * wps_cred_processing - Credential processing
628          *
629          *   0 = process received credentials internally
630          *   1 = do not process received credentials; just pass them over
631          *      ctrl_iface to external program(s)
632          *   2 = process received credentials internally and pass them over
633          *      ctrl_iface to external program(s)
634          */
635         int wps_cred_processing;
636
637 #define MAX_SEC_DEVICE_TYPES 5
638         /**
639          * sec_device_types - Secondary Device Types (P2P)
640          */
641         u8 sec_device_type[MAX_SEC_DEVICE_TYPES][WPS_DEV_TYPE_LEN];
642         int num_sec_device_types;
643
644         int p2p_listen_reg_class;
645         int p2p_listen_channel;
646         int p2p_oper_reg_class;
647         int p2p_oper_channel;
648         int p2p_go_intent;
649         char *p2p_ssid_postfix;
650         int persistent_reconnect;
651         int p2p_intra_bss;
652         unsigned int num_p2p_pref_chan;
653         struct p2p_channel *p2p_pref_chan;
654         struct wpa_freq_range_list p2p_no_go_freq;
655         int p2p_add_cli_chan;
656         int p2p_ignore_shared_freq;
657
658         struct wpabuf *wps_vendor_ext_m1;
659
660 #define MAX_WPS_VENDOR_EXT 10
661         /**
662          * wps_vendor_ext - Vendor extension attributes in WPS
663          */
664         struct wpabuf *wps_vendor_ext[MAX_WPS_VENDOR_EXT];
665
666         /**
667          * p2p_group_idle - Maximum idle time in seconds for P2P group
668          *
669          * This value controls how long a P2P group is maintained after there
670          * is no other members in the group. As a GO, this means no associated
671          * stations in the group. As a P2P client, this means no GO seen in
672          * scan results. The maximum idle time is specified in seconds with 0
673          * indicating no time limit, i.e., the P2P group remains in active
674          * state indefinitely until explicitly removed. As a P2P client, the
675          * maximum idle time of P2P_MAX_CLIENT_IDLE seconds is enforced, i.e.,
676          * this parameter is mainly meant for GO use and for P2P client, it can
677          * only be used to reduce the default timeout to smaller value. A
678          * special value -1 can be used to configure immediate removal of the
679          * group for P2P client role on any disconnection after the data
680          * connection has been established.
681          */
682         int p2p_group_idle;
683
684         /**
685          * bss_max_count - Maximum number of BSS entries to keep in memory
686          */
687         unsigned int bss_max_count;
688
689         /**
690          * bss_expiration_age - BSS entry age after which it can be expired
691          *
692          * This value controls the time in seconds after which a BSS entry
693          * gets removed if it has not been updated or is not in use.
694          */
695         unsigned int bss_expiration_age;
696
697         /**
698          * bss_expiration_scan_count - Expire BSS after number of scans
699          *
700          * If the BSS entry has not been seen in this many scans, it will be
701          * removed. A value of 1 means that entry is removed after the first
702          * scan in which the BSSID is not seen. Larger values can be used
703          * to avoid BSS entries disappearing if they are not visible in
704          * every scan (e.g., low signal quality or interference).
705          */
706         unsigned int bss_expiration_scan_count;
707
708         /**
709          * filter_ssids - SSID-based scan result filtering
710          *
711          *   0 = do not filter scan results
712          *   1 = only include configured SSIDs in scan results/BSS table
713          */
714         int filter_ssids;
715
716         /**
717          * filter_rssi - RSSI-based scan result filtering
718          *
719          * 0 = do not filter scan results
720          * -n = filter scan results below -n dBm
721          */
722         int filter_rssi;
723
724         /**
725          * max_num_sta - Maximum number of STAs in an AP/P2P GO
726          */
727         unsigned int max_num_sta;
728
729         /**
730          * freq_list - Array of allowed scan frequencies or %NULL for all
731          *
732          * This is an optional zero-terminated array of frequencies in
733          * megahertz (MHz) to allow for narrowing scanning range.
734          */
735         int *freq_list;
736
737         /**
738          * scan_cur_freq - Whether to scan only the current channel
739          *
740          * If true, attempt to scan only the current channel if any other
741          * VIFs on this radio are already associated on a particular channel.
742          */
743         int scan_cur_freq;
744
745         /**
746          * changed_parameters - Bitmap of changed parameters since last update
747          */
748         unsigned int changed_parameters;
749
750         /**
751          * disassoc_low_ack - Disassocicate stations with massive packet loss
752          */
753         int disassoc_low_ack;
754
755         /**
756          * interworking - Whether Interworking (IEEE 802.11u) is enabled
757          */
758         int interworking;
759
760         /**
761          * access_network_type - Access Network Type
762          *
763          * When Interworking is enabled, scans will be limited to APs that
764          * advertise the specified Access Network Type (0..15; with 15
765          * indicating wildcard match).
766          */
767         int access_network_type;
768
769         /**
770          * hessid - Homogenous ESS identifier
771          *
772          * If this is set (any octet is non-zero), scans will be used to
773          * request response only from BSSes belonging to the specified
774          * Homogeneous ESS. This is used only if interworking is enabled.
775          */
776         u8 hessid[ETH_ALEN];
777
778         /**
779          * hs20 - Hotspot 2.0
780          */
781         int hs20;
782
783         /**
784          * pbc_in_m1 - AP mode WPS probing workaround for PBC with Windows 7
785          *
786          * Windows 7 uses incorrect way of figuring out AP's WPS capabilities
787          * by acting as a Registrar and using M1 from the AP. The config
788          * methods attribute in that message is supposed to indicate only the
789          * configuration method supported by the AP in Enrollee role, i.e., to
790          * add an external Registrar. For that case, PBC shall not be used and
791          * as such, the PushButton config method is removed from M1 by default.
792          * If pbc_in_m1=1 is included in the configuration file, the PushButton
793          * config method is left in M1 (if included in config_methods
794          * parameter) to allow Windows 7 to use PBC instead of PIN (e.g., from
795          * a label in the AP).
796          */
797         int pbc_in_m1;
798
799         /**
800          * autoscan - Automatic scan parameters or %NULL if none
801          *
802          * This is an optional set of parameters for automatic scanning
803          * within an interface in following format:
804          * <autoscan module name>:<module parameters>
805          */
806         char *autoscan;
807
808         /**
809          * wps_nfc_pw_from_config - NFC Device Password was read from config
810          *
811          * This parameter can be determined whether the NFC Device Password was
812          * included in the configuration (1) or generated dynamically (0). Only
813          * the former case is re-written back to the configuration file.
814          */
815         int wps_nfc_pw_from_config;
816
817         /**
818          * wps_nfc_dev_pw_id - NFC Device Password ID for password token
819          */
820         int wps_nfc_dev_pw_id;
821
822         /**
823          * wps_nfc_dh_pubkey - NFC DH Public Key for password token
824          */
825         struct wpabuf *wps_nfc_dh_pubkey;
826
827         /**
828          * wps_nfc_dh_privkey - NFC DH Private Key for password token
829          */
830         struct wpabuf *wps_nfc_dh_privkey;
831
832         /**
833          * wps_nfc_dev_pw - NFC Device Password for password token
834          */
835         struct wpabuf *wps_nfc_dev_pw;
836
837         /**
838          * ext_password_backend - External password backend or %NULL if none
839          *
840          * format: <backend name>[:<optional backend parameters>]
841          */
842         char *ext_password_backend;
843
844         /*
845          * p2p_go_max_inactivity - Timeout in seconds to detect STA inactivity
846          *
847          * This timeout value is used in P2P GO mode to clean up
848          * inactive stations.
849          * By default: 300 seconds.
850          */
851         int p2p_go_max_inactivity;
852
853         struct hostapd_wmm_ac_params wmm_ac_params[4];
854
855         /**
856          * auto_interworking - Whether to use network selection automatically
857          *
858          * 0 = do not automatically go through Interworking network selection
859          *     (i.e., require explicit interworking_select command for this)
860          * 1 = perform Interworking network selection if one or more
861          *     credentials have been configured and scan did not find a
862          *     matching network block
863          */
864         int auto_interworking;
865
866         /**
867          * p2p_go_ht40 - Default mode for HT40 enable when operating as GO.
868          *
869          * This will take effect for p2p_group_add, p2p_connect, and p2p_invite.
870          * Note that regulatory constraints and driver capabilities are
871          * consulted anyway, so setting it to 1 can't do real harm.
872          * By default: 0 (disabled)
873          */
874         int p2p_go_ht40;
875
876         /**
877          * p2p_go_vht - Default mode for VHT enable when operating as GO
878          *
879          * This will take effect for p2p_group_add, p2p_connect, and p2p_invite.
880          * Note that regulatory constraints and driver capabilities are
881          * consulted anyway, so setting it to 1 can't do real harm.
882          * By default: 0 (disabled)
883          */
884         int p2p_go_vht;
885
886         /**
887          * p2p_disabled - Whether P2P operations are disabled for this interface
888          */
889         int p2p_disabled;
890
891         /**
892          * p2p_no_group_iface - Whether group interfaces can be used
893          *
894          * By default, wpa_supplicant will create a separate interface for P2P
895          * group operations if the driver supports this. This functionality can
896          * be disabled by setting this parameter to 1. In that case, the same
897          * interface that was used for the P2P management operations is used
898          * also for the group operation.
899          */
900         int p2p_no_group_iface;
901
902         /**
903          * okc - Whether to enable opportunistic key caching by default
904          *
905          * By default, OKC is disabled unless enabled by the per-network
906          * proactive_key_caching=1 parameter. okc=1 can be used to change this
907          * default behavior.
908          */
909         int okc;
910
911         /**
912          * pmf - Whether to enable/require PMF by default
913          *
914          * By default, PMF is disabled unless enabled by the per-network
915          * ieee80211w=1 or ieee80211w=2 parameter. pmf=1/2 can be used to change
916          * this default behavior.
917          */
918         enum mfp_options pmf;
919
920         /**
921          * sae_groups - Preference list of enabled groups for SAE
922          *
923          * By default (if this parameter is not set), the mandatory group 19
924          * (ECC group defined over a 256-bit prime order field) is preferred,
925          * but other groups are also enabled. If this parameter is set, the
926          * groups will be tried in the indicated order.
927          */
928         int *sae_groups;
929
930         /**
931          * dtim_period - Default DTIM period in Beacon intervals
932          *
933          * This parameter can be used to set the default value for network
934          * blocks that do not specify dtim_period.
935          */
936         int dtim_period;
937
938         /**
939          * beacon_int - Default Beacon interval in TU
940          *
941          * This parameter can be used to set the default value for network
942          * blocks that do not specify beacon_int.
943          */
944         int beacon_int;
945
946         /**
947          * ap_vendor_elements: Vendor specific elements for Beacon/ProbeResp
948          *
949          * This parameter can be used to define additional vendor specific
950          * elements for Beacon and Probe Response frames in AP/P2P GO mode. The
951          * format for these element(s) is a hexdump of the raw information
952          * elements (id+len+payload for one or more elements).
953          */
954         struct wpabuf *ap_vendor_elements;
955
956         /**
957          * ignore_old_scan_res - Ignore scan results older than request
958          *
959          * The driver may have a cache of scan results that makes it return
960          * information that is older than our scan trigger. This parameter can
961          * be used to configure such old information to be ignored instead of
962          * allowing it to update the internal BSS table.
963          */
964         int ignore_old_scan_res;
965
966         /**
967          * sched_scan_interval -  schedule scan interval
968          */
969         unsigned int sched_scan_interval;
970
971         /**
972          * tdls_external_control - External control for TDLS setup requests
973          *
974          * Enable TDLS mode where external programs are given the control
975          * to specify the TDLS link to get established to the driver. The
976          * driver requests the TDLS setup to the supplicant only for the
977          * specified TDLS peers.
978          */
979         int tdls_external_control;
980
981         u8 ip_addr_go[4];
982         u8 ip_addr_mask[4];
983         u8 ip_addr_start[4];
984         u8 ip_addr_end[4];
985
986         /**
987          * osu_dir - OSU provider information directory
988          *
989          * If set, allow FETCH_OSU control interface command to be used to fetch
990          * OSU provider information into all APs and store the results in this
991          * directory.
992          */
993         char *osu_dir;
994 };
995
996
997 /* Prototypes for common functions from config.c */
998
999 void wpa_config_free(struct wpa_config *ssid);
1000 void wpa_config_free_ssid(struct wpa_ssid *ssid);
1001 void wpa_config_foreach_network(struct wpa_config *config,
1002                                 void (*func)(void *, struct wpa_ssid *),
1003                                 void *arg);
1004 struct wpa_ssid * wpa_config_get_network(struct wpa_config *config, int id);
1005 struct wpa_ssid * wpa_config_add_network(struct wpa_config *config);
1006 int wpa_config_remove_network(struct wpa_config *config, int id);
1007 void wpa_config_set_network_defaults(struct wpa_ssid *ssid);
1008 int wpa_config_set(struct wpa_ssid *ssid, const char *var, const char *value,
1009                    int line);
1010 int wpa_config_set_quoted(struct wpa_ssid *ssid, const char *var,
1011                           const char *value);
1012 char ** wpa_config_get_all(struct wpa_ssid *ssid, int get_keys);
1013 char * wpa_config_get(struct wpa_ssid *ssid, const char *var);
1014 char * wpa_config_get_no_key(struct wpa_ssid *ssid, const char *var);
1015 void wpa_config_update_psk(struct wpa_ssid *ssid);
1016 int wpa_config_add_prio_network(struct wpa_config *config,
1017                                 struct wpa_ssid *ssid);
1018 int wpa_config_update_prio_list(struct wpa_config *config);
1019 const struct wpa_config_blob * wpa_config_get_blob(struct wpa_config *config,
1020                                                    const char *name);
1021 void wpa_config_set_blob(struct wpa_config *config,
1022                          struct wpa_config_blob *blob);
1023 void wpa_config_free_blob(struct wpa_config_blob *blob);
1024 int wpa_config_remove_blob(struct wpa_config *config, const char *name);
1025 void wpa_config_flush_blobs(struct wpa_config *config);
1026
1027 struct wpa_cred * wpa_config_get_cred(struct wpa_config *config, int id);
1028 struct wpa_cred * wpa_config_add_cred(struct wpa_config *config);
1029 int wpa_config_remove_cred(struct wpa_config *config, int id);
1030 void wpa_config_free_cred(struct wpa_cred *cred);
1031 int wpa_config_set_cred(struct wpa_cred *cred, const char *var,
1032                         const char *value, int line);
1033
1034 struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
1035                                            const char *driver_param);
1036 #ifndef CONFIG_NO_STDOUT_DEBUG
1037 void wpa_config_debug_dump_networks(struct wpa_config *config);
1038 #else /* CONFIG_NO_STDOUT_DEBUG */
1039 #define wpa_config_debug_dump_networks(c) do { } while (0)
1040 #endif /* CONFIG_NO_STDOUT_DEBUG */
1041
1042
1043 /* Prototypes for common functions from config.c */
1044 int wpa_config_process_global(struct wpa_config *config, char *pos, int line);
1045
1046
1047 /* Prototypes for backend specific functions from the selected config_*.c */
1048
1049 /**
1050  * wpa_config_read - Read and parse configuration database
1051  * @name: Name of the configuration (e.g., path and file name for the
1052  * configuration file)
1053  * @cfgp: Pointer to previously allocated configuration data or %NULL if none
1054  * Returns: Pointer to allocated configuration data or %NULL on failure
1055  *
1056  * This function reads configuration data, parses its contents, and allocates
1057  * data structures needed for storing configuration information. The allocated
1058  * data can be freed with wpa_config_free().
1059  *
1060  * Each configuration backend needs to implement this function.
1061  */
1062 struct wpa_config * wpa_config_read(const char *name, struct wpa_config *cfgp);
1063
1064 /**
1065  * wpa_config_write - Write or update configuration data
1066  * @name: Name of the configuration (e.g., path and file name for the
1067  * configuration file)
1068  * @config: Configuration data from wpa_config_read()
1069  * Returns: 0 on success, -1 on failure
1070  *
1071  * This function write all configuration data into an external database (e.g.,
1072  * a text file) in a format that can be read with wpa_config_read(). This can
1073  * be used to allow wpa_supplicant to update its configuration, e.g., when a
1074  * new network is added or a password is changed.
1075  *
1076  * Each configuration backend needs to implement this function.
1077  */
1078 int wpa_config_write(const char *name, struct wpa_config *config);
1079
1080 #endif /* CONFIG_H */