Description |
|
The getprotoent,
getprotobyname, and getprotobynumber subroutines
each return a pointer to an object with the following structure. This
structure contains fields found in the network protocol database,
/etc/protocols.
struct protoent {
char *p_name; /* official name of protocol */
char **p_aliases; /* alias list */
long p_proto; /* protocol number */
};
|
The members of this structure are as follows:
- 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.
The getprotoent subroutine reads the next line of the file,
opening the file if necessary.
The setprotoent subroutine opens and rewinds the file. If
the stayopen flag is non-zero, the protocol database is not
closed after each call to getprotoent (either directly
or indirectly through one of the other getproto calls).
The endprotoent subroutine closes the file.
The getprotobyname and getprotobynumber subroutines
sequentially search from the beginning of the file until a protocol
name matching the parameter name or a protocol number matching
the parameter proto is found, or until EOF is encountered.
Return Value |
|
The getprotoent, getprotobyname, and getprotobynumber
subroutines return a null pointer (0) on EOF or when they are unable
to open PROTOCOL.NET.SYS.