source: trunk/minix/man/man3/resolver.3@ 11

Last change on this file since 11 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 7.1 KB
Line 
1.\" Copyright (c) 1985 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms are permitted provided
5.\" that: (1) source distributions retain this entire copyright notice and
6.\" comment, and (2) distributions including binaries display the following
7.\" acknowledgement: ``This product includes software developed by the
8.\" University of California, Berkeley and its contributors'' in the
9.\" documentation or other materials provided with the distribution and in
10.\" all advertising materials mentioning features or use of this software.
11.\" Neither the name of the University nor the names of its contributors may
12.\" be used to endorse or promote products derived from this software without
13.\" specific prior written permission.
14.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
15.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
16.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17.\"
18.\" @(#)resolver.3 6.5 (Berkeley) 6/23/90
19.\"
20.TH RESOLVER 3 "June 23, 1990"
21.UC 4
22.SH NAME
23resolver, res_query, res_search, res_mkquery, res_send, res_init, dn_comp, dn_expand \- resolver routines
24.SH SYNOPSIS
25.B #include <sys/types.h>
26.br
27.B #include <net/gen/in.h>
28.br
29.B #include <net/gen/nameser.h>
30.br
31.B #include <net/gen/resolv.h>
32.PP
33.B "res_query(dname, class, type, answer, anslen)"
34.br
35.B char *dname;
36.br
37.B int class, type;
38.br
39.B u_char *answer;
40.br
41.B int anslen;
42.PP
43.B "res_search(dname, class, type, answer, anslen)"
44.br
45.B char *dname;
46.br
47.B int class, type;
48.br
49.B u_char *answer;
50.br
51.B int anslen;
52.PP
53.B "res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)"
54.br
55.B int op;
56.br
57.B char *dname;
58.br
59.B int class, type;
60.br
61.B char *data;
62.br
63.B int datalen;
64.br
65.B struct rrec *newrr;
66.br
67.B char *buf;
68.br
69.B int buflen;
70.PP
71.B res_send(msg, msglen, answer, anslen)
72.br
73.B char *msg;
74.br
75.B int msglen;
76.br
77.B char *answer;
78.br
79.B int anslen;
80.PP
81.B res_init()
82.PP
83.B dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
84.br
85.B char *exp_dn, *comp_dn;
86.br
87.B int length;
88.br
89.B char **dnptrs, **lastdnptr;
90.PP
91.B dn_expand(msg, eomorig, comp_dn, exp_dn, length)
92.br
93.B char *msg, *eomorig, *comp_dn, exp_dn;
94.br
95.B int length;
96.SH DESCRIPTION
97These routines are used for making, sending and interpreting
98query and reply messages with Internet domain name servers.
99.PP
100Global configuration and state information that is used by the
101resolver routines is kept in the structure
102.IR _res .
103Most of the values have reasonable defaults and can be ignored.
104Options
105stored in
106.I _res.options
107are defined in
108.I resolv.h
109and are as follows.
110Options are stored as a simple bit mask containing the bitwise ``or''
111of the options enabled.
112.IP RES_INIT
113True if the initial name server address and default domain name are
114initialized (i.e.,
115.I res_init
116has been called).
117.IP RES_DEBUG
118Print debugging messages.
119.IP RES_AAONLY
120Accept authoritative answers only.
121With this option,
122.I res_send
123should continue until it finds an authoritative answer or finds an error.
124Currently this is not implemented.
125.IP RES_USEVC
126Use TCP connections for queries instead of UDP datagrams.
127.IP RES_STAYOPEN
128Used with RES_USEVC to keep the TCP connection open between
129queries.
130This is useful only in programs that regularly do many queries.
131UDP should be the normal mode used.
132.IP RES_IGNTC
133Unused currently (ignore truncation errors, i.e., don't retry with TCP).
134.IP RES_RECURSE
135Set the recursion-desired bit in queries.
136This is the default.
137(\c
138.I res_send
139does not do iterative queries and expects the name server
140to handle recursion.)
141.IP RES_DEFNAMES
142If set,
143.I res_search
144will append the default domain name to single-component names
145(those that do not contain a dot).
146This option is enabled by default.
147.IP RES_DNSRCH
148If this option is set,
149.I res_search
150will search for host names in the current domain and in parent domains; see
151.IR hostname (7).
152This is used by the standard host lookup routine
153.IR gethostbyname (3).
154This option is enabled by default.
155.PP
156The
157.I res_init
158routine
159reads the configuration file (if any; see
160.IR resolver (5))
161to get the default domain name,
162search list and
163the Internet address of the local name server(s).
164If no server is configured, the host running
165the resolver is tried.
166The current domain name is defined by the hostname
167if not specified in the configuration file;
168it can be overridden by the environment variable LOCALDOMAIN.
169Initialization normally occurs on the first call
170to one of the following routines.
171.PP
172The
173.I res_query
174function provides an interface to the server query mechanism.
175It constructs a query, sends it to the local server,
176awaits a response, and makes preliminary checks on the reply.
177The query requests information of the specified
178.I type
179and
180.I class
181for the specified fully-qualified domain name
182.I dname .
183The reply message is left in the
184.I answer
185buffer with length
186.I anslen
187supplied by the caller.
188.PP
189The
190.I res_search
191routine makes a query and awaits a response like
192.IR res_query ,
193but in addition, it implements the default and search rules
194controlled by the RES_DEFNAMES and RES_DNSRCH options.
195It returns the first successful reply.
196.PP
197The remaining routines are lower-level routines used by
198.IR res_query .
199The
200.I res_mkquery
201function
202constructs a standard query message and places it in
203.IR buf .
204It returns the size of the query, or \-1 if the query is
205larger than
206.IR buflen .
207The query type
208.I op
209is usually QUERY, but can be any of the query types defined in
210.IR <arpa/nameser.h> .
211The domain name for the query is given by
212.IR dname .
213.I Newrr
214is currently unused but is intended for making update messages.
215.PP
216The
217.I res_send
218routine
219sends a pre-formatted query and returns an answer.
220It will call
221.I res_init
222if RES_INIT is not set, send the query to the local name server, and
223handle timeouts and retries.
224The length of the reply message is returned, or
225\-1 if there were errors.
226.PP
227The
228.I dn_comp
229function
230compresses the domain name
231.I exp_dn
232and stores it in
233.IR comp_dn .
234The size of the compressed name is returned or \-1 if there were errors.
235The size of the array pointed to by
236.I comp_dn
237is given by
238.IR length .
239The compression uses
240an array of pointers
241.I dnptrs
242to previously-compressed names in the current message.
243The first pointer points to
244to the beginning of the message and the list ends with NULL.
245The limit to the array is specified by
246.IR lastdnptr .
247A side effect of
248.I dn_comp
249is to update the list of pointers for
250labels inserted into the message
251as the name is compressed.
252If
253.I dnptr
254is NULL, names are not compressed.
255If
256.I lastdnptr
257is NULL, the list of labels is not updated.
258.PP
259The
260.I dn_expand
261entry
262expands the compressed domain name
263.I comp_dn
264to a full domain name
265The compressed name is contained in a query or reply message;
266.I msg
267is a pointer to the beginning of the message.
268The uncompressed name is placed in the buffer indicated by
269.I exp_dn
270which is of size
271.IR length .
272The size of compressed name is returned or \-1 if there was an error.
273.SH FILES
274/etc/resolv.conf see resolver(5)
275.SH "SEE ALSO"
276gethostbyname(3), named(8), resolver(5), hostname(7),
277.br
278RFC1032, RFC1033, RFC1034, RFC1035, RFC974,
279.br
280SMM:11 Name Server Operations Guide for BIND
Note: See TracBrowser for help on using the repository browser.