COHERENT manpages
This page displays the COHERENT manpage for getnetbyaddr() [Get a network entry by address].
List of available manpages
Index
getnetbyaddr() -- Sockets Function (libsocket)
Get a network entry by address
#include <netdb.h>
struct netent *getnetbyaddr(network, type)
long network; int type;
getnetbyaddr() fetches a network entry. It opens and searches file
/etc/network, which describes all entities on your local network, for the
entry with address. /etc/networks must have been opened by function
setnetent(). type is the type of network; at present, getnetbyaddr()
recognizes only type AF_INET.
getnetbyaddr() returns a pointer to an object of type netend, which is
defined in header file <netdb.h>:
struct netent {
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net number type */
unsigned long n_net; /* net number */
};
The following describes the members:
n_name
The official name of the network.
n_aliases
This points to a zero-terminated list of alternate names for the
network.
n_addrtype
The type of the network number returned; currently, only type AF_INET
is recognized.
n_net
The network's number. Network numbers are returned in the machine's
byte order.
getnetent() returns a pointer to the netent structure it built. It returns
NULL if something went wrong or if it cannot find an entry with address.
See Also
endnetent(),
getnetent(),
getnetbyname(),
libsocket,
netdb.h,
setnetent()