summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@indt.org.br>2008-07-03 16:50:22 -0300
committerLuiz Augusto von Dentz <luiz.dentz@indt.org.br>2008-07-28 10:32:51 -0300
commitc7b89988961e6c197c07fb1ba1f94bf27e457a51 (patch)
treec88f7b61d95805a9acf23443bfa791fbcc48c1e9 /hcid
parentd3ea4d9816ddbc3ee0ea6ad44cd130cb646a3a61 (diff)
Cleanup dbus-database.c.
Diffstat (limited to 'hcid')
-rw-r--r--hcid/dbus-database.c159
-rw-r--r--hcid/dbus-database.h3
2 files changed, 0 insertions, 162 deletions
diff --git a/hcid/dbus-database.c b/hcid/dbus-database.c
index acdb5a72..46b1cbde 100644
--- a/hcid/dbus-database.c
+++ b/hcid/dbus-database.c
@@ -100,62 +100,6 @@ static inline DBusMessage *failed(DBusMessage *msg)
return g_dbus_create_error(msg, ERROR_INTERFACE ".Failed", "Failed");
}
-static DBusMessage *add_service_record(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- DBusMessageIter iter, array;
- const char *sender;
- struct record_data *user_record;
- sdp_record_t *sdp_record;
- const uint8_t *record;
- int scanned, len = -1;
-
- dbus_message_iter_init(msg, &iter);
- dbus_message_iter_recurse(&iter, &array);
-
- dbus_message_iter_get_fixed_array(&array, &record, &len);
- if (len <= 0)
- return invalid_arguments(msg);
-
- sdp_record = sdp_extract_pdu_safe(record, len, &scanned);
- if (!sdp_record) {
- error("Parsing of service record failed");
- return failed(msg);
- }
-
- if (scanned != len) {
- error("Size mismatch of service record");
- sdp_record_free(sdp_record);
- return failed(msg);
- }
-
- if (add_record_to_server(BDADDR_ANY, sdp_record) < 0) {
- error("Failed to register service record");
- sdp_record_free(sdp_record);
- return failed(msg);
- }
-
- user_record = g_new0(struct record_data, 1);
-
- user_record->handle = sdp_record->handle;
-
- sender = dbus_message_get_sender(msg);
-
- user_record->sender = g_strdup(sender);
-
- records = g_slist_append(records, user_record);
-
- user_record->listener_id = g_dbus_add_disconnect_watch(conn, sender,
- exit_callback,
- user_record,
- NULL);
-
- debug("listener_id %d", user_record->listener_id);
-
- return g_dbus_create_reply(msg, DBUS_TYPE_UINT32, &user_record->handle,
- DBUS_TYPE_INVALID);
-}
-
int add_xml_record(DBusConnection *conn, const char *sender, bdaddr_t *src,
const char *record, dbus_uint32_t *handle)
{
@@ -192,27 +136,6 @@ int add_xml_record(DBusConnection *conn, const char *sender, bdaddr_t *src,
return 0;
}
-static DBusMessage *add_service_record_from_xml(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- const char *sender, *record;
- dbus_uint32_t handle;
- int err;
-
- if (dbus_message_get_args(msg, NULL,
- DBUS_TYPE_STRING, &record, DBUS_TYPE_INVALID) == FALSE)
- return NULL;
-
- sender = dbus_message_get_sender(msg);
-
- err = add_xml_record(conn, sender, BDADDR_ANY, record, &handle);
- if (err < 0)
- return failed(msg);
-
- return g_dbus_create_reply(msg, DBUS_TYPE_UINT32, &handle,
- DBUS_TYPE_INVALID);
-}
-
static DBusMessage *update_record(DBusConnection *conn, DBusMessage *msg,
bdaddr_t *src, dbus_uint32_t handle, sdp_record_t *sdp_record)
{
@@ -238,44 +161,6 @@ static DBusMessage *update_record(DBusConnection *conn, DBusMessage *msg,
return dbus_message_new_method_return(msg);
}
-static DBusMessage *update_service_record(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- struct record_data *user_record;
- DBusMessageIter iter, array;
- sdp_record_t *sdp_record;
- dbus_uint32_t handle;
- const uint8_t *bin_record;
- int scanned, size = -1;
-
- dbus_message_iter_init(msg, &iter);
- dbus_message_iter_get_basic(&iter, &handle);
- dbus_message_iter_next(&iter);
- dbus_message_iter_recurse(&iter, &array);
-
- dbus_message_iter_get_fixed_array(&array, &bin_record, &size);
- if (size <= 0)
- return invalid_arguments(msg);
-
- user_record = find_record(handle, dbus_message_get_sender(msg));
- if (!user_record)
- return not_available(msg);
-
- sdp_record = sdp_extract_pdu_safe(bin_record, size, &scanned);
- if (!sdp_record) {
- error("Parsing of service record failed");
- return invalid_arguments(msg);
- }
-
- if (scanned != size) {
- error("Size mismatch of service record");
- sdp_record_free(sdp_record);
- return invalid_arguments(msg);
- }
-
- return update_record(conn, msg, BDADDR_ANY, handle, sdp_record);
-}
-
DBusMessage *update_xml_record(DBusConnection *conn,
DBusMessage *msg, bdaddr_t *src)
{
@@ -313,12 +198,6 @@ DBusMessage *update_xml_record(DBusConnection *conn,
return update_record(conn, msg, src, handle, sdp_record);
}
-static DBusMessage *update_service_record_from_xml(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- return update_xml_record(conn, msg, BDADDR_ANY);
-}
-
int remove_record(DBusConnection *conn, const char *sender,
dbus_uint32_t handle)
{
@@ -338,41 +217,3 @@ int remove_record(DBusConnection *conn, const char *sender,
return 0;
}
-
-static DBusMessage *remove_service_record(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- dbus_uint32_t handle;
- const char *sender;
-
- if (dbus_message_get_args(msg, NULL,
- DBUS_TYPE_UINT32, &handle, DBUS_TYPE_INVALID) == FALSE)
- return NULL;
-
- sender = dbus_message_get_sender(msg);
-
- if (remove_record(conn, sender, handle) < 0)
- return not_available(msg);
-
- return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
-}
-
-static GDBusMethodTable database_methods[] = {
- { "AddServiceRecord", "ay", "u", add_service_record },
- { "AddServiceRecordFromXML", "s", "u", add_service_record_from_xml },
- { "UpdateServiceRecord", "uay", "", update_service_record },
- { "UpdateServiceRecordFromXML", "us", "", update_service_record_from_xml },
- { "RemoveServiceRecord", "u", "", remove_service_record },
- { }
-};
-
-dbus_bool_t database_init(DBusConnection *conn, const char *path)
-{
- return g_dbus_register_interface(conn, path, DATABASE_INTERFACE,
- database_methods, NULL, NULL, NULL, NULL);
-}
-
-void database_cleanup(DBusConnection *conn, const char *path)
-{
- g_dbus_unregister_interface(conn, path, DATABASE_INTERFACE);
-}
diff --git a/hcid/dbus-database.h b/hcid/dbus-database.h
index c173afaf..2f5606fc 100644
--- a/hcid/dbus-database.h
+++ b/hcid/dbus-database.h
@@ -24,9 +24,6 @@
#define DATABASE_INTERFACE "org.bluez.Database"
-dbus_bool_t database_init(DBusConnection *conn, const char *path);
-void database_cleanup(DBusConnection *conn, const char *path);
-
int add_xml_record(DBusConnection *conn, const char *sender, bdaddr_t *src,
const char *record, dbus_uint32_t *handle);
DBusMessage *update_xml_record(DBusConnection *conn,