initialize the Internet domain name resolver routines
#include <sys/types.h> #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> int res_init( void );
The resolver routines are used for making, sending, and interpreting query and reply messages with Internet domain name servers.
The res_init() routine reads the resolver configuration file (if one is present; see /etc/resolv.conf in the TCP/IP User's Guide) to get the default domain name, search list, and Internet address of the local name servers. If no server is configured, the host running the resolver is tried. If not specified in the configuration file, the current domain name is defined by the hostname; the domain name can be overridden by the environment variable LOCALDOMAIN. Initialization normally occurs on the first call to one of the resolver routines.
Global configuration and state information used by these routines is kept in the state structure _res, which is defined in <resolv.h>. Since most of the values have reasonable defaults, you can generally ignore them.
The _res.options member is a simple bit mask that contains the bitwise OR of the enabled options. The following options are defined in <resolv.h>:
See herror().
UNIX
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
dn_comp(), dn_expand(), gethostbyname(), res_mkquery(), res_query(), res_search(), res_send()
/etc/resolv.conf, hostname, named in the TCP/IP User's Guide
RFC 1032, RFC 1033, RFC 1034, RFC 1035, RFC 974