lwres_getipnode.docbook revision ddccd5811feff696ba460dabfb666ce61040f545
82bdf8ce36ccfe1b6ff389a9c9c7e2b2d049a43dTom Gundersen<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen - Copyright (C) 2000, 2001 Internet Software Consortium.
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen - Permission to use, copy, modify, and distribute this software for any
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen - purpose with or without fee is hereby granted, provided that the above
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen - copyright notice and this permission notice appear in all copies.
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen<!-- $Id: lwres_getipnode.docbook,v 1.1 2001/03/31 00:08:12 gson Exp $ -->
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen<refentryinfo>
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen</refentryinfo>
10b17992ee59ac1d03d6fc210a976bc2b59f6d75Jason St. John<refpurpose>lightweight resolver nodename / address translation API</refpurpose>
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen<refsynopsisdiv>
10b17992ee59ac1d03d6fc210a976bc2b59f6d75Jason St. John<funcsynopsis>
10b17992ee59ac1d03d6fc210a976bc2b59f6d75Jason St. John<funcsynopsisinfo>#include <lwres/netdb.h></funcsynopsisinfo>
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen<funcprototype>
10b17992ee59ac1d03d6fc210a976bc2b59f6d75Jason St. Johnstruct hostent *
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen<function>lwres_getipnodebyname</function></funcdef>
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen</funcprototype>
6436165dbc500f14abfec738af28f87a71f6a12aLennart Poettering<funcprototype>
6436165dbc500f14abfec738af28f87a71f6a12aLennart Poetteringstruct hostent *
6436165dbc500f14abfec738af28f87a71f6a12aLennart Poettering<function>lwres_getipnodebyaddr</function></funcdef>
03cc0fd1431b82e59c11ae12a274c1f2df23169dLennart Poettering</funcprototype>
8612e9365333d35773a08509b1d80a98911acb44Lennart Poettering<funcprototype>
91c40d86120f3bf033539a53c971d99f5dd70708Torstein Husebø<function>lwres_freehostent</function></funcdef>
8612e9365333d35773a08509b1d80a98911acb44Lennart Poettering</funcprototype>
3df9bec57c3e2d96f7e2a25961585cfa609b61ebLennart Poettering</funcsynopsis>
3df9bec57c3e2d96f7e2a25961585cfa609b61ebLennart Poettering</refsynopsisdiv>
03cc0fd1431b82e59c11ae12a274c1f2df23169dLennart PoetteringThese functions perform thread safe, protocol independent
438ca2bbd4dc1de6193ec61f3c12e19cded7921dTom Gundersennodename-to-address and address-to-nodename
8434fd5cf23f998a0f3a0f947a4308a8c18ba7a5Tom Gundersentranslation as defined in RFC2553.
8434fd5cf23f998a0f3a0f947a4308a8c18ba7a5Tom Gundersenwhich is defined in
deb2e5230b4dcbc0e2e02cc47a0b2d0d7179a044Tom Gundersen<programlisting>
deb2e5230b4dcbc0e2e02cc47a0b2d0d7179a044Tom Gundersenstruct hostent {
438ca2bbd4dc1de6193ec61f3c12e19cded7921dTom Gundersen char *h_name; /* official name of host */
deb2e5230b4dcbc0e2e02cc47a0b2d0d7179a044Tom Gundersen char **h_aliases; /* alias list */
91c40d86120f3bf033539a53c971d99f5dd70708Torstein Husebø int h_addrtype; /* host address type */
d3df0e3982777fd5de8cffaa585eba0af3773c08Tom Gundersen int h_length; /* length of address */
d3df0e3982777fd5de8cffaa585eba0af3773c08Tom Gundersen char **h_addr_list; /* list of addresses from name server */
d3df0e3982777fd5de8cffaa585eba0af3773c08Tom Gundersen#define h_addr h_addr_list[0] /* address, for backward compatibility */
d3df0e3982777fd5de8cffaa585eba0af3773c08Tom Gundersen</programlisting>
deb2e5230b4dcbc0e2e02cc47a0b2d0d7179a044Tom GundersenThe members of this structure are:
deb2e5230b4dcbc0e2e02cc47a0b2d0d7179a044Tom Gundersen<variablelist>
deb2e5230b4dcbc0e2e02cc47a0b2d0d7179a044Tom Gundersen<varlistentry><term><constant>h_name</constant></term>
adc5b2e2ebcb91ee18b6a32681b8ec1e52793473Tom GundersenThe official (canonical) name of the host.
6f4dedb250f2d607eceefaa491f338becbeee7c0Tom Gundersen<varlistentry><term><constant>h_aliases</constant></term>
7dbf94a9c4dcdf9b56384e66eb2652fb61da5063Tom GundersenA NULL-terminated array of alternate names (nicknames) for the host.
d6731e4c7964ee2860d4f5abdb0b52acd7a66960Tom Gundersen<varlistentry><term><constant>h_addrtype</constant></term>
03cc0fd1431b82e59c11ae12a274c1f2df23169dLennart PoetteringThe type of address being returned - usually
ad6c04756115809d615dede330213d73edf732a8Lennart Poettering<varlistentry><term><constant>h_length</constant></term>
aaa297d4e5401fd4466632555432774863457f1dLennart PoetteringThe length of the address in bytes.
aaa297d4e5401fd4466632555432774863457f1dLennart Poettering<varlistentry><term><constant>h_addr_list</constant></term>
ad6c04756115809d615dede330213d73edf732a8Lennart Poetteringterminated array of network addresses for the host.
ad6c04756115809d615dede330213d73edf732a8Lennart PoetteringHost addresses are returned in network byte order.
8a516214c4412e8a40544bd725a6d499a30cbbbfLennart Poettering</variablelist>
8a516214c4412e8a40544bd725a6d499a30cbbbfLennart Poettering<function>lwres_getipnodebyname()</function>
8a516214c4412e8a40544bd725a6d499a30cbbbfLennart Poetteringlooks up addresses of protocol family
3df9bec57c3e2d96f7e2a25961585cfa609b61ebLennart Poetteringfor the hostname
9b4d1882ca46d5b2ae7d028ec2b5d0d0c3a46a76Tom Gundersenparameter contains ORed flag bits to
0d4ad91dd4fc831c31a9775b0eadf97fea6cd7f6Alin Rautaspecify the types of addresses that are searched
0d4ad91dd4fc831c31a9775b0eadf97fea6cd7f6Alin Rautafor, and the types of addresses that are returned.
0d4ad91dd4fc831c31a9775b0eadf97fea6cd7f6Alin RautaThe flag bits are:
0d4ad91dd4fc831c31a9775b0eadf97fea6cd7f6Alin Rauta<variablelist>
0d4ad91dd4fc831c31a9775b0eadf97fea6cd7f6Alin Rauta<varlistentry><term><constant>AI_V4MAPPED</constant></term>
8eb9058dc1f99a5eb9b8726a978fcc0720837a10Lennart PoetteringThis is used with an
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersenof AF_INET6, and causes IPv4 addresses to be returned as IPv4-mapped
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom GundersenIPv6 addresses.
0014a4ad505d119c7ac4346d9d774c3f17f663a5Lennart Poettering<varlistentry><term><constant>AI_ALL</constant></term>
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom GundersenThis is used with an
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersenof AF_INET6, and causes all known addresses (IPv6 and IPv4) to be returned.
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom GundersenIf AI_V4MAPPED is also set, the IPv4 addresses are return as mapped
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom GundersenIPv6 addresses.
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersen<varlistentry><term><constant>AI_ADDRCONFIG</constant></term>
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom GundersenOnly return an IPv6 or IPv4 address if here is an active network
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gunderseninterface of that type. This is not currently implemented
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom Gundersenin the BIND 9 lightweight resolver, and the flag is ignored.
4afd3348c7506dd1d36305b7bcb9feb8952b9d6bLennart Poettering<varlistentry><term><constant>AI_DEFAULT</constant></term>
fe8db0c5ee3365a2fc80ee7ebffa238f9a0a2ae2Tom GundersenThis default sets the