getipnodebyaddr (3) - Linux Manuals
getipnodebyaddr: get network
NAME
getipnodebyname, getipnodebyaddr, freehostent - get network hostnames and addresses
SYNOPSIS
#include <sys/types.h> #include <sys/socket.h> #include <netdb.h> struct hostent *getipnodebyname(const char *name, int af, int flags, int *error_num); struct hostent *getipnodebyaddr(const void *addr, size_t len, int af, int *error_num); void freehostent(struct hostent *ip);
DESCRIPTION
These functions are deprecated (and unavailable in glibc). Use getaddrinfo(3) and getnameinfo(3) instead.The getipnodebyname() and getipnodebyaddr() functions return the names and addresses of a network host. These functions return a pointer to the following structure:
struct hostent {
These functions replace the
gethostbyname(3)
and
gethostbyaddr(3)
functions, which could access only the IPv4 network address family.
The
getipnodebyname()
and
getipnodebyaddr()
functions can access multiple network address families.
Unlike the
gethostby
functions,
these functions return pointers to dynamically allocated memory.
The
freehostent()
function is used to release the dynamically allocated memory
after the caller no longer needs the
hostent
structure.
The
flags
argument specifies additional options.
More than one option can be specified by bitwise OR-ing
them together.
flags
should be set to 0
if no options are desired.
A successful query returns a pointer to a
hostent
structure that contains the following fields:
getipnodebyname() arguments
The
getipnodebyname()
function
looks up network addresses for the host
specified by the
name
argument.
The
af
argument specifies one of the following values:
getipnodebyaddr() arguments
The
getipnodebyaddr()
function
looks up the name of the host whose
network address is
specified by the
addr
argument.
The
af
argument specifies one of the following values:
RETURN VALUE
NULL is returned if an error occurred, and
error_num
will contain an error code from the following list:
CONFORMING TO
RFC 2553.
NOTES
These functions were present in glibc 2.1.91-95, but were
removed again.
Several UNIX-like systems support them, but all
call them deprecated.
COLOPHON
This page is part of release 5.10 of the Linux
man-pages
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
https://www.kernel.org/doc/man-pages/.