Provides APIs for the management of nwfilters
typedef struct _virNWFilter virNWFilter typedef struct _virNWFilterBinding virNWFilterBinding typedef enum virNWFilterBindingCreateFlags typedef virNWFilterBinding * virNWFilterBindingPtr typedef enum virNWFilterDefineFlags typedef virNWFilter * virNWFilterPtr
int virConnectListAllNWFilterBindings (virConnectPtr conn,
virNWFilterBindingPtr ** bindings,
unsigned int flags) int virConnectListAllNWFilters (virConnectPtr conn,
virNWFilterPtr ** filters,
unsigned int flags) int virConnectListNWFilters (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectNumOfNWFilters (virConnectPtr conn) virNWFilterBindingPtr virNWFilterBindingCreateXML (virConnectPtr conn,
const char * xml,
unsigned int flags) int virNWFilterBindingDelete (virNWFilterBindingPtr binding) int virNWFilterBindingFree (virNWFilterBindingPtr binding) const char * virNWFilterBindingGetFilterName (virNWFilterBindingPtr binding) const char * virNWFilterBindingGetPortDev (virNWFilterBindingPtr binding) char * virNWFilterBindingGetXMLDesc (virNWFilterBindingPtr binding,
unsigned int flags) virNWFilterBindingPtr virNWFilterBindingLookupByPortDev (virConnectPtr conn,
const char * portdev) int virNWFilterBindingRef (virNWFilterBindingPtr binding) virNWFilterPtr virNWFilterDefineXML (virConnectPtr conn,
const char * xmlDesc) virNWFilterPtr virNWFilterDefineXMLFlags (virConnectPtr conn,
const char * xmlDesc,
unsigned int flags) 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)
virNWFilter
¶struct virNWFilter {
}
virNWFilterBinding
¶struct virNWFilterBinding {
}
virNWFilterBindingCreateFlags
¶enum virNWFilterBindingCreateFlags {
VIR_NWFILTER_BINDING_CREATE_VALIDATE | = | 1 (0x1; 1 << 0) | Validate the XML document against schema |
}
virNWFilterBindingPtr
¶typedef virNWFilterBinding * virNWFilterBindingPtr;
a virNWFilterBindingPtr is pointer to a virNWFilterBinding private structure, this is the type used to reference a network filter port binding in the API.
virNWFilterDefineFlags
¶enum virNWFilterDefineFlags {
VIR_NWFILTER_DEFINE_VALIDATE | = | 1 (0x1; 1 << 0) | Validate the XML document against schema |
}
virNWFilterPtr
¶typedef virNWFilter * virNWFilterPtr;
a virNWFilterPtr is pointer to a virNWFilter private structure, this is the type used to reference a network filter in the API.
virConnectListAllNWFilterBindings
¶int virConnectListAllNWFilterBindings (virConnectPtr conn, virNWFilterBindingPtr ** bindings, unsigned int flags)
Collect the list of network filters, and allocate an array to store those objects.
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
.Object | Permission | Condition |
---|---|---|
connect | search-nwfilter-bindings | - |
Object | Permission |
---|---|
nwfilter-binding | getattr |
virConnectListAllNWFilters
¶int virConnectListAllNWFilters (virConnectPtr conn, virNWFilterPtr ** filters, unsigned int flags)
Collect the list of network filters, and allocate an array to store those objects.
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
.Object | Permission | Condition |
---|---|---|
connect | search-nwfilters | - |
Object | Permission |
---|---|
nwfilter | getattr |
virConnectListNWFilters
¶int virConnectListNWFilters (virConnectPtr conn, char ** const names, int maxnames)
Collect the list of network filters, and store their names in names
The use of this function is discouraged. Instead, use virConnectListAllNWFilters().
names
Object | Permission | Condition |
---|---|---|
connect | search-nwfilters | - |
Object | Permission |
---|---|
nwfilter | getattr |
virConnectNumOfNWFilters
¶int virConnectNumOfNWFilters (virConnectPtr conn)
Provides the number of nwfilters.
Object | Permission | Condition |
---|---|---|
connect | search-nwfilters | - |
Object | Permission |
---|---|
nwfilter | getattr |
virNWFilterBindingCreateXML
¶virNWFilterBindingPtr virNWFilterBindingCreateXML (virConnectPtr conn, const char * xml, unsigned int flags)
Define a new network filter, based on an XML description similar to the one returned by virNWFilterGetXMLDesc(). This API may be used to associate a filter with a currently running guest that does not have a filter defined for a specific network port. Since the bindings are generally automatically managed by the hypervisor, using this command to define a filter for a network port and then starting the guest afterwards may prevent the guest from starting if it attempts to use the network port and finds a filter already defined.
virNWFilterFree should be used to free the resources after the binding object is no longer needed.
Object | Permission | Condition |
---|---|---|
nwfilter-binding | create | - |
virNWFilterBindingDelete
¶int virNWFilterBindingDelete (virNWFilterBindingPtr binding)
Delete the binding object. This does not free the associated virNWFilterBindingPtr object. This API may be used to remove the network port binding filter currently in use for the guest while the guest is running without needing to restart the guest. Restoring the network port binding filter for the running guest would be accomplished by using virNWFilterBindingCreateXML.
Object | Permission | Condition |
---|---|---|
nwfilter-binding | delete | - |
virNWFilterBindingFree
¶int virNWFilterBindingFree (virNWFilterBindingPtr binding)
Free the binding object. The running instance is kept alive. The data structure is freed and should not be used thereafter.
virNWFilterBindingGetFilterName
¶const char * virNWFilterBindingGetFilterName (virNWFilterBindingPtr binding)
Get the filter name for the network filter binding
virNWFilterBindingGetPortDev
¶const char * virNWFilterBindingGetPortDev (virNWFilterBindingPtr binding)
Get the port dev name for the network filter binding
virNWFilterBindingGetXMLDesc
¶char * virNWFilterBindingGetXMLDesc (virNWFilterBindingPtr binding, unsigned int flags)
Provide an XML description of the network filter. The description may be reused later to redefine the network filter with virNWFilterCreateXML().
Object | Permission | Condition |
---|---|---|
nwfilter-binding | read | - |
virNWFilterBindingLookupByPortDev
¶virNWFilterBindingPtr virNWFilterBindingLookupByPortDev (virConnectPtr conn, const char * portdev)
Try to lookup a network filter binding on the given hypervisor based on network port device name.
virNWFilterBindingFree should be used to free the resources after the binding object is no longer needed.
Object | Permission | Condition |
---|---|---|
nwfilter-binding | getattr | - |
virNWFilterBindingRef
¶int virNWFilterBindingRef (virNWFilterBindingPtr binding)
Increment the reference count on the binding. 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 binding would increment the reference count.
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.
virNWFilterDefineXMLFlags
¶virNWFilterPtr virNWFilterDefineXMLFlags (virConnectPtr conn, const char * xmlDesc, unsigned int flags)
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.
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.
virNWFilterGetName
¶const char * virNWFilterGetName (virNWFilterPtr nwfilter)
Get the public name for the network filter
virNWFilterGetUUID
¶int virNWFilterGetUUID (virNWFilterPtr nwfilter, unsigned char * uuid)
Get the UUID for a network filter
virNWFilterGetUUIDString
¶int virNWFilterGetUUIDString (virNWFilterPtr nwfilter, char * buf)
Get the UUID for a network filter as string. For more information about UUID see RFC4122.
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().
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.
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.
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.
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.
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.