Plan 9 from Bell Labs’s /usr/web/sources/contrib/anothy/src/lib/djb-ape/dns/dns_name6.3

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.TH dns_name6 3
.SH NAME
dns_name6 \- find FQDNs for IP addresses
.SH SYNTAX
.B #include <dns.h>

void \fBdns_name6\fP(&\fIout\fR,\fIip\fR);
.br
void \fBdns_name_packet\fP(&\fIout\fR,char *\fIbuf\fR,unsigned int \fIlen\fR);
.br
void \fBdns_name6_domain\fP(\fIq\fR,\fIip\fR);

stralloc \fIout\fR = {0};
.br
char \fIip\fR[16];
.br
char \fIq\fR[DNS_NAME6_DOMAIN];

.SH DESCRIPTION
.B dns_name16
looks up the domain name for the 16-byte IP address in \fIip\fR.  It
puts the (first) domain name into \fIout\fR and returns 0. If the
relevant ip6.int domain does not exist in DNS, or has no PTR records,
\fIout\fR will be empty.

If \fBdns_name6\fR has trouble with the DNS lookup or runs out of
memory, it returns -1, setting \fIerrno\fR appropriately. It may or may
not change \fIout\fR.

.B dns_name_packet
is a low-level component of \fBdns_name6\fR, designed to support
asynchronous DNS lookups. It reads a DNS packet of length \fIlen\fR from \fIbuf\fR,
extracts the first PTR record from the answer section of the packet, puts the
result into \fIout\fR, and returns 0 or -1 the same way as \fIdns_name6\fR.

.B dns_name6_domain
is another low-level component of \fBdns_name6\fR. It converts an IP address
such as 4321:0:1:2:3:4:567:89ab into a domain name such as
b.a.9.8.7.6.5.0.4.0.0.0.3.0.0.0.2.0.0.0.1.0.0.0.0.0.0.0.1.2.3.4.IP6.INT. and
places the packet-encoded domain name into \fIq\fR.

.SH "SEE ALSO"
dns_ip6_qualify(3), dns_name4(3)

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.