mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-26 03:21:44 +03:00
list: Define new API virConnectListAllNWFilters
This is to list the network filter objects. No flags are supported include/libvirt/libvirt.h.in: Declare enum virConnectListAllNWFilterFlags and virConnectListAllNWFilters. python/generator.py: Skip auto-generating src/driver.h: (virDrvConnectListAllNWFilters) src/libvirt.c: Implement the public API src/libvirt_public.syms: Export the symbol to public
This commit is contained in:
parent
aa20e97578
commit
6498f76e31
@ -4126,7 +4126,9 @@ int virConnectNumOfNWFilters (virConnectPtr conn);
|
||||
int virConnectListNWFilters (virConnectPtr conn,
|
||||
char **const names,
|
||||
int maxnames);
|
||||
|
||||
int virConnectListAllNWFilters(virConnectPtr conn,
|
||||
virNWFilterPtr **filters,
|
||||
unsigned int flags);
|
||||
/*
|
||||
* Lookup nwfilter by name or uuid
|
||||
*/
|
||||
|
@ -465,6 +465,7 @@ skip_function = (
|
||||
'virConnectListAllNetworks', # overridden in virConnect.py
|
||||
'virConnectListAllInterfaces', # overridden in virConnect.py
|
||||
'virConnectListAllNodeDevices', # overridden in virConnect.py
|
||||
'virConnectListAllNWFilters', # overridden in virConnect.py
|
||||
|
||||
'virStreamRecvAll', # Pure python libvirt-override-virStream.py
|
||||
'virStreamSendAll', # Pure python libvirt-override-virStream.py
|
||||
|
@ -1638,6 +1638,10 @@ typedef int
|
||||
(*virDrvConnectListNWFilters) (virConnectPtr conn,
|
||||
char **const names,
|
||||
int maxnames);
|
||||
typedef int
|
||||
(*virDrvConnectListAllNWFilters) (virConnectPtr conn,
|
||||
virNWFilterPtr **filters,
|
||||
unsigned int flags);
|
||||
typedef virNWFilterPtr
|
||||
(*virDrvNWFilterLookupByName) (virConnectPtr conn,
|
||||
const char *name);
|
||||
@ -1675,6 +1679,7 @@ struct _virNWFilterDriver {
|
||||
|
||||
virDrvConnectNumOfNWFilters numOfNWFilters;
|
||||
virDrvConnectListNWFilters listNWFilters;
|
||||
virDrvConnectListAllNWFilters listAllNWFilters;
|
||||
virDrvNWFilterLookupByName nwfilterLookupByName;
|
||||
virDrvNWFilterLookupByUUID nwfilterLookupByUUID;
|
||||
virDrvNWFilterDefineXML defineXML;
|
||||
|
@ -16165,6 +16165,56 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* virConnectListAllNWFilters:
|
||||
* @conn: Pointer to the hypervisor connection.
|
||||
* @filters: Pointer to a variable to store the array containing the network
|
||||
* filter objects or NULL if the list is not required (just returns
|
||||
* number of network filters).
|
||||
* @flags: extra flags; not used yet, so callers should always pass 0
|
||||
*
|
||||
* Collect the list of network filters, and allocate an array to store those
|
||||
* objects.
|
||||
*
|
||||
* Returns the number of network filters found or -1 and sets @filters to NULL
|
||||
* in case of error. On success, the array stored into @filters is guaranteed to
|
||||
* have an extra allocated element set to NULL but not included in the return count,
|
||||
* to make iteration easier. The caller is responsible for calling
|
||||
* virNWFilterFree() on each array element, then calling free() on @filters.
|
||||
*/
|
||||
int
|
||||
virConnectListAllNWFilters(virConnectPtr conn,
|
||||
virNWFilterPtr **filters,
|
||||
unsigned int flags)
|
||||
{
|
||||
VIR_DEBUG("conn=%p, filters=%p, flags=%x", conn, filters, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (filters)
|
||||
*filters = NULL;
|
||||
|
||||
if (!VIR_IS_CONNECT(conn)) {
|
||||
virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
|
||||
virDispatchError(NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (conn->nwfilterDriver &&
|
||||
conn->nwfilterDriver->listAllNWFilters) {
|
||||
int ret;
|
||||
ret = conn->nwfilterDriver->listAllNWFilters(conn, filters, flags);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
|
||||
error:
|
||||
virDispatchError(conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* virConnectListNWFilters:
|
||||
|
@ -559,6 +559,7 @@ LIBVIRT_0.10.2 {
|
||||
virConnectListAllInterfaces;
|
||||
virConnectListAllNetworks;
|
||||
virConnectListAllNodeDevices;
|
||||
virConnectListAllNWFilters;
|
||||
virConnectListAllStoragePools;
|
||||
virStoragePoolListAllVolumes;
|
||||
} LIBVIRT_0.10.0;
|
||||
|
Loading…
Reference in New Issue
Block a user