[PATCH 1/5] agent: adding support for requesting browser action

Tomasz Bursztyka tomasz.bursztyka at linux.intel.com
Wed Feb 8 06:24:40 PST 2012


---
 src/agent.c   |   41 +++++++++++++++++++++++++++++++++++++++++
 src/connman.h |    6 ++++++
 2 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/src/agent.c b/src/agent.c
index 9c789cf..0a9230d 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -524,6 +524,47 @@ int __connman_agent_request_login_input(struct connman_service *service,
 	return -EIO;
 }
 
+int __connman_agent_request_browser(struct connman_service *service,
+				browser_authentication_cb_t callback,
+				const char *url, void *user_data)
+{
+	DBusPendingCall *call;
+	DBusMessage *message;
+	DBusMessageIter iter;
+	const char *path;
+
+	if (service == NULL || agent_path == NULL || callback == NULL)
+		return -ESRCH;
+
+	message = dbus_message_new_method_call(agent_sender, agent_path,
+					CONNMAN_AGENT_INTERFACE,
+					"RequestBrowser");
+	if (message == NULL)
+		return -ENOMEM;
+
+	dbus_message_iter_init_append(message, &iter);
+
+	path = __connman_service_get_path(service);
+	dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, &path);
+
+	dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &url);
+
+	if (dbus_connection_send_with_reply(connection, message,
+							&call, -1) == FALSE) {
+		dbus_message_unref(message);
+		return -ESRCH;
+	}
+
+	if (call == NULL) {
+		dbus_message_unref(message);
+		return -ESRCH;
+	}
+
+	dbus_message_unref(message);
+
+	return -EIO;
+}
+
 struct report_error_data {
 	struct connman_service *service;
 	report_error_cb_t callback;
diff --git a/src/connman.h b/src/connman.h
index dcde0f3..967f32b 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -89,12 +89,18 @@ typedef void (* authentication_cb_t) (struct connman_service *service,
 				const char *name, int name_len,
 				const char *identifier, const char *secret,
 				void *user_data);
+typedef void (* browser_authentication_cb_t) (struct connman_service *service,
+				connman_bool_t authentication_done,
+				void *user_data);
 typedef void (* report_error_cb_t) (struct connman_service *service,
 				gboolean retry, void *user_data);
 int __connman_agent_request_passphrase_input(struct connman_service *service,
 				authentication_cb_t callback, void *user_data);
 int __connman_agent_request_login_input(struct connman_service *service,
 				authentication_cb_t callback, void *user_data);
+int __connman_agent_request_browser(struct connman_service *service,
+				browser_authentication_cb_t callback,
+				const char *url, void *user_data);
 int __connman_agent_report_error(struct connman_service *service,
 				const char *error,
 				report_error_cb_t callback, void *user_data);
-- 
1.7.8.4




More information about the connman mailing list