diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-03-23 21:04:08 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-03-23 21:04:08 +0000 |
commit | ef3649fd9e62bd989ff67a125a05c962d5640fd3 (patch) | |
tree | f8ec45b3ad8422908f9c1990fb65eec6287d4b98 /network/server.c | |
parent | 696c7534eca66f0dd64de6aba2ab26e8a4b66eea (diff) |
network: using service class identifier instead of the uuid 128 string for server registration
Diffstat (limited to 'network/server.c')
-rw-r--r-- | network/server.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/network/server.c b/network/server.c index 5cfb332e..80c8df9e 100644 --- a/network/server.c +++ b/network/server.c @@ -37,14 +37,15 @@ #define NETWORK_SERVER_INTERFACE "org.bluez.network.Server" +#include "common.h" #include "server.h" struct network_server { char *iface; /* Routing interface */ char *name; char *path; - char *uuid; /* UUID 128 */ dbus_bool_t secure; + uint16_t id; /* Service class identifier */ }; static DBusHandlerResult get_uuid(DBusConnection *conn, @@ -52,13 +53,15 @@ static DBusHandlerResult get_uuid(DBusConnection *conn, { struct network_server *ns = data; DBusMessage *reply; + const char *uuid; reply = dbus_message_new_method_return(msg); if (!reply) return DBUS_HANDLER_RESULT_NEED_MEMORY; + uuid = bnep_uuid(ns->id); dbus_message_append_args(reply, - DBUS_TYPE_STRING, &ns->uuid, + DBUS_TYPE_STRING, &uuid, DBUS_TYPE_INVALID); return send_message_and_unref(conn, reply); @@ -264,9 +267,6 @@ static void server_free(struct network_server *ns) if (ns->path) g_free(ns->path); - if (ns->uuid) - g_free(ns->uuid); - g_free(ns); } @@ -285,14 +285,14 @@ static const DBusObjectPathVTable server_table = { .unregister_function = server_unregister, }; -int server_register(DBusConnection *conn, const char *path, const char *uuid) +int server_register(DBusConnection *conn, const char *path, uint16_t id) { struct network_server *ns; if (!conn) return -EINVAL; - if (!path || !uuid) + if (!path) return -EINVAL; ns = g_new0(struct network_server, 1); @@ -305,7 +305,7 @@ int server_register(DBusConnection *conn, const char *path, const char *uuid) } ns->path = g_strdup(path); - ns->uuid = g_strdup(uuid); + ns->id = id; info("Registered server path:%s", ns->path); return 0; |