diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-04-16 13:49:13 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-04-16 13:49:13 +0000 |
commit | 8c599674509651cc8e68d12ba21423dbf13305d9 (patch) | |
tree | d15c6cb6374f599a94ad68a95c4ea77d27627ba1 /network/server.c | |
parent | 3723149c0baab5f94d57221fa693e4d0ec19df6b (diff) |
network: added function to store/update server property
Diffstat (limited to 'network/server.c')
-rw-r--r-- | network/server.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/network/server.c b/network/server.c index 160f8910..f5a4b7c3 100644 --- a/network/server.c +++ b/network/server.c @@ -79,6 +79,21 @@ struct network_server { static char netdev[16] = "bnep%d"; +static int store_property(bdaddr_t *src, uint16_t id, + const char *key, const char *value) +{ + char filename[PATH_MAX + 1]; + char addr[18]; + + ba2str(src, addr); + if (id == BNEP_SVC_NAP) + create_name(filename, PATH_MAX, STORAGEDIR, addr, "nap"); + else + create_name(filename, PATH_MAX, STORAGEDIR, addr, "gn"); + + return textfile_put(filename, key, value); +} + static void pending_auth_free(struct pending_auth *pauth) { if (!pauth) @@ -723,7 +738,7 @@ static DBusHandlerResult enable(DBusConnection *conn, if (err < 0) return err_failed(conn, msg, strerror(-err)); - network_store_info(&ns->src, ns->id, TRUE); + store_property(&ns->src, ns->id, "enabled", "1"); return send_message_and_unref(conn, reply); } @@ -751,7 +766,7 @@ static DBusHandlerResult disable(DBusConnection *conn, g_io_channel_unref(ns->io); ns->io = NULL; - network_store_info(&ns->src, ns->id, FALSE); + store_property(&ns->src, ns->id, "enabled", "0"); return send_message_and_unref(conn, reply); } |