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

Re: [Libvir] 1/4 Additions to the public API



On Thu, Feb 21, 2008 at 05:13:51PM -0500, Daniel Veillard wrote:
> On Thu, Feb 21, 2008 at 08:56:17PM +0000, Richard W.M. Jones wrote:
> > This just adds the four new functions to the public API.
> [...]
> > +/**
> > + * virNetworkDHCPHostMapping:
> > + *
> > + * hostname mappings are returned by virNetworkListDHCPHostMapping.
> > + */
> > +typedef struct _virNetworkDHCPHostMapping {
> > +  char *hwaddr;
> > +  char *ipaddr;
> > +  char *hostname;
> > +} virNetworkDHCPHostMapping;
> > +
> > +typedef virNetworkDHCPHostMapping *virNetworkDHCPHostMappingPtr;
> > +
> [...]
> > +int                     virNetworkListDHCPHostMappings
> > +                                                (virNetworkPtr network,
> > +				  virNetworkDHCPHostMappingPtr *const mappings,
> > +			          int maxmappings);
> > +int                     virNetworkFreeDHCPHostMappings
> > +                                 (virNetworkDHCPHostMappingPtr *const mappings,
> > +			          int maxmappings);
> 
>   Hum, do we really need to expose this structure at the API level, since we
> use it only for listing. Since everything is provided as strings why not 
> use something like
> 
>      int virNetworkListDHCPHostMappings (virNetworkPtr network,
>                                          int maxmappings,
>                                          char **hwaddrtab,
> 					 char **ipaddrtab,
> 					 char **hostnametab);
> 
>   This also avoids the free function too, same functionality, quite a simpler
> interface.

Simpler for who ? Apps using this data now have to pass around a whole
bunch of pointers, instead of a single virNetworkDHCPHostMapping. When 
you map this API into higher level languages a struct is also going to be
a much nicer thing to represent. 

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 


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