HP-UX Reference (11i v1 00/12) - 3 Library Functions A-M (vol 6)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/!!!intro.3c
________________________________________________________________
___ ___
g
gethostent(3N) gethostent(3N)
Name Service Switch-Based Operation
These host entry library routines internally call the name service switch to access the "hosts" database
lookup policy configured in the /etc/nsswitch.conf file (see nsswitch.conf(4)). The lookup policy
defines the order and the criteria of the supported name services used to resolve host names and Internet
addresses. The operations of these name services: Domain Name Server, NIS, NIS+, and nonserver mode
(e.g., files) are listed below.
Domain Name Server Operation
If the local system is configured to use the named name server (see named(1M) and resolver(4)) for name
or address resolution, then the function:
gethostent() Always returns a NULL pointer.
sethostent() Requests the use of a connected stream socket for queries to the name server
if the stayopen flag is non-zero. The connection is retained after each call to
gethostbyname() or gethostbyaddr().
endhostent() Closes the stream socket connection.
gethostbyname()
gethostbyaddr()
Each retrieves host information from the name server. Names are matched
without respect to uppercase or lowercase. For example,
berkeley.edu ,
Berkeley.EDU , and BERKELEY.EDU all match the entry for
berkeley.edu .
NIS Server Operation
If ypserv, the server for the Network Information Service (see ypserv(1M)), is used for name or address
resolution, then the function:
gethostent() Returns the next entry in the NIS database.
sethostent() Initializes an internal key for the NIS database. If the stayopen flag is non-
zero, the internal key is not cleared after calls to endhostent() .
endhostent() Clears the internal NIS database key.
gethostbyname()
gethostbyaddr()
Each retrieves host information from the NIS database. Names are matched
without respect to uppercase or lowercase. For example,
berkeley.edu ,
Berkeley.EDU , and BERKELEY.EDU all match the entry for
berkeley.edu .
NIS Plus Server Operation
If rpc.nisd, the server for the Network Information Service Plus (see nis+(1)), is used for name or
address resolution, then the function:
gethostent() Returns the next entry in the NIS+ database.
sethostent() Initializes an internal key for the NIS+ database. If the stayopen flag is non-
zero, the internal key is not cleared after calls to endhostent() .
endhostent() Clears the internal NIS+ database key.
gethostbyname()
gethostbyaddr()
Each retrieves host information from the NIS+ database. Names are
matched without respect to uppercase or lowercase. For example,
berkeley.edu , Berkeley.EDU , and BERKELEY.EDU all match the
entry for berkeley.edu .
Nonserver Operation
If the /etc/hosts file is used for name or address resolution, then the function:
gethostent() Reads the next line of /etc/hosts , opening the file if necessary.
sethostent() Opens and rewinds the file. If the stayopen flag is non-zero, the host data
base is not closed after each call to gethostent() (either directly or
indirectly through one of the other gethost calls).
endhostent() Closes the file.
HP-UX Release 11i: December 2000 2 Section 3303
___
___