GETPROTOENT(3N) — Series 300 and 800 Only
NAME
getprotoent, getprotobynumber, getprotobyname, setprotoent, endprotoent − get protocol entry
SYNOPSIS
#include <netdb.h>
struct protoent *getprotoent()
struct protoent *getprotobyname(name)
char *name;
struct protoent *getprotobynumber(proto)
int proto;
setprotoent(stayopen)
int stayopen
endprotoent()
DESCRIPTION
Getprotoent, getprotobyname, and getprotobynumber each return a pointer to a structure of type protoent containing the broken-out fields of a line in the network protocol data base, /etc/protocols.
The members of this structure are:
p_name The official name of the protocol.
p_aliases A null-terminated list of alternate names for the protocol.
p_proto The protocol number.
Getprotoent reads the next line of the file, opening the file if necessary.
Setprotoent opens and rewinds the file. If the stayopen flag is non-zero, the protocol data base will not be closed after each call to getprotoent (either directly or indirectly through one of the other “getproto” calls).
Endprotoent closes the file.
Getprotobyname and getprotobynumber sequentially search from the beginning of the file until a matching protocol name (among either the official names or the aliases) or protocol number is found, or until EOF is encountered.
If the system is running Yellow Pages (NFS), getprotobyname and getprotobynumber get the host information from the YP server. See ypserv(1M) and ypfiles(4).
RETURN VALUE
Getprotoent, getprotobyname and getprotobynumber return a null pointer (0) on EOF or when they are unable to open /etc/protocols.
WARNINGS
All information is contained in a static area so it must be copied if it is to be saved.
DEPENDENCIES
Implemented on the Series 300 and 800 only.
AUTHOR
UCB (University of California at Berkeley)
FILES
/etc/protocols
SEE ALSO
ypserv(1M), protocols(4), ypfiles(4).
INTERNATIONAL SUPPORT
8-bit data, messages.
Hewlett-Packard Company — May 11, 2021