OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [common/] [v2_0/] [doc/] [manpages/] [net/] [resolver.3] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
.\"     $OpenBSD: resolver.3,v 1.15 2001/04/03 20:09:08 aaron Exp $
2
.\"
3
.\" Copyright (c) 1985, 1991, 1993
4
.\"     The Regents of the University of California.  All rights reserved.
5
.\"
6
.\" Redistribution and use in source and binary forms, with or without
7
.\" modification, are permitted provided that the following conditions
8
.\" are met:
9
.\" 1. Redistributions of source code must retain the above copyright
10
.\"    notice, this list of conditions and the following disclaimer.
11
.\" 2. Redistributions in binary form must reproduce the above copyright
12
.\"    notice, this list of conditions and the following disclaimer in the
13
.\"    documentation and/or other materials provided with the distribution.
14
.\" 3. All advertising materials mentioning features or use of this software
15
.\"    must display the following acknowledgement:
16
.\"     This product includes software developed by the University of
17
.\"     California, Berkeley and its contributors.
18
.\" 4. Neither the name of the University nor the names of its contributors
19
.\"    may be used to endorse or promote products derived from this software
20
.\"    without specific prior written permission.
21
.\"
22
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32
.\" SUCH DAMAGE.
33
.\"
34
.Dd June 4, 1993
35
.Dt RESOLVER 3
36
.Os
37
.Sh NAME
38
.Nm res_query ,
39
.Nm res_search ,
40
.Nm res_mkquery ,
41
.Nm res_send ,
42
.Nm res_init ,
43
.Nm dn_comp ,
44
.Nm dn_expand
45
.Nd resolver routines
46
.Sh SYNOPSIS
47
.Fd #include 
48
.Fd #include 
49
.Fd #include 
50
.Fd #include 
51
.Ft int
52
.Fo res_query
53
.Fa "char *dname"
54
.Fa "int class"
55
.Fa "int type"
56
.Fa "u_char *answer"
57
.Fa "int anslen"
58
.Fc
59
.Ft int
60
.Fo res_search
61
.Fa "char *dname"
62
.Fa "int class"
63
.Fa "int type"
64
.Fa "u_char *answer"
65
.Fa "int anslen"
66
.Fc
67
.Ft int
68
.Fo res_mkquery
69
.Fa "int op"
70
.Fa "char *dname"
71
.Fa "int class"
72
.Fa "int type"
73
.Fa "char *data"
74
.Fa "int datalen"
75
.Fa "struct rrec *newrr"
76
.Fa "char *buf"
77
.Fa "int buflen"
78
.Fc
79
.Ft int
80
.Fo res_send
81
.Fa "char *msg"
82
.Fa "int msglen"
83
.Fa "char *answer"
84
.Fa "int anslen"
85
.Fc
86
.Ft int
87
.Fn res_init "void"
88
.Ft int
89
.Fo dn_comp
90
.Fa "char *exp_dn"
91
.Fa "char *comp_dn"
92
.Fa "int length"
93
.Fa "char **dnptrs"
94
.Fa "char **lastdnptr"
95
.Fc
96
.Ft int
97
.Fo dn_expand
98
.Fa "u_char *msg"
99
.Fa "u_char *eomorig"
100
.Fa "u_char *comp_dn"
101
.Fa "u_char *exp_dn"
102
.Fa "int length"
103
.Fc
104
.Sh DESCRIPTION
105
These routines are used for making, sending, and interpreting
106
query and reply messages with Internet domain name servers.
107
.Pp
108
Global configuration and state information that is used by the
109
resolver routines is kept in the structure
110
.Li _res .
111
Most of the values have reasonable defaults and can be ignored.
112
Options stored in
113
.Li _res.options
114
are defined in
115
.Aq Pa resolv.h
116
and are as follows.
117
Options are stored as a simple bit mask containing the bitwise
118
.Tn OR
119
of the options enabled.
120
.Bl -tag -width RES_USE_INET6
121
.It Dv RES_INIT
122
True if the initial name server address and default domain name are
123
initialized (i.e.,
124
.Fn res_init
125
has been called).
126
.It Dv RES_DEBUG
127
Print debugging messages.
128
.It Dv RES_AAONLY
129
Accept authoritative answers only.
130
With this option,
131
.Fn res_send
132
should continue until it finds an authoritative answer or finds an error.
133
Currently this is not implemented.
134
.It Dv RES_USEVC
135
Use
136
.Tn TCP
137
connections for queries instead of
138
.Tn UDP
139
datagrams.
140
.It Dv RES_STAYOPEN
141
Used with
142
.Dv RES_USEVC
143
to keep the
144
.Tn TCP
145
connection open between queries.
146
This is useful only in programs that regularly do many queries.
147
.Tn UDP
148
should be the normal mode used.
149
.It Dv RES_IGNTC
150
Unused currently (ignore truncation errors, i.e., don't retry with
151
.Tn TCP ) .
152
.It Dv RES_RECURSE
153
Set the recursion-desired bit in queries.
154
This is the default.
155
.Pf ( Fn res_send
156
does not do iterative queries and expects the name server
157
to handle recursion.)
158
.It Dv RES_DEFNAMES
159
If set,
160
.Fn res_search
161
will append the default domain name to single-component names
162
(those that do not contain a dot).
163
This option is enabled by default.
164
.It Dv RES_DNSRCH
165
If this option is set,
166
.Fn res_search
167
will search for host names in the current domain and in parent domains; see
168
.Xr hostname 7 .
169
This is used by the standard host lookup routine
170
.Xr gethostbyname 3 .
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 .
178
.El
179
.Pp
180
The
181
.Fn res_init
182
routine reads the configuration file (if any; see
183
.Xr resolv.conf 5 )
184
to get the default domain name, search list, and the Internet address
185
of the local name server(s).
186
If no server is configured, the host running
187
the resolver is tried.
188
The current domain name is defined by the hostname
189
if not specified in the configuration file;
190
it can be overridden by the environment variable
191
.Ev LOCALDOMAIN .
192
This environment variable may contain several blank-separated
193
tokens if you wish to override the
194
.Fa search list
195
on a per-process basis.
196
This is similar to the
197
.Fa search
198
command in the configuration file.
199
Another environment variable
200
.Ev RES_OPTIONS
201
can be set to override certain internal resolver options which
202
are otherwise set by changing fields in the
203
.Fa _res
204
structure or are inherited from the configuration file's
205
.Fa options
206
command.
207
The syntax of the
208
.Ev RES_OPTIONS
209
environment variable is explained in
210
.Xr resolv.conf 5 .
211
Initialization normally occurs on the first call
212
to one of the following routines.
213
.Pp
214
The
215
.Fn res_query
216
function provides an interface to the server query mechanism.
217
It constructs a query, sends it to the local server,
218
awaits a response, and makes preliminary checks on the reply.
219
The query requests information of the specified
220
.Fa type
221
and
222
.Fa class
223
for the specified fully qualified domain name
224
.Fa dname .
225
The reply message is left in the
226
.Fa answer
227
buffer with length
228
.Fa anslen
229
supplied by the caller.
230
.Pp
231
The
232
.Fn res_search
233
routine makes a query and awaits a response like
234
.Fn res_query ,
235
but in addition, it implements the default and search rules controlled by the
236
.Dv RES_DEFNAMES
237
and
238
.Dv RES_DNSRCH
239
options.
240
It returns the first successful reply.
241
.Pp
242
The remaining routines are lower-level routines used by
243
.Fn res_query .
244
The
245
.Fn res_mkquery
246
function constructs a standard query message and places it in
247
.Fa buf .
248
It returns the size of the query, or \-1 if the query is larger than
249
.Fa buflen .
250
The query type
251
.Fa op
252
is usually
253
.Dv QUERY ,
254
but can be any of the query types defined in
255
.Aq Pa arpa/nameser.h .
256
The domain name for the query is given by
257
.Fa dname .
258
.Fa newrr
259
is currently unused but is intended for making update messages.
260
.Pp
261
The
262
.Fn res_send
263
routine sends a pre-formatted query and returns an answer.
264
It will call
265
.Fn res_init
266
if
267
.Dv RES_INIT
268
is not set, send the query to the local name server, and
269
handle timeouts and retries.
270
The length of the reply message is returned, or \-1 if there were errors.
271
.Pp
272
The
273
.Fn dn_comp
274
function compresses the domain name
275
.Fa exp_dn
276
and stores it in
277
.Fa comp_dn .
278
The size of the compressed name is returned or \-1 if there were errors.
279
The size of the array pointed to by
280
.Fa comp_dn
281
is given by
282
.Fa length .
283
The compression uses an array of pointers
284
.Fa dnptrs
285
to previously compressed names in the current message.
286
The first pointer points
287
to the beginning of the message and the list ends with
288
.Dv NULL .
289
The limit to the array is specified by
290
.Fa lastdnptr .
291
A side effect of
292
.Fn dn_comp
293
is to update the list of pointers for labels inserted into the message
294
as the name is compressed.
295
If
296
.Em dnptr
297
is
298
.Dv NULL ,
299
names are not compressed.
300
If
301
.Fa lastdnptr
302
is
303
.Dv NULL ,
304
the list of labels is not updated.
305
.Pp
306
The
307
.Fn dn_expand
308
entry expands the compressed domain name
309
.Fa comp_dn
310
to a full domain name
311
The compressed name is contained in a query or reply message;
312
.Fa msg
313
is a pointer to the beginning of the message.
314
The uncompressed name is placed in the buffer indicated by
315
.Fa exp_dn
316
which is of size
317
.Fa length .
318
The size of compressed name is returned or \-1 if there was an error.
319
.Sh FILES
320
.Bl -tag -width Pa
321
/etc/resolv.conf
322
configuration file
323
see
324
.Xr resolv.conf 5 .
325
.El
326
.Sh SEE ALSO
327
.Xr gethostbyname 3 ,
328
.Xr resolv.conf 5 ,
329
.Xr hostname 7 ,
330
.Xr named 8
331
.Pp
332
.%T RFC1032 ,
333
.%T RFC1033 ,
334
.%T RFC1034 ,
335
.%T RFC1035 ,
336
.%T RFC1535 ,
337
.%T RFC974
338
.Rs
339
.%T "Name Server Operations Guide for BIND"
340
.Re
341
.Sh HISTORY
342
The
343
.Nm
344
function appeared in
345
.Bx 4.3 .

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.