2 - Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 - Copyright (C) 2001, 2003 Internet Software Consortium.
5 - Permission to use, copy, modify, and distribute this software for any
6 - purpose with or without fee is hereby granted, provided that the above
7 - copyright notice and this permission notice appear in all copies.
9 - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 - PERFORMANCE OF THIS SOFTWARE.
18 <!-- $Id: lwres_getipnode.html,v 1.7.2.2 2004/03/15 04:45:02 marka Exp $ -->
23 >lwres_getipnode</TITLE
26 CONTENT="Modular DocBook HTML Stylesheet Version 1.73
47 >lwres_getipnodebyname, lwres_getipnodebyaddr, lwres_freehostent -- lightweight resolver nodename / address translation API</DIV
49 CLASS="REFSYNOPSISDIV"
63 CLASS="FUNCSYNOPSISINFO"
64 >#include <lwres/netdb.h></PRE
70 lwres_getipnodebyname</CODE
71 >(const char *name, int af, int flags, int *error_num);</CODE
78 lwres_getipnodebyaddr</CODE
79 >(const void *src, size_t len, int af, int *error_num);</CODE
86 lwres_freehostent</CODE
87 >(struct hostent *he);</CODE
101 >These functions perform thread safe, protocol independent
102 nodename-to-address and address-to-nodename
103 translation as defined in RFC2553.</P
108 >struct hostent</SPAN
116 CLASS="PROGRAMLISTING"
118 char *h_name; /* official name of host */
119 char **h_aliases; /* alias list */
120 int h_addrtype; /* host address type */
121 int h_length; /* length of address */
122 char **h_addr_list; /* list of addresses from name server */
124 #define h_addr h_addr_list[0] /* address, for backward compatibility */</PRE
127 >The members of this structure are:
140 >The official (canonical) name of the host.</P
149 >A NULL-terminated array of alternate names (nicknames) for the host.</P
158 >The type of address being returned - usually
176 >The length of the address in bytes.</P
190 terminated array of network addresses for the host.
191 Host addresses are returned in network byte order.</P
199 >lwres_getipnodebyname()</TT
201 looks up addresses of protocol family
224 parameter contains ORed flag bits to
225 specify the types of addresses that are searched
226 for, and the types of addresses that are returned.
240 >This is used with an
247 of AF_INET6, and causes IPv4 addresses to be returned as IPv4-mapped
257 >This is used with an
264 of AF_INET6, and causes all known addresses (IPv6 and IPv4) to be returned.
265 If AI_V4MAPPED is also set, the IPv4 addresses are return as mapped
275 >Only return an IPv6 or IPv4 address if here is an active network
276 interface of that type. This is not currently implemented
277 in the BIND 9 lightweight resolver, and the flag is ignored.</P
286 >This default sets the
304 >lwres_getipnodebyaddr()</TT
306 performs a reverse lookup
328 denotes the protocol family, typically
341 >lwres_freehostent()</TT
343 releases all the memory associated with
347 >struct hostent</SPAN
357 Any memory allocated for the
372 is freed, as is the memory for the
390 >lwres_getipnodebyname()</TT
395 >lwres_getipnodebyaddr()</TT
404 to an appropriate error code and the function returns a
410 The error codes and their meanings are defined in
413 ><lwres/netdb.h></TT
427 >No such host is known.</P
436 >The server recognised the request and the name but no address is
437 available. Another type of request to the name server for the
438 domain might return an answer.</P
447 >A temporary and possibly transient error occurred, such as a
448 failure of a server to respond. The request may succeed if
458 >An unexpected failure occurred, and retrying the request
468 CLASS="REFENTRYTITLE"
469 >lwres_hstrerror</SPAN
472 translates these error codes to suitable error messages.</P
485 CLASS="REFENTRYTITLE"
493 CLASS="REFENTRYTITLE"
501 CLASS="REFENTRYTITLE"
502 >lwres_gethostent</SPAN
509 CLASS="REFENTRYTITLE"
510 >lwres_getaddrinfo</SPAN
517 CLASS="REFENTRYTITLE"
518 >lwres_getnameinfo</SPAN
525 CLASS="REFENTRYTITLE"
526 >lwres_hstrerror</SPAN