getnetent()--Get Next Entry from Network Database


  Syntax
 #include <netdb.h>

 struct netent *getnetent()

  Service Program Name: QSOSRV2

  Default Public Authority: *USE

  Threadsafe: No; see Usage Notes.

The getnetent() function is used to retrieve network information from the network database file. When getnetent() is first called, the file is opened, and the first entry is returned. Each subsequent call to getnetent() results in the next entry in the file being returned. To close the file, use endnetent().


Authorities

No authorization is required.


Return Value

getnetent() returns a pointer. Possible values are:

The structure struct netent is defined in <netdb.h>.

      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 array of alternate names for the network. n_addrtype contains the address type of the network. n_net is the 32-bit network address (an IP address with host part set to zero).


Usage Notes

  1. System i® Navigator or the following CL commands can be used to access the network database file:
  2. The pointer returned by getnetent() points to static storage that is overwritten on subsequent calls to the getnetent(), getnetbyaddr(), or getnetbyname() functions.

  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 names returned in the netent structure, the job CCSID must be something other than 65535.

  4. Do not use the getnetent() function in a multithreaded environment. See the multithread alternative getnetent_r() function.

  5. 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 getnetent() API is mapped to qso_getnetent98().

Related Information



API introduced: V3R1

[ Back to top | UNIX-Type APIs | APIs by category ]