Module libvirt-nwfilter from libvirt

Provides APIs for the management of nwfilters

Table of Contents

Types

typedef struct _virNWFilter virNWFilter
typedef virNWFilter * virNWFilterPtr

Functions

int	virConnectListAllNWFilters	(virConnectPtr conn, 
virNWFilterPtr ** filters,
unsigned int flags) int virConnectListNWFilters (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectNumOfNWFilters (virConnectPtr conn) virNWFilterPtr virNWFilterDefineXML (virConnectPtr conn,
const char * xmlDesc) int virNWFilterFree (virNWFilterPtr nwfilter) const char * virNWFilterGetName (virNWFilterPtr nwfilter) int virNWFilterGetUUID (virNWFilterPtr nwfilter,
unsigned char * uuid) int virNWFilterGetUUIDString (virNWFilterPtr nwfilter,
char * buf) char * virNWFilterGetXMLDesc (virNWFilterPtr nwfilter,
unsigned int flags) virNWFilterPtr virNWFilterLookupByName (virConnectPtr conn,
const char * name) virNWFilterPtr virNWFilterLookupByUUID (virConnectPtr conn,
const unsigned char * uuid) virNWFilterPtr virNWFilterLookupByUUIDString (virConnectPtr conn,
const char * uuidstr) int virNWFilterRef (virNWFilterPtr nwfilter) int virNWFilterUndefine (virNWFilterPtr nwfilter)

Description

Types

virNWFilter

struct virNWFilter {
The content of this structure is not made public by the API
}

Functions

virConnectListAllNWFilters

int	virConnectListAllNWFilters	(virConnectPtr conn,
					 virNWFilterPtr ** filters,
					 unsigned int flags)

Collect the list of network filters, and allocate an array to store those objects.

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
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.

virConnectListNWFilters

int	virConnectListNWFilters		(virConnectPtr conn,
					 char ** const names,
					 int maxnames)

Collect the list of network filters, and store their names in @names

conn
pointer to the hypervisor connection
names
array to collect the list of names of network filters
maxnames
size of @names
Returns
the number of network filters found or -1 in case of error

virConnectNumOfNWFilters

int	virConnectNumOfNWFilters	(virConnectPtr conn)

Provides the number of nwfilters.

conn
pointer to the hypervisor connection
Returns
the number of nwfilters found or -1 in case of error

virNWFilterDefineXML

virNWFilterPtr	virNWFilterDefineXML	(virConnectPtr conn,
					 const char * xmlDesc)

Define a new network filter, based on an XML description similar to the one returned by virNWFilterGetXMLDesc()

virNWFilterFree should be used to free the resources after the nwfilter object is no longer needed.

conn
pointer to the hypervisor connection
xmlDesc
an XML description of the nwfilter
Returns
a new nwfilter object or NULL in case of failure

virNWFilterFree

int	virNWFilterFree			(virNWFilterPtr nwfilter)

Free the nwfilter object. The running instance is kept alive. The data structure is freed and should not be used thereafter.

nwfilter
a nwfilter object
Returns
0 in case of success and -1 in case of failure.

virNWFilterGetName

const char *	virNWFilterGetName	(virNWFilterPtr nwfilter)

Get the public name for the network filter

nwfilter
a nwfilter object
Returns
a pointer to the name or NULL, the string need not be deallocated its lifetime will be the same as the nwfilter object.

virNWFilterGetUUID

int	virNWFilterGetUUID		(virNWFilterPtr nwfilter,
					 unsigned char * uuid)

Get the UUID for a network filter

nwfilter
a nwfilter object
uuid
pointer to a VIR_UUID_BUFLEN bytes array
Returns
-1 in case of error, 0 in case of success

virNWFilterGetUUIDString

int	virNWFilterGetUUIDString	(virNWFilterPtr nwfilter,
					 char * buf)

Get the UUID for a network filter as string. For more information about UUID see RFC4122.

nwfilter
a nwfilter object
buf
pointer to a VIR_UUID_STRING_BUFLEN bytes array
Returns
-1 in case of error, 0 in case of success

virNWFilterGetXMLDesc

char *	virNWFilterGetXMLDesc		(virNWFilterPtr nwfilter,
					 unsigned int flags)

Provide an XML description of the network filter. The description may be reused later to redefine the network filter with virNWFilterCreateXML().

nwfilter
a nwfilter object
flags
extra flags; not used yet, so callers should always pass 0
Returns
a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.

virNWFilterLookupByName

virNWFilterPtr	virNWFilterLookupByName	(virConnectPtr conn,
					 const char * name)

Try to lookup a network filter on the given hypervisor based on its name.

virNWFilterFree should be used to free the resources after the nwfilter object is no longer needed.

conn
pointer to the hypervisor connection
name
name for the network filter
Returns
a new nwfilter object or NULL in case of failure. If the network filter cannot be found, then VIR_ERR_NO_NWFILTER error is raised.

virNWFilterLookupByUUID

virNWFilterPtr	virNWFilterLookupByUUID	(virConnectPtr conn,
					 const unsigned char * uuid)

Try to lookup a network filter on the given hypervisor based on its UUID.

virNWFilterFree should be used to free the resources after the nwfilter object is no longer needed.

conn
pointer to the hypervisor connection
uuid
the raw UUID for the network filter
Returns
a new nwfilter object or NULL in case of failure. If the nwfdilter cannot be found, then VIR_ERR_NO_NWFILTER error is raised.

virNWFilterLookupByUUIDString

virNWFilterPtr	virNWFilterLookupByUUIDString	(virConnectPtr conn,
						 const char * uuidstr)

Try to lookup an nwfilter on the given hypervisor based on its UUID.

virNWFilterFree should be used to free the resources after the nwfilter object is no longer needed.

conn
pointer to the hypervisor connection
uuidstr
the string UUID for the nwfilter
Returns
a new nwfilter object or NULL in case of failure. If the nwfilter cannot be found, then VIR_ERR_NO_NWFILTER error is raised.

virNWFilterRef

int	virNWFilterRef			(virNWFilterPtr nwfilter)

Increment the reference count on the nwfilter. For each additional call to this method, there shall be a corresponding call to virNWFilterFree to release the reference count, once the caller no longer needs the reference to this object.

This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using an nwfilter would increment the reference count.

nwfilter
the nwfilter to hold a reference on
Returns
0 in case of success, -1 in case of failure.

virNWFilterUndefine

int	virNWFilterUndefine		(virNWFilterPtr nwfilter)

Undefine the nwfilter object. This call will not succeed if a running VM is referencing the filter. This does not free the associated virNWFilterPtr object.

nwfilter
a nwfilter object
Returns
0 in case of success and -1 in case of failure.