NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | FILES | DIAGNOSTICS | ATTRIBUTES | SEE ALSO | BUGS
$(OS_DIR)/lib/libc.a #include <netdb.h>struct netent * getnetent(void);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
The getnetent() , getnetbyname() , and getnetbyaddr() functions each return a pointer to an object containing the broken-out fields of a line in the network data base /etc/networks . The object has the following structure:
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 members of this structure are:
The official name of the network.
A zero terminated list of alternate names for the network.
The type of the network number returned; currently only AF_INET.
The network number. Network numbers are returned in machine byte order.
The getnetent() function reads the next line of the file, opening the file if necessary.
The setnetent() function opens and rewinds the file. If the stayopen flag is non-zero, the net data base is not closed after each call to getnetbyname() or getnetbyaddr() .
The endnetent() function closes the file.
The getnetbyname() and getnetbyaddr() functions sequentially search from the beginning of the file until a matching net name or net address and type is found, or until EOF is encountered. Network numbers are supplied in host order.
/etc/networks
A null pointer (0) is returned when EOF or an error is encountered.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
The data space used by these functions is static; if the data will be required in the future, it should be copied before any subsequent calls to these functions overwrite it. Only Internet network numbers are currently understood.
NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | FILES | DIAGNOSTICS | ATTRIBUTES | SEE ALSO | BUGS