summaryrefslogtreecommitdiffstats
path: root/network/connection.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-04-13 18:51:51 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-04-13 18:51:51 +0000
commit4706fa6e70ea2e19c7892ade0323a35d4f0b5a47 (patch)
tree64517f07c90b022251707cb51a38ac311018b103 /network/connection.c
parent2cd680bf44197f4fdba3fdfe6d042dcc373c1c52 (diff)
network: changed connection_register prototype
Diffstat (limited to 'network/connection.c')
-rw-r--r--network/connection.c37
1 files changed, 8 insertions, 29 deletions
diff --git a/network/connection.c b/network/connection.c
index e4f759aa..c7f22f4b 100644
--- a/network/connection.c
+++ b/network/connection.c
@@ -28,16 +28,12 @@
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
#include <netinet/in.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/l2cap.h>
#include <bluetooth/bnep.h>
-#include <bluetooth/sdp.h>
-#include <bluetooth/sdp_lib.h>
#include <glib.h>
@@ -564,11 +560,10 @@ static const DBusObjectPathVTable connection_table = {
.unregister_function = connection_unregister,
};
-int connection_register(DBusConnection *conn, const char *path,
- const char *addr, uint16_t id, const sdp_record_t *rec)
+int connection_register(DBusConnection *conn, const char *path, bdaddr_t *src,
+ bdaddr_t *dst, uint16_t id, const char *name, const char *desc)
{
struct network_conn *nc;
- sdp_data_t *d;
if (!conn)
return -1;
@@ -578,39 +573,23 @@ int connection_register(DBusConnection *conn, const char *path,
/* register path */
if (!dbus_connection_register_object_path(conn, path,
&connection_table, nc)) {
- error("D-Bus failed to register %s path", path);
-
connection_free(nc);
return -1;
}
nc->path = g_strdup(path);
- bacpy(&nc->src, BDADDR_ANY);
- str2ba(addr, &nc->dst);
+ bacpy(&nc->src, src);
+ bacpy(&nc->dst, dst);
nc->id = id;
-
- /* Extract service name from record */
- d = sdp_data_get(rec, SDP_ATTR_SVCNAME_PRIMARY);
- if (d) {
- nc->name = g_new0(char, d->unitSize);
- snprintf(nc->name, d->unitSize, "%.*s", d->unitSize,
- d->val.str);
- }
-
- /* Extract service description from record */
- d = sdp_data_get(rec, SDP_ATTR_SVCDESC_PRIMARY);
- if (d) {
- nc->desc = g_new0(char, d->unitSize);
- snprintf(nc->desc, d->unitSize, "%.*s", d->unitSize,
- d->val.str);
- }
-
+ nc->name = g_strdup(name);
+ nc->desc = g_strdup(desc);
memset(nc->dev, 0, 16);
strncpy(nc->dev, netdev, 16);
-
nc->state = DISCONNECTED;
nc->conn = conn;
+
info("Registered connection path:%s", path);
+
return 0;
}