Commit 0dc348de authored by Katerina Koukiou's avatar Katerina Koukiou

Implement GetXMLDesc method for NWFilter Interface

Signed-off-by: default avatarKaterina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Jano Tomko's avatarJán Tomko <jtomko@redhat.com>
parent 712e5ad7
......@@ -13,5 +13,11 @@
value="See https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterGetUUIDString"/>
<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#virNWFilterGetXMLDesc"/>
<arg name="flags" type="u" direction="in"/>
<arg name="xml" type="s" direction="out"/>
</method>
</interface>
</node>
......@@ -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 }
};
......
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