#include <netdb.h> int getnetent_r(struct netent *netent_struct_addr, struct netent_data *netent_data_struct_addr)
The getnetent_r() function is used to retrieve network information from the network database file. When the getnetent_r() is first called, the file is opened, and the first entry is returned. Each subsequent call of getnetent_r() results in the next entry in the file being returned. To close the file, use endnetent_r().
No authorization is required.
The getnetent_r() function returns an integer. Possible values are:
The struct netent, denoted by netent_struct_addr and struct netent_datadenoted by netent_data_struct_addr are both defined in <netdb.h>. The structure struct netentis defined as:
struct netent [ char *n_name; char **n_aliases; int n_addrtype; unsigned long n_net; ];
n_name points to the character string that contains the name of the network. n_aliases is a pointer to a NULL-terminated list of pointers, each of which points to a character string that represents an alternative name for the network. n_addrtype contains the address type of the network (that is, AF_INET). n_net is the 32-bit network address (that is, an IP address in network byte order with host part set to zero).
When the getnetent_r() function fails, errno can be set to:
The netent_data structure was not properly initialized to hexadecimal zeros before initial use. For corrective action, see the description for structure netent_data.
Top | UNIX-Type APIs | APIs by category |