GETPROTOENT(3N) COMMAND REFERENCE GETPROTOENT(3N)
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 an object with the following structure
containing the broken-out fields of a line in the network
protocol database, /etc/protocols.
struct protoent {
char *p_name; /* official protocol name */
char **p_aliases; /* alias list */
int p_proto; /* protocol # */
};
The members of this structure are:
p_name The official name of the protocol.
p_aliases A zero 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. The file remains open upon completion.
Getprotobyname and getprotobynumber open the file, if
necessary, then sequentially search from the beginning of
the file until a matching protocol name or protocol number
is found, or until EOF is encountered. The file is closed
Printed 10/17/86 1
GETPROTOENT(3N) COMMAND REFERENCE GETPROTOENT(3N)
upon completion.
Setprotoent opens and rewinds the file. If the stayopen
flag is nonzero, the protocol database will not be closed by
subsequent calls to endprotoent (either directly, or
indirectly through one of the other getproto calls).
Endprotoent closes the file.
FILES
/etc/protocols
DIAGNOSTICS
Null pointer (0) returned on EOF or error.
CAVEATS
All information is contained in a static area so it must be
copied if it is to be saved. Only the Internet protocols
are currently understood.
SEE ALSO
protocols(5n).
Printed 10/17/86 2
%%index%%
na:72,133;
sy:205,1401;
de:1606,1686;3436,609;
fi:4045,81;
di:4126,127;
ca:4253,214;
se:4467,123;
%%index%%000000000131