1LWRES_GETIPNODE(3)                   BIND9                  LWRES_GETIPNODE(3)
2
3
4

NAME

6       lwres_getipnodebyname, lwres_getipnodebyaddr, lwres_freehostent -
7       lightweight resolver nodename / address translation API
8

SYNOPSIS

10       #include <lwres/netdb.h>
11
12       struct hostent * lwres_getipnodebyname(const char *name, int af,
13                                              int flags, int *error_num);
14
15       struct hostent * lwres_getipnodebyaddr(const void *src, size_t len,
16                                              int af, int *error_num);
17
18       void lwres_freehostent(struct hostent *he);
19

DESCRIPTION

21       These functions perform thread safe, protocol independent
22       nodename-to-address and address-to-nodename translation as defined in
23       RFC2553.
24
25       They use a struct hostent which is defined in namedb.h:
26
27           struct  hostent {
28                   char    *h_name;        /* official name of host */
29                   char    **h_aliases;    /* alias list */
30                   int     h_addrtype;     /* host address type */
31                   int     h_length;       /* length of address */
32                   char    **h_addr_list;  /* list of addresses from name server */
33           };
34           #define h_addr  h_addr_list[0]  /* address, for backward compatibility */
35
36
37       The members of this structure are:
38
39       h_name
40           The official (canonical) name of the host.
41
42       h_aliases
43           A NULL-terminated array of alternate names (nicknames) for the
44           host.
45
46       h_addrtype
47           The type of address being returned - usually PF_INET or PF_INET6.
48
49       h_length
50           The length of the address in bytes.
51
52       h_addr_list
53           A NULL terminated array of network addresses for the host. Host
54           addresses are returned in network byte order.
55
56       lwres_getipnodebyname() looks up addresses of protocol family af for
57       the hostname name. The flags parameter contains ORed flag bits to
58       specify the types of addresses that are searched for, and the types of
59       addresses that are returned. The flag bits are:
60
61       AI_V4MAPPED
62           This is used with an af of AF_INET6, and causes IPv4 addresses to
63           be returned as IPv4-mapped IPv6 addresses.
64
65       AI_ALL
66           This is used with an af of AF_INET6, and causes all known addresses
67           (IPv6 and IPv4) to be returned. If AI_V4MAPPED is also set, the
68           IPv4 addresses are return as mapped IPv6 addresses.
69
70       AI_ADDRCONFIG
71           Only return an IPv6 or IPv4 address if here is an active network
72           interface of that type. This is not currently implemented in the
73           BIND 9 lightweight resolver, and the flag is ignored.
74
75       AI_DEFAULT
76           This default sets the AI_V4MAPPED and AI_ADDRCONFIG flag bits.
77
78       lwres_getipnodebyaddr() performs a reverse lookup of address src which
79       is len bytes long.  af denotes the protocol family, typically PF_INET
80       or PF_INET6.
81
82       lwres_freehostent() releases all the memory associated with the struct
83       hostent pointer he. Any memory allocated for the h_name, h_addr_list
84       and h_aliases is freed, as is the memory for the hostent structure
85       itself.
86

RETURN VALUES

88       If an error occurs, lwres_getipnodebyname() and lwres_getipnodebyaddr()
89       set *error_num to an appropriate error code and the function returns a
90       NULL pointer. The error codes and their meanings are defined in
91       <lwres/netdb.h>:
92
93       HOST_NOT_FOUND
94           No such host is known.
95
96       NO_ADDRESS
97           The server recognised the request and the name but no address is
98           available. Another type of request to the name server for the
99           domain might return an answer.
100
101       TRY_AGAIN
102           A temporary and possibly transient error occurred, such as a
103           failure of a server to respond. The request may succeed if retried.
104
105       NO_RECOVERY
106           An unexpected failure occurred, and retrying the request is
107           pointless.
108
109       lwres_hstrerror(3) translates these error codes to suitable error
110       messages.
111

SEE ALSO

113       RFC2553(), lwres(3), lwres_gethostent(3), lwres_getaddrinfo(3),
114       lwres_getnameinfo(3), lwres_hstrerror(3).
115
117       Copyright © 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
118       Copyright © 2000, 2001, 2003 Internet Software Consortium.
119
120
121
122BIND9                            Jun 30, 2000               LWRES_GETIPNODE(3)
Impressum