summaryrefslogtreecommitdiff
path: root/vpn
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-11-30 11:30:43 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-11-30 15:01:19 +0200
commitdf990b51eac495ac3b482629a9798938e14f0ad4 (patch)
treef5af82a8d4b1ed7a3344010088ce0d688d0d893d /vpn
parent5de0f9dec69dba2466f44d9fd031e36b488dd15a (diff)
downloadconnman-df990b51eac495ac3b482629a9798938e14f0ad4.tar.gz
connman-df990b51eac495ac3b482629a9798938e14f0ad4.tar.bz2
connman-df990b51eac495ac3b482629a9798938e14f0ad4.zip
vpn-agent: Routine to add username and password into agent dict
Diffstat (limited to 'vpn')
-rw-r--r--vpn/vpn-agent.c45
-rw-r--r--vpn/vpn-agent.h3
2 files changed, 48 insertions, 0 deletions
diff --git a/vpn/vpn-agent.c b/vpn/vpn-agent.c
index 0281764d..f1cfb1e0 100644
--- a/vpn/vpn-agent.c
+++ b/vpn/vpn-agent.c
@@ -98,3 +98,48 @@ void vpn_agent_append_host_and_name(DBusMessageIter *iter,
request_input_append_name,
provider);
}
+
+struct user_info_data {
+ struct vpn_provider *provider;
+ const char *username_str;
+};
+
+static void request_input_append_user_info(DBusMessageIter *iter,
+ void *user_data)
+{
+ struct user_info_data *data = user_data;
+ struct vpn_provider *provider = data->provider;
+ const char *str = "string";
+
+ connman_dbus_dict_append_basic(iter, "Type",
+ DBUS_TYPE_STRING, &str);
+ str = "mandatory";
+ connman_dbus_dict_append_basic(iter, "Requirement",
+ DBUS_TYPE_STRING, &str);
+
+ if (data->username_str != NULL) {
+ str = vpn_provider_get_string(provider, data->username_str);
+ if (str != NULL)
+ connman_dbus_dict_append_basic(iter, "Value",
+ DBUS_TYPE_STRING, &str);
+ }
+}
+
+void vpn_agent_append_user_info(DBusMessageIter *iter,
+ struct vpn_provider *provider,
+ const char *username_str)
+{
+ struct user_info_data data = {
+ .provider = provider,
+ .username_str = username_str
+ };
+
+ connman_dbus_dict_append_dict(iter, "Username",
+ request_input_append_user_info,
+ &data);
+
+ data.username_str = NULL;
+ connman_dbus_dict_append_dict(iter, "Password",
+ request_input_append_user_info,
+ &data);
+}
diff --git a/vpn/vpn-agent.h b/vpn/vpn-agent.h
index 41b7f8c2..821d7596 100644
--- a/vpn/vpn-agent.h
+++ b/vpn/vpn-agent.h
@@ -35,6 +35,9 @@ extern "C" {
void vpn_agent_append_host_and_name(DBusMessageIter *iter,
struct vpn_provider *provider);
connman_bool_t vpn_agent_check_reply_has_dict(DBusMessage *reply);
+void vpn_agent_append_user_info(DBusMessageIter *iter,
+ struct vpn_provider *provider,
+ const char *username_str);
#ifdef __cplusplus
}