summaryrefslogtreecommitdiffstats
path: root/network
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-03-19 13:57:52 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-03-19 13:57:52 +0000
commit0ac929228aa1eb823f37776e2bbb84855417c66e (patch)
tree841f767e50e07f1e7700dd08e9ffe80381c80445 /network
parent851ad267e554850ae2cbfd486922cbcfb897f8b5 (diff)
Fix build, move errors to error file and add server registration.
Diffstat (limited to 'network')
-rw-r--r--network/connection.c4
-rw-r--r--network/error.c12
-rw-r--r--network/error.h6
-rw-r--r--network/manager.c12
-rw-r--r--network/server.c25
-rw-r--r--network/server.h1
6 files changed, 46 insertions, 14 deletions
diff --git a/network/connection.c b/network/connection.c
index 4966a7e1..e6d4d221 100644
--- a/network/connection.c
+++ b/network/connection.c
@@ -31,10 +31,9 @@
#include "logging.h"
#include "dbus.h"
+#include "error.h"
#define NETWORK_CONNECTION_INTERFACE "org.bluez.network.Manager"
-#define NETWORK_CONNECTION_PATH "/org/bluez/network/connection"
-#define NETWORK_ERROR_INTERFACE "org.bluez.Error"
#include "connection.h"
@@ -157,7 +156,6 @@ static const DBusObjectPathVTable connection_table = {
int connection_register(DBusConnection *conn, const char *path)
{
struct network_conn *nc;
- static int nc_uid = 0;
if (!conn)
return -1;
diff --git a/network/error.c b/network/error.c
index 55c459da..8c0924d5 100644
--- a/network/error.c
+++ b/network/error.c
@@ -26,3 +26,15 @@
#endif
#include "error.h"
+
+#define NETWORK_ERROR_INTERFACE "org.bluez.Error"
+
+DBusHandlerResult err_unknown_connection(DBusConnection *conn,
+ DBusMessage *msg)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg,
+ NETWORK_ERROR_INTERFACE ".UnknownConnection",
+ "Unknown connection path"));
+}
+
diff --git a/network/error.h b/network/error.h
index e87dd676..3572bf27 100644
--- a/network/error.h
+++ b/network/error.h
@@ -20,3 +20,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
+
+#include "dbus.h"
+
+DBusHandlerResult err_unknown_connection(DBusConnection *conn,
+ DBusMessage *msg);
+
diff --git a/network/manager.c b/network/manager.c
index e0265af7..e10a4e33 100644
--- a/network/manager.c
+++ b/network/manager.c
@@ -32,12 +32,11 @@
#include <glib.h>
#include "logging.h"
-#include "dbus.h"
#define NETWORK_PATH "/org/bluez/network"
#define NETWORK_MANAGER_INTERFACE "org.bluez.network.Manager"
-#define NETWORK_ERROR_INTERFACE "org.bluez.Error"
+#include "error.h"
#include "bridge.h"
#include "manager.h"
@@ -48,15 +47,6 @@ struct manager {
static DBusConnection *connection = NULL;
-static DBusHandlerResult err_unknown_connection(DBusConnection *conn,
- DBusMessage *msg)
-{
- return send_message_and_unref(conn,
- dbus_message_new_error(msg,
- NETWORK_ERROR_INTERFACE ".UnknownConnection",
- "Unknown connection path"));
-}
-
static DBusHandlerResult list_servers(DBusConnection *conn,
DBusMessage *msg, void *data)
{
diff --git a/network/server.c b/network/server.c
index 8695aeaa..e88b8090 100644
--- a/network/server.c
+++ b/network/server.c
@@ -161,3 +161,28 @@ static const DBusObjectPathVTable server_table = {
.message_function = server_message,
.unregister_function = server_unregister,
};
+
+int server_register(DBusConnection *conn, const char *path)
+{
+ struct network_server *ns;
+
+ if (!conn)
+ return -1;
+
+ ns = g_new0(struct network_server, 1);
+
+ /* register path */
+ if (!dbus_connection_register_object_path(conn, path,
+ &server_table, ns)) {
+ error("D-Bus failed to register %s path", path);
+ goto fail;
+ }
+
+ ns->path = g_strdup(path);
+ info("Registered server path:%s", path);
+
+ return 0;
+fail:
+ server_free(ns);
+ return -1;
+}
diff --git a/network/server.h b/network/server.h
index e87dd676..33f997a9 100644
--- a/network/server.h
+++ b/network/server.h
@@ -20,3 +20,4 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
+int server_register(DBusConnection *conn, const char *path);