resolver.3n (2010 09)
r
resolver(3N) resolver(3N)
Alternatively in
resolv.conf the following name-value pairs can be added :
retrans value in milliseconds
retry number of retries
While the Environmental Variables and entries in the
resolv.conf file are interpreted when the
res_init() API is called, the API set_resfield()
has to be explicitly called from within the code.
Setting the retrans and retry values through a lower precedence option will be ignored if these values
have been configured through higher precedence option. A message is flagged in
syslog when an
invalid value is specified in either
resolv.conf or Environmental variables. The retrans is to be
specified in milliseconds, and its default value is 5000 milliseconds. The default value for retry is 4.
Primary Routines
res_init() Reads the configuration file,
/etc/resolv.conf, to get the default domain
name, search list, the Internet address of the local name server(s), the values for
retrans and retry . 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 and over-
rides the search list on a per process basis. This is similar to the
search command
in the configuration file. Another environment variable such as,
RES_OPTIONS
can be set to override certain internal resolver options which are set by calling some
of the configuration routines above, or by using the configuration file’s
options
command. The syntax of the RES_OPTIONS environment variable is explained in
resolver (4). The resolv.conf entries for retrans and retry can be overridden by
RES_RETRANS and RES_RETRY Environmental Variables respectively.
res_query() Provides an interface to the server query mechanism. 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-qualified domain name dname. The reply message is left in the answer buffer
with length anslen supplied by the caller.
res_search() Makes a query and awaits a response much like res_query(), but in addition, it
implements the default and search rules controlled by the RES_DEFNAMES and
RES_DNSRCH options. It returns the first successful reply.
set_resfield() Sets the value for the retry and retrans fields in the
_res structure. The value for
the retrans option must be specified in milliseconds. This routine also validates the
values which the user tries to set for the retry and retrans options.
set_resfield() returns 0 on success, and
-1 on failure. Calls to
set_resfield() fails when values for the field passed as argument is already
set by any higher precedence option like entering name-value pairs in the
resolv.conf file or setting the Environmental Variables
RES_RETRANS and
RES_RETRY.
get_resfield() Get the value for the retry and retrans fields in the _res structure.
get_resfield() returns the value of the field requested on success and -1 if on
failure. It fails when the arguments do not refer to retrans or retry .
Other Routines
Routines described here are lower-level routines used by
res_query().
res_mkquery() 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 <arpa/nameser.h>. The domain
name for the query is given by dname. class can be any of the query classes defined
in <arpa/nameser.h>. type can be any of the query types defined in
<arpa/nameser.h>. data is the data for an inverse query (IQUERY). newrr is
currently unused but is intended for making update messages.
res_send() Sends a pre-formatted query and returns an answer. It calls res_init() if
RES_INIT is not set, sends the query to the local name server, and handles
timeouts and retries. res_send() returns the length of the reply message, or −1
if there were errors.
HP-UX 11i Version 3: September 2010 − 3 − Hewlett-Packard Company 3