Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.NWFilter.xml | 6 ++++++
src/nwfilter.c | 28 ++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/data/org.libvirt.NWFilter.xml b/data/org.libvirt.NWFilter.xml
index fae61dc..69e3357 100644
--- a/data/org.libvirt.NWFilter.xml
+++ b/data/org.libvirt.NWFilter.xml
@@ -13,5 +13,11 @@
value="See
https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterGetUUID...
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal"
value="const"/>
</property>
+ <method name="GetXMLDesc">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterGetXMLD...
+ <arg name="flags" type="u" direction="in"/>
+ <arg name="xml" type="s" direction="out"/>
+ </method>
</interface>
</node>
diff --git a/src/nwfilter.c b/src/nwfilter.c
index 90183a7..acfbdd5 100644
--- a/src/nwfilter.c
+++ b/src/nwfilter.c
@@ -65,6 +65,33 @@ virtDBusNWFilterGetUUID(const gchar *objectPath,
*value = g_variant_new("s", uuid);
}
+static void
+virtDBusNWFilterGetXMLDesc(GVariant *inArgs,
+ GUnixFDList *inFDs G_GNUC_UNUSED,
+ const gchar *objectPath,
+ gpointer userData,
+ GVariant **outArgs,
+ GUnixFDList **outFDs G_GNUC_UNUSED,
+ GError **error)
+{
+ virtDBusConnect *connect = userData;
+ g_autoptr(virNWFilter) nwfilter = NULL;
+ g_autofree gchar *xml = NULL;
+ guint flags;
+
+ g_variant_get(inArgs, "(u)", &flags);
+
+ nwfilter = virtDBusNWFilterGetVirNWFilter(connect, objectPath, error);
+ if (!nwfilter)
+ return;
+
+ xml = virNWFilterGetXMLDesc(nwfilter, flags);
+ if (!xml)
+ return virtDBusUtilSetLastVirtError(error);
+
+ *outArgs = g_variant_new("(s)", xml);
+}
+
static virtDBusGDBusPropertyTable virtDBusNWFilterPropertyTable[] = {
{ "Name", virtDBusNWFilterGetName, NULL },
{ "UUID", virtDBusNWFilterGetUUID, NULL },
@@ -72,6 +99,7 @@ static virtDBusGDBusPropertyTable virtDBusNWFilterPropertyTable[] = {
};
static virtDBusGDBusMethodTable virtDBusNWFilterMethodTable[] = {
+ { "GetXMLDesc", virtDBusNWFilterGetXMLDesc },
{ 0 }
};
--
2.15.0