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

OSS Library Calls (g - h) gethostbyaddr_r(3)
host Points to a struct hostent structure allocated by the caller.
buffer Points to the buffer supplied by the caller and used as a storage space for host
data.
buflen Specifies the size of the buffer passed in bytes. For H06.21 and later H-series
RVUs and J06.10 and later J-series RVUs, HP recommends that this buffer be at
least equal to the size of the hostent_data structure.
h_errnop Points to the integer h_errno to indicate the error code if an error occurs. For
the possible values that can be returned, see the ERRORS subsection of this
reference page. For H06.20 and earlier H-series RVUs and J06.09 and earlier J-
series RVUs, h_errno is a global integer.
DESCRIPTION
The gethostbyaddr_r( ) function is the reentrant version of the gethostbyaddr( ) function and
performs the same function. However, the gethostbyaddr_r( ) function uses buffers that are sup-
plied by the caller of the function to store returned results.
The host parameter must be a pointer to a struct hostent structure allocated by the caller. On
successful completion, the function returns the host entry in this structure. The buffer parameter
must be a pointer to a buffer supplied by the caller. This buffer is used as storage space for the
host data. All of the pointers within the returned struct hostent host point to data stored within
this buffer. See the RETURN VALUES section for more information. The buffer must be large
enough to hold all of the data associated with the host entry. For H06.21 and later H-series
RVUs and J06.10 and later J-series RVUs, HP recommends that the size of the buffer, indicated
by the buflen parameter, be equal or greater than the size of the hostent_data structure.
The hostent structure is defined in the netdb.h header file. All functions that return the hostent
structure must return the official (canonical) name of the host in the h_name field.
If multiple threads interleave calls to gethostbyname_r( ), gethostbyaddr_r( ), gethostent_r( )
and their base versions, the threads enumerate disjoint subsets of the hosts database.
NOTES
Use the endhostent( ) function to close the /etc/hosts file.
NonStop TCP/IPv6 searches for host information can be controlled by the environment variable
TCPIP_RESOLVER_ORDER, as described in the environ(5) reference page.
If you need to use DNS lookup using the Light Weight Resolver library, you can define the
LWRES macro as shown in the SYNOPSIS section, or you can use the
lwres_gethostbyaddr_r( ) function instead of this function.
On systems running H-series RVUs earlier than H06.21, J-series RVUs earlier than J06.10, or
G-series RVUs (native OSS processes only), follow the instructions for using the Standard
POSIX Threads library.
On systems running H06.21 or later H-series RVUs or J06.10 or later J-series RVUs, you can use
either the POSIX User Thread Model library or the Standard POSIX Threads library for threaded
applications.
On systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can use |
this function with 32-bit applications or 64-bit applications unless you are using the Standard |
POSIX Threads Library.
If you are NOT using the Standard POSIX Threads Library (this is not a threaded application or
you are using the POSIX User Thread Model Library), you must:
Include the netdb.h header file
527187-017 Hewlett-Packard Company 353