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 Calls 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 data base, /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. The getprotoent call reads the next line of the /etc/protocols file, opening the file if necessary; the file remains open upon completion. If the Yellow Pages aren't running, both getprotobyname and getprotobynumber open the /etc/protocols 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 upon completion. Printed 3/13/89 1
GETPROTOENT(3N) COMMAND REFERENCE GETPROTOENT(3N) The setprotoent call opens and rewinds the /etc/protocols file. If the stayopen flag is nonzero, the protocol data base 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 /etc/yp/domainname/hosts.byaddr /etc/yp/domainname/hosts.byname The domainname is the name of your host (domain). 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), ypserv(8). Printed 3/13/89 2
%%index%% na:432,149; sy:581,2161; de:2742,2230;5476,818; fi:6294,355; di:6649,171; ca:6820,238; se:7058,175; %%index%%000000000133