1 .\" $NetBSD: lwres_getipnode.3,v 1.5 2014/12/10 04:38:02 christos Exp $
3 .\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC")
4 .\" Copyright (C) 2000, 2001, 2003 Internet Software Consortium.
6 .\" Permission to use, copy, modify, and/or distribute this software for any
7 .\" purpose with or without fee is hereby granted, provided that the above
8 .\" copyright notice and this permission notice appear in all copies.
10 .\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 .\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 .\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 .\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 .\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 .\" PERFORMANCE OF THIS SOFTWARE.
22 .\" Title: lwres_getipnode
24 .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/>
25 .\" Date: June 18, 2007
29 .TH "LWRES_GETIPNODE" "3" "June 18, 2007" "BIND9" "BIND9"
30 .\" disable hyphenation
32 .\" disable justification (adjust text to left margin only)
35 lwres_getipnodebyname, lwres_getipnodebyaddr, lwres_freehostent \- lightweight resolver nodename / address translation API
38 #include <lwres/netdb.h>
41 .BI "struct hostent * lwres_getipnodebyname(const\ char\ *" "name" ", int\ " "af" ", int\ " "flags" ", int\ *" "error_num" ");"
43 .BI "struct hostent * lwres_getipnodebyaddr(const\ void\ *" "src" ", size_t\ " "len" ", int\ " "af" ", int\ *" "error_num" ");"
45 .BI "void lwres_freehostent(struct\ hostent\ *" "he" ");"
48 These functions perform thread safe, protocol independent nodename\-to\-address and address\-to\-nodename translation as defined in RFC2553.
58 char *h_name; /* official name of host */
59 char **h_aliases; /* alias list */
60 int h_addrtype; /* host address type */
61 int h_length; /* length of address */
62 char **h_addr_list; /* list of addresses from name server */
64 #define h_addr h_addr_list[0] /* address, for backward compatibility */
69 The members of this structure are:
73 The official (canonical) name of the host.
78 A NULL\-terminated array of alternate names (nicknames) for the host.
83 The type of address being returned \- usually
91 The length of the address in bytes.
98 terminated array of network addresses for the host. Host addresses are returned in network byte order.
101 \fBlwres_getipnodebyname()\fR
102 looks up addresses of protocol family
107 parameter contains ORed flag bits to specify the types of addresses that are searched for, and the types of addresses that are returned. The flag bits are:
113 of AF_INET6, and causes IPv4 addresses to be returned as IPv4\-mapped IPv6 addresses.
120 of AF_INET6, and causes all known addresses (IPv6 and IPv4) to be returned. If AI_V4MAPPED is also set, the IPv4 addresses are return as mapped IPv6 addresses.
125 Only return an IPv6 or IPv4 address if here is an active network interface of that type. This is not currently implemented in the BIND 9 lightweight resolver, and the flag is ignored.
130 This default sets the
137 \fBlwres_getipnodebyaddr()\fR
138 performs a reverse lookup of address
144 denotes the protocol family, typically
149 \fBlwres_freehostent()\fR
150 releases all the memory associated with the
153 \fIhe\fR. Any memory allocated for the
158 is freed, as is the memory for the
164 \fBlwres_getipnodebyname()\fR
166 \fBlwres_getipnodebyaddr()\fR
169 to an appropriate error code and the function returns a
171 pointer. The error codes and their meanings are defined in
172 \fI<lwres/netdb.h>\fR:
176 No such host is known.
181 The server recognised the request and the name but no address is available. Another type of request to the name server for the domain might return an answer.
186 A temporary and possibly transient error occurred, such as a failure of a server to respond. The request may succeed if retried.
191 An unexpected failure occurred, and retrying the request is pointless.
194 \fBlwres_hstrerror\fR(3)
195 translates these error codes to suitable error messages.
200 \fBlwres_gethostent\fR(3),
201 \fBlwres_getaddrinfo\fR(3),
202 \fBlwres_getnameinfo\fR(3),
203 \fBlwres_hstrerror\fR(3).
205 Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC")
207 Copyright \(co 2000, 2001, 2003 Internet Software Consortium.