Interworking: Add ctrl_iface commands for managing credentials
[mech_eap.git] / wpa_supplicant / config.h
index ff4cf22..35fdc94 100644 (file)
@@ -2,14 +2,8 @@
  * WPA Supplicant / Configuration file structures
  * Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Alternatively, this software may be distributed under the terms of BSD
- * license.
- *
- * See README and COPYING for more details.
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
  */
 
 #ifndef CONFIG_H
 #define DEFAULT_P2P_GO_INTENT 7
 #define DEFAULT_P2P_INTRA_BSS 1
 #define DEFAULT_BSS_MAX_COUNT 200
+#define DEFAULT_BSS_EXPIRATION_AGE 180
+#define DEFAULT_BSS_EXPIRATION_SCAN_COUNT 2
 #define DEFAULT_MAX_NUM_STA 128
+#define DEFAULT_ACCESS_NETWORK_TYPE 15
 
 #include "config_ssid.h"
+#include "wps/wps.h"
+
+
+struct wpa_cred {
+       /**
+        * next - Next credential in the list
+        *
+        * This pointer can be used to iterate over all credentials. The head
+        * of this list is stored in the cred field of struct wpa_config.
+        */
+       struct wpa_cred *next;
+
+       /**
+        * id - Unique id for the credential
+        *
+        * This identifier is used as a unique identifier for each credential
+        * block when using the control interface. Each credential is allocated
+        * an id when it is being created, either when reading the
+        * configuration file or when a new credential is added through the
+        * control interface.
+        */
+       int id;
+
+       /**
+        * realm - Home Realm for Interworking
+        */
+       char *realm;
+
+       /**
+        * username - Username for Interworking network selection
+        */
+       char *username;
+
+       /**
+        * password - Password for Interworking network selection
+        */
+       char *password;
+
+       /**
+        * ca_cert - CA certificate for Interworking network selection
+        */
+       char *ca_cert;
+
+       /**
+        * imsi - IMSI in <MCC> | <MNC> | '-' | <MSIN> format
+        */
+       char *imsi;
+
+       /**
+        * milenage - Milenage parameters for SIM/USIM simulator in
+        *      <Ki>:<OPc>:<SQN> format
+        */
+       char *milenage;
+
+       /**
+        * domain - Home service provider FQDN
+        *
+        * This is used to compare against the Domain Name List to figure out
+        * whether the AP is operated by the Home SP.
+        */
+       char *domain;
+};
 
 
 #define CFG_CHANGED_DEVICE_NAME BIT(0)
@@ -40,6 +99,9 @@
 #define CFG_CHANGED_P2P_SSID_POSTFIX BIT(7)
 #define CFG_CHANGED_WPS_STRING BIT(8)
 #define CFG_CHANGED_P2P_INTRA_BSS BIT(9)
+#define CFG_CHANGED_VENDOR_EXTENSION BIT(10)
+#define CFG_CHANGED_P2P_LISTEN_CHANNEL BIT(11)
+#define CFG_CHANGED_P2P_OPER_CHANNEL BIT(12)
 
 /**
  * struct wpa_config - wpa_supplicant configuration data
@@ -71,6 +133,13 @@ struct wpa_config {
        int num_prio;
 
        /**
+        * cred - Head of the credential list
+        *
+        * This is the head for the list of all the configured credentials.
+        */
+       struct wpa_cred *cred;
+
+       /**
         * eapol_version - IEEE 802.1X/EAPOL version number
         *
         * wpa_supplicant is implemented based on IEEE Std 802.1X-2004 which
@@ -117,7 +186,7 @@ struct wpa_config {
         * If this is specified, %wpa_supplicant will open a control interface
         * that is available for external programs to manage %wpa_supplicant.
         * The meaning of this string depends on which control interface
-        * mechanism is used. For all cases, the existance of this parameter
+        * mechanism is used. For all cases, the existence of this parameter
         * in configuration is used to determine whether the control interface
         * is enabled.
         *
@@ -299,18 +368,8 @@ struct wpa_config {
 
        /**
         * device_type - Primary Device Type (WPS)
-        * Used format: categ-OUI-subcateg
-        * categ = Category as an integer value
-        * OUI = OUI and type octet as a 4-octet hex-encoded value;
-        *      0050F204 for default WPS OUI
-        * subcateg = OUI-specific Sub Category as an integer value
-        * Examples:
-        *   1-0050F204-1 (Computer / PC)
-        *   1-0050F204-2 (Computer / Server)
-        *   5-0050F204-1 (Storage / NAS)
-        *   6-0050F204-1 (Network Infrastructure / AP)
         */
-       char *device_type;
+       u8 device_type[WPS_DEV_TYPE_LEN];
 
        /**
         * config_methods - Config Methods
@@ -352,10 +411,10 @@ struct wpa_config {
 
 #define MAX_SEC_DEVICE_TYPES 5
        /**
-        * sec_device_type - Secondary Device Types (P2P)
-        * See device_type for the format used with these.
+        * sec_device_types - Secondary Device Types (P2P)
         */
-       char *sec_device_type[MAX_SEC_DEVICE_TYPES];
+       u8 sec_device_type[MAX_SEC_DEVICE_TYPES][WPS_DEV_TYPE_LEN];
+       int num_sec_device_types;
 
        int p2p_listen_reg_class;
        int p2p_listen_channel;
@@ -366,12 +425,52 @@ struct wpa_config {
        int persistent_reconnect;
        int p2p_intra_bss;
 
+#define MAX_WPS_VENDOR_EXT 10
+       /**
+        * wps_vendor_ext - Vendor extension attributes in WPS
+        */
+       struct wpabuf *wps_vendor_ext[MAX_WPS_VENDOR_EXT];
+
+       /**
+        * p2p_group_idle - Maximum idle time in seconds for P2P group
+        *
+        * This value controls how long a P2P group is maintained after there
+        * is no other members in the group. As a GO, this means no associated
+        * stations in the group. As a P2P client, this means no GO seen in
+        * scan results. The maximum idle time is specified in seconds with 0
+        * indicating no time limit, i.e., the P2P group remains in active
+        * state indefinitely until explicitly removed. As a P2P client, the
+        * maximum idle time of P2P_MAX_CLIENT_IDLE seconds is enforced, i.e.,
+        * this parameter is mainly meant for GO use and for P2P client, it can
+        * only be used to reduce the default timeout to smaller value.
+        */
+       unsigned int p2p_group_idle;
+
        /**
         * bss_max_count - Maximum number of BSS entries to keep in memory
         */
        unsigned int bss_max_count;
 
        /**
+        * bss_expiration_age - BSS entry age after which it can be expired
+        *
+        * This value controls the time in seconds after which a BSS entry
+        * gets removed if it has not been updated or is not in use.
+        */
+       unsigned int bss_expiration_age;
+
+       /**
+        * bss_expiration_scan_count - Expire BSS after number of scans
+        *
+        * If the BSS entry has not been seen in this many scans, it will be
+        * removed. A value of 1 means that entry is removed after the first
+        * scan in which the BSSID is not seen. Larger values can be used
+        * to avoid BSS entries disappearing if they are not visible in
+        * every scan (e.g., low signal quality or interference).
+        */
+       unsigned int bss_expiration_scan_count;
+
+       /**
         * filter_ssids - SSID-based scan result filtering
         *
         *   0 = do not filter scan results
@@ -388,6 +487,34 @@ struct wpa_config {
         * changed_parameters - Bitmap of changed parameters since last update
         */
        unsigned int changed_parameters;
+
+       /**
+        * disassoc_low_ack - Disassocicate stations with massive packet loss
+        */
+       int disassoc_low_ack;
+
+       /**
+        * interworking - Whether Interworking (IEEE 802.11u) is enabled
+        */
+       int interworking;
+
+       /**
+        * access_network_type - Access Network Type
+        *
+        * When Interworking is enabled, scans will be limited to APs that
+        * advertise the specified Access Network Type (0..15; with 15
+        * indicating wildcard match).
+        */
+       int access_network_type;
+
+       /**
+        * hessid - Homogenous ESS identifier
+        *
+        * If this is set (any octet is non-zero), scans will be used to
+        * request response only from BSSes belonging to the specified
+        * Homogeneous ESS. This is used only if interworking is enabled.
+        */
+       u8 hessid[ETH_ALEN];
 };
 
 
@@ -395,12 +522,17 @@ struct wpa_config {
 
 void wpa_config_free(struct wpa_config *ssid);
 void wpa_config_free_ssid(struct wpa_ssid *ssid);
+void wpa_config_foreach_network(struct wpa_config *config,
+                               void (*func)(void *, struct wpa_ssid *),
+                               void *arg);
 struct wpa_ssid * wpa_config_get_network(struct wpa_config *config, int id);
 struct wpa_ssid * wpa_config_add_network(struct wpa_config *config);
 int wpa_config_remove_network(struct wpa_config *config, int id);
 void wpa_config_set_network_defaults(struct wpa_ssid *ssid);
 int wpa_config_set(struct wpa_ssid *ssid, const char *var, const char *value,
                   int line);
+int wpa_config_set_quoted(struct wpa_ssid *ssid, const char *var,
+                         const char *value);
 char ** wpa_config_get_all(struct wpa_ssid *ssid, int get_keys);
 char * wpa_config_get(struct wpa_ssid *ssid, const char *var);
 char * wpa_config_get_no_key(struct wpa_ssid *ssid, const char *var);
@@ -415,6 +547,13 @@ void wpa_config_set_blob(struct wpa_config *config,
 void wpa_config_free_blob(struct wpa_config_blob *blob);
 int wpa_config_remove_blob(struct wpa_config *config, const char *name);
 
+struct wpa_cred * wpa_config_get_cred(struct wpa_config *config, int id);
+struct wpa_cred * wpa_config_add_cred(struct wpa_config *config);
+int wpa_config_remove_cred(struct wpa_config *config, int id);
+void wpa_config_free_cred(struct wpa_cred *cred);
+int wpa_config_set_cred(struct wpa_cred *cred, const char *var,
+                       const char *value, int line);
+
 struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
                                           const char *driver_param);
 #ifndef CONFIG_NO_STDOUT_DEBUG