Commit eeb5adc4 authored by Katerina Koukiou's avatar Katerina Koukiou

Implement ListNWFilters method for Connect Interface

Signed-off-by: default avatarKaterina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Jano Tomko's avatarJán Tomko <jtomko@redhat.com>
parent 7e7949c0
......@@ -160,6 +160,12 @@
<arg name="flags" type="u" direction="in"/>
<arg name="networks" type="ao" direction="out"/>
</method>
<method name="ListNWFilters">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virConnectListAllNWFilters"/>
<arg name="flags" type="u" direction="in"/>
<arg name="nwfilters" type="ao" direction="out"/>
</method>
<method name="ListSecrets">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-secret.html#virConnectListAllSecrets"/>
......
......@@ -796,6 +796,43 @@ virtDBusConnectListNetworks(GVariant *inArgs,
*outArgs = g_variant_new_tuple(&gnetworks, 1);
}
static void
virtDBusConnectListNWFilters(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(virNWFilterPtr) nwfilters = NULL;
guint flags;
GVariantBuilder builder;
GVariant *gnwfilters;
g_variant_get(inArgs, "(u)", &flags);
if (!virtDBusConnectOpen(connect, error))
return;
if (virConnectListAllNWFilters(connect->connection, &nwfilters, flags) < 0)
return virtDBusUtilSetLastVirtError(error);
g_variant_builder_init(&builder, G_VARIANT_TYPE("ao"));
for (gint i = 0; nwfilters[i]; i++) {
g_autofree gchar *path = NULL;
path = virtDBusUtilBusPathForVirNWFilter(nwfilters[i],
connect->nwfilterPath);
g_variant_builder_add(&builder, "o", path);
}
gnwfilters = g_variant_builder_end(&builder);
*outArgs = g_variant_new_tuple(&gnwfilters, 1);
}
static void
virtDBusConnectListSecrets(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,
......@@ -1451,6 +1488,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = {
{ "GetSysinfo", virtDBusConnectGetSysinfo },
{ "ListDomains", virtDBusConnectListDomains },
{ "ListNetworks", virtDBusConnectListNetworks },
{ "ListNWFilters", virtDBusConnectListNWFilters },
{ "ListSecrets", virtDBusConnectListSecrets },
{ "ListStoragePools", virtDBusConnectListStoragePools },
{ "NetworkCreateXML", virtDBusConnectNetworkCreateXML },
......
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