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.
20 >lwres_getipnode
</TITLE
23 CONTENT=
"Modular DocBook HTML Stylesheet Version 1.61
44 >lwres_getipnodebyname, lwres_getipnodebyaddr, lwres_freehostent
--
lightweight resolver nodename / address translation API
</DIV
46 CLASS=
"REFSYNOPSISDIV"
60 CLASS=
"FUNCSYNOPSISINFO"
61 >#include
<lwres/netdb.h
></PRE
67 lwres_getipnodebyname
</CODE
68 >(const char *name, int af, int flags, int *error_num);
</CODE
75 lwres_getipnodebyaddr
</CODE
76 >(const void *src, size_t len, int af, int *error_num);
</CODE
83 lwres_freehostent
</CODE
84 >(struct hostent *he);
</CODE
98 >These functions perform thread safe, protocol independent
99 nodename-to-address and address-to-nodename
100 translation as defined in RFC2553.
</P
105 >struct hostent
</SPAN
113 CLASS=
"PROGRAMLISTING"
115 char *h_name; /* official name of host */
116 char **h_aliases; /* alias list */
117 int h_addrtype; /* host address type */
118 int h_length; /* length of address */
119 char **h_addr_list; /* list of addresses from name server */
121 #define h_addr h_addr_list[
0] /* address, for backward compatibility */
</PRE
124 >The members of this structure are:
137 >The official (canonical) name of the host.
</P
146 >A NULL-terminated array of alternate names (nicknames) for the host.
</P
155 >The type of address being returned - usually
173 >The length of the address in bytes.
</P
187 terminated array of network addresses for the host.
188 Host addresses are returned in network byte order.
</P
196 >lwres_getipnodebyname()
</TT
198 looks up addresses of protocol family
221 parameter contains ORed flag bits to
222 specify the types of addresses that are searched
223 for, and the types of addresses that are returned.
237 >This is used with an
244 of AF_INET6, and causes IPv4 addresses to be returned as IPv4-mapped
254 >This is used with an
261 of AF_INET6, and causes all known addresses (IPv6 and IPv4) to be returned.
262 If AI_V4MAPPED is also set, the IPv4 addresses are return as mapped
272 >Only return an IPv6 or IPv4 address if here is an active network
273 interface of that type. This is not currently implemented
274 in the BIND
9 lightweight resolver, and the flag is ignored.
</P
283 >This default sets the
301 >lwres_getipnodebyaddr()
</TT
303 performs a reverse lookup
325 denotes the protocol family, typically
338 >lwres_freehostent()
</TT
340 releases all the memory associated with
344 >struct hostent
</SPAN
354 Any memory allocated for the
369 is freed, as is the memory for the
387 >lwres_getipnodebyname()
</TT
392 >lwres_getipnodebyaddr()
</TT
401 to an approriate error code and the function returns a
407 The error codes and their meanings are defined in
410 ><lwres/netdb.h
></TT
424 >No such host is known.
</P
433 >The server recognised the request and the name but no address is
434 available. Another type of request to the name server for the
435 domain might return an answer.
</P
444 >A temporary and possibly transient error occurred, such as a
445 failure of a server to respond. The request may succeed if
455 >An unexpected failure occurred, and retrying the request
465 CLASS=
"REFENTRYTITLE"
466 >lwres_hstrerror
</SPAN
469 translates these error codes to suitable error messages.
</P
482 CLASS=
"REFENTRYTITLE"
490 CLASS=
"REFENTRYTITLE"
498 CLASS=
"REFENTRYTITLE"
499 >lwres_gethostent
</SPAN
506 CLASS=
"REFENTRYTITLE"
507 >lwres_getaddrinfo
</SPAN
514 CLASS=
"REFENTRYTITLE"
515 >lwres_getnameinfo
</SPAN
522 CLASS=
"REFENTRYTITLE"
523 >lwres_hstrerror
</SPAN