libs6dns
s6-dns
Software
skarnet.org
The following functions are declared in the s6-dns/s6dns-ip46.h header, and implemented as macros.
s6dns_ip46 is the transport abstraction layer. It allows the functions declared in s6-dns/s6dns-engine.h and s6-dns/s6dns-rci.h to be transport-agnostic, i.e. to be able to work with both IPv4 and IPv6.
If the underlying skalibs has been compiled with flag-noipv6, or if it has detected at build time that the target host does not support IPv6, then the s6dns-ip46 abstraction will be totally transparent and use no resources at all.
A s6dns_ip46list_t structure holds a list of S6DNS_MAX_SERVERS (16) IPv4 or IPv6 addresses. Such a mixed list can be constructed, for instance, if the /etc/resolv.conf file contains both v4 and v6 nameserver lines.
If list is a s6dns_ip46list_t and i an integer between 0 and DNS_MAX_SERVERS-1, then
s6dns_ip46list_is6(&list, i)
is 1 if the ith
address in list is IPv6 and 0 if it is IPv4. s6dns_ip46list_ip(&list, i)
is a char * pointer to
16 (if IPv6) or 4 (IPv4) bytes representing the ith address in
list, in network byte order.