diff options
author | Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com> | 2012-02-14 12:05:42 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-02-14 14:55:55 +0100 |
commit | 484a573ed476cf4d4405b26f4b2ca16e881b5cd3 (patch) | |
tree | 98f00e97f494573bdea81f7cac1144abc822e24c /src/agent.c | |
parent | 1ec91f4d4c4997a76c2540679543c95daa0ba4b9 (diff) | |
download | connman-484a573ed476cf4d4405b26f4b2ca16e881b5cd3.tar.gz connman-484a573ed476cf4d4405b26f4b2ca16e881b5cd3.tar.bz2 connman-484a573ed476cf4d4405b26f4b2ca16e881b5cd3.zip |
agent: Add support for requesting browser action
Diffstat (limited to 'src/agent.c')
-rw-r--r-- | src/agent.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/agent.c b/src/agent.c index a24c2098..67303087 100644 --- a/src/agent.c +++ b/src/agent.c @@ -524,6 +524,50 @@ 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; + + if (url == NULL) + url = ""; + + 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; |