added interface XML to introspection/ added GTypeInterface skeleton in src/ that NMPolicy can implement --- introspection/Makefile.am | 3 +- introspection/all.xml | 1 + introspection/nm-zones.xml | 42 +++++++++++++++++++++ libnm-glib/Makefile.am | 6 +++- src/Makefile.am | 10 ++++- src/nm-zones-interface.c | 87 ++++++++++++++++++++++++++++++++++++++++++++ src/nm-zones-interface.h | 51 ++++++++++++++++++++++++++ 7 files changed, 196 insertions(+), 4 deletions(-) create mode 100644 introspection/nm-zones.xml create mode 100644 src/nm-zones-interface.c create mode 100644 src/nm-zones-interface.h
diff --git a/introspection/Makefile.am b/introspection/Makefile.am index 320245e..7b86631 100644 --- a/introspection/Makefile.am +++ b/introspection/Makefile.am @@ -24,5 +24,6 @@ EXTRA_DIST = \ nm-dhcp6-config.xml \ nm-agent-manager.xml \ nm-wimax-nsp.xml \ - nm-secret-agent.xml + nm-secret-agent.xml \ + nm-zones.xml diff --git a/introspection/all.xml b/introspection/all.xml index 5d1baf0..f2df540 100644 --- a/introspection/all.xml +++ b/introspection/all.xml @@ -45,6 +45,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</ <xi:include href="nm-agent-manager.xml"/> <xi:include href="nm-vpn-connection.xml"/> <xi:include href="nm-vpn-plugin.xml"/> +<xi:include href="nm-zones.xml"/> <xi:include href="errors.xml"/> <xi:include href="vpn-errors.xml"/> diff --git a/introspection/nm-zones.xml b/introspection/nm-zones.xml new file mode 100644 index 0000000..e42b05b --- /dev/null +++ b/introspection/nm-zones.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + <interface name="org.freedesktop.NetworkManager.Zones"> + <tp:docstring> + The Zones interface allows clients to be informed about what zone connection belongs to. + </tp:docstring> + + <signal name="ConnectionAdded"> + <tp:docstring> + A connection was added to zone. + </tp:docstring> + <arg name="iface_name" type="s"> + <tp:docstring> + The interface name. + </tp:docstring> + </arg> + <arg name="zone_name" type="s"> + <tp:docstring> + The zone name. + </tp:docstring> + </arg> + </signal> + + <signal name="ConnectionRemoved"> + <tp:docstring> + A connection was removed from zone. + </tp:docstring> + <arg name="iface_name" type="s"> + <tp:docstring> + The interface name. + </tp:docstring> + </arg> + <arg name="zone_name" type="s"> + <tp:docstring> + The zone name. + </tp:docstring> + </arg> + </signal> + + </interface> +</node> diff --git a/libnm-glib/Makefile.am b/libnm-glib/Makefile.am index 4eec401..c362389 100644 --- a/libnm-glib/Makefile.am +++ b/libnm-glib/Makefile.am @@ -23,7 +23,8 @@ BUILT_SOURCES = \ nm-dhcp4-config-bindings.h \ nm-ip6-config-bindings.h \ nm-dhcp6-config-bindings.h \ - nm-secret-agent-glue.h + nm-secret-agent-glue.h \ + nm-zones-bindings.h noinst_LTLIBRARIES = \ @@ -234,6 +235,9 @@ nm-device-wimax-bindings.h: $(top_srcdir)/introspection/nm-device-wimax.xml nm-device-modem-bindings.h: $(top_srcdir)/introspection/nm-device-modem.xml dbus-binding-tool --prefix=nm_device_modem --mode=glib-client --output=$@ $< +nm-zones-bindings.h: $(top_srcdir)/introspection/nm-zones.xml + $(AM_V_GEN) dbus-binding-tool --prefix=nm_zones --mode=glib-client --output=$@ $< + pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libnm-glib.pc libnm-glib-vpn.pc diff --git a/src/Makefile.am b/src/Makefile.am index 94e1a8c..e8fd898 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -171,7 +171,9 @@ NetworkManager_SOURCES = \ nm-dhcp6-config.h \ nm-rfkill.h \ nm-session-monitor.c \ - nm-session-monitor.h + nm-session-monitor.h \ + nm-zones-interface.c \ + nm-zones-interface.h nm-access-point-glue.h: $(top_srcdir)/introspection/nm-access-point.xml $(AM_V_GEN) dbus-binding-tool --prefix=nm_access_point --mode=glib-server --output=$@ $< @@ -212,6 +214,9 @@ nm-dhcp6-config-glue.h: $(top_srcdir)/introspection/nm-dhcp6-config.xml nm-device-modem-glue.h: $(top_srcdir)/introspection/nm-device-modem.xml $(AM_V_GEN) dbus-binding-tool --prefix=nm_device_modem --mode=glib-server --output=$@ $< +nm-zones-glue.h: $(top_srcdir)/introspection/nm-zones.xml + $(AM_V_GEN) dbus-binding-tool --prefix=nm_zones --mode=glib-server --output=$@ $< + BUILT_SOURCES = \ nm-access-point-glue.h \ nm-manager-glue.h \ @@ -225,7 +230,8 @@ BUILT_SOURCES = \ nm-ip6-config-glue.h \ nm-active-connection-glue.h \ nm-dhcp4-config-glue.h \ - nm-dhcp6-config-glue.h + nm-dhcp6-config-glue.h \ + nm-zones-glue.h NetworkManager_CPPFLAGS = \ $(DBUS_CFLAGS) \ diff --git a/src/nm-zones-interface.c b/src/nm-zones-interface.c new file mode 100644 index 0000000..62c6a4c --- /dev/null +++ b/src/nm-zones-interface.c @@ -0,0 +1,87 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* NetworkManager -- Network link manager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright (C) 2011 Red Hat, Inc. + */ + +#include "nm-zones-interface.h" +#include "nm-zones-glue.h" +#include "nm-marshal.h" +#include <dbus/dbus-glib-lowlevel.h> + +static void +nm_zones_interface_base_init (gpointer g_iface) +{ + GType iface_type = G_TYPE_FROM_INTERFACE (g_iface); + static gboolean is_initialized = FALSE; + + if (!is_initialized) + { + + /* Signals */ + + g_signal_new (NM_ZONES_INTERFACE_CONNECTION_ADDED, + iface_type, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (NMZonesInterface, connection_added), + NULL, NULL, + _nm_marshal_VOID__STRING_STRING, + G_TYPE_NONE, 2, + G_TYPE_STRING, G_TYPE_STRING); + + g_signal_new (NM_ZONES_INTERFACE_CONNECTION_REMOVED, + iface_type, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (NMZonesInterface, connection_removed), + NULL, NULL, + _nm_marshal_VOID__STRING_STRING, + G_TYPE_NONE, 2, + G_TYPE_STRING, G_TYPE_STRING); + + is_initialized = TRUE; + } + + /* Bind this GType into the GLib/D-Bus wrappers */ + dbus_g_object_type_install_info (iface_type, + &dbus_glib_nm_zones_object_info); + +} + +GType +nm_zones_interface_get_type (void) +{ + static GType type = 0; + + if (!G_UNLIKELY (type)) { + const GTypeInfo type_info = { + sizeof (NMZonesInterface), /* class_size */ + nm_zones_interface_base_init, /* base_init */ + NULL, /* base_finalize */ + NULL, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + 0, /* instance_size */ + 0, /* n_preallocs */ + NULL /* instance_init */ + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "NMZonesInterface", &type_info, 0); + g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); + } + + return type; +} diff --git a/src/nm-zones-interface.h b/src/nm-zones-interface.h new file mode 100644 index 0000000..c150bde --- /dev/null +++ b/src/nm-zones-interface.h @@ -0,0 +1,51 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* NetworkManager -- Network link manager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright (C) 2011 Red Hat, Inc. + */ + +#ifndef NM_ZONES_INTERFACE_H +#define NM_ZONES_INTERFACE_H + +#include <glib-object.h> + +#define NM_TYPE_ZONES_INTERFACE (nm_zones_interface_get_type ()) +#define NM_ZONES_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_ZONES_INTERFACE, NMZonesInterface)) +#define NM_IS_ZONES_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_ZONES_INTERFACE)) +#define NM_ZONES_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_ZONES_INTERFACE, NMZonesInterface)) + +#define NM_ZONES_INTERFACE_CONNECTION_ADDED "connection-added" +#define NM_ZONES_INTERFACE_CONNECTION_REMOVED "connection-removed" + +typedef struct _NMZonesInterface NMZonesInterface; + +struct _NMZonesInterface { + GTypeInterface g_iface; + + /* Signals */ + void (*connection_added) (NMZonesInterface *zones, + const char *iface_name, + const char *zone_name); + void (*connection_removed) (NMZonesInterface *zones, + const char *iface_name, + const char *zone_name); + +}; + +GType nm_zones_interface_get_type (void); + +#endif /* NM_ZONES_INTERFACE_H */ -- 1.7.6 _______________________________________________ networkmanager-list mailing list networkmanager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list