Interworking: Add ctrl_iface commands for managing credentials
[mech_eap.git] / wpa_supplicant / config.h
index 3741b9b..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_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)
 #define CFG_CHANGED_CONFIG_METHODS BIT(1)
 #define CFG_CHANGED_DEVICE_TYPE BIT(2)
@@ -77,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
@@ -376,7 +439,10 @@ struct wpa_config {
         * 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.
+        * 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;
 
@@ -433,6 +499,15 @@ struct wpa_config {
        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
@@ -440,37 +515,6 @@ struct wpa_config {
         * Homogeneous ESS. This is used only if interworking is enabled.
         */
        u8 hessid[ETH_ALEN];
-
-       /**
-        * home_realm - Home Realm for Interworking
-        */
-       char *home_realm;
-
-       /**
-        * home_username - Username for Interworking network selection
-        */
-       char *home_username;
-
-       /**
-        * home_password - Password for Interworking network selection
-        */
-       char *home_password;
-
-       /**
-        * home_ca_cert - CA certificate for Interworking network selection
-        */
-       char *home_ca_cert;
-
-       /**
-        * home_imsi - IMSI in <MCC> | <MNC> | '-' | <MSIN> format
-        */
-       char *home_imsi;
-
-       /**
-        * home_milenage - Milenage parameters for SIM/USIM simulator in
-        *      <Ki>:<OPc>:<SQN> format
-        */
-       char *home_milenage;
 };
 
 
@@ -503,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