getprotobynumber()--Get Protocol Information for Protocol Number
Syntax
#include <netdb.h>
struct protoent
*getprotobynumber(int protocol_number)
Service Program Name: QSOSRV2
Default Public Authority: *USE
Threadsafe: No; see
Usage Notes.
The getprotobynumber() function is used to retrieve information
about a protocol. The information is retrieved from the protocol database
file.
Parameters
- protocol_number
- (Input) The protocol number for which information is to be retrieved.
Authorities
No authorization is required.
Return Value
getprotobynumber() returns a pointer. Possible values are:
- NULL (unsuccessful)
- p (successful), where p is a pointer to struct
protoent.
The structure struct protoent is defined in
<netdb.h>.
struct protoent {
char *p_name;
char **p_aliases;
int p_proto;
};
p_name points to the character string that contains the name of the
protocol. p_aliases is a pointer to a NULL-terminated array of
alternate names for the protocol. p_proto is the protocol number.
- The iSeries Navigator or the
following CL commands can be
used to access the protocol database file:
- WRKPCLTBLE (Work with Protocol Table Entries)
- ADDPCLTBLE (Add Protocol Table Entry)
- RMVPCLTBLE (Remove Protocol Table Entry)
- The pointer returned by getprotobynumber() points to static
storage that is overwritten on subsequent calls to the
getprotobynumber(), getprotobyname(), or
getprotoent() functions.
- When the protocol information is obtained from the protocol database file,
the file is opened and the protocol information is retrieved (if it exists)
from the file. The file is then closed only if a setprotoent() with a
nonzero parameter value was not previously done.
- A coded character set identifier (CCSID) of 65535 for the job requests that
no database translation be performed. For translation to occur for the protocol
names returned in the protoent structure, the job CCSID must be something other
than 65535.
- Do not use the getprotobynumber() function in a multithreaded
environment. See the multithread alternative getprotobynumber()
function.
- When you develop in C-based
languages and an application is compiled with the _XOPEN_SOURCE macro defined
to the value 520 or greater, the getprotobynumber() API is mapped to
qso_getprotobynumber98().
Related Information
API introduced: V4R2