dns_name4(&out,
ip);
dns_name_packet(&out,
buf, len);
dns_name4_domain(q,
ip);
stralloc
out
= {0};
char
ip[4];
char
q[DNS_NAME4_DOMAIN];
char
*buf;
unsigned int
len;
If dns_name4 has trouble with the DNS lookup or runs out of memory, it returns -1, setting errno appropriately. It may or may not change out.
dns_name_packet is a low-level component of dns_name4, designed to support asynchronous DNS lookups. It reads a DNS packet of length len from buf, extracts the first PTR record from the answer section of the packet, puts the result into out, and returns 0 or -1 the same way as dns_name4.
dns_name4_domain is another low-level component of dns_name4. It converts an IP address such as 1.2.3.4 into a domain name such as 4.3.2.1.in-addr.arpa and places the packet-encoded domain name into q.
http://cr.yp.to/djbdns/blurb/library.html