[libvirt] [PATCH 1/5] Public API for new virInterface* functions, which facilitate

Daniel P. Berrange berrange at redhat.com
Mon May 11 10:29:56 UTC 2009


On Fri, May 08, 2009 at 01:52:23PM -0400, Laine Stump wrote:
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 2f7076f..cee3d94 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -854,6 +854,90 @@ int                     virNetworkGetAutostart  (virNetworkPtr network,
>  int                     virNetworkSetAutostart  (virNetworkPtr network,
>                                                   int autostart);
>  
> +/*
> + * Physical host interface configuration API
> + */
> +
> +/**
> + * virInterface:
> + *
> + * a virInterface is a private structure representing a virtual interface.
> + */
> +typedef struct _virInterface virInterface;
> +
> +/**
> + * virInterfacePtr:
> + *
> + * a virInterfacePtr is pointer to a virInterface private structure, this is the
> + * type used to reference a virtual interface in the API.
> + */
> +typedef virInterface *virInterfacePtr;
> +
> +/*
> + * Get connection from interface.
> + */
> +virConnectPtr           virInterfaceGetConnect    (virInterfacePtr interface);
> +
> +/*
> + * List defined interfaces
> + */
> +int                     virConnectNumOfInterfaces (virConnectPtr conn);
> +int                     virConnectListInterfaces  (virConnectPtr conn,
> +                                                   char **const names,
> +                                                   int maxnames);
> +
> +/*
> + * Lookup interface by name or MAC address
> + */
> +virInterfacePtr         virInterfaceLookupByName  (virConnectPtr conn,
> +                                                   const char *name);
> +virInterfacePtr         virInterfaceLookupByMAC   (virConnectPtr conn,
> +                                                   const unsigned char *mac);
> +virInterfacePtr         virInterfaceLookupByMACString (virConnectPtr conn,
> +                                                       const char *mac);
> +
> +/*
> + * Interface information
> + */
> +const char*             virInterfaceGetName       (virInterfacePtr interface);
> +int                     virInterfaceGetMAC        (virInterfacePtr interface,
> +                                                   unsigned char *mac);
> +int                     virInterfaceGetMACString  (virInterfacePtr interface,
> +                                                   char *mac);
> +
> +char *                  virInterfaceGetXMLDesc    (virInterfacePtr interface,
> +                                                   int flags);
> +/*
> + * Define interface (or modify existing interface configuration)
> + */
> +virInterfacePtr         virInterfaceDefineXML     (virConnectPtr conn,
> +                                                   const char *xmlDesc,
> +                                                   int flags);
> +
> +/*
> + * Delete interface
> + */
> +int                     virInterfaceUndefine      (virInterfacePtr interface);
> +
> +/*
> + * Activate interface (ie call "ifup")
> + */
> +int                     virInterfaceCreate        (virInterfacePtr interface,
> +                                                   int flags);
> +
> +/*
> + * De-activate interface (call "ifdown")
> + */
> +int                     virInterfaceDestroy       (virInterfacePtr interface,
> +                                                   int flags);
> +
> +/*
> + * interface object memory management - you must call
> + * virInterfaceFree() once for each call to virInterfaceRef, or any
> + * API function that returns a virInterfacePtr.
> + */
> +int                     virInterfaceRef           (virInterfacePtr interface);
> +int                     virInterfaceFree          (virInterfacePtr interface);
>  
>  /**
>   * virStoragePool:


ACK, looks OK to me. BTW, there's no need for the comments in the
header, as the src/libvirt.c file contains formal docs for each API
that are then put in website & in generated API docs

Regards
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list