Index of Section 2 Manual Pages
| Interix / SUA | getprotoent.2 | Interix / SUA |
getprotoent(2) getprotoent(2)
getprotobynumber()
NAME
getprotobynumber(), getprotobyname(), getprotoent(), setprotoent(),
endprotoent() - get protocol entry
SYNOPSIS
#include
struct protoent * getprotobyname (const char *name)
struct protoent * getprotobynumber (int proto)
struct protoent * getprotoent (void)
void setprotoent (int stayopen)
void endprotoent (void)
DESCRIPTION
The getprotobyname(2) and getprotobynumber(2) functions each return a
pointer to an object with the following structure containing the
information from a network protocol database.
struct protoent {
char * p_name; /* official name of protocol */
char ** p_aliases; /* alias list */
int p_proto; /* protocol number */
};
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 getprotobyname(2) function and getprotobynumber(2) sequentially search
from the beginning of the file until a matching protocol name or protocol
number is found, or until EOF is encountered.
The getprotoent(2), setprotoent(2), and endprotoent(2) functions also deal
with the network database, but on an entry-by-entry basis. The
getprotoent(2) call reads the next line of the file, opening the file if
necessary. The setprotoent(2) call opens and rewinds the file. If the
stayopen flag is non-zero, the network database stays open after each call
to getprotobyname(2) or getprotobynumber(2). (The default action is to
close the database after these calls.) The endprotoent(2) call closes the
file.
RETURN VALUES
The functions getprotoent(2), getprotobyname(2), and getprotobynumber(2)
return pointers to protoent structures.
All of the function return NULL on failure.
NOTES
These functions use a static data space; if the data is needed for future
use, it should be copied before any subsequent calls overwrite it. Only
the Internet protocols are currently available.
The INTERIX sockets implementation is built around the Microsoft Winsock
DLL; to configure the protocols appropriately, see the documentation for
configuring your Windows network.
SEE ALSO
protocols(5)
USAGE NOTES
None of these functions are thread safe.
None of these functions are async-signal safe.