Add skeleton for agent infrastructure
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 24 Jan 2008 11:07:55 +0000 (12:07 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 24 Jan 2008 11:07:55 +0000 (12:07 +0100)
src/Makefile.am
src/agent.c [new file with mode: 0644]
src/connman.h
src/main.c
src/manager.c

index 4da752e..1a09a0f 100644 (file)
@@ -5,7 +5,7 @@ dbus_DATA = connman.conf
 
 sbin_PROGRAMS = connmand
 
-connmand_SOURCES = main.c connman.h manager.c plugin.c \
+connmand_SOURCES = main.c connman.h manager.c agent.c plugin.c \
                        iface.c iface-storage.c iface-helper.c \
                                        iface-inet.c rtnl.c dhcp.c
 
diff --git a/src/agent.c b/src/agent.c
new file mode 100644 (file)
index 0000000..d3a2746
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ *
+ *  Connection Manager
+ *
+ *  Copyright (C) 2007  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "connman.h"
+
+int __connman_agent_init(void)
+{
+       DBG("");
+
+       return 0;
+}
+
+void __connman_agent_cleanup(void)
+{
+       DBG("");
+}
+
+int __connman_agent_register(const char *path)
+{
+       DBG("");
+
+       return 0;
+}
+
+int __connman_agent_unregister(const char *path)
+{
+       DBG("");
+
+       return 0;
+}
index 8756034..ff33489 100644 (file)
 int __connman_manager_init(DBusConnection *conn, int compat);
 void __connman_manager_cleanup(void);
 
+int __connman_agent_init(void);
+void __connman_agent_cleanup(void);
+
+int __connman_agent_register(const char *path);
+int __connman_agent_unregister(const char *path);
+
 #include <connman/plugin.h>
 
 int __connman_plugin_init(void);
index 8de7fbe..1b314db 100644 (file)
@@ -120,6 +120,8 @@ int main(int argc, char *argv[])
                        compat = 0;
        }
 
+       __connman_agent_init();
+
        __connman_manager_init(conn, compat);
 
        __connman_plugin_init();
@@ -143,6 +145,8 @@ int main(int argc, char *argv[])
 
        __connman_manager_cleanup();
 
+       __connman_agent_cleanup();
+
        g_dbus_cleanup_connection(conn);
 
        g_main_loop_unref(main_loop);
index b11d805..2a1a738 100644 (file)
@@ -70,9 +70,55 @@ static DBusMessage *get_state(DBusConnection *conn,
        return reply;
 }
 
+static DBusMessage *register_agent(DBusConnection *conn,
+                                       DBusMessage *msg, void *data)
+{
+       DBusMessage *reply;
+       const char *path;
+
+       DBG("conn %p", conn);
+
+       dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
+                                                       DBUS_TYPE_INVALID);
+
+       reply = dbus_message_new_method_return(msg);
+       if (reply == NULL)
+               return NULL;
+
+       dbus_message_append_args(reply, DBUS_TYPE_INVALID);
+
+       __connman_agent_register(path);
+
+       return reply;
+}
+
+static DBusMessage *unregister_agent(DBusConnection *conn,
+                                       DBusMessage *msg, void *data)
+{
+       DBusMessage *reply;
+       const char *path;
+
+       DBG("conn %p", conn);
+
+       dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
+                                                       DBUS_TYPE_INVALID);
+
+       reply = dbus_message_new_method_return(msg);
+       if (reply == NULL)
+               return NULL;
+
+       dbus_message_append_args(reply, DBUS_TYPE_INVALID);
+
+       __connman_agent_unregister(path);
+
+       return reply;
+}
+
 static GDBusMethodTable manager_methods[] = {
-       { "ListInterfaces", "", "ao", list_interfaces },
-       { "GetState",       "", "s",  get_state       },
+       { "ListInterfaces",  "",  "ao", list_interfaces  },
+       { "GetState",        "",  "s",  get_state        },
+       { "RegisterAgent",   "o", "",   register_agent   },
+       { "UnregisterAgent", "o", "",   unregister_agent },
        { },
 };