Merge branch 'vendor/LESS' into less_update
[dragonfly.git] / contrib / bind-9.5.2 / lib / lwres / man / lwres_getipnode.3
1 .\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
2 .\" Copyright (C) 2000, 2001, 2003 Internet Software Consortium.
3 .\" 
4 .\" Permission to use, copy, modify, and/or 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.
7 .\" 
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9 .\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 .\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11 .\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 .\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13 .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 .\" PERFORMANCE OF THIS SOFTWARE.
15 .\"
16 .\" $Id: lwres_getipnode.3,v 1.28.214.1 2009/07/11 01:43:31 tbox Exp $
17 .\"
18 .hy 0
19 .ad l
20 .\"     Title: lwres_getipnode
21 .\"    Author: 
22 .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/>
23 .\"      Date: Jun 30, 2000
24 .\"    Manual: BIND9
25 .\"    Source: BIND9
26 .\"
27 .TH "LWRES_GETIPNODE" "3" "Jun 30, 2000" "BIND9" "BIND9"
28 .\" disable hyphenation
29 .nh
30 .\" disable justification (adjust text to left margin only)
31 .ad l
32 .SH "NAME"
33 lwres_getipnodebyname, lwres_getipnodebyaddr, lwres_freehostent \- lightweight resolver nodename / address translation API
34 .SH "SYNOPSIS"
35 .nf
36 #include <lwres/netdb.h>
37 .fi
38 .HP 39
39 .BI "struct hostent * lwres_getipnodebyname(const\ char\ *" "name" ", int\ " "af" ", int\ " "flags" ", int\ *" "error_num" ");"
40 .HP 39
41 .BI "struct hostent * lwres_getipnodebyaddr(const\ void\ *" "src" ", size_t\ " "len" ", int\ " "af" ", int\ *" "error_num" ");"
42 .HP 23
43 .BI "void lwres_freehostent(struct\ hostent\ *" "he" ");"
44 .SH "DESCRIPTION"
45 .PP
46 These functions perform thread safe, protocol independent nodename\-to\-address and address\-to\-nodename translation as defined in RFC2553.
47 .PP
48 They use a
49 \fBstruct hostent\fR
50 which is defined in
51 \fInamedb.h\fR:
52 .PP
53 .RS 4
54 .nf
55 struct  hostent {
56         char    *h_name;        /* official name of host */
57         char    **h_aliases;    /* alias list */
58         int     h_addrtype;     /* host address type */
59         int     h_length;       /* length of address */
60         char    **h_addr_list;  /* list of addresses from name server */
61 };
62 #define h_addr  h_addr_list[0]  /* address, for backward compatibility */
63 .fi
64 .RE
65 .sp
66 .PP
67 The members of this structure are:
68 .PP
69 \fBh_name\fR
70 .RS 4
71 The official (canonical) name of the host.
72 .RE
73 .PP
74 \fBh_aliases\fR
75 .RS 4
76 A NULL\-terminated array of alternate names (nicknames) for the host.
77 .RE
78 .PP
79 \fBh_addrtype\fR
80 .RS 4
81 The type of address being returned \- usually
82 \fBPF_INET\fR
83 or
84 \fBPF_INET6\fR.
85 .RE
86 .PP
87 \fBh_length\fR
88 .RS 4
89 The length of the address in bytes.
90 .RE
91 .PP
92 \fBh_addr_list\fR
93 .RS 4
94 A
95 \fBNULL\fR
96 terminated array of network addresses for the host. Host addresses are returned in network byte order.
97 .RE
98 .PP
99 \fBlwres_getipnodebyname()\fR
100 looks up addresses of protocol family
101 \fIaf\fR
102 for the hostname
103 \fIname\fR. The
104 \fIflags\fR
105 parameter contains ORed flag bits to specify the types of addresses that are searched for, and the types of addresses that are returned. The flag bits are:
106 .PP
107 \fBAI_V4MAPPED\fR
108 .RS 4
109 This is used with an
110 \fIaf\fR
111 of AF_INET6, and causes IPv4 addresses to be returned as IPv4\-mapped IPv6 addresses.
112 .RE
113 .PP
114 \fBAI_ALL\fR
115 .RS 4
116 This is used with an
117 \fIaf\fR
118 of AF_INET6, and causes all known addresses (IPv6 and IPv4) to be returned. If AI_V4MAPPED is also set, the IPv4 addresses are return as mapped IPv6 addresses.
119 .RE
120 .PP
121 \fBAI_ADDRCONFIG\fR
122 .RS 4
123 Only return an IPv6 or IPv4 address if here is an active network interface of that type. This is not currently implemented in the BIND 9 lightweight resolver, and the flag is ignored.
124 .RE
125 .PP
126 \fBAI_DEFAULT\fR
127 .RS 4
128 This default sets the
129 \fBAI_V4MAPPED\fR
130 and
131 \fBAI_ADDRCONFIG\fR
132 flag bits.
133 .RE
134 .PP
135 \fBlwres_getipnodebyaddr()\fR
136 performs a reverse lookup of address
137 \fIsrc\fR
138 which is
139 \fIlen\fR
140 bytes long.
141 \fIaf\fR
142 denotes the protocol family, typically
143 \fBPF_INET\fR
144 or
145 \fBPF_INET6\fR.
146 .PP
147 \fBlwres_freehostent()\fR
148 releases all the memory associated with the
149 \fBstruct hostent\fR
150 pointer
151 \fIhe\fR. Any memory allocated for the
152 \fBh_name\fR,
153 \fBh_addr_list\fR
154 and
155 \fBh_aliases\fR
156 is freed, as is the memory for the
157 \fBhostent\fR
158 structure itself.
159 .SH "RETURN VALUES"
160 .PP
161 If an error occurs,
162 \fBlwres_getipnodebyname()\fR
163 and
164 \fBlwres_getipnodebyaddr()\fR
165 set
166 \fI*error_num\fR
167 to an appropriate error code and the function returns a
168 \fBNULL\fR
169 pointer. The error codes and their meanings are defined in
170 \fI<lwres/netdb.h>\fR:
171 .PP
172 \fBHOST_NOT_FOUND\fR
173 .RS 4
174 No such host is known.
175 .RE
176 .PP
177 \fBNO_ADDRESS\fR
178 .RS 4
179 The server recognised the request and the name but no address is available. Another type of request to the name server for the domain might return an answer.
180 .RE
181 .PP
182 \fBTRY_AGAIN\fR
183 .RS 4
184 A temporary and possibly transient error occurred, such as a failure of a server to respond. The request may succeed if retried.
185 .RE
186 .PP
187 \fBNO_RECOVERY\fR
188 .RS 4
189 An unexpected failure occurred, and retrying the request is pointless.
190 .RE
191 .PP
192 \fBlwres_hstrerror\fR(3)
193 translates these error codes to suitable error messages.
194 .SH "SEE ALSO"
195 .PP
196 \fBRFC2553\fR(),
197 \fBlwres\fR(3),
198 \fBlwres_gethostent\fR(3),
199 \fBlwres_getaddrinfo\fR(3),
200 \fBlwres_getnameinfo\fR(3),
201 \fBlwres_hstrerror\fR(3).
202 .SH "COPYRIGHT"
203 Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
204 .br
205 Copyright \(co 2000, 2001, 2003 Internet Software Consortium.
206 .br