On Tue, Oct 15, 2013 at 12:05:02PM -0700, Ian Main wrote:
This patch adds support for setting filterref's on interfaces.
Also
supported are parameters to the filterref's.
This mostly looks good, some comments below.
Signed-off-by: Ian Main <imain(a)redhat.com>
---
examples/config-demo.py | 9 +-
libvirt-gconfig/Makefile.am | 4 +
...-gconfig-domain-interface-filterref-parameter.c | 101 ++++++++++++++
...-gconfig-domain-interface-filterref-parameter.h | 75 ++++++++++
.../libvirt-gconfig-domain-interface-filterref.c | 155 +++++++++++++++++++++
.../libvirt-gconfig-domain-interface-filterref.h | 76 ++++++++++
libvirt-gconfig/libvirt-gconfig-domain-interface.c | 41 ++++++
libvirt-gconfig/libvirt-gconfig-domain-interface.h | 5 +
libvirt-gconfig/libvirt-gconfig.h | 2 +
libvirt-gconfig/libvirt-gconfig.sym | 18 +++
10 files changed, 485 insertions(+), 1 deletion(-)
create mode 100644
libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.c
create mode 100644
libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.h
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h
diff --git a/examples/config-demo.py b/examples/config-demo.py
index 09b9e89..0566d66 100644
--- a/examples/config-demo.py
+++ b/examples/config-demo.py
@@ -28,13 +28,20 @@ disk.set_type(LibvirtGConfig.DomainDiskType.FILE)
disk.set_guest_device_type(LibvirtGConfig.DomainDiskGuestDeviceType.DISK)
disk.set_source("/tmp/foo/bar")
disk.set_driver_name("qemu")
-disk.set_driver_format(LibvirtGConfig.DriverType.QCOW2)
+disk.set_driver_format(LibvirtGConfig.DomainDiskFormat.QCOW2)
Can you split that one line change to a separate patch?
disk.set_target_bus(LibvirtGConfig.DomainDiskBus.IDE)
disk.set_target_dev("hda")
domain.add_device(disk)
interface = LibvirtGConfig.DomainInterfaceNetwork.new()
interface.set_source("default")
+filterref = LibvirtGConfig.DomainInterfaceFilterref.new()
+filterref.set_filter("clean-traffic")
+parameter = LibvirtGConfig.DomainInterfaceFilterrefParameter.new()
+parameter.set_name("IP")
+parameter.set_value("205.23.12.40")
+filterref.add_parameter(parameter)
+interface.set_filterref(filterref)
domain.add_device(interface)
interface = LibvirtGConfig.DomainInterfaceUser.new()
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 35dc978..48f0547 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -49,6 +49,8 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-domain-interface-bridge.h \
libvirt-gconfig-domain-interface-network.h \
libvirt-gconfig-domain-interface-user.h \
+ libvirt-gconfig-domain-interface-filterref.h \
+ libvirt-gconfig-domain-interface-filterref-parameter.h \
Can you move it right after -bridge.h so that it's alphabetically sorted?
libvirt-gconfig-domain-memballoon.h \
libvirt-gconfig-domain-os.h \
libvirt-gconfig-domain-parallel.h \
@@ -131,6 +133,8 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-domain-interface-bridge.c \
libvirt-gconfig-domain-interface-network.c \
libvirt-gconfig-domain-interface-user.c \
+ libvirt-gconfig-domain-interface-filterref.c \
+ libvirt-gconfig-domain-interface-filterref-parameter.c \
Same here.
libvirt-gconfig-domain-memballoon.c \
libvirt-gconfig-domain-os.c \
libvirt-gconfig-domain-parallel.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.c
b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.c
new file mode 100644
index 0000000..e697e86
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.c
@@ -0,0 +1,101 @@
+/*
+ * libvirt-gconfig-domain-interface-filterref-parameter.c:
+ * libvirt filterref parameters
+ *
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <
http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ian Main <imain(a)redhat.com>
+ * Daniel P. Berrange <berrange(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj),
GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER,
GVirConfigDomainInterfaceFilterrefParameterPrivate))
+
+struct _GVirConfigDomainInterfaceFilterrefParameterPrivate
+{
+ gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainInterfaceFilterrefParameter,
gvir_config_domain_interface_filterref_parameter, GVIR_CONFIG_TYPE_OBJECT);
+
+static void
gvir_config_domain_interface_filterref_parameter_class_init(GVirConfigDomainInterfaceFilterrefParameterClass
*klass)
+{
+ g_type_class_add_private(klass,
sizeof(GVirConfigDomainInterfaceFilterrefParameterPrivate));
+}
+
+static void
gvir_config_domain_interface_filterref_parameter_init(GVirConfigDomainInterfaceFilterrefParameter
*parameter)
+{
+ g_debug("Init GVirConfigDomainInterfaceFilterrefParameter=%p",
parameter);
+
+ parameter->priv =
GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_GET_PRIVATE(parameter);
+}
+
+GVirConfigDomainInterfaceFilterrefParameter
*gvir_config_domain_interface_filterref_parameter_new(void)
+{
+ GVirConfigObject *object;
+
+ object =
gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER,
+ "parameter", NULL);
+ return GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER(object);
+}
+
+GVirConfigDomainInterfaceFilterrefParameter *
+gvir_config_domain_interface_filterref_parameter_new_from_xml(const gchar *xml, GError
**error)
+{
+ GVirConfigObject *object;
+
+ object =
gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER,
+ "parameter",
+ NULL,
+ xml,
+ error);
+
+ return GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER(object);
+}
+
+void
gvir_config_domain_interface_filterref_parameter_set_name(GVirConfigDomainInterfaceFilterrefParameter
*parameter, const gchar *name)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_PARAMETER(parameter));
+ gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(parameter),
+ "name", name, NULL);
+}
+
+void
gvir_config_domain_interface_filterref_parameter_set_value(GVirConfigDomainInterfaceFilterrefParameter
*parameter, const gchar *value)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_PARAMETER(parameter));
+ gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(parameter),
+ "value", value, NULL);
+}
+
+const gchar
*gvir_config_domain_interface_filterref_parameter_get_name(GVirConfigDomainInterfaceFilterrefParameter
*parameter)
+{
+ return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(parameter),
+ NULL,
+ "name");
+}
+const gchar
*gvir_config_domain_interface_filterref_parameter_get_value(GVirConfigDomainInterfaceFilterrefParameter
*parameter)
+{
+ return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(parameter),
+ NULL,
+ "value");
+}
+
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.h
b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.h
new file mode 100644
index 0000000..a768c84
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.h
@@ -0,0 +1,75 @@
+/*
+ * libvirt-gconfig-domain-interface-filterref-parameter.h:
+ * libvirt filterref parameters
+ *
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <
http://www.gnu.org/licenses/>.
+ *
+ * Authors: Ian Main <imain(a)redhat.com>
+ * Daniel P. Berrange <berrange(a)redhat.com>
+ */
+
+#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD)
+#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included
directly."
+#endif
+
+#ifndef __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER
(gvir_config_domain_interface_filterref_parameter_get_type ())
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER(obj)
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER,
GVirConfigDomainInterfaceFilterrefParameter))
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_CLASS(klass)
(G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER,
GVirConfigDomainInterfaceFilterrefParameterClass))
+#define GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_PARAMETER(obj)
(G_TYPE_CHECK_INSTANCE_TYPE ((obj),
GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER))
+#define GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_PARAMETER_CLASS(klass)
(G_TYPE_CHECK_CLASS_TYPE ((klass),
GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER))
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_GET_CLASS(obj)
(G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER,
GVirConfigDomainInterfaceFilterrefParameterClass))
+
+typedef struct _GVirConfigDomainInterfaceFilterrefParameter
GVirConfigDomainInterfaceFilterrefParameter;
+typedef struct _GVirConfigDomainInterfaceFilterrefParameterPrivate
GVirConfigDomainInterfaceFilterrefParameterPrivate;
+typedef struct _GVirConfigDomainInterfaceFilterrefParameterClass
GVirConfigDomainInterfaceFilterrefParameterClass;
+
+struct _GVirConfigDomainInterfaceFilterrefParameter
+{
+ GVirConfigObject parent;
+
+ GVirConfigDomainInterfaceFilterrefParameterPrivate *priv;
+
+ /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainInterfaceFilterrefParameterClass
+{
+ GVirConfigObjectClass parent_class;
+
+ gpointer padding[20];
+};
+
+GType gvir_config_domain_interface_filterref_parameter_get_type(void);
+
+GVirConfigDomainInterfaceFilterrefParameter
*gvir_config_domain_interface_filterref_parameter_new(void);
+
+GVirConfigDomainInterfaceFilterrefParameter *
+gvir_config_domain_interface_filterref_parameter_new_from_xml(const gchar *xml, GError
**error);
+
+void
gvir_config_domain_interface_filterref_parameter_set_name(GVirConfigDomainInterfaceFilterrefParameter
*parameter, const gchar *name);
+void
gvir_config_domain_interface_filterref_parameter_set_value(GVirConfigDomainInterfaceFilterrefParameter
*parameter, const gchar *value);
+const gchar
*gvir_config_domain_interface_filterref_parameter_get_name(GVirConfigDomainInterfaceFilterrefParameter
*parameter);
+const gchar
*gvir_config_domain_interface_filterref_parameter_get_value(GVirConfigDomainInterfaceFilterrefParameter
*parameter);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_FILTERREF_PARAMETER_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.c
b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.c
new file mode 100644
index 0000000..cc8b246
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.c
@@ -0,0 +1,155 @@
+/*
+ * libvirt-gconfig-domain-interface-network-filterref.c:
Nit: there's a trailing space at the end of this line
+ * libvirt filter reference config.
+ *
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <
http://www.gnu.org/licenses/>.
+ *
+ * Author: Ian Main <imain(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_GET_PRIVATE(obj)
\
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF,
GVirConfigDomainInterfaceFilterrefPrivate))
+
+struct _GVirConfigDomainInterfaceFilterrefPrivate
+{
+ gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainInterfaceFilterref,
gvir_config_domain_interface_filterref, GVIR_CONFIG_TYPE_OBJECT);
+
+static void
gvir_config_domain_interface_filterref_class_init(GVirConfigDomainInterfaceFilterrefClass
*klass)
+{
+ g_type_class_add_private(klass, sizeof(GVirConfigDomainInterfaceFilterrefPrivate));
+}
+
+static void
gvir_config_domain_interface_filterref_init(GVirConfigDomainInterfaceFilterref
*filterref)
+{
+ g_debug("Init GVirConfigDomainInterfaceFilterref=%p", filterref);
+
+ filterref->priv = GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_GET_PRIVATE(filterref);
+}
+
+
+GVirConfigDomainInterfaceFilterref *gvir_config_domain_interface_filterref_new(void)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF,
+ "filterref", NULL);
+ return GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF(object);
+}
+
+GVirConfigDomainInterfaceFilterref
*gvir_config_domain_interface_filterref_new_from_xml(const gchar *xml,
+
GError **error)
+{
+ GVirConfigObject *object;
+
+ object =
gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF,
+ "filterref", NULL, xml, error);
+ if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"),
"filterref") != 0) {
Is this test correct? I don't see a 'type' attribute on 'filterref'
nodes
in
http://libvirt.org/formatnwfilter.html
+ g_object_unref(G_OBJECT(object));
+ return NULL;
+ }
+ return GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF(object);
+}
+
+void
gvir_config_domain_interface_filterref_set_filter(GVirConfigDomainInterfaceFilterref
*filterref,
+ const char *filter)
I'm wondering if we should call that method
gvir_config_domain_interface_filterref_set_filter_name()
so that in the future we can have
gvir_config_domain_interface_filterref_set_filter(GVirConfigDomainInterfaceFilterref
*ref,
GVirConfigNwFilter *filter);
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(filterref));
+
+ gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(filterref),
+ "filter", filter, NULL);
+}
+
+const char
*gvir_config_domain_interface_filterref_get_filter(GVirConfigDomainInterfaceFilterref
*filterref)
+{
I'd add a
g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(filterref), NULL);
here.
+ return
gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(filterref),
+ NULL,
+ "filter");
+}
+
+void
gvir_config_domain_interface_filterref_add_parameter(GVirConfigDomainInterfaceFilterref
*filterref,
+
GVirConfigDomainInterfaceFilterrefParameter *parameter)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(filterref));
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_PARAMETER(parameter));
+
+ gvir_config_object_attach_add(GVIR_CONFIG_OBJECT(filterref),
+ GVIR_CONFIG_OBJECT(parameter));
+}
+
+struct GetParameterData {
+ GVirConfigXmlDoc *doc;
+ GList *parameters;
+};
+
+
+static gboolean add_filterref_parameter(xmlNodePtr node, gpointer opaque)
+{
+ struct GetParameterData* data = (struct GetParameterData*)opaque;
+ GVirConfigObject *parameter;
+
+ if (g_strcmp0((const gchar *)node->name, "parameter") != 0)
+ return TRUE;
+
+ parameter =
gvir_config_object_new_from_tree(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF_PARAMETER,
A few lines are missing here, this does not compile :(
+ if (parameter != NULL)
+ data->parameters = g_list_append(data->parameters, parameter);
+ else
+ g_debug("Failed to parse %s node", node->name);
+
+ return TRUE;
+}
+
+/**
+ * gvir_config_domain_interface_filterref_get_parameters:
+ * @filterref: a #GVirConfigDomainInterfaceFilterref
+ *
+ * Gets the list of parameters attached to @filterref. The returned list should be
+ * freed with g_list_free(), after its elements have been unreffed with
+ * g_object_unref().
+ *
+ * Returns: (element-type LibvirtGConfig.DomainInterfaceFilterrefParameter) (transfer
full):
+ * a newly allocated #GList of #GVirConfigDomainInterfaceFilterrefParameter.
+ */
+GList
*gvir_config_domain_interface_filterref_get_parameters(GVirConfigDomainInterfaceFilterref
*filterref)
+{
+ struct GetParameterData data;
+
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(filterref), NULL);
+
+ g_object_get(G_OBJECT(filterref), "doc", &data.doc, NULL);
+ data.parameters = NULL;
+
+ gvir_config_object_foreach_child(GVIR_CONFIG_OBJECT(filterref),
+ NULL,
+ add_filterref_parameter,
+ &data);
+
+ if (data.doc != NULL) {
+ g_object_unref(G_OBJECT(data.doc));
+ }
+
+ return data.parameters;
+}
+
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h
b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h
new file mode 100644
index 0000000..ee785c2
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h
@@ -0,0 +1,76 @@
+/*
+ * libvirt-gconfig-domain-interface-network-filterref.h: libvirt filter reference
config
+ *
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <
http://www.gnu.org/licenses/>.
+ *
+ * Author: Ian Main <imain(a)redhat.com>
+ */
+
+#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD)
+#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included
directly."
+#endif
+
+#ifndef __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_FILTERREF_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_FILTERREF_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF
(gvir_config_domain_interface_filterref_get_type ())
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF(obj)
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF,
GVirConfigDomainInterfaceFilterref))
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST
((klass), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF,
GVirConfigDomainInterfaceFilterrefClass))
+#define GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(obj)
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF))
+#define GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE
((klass), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF))
+#define GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF_GET_CLASS(obj)
(G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF,
GVirConfigDomainInterfaceFilterrefClass))
+
+typedef struct _GVirConfigDomainInterfaceFilterref GVirConfigDomainInterfaceFilterref;
+typedef struct _GVirConfigDomainInterfaceFilterrefPrivate
GVirConfigDomainInterfaceFilterrefPrivate;
+typedef struct _GVirConfigDomainInterfaceFilterrefClass
GVirConfigDomainInterfaceFilterrefClass;
+
+struct _GVirConfigDomainInterfaceFilterref
+{
+ GVirConfigObject parent;
+
+ GVirConfigDomainInterfaceFilterrefPrivate *priv;
+
+ /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainInterfaceFilterrefClass
+{
+ GVirConfigObjectClass parent_class;
+
+ gpointer padding[20];
+};
+
+GType gvir_config_domain_interface_filterref_get_type(void);
+
+GVirConfigDomainInterfaceFilterref *gvir_config_domain_interface_filterref_new(void);
+
+GVirConfigDomainInterfaceFilterref *
+gvir_config_domain_interface_filterref_new_from_xml(const gchar *xml, GError **error);
+
+void
gvir_config_domain_interface_filterref_set_filter(GVirConfigDomainInterfaceFilterref
*filterref,
+ const char *filter);
+const char
*gvir_config_domain_interface_filterref_get_filter(GVirConfigDomainInterfaceFilterref
*filterref);
+
+void
gvir_config_domain_interface_filterref_add_parameter(GVirConfigDomainInterfaceFilterref
*filterref,
+
GVirConfigDomainInterfaceFilterrefParameter *parameter);
+GList
*gvir_config_domain_interface_filterref_get_parameters(GVirConfigDomainInterfaceFilterref
*filterref);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_FILTERREF_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface.c
b/libvirt-gconfig/libvirt-gconfig-domain-interface.c
index 86a0c34..ce1b3f0 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-interface.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface.c
@@ -131,6 +131,47 @@ const char
*gvir_config_domain_interface_get_model(GVirConfigDomainInterface *in
"model", "type");
}
+/**
+ * gvir_config_domain_interface_set_filterref:
+ * @interface: a #GVirConfigDomainInterface
+ * @filterref: (allow-none): the filterref to set
+ */
+void gvir_config_domain_interface_set_filterref(GVirConfigDomainInterface *interface,
+ GVirConfigDomainInterfaceFilterref
*filterref)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE(interface));
+ g_return_if_fail(filterref == NULL ||
GVIR_CONFIG_IS_DOMAIN_INTERFACE_FILTERREF(filterref));
+
+ gvir_config_object_attach_replace(GVIR_CONFIG_OBJECT(interface),
+ "filterref",
+ GVIR_CONFIG_OBJECT(filterref));
+}
+
+/**
+ * gvir_config_domain_interface_get_filterref:
+ * @interface: a #GVirConfigDomainInterface
+ *
+ * Gets the filterref associated with the @interface
+ *
+ * Returns: (transfer full): A #GVirConfigDomainInterfaceFilterref. The returned
+ * object should be unreffed with g_object_unref() when no longer needed.
+ */
+
+GVirConfigDomainInterfaceFilterref
*gvir_config_domain_interface_get_filterref(GVirConfigDomainInterface *interface)
+{
+ GVirConfigObject *object;
+
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE(interface), NULL);
+
+ object = gvir_config_object_get_child_with_type
+ (GVIR_CONFIG_OBJECT(interface),
+ "filterref",
+ GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_FILTERREF);
+
+ return GVIR_CONFIG_DOMAIN_INTERFACE_FILTERREF(object);
+}
+
+
G_GNUC_INTERNAL GVirConfigDomainDevice *
gvir_config_domain_interface_new_from_tree(GVirConfigXmlDoc *doc,
xmlNodePtr tree)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface.h
b/libvirt-gconfig/libvirt-gconfig-domain-interface.h
index 65c5d0b..2b0c22f 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-interface.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface.h
@@ -27,6 +27,8 @@
#ifndef __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_H__
#define __LIBVIRT_GCONFIG_DOMAIN_INTERFACE_H__
+#include <libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h>
+
G_BEGIN_DECLS
#define GVIR_CONFIG_TYPE_DOMAIN_INTERFACE
(gvir_config_domain_interface_get_type ())
@@ -76,6 +78,9 @@ const char
*gvir_config_domain_interface_get_ifname(GVirConfigDomainInterface *i
GVirConfigDomainInterfaceLinkState
gvir_config_domain_interface_get_link_state(GVirConfigDomainInterface *interface);
const char *gvir_config_domain_interface_get_mac(GVirConfigDomainInterface *interface);
const char *gvir_config_domain_interface_get_model(GVirConfigDomainInterface
*interface);
+void gvir_config_domain_interface_set_filterref(GVirConfigDomainInterface *interface,
+ GVirConfigDomainInterfaceFilterref
*filterref);
+GVirConfigDomainInterfaceFilterref
*gvir_config_domain_interface_get_filterref(GVirConfigDomainInterface *interface);
G_END_DECLS
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 03e8ce7..14386b9 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -62,6 +62,8 @@
#include <libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-input.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-interface-filterref-parameter.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-interface.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-interface-bridge.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-interface-network.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 72eafc1..5065047 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -608,6 +608,24 @@ global:
gvir_config_domain_graphics_rdp_set_replace_user;
gvir_config_object_new_from_xml;
+
+ gvir_config_domain_interface_set_filterref;
+ gvir_config_domain_interface_get_filterref;
+
+ gvir_config_domain_interface_filterref_get_type;
+ gvir_config_domain_interface_filterref_new;
+ gvir_config_domain_interface_filterref_new_from_xml;
+ gvir_config_domain_interface_filterref_set_filter;
+ gvir_config_domain_interface_filterref_get_filter;
+ gvir_config_domain_interface_filterref_add_parameter;
+ gvir_config_domain_interface_filterref_get_parameters;
+ gvir_config_domain_interface_filterref_parameter_get_type;
+ gvir_config_domain_interface_filterref_parameter_new;
+ gvir_config_domain_interface_filterref_parameter_new_from_xml;
+ gvir_config_domain_interface_filterref_parameter_set_name;
+ gvir_config_domain_interface_filterref_parameter_set_value;
+ gvir_config_domain_interface_filterref_parameter_get_name;
+ gvir_config_domain_interface_filterref_parameter_get_value;
} LIBVIRT_GCONFIG_0.1.7;
# .... define new API here using predicted next version number ....
--
1.8.1.4
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list