return 0;
}
+int __connman_agent_request_passphrase(struct connman_service *service,
+ passphrase_cb_t callback, void *user_data)
+{
+ DBusMessage *message;
+ const char *path;
+
+ DBG("service %p", service);
+
+ if (agent_path == NULL)
+ return -ESRCH;
+
+ message = dbus_message_new_method_call(agent_sender, agent_path,
+ CONNMAN_AGENT_INTERFACE, "RequestPassphrase");
+ if (message == NULL)
+ return -ENOMEM;
+
+ dbus_message_set_no_reply(message, TRUE);
+
+ path = __connman_service_get_path(service);
+
+ dbus_message_append_args(message, DBUS_TYPE_OBJECT_PATH, &path,
+ DBUS_TYPE_INVALID);
+
+ g_dbus_send_message(connection, message);
+
+ return -EIO;
+}
+
int __connman_agent_init(void)
{
DBG("");
void __connman_agent_cleanup(void)
{
- DBusMessage *msg;
+ DBusMessage *message;
DBG("");
if (agent_path == NULL)
return;
- msg = dbus_message_new_method_call(agent_sender, agent_path,
+ message = dbus_message_new_method_call(agent_sender, agent_path,
CONNMAN_AGENT_INTERFACE, "Release");
- if (msg == NULL)
+ if (message == NULL)
return;
- dbus_message_set_no_reply(msg, TRUE);
-
- dbus_connection_send(connection, msg, NULL);
+ dbus_message_set_no_reply(message, TRUE);
- dbus_message_unref(msg);
+ g_dbus_send_message(connection, message);
agent_free();
int __connman_agent_register(const char *sender, const char *path);
int __connman_agent_unregister(const char *sender, const char *path);
+struct connman_service;
+
+typedef void (* passphrase_cb_t) (struct connman_service *service,
+ const char *passphrase, void *user_data);
+
+int __connman_agent_request_passphrase(struct connman_service *service,
+ passphrase_cb_t callback, void *user_data);
+
#include <connman/log.h>
int __connman_log_init(gboolean detach, gboolean debug);
void __connman_service_update_from_network(struct connman_network *network);
void __connman_service_remove_from_network(struct connman_network *network);
+const char *__connman_service_get_path(struct connman_service *service);
unsigned int __connman_service_get_order(struct connman_service *service);
int __connman_service_set_carrier(struct connman_service *service,
err = __connman_service_connect(service);
if (err < 0) {
+ if (err == -ENOKEY) {
+ if (__connman_agent_request_passphrase(service,
+ NULL, NULL) == 0)
+ return NULL;
+ }
+
if (err != -EINPROGRESS) {
dbus_message_unref(service->pending);
service->pending = NULL;
return service;
}
+const char *__connman_service_get_path(struct connman_service *service)
+{
+ return service->path;
+}
+
unsigned int __connman_service_get_order(struct connman_service *service)
{
GSequenceIter *iter;