Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | * WPA Supplicant / Configuration file structures |
| 3 | * Copyright (c) 2003-2005, Jouni Malinen <j@w1.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 | #define DEFAULT_EAPOL_VERSION 1 |
| 19 | #ifdef CONFIG_NO_SCAN_PROCESSING |
| 20 | #define DEFAULT_AP_SCAN 2 |
| 21 | #else /* CONFIG_NO_SCAN_PROCESSING */ |
| 22 | #define DEFAULT_AP_SCAN 1 |
| 23 | #endif /* CONFIG_NO_SCAN_PROCESSING */ |
| 24 | #define DEFAULT_FAST_REAUTH 1 |
| 25 | #define DEFAULT_P2P_GO_INTENT 7 |
| 26 | #define DEFAULT_P2P_INTRA_BSS 1 |
| 27 | #define DEFAULT_BSS_MAX_COUNT 200 |
| 28 | #define DEFAULT_BSS_EXPIRATION_AGE 180 |
| 29 | #define DEFAULT_BSS_EXPIRATION_SCAN_COUNT 2 |
| 30 | #define DEFAULT_MAX_NUM_STA 128 |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 31 | #define DEFAULT_ACCESS_NETWORK_TYPE 15 |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 32 | |
| 33 | #include "config_ssid.h" |
| 34 | #include "wps/wps.h" |
| 35 | |
| 36 | |
| 37 | #define CFG_CHANGED_DEVICE_NAME BIT(0) |
| 38 | #define CFG_CHANGED_CONFIG_METHODS BIT(1) |
| 39 | #define CFG_CHANGED_DEVICE_TYPE BIT(2) |
| 40 | #define CFG_CHANGED_OS_VERSION BIT(3) |
| 41 | #define CFG_CHANGED_UUID BIT(4) |
| 42 | #define CFG_CHANGED_COUNTRY BIT(5) |
| 43 | #define CFG_CHANGED_SEC_DEVICE_TYPE BIT(6) |
| 44 | #define CFG_CHANGED_P2P_SSID_POSTFIX BIT(7) |
| 45 | #define CFG_CHANGED_WPS_STRING BIT(8) |
| 46 | #define CFG_CHANGED_P2P_INTRA_BSS BIT(9) |
| 47 | #define CFG_CHANGED_VENDOR_EXTENSION BIT(10) |
Jouni Malinen | 75ecf52 | 2011-06-27 15:19:46 -0700 | [diff] [blame] | 48 | #define CFG_CHANGED_P2P_LISTEN_CHANNEL BIT(11) |
| 49 | #define CFG_CHANGED_P2P_OPER_CHANNEL BIT(12) |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 50 | |
| 51 | /** |
| 52 | * struct wpa_config - wpa_supplicant configuration data |
| 53 | * |
| 54 | * This data structure is presents the per-interface (radio) configuration |
| 55 | * data. In many cases, there is only one struct wpa_config instance, but if |
| 56 | * more than one network interface is being controlled, one instance is used |
| 57 | * for each. |
| 58 | */ |
| 59 | struct wpa_config { |
| 60 | /** |
| 61 | * ssid - Head of the global network list |
| 62 | * |
| 63 | * This is the head for the list of all the configured networks. |
| 64 | */ |
| 65 | struct wpa_ssid *ssid; |
| 66 | |
| 67 | /** |
| 68 | * pssid - Per-priority network lists (in priority order) |
| 69 | */ |
| 70 | struct wpa_ssid **pssid; |
| 71 | |
| 72 | /** |
| 73 | * num_prio - Number of different priorities used in the pssid lists |
| 74 | * |
| 75 | * This indicates how many per-priority network lists are included in |
| 76 | * pssid. |
| 77 | */ |
| 78 | int num_prio; |
| 79 | |
| 80 | /** |
| 81 | * eapol_version - IEEE 802.1X/EAPOL version number |
| 82 | * |
| 83 | * wpa_supplicant is implemented based on IEEE Std 802.1X-2004 which |
| 84 | * defines EAPOL version 2. However, there are many APs that do not |
| 85 | * handle the new version number correctly (they seem to drop the |
| 86 | * frames completely). In order to make wpa_supplicant interoperate |
| 87 | * with these APs, the version number is set to 1 by default. This |
| 88 | * configuration value can be used to set it to the new version (2). |
| 89 | */ |
| 90 | int eapol_version; |
| 91 | |
| 92 | /** |
| 93 | * ap_scan - AP scanning/selection |
| 94 | * |
| 95 | * By default, wpa_supplicant requests driver to perform AP |
| 96 | * scanning and then uses the scan results to select a |
| 97 | * suitable AP. Another alternative is to allow the driver to |
| 98 | * take care of AP scanning and selection and use |
| 99 | * wpa_supplicant just to process EAPOL frames based on IEEE |
| 100 | * 802.11 association information from the driver. |
| 101 | * |
| 102 | * 1: wpa_supplicant initiates scanning and AP selection (default). |
| 103 | * |
| 104 | * 0: Driver takes care of scanning, AP selection, and IEEE 802.11 |
| 105 | * association parameters (e.g., WPA IE generation); this mode can |
| 106 | * also be used with non-WPA drivers when using IEEE 802.1X mode; |
| 107 | * do not try to associate with APs (i.e., external program needs |
| 108 | * to control association). This mode must also be used when using |
| 109 | * wired Ethernet drivers. |
| 110 | * |
| 111 | * 2: like 0, but associate with APs using security policy and SSID |
| 112 | * (but not BSSID); this can be used, e.g., with ndiswrapper and NDIS |
| 113 | * drivers to enable operation with hidden SSIDs and optimized roaming; |
| 114 | * in this mode, the network blocks in the configuration are tried |
| 115 | * one by one until the driver reports successful association; each |
| 116 | * network block should have explicit security policy (i.e., only one |
| 117 | * option in the lists) for key_mgmt, pairwise, group, proto variables. |
| 118 | */ |
| 119 | int ap_scan; |
| 120 | |
| 121 | /** |
| 122 | * ctrl_interface - Parameters for the control interface |
| 123 | * |
| 124 | * If this is specified, %wpa_supplicant will open a control interface |
| 125 | * that is available for external programs to manage %wpa_supplicant. |
| 126 | * The meaning of this string depends on which control interface |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 127 | * mechanism is used. For all cases, the existence of this parameter |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 128 | * in configuration is used to determine whether the control interface |
| 129 | * is enabled. |
| 130 | * |
| 131 | * For UNIX domain sockets (default on Linux and BSD): This is a |
| 132 | * directory that will be created for UNIX domain sockets for listening |
| 133 | * to requests from external programs (CLI/GUI, etc.) for status |
| 134 | * information and configuration. The socket file will be named based |
| 135 | * on the interface name, so multiple %wpa_supplicant processes can be |
| 136 | * run at the same time if more than one interface is used. |
| 137 | * /var/run/wpa_supplicant is the recommended directory for sockets and |
| 138 | * by default, wpa_cli will use it when trying to connect with |
| 139 | * %wpa_supplicant. |
| 140 | * |
| 141 | * Access control for the control interface can be configured |
| 142 | * by setting the directory to allow only members of a group |
| 143 | * to use sockets. This way, it is possible to run |
| 144 | * %wpa_supplicant as root (since it needs to change network |
| 145 | * configuration and open raw sockets) and still allow GUI/CLI |
| 146 | * components to be run as non-root users. However, since the |
| 147 | * control interface can be used to change the network |
| 148 | * configuration, this access needs to be protected in many |
| 149 | * cases. By default, %wpa_supplicant is configured to use gid |
| 150 | * 0 (root). If you want to allow non-root users to use the |
| 151 | * control interface, add a new group and change this value to |
| 152 | * match with that group. Add users that should have control |
| 153 | * interface access to this group. |
| 154 | * |
| 155 | * When configuring both the directory and group, use following format: |
| 156 | * DIR=/var/run/wpa_supplicant GROUP=wheel |
| 157 | * DIR=/var/run/wpa_supplicant GROUP=0 |
| 158 | * (group can be either group name or gid) |
| 159 | * |
| 160 | * For UDP connections (default on Windows): The value will be ignored. |
| 161 | * This variable is just used to select that the control interface is |
| 162 | * to be created. The value can be set to, e.g., udp |
| 163 | * (ctrl_interface=udp). |
| 164 | * |
| 165 | * For Windows Named Pipe: This value can be used to set the security |
| 166 | * descriptor for controlling access to the control interface. Security |
| 167 | * descriptor can be set using Security Descriptor String Format (see |
| 168 | * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/security_descriptor_string_format.asp). |
| 169 | * The descriptor string needs to be prefixed with SDDL=. For example, |
| 170 | * ctrl_interface=SDDL=D: would set an empty DACL (which will reject |
| 171 | * all connections). |
| 172 | */ |
| 173 | char *ctrl_interface; |
| 174 | |
| 175 | /** |
| 176 | * ctrl_interface_group - Control interface group (DEPRECATED) |
| 177 | * |
| 178 | * This variable is only used for backwards compatibility. Group for |
| 179 | * UNIX domain sockets should now be specified using GROUP=group in |
| 180 | * ctrl_interface variable. |
| 181 | */ |
| 182 | char *ctrl_interface_group; |
| 183 | |
| 184 | /** |
| 185 | * fast_reauth - EAP fast re-authentication (session resumption) |
| 186 | * |
| 187 | * By default, fast re-authentication is enabled for all EAP methods |
| 188 | * that support it. This variable can be used to disable fast |
| 189 | * re-authentication (by setting fast_reauth=0). Normally, there is no |
| 190 | * need to disable fast re-authentication. |
| 191 | */ |
| 192 | int fast_reauth; |
| 193 | |
| 194 | /** |
| 195 | * opensc_engine_path - Path to the OpenSSL engine for opensc |
| 196 | * |
| 197 | * This is an OpenSSL specific configuration option for loading OpenSC |
| 198 | * engine (engine_opensc.so); if %NULL, this engine is not loaded. |
| 199 | */ |
| 200 | char *opensc_engine_path; |
| 201 | |
| 202 | /** |
| 203 | * pkcs11_engine_path - Path to the OpenSSL engine for PKCS#11 |
| 204 | * |
| 205 | * This is an OpenSSL specific configuration option for loading PKCS#11 |
| 206 | * engine (engine_pkcs11.so); if %NULL, this engine is not loaded. |
| 207 | */ |
| 208 | char *pkcs11_engine_path; |
| 209 | |
| 210 | /** |
| 211 | * pkcs11_module_path - Path to the OpenSSL OpenSC/PKCS#11 module |
| 212 | * |
| 213 | * This is an OpenSSL specific configuration option for configuring |
| 214 | * path to OpenSC/PKCS#11 engine (opensc-pkcs11.so); if %NULL, this |
| 215 | * module is not loaded. |
| 216 | */ |
| 217 | char *pkcs11_module_path; |
| 218 | |
| 219 | /** |
| 220 | * driver_param - Driver interface parameters |
| 221 | * |
| 222 | * This text string is passed to the selected driver interface with the |
| 223 | * optional struct wpa_driver_ops::set_param() handler. This can be |
| 224 | * used to configure driver specific options without having to add new |
| 225 | * driver interface functionality. |
| 226 | */ |
| 227 | char *driver_param; |
| 228 | |
| 229 | /** |
| 230 | * dot11RSNAConfigPMKLifetime - Maximum lifetime of a PMK |
| 231 | * |
| 232 | * dot11 MIB variable for the maximum lifetime of a PMK in the PMK |
| 233 | * cache (unit: seconds). |
| 234 | */ |
| 235 | unsigned int dot11RSNAConfigPMKLifetime; |
| 236 | |
| 237 | /** |
| 238 | * dot11RSNAConfigPMKReauthThreshold - PMK re-authentication threshold |
| 239 | * |
| 240 | * dot11 MIB variable for the percentage of the PMK lifetime |
| 241 | * that should expire before an IEEE 802.1X reauthentication occurs. |
| 242 | */ |
| 243 | unsigned int dot11RSNAConfigPMKReauthThreshold; |
| 244 | |
| 245 | /** |
| 246 | * dot11RSNAConfigSATimeout - Security association timeout |
| 247 | * |
| 248 | * dot11 MIB variable for the maximum time a security association |
| 249 | * shall take to set up (unit: seconds). |
| 250 | */ |
| 251 | unsigned int dot11RSNAConfigSATimeout; |
| 252 | |
| 253 | /** |
| 254 | * update_config - Is wpa_supplicant allowed to update configuration |
| 255 | * |
| 256 | * This variable control whether wpa_supplicant is allow to re-write |
| 257 | * its configuration with wpa_config_write(). If this is zero, |
| 258 | * configuration data is only changed in memory and the external data |
| 259 | * is not overriden. If this is non-zero, wpa_supplicant will update |
| 260 | * the configuration data (e.g., a file) whenever configuration is |
| 261 | * changed. This update may replace the old configuration which can |
| 262 | * remove comments from it in case of a text file configuration. |
| 263 | */ |
| 264 | int update_config; |
| 265 | |
| 266 | /** |
| 267 | * blobs - Configuration blobs |
| 268 | */ |
| 269 | struct wpa_config_blob *blobs; |
| 270 | |
| 271 | /** |
| 272 | * uuid - Universally Unique IDentifier (UUID; see RFC 4122) for WPS |
| 273 | */ |
| 274 | u8 uuid[16]; |
| 275 | |
| 276 | /** |
| 277 | * device_name - Device Name (WPS) |
| 278 | * User-friendly description of device; up to 32 octets encoded in |
| 279 | * UTF-8 |
| 280 | */ |
| 281 | char *device_name; |
| 282 | |
| 283 | /** |
| 284 | * manufacturer - Manufacturer (WPS) |
| 285 | * The manufacturer of the device (up to 64 ASCII characters) |
| 286 | */ |
| 287 | char *manufacturer; |
| 288 | |
| 289 | /** |
| 290 | * model_name - Model Name (WPS) |
| 291 | * Model of the device (up to 32 ASCII characters) |
| 292 | */ |
| 293 | char *model_name; |
| 294 | |
| 295 | /** |
| 296 | * model_number - Model Number (WPS) |
| 297 | * Additional device description (up to 32 ASCII characters) |
| 298 | */ |
| 299 | char *model_number; |
| 300 | |
| 301 | /** |
| 302 | * serial_number - Serial Number (WPS) |
| 303 | * Serial number of the device (up to 32 characters) |
| 304 | */ |
| 305 | char *serial_number; |
| 306 | |
| 307 | /** |
| 308 | * device_type - Primary Device Type (WPS) |
| 309 | */ |
| 310 | u8 device_type[WPS_DEV_TYPE_LEN]; |
| 311 | |
| 312 | /** |
| 313 | * config_methods - Config Methods |
| 314 | * |
| 315 | * This is a space-separated list of supported WPS configuration |
| 316 | * methods. For example, "label virtual_display virtual_push_button |
| 317 | * keypad". |
| 318 | * Available methods: usba ethernet label display ext_nfc_token |
| 319 | * int_nfc_token nfc_interface push_button keypad |
| 320 | * virtual_display physical_display |
| 321 | * virtual_push_button physical_push_button. |
| 322 | */ |
| 323 | char *config_methods; |
| 324 | |
| 325 | /** |
| 326 | * os_version - OS Version (WPS) |
| 327 | * 4-octet operating system version number |
| 328 | */ |
| 329 | u8 os_version[4]; |
| 330 | |
| 331 | /** |
| 332 | * country - Country code |
| 333 | * |
| 334 | * This is the ISO/IEC alpha2 country code for which we are operating |
| 335 | * in |
| 336 | */ |
| 337 | char country[2]; |
| 338 | |
| 339 | /** |
| 340 | * wps_cred_processing - Credential processing |
| 341 | * |
| 342 | * 0 = process received credentials internally |
| 343 | * 1 = do not process received credentials; just pass them over |
| 344 | * ctrl_iface to external program(s) |
| 345 | * 2 = process received credentials internally and pass them over |
| 346 | * ctrl_iface to external program(s) |
| 347 | */ |
| 348 | int wps_cred_processing; |
| 349 | |
| 350 | #define MAX_SEC_DEVICE_TYPES 5 |
| 351 | /** |
| 352 | * sec_device_types - Secondary Device Types (P2P) |
| 353 | */ |
| 354 | u8 sec_device_type[MAX_SEC_DEVICE_TYPES][WPS_DEV_TYPE_LEN]; |
| 355 | int num_sec_device_types; |
| 356 | |
| 357 | int p2p_listen_reg_class; |
| 358 | int p2p_listen_channel; |
| 359 | int p2p_oper_reg_class; |
| 360 | int p2p_oper_channel; |
| 361 | int p2p_go_intent; |
| 362 | char *p2p_ssid_postfix; |
| 363 | int persistent_reconnect; |
| 364 | int p2p_intra_bss; |
| 365 | |
| 366 | #define MAX_WPS_VENDOR_EXT 10 |
| 367 | /** |
| 368 | * wps_vendor_ext - Vendor extension attributes in WPS |
| 369 | */ |
| 370 | struct wpabuf *wps_vendor_ext[MAX_WPS_VENDOR_EXT]; |
| 371 | |
| 372 | /** |
| 373 | * p2p_group_idle - Maximum idle time in seconds for P2P group |
| 374 | * |
| 375 | * This value controls how long a P2P group is maintained after there |
| 376 | * is no other members in the group. As a GO, this means no associated |
| 377 | * stations in the group. As a P2P client, this means no GO seen in |
| 378 | * scan results. The maximum idle time is specified in seconds with 0 |
| 379 | * indicating no time limit, i.e., the P2P group remains in active |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 380 | * state indefinitely until explicitly removed. As a P2P client, the |
| 381 | * maximum idle time of P2P_MAX_CLIENT_IDLE seconds is enforced, i.e., |
| 382 | * this parameter is mainly meant for GO use and for P2P client, it can |
| 383 | * only be used to reduce the default timeout to smaller value. |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 384 | */ |
| 385 | unsigned int p2p_group_idle; |
| 386 | |
| 387 | /** |
| 388 | * bss_max_count - Maximum number of BSS entries to keep in memory |
| 389 | */ |
| 390 | unsigned int bss_max_count; |
| 391 | |
| 392 | /** |
| 393 | * bss_expiration_age - BSS entry age after which it can be expired |
| 394 | * |
| 395 | * This value controls the time in seconds after which a BSS entry |
| 396 | * gets removed if it has not been updated or is not in use. |
| 397 | */ |
| 398 | unsigned int bss_expiration_age; |
| 399 | |
| 400 | /** |
| 401 | * bss_expiration_scan_count - Expire BSS after number of scans |
| 402 | * |
| 403 | * If the BSS entry has not been seen in this many scans, it will be |
| 404 | * removed. A value of 1 means that entry is removed after the first |
| 405 | * scan in which the BSSID is not seen. Larger values can be used |
| 406 | * to avoid BSS entries disappearing if they are not visible in |
| 407 | * every scan (e.g., low signal quality or interference). |
| 408 | */ |
| 409 | unsigned int bss_expiration_scan_count; |
| 410 | |
| 411 | /** |
| 412 | * filter_ssids - SSID-based scan result filtering |
| 413 | * |
| 414 | * 0 = do not filter scan results |
| 415 | * 1 = only include configured SSIDs in scan results/BSS table |
| 416 | */ |
| 417 | int filter_ssids; |
| 418 | |
| 419 | /** |
| 420 | * max_num_sta - Maximum number of STAs in an AP/P2P GO |
| 421 | */ |
| 422 | unsigned int max_num_sta; |
| 423 | |
| 424 | /** |
| 425 | * changed_parameters - Bitmap of changed parameters since last update |
| 426 | */ |
| 427 | unsigned int changed_parameters; |
| 428 | |
| 429 | /** |
| 430 | * disassoc_low_ack - Disassocicate stations with massive packet loss |
| 431 | */ |
| 432 | int disassoc_low_ack; |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 433 | |
| 434 | /** |
| 435 | * interworking - Whether Interworking (IEEE 802.11u) is enabled |
| 436 | */ |
| 437 | int interworking; |
| 438 | |
| 439 | /** |
| 440 | * access_network_type - Access Network Type |
| 441 | * |
| 442 | * When Interworking is enabled, scans will be limited to APs that |
| 443 | * advertise the specified Access Network Type (0..15; with 15 |
| 444 | * indicating wildcard match). |
| 445 | */ |
| 446 | int access_network_type; |
| 447 | |
| 448 | /** |
| 449 | * hessid - Homogenous ESS identifier |
| 450 | * |
| 451 | * If this is set (any octet is non-zero), scans will be used to |
| 452 | * request response only from BSSes belonging to the specified |
| 453 | * Homogeneous ESS. This is used only if interworking is enabled. |
| 454 | */ |
| 455 | u8 hessid[ETH_ALEN]; |
| 456 | |
| 457 | /** |
| 458 | * home_realm - Home Realm for Interworking |
| 459 | */ |
| 460 | char *home_realm; |
| 461 | |
| 462 | /** |
| 463 | * home_username - Username for Interworking network selection |
| 464 | */ |
| 465 | char *home_username; |
| 466 | |
| 467 | /** |
| 468 | * home_password - Password for Interworking network selection |
| 469 | */ |
| 470 | char *home_password; |
| 471 | |
| 472 | /** |
| 473 | * home_ca_cert - CA certificate for Interworking network selection |
| 474 | */ |
| 475 | char *home_ca_cert; |
| 476 | |
| 477 | /** |
| 478 | * home_imsi - IMSI in <MCC> | <MNC> | '-' | <MSIN> format |
| 479 | */ |
| 480 | char *home_imsi; |
| 481 | |
| 482 | /** |
| 483 | * home_milenage - Milenage parameters for SIM/USIM simulator in |
| 484 | * <Ki>:<OPc>:<SQN> format |
| 485 | */ |
| 486 | char *home_milenage; |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 487 | }; |
| 488 | |
| 489 | |
| 490 | /* Prototypes for common functions from config.c */ |
| 491 | |
| 492 | void wpa_config_free(struct wpa_config *ssid); |
| 493 | void wpa_config_free_ssid(struct wpa_ssid *ssid); |
| 494 | void wpa_config_foreach_network(struct wpa_config *config, |
| 495 | void (*func)(void *, struct wpa_ssid *), |
| 496 | void *arg); |
| 497 | struct wpa_ssid * wpa_config_get_network(struct wpa_config *config, int id); |
| 498 | struct wpa_ssid * wpa_config_add_network(struct wpa_config *config); |
| 499 | int wpa_config_remove_network(struct wpa_config *config, int id); |
| 500 | void wpa_config_set_network_defaults(struct wpa_ssid *ssid); |
| 501 | int wpa_config_set(struct wpa_ssid *ssid, const char *var, const char *value, |
| 502 | int line); |
Dmitry Shmidt | 1f69aa5 | 2012-01-24 16:10:04 -0800 | [diff] [blame] | 503 | int wpa_config_set_quoted(struct wpa_ssid *ssid, const char *var, |
| 504 | const char *value); |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 505 | char ** wpa_config_get_all(struct wpa_ssid *ssid, int get_keys); |
| 506 | char * wpa_config_get(struct wpa_ssid *ssid, const char *var); |
| 507 | char * wpa_config_get_no_key(struct wpa_ssid *ssid, const char *var); |
| 508 | void wpa_config_update_psk(struct wpa_ssid *ssid); |
| 509 | int wpa_config_add_prio_network(struct wpa_config *config, |
| 510 | struct wpa_ssid *ssid); |
| 511 | int wpa_config_update_prio_list(struct wpa_config *config); |
| 512 | const struct wpa_config_blob * wpa_config_get_blob(struct wpa_config *config, |
| 513 | const char *name); |
| 514 | void wpa_config_set_blob(struct wpa_config *config, |
| 515 | struct wpa_config_blob *blob); |
| 516 | void wpa_config_free_blob(struct wpa_config_blob *blob); |
| 517 | int wpa_config_remove_blob(struct wpa_config *config, const char *name); |
| 518 | |
| 519 | struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface, |
| 520 | const char *driver_param); |
| 521 | #ifndef CONFIG_NO_STDOUT_DEBUG |
| 522 | void wpa_config_debug_dump_networks(struct wpa_config *config); |
| 523 | #else /* CONFIG_NO_STDOUT_DEBUG */ |
| 524 | #define wpa_config_debug_dump_networks(c) do { } while (0) |
| 525 | #endif /* CONFIG_NO_STDOUT_DEBUG */ |
| 526 | |
| 527 | |
| 528 | /* Prototypes for common functions from config.c */ |
| 529 | int wpa_config_process_global(struct wpa_config *config, char *pos, int line); |
| 530 | |
| 531 | |
| 532 | /* Prototypes for backend specific functions from the selected config_*.c */ |
| 533 | |
| 534 | /** |
| 535 | * wpa_config_read - Read and parse configuration database |
| 536 | * @name: Name of the configuration (e.g., path and file name for the |
| 537 | * configuration file) |
| 538 | * Returns: Pointer to allocated configuration data or %NULL on failure |
| 539 | * |
| 540 | * This function reads configuration data, parses its contents, and allocates |
| 541 | * data structures needed for storing configuration information. The allocated |
| 542 | * data can be freed with wpa_config_free(). |
| 543 | * |
| 544 | * Each configuration backend needs to implement this function. |
| 545 | */ |
| 546 | struct wpa_config * wpa_config_read(const char *name); |
| 547 | |
| 548 | /** |
| 549 | * wpa_config_write - Write or update configuration data |
| 550 | * @name: Name of the configuration (e.g., path and file name for the |
| 551 | * configuration file) |
| 552 | * @config: Configuration data from wpa_config_read() |
| 553 | * Returns: 0 on success, -1 on failure |
| 554 | * |
| 555 | * This function write all configuration data into an external database (e.g., |
| 556 | * a text file) in a format that can be read with wpa_config_read(). This can |
| 557 | * be used to allow wpa_supplicant to update its configuration, e.g., when a |
| 558 | * new network is added or a password is changed. |
| 559 | * |
| 560 | * Each configuration backend needs to implement this function. |
| 561 | */ |
| 562 | int wpa_config_write(const char *name, struct wpa_config *config); |
| 563 | |
| 564 | #endif /* CONFIG_H */ |