summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-security.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-05-04 15:32:26 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-05-04 15:32:26 +0000
commit994212593598a7c176342e616bc99aae45991244 (patch)
treeb27993a278543aafe294543adec27b4fe85ff4ba /hcid/dbus-security.c
parent16dceb4c2f7a8ed91c88b1c1353b6bd5ccc68cbf (diff)
Convert to using the generic D-Bus object handling
Diffstat (limited to 'hcid/dbus-security.c')
-rw-r--r--hcid/dbus-security.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/hcid/dbus-security.c b/hcid/dbus-security.c
index df06f008..41782535 100644
--- a/hcid/dbus-security.c
+++ b/hcid/dbus-security.c
@@ -41,6 +41,7 @@
#include <dbus/dbus.h>
#include "dbus.h"
+#include "dbus-helper.h"
#include "hcid.h"
#include "dbus-common.h"
#include "dbus-adapter.h"
@@ -835,27 +836,27 @@ DBusHandlerResult cancel_authorize_request(DBusConnection *conn,
service, address, path);
}
-static struct service_data sec_services[] = {
- { "RegisterDefaultPasskeyAgent", register_default_passkey_agent },
- { "UnregisterDefaultPasskeyAgent", unregister_default_passkey_agent },
- { "RegisterPasskeyAgent", register_passkey_agent },
- { "UnregisterPasskeyAgent", unregister_passkey_agent },
- { "RegisterDefaultAuthorizationAgent", register_default_auth_agent },
- { "UnregisterDefaultAuthorizationAgent", unregister_default_auth_agent },
- { NULL, NULL }
+static DBusMethodVTable security_methods[] = {
+ { "RegisterDefaultPasskeyAgent", register_default_passkey_agent,
+ "s", "" },
+ { "UnregisterDefaultPasskeyAgent", unregister_default_passkey_agent,
+ "s", "" },
+ { "RegisterPasskeyAgent", register_passkey_agent,
+ "ss", "" },
+ { "UnregisterPasskeyAgent", unregister_passkey_agent,
+ "ss", "" },
+ { "RegisterDefaultAuthorizationAgent", register_default_auth_agent,
+ "s", "" },
+ { "UnregisterDefaultAuthorizationAgent", unregister_default_auth_agent,
+ "s", "" },
+ { NULL, NULL, NULL, NULL }
};
-DBusHandlerResult handle_security_method(DBusConnection *conn,
- DBusMessage *msg, void *data)
+dbus_bool_t security_init(DBusConnection *conn, const char *path)
{
- service_handler_func_t handler;
-
- handler = find_service_handler(sec_services, msg);
-
- if (handler)
- return handler(conn, msg, data);
-
- return error_unknown_method(conn, msg);
+ return dbus_connection_register_interface(conn, path, SECURITY_INTERFACE,
+ security_methods,
+ NULL, NULL);
}
static DBusPendingCall *agent_request(const char *path, bdaddr_t *bda,
@@ -1039,7 +1040,7 @@ int handle_passkey_request(DBusConnection *conn, int dev, const char *path,
char addr[18];
void *data;
- dbus_connection_get_object_path_data(conn, path, &data);
+ dbus_connection_get_object_user_data(conn, path, &data);
if (!data)
goto done;
@@ -1218,7 +1219,7 @@ int handle_confirm_request(DBusConnection *conn, int dev, const char *path,
char addr[18];
void *data;
- dbus_connection_get_object_path_data(conn, path, &data);
+ dbus_connection_get_object_user_data(conn, path, &data);
if (!data)
goto done;