getprotoent_r()--Get Next Entry from Protocol Database
Syntax
#include <netdb.h>
int getprotoent_r(struct protoent
*protoent_struct_addr,
struct protoent_data
*protoent_data_struct_addr)
Service Program Name: QSOSRV2
Default Public Authority: *USE
Threadsafe: Yes
The getprotoent_r() function is used to retrieve protocol
information from the protocol database file. When the getprotoent_r()
is first called, the file is opened, and the first entry is returned. Each
subsequent call of getprotoent_r() results in the next entry in the
file being returned. To close the file, use endprotoent_r().
Parameters
- struct protoent *protoent_address
(input/output)
- Specifies the pointer to a protoent structure where the results will be
placed. All results must be referenced through this structure.
- struct protoent_data *protoent_data_struct_addr
(input/output)
- Specifies the pointer to the protoent_data structure, which is used to pass
and preserve results between function calls. The field proto_control_blk in the
protoent_data structure must be initialized with hexadecimal zeros before its
initial use. If compatibility with other platforms is required, then the entire
protoent_data structure must be initialized with hexadecimal zeros before
initial use.
Authorities
No authorization is required.
Return Value
The getprotoent_r() function returns an integer. Possible values
are:
- -1 (unsuccessful call)
- 0 (successful call)
The struct protoent denoted by
protoent_struct_addr and struct
protoent_data denoted by
protoent_data_struct_addr are both defined in
<netdb.h>. The structure struct
protoentis defined as:
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 list of
pointers, each of which points to a character string that represents an
alternative name for the protocol. p_proto is the protocol number.
Error Conditions
When the getprotoent_r() function fails, errno can be set
to:
- [EINVAL]
The protoent_data structure was not properly
initialized with hexadecimal zeros before initial use. For corrective action,
see the description for structure protoent_data.
Usage Notes
- 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)
- 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.
Related Information
API introduced: V3R1