[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnulib] Re: inet_r, xinet
From: |
Simon Josefsson |
Subject: |
[Bug-gnulib] Re: inet_r, xinet |
Date: |
Fri, 17 Sep 2004 15:53:59 +0200 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) |
Bruno Haible <address@hidden> writes:
> Simon Josefsson wrote:
>> +char *inet_ntoa_r (struct in_addr in, char *buf);
>> +char *xinet_ntoa (struct in_addr in);
>
> Hi,
>
> I don't think we should, at this time, introduce new API that works only
> for IPv4 and doesn't work for other protocols like IPv6.
Makes sense. OTOH, my use of this was in a DNS resolver code for A
records, which are IPv4 specific. However...
> Can you rework this in such a way that the API becomes protocol independent
> (like the gethostbyaddr function is) and that the implementation supports
> IPv6?
>
> You can use the appended autoconf macros for detecting IPv4 and IPv6 support.
> Maybe you can also use the appended code from GNU clisp.
...when browsing around, I discovered POSIX has inet_ntop, a protocol
independent variant. It uses fixed size buffers, so a simple
xinet_ntop wrapper seem like a good solution here.
But I realized it would be easier for me to remove the DNS resolver A
record parser code from my package, since I'm using getaddrinfo for
addresses. I only needed the DNS parser for SRV records.
O well, these ideas are in the archives if someone wants to pursue it
in the future.
Thanks.