1 .\" Copyright (c) 1985 The Regents of the University of California.
2 .\" All rights reserved.
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.
18 .\" @(#)resolver.3 6.5 (Berkeley) 6/23/90
20 .TH RESOLVER 3 "June 23, 1990"
23 resolver, res_query, res_search, res_mkquery, res_send, res_init, dn_comp, dn_expand \- resolver routines
25 .B #include <sys/types.h>
27 .B #include <net/gen/in.h>
29 .B #include <net/gen/nameser.h>
31 .B #include <net/gen/resolv.h>
33 .B "res_query(dname, class, type, answer, anslen)"
43 .B "res_search(dname, class, type, answer, anslen)"
53 .B "res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)"
65 .B struct rrec *newrr;
71 .B res_send(msg, msglen, answer, anslen)
83 .B dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
85 .B char *exp_dn, *comp_dn;
89 .B char **dnptrs, **lastdnptr;
91 .B dn_expand(msg, eomorig, comp_dn, exp_dn, length)
93 .B char *msg, *eomorig, *comp_dn, exp_dn;
97 These routines are used for making, sending and interpreting
98 query and reply messages with Internet domain name servers.
100 Global configuration and state information that is used by the
101 resolver routines is kept in the structure
103 Most of the values have reasonable defaults and can be ignored.
110 Options are stored as a simple bit mask containing the bitwise ``or''
111 of the options enabled.
113 True if the initial name server address and default domain name are
118 Print debugging messages.
120 Accept authoritative answers only.
123 should continue until it finds an authoritative answer or finds an error.
124 Currently this is not implemented.
126 Use TCP connections for queries instead of UDP datagrams.
128 Used with RES_USEVC to keep the TCP connection open between
130 This is useful only in programs that regularly do many queries.
131 UDP should be the normal mode used.
133 Unused currently (ignore truncation errors, i.e., don't retry with TCP).
135 Set the recursion-desired bit in queries.
139 does not do iterative queries and expects the name server
140 to handle recursion.)
144 will append the default domain name to single-component names
145 (those that do not contain a dot).
146 This option is enabled by default.
148 If this option is set,
150 will search for host names in the current domain and in parent domains; see
152 This is used by the standard host lookup routine
153 .IR gethostbyname (3).
154 This option is enabled by default.
159 reads the configuration file (if any; see
161 to get the default domain name,
163 the Internet address of the local name server(s).
164 If no server is configured, the host running
165 the resolver is tried.
166 The current domain name is defined by the hostname
167 if not specified in the configuration file;
168 it can be overridden by the environment variable LOCALDOMAIN.
169 Initialization normally occurs on the first call
170 to one of the following routines.
174 function provides an interface to the server query mechanism.
175 It constructs a query, sends it to the local server,
176 awaits a response, and makes preliminary checks on the reply.
177 The query requests information of the specified
181 for the specified fully-qualified domain name
183 The reply message is left in the
187 supplied by the caller.
191 routine makes a query and awaits a response like
193 but in addition, it implements the default and search rules
194 controlled by the RES_DEFNAMES and RES_DNSRCH options.
195 It returns the first successful reply.
197 The remaining routines are lower-level routines used by
202 constructs a standard query message and places it in
204 It returns the size of the query, or \-1 if the query is
209 is usually QUERY, but can be any of the query types defined in
210 .IR <arpa/nameser.h> .
211 The domain name for the query is given by
214 is currently unused but is intended for making update messages.
219 sends a pre-formatted query and returns an answer.
222 if RES_INIT is not set, send the query to the local name server, and
223 handle timeouts and retries.
224 The length of the reply message is returned, or
225 \-1 if there were errors.
230 compresses the domain name
234 The size of the compressed name is returned or \-1 if there were errors.
235 The size of the array pointed to by
242 to previously-compressed names in the current message.
243 The first pointer points to
244 to the beginning of the message and the list ends with NULL.
245 The limit to the array is specified by
249 is to update the list of pointers for
250 labels inserted into the message
251 as the name is compressed.
254 is NULL, names are not compressed.
257 is NULL, the list of labels is not updated.
262 expands the compressed domain name
264 to a full domain name
265 The compressed name is contained in a query or reply message;
267 is a pointer to the beginning of the message.
268 The uncompressed name is placed in the buffer indicated by
272 The size of compressed name is returned or \-1 if there was an error.
274 /etc/resolv.conf see resolver(5)
276 gethostbyname(3), named(8), resolver(5), hostname(7),
278 RFC1032, RFC1033, RFC1034, RFC1035, RFC974,
280 SMM:11 Name Server Operations Guide for BIND