#include <netdb.h>
int getprotoent_r(struct protoent
*protoent_struct_addr,
struct protoent_data
*protoent_data_struct_addr)
The getprotoent_r() function is used to retrieve protocol information from the protocol database file. When the getprotoent_r() is first called, the file is opened, and the first entry is returned. Each subsequent call of getprotoent_r() results in the next entry in the file being returned. To close the file, use endprotoent_r().
No authorization is required.
The getprotoent_r() function returns an integer. Possible values are:
The struct protoent denoted by protoent_struct_addr and struct protoent_data denoted by protoent_data_struct_addr are both defined in <netdb.h>. The structure struct protoentis defined as:
struct protoent [
char *p_name;
char **p_aliases;
int p_proto;
];
p_name points to the character string that contains the name of the protocol. p_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 protocol. p_proto is the protocol number.
When the getprotoent_r() function fails, errno can be set to:
The protoent_data structure was not properly initialized with hexadecimal zeros before initial use. For corrective action, see the description for structure protoent_data.
| Top | UNIX-Type APIs | APIs by category |