diff options
Diffstat (limited to 'src/lib/libc/net/resolver.3')
-rw-r--r-- | src/lib/libc/net/resolver.3 | 93 |
1 files changed, 47 insertions, 46 deletions
diff --git a/src/lib/libc/net/resolver.3 b/src/lib/libc/net/resolver.3 index 99abe17f03..4d5402ed2d 100644 --- a/src/lib/libc/net/resolver.3 +++ b/src/lib/libc/net/resolver.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $NetBSD: resolver.3,v 1.5 1995/02/25 06:21:02 cgd Exp $ | 1 | .\" $OpenBSD: resolver.3,v 1.15 2001/04/03 20:09:08 aaron Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 1985, 1991, 1993 | 3 | .\" Copyright (c) 1985, 1991, 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | 4 | .\" The Regents of the University of California. All rights reserved. |
@@ -31,11 +31,9 @@ | |||
31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | .\" SUCH DAMAGE. | 32 | .\" SUCH DAMAGE. |
33 | .\" | 33 | .\" |
34 | .\" @(#)resolver.3 8.1 (Berkeley) 6/4/93 | ||
35 | .\" | ||
36 | .Dd June 4, 1993 | 34 | .Dd June 4, 1993 |
37 | .Dt RESOLVER 3 | 35 | .Dt RESOLVER 3 |
38 | .Os BSD 4.3 | 36 | .Os |
39 | .Sh NAME | 37 | .Sh NAME |
40 | .Nm res_query , | 38 | .Nm res_query , |
41 | .Nm res_search , | 39 | .Nm res_search , |
@@ -50,6 +48,7 @@ | |||
50 | .Fd #include <netinet/in.h> | 48 | .Fd #include <netinet/in.h> |
51 | .Fd #include <arpa/nameser.h> | 49 | .Fd #include <arpa/nameser.h> |
52 | .Fd #include <resolv.h> | 50 | .Fd #include <resolv.h> |
51 | .Ft int | ||
53 | .Fo res_query | 52 | .Fo res_query |
54 | .Fa "char *dname" | 53 | .Fa "char *dname" |
55 | .Fa "int class" | 54 | .Fa "int class" |
@@ -57,6 +56,7 @@ | |||
57 | .Fa "u_char *answer" | 56 | .Fa "u_char *answer" |
58 | .Fa "int anslen" | 57 | .Fa "int anslen" |
59 | .Fc | 58 | .Fc |
59 | .Ft int | ||
60 | .Fo res_search | 60 | .Fo res_search |
61 | .Fa "char *dname" | 61 | .Fa "char *dname" |
62 | .Fa "int class" | 62 | .Fa "int class" |
@@ -64,6 +64,7 @@ | |||
64 | .Fa "u_char *answer" | 64 | .Fa "u_char *answer" |
65 | .Fa "int anslen" | 65 | .Fa "int anslen" |
66 | .Fc | 66 | .Fc |
67 | .Ft int | ||
67 | .Fo res_mkquery | 68 | .Fo res_mkquery |
68 | .Fa "int op" | 69 | .Fa "int op" |
69 | .Fa "char *dname" | 70 | .Fa "char *dname" |
@@ -75,13 +76,16 @@ | |||
75 | .Fa "char *buf" | 76 | .Fa "char *buf" |
76 | .Fa "int buflen" | 77 | .Fa "int buflen" |
77 | .Fc | 78 | .Fc |
79 | .Ft int | ||
78 | .Fo res_send | 80 | .Fo res_send |
79 | .Fa "char *msg" | 81 | .Fa "char *msg" |
80 | .Fa "int msglen" | 82 | .Fa "int msglen" |
81 | .Fa "char *answer" | 83 | .Fa "char *answer" |
82 | .Fa "int anslen" | 84 | .Fa "int anslen" |
83 | .Fc | 85 | .Fc |
84 | .Fn res_init | 86 | .Ft int |
87 | .Fn res_init "void" | ||
88 | .Ft int | ||
85 | .Fo dn_comp | 89 | .Fo dn_comp |
86 | .Fa "char *exp_dn" | 90 | .Fa "char *exp_dn" |
87 | .Fa "char *comp_dn" | 91 | .Fa "char *comp_dn" |
@@ -89,6 +93,7 @@ | |||
89 | .Fa "char **dnptrs" | 93 | .Fa "char **dnptrs" |
90 | .Fa "char **lastdnptr" | 94 | .Fa "char **lastdnptr" |
91 | .Fc | 95 | .Fc |
96 | .Ft int | ||
92 | .Fo dn_expand | 97 | .Fo dn_expand |
93 | .Fa "u_char *msg" | 98 | .Fa "u_char *msg" |
94 | .Fa "u_char *eomorig" | 99 | .Fa "u_char *eomorig" |
@@ -97,22 +102,22 @@ | |||
97 | .Fa "int length" | 102 | .Fa "int length" |
98 | .Fc | 103 | .Fc |
99 | .Sh DESCRIPTION | 104 | .Sh DESCRIPTION |
100 | These routines are used for making, sending and interpreting | 105 | These routines are used for making, sending, and interpreting |
101 | query and reply messages with Internet domain name servers. | 106 | query and reply messages with Internet domain name servers. |
102 | .Pp | 107 | .Pp |
103 | Global configuration and state information that is used by the | 108 | Global configuration and state information that is used by the |
104 | resolver routines is kept in the structure | 109 | resolver routines is kept in the structure |
105 | .Em _res . | 110 | .Li _res . |
106 | Most of the values have reasonable defaults and can be ignored. | 111 | Most of the values have reasonable defaults and can be ignored. |
107 | Options | 112 | Options stored in |
108 | stored in | 113 | .Li _res.options |
109 | .Em _res.options | ||
110 | are defined in | 114 | are defined in |
111 | .Pa resolv.h | 115 | .Aq Pa resolv.h |
112 | and are as follows. | 116 | and are as follows. |
113 | Options are stored as a simple bit mask containing the bitwise ``or'' | 117 | Options are stored as a simple bit mask containing the bitwise |
118 | .Tn OR | ||
114 | of the options enabled. | 119 | of the options enabled. |
115 | .Bl -tag -width RES_DEFNAMES | 120 | .Bl -tag -width RES_USE_INET6 |
116 | .It Dv RES_INIT | 121 | .It Dv RES_INIT |
117 | True if the initial name server address and default domain name are | 122 | True if the initial name server address and default domain name are |
118 | initialized (i.e., | 123 | initialized (i.e., |
@@ -137,8 +142,7 @@ Used with | |||
137 | .Dv RES_USEVC | 142 | .Dv RES_USEVC |
138 | to keep the | 143 | to keep the |
139 | .Tn TCP | 144 | .Tn TCP |
140 | connection open between | 145 | connection open between queries. |
141 | queries. | ||
142 | This is useful only in programs that regularly do many queries. | 146 | This is useful only in programs that regularly do many queries. |
143 | .Tn UDP | 147 | .Tn UDP |
144 | should be the normal mode used. | 148 | should be the normal mode used. |
@@ -165,16 +169,20 @@ will search for host names in the current domain and in parent domains; see | |||
165 | This is used by the standard host lookup routine | 169 | This is used by the standard host lookup routine |
166 | .Xr gethostbyname 3 . | 170 | .Xr gethostbyname 3 . |
167 | This option is enabled by default. | 171 | This option is enabled by default. |
172 | .It Dv RES_USE_INET6 | ||
173 | Enables support for IPv6-only applications. | ||
174 | This causes IPv4 addresses to be returned as an IPv4 mapped address. | ||
175 | For example, 10.1.1.1 will be returned as ::ffff:10.1.1.1. | ||
176 | The option is not meaningful on | ||
177 | .Ox . | ||
168 | .El | 178 | .El |
169 | .Pp | 179 | .Pp |
170 | The | 180 | The |
171 | .Fn res_init | 181 | .Fn res_init |
172 | routine | 182 | routine reads the configuration file (if any; see |
173 | reads the configuration file (if any; see | ||
174 | .Xr resolv.conf 5 ) | 183 | .Xr resolv.conf 5 ) |
175 | to get the default domain name, | 184 | to get the default domain name, search list, and the Internet address |
176 | search list and | 185 | of the local name server(s). |
177 | the Internet address of the local name server(s). | ||
178 | If no server is configured, the host running | 186 | If no server is configured, the host running |
179 | the resolver is tried. | 187 | the resolver is tried. |
180 | The current domain name is defined by the hostname | 188 | The current domain name is defined by the hostname |
@@ -212,7 +220,7 @@ The query requests information of the specified | |||
212 | .Fa type | 220 | .Fa type |
213 | and | 221 | and |
214 | .Fa class | 222 | .Fa class |
215 | for the specified fully-qualified domain name | 223 | for the specified fully qualified domain name |
216 | .Fa dname . | 224 | .Fa dname . |
217 | The reply message is left in the | 225 | The reply message is left in the |
218 | .Fa answer | 226 | .Fa answer |
@@ -224,8 +232,7 @@ The | |||
224 | .Fn res_search | 232 | .Fn res_search |
225 | routine makes a query and awaits a response like | 233 | routine makes a query and awaits a response like |
226 | .Fn res_query , | 234 | .Fn res_query , |
227 | but in addition, it implements the default and search rules | 235 | but in addition, it implements the default and search rules controlled by the |
228 | controlled by the | ||
229 | .Dv RES_DEFNAMES | 236 | .Dv RES_DEFNAMES |
230 | and | 237 | and |
231 | .Dv RES_DNSRCH | 238 | .Dv RES_DNSRCH |
@@ -236,11 +243,9 @@ The remaining routines are lower-level routines used by | |||
236 | .Fn res_query . | 243 | .Fn res_query . |
237 | The | 244 | The |
238 | .Fn res_mkquery | 245 | .Fn res_mkquery |
239 | function | 246 | function constructs a standard query message and places it in |
240 | constructs a standard query message and places it in | ||
241 | .Fa buf . | 247 | .Fa buf . |
242 | It returns the size of the query, or \-1 if the query is | 248 | It returns the size of the query, or \-1 if the query is larger than |
243 | larger than | ||
244 | .Fa buflen . | 249 | .Fa buflen . |
245 | The query type | 250 | The query type |
246 | .Fa op | 251 | .Fa op |
@@ -250,26 +255,23 @@ but can be any of the query types defined in | |||
250 | .Aq Pa arpa/nameser.h . | 255 | .Aq Pa arpa/nameser.h . |
251 | The domain name for the query is given by | 256 | The domain name for the query is given by |
252 | .Fa dname . | 257 | .Fa dname . |
253 | .Fa Newrr | 258 | .Fa newrr |
254 | is currently unused but is intended for making update messages. | 259 | is currently unused but is intended for making update messages. |
255 | .Pp | 260 | .Pp |
256 | The | 261 | The |
257 | .Fn res_send | 262 | .Fn res_send |
258 | routine | 263 | routine sends a pre-formatted query and returns an answer. |
259 | sends a pre-formatted query and returns an answer. | ||
260 | It will call | 264 | It will call |
261 | .Fn res_init | 265 | .Fn res_init |
262 | if | 266 | if |
263 | .Dv RES_INIT | 267 | .Dv RES_INIT |
264 | is not set, send the query to the local name server, and | 268 | is not set, send the query to the local name server, and |
265 | handle timeouts and retries. | 269 | handle timeouts and retries. |
266 | The length of the reply message is returned, or | 270 | The length of the reply message is returned, or \-1 if there were errors. |
267 | \-1 if there were errors. | ||
268 | .Pp | 271 | .Pp |
269 | The | 272 | The |
270 | .Fn dn_comp | 273 | .Fn dn_comp |
271 | function | 274 | function compresses the domain name |
272 | compresses the domain name | ||
273 | .Fa exp_dn | 275 | .Fa exp_dn |
274 | and stores it in | 276 | and stores it in |
275 | .Fa comp_dn . | 277 | .Fa comp_dn . |
@@ -278,24 +280,23 @@ The size of the array pointed to by | |||
278 | .Fa comp_dn | 280 | .Fa comp_dn |
279 | is given by | 281 | is given by |
280 | .Fa length . | 282 | .Fa length . |
281 | The compression uses | 283 | The compression uses an array of pointers |
282 | an array of pointers | ||
283 | .Fa dnptrs | 284 | .Fa dnptrs |
284 | to previously-compressed names in the current message. | 285 | to previously compressed names in the current message. |
285 | The first pointer points to | 286 | The first pointer points |
286 | to the beginning of the message and the list ends with | 287 | to the beginning of the message and the list ends with |
287 | .Dv NULL . | 288 | .Dv NULL . |
288 | The limit to the array is specified by | 289 | The limit to the array is specified by |
289 | .Fa lastdnptr . | 290 | .Fa lastdnptr . |
290 | A side effect of | 291 | A side effect of |
291 | .Fn dn_comp | 292 | .Fn dn_comp |
292 | is to update the list of pointers for | 293 | is to update the list of pointers for labels inserted into the message |
293 | labels inserted into the message | ||
294 | as the name is compressed. | 294 | as the name is compressed. |
295 | If | 295 | If |
296 | .Em dnptr | 296 | .Em dnptr |
297 | is | 297 | is |
298 | .Dv NULL, names are not compressed. | 298 | .Dv NULL , |
299 | names are not compressed. | ||
299 | If | 300 | If |
300 | .Fa lastdnptr | 301 | .Fa lastdnptr |
301 | is | 302 | is |
@@ -304,8 +305,7 @@ the list of labels is not updated. | |||
304 | .Pp | 305 | .Pp |
305 | The | 306 | The |
306 | .Fn dn_expand | 307 | .Fn dn_expand |
307 | entry | 308 | entry expands the compressed domain name |
308 | expands the compressed domain name | ||
309 | .Fa comp_dn | 309 | .Fa comp_dn |
310 | to a full domain name | 310 | to a full domain name |
311 | The compressed name is contained in a query or reply message; | 311 | The compressed name is contained in a query or reply message; |
@@ -319,20 +319,21 @@ The size of compressed name is returned or \-1 if there was an error. | |||
319 | .Sh FILES | 319 | .Sh FILES |
320 | .Bl -tag -width Pa | 320 | .Bl -tag -width Pa |
321 | /etc/resolv.conf | 321 | /etc/resolv.conf |
322 | The configuration file | 322 | configuration file |
323 | see | 323 | see |
324 | .Xr resolv.conf 5 . | 324 | .Xr resolv.conf 5 . |
325 | .El | 325 | .El |
326 | .Sh SEE ALSO | 326 | .Sh SEE ALSO |
327 | .Xr gethostbyname 3 , | 327 | .Xr gethostbyname 3 , |
328 | .Xr named 8 , | ||
329 | .Xr resolv.conf 5 , | 328 | .Xr resolv.conf 5 , |
330 | .Xr hostname 7 , | 329 | .Xr hostname 7 , |
330 | .Xr named 8 | ||
331 | .Pp | 331 | .Pp |
332 | .%T RFC1032 , | 332 | .%T RFC1032 , |
333 | .%T RFC1033 , | 333 | .%T RFC1033 , |
334 | .%T RFC1034 , | 334 | .%T RFC1034 , |
335 | .%T RFC1035 , | 335 | .%T RFC1035 , |
336 | .%T RFC1535 , | ||
336 | .%T RFC974 | 337 | .%T RFC974 |
337 | .Rs | 338 | .Rs |
338 | .%T "Name Server Operations Guide for BIND" | 339 | .%T "Name Server Operations Guide for BIND" |
@@ -340,5 +341,5 @@ see | |||
340 | .Sh HISTORY | 341 | .Sh HISTORY |
341 | The | 342 | The |
342 | .Nm | 343 | .Nm |
343 | function appeared in | 344 | function appeared in |
344 | .Bx 4.3 . | 345 | .Bx 4.3 . |