summaryrefslogtreecommitdiffstats
path: root/network/common.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-08-29 17:50:49 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-08-29 17:50:49 +0000
commit1b9cc018822ca0edde9d0485c382a13a90253e43 (patch)
tree3f198887f78f527d508f4bb45a2ff8897843181f /network/common.c
parent1dfdcaaccb924c36d6ab8380fb52ea5a9691a872 (diff)
network: concat remote name and service name to the connection name
Diffstat (limited to 'network/common.c')
-rw-r--r--network/common.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/network/common.c b/network/common.c
index 0a11d306..d818829a 100644
--- a/network/common.c
+++ b/network/common.c
@@ -40,6 +40,7 @@
#include "logging.h"
#include "common.h"
+#include "textfile.h"
static int ctl;
@@ -204,3 +205,21 @@ int bnep_if_up(const char *devname, int up)
return 0;
}
+
+int read_remote_name(bdaddr_t *src, bdaddr_t *dst, char *buf, size_t size)
+{
+ char filename[PATH_MAX + 1], addr[18], *str;
+
+ ba2str(src, addr);
+ create_name(filename, PATH_MAX, STORAGEDIR, addr, "names");
+
+ ba2str(dst, addr);
+ str = textfile_get(filename, addr);
+ if (!str)
+ return -ENOENT;
+
+ snprintf(buf, size, "%s", str);
+ free(str);
+
+ return 0;
+}