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