Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Connect.xml | 6 ++++++
src/connect.c | 29 +++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml
index a78a87d..c228c6d 100644
--- a/data/org.libvirt.Connect.xml
+++ b/data/org.libvirt.Connect.xml
@@ -195,6 +195,12 @@
<arg name="uuid" type="s" direction="in"/>
<arg name="network" type="o" direction="out"/>
</method>
+ <method name="NWFilterDefineXML">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterDefineX...
+ <arg name="xml" type="s" direction="in"/>
+ <arg name="nwfilter" type="o"
direction="out"/>
+ </method>
<method name="NodeGetCPUMap">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetCPUMap"...
diff --git a/src/connect.c b/src/connect.c
index ff1120e..8981f36 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -994,6 +994,34 @@ virtDBusConnectNetworkLookupByUUID(GVariant *inArgs,
*outArgs = g_variant_new("(o)", path);
}
+static void
+virtDBusConnectNWFilterDefineXML(GVariant *inArgs,
+ GUnixFDList *inFDs G_GNUC_UNUSED,
+ const gchar *objectPath G_GNUC_UNUSED,
+ gpointer userData,
+ GVariant **outArgs,
+ GUnixFDList **outFDs G_GNUC_UNUSED,
+ GError **error)
+{
+ virtDBusConnect *connect = userData;
+ g_autoptr(virNWFilter) nwfilter = NULL;
+ g_autofree gchar *path = NULL;
+ const gchar *xml;
+
+ g_variant_get(inArgs, "(&s)", &xml);
+
+ if (!virtDBusConnectOpen(connect, error))
+ return;
+
+ nwfilter = virNWFilterDefineXML(connect->connection, xml);
+ if (!nwfilter)
+ return virtDBusUtilSetLastVirtError(error);
+
+ path = virtDBusUtilBusPathForVirNWFilter(nwfilter, connect->nwfilterPath);
+
+ *outArgs = g_variant_new("(o)", path);
+}
+
static void
virtDBusConnectNodeGetCPUMap(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -1408,6 +1436,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = {
{ "NetworkDefineXML", virtDBusConnectNetworkDefineXML },
{ "NetworkLookupByName", virtDBusConnectNetworkLookupByName },
{ "NetworkLookupByUUID", virtDBusConnectNetworkLookupByUUID },
+ { "NWFilterDefineXML", virtDBusConnectNWFilterDefineXML },
{ "NodeGetCPUMap", virtDBusConnectNodeGetCPUMap },
{ "NodeGetCPUStats", virtDBusConnectNodeGetCPUStats },
{ "NodeGetFreeMemory", virtDBusConnectNodeGetFreeMemory },
--
2.15.0