[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Communications Technical Reference, Volume 2

res_init Subroutine

Purpose

Searches for a default domain name and Internet address.

Library

Standard C Library (libc.a)

Syntax

#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
 
void res_init ( )

Description

The res_init subroutine reads the /etc/resolv.conf file for the default domain name and the Internet address of the initial hosts running the name server.

Note: If the /etc/resolv.conf file does not exist, the res_init subroutine attempts name resolution using the local /etc/hosts file. If the system is not using a domain name server, the /etc/resolv.conf file should not exist. The /etc/hosts file should be present on the system even if the system is using a name server. In this instance, the file should contain the host IDs that the system requires to function even if the name server is not functioning.

The res_init subroutine is one of a set of subroutines that form the resolver, a set of functions that translate domain names to Internet addresses. All resolver subroutines use the /usr/include/resolv.h file, which defines the _res structure. The res_init subroutine stores domain name information in the _res structure. Three environment variables, LOCALDOMAIN, RES_TIMEOUT, and RES_RETRY, affect default values related to the _res structure.

For more information on the _res structure, see "Understanding Domain Name Resolution" in AIX Version 4.3 Communications Programming Concepts.

Implementation Specifics

The res_init subroutine is part of Base Operating System (BOS) Runtime.

All applications containing the res_init subroutine must be compiled with _BSD set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.

Files

/etc/resolv.conf
                          Contains the name server and domain name.
/etc/hosts
                          Contains host names and their addresses for hosts in a network. This file is used to resolve a host name into an Internet address.

Related Information

The dn_comp subroutine, dn_expand subroutine, _getlong subroutine, _getshort subroutine, putlong subroutine, putshort subroutine, res_mkquery subroutine, res_query subroutine, res_search subroutine, res_send subroutine.

Sockets Overview and Understanding Domain Name Resolution in AIX Version 4.3 Communications Programming Concepts.


[ Previous | Next | Contents | Glossary | Home | Search ]