HP-UX Reference (11i v1 00/12) - 3 Library Functions A-M (vol 6)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/!!!intro.3c
________________________________________________________________
___ ___
g
getnetent(3N) getnetent(3N)
NAME
getnetent(), getnetbyaddr(), getnetbyname(), setnetent(), endnetent()- get network entry
SYNOPSIS
#include <sys/socket.h>
#include <netdb.h>
struct netent *getnetent(void);
struct netent *getnetbyname(const char *name);
struct netent *getnetbyaddr(int net, int type);
_XOPEN_SOURCE_EXTENDED only
struct netent *getnetbyaddr(in_addr_t net, int type);
int setnetent(int stayopen);
int endnetent(void);
_XOPEN_SOURCE_EXTENDED only
void setnetent(int stayopen);
void endnetent(void);
MULTITHREAD USAGE
Thread Safe: Yes
Cancel Safe: Yes
Async-cancel Safe: No
Async-signal Safe: No
These functions can be called safely in a multithreaded environment. They may be cancellation points in
that they call functions that are cancel points.
DESCRIPTION
getnetent() , getnetbyname(), and
getnetbyaddr() each return a pointer to a structure of
type netent containing the broken-out fields of a line in the network data base,
/etc/networks
.
The members of this structure are:
n_name The official name of the network.
n_aliases A null-terminated list of alternate names for the network.
n_addrtype The type of the network number returned; always AF_INET.
n_net The network number.
Functions behave as follows:
getnetent() Reads the next line of the file, opening the file if necessary.
setnetent() Opens and rewinds the file. If the stayopen flag is non-zero, the network data
base is not closed after each call to getnetent() (either directly or
indirectly through one of the other getnet* calls).
endnetent() Closes the file.
getnetbyname() Sequentially searches from the beginning of the file until a network name
(among either the official names or the aliases) matching its parameter name
is found, or untilEOF is encountered.
getnetbyaddr() Sequentially searches from the beginning of the file until a network number
matching its parameter net is found, or untilEOF is encountered. The parame-
ter net must be in network order. The parameter type must be the constant
AF_INET. Network numbers are supplied in host order (see byteorder(3N)).
If the system is running Network Information Service (NFS), getnetbyname() and getnetbyaddr()
obtain their network information from the NIS server (see ypserv(1M) and ypfiles(4)) or NIS+ server (see
nis+(1)) ,respectively.
HP-UX Release 11i: December 2000 1 Section 3315
___
___