Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
lwres_gethostbyname2(3) OSS Library Calls Reference Manual
NAME
lwres_gethostbyname2 - Gets an Internet host entry by name and IPv4 or IPv6 address family
LIBRARY
G-series native OSS processes: /G/system/sysnn/zinetsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zinetdll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yinetdll |
SYNOPSIS
#include <netdb.h>
extern lwres_h_errno;
struct hostent *lwres_gethostbyname2(
const char *name,
int af);
PARAMETERS
name Points to either the official name or an alias of the host whose Internet address is
to be found.
af Specifies the address family searched for and returned by the function. Valid
values are AF_INET (IPv4) or AF_INET6 (IPv6).
DESCRIPTION
The lwres_gethostbyname2( ) function searches host entries sequentially until a match with the
value pointed to by the name parameter occurs. This function provides the same information as
the gethostbyname2( ) function but uses the Domain Name System (DNS) lightweight resolver
server lwresd instead of the named DNS server.
The lwres_gethostbyname2( ) function returns a pointer to a structure of type hostent whose
members specify data obtained from a name server specified in the /etc/resolv.conf file or from
fields of a record line in the /etc/hosts network hostname database file. (When the name server is
not running and /etc/resolv.conf can not be searched, this function searches the /etc/hosts name
file.)
The <netdb.h> header file defines the hostent structure.
EXAMPLE
This example makes a call to lwres_gethostbyname2( ) by passing the host name and address
family as arguments. If an answer is found, a pointer to the hostent structure is returned and
stored in hp. NULL is returned if no answer is found.
int af;
char *name;
struct hostent *hp;
hp = lwres_gethostbyname2(name, af);
NOTES
The name value passed to the lwres_gethostbyname2( ) function is case-sensitive.
The hostent structure is statically declared. Subsequent calls to lwres_gethostbyname2( )
replace the existing data in the hostent structure.
RETURN VALUES
Upon successful completion, lwres_gethostbyname2( ) returns a pointer to a structure (based on
the hostent structure) in which information on the specified host is returned. The information
includes the official name, aliases, and addresses for the host.
If the call to lwres_gethostbyname2( ) fails, a null pointer is returned.
4−160 Hewlett-Packard Company 527187-017