[SSSD] RFC: a substitute for the hostent structure
Stephen Gallagher
sgallagh at redhat.com
Mon May 23 12:15:01 UTC 2011
On Thu, 2011-05-19 at 12:46 +0200, Jakub Hrozek wrote:
> I've been working on extending our resolver code to honour TTL lately.
> One of the problems I'm solving is the data structure we pass from our
> resolver abstraction over c-ares to the failover code.
>
> Currently, the code uses "struct hostent". This is not practical as
> hostent does not store TTL.
>
> My current version of the patch uses a "struct resolv_hostent" quite
> similar to hostent, but the address itself is stored in:
>
> --------
> struct resolv_in_addr {
> struct in_addr ipaddr;
> int ttl;
> };
>
> struct resolv_in6_addr {
> struct in6_addr ipaddr;
> int ttl;
> };
>
> union resolv_addr {
> struct resolv_in_addr v4_addr;
> struct resolv_in6_addr v6_addr;
> };
> --------
>
> I was also considering using "struct sockaddr_storage" because that is
> defined in system headers and some sources[1] recommend it, but I also
> think that semantics of sockaddr structures is more tied to connecting
> to a socket than just pure resolving. So right now I prefer the
> resolv_addr union, but I would like to hear other opinions before moving
> on with the patch.
I think I'm inclined to prefer the resolv_addr union as well here. In
general I'd rather see us using data types that fit our needs closely.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20110523/190b1c03/attachment.sig>
More information about the sssd-devel
mailing list