Man Linux: Main Page and Category List

NAME

       dns_name4 - IP address to host name

SYSNOPSIS

       #include <dns.h>

       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;

DESCRIPTION

       dns_name4 looks up the domain name for the 4-byte IP address in ip.  It
       puts the (first) domain name into out and returns 0.  If  the  relevant
       in-addr.arpa  domain  does not exist in DNS, or has no PTR records, out
       will be empty.

       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.

SEE ALSO

       dns_domain(3),      dns_ip4(3),      dns_ip4_qualify(3),     dns_mx(3),
       dns_packet(3), dns_random(3), dns_transmit(3), dns_txt(3)

       http://cr.yp.to/djbdns/blurb/library.html

                                                                  dns_name4(3)