Commit 1a5cfc1f authored by Dan Winship's avatar Dan Winship

dispatcher: port to GDBus

Port nm-dispatcher to GDBus, mostly, using dbus-glib's GVariant
utilities to translate the return value of nm_connection_to_dbus().
parent 408e86dd
......@@ -43,6 +43,7 @@ valgrind-*.log
/callouts/nm-avahi-autoipd.action
/callouts/nm-dispatcher
/callouts/nmdbus-dispatcher.*
/callouts/org.freedesktop.nm_dispatcher.service
/callouts/tests/test-dispatcher-envp
......
......@@ -46,11 +46,33 @@ nm_dispatcher_SOURCES = \
nm_dispatcher_LDADD = \
$(top_builddir)/libnm/libnm.la \
$(DBUS_LIBS) \
libnmdbus-dispatcher.la \
$(GLIB_LIBS)
nm-dispatcher-glue.h: nm-dispatcher.xml
$(AM_V_GEN) dbus-binding-tool --prefix=nm_dispatcher --mode=glib-server --output=$@ $<
# We have to build the gdbus generated code separately, without
# -DGLIB_VERSION_MAX_ALLOWED, due to a bug in GLib 2.38
noinst_LTLIBRARIES += libnmdbus-dispatcher.la
libnmdbus_dispatcher_la_SOURCES = \
nmdbus-dispatcher.c \
nmdbus-dispatcher.h
libnmdbus_dispatcher_la_CPPFLAGS = $(filter-out -DGLIB_VERSION_MAX_ALLOWED%,$(AM_CPPFLAGS))
nmdbus-dispatcher.h: nm-dispatcher.xml
$(AM_V_GEN) gdbus-codegen \
--generate-c-code $(basename $@) \
--c-namespace NMDBus \
--interface-prefix org.freedesktop \
$<
nmdbus-dispatcher.c: nmdbus-dispatcher.h
@true
BUILT_SOURCES = \
nmdbus-dispatcher.c \
nmdbus-dispatcher.h
###########################################
# dispatcher envp
......@@ -65,8 +87,7 @@ libtest_dispatcher_envp_la_CPPFLAGS = \
libtest_dispatcher_envp_la_LIBADD = \
$(top_builddir)/libnm/libnm.la \
$(GLIB_LIBS) \
$(DBUS_LIBS)
$(GLIB_LIBS)
if WITH_UDEV_DIR
......@@ -93,8 +114,6 @@ install-data-hook:
$(mkinstalldirs) -m 0755 $(DESTDIR)$(dispatcherdir)/pre-down.d
$(mkinstalldirs) -m 0755 $(DESTDIR)$(dispatcherdir)/pre-up.d
BUILT_SOURCES = nm-dispatcher-glue.h
CLEANFILES = $(BUILT_SOURCES) $(dbusactivation_DATA)
EXTRA_DIST = \
......
......@@ -18,13 +18,11 @@
* Copyright (C) 2008 - 2012 Red Hat, Inc.
*/
#include <dbus/dbus-glib.h>
#define NMD_SCRIPT_DIR_DEFAULT NMCONFDIR "/dispatcher.d"
#define NMD_SCRIPT_DIR_PRE_UP NMD_SCRIPT_DIR_DEFAULT "/pre-up.d"
#define NMD_SCRIPT_DIR_PRE_DOWN NMD_SCRIPT_DIR_DEFAULT "/pre-down.d"
/* dbus-glib types for dispatcher call return value */
/* dbus-glib types for dispatcher call return value (used by src/nm-dispatcher.c) */
#define DISPATCHER_TYPE_RESULT (dbus_g_type_get_struct ("GValueArray", G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID))
#define DISPATCHER_TYPE_RESULT_ARRAY (dbus_g_type_get_collection ("GPtrArray", DISPATCHER_TYPE_RESULT))
......
This diff is collapsed.
......@@ -25,16 +25,16 @@
char **
nm_dispatcher_utils_construct_envp (const char *action,
GHashTable *connection_hash,
GHashTable *connection_props,
GHashTable *device_props,
GHashTable *device_ip4_props,
GHashTable *device_ip6_props,
GHashTable *device_dhcp4_props,
GHashTable *device_dhcp6_props,
GVariant *connection_dict,
GVariant *connection_props,
GVariant *device_props,
GVariant *device_ip4_props,
GVariant *device_ip6_props,
GVariant *device_dhcp4_props,
GVariant *device_dhcp6_props,
const char *vpn_ip_iface,
GHashTable *vpn_ip4_props,
GHashTable *vpn_ip6_props,
GVariant *vpn_ip4_props,
GVariant *vpn_ip6_props,
char **out_iface);
#endif /* __NETWORKMANAGER_DISPATCHER_UTILS_H__ */
......
This diff is collapsed.
......@@ -2,15 +2,13 @@
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.nm_dispatcher">
<annotation name="org.gtk.GDBus.C.Name" value="Dispatcher"/>
<method name="Action">
<tp:docstring>
INTERNAL; not public API. Perform an action.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_dispatch"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="action" type="s" direction="in">
<tp:docstring>
The action being performed.
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment