summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--network/manager.c7
-rw-r--r--network/server.c18
-rw-r--r--network/server.h6
3 files changed, 13 insertions, 18 deletions
diff --git a/network/manager.c b/network/manager.c
index 15209592..450fd872 100644
--- a/network/manager.c
+++ b/network/manager.c
@@ -803,11 +803,11 @@ static void register_stored(void)
/* NAP objects */
create_name(filename, PATH_MAX, STORAGEDIR, de->d_name, "nap");
-
if (stat (filename, &s) == 0 && (s.st_mode & __S_IFREG)) {
snprintf(path, MAX_PATH_LENGTH,
NETWORK_PATH"/server/nap%d", net_uid++);
- register_nap_from_file(connection, path, &src, filename);
+ server_register_from_file(connection, path,
+ &src, BNEP_SVC_NAP, filename);
}
/* GN objects */
@@ -815,7 +815,8 @@ static void register_stored(void)
if (stat (filename, &s) == 0 && (s.st_mode & __S_IFREG)) {
snprintf(path, MAX_PATH_LENGTH,
NETWORK_PATH"/server/gn%d", net_uid++);
- register_gn_from_file(connection, path, &src, filename);
+ server_register_from_file(connection, path,
+ &src, BNEP_SVC_GN, filename);
}
}
diff --git a/network/server.c b/network/server.c
index be6316a1..a7dc3f6b 100644
--- a/network/server.c
+++ b/network/server.c
@@ -1012,7 +1012,7 @@ int server_register(DBusConnection *conn, const char *addr, const char *path,
ns->conn = dbus_connection_ref(conn);
str2ba(addr, &ns->src);
- info("Registered server path:%s", ns->path);
+ info("Registered server path:%s", path);
return 0;
fail:
@@ -1020,21 +1020,22 @@ fail:
return -1;
}
-int register_nap_from_file(DBusConnection *conn, const char *path,
- const bdaddr_t *src, const char *filename)
+int server_register_from_file(DBusConnection *conn, const char *path,
+ const bdaddr_t *src, uint16_t id, const char *filename)
{
struct network_server *ns;
char *str;
ns = g_new0(struct network_server, 1);
- ns->id = BNEP_SVC_NAP;
+ ns->id = id;
ns->name = textfile_get(filename, "name");
- if (ns->name) {
+ if (!ns->name) {
/* Name is mandatory */
server_free(ns);
return -1;
}
+
ns->secure = FALSE;
str = textfile_get(filename, "secure");
if (str) {
@@ -1056,12 +1057,7 @@ int register_nap_from_file(DBusConnection *conn, const char *path,
/* FIXME: Missing enabled the server(if applied) */
- return 0;
-}
+ info("Registered server path:%s", path);
-int register_gn_from_file(DBusConnection *conn, const char *path,
- const bdaddr_t *src, const char *filename)
-{
- /* FIXME: extract name, description, secure, enabled, address range ...*/
return 0;
}
diff --git a/network/server.h b/network/server.h
index d96873b3..c4dd51e6 100644
--- a/network/server.h
+++ b/network/server.h
@@ -23,8 +23,6 @@
int server_register(DBusConnection *conn, const char *addr,
const char *path, uint16_t id);
-int register_nap_from_file(DBusConnection *conn, const char *path,
- const bdaddr_t *src, const char *filename);
-int register_gn_from_file(DBusConnection *conn, const char *path,
- const bdaddr_t *src, const char *filename);
+int server_register_from_file(DBusConnection *conn, const char *path,
+ const bdaddr_t *src, uint16_t id, const char *filename);
int read_server_uuid(bdaddr_t *src, uint16_t uuid, gboolean *enable);