Open System Services System Calls Reference Manual (G06.28+, H06.05+)

System Functions (f - i) getnetbyaddr_r(2)
NAME
getnetbyaddr_r - Gets a network entry by address (reentrant)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <sys/socket.h>]
[#include <netdb.h>]
#include <spthread.h>
struct netent *getnetbyaddr_r (
in_addr_t num,
int type,
struct netent *ret,
char *buffer,
int buen
);
PARAMETERS
num Species the number of the network in host-byte order.
type Species the Internet domain address format; you must use the value AF_INET
or AF_INET6.
ret Points to a struct netent structure allocated by the caller.
buffer Points to the buffer supplied by the caller and used as a storage space for
returned data.
buflen Species the size of the buffer passed in bytes.
DESCRIPTION
The getnetbyaddr_r() function is the reentrant version of the getnetbyaddr() function.
The getnetbyaddr_r() function searches the /etc/networks le sequentially until a match with
the num and type parameters is found.
The getnetbyaddr_r() function returns a pointer to a structure of type netent whose members
specify data from the /etc/networks network name database le. The netdb.h header le denes
the netent structure.
The getnetbyaddr_r() function updates the netent structure pointed to by the ret parameter.
Storage referenced by the netent structure is allocated from the memory provided using the
buffer parameter, which is buen characters in size.
RETURN VALUES
Upon successful completion, the getnetbyaddr_r() function returns a pointer to a netent struc-
ture if the address was found, and a null pointer if the address was not found. If the call to
getnetbyaddr_r( ) fails, a null pointer is returned.
ERRORS
If this condition occurs, the getnetbyaddr_r() function sets errno to the corresponding value:
[ERANGE] Insufcient storage was supplied via buffer and buen to contain the data to be
referenced by the resulting netent structure.
527186-007 Hewlett-Packard Company 383