]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - contrib/bind9/lib/lwres/man/lwres_getipnode.3
MFV r306384:
[FreeBSD/stable/9.git] / contrib / bind9 / lib / lwres / man / lwres_getipnode.3
1 .\" Copyright (C) 2004, 2005, 2007, 2014, 2015 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 .hy 0
17 .ad l
18 '\" t
19 .\"     Title: lwres_getipnode
20 .\"    Author: 
21 .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
22 .\"      Date: 2007-06-18
23 .\"    Manual: BIND9
24 .\"    Source: ISC
25 .\"  Language: English
26 .\"
27 .TH "LWRES_GETIPNODE" "3" "2007\-06\-18" "ISC" "BIND9"
28 .\" -----------------------------------------------------------------
29 .\" * Define some portability stuff
30 .\" -----------------------------------------------------------------
31 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 .\" http://bugs.debian.org/507673
33 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
34 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35 .ie \n(.g .ds Aq \(aq
36 .el       .ds Aq '
37 .\" -----------------------------------------------------------------
38 .\" * set default formatting
39 .\" -----------------------------------------------------------------
40 .\" disable hyphenation
41 .nh
42 .\" disable justification (adjust text to left margin only)
43 .ad l
44 .\" -----------------------------------------------------------------
45 .\" * MAIN CONTENT STARTS HERE *
46 .\" -----------------------------------------------------------------
47 .SH "NAME"
48 lwres_getipnodebyname, lwres_getipnodebyaddr, lwres_freehostent \- lightweight resolver nodename / address translation API
49 .SH "SYNOPSIS"
50 .sp
51 .ft B
52 .nf
53 #include <lwres/netdb\&.h>
54 .fi
55 .ft
56 .HP \w'struct\ hostent\ *\ lwres_getipnodebyname('u
57 .BI "struct hostent * lwres_getipnodebyname(const\ char\ *" "name" ", int\ " "af" ", int\ " "flags" ", int\ *" "error_num" ");"
58 .HP \w'struct\ hostent\ *\ lwres_getipnodebyaddr('u
59 .BI "struct hostent * lwres_getipnodebyaddr(const\ void\ *" "src" ", size_t\ " "len" ", int\ " "af" ", int\ *" "error_num" ");"
60 .HP \w'void\ lwres_freehostent('u
61 .BI "void lwres_freehostent(struct\ hostent\ *" "he" ");"
62 .SH "DESCRIPTION"
63 .PP
64 These functions perform thread safe, protocol independent nodename\-to\-address and address\-to\-nodename translation as defined in RFC2553\&.
65 .PP
66 They use a
67 \fBstruct hostent\fR
68 which is defined in
69 namedb\&.h:
70 .PP
71 .if n \{\
72 .RS 4
73 .\}
74 .nf
75 struct  hostent {
76         char    *h_name;        /* official name of host */
77         char    **h_aliases;    /* alias list */
78         int     h_addrtype;     /* host address type */
79         int     h_length;       /* length of address */
80         char    **h_addr_list;  /* list of addresses from name server */
81 };
82 #define h_addr  h_addr_list[0]  /* address, for backward compatibility */
83 .fi
84 .if n \{\
85 .RE
86 .\}
87 .PP
88 The members of this structure are:
89 .PP
90 \fBh_name\fR
91 .RS 4
92 The official (canonical) name of the host\&.
93 .RE
94 .PP
95 \fBh_aliases\fR
96 .RS 4
97 A NULL\-terminated array of alternate names (nicknames) for the host\&.
98 .RE
99 .PP
100 \fBh_addrtype\fR
101 .RS 4
102 The type of address being returned \- usually
103 \fBPF_INET\fR
104 or
105 \fBPF_INET6\fR\&.
106 .RE
107 .PP
108 \fBh_length\fR
109 .RS 4
110 The length of the address in bytes\&.
111 .RE
112 .PP
113 \fBh_addr_list\fR
114 .RS 4
115 A
116 \fBNULL\fR
117 terminated array of network addresses for the host\&. Host addresses are returned in network byte order\&.
118 .RE
119 .PP
120 \fBlwres_getipnodebyname()\fR
121 looks up addresses of protocol family
122 \fIaf\fR
123 for the hostname
124 \fIname\fR\&. The
125 \fIflags\fR
126 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:
127 .PP
128 \fBAI_V4MAPPED\fR
129 .RS 4
130 This is used with an
131 \fIaf\fR
132 of AF_INET6, and causes IPv4 addresses to be returned as IPv4\-mapped IPv6 addresses\&.
133 .RE
134 .PP
135 \fBAI_ALL\fR
136 .RS 4
137 This is used with an
138 \fIaf\fR
139 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\&.
140 .RE
141 .PP
142 \fBAI_ADDRCONFIG\fR
143 .RS 4
144 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\&.
145 .RE
146 .PP
147 \fBAI_DEFAULT\fR
148 .RS 4
149 This default sets the
150 \fBAI_V4MAPPED\fR
151 and
152 \fBAI_ADDRCONFIG\fR
153 flag bits\&.
154 .RE
155 .PP
156 \fBlwres_getipnodebyaddr()\fR
157 performs a reverse lookup of address
158 \fIsrc\fR
159 which is
160 \fIlen\fR
161 bytes long\&.
162 \fIaf\fR
163 denotes the protocol family, typically
164 \fBPF_INET\fR
165 or
166 \fBPF_INET6\fR\&.
167 .PP
168 \fBlwres_freehostent()\fR
169 releases all the memory associated with the
170 \fBstruct hostent\fR
171 pointer
172 \fIhe\fR\&. Any memory allocated for the
173 \fBh_name\fR,
174 \fBh_addr_list\fR
175 and
176 \fBh_aliases\fR
177 is freed, as is the memory for the
178 \fBhostent\fR
179 structure itself\&.
180 .SH "RETURN VALUES"
181 .PP
182 If an error occurs,
183 \fBlwres_getipnodebyname()\fR
184 and
185 \fBlwres_getipnodebyaddr()\fR
186 set
187 \fI*error_num\fR
188 to an appropriate error code and the function returns a
189 \fBNULL\fR
190 pointer\&. The error codes and their meanings are defined in
191 <lwres/netdb\&.h>:
192 .PP
193 \fBHOST_NOT_FOUND\fR
194 .RS 4
195 No such host is known\&.
196 .RE
197 .PP
198 \fBNO_ADDRESS\fR
199 .RS 4
200 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\&.
201 .RE
202 .PP
203 \fBTRY_AGAIN\fR
204 .RS 4
205 A temporary and possibly transient error occurred, such as a failure of a server to respond\&. The request may succeed if retried\&.
206 .RE
207 .PP
208 \fBNO_RECOVERY\fR
209 .RS 4
210 An unexpected failure occurred, and retrying the request is pointless\&.
211 .RE
212 .PP
213 \fBlwres_hstrerror\fR(3)
214 translates these error codes to suitable error messages\&.
215 .SH "SEE ALSO"
216 .PP
217 \fBRFC2553\fR(),
218 \fBlwres\fR(3),
219 \fBlwres_gethostent\fR(3),
220 \fBlwres_getaddrinfo\fR(3),
221 \fBlwres_getnameinfo\fR(3),
222 \fBlwres_hstrerror\fR(3)\&.
223 .SH "AUTHOR"
224 .PP
225 \fBInternet Systems Consortium, Inc\&.\fR
226 .SH "COPYRIGHT"
227 .br
228 Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
229 .br
230 Copyright \(co 2000, 2001, 2003 Internet Software Consortium.
231 .br