[libvirt] [PATCH v7 1/4] net-dhcp-leases: Implement the public APIs
Daniel P. Berrange
berrange at redhat.com
Tue Jun 24 12:25:03 UTC 2014
On Tue, Jun 24, 2014 at 02:18:32PM +0200, Peter Krempa wrote:
> 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.
Yep, I'm pushing a change to rename it to 'iface'.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list