2 .\" Copyright (C) 2000, 2001 Internet Software Consortium.
4 .\" Permission to use, copy, modify, and distribute this software for any
5 .\" purpose with or without fee is hereby granted, provided that the above
6 .\" copyright notice and this permission notice appear in all copies.
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
9 .\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
10 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
11 .\" INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
12 .\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
13 .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
14 .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
15 .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 .TH "LWRES_GETIPNODE" "3" "Jun 30, 2000" "BIND9" ""
19 lwres_getipnodebyname, lwres_getipnodebyaddr, lwres_freehostent \- lightweight resolver nodename / address translation API
21 \fB#include <lwres/netdb.h>
25 lwres_getipnodebyname(const char *name, int af, int flags, int *error_num);
30 lwres_getipnodebyaddr(const void *src, size_t len, int af, int *error_num);
35 lwres_freehostent(struct hostent *he);
39 These functions perform thread safe, protocol independent
40 nodename-to-address and address-to-nodename
41 translation as defined in RFC2553.
50 char *h_name; /* official name of host */
51 char **h_aliases; /* alias list */
52 int h_addrtype; /* host address type */
53 int h_length; /* length of address */
54 char **h_addr_list; /* list of addresses from name server */
56 #define h_addr h_addr_list[0] /* address, for backward compatibility */
60 The members of this structure are:
63 The official (canonical) name of the host.
66 A NULL-terminated array of alternate names (nicknames) for the host.
69 The type of address being returned - usually
75 The length of the address in bytes.
80 terminated array of network addresses for the host.
81 Host addresses are returned in network byte order.
83 \fBlwres_getipnodebyname()\fR
84 looks up addresses of protocol family
90 parameter contains ORed flag bits to
91 specify the types of addresses that are searched
92 for, and the types of addresses that are returned.
98 of AF_INET6, and causes IPv4 addresses to be returned as IPv4-mapped
104 of AF_INET6, and causes all known addresses (IPv6 and IPv4) to be returned.
105 If AI_V4MAPPED is also set, the IPv4 addresses are return as mapped
109 Only return an IPv6 or IPv4 address if here is an active network
110 interface of that type. This is not currently implemented
111 in the BIND 9 lightweight resolver, and the flag is ignored.
114 This default sets the
120 \fBlwres_getipnodebyaddr()\fR
121 performs a reverse lookup
128 denotes the protocol family, typically
133 \fBlwres_freehostent()\fR
134 releases all the memory associated with
139 Any memory allocated for the
144 is freed, as is the memory for the
150 \fBlwres_getipnodebyname()\fR
152 \fBlwres_getipnodebyaddr()\fR
155 to an approriate error code and the function returns a
158 The error codes and their meanings are defined in
159 \fI<lwres/netdb.h>\fR:
162 No such host is known.
165 The server recognised the request and the name but no address is
166 available. Another type of request to the name server for the
167 domain might return an answer.
170 A temporary and possibly transient error occurred, such as a
171 failure of a server to respond. The request may succeed if
175 An unexpected failure occurred, and retrying the request
178 \fBlwres_hstrerror\fR(3)
179 translates these error codes to suitable error messages.
184 \fBlwres_gethostent\fR(3),
185 \fBlwres_getaddrinfo\fR(3),
186 \fBlwres_getnameinfo\fR(3),
187 \fBlwres_hstrerror\fR(3).