setprotoent_r()--Open Protocol Database
Syntax
#include <netdb.h>
int setprotoent_r(int stay_open,
struct protoent_data *protoent_data_struct_addr)
Service Program Name: QSOSRV2
Default Public Authority: *USE
Threadsafe: Yes
The setprotoent_r() function is used in preparation for sequential
access to the protocol database file. The setprotoent_r() function
opens the file and repositions the file marker to the beginning of the
file.
Parameters
- int stay_open (input)
- Specifies whether to leave the database file open after each call to
getprotobynumber_r() and getprotobyname_r(). A non-zero value
will result in the database file being left open.
- 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 setprotoent_r() returns an integer. Possible values are:
- -1 (unsuccessful call)
- 0 (successful call)
The struct protoent_data denoted by
protoent_data_struct_addr is defined in
<netdb.h>.
Error Conditions
When the setprotoent_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)
Related Information
API introduced: V4R2