Re: [PATCH v7 1/4] net-dhcp-leases: Implement the public APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 */
> +};
> +


Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]