getnetbyname_r()--Get Network Information for Domain Name


  Syntax
 #include <netdb.h>
 int getnetbyname_r(char *network_name,
                  struct netent *netent_struct_addr,
                  struct netent_data
                     *netent_data_struct_addr)

  Service Program Name: QSOSRV2

  Default Public Authority: *USE

  Threadsafe: Yes

The getnetbyname_r() function is used to retrieve information about a network. The information is retrieved from the network database file.


Parameters

char *network_name  (input/output) 
Specifies the pointer to the character string that contains the name of the network for which information is to be retrieved.

struct netent *netent_struct_addr  (input/output) 
Specifies the pointer to a netent structure where the results will be placed. All results must be referenced through this structure.

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 initialized with hexadecimal zeros before initial use.

Authorities

No authorization is required.


Return Value

The getnetbyname_r() function returns an integer. Possible values are:

The struct netent denoted by netent_struct_addr and struct netent_datadenoted by netent_data_struct_addr are both defined in <netdb.h>. The structure struct netentis defined as:

      struct netent [
        char            *n_name;
        char            **n_aliases;
        int             n_addrtype;
        unsigned long   n_net;
      ];

n_name points to the character string that contains the name of the network. n_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 network. n_addrtype contains the address type of the network (that is, AF_INET). n_net is the 32-bit network address (that is, an IP address in network byte order with host part set to zero).


Error Conditions

When the getnetbyname_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

  1. The iSeries Navigator or the following CL commands can be used to access the network database file:


  2. When the network information is obtained from the network database file, the file is opened and the network information is retrieved (if it exists) from the file. The file is then closed only if a setnetent_r() call with a non-zero parameter value was not previously done.

  3. A coded character set identifier (CCSID) of 65535 for the job requests that no database translation be performed. For translation to occur for the network name specified by the network_name parameter, and for the network names returned in the netent structure, the job CCSID must be something other than 65535.

Related Information



API introduced: V3R1
Top | UNIX-Type APIs | APIs by category