summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-database.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-01-24 05:38:40 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-01-24 05:38:40 +0000
commit3021d8e125537fd3b14a5d50e0710bce17f8d198 (patch)
treeb899e4e247deb92223bd11e986a6defb7fc50b1f /hcid/dbus-database.c
parentbf9a0168854c71faff3e67c42c6265069230f6ce (diff)
Add support for internal debug services
Diffstat (limited to 'hcid/dbus-database.c')
-rw-r--r--hcid/dbus-database.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/hcid/dbus-database.c b/hcid/dbus-database.c
index 1e0cee3e..f0b13abb 100644
--- a/hcid/dbus-database.c
+++ b/hcid/dbus-database.c
@@ -43,6 +43,8 @@
#include "sdp-xml.h"
#include "dbus-common.h"
#include "dbus-error.h"
+#include "dbus-hci.h"
+#include "dbus-service.h"
#include "dbus-database.h"
static int sdp_server_enable = 0;
@@ -264,10 +266,38 @@ static DBusHandlerResult remove_service_record(DBusConnection *conn,
return send_message_and_unref(conn, reply);
}
+static DBusHandlerResult register_service(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ DBusMessage *reply;
+ const char *ident, *name, *desc;
+ const char *sender;
+
+ if (!hcid_dbus_use_experimental())
+ return error_unknown_method(conn, msg);
+
+ if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &ident,
+ DBUS_TYPE_STRING, &name, DBUS_TYPE_STRING, &desc,
+ DBUS_TYPE_INVALID) == FALSE)
+ return error_invalid_arguments(conn, msg);
+
+ sender = dbus_message_get_sender(msg);
+
+ if (service_register(sender, ident, name, desc) < 0)
+ return error_failed(conn, msg, EIO);
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ return send_message_and_unref(conn, reply);
+}
+
static struct service_data database_services[] = {
{ "AddServiceRecord", add_service_record },
{ "AddServiceRecordFromXML", add_service_record_from_xml },
{ "RemoveServiceRecord", remove_service_record },
+ { "RegisterService", register_service },
{ NULL, NULL }
};