Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

lwres_gethostbyaddr(3) OSS Library Calls Reference Manual
NAME
lwres_gethostbyaddr - Gets the name of the host with the specified Internet address and 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_gethostbyaddr(
const void *addr,
size_t len,
int type);
PARAMETERS
addr Points to the Internet address of the host whose name is to be found. The address
pointed to is in binary format and network order. (This address is in the same
format and order as the return value of the inet_addr( ) function.)
len Is the length of the Internet address pointed to by the returned pointer.
type Is the type of address specified. It is either AF_INET (IPv4) or AF_INET6
(IPv6).
DESCRIPTION
The lwres_gethostbyaddr( ) function gets the name of the host with the specified Internet
address and address family. This function provides the same information as the gethostbyaddr( )
function but uses the Domain Name System (DNS) lightweight resolver server lresd instead of
the named DNS server.
EXAMPLE
char *addr;
int len, type;
struct hostent *hp;
hp = lwres_gethostbyaddr(addr, len, type);
The above example makes a call to lwres_gethostbyaddr( ) by passing the Internet address as an
argument. 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.
NOTES
The address that is returned can be directly used in a sockaddr_in structure. The address is in
network order.
RETURN VALUES
Upon successful completion, the lwres_gethostbyaddr( ) function points to a structure (based on
the hostent structure) in which information on the specified host is returned. The information
includes the ofcial name, aliases, and addresses for the host. If the lookup fails, NULL is
returned, and the external variable lwres_h_errno is set as indicated in the ERRORS section of
this reference page.
4158 Hewlett-Packard Company 527187-017