Manual Pages for UNIX Darwin command on man resolver
MyWebUniversity

Manual Pages for UNIX Darwin command on man resolver

RESOLVER(3) BSD Library Functions Manual RESOLVER(3)

NAME

rreessqquueerryy, rreesssseeaarrcchh, rreessmmkkqquueerryy, rreesssseenndd, rreessiinniitt, ddnnccoommpp,

ddnneexxppaanndd, ddnnsskkiippnnaammee, nnssggeett1166, nnssggeett3322, nnssppuutt1166, nnssppuutt3322 -

resolver routines

LLIIBBRRAARRYY

Standard C Library (libc, -lc)

SYNOPSIS

##iinncclluuddee <>

##iinncclluuddee <>

##iinncclluuddee <>

##iinncclluuddee <>

int rreessqquueerryy(const char *dname, int class, int type, uchar *answer, int anslen); int rreesssseeaarrcchh(const char *dname, int class, int type, uchar *answer, int anslen); int rreessmmkkqquueerryy(int op, const char *dname, int class, int type, const uchar *data, int datalen, const uchar *newrrin, uchar *buf, int buflen); int rreesssseenndd(const uchar *msg, int msglen, uchar *answer, int anslen); int rreessiinniitt(); int ddnnccoommpp(const char *expdn, uchar *compdn, int length, uchar **dnptrs, uchar **lastdnptr); int ddnneexxppaanndd(const uchar *msg, const uchar *eomorig, const uchar *compdn, char *expdn, int length); int ddnnsskkiippnnaammee(const uchar *compdn, const uchar *eom); uint nnssggeett1166(const uchar *src); ulong nnssggeett3322(const uchar *src); void nnssppuutt1166(uint src, uchar *dst); void nnssppuutt3322(ulong src, uchar *dst);

DESCRIPTION

These routines are used for making, sending and interpreting query and reply messages with Internet domain name servers.

Global configuration and state information that is used by the resolver

routines is kept in the structure res. Most of the values have reason-

able defaults and can be ignored. Options stored in res.options are defined in resolv.h and are as follows. Options are stored as a simple bit mask containing the bitwise ``or'' of the options enabled. RESINIT True if the initial name server address and default domain name are initialized (i.e., rreessiinniitt() has been called). RESDEBUG Print debugging messages. RESAAONLY Accept authoritative answers only. With this option, rreesssseenndd() should continue until it finds an authoritative

answer or finds an error. Currently this is not imple-

mented. RESUSEVC Use TCP connections for queries instead of UDP datagrams. RESSTAYOPEN Used with RESUSEVC to keep the TCP connection open between queries. This is useful only in programs that regularly do many queries. UDP should be the normal mode used. RESIGNTC Unused currently (ignore truncation errors, i.e., don't retry with TCP).

RESRECURSE Set the recursion-desired bit in queries. This is the

default. (rreesssseenndd() does not do iterative queries and expects the name server to handle recursion.)

RESDEFNAMES If set, rreesssseeaarrcchh() will append the default domain name

to single-component names (those that do not contain a

dot). This option is enabled by default. RESDNSRCH If this option is set, rreesssseeaarrcchh() will search for host names in the current domain and in parent domains; see hostname(7). This is used by the standard host lookup routine gethostbyname(3). This option is enabled by default.

RESNOALIASES This option turns off the user level aliasing feature con-

trolled by the ``HOSTALIASES'' environment variable. Net-

work daemons should set this option.

RESUSEINET6 Enables support for IPv6-only applications. This causes

IPv4 addresses to be returned as an IPv4 mapped address. For example, 10.1.1.1 will be returned as ::ffff:10.1.1.1. The option is meaningful with certain kernel configuration only.

RESUSEEDNS0 Enables support for OPT pseudo-RR for EDNS0 extension.

With the option, resolver code will attach OPT pseudo-RR

into DNS queries, to inform of our receive buffer size. The option will allow DNS servers to take advantage of

non-default receive buffer size, and to send larger

replies. DNS query packets with EDNS0 extension is not

compatible with non-EDNS0 DNS servers.

The rreessiinniitt() routine reads the configuration file (if any; see

resolver(5)) to get the default domain name, search list and the Internet

address of the local name server(s). If no server is configured, the

host running the resolver is tried. The current domain name is defined

by the hostname if not specified in the configuration file; it can be overridden by the environment variable LOCALDOMAIN. This environment

variable may contain several blank-separated tokens if you wish to over-

ride the search list on a per-process basis. This is similar to the

search command in the configuration file. Another environment variable

``RESOPTIONS'' can be set to override certain internal resolver options

which are otherwise set by changing fields in the res structure or are inherited from the configuration file's options command. The syntax of

the ``RESOPTIONS'' environment variable is explained in resolver(5).

Initialization normally occurs on the first call to one of the following routines.

The rreessqquueerryy() function provides an interface to the server query mecha-

nism. It constructs a query, sends it to the local server, awaits a response, and makes preliminary checks on the reply. The query requests

information of the specified type and class for the specified fully-qual-

ified domain name dname. The reply message is left in the answer buffer with length anslen supplied by the caller. The rreesssseeaarrcchh() routine makes a query and awaits a response like rreessqquueerryy(), but in addition, it implements the default and search rules

controlled by the RESDEFNAMES and RESDNSRCH options. It returns the

first successful reply.

The remaining routines are lower-level routines used by rreessqquueerryy(). The

rreessmmkkqquueerryy() function constructs a standard query message and places it

in buf. It returns the size of the query, or -1 if the query is larger

than buflen. The query type op is usually QUERY, but can be any of the query types defined in . The domain name for the query is given by dname. Newrr is currently unused but is intended for making update messages.

The rreesssseenndd() routine sends a pre-formatted query and returns an answer.

It will call rreessiinniitt() if RESINIT is not set, send the query to the local name server, and handle timeouts and retries. The length of the

reply message is returned, or -1 if there were errors.

The ddnnccoommpp() function compresses the domain name expdn and stores it in

compdn. The size of the compressed name is returned or -1 if there were

errors. The size of the array pointed to by compdn is given by length.

The compression uses an array of pointers dnptrs to previously-compressed

names in the current message. The first pointer points to the beginning of the message and the list ends with NULL. The limit to the array is specified by lastdnptr. A side effect of ddnnccoommpp() is to update the list

of pointers for labels inserted into the message as the name is com-

pressed. If dnptr is NULL, names are not compressed. If lastdnptr is NULL, the list of labels is not updated. The ddnneexxppaanndd() entry expands the compressed domain name compdn to a full domain name The compressed name is contained in a query or reply

message; msg is a pointer to the beginning of the message. The uncom-

pressed name is placed in the buffer indicated by expdn which is of size

length. The size of compressed name is returned or -1 if there was an

error. The ddnnsskkiippnnaammee() function skips over a compressed domain name, which

starts at a location pointed to by compdn. The compressed name is con-

tained in a query or reply message; eom is a pointer to the end of the

message. The size of compressed name is returned or -1 if there was an

error.

The nnssggeett1166() function gets a 16-bit quantity from a buffer pointed to

by src.

The nnssggeett3322() function gets a 32-bit quantity from a buffer pointed to

by src.

The nnssppuutt1166() function puts a 16-bit quantity src to a buffer pointed to

by dst.

The nnssppuutt3322() function puts a 32-bit quantity src to a buffer pointed to

by dst. FILES

/etc/resolv.conf The configuration file, see resolver(5).

SEE ALSO

gethostbyname(3), resolver(5), hostname(7), named(8)

RFC1032, RFC1033, RFC1034, RFC1035, RFC974 Name Server Operations Guide for BIND. HISTORY The rreessqquueerryy function appeared in 4.3BSD. BSD June 4, 1993 BSD




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™