.\" Copyright (c) 1985 The Regents of the University of California.
.\" Redistribution and use in source and binary forms are permitted
.\" provided that the above copyright notice and this paragraph are
.\" duplicated in all such forms and that any documentation,
.\" advertising materials, and other materials related to such
.\" distribution and use acknowledge that the software was developed
.\" by the University of California, Berkeley. The name of the
.\" University may not be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\" @(#)resolver.3 6.2 (Berkeley) %G%
res_mkquery, res_send, res_init, dn_comp, dn_expand \- resolver routines
.B #include <sys/types.h>
.B #include <netinet/in.h>
.B #include <arpa/nameser.h>
.B "res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)"
.B res_send(msg, msglen, answer, anslen)
.B dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
.B char *exp_dn, *comp_dn;
.B char **dnptrs, **lastdnptr;
.B dn_expand(msg, eomorig, comp_dn, exp_dn, length)
.B char *msg, *eomorig, *comp_dn, exp_dn;
These routines are used for making, sending and interpreting packets
for use with Internet domain name servers.
Global information that is used by the
resolver routines is kept in the variable
Most of the values have reasonable defaults and can be ignored.
Options are stored a simple bit mask containing the bitwise ``or''
True if the initial name server address and default domain name are
Print debugging messages.
Accept authoritative answers only.
should continue until it finds an authoritative answer or finds an error.
Currently this is not implemented.
Use TCP connections for queries instead of UDP datagrams.
Used with RES_USEVC to keep the TCP connection open between
This is useful only in programs that regularly do many queries.
UDP should be the normal mode used.
Unused currently (ignore truncation errors, i.e., don't retry with TCP).
Set the recursion-desired bit in queries.
does not do iterative queries and expects the name server
will append the default domain name to single-component names
(those that do not contain a dot).
the standard host lookup routine
will search for host names in the current domain and in parent domains; see
reads the initialization file to get the default
domain name and the Internet address of the initial hosts
If this line does not exist, the host running
makes a standard query message and places it in
will return the size of the query or \-1 if the query is
is usually QUERY but can be any of the query types defined in
consists of a single label and the RES_DEFNAMES flag is enabled
(the default), the current domain name will be appended to
The current domain name is defined by the hostname
or is specified in a system file; it can be overridden
by the environment variable LOCALDOMAIN.
is currently unused but is intended for making update messages.
sends a query to name servers and returns an answer.
if RES_INIT is not set, send the query to the local name server, and
handle timeouts and retries.
The length of the message is returned, or
\-1 if there were errors.
expands the compressed domain name
to a full domain name. Expanded names are converted to upper case.
is a pointer to the beginning of the message,
is a pointer to a buffer of size
The size of compressed name is returned or -1 if there was an error.
compresses the domain name
The size of the compressed name is returned or -1 if there were errors.
.I length is the size of the array pointed to by
is a list of pointers to previously compressed names in the current message.
The first pointer points to
to the beginning of the message and the list ends with NULL.
is a pointer to the end of the array pointed to
A side effect is to update the list of pointers for
labels inserted into the message by
as the name is compressed.
is NULL, names are not compressed.
is NULL, the list of labels is not updated.
/etc/resolv.conf see resolver(5)
gethostbyname(3), named(8), resolver(5), hostname(7),
RFC882, RFC883, RFC973, RFC974,
SMM:11 Name Server Operations Guide for BIND