setnetent_r()--Open Network Database
Syntax
#include <netdb.h>
int setnetent_r(int stay_open,
struct netent_data
*netent_data_struct_addr)
Service Program Name: QSOSRV2
Default Public Authority: *USE
Threadsafe: Yes
The setnetent_r() function is used in preparation for sequential
access to the network database file. The setnetent_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
getnetbyname_r() and getnetbyaddr_r(). A non-zero value will
result in the database file being left open.
- struct netent_data *netent_data_struct_addr
(input/output)
- Specifies the pointer to the netent_data structure, which is used to pass
and preserve results between function calls. The field net_control_blk in the
netent_data structure must be initialized with hexadecimal zeros before its
initial use. If compatibility with other platforms is required, then the entire
netent_data structure must be initialized with hexadecimal zeros before initial
use.
Authorities
No authorization is required.
Return Value
The setnetent_r() function returns a pointer. Possible values
are:
- -1 (unsuccessful call)
- 0 (successful call)
The struct netent_datadenoted by
netent_data_struct_addr is defined in
<netdb.h>.
Error Conditions
When the setnetent_r() function fails, errno can be set
to:
- [EINVAL]
The netent_data structure was not properly initialized to hexadecimal zeros before initial
use. For corrective action see the description for structure netent_data.
Usage Notes
The iSeries Navigator or the following CL commands can be
used to access the network database file:
- WRKNETTBLE (Work with Network Table Entries)
- ADDNETTBLE (Add Network Table Entry)
- RMVNETTBLE (Remove Network Table Entry)
Related Information
API introduced: V4R2