[libvirt] [PATCH v7 1/4] net-dhcp-leases: Implement the public APIs
Peter Krempa
pkrempa at redhat.com
Tue Jun 24 12:18:32 UTC 2014
On 06/23/14 23:01, Nehal J Wani wrote:
> Introduce 3 new APIs, virNetworkGetDHCPLeases, virNetworkGetDHCPLeasesForMAC
> and virNetworkDHCPLeaseFree.
>
> * virNetworkGetDHCPLeases: returns the dhcp leases information for a given
> virtual network.
>
> For DHCPv4, the information returned:
> - Network Interface Name
> - Expiry Time
> - MAC address
> - IAID (NULL)
> - IPv4 address (with type and prefix)
> - Hostname (can be NULL)
> - Client ID (can be NULL)
>
> For DHCPv6, the information returned:
> - Network Interface Name
> - Expiry Time
> - MAC address
> - IAID (can be NULL, only in rare cases)
> - IPv6 address (with type and prefix)
> - Hostname (can be NULL)
> - Client DUID
>
> Note: @mac, @iaid, @ipaddr, @clientid are in ASCII form, not raw bytes.
> Note: @expirytime can 0, in case the lease is for infinite time.
>
> * virNetworkGetDHCPLeasesForMAC: returns the dhcp leases information for a
> given virtual network and specified MAC Address.
>
> * virNetworkDHCPLeaseFree: allows the upper layer application to free the
> network interface object conveniently.
>
> There is no support for flags, so user is expected to pass 0 for
> both the APIs.
>
> include/libvirt/libvirt.h.in:
> * Define virNetworkGetDHCPLeases
> * Define virNetworkGetDHCPLeasesForMAC
> * Define virNetworkDHCPLeaseFree
>
> src/driver.h:
> * Define networkGetDHCPLeases
> * Define networkGetDHCPLeasesForMAC
>
> src/libvirt.c:
> * Implement virNetworkGetDHCPLeases
> * Implement virNetworkGetDHCPLeasesForMAC
> * Implement virNetworkDHCPLeaseFree
>
> src/libvirt_public.syms:
> * Export the new symbols
>
> ---
> include/libvirt/libvirt.h.in | 34 ++++++++
> src/driver.h | 13 ++++
> src/libvirt.c | 179 +++++++++++++++++++++++++++++++++++++++++++
> src/libvirt_public.syms | 3 +
> 4 files changed, 229 insertions(+)
>
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index c83b20d..b3120e2 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -5162,6 +5162,40 @@ typedef enum {
> #endif
> } virNetworkEventID;
>
> +typedef enum {
> + VIR_IP_ADDR_TYPE_IPV4,
> + VIR_IP_ADDR_TYPE_IPV6,
> +
> +#ifdef VIR_ENUM_SENTINELS
> + VIR_IP_ADDR_TYPE_LAST
> +#endif
> +} virIPAddrType;
> +
> +typedef struct _virNetworkDHCPLease virNetworkDHCPLease;
> +typedef virNetworkDHCPLease *virNetworkDHCPLeasePtr;
> +struct _virNetworkDHCPLease {
> + char *interface; /* Network interface name */
"interface" is apparently a reserved identifier when building on mingw:
In file included from ../../src/internal.h:58:0,
from ../../src/datatypes.h:25,
from ../../src/datatypes.c:25:
../include/libvirt/libvirt.h:5177:11: error: expected identifier or '(' before 'struct'
char *interface; /* Network interface name */
^
In file included from ../../src/internal.h:58:0,
from ../../src/fdstream.h:26,
from ../../src/fdstream.c:36:
../include/libvirt/libvirt.h:5177:11: error: expected identifier or '(' before 'struct'
char *interface; /* Network interface name */
^
We should change that ASAP so that it doesn't break our API guarantee.
Peter
> + long long expirytime; /* Seconds since epoch */
> + int type; /* virIPAddrType */
> + char *mac; /* MAC address */
> + char *iaid; /* IAID */
> + char *ipaddr; /* IP address */
> + unsigned int prefix; /* IP address prefix */
> + char *hostname; /* Hostname */
> + char *clientid; /* Client ID or DUID */
> +};
> +
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140624/d02e083a/attachment-0001.sig>
More information about the libvir-list
mailing list