dns_ip4(&out,
&fqdn);
dns_ip4_packet(&out,
buf, len);
stralloc
out
= {0};
stralloc
fqdn
= {0};
char
*buf;
unsigned int
len;
If dns_ip4 has trouble with the DNS lookup or runs out of memory, it returns -1, setting errno appropriately. It may or may not change out.
If fqdn is a dotted-decimal IP address, dns_ip4 puts that IP address into out without checking DNS. More generally, if fqdn is a dot-separated sequence of dotted-decimal IP addresses, dns_ip4 puts those IP addresses into out without checking DNS. Brackets may appear inside the dotted-decimal IP addresses; they are ignored.
dns_ip4_packet is a low-level component of dns_ip4, designed to support asynchronous DNS lookups. It reads a DNS packet of length len from buf, extracts IP addresses from the answer section of the packet, puts the addresses into out, and returns 0 or -1 the same way as dns_ip4.
http://cr.yp.to/djbdns/blurb/library.html