Remove bugs section
[unix-history] / usr / src / lib / libc / net / resolver.3
CommitLineData
7403e690 1.\" Copyright (c) 1985 Regents of the University of California.
49bbe9e0
KD
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
7403e690 5.\" @(#)resolver.3 1.2 (Berkeley) %G%
49bbe9e0 6.\"
7403e690 7.TH RESOLVER 3 "15 November 1985"
49bbe9e0
KD
8.UC 4
9.SH NAME
10res_mkquery, res_send, res_init, dn_comp, dn_expand \- resolver routines
11.SH SYNOPSIS
12.B #include <sys/types.h>
13.br
14.B #include <netinet/in.h>
15.br
7403e690 16.B #include <arpa/nameser.h>
49bbe9e0 17.br
7403e690 18.B #include <arpa/resolv.h>
49bbe9e0
KD
19.PP
20.B "res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)"
21.br
22.B int op;
23.br
24.B char *dname;
25.br
26.B int class, type;
27.br
28.B char *data;
29.br
30.B int datalen;
31.br
32.B struct rrec *newrr;
33.br
34.B char *buf;
35.br
36.B int buflen;
37.PP
38.B res_send(msg, msglen, answer, anslen)
39.br
40.B char *msg;
41.br
42.B int msglen;
43.br
44.B char *answer;
45.br
46.B int anslen;
47.PP
48.B res_init()
49.PP
50.B dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
51.br
52.B char *exp_dn, *comp_dn;
53.br
54.B int length;
55.br
56.B char **dnptrs, **lastdnptr;
57.PP
58.B dn_expand(msg, comp_dn, exp_dn, length)
59.br
60.SM
61.B char *msg, *comp_dn, exp_dn;
62.br
63.B int length;
64.SH DESCRIPTION
65These routines are used for making, sending and interpreting packets to
66Internet domain name servers. Global information that is used by the
67resolver routines is kept in the variable
68.IR _res .
69Most of the values have reasonable defaults and can be ignored. Options
70stored in
71.I _res.options
72are defined in
73.I resolv.h
74and are as follows. Options are a simple bit mask and are or'ed in to
75enable.
76.IP RES_INIT
77True if the initial name server address and default domain name are
78initialized (i.e.,
79.I res_init
80has been called).
81.IP RES_DEBUG
82Print debugging messages.
83.IP RES_AAONLY
84Accept authoritative answers only.
85.I Res_send
86will continue until it finds an authoritative answer or finds an error.
87Currently this is not implemented.
88.IP RES_USEVC
89Use TCP connections for queries instead of UDP.
90.IP RES_PRIMARY
91Unused currently.
92.IP RES_IGNTC
93Unused currently (ignore truncation errors, i.e., don't retry with TCP).
94.IP RES_RECURSE
95Set the recursion desired bit in queries. This is the default.
96(
97.I res_send
7403e690 98does not currently perform iterative queries and expects the name server
49bbe9e0
KD
99to handle recursion. This should be fixed.)
100.IP RES_DEFNAMES
101Append the default domain name to single label queries. This is the default.
102.PP
103.I Res_init
104.PP
7403e690
KD
105reads the initialization file to get the default
106domain name and the Internet address of the initial hosts
49bbe9e0 107running the name server. If this line does not exist, the host running
7403e690 108the resolver is tried.
49bbe9e0
KD
109.I Res_mkquery
110is used to make a standard query message and places it in
111.IR buf .
112.I Res_mkquery
113will return the size of the query or \-1 if the query is
114larger than
115.IR buflen .
116.I Op
117is usually QUERY but can be any of the query types defined in
118.IR nameser.h .
119.I Dname
120is the domain name. If
121.I dname
122consists of a single label and the RES_DEFNAMES flag is enabled
123(the default),
124.I dname
125will be appended with the current domain name. The current
126domain name is defined in a system file and can be overridden
127by the environment variable LOCALDOMAIN.
128.I Newrr
129is currently unused but is intended for making update messages.
130.PP
131.I Res_send
132is used to send a query to name servers and return an answer.
133It will call
134.I res_init
7403e690 135if RES_INIT is not set, send the query to the local name server, and
49bbe9e0
KD
136handle timeouts and retries. The length of the message is returned or
137\-1 if there were errors.
138.PP
139.I Dn_expand
140Expands the compressed domain name
141.I comp_dn
142to a full domain name. Expanded names are converted to upper case.
143.I Msg
144is a pointer to the beginning of the message,
145.I exp_dn
146is a pointer to a buffer of size
147.I length
148for the result.
149The size of compressed name is returned or -1 if there was an error.
150.PP
151.I Dn_comp
152Compresses the domain name
153.I exp_dn
154and stores it in
155.IR comp_dn .
156The size of the compressed name is returned or -1 if there were errors.
157.I length is the size of the array pointed to by
158.IR comp_dn .
159.I Dnptrs
160is a list of pointers to previously compressed names in the current message.
161The first pointer points to
162to the beginning of the message and the list ends with NULL.
163.I lastdnptr
164is a pointer to the end of the array pointed to
165.IR dnptrs .
166A side effect is to update the list of pointers for
167labels inserted into the message by
168.I dn_comp
169as the name is compressed.
170If
171.I dnptr
172is NULL, we don't try to compress names. If
173.I lastdnptr
174is NULL, we don't update the list.
175.SH FILES
7403e690
KD
176resolv.conf Contains the default resolver information read by res_init.
177There are two types of records in this file, domain and name server.
178The domain record specifies the default domain for the resolver to use.
179You can have multiple name server records to designate the name servers
180addresses you would like the resolver to try. By using this
181file you don't have to have a name server actually running on your system
182and you can have a back up name server to try in the event your local server
183is not responsive.
49bbe9e0
KD
184.SH "SEE ALSO"
185named(8), RFC882, RFC883