The _res Data Structure
Global information used by these resolver calls is kept in the _res data
structure. This structure is defined in the <RESOLV.H> file and contains
the following members:
┌─────────────────────────────────────────────────────────────────┐
│Type Member Contents │
├─────────────────────────────────────────────────────────────────┤
│int retrans Retransmission time │
│ interval │
├─────────────────────────────────────────────────────────────────┤
│int retry Number of times to │
│ retransmit │
├─────────────────────────────────────────────────────────────────┤
│long options Option flags │
├─────────────────────────────────────────────────────────────────┤
│int nscount Number of name │
│ servers │
├─────────────────────────────────────────────────────────────────┤
│struct nsaddr_list Address of name │
│sockaddr_in[MAXNS] server │
├─────────────────────────────────────────────────────────────────┤
│unsigned short id Current packet id │
├─────────────────────────────────────────────────────────────────┤
│char[MAXDNAME] defdname Default domain │
├─────────────────────────────────────────────────────────────────┤
│char*[MAXDNSRCH+1] dnsrch Components of domain │
│ to search │
└─────────────────────────────────────────────────────────────────┘
The options field of the _res data structure is constructed by logically
ORing the following values:
RES_INIT
Indicates whether the initial name server
and default domain name have been initialized (that is, whether the res_init()
call has been called).
RES_DEBUG
Prints
debugging messages.
RES_USEVC
Uses
Transmission Control Protocol/Internet Protocol (TCP/IP) connections for
queries instead of User Datagram Protocol/Internet Protocol (UDP/IP).
RES_STAYOPEN
Used with the RES_USEVC value, keeps the TCP/IP
connection open between queries. While UDP/IP is the mode normally used,
TCP/IP mode and this option are useful for programs that regularly perform
many queries.
RES_RECURSE
Sets
the Recursion Desired bit for queries. This is the default.
RES_DEFNAMES
Appends the default domain name to single-label
queries. This is the default.
These environment variables affect values related to the _res data structure:
LOCALDOMAIN
Overrides the default local domain,
which is read from the ETC\RESOLV.conf file and stored in the defdname field
of the _res data structure.
RES_TIMEOUT
Overrides
the default value of the retrans field of the _res data structure, which
is the value of the RES_TIMEOUT constant defined in the <RESOLV.H>
file. This value is the base timeout period in seconds between queries to
the name servers. After each failed attempt, the timeout period is doubled.
The timeout period is divided by the number of name servers defined. The
minimum timeout period is 1 second.
RES_RETRY
Overrides
the default value for the retry field of the _res data structure, which
is 4. This value is the number of times the resolver tries to query the
name servers before giving up. Setting RES_RETRY to 0 prevents the resolver
from querying the name servers.
The res_send() call does not perform interactive queries and expects the
name server to handle recursion.
[Back: Domain Name Resolution]
[Next: Ports]