getprotoent()--Get Next Entry from Protocol Database


  Syntax
 #include <netdb.h>

 struct protoent *getprotoent()

  Service Program Name: QSOSRV2

  Default Public Authority: *USE

  Threadsafe: No; see Usage Notes.

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


Authorities

No authorization is required.


Return Value

getprotoent() returns a pointer. Possible values are:

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

      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 array of alternate names for the protocol. p_proto is the protocol number.


Usage Notes

  1. System i® Navigator or the following CL commands can be used to access the protocol database file:


  2. The pointer returned by getprotoent() points to static storage that is overwritten on subsequent calls to the getprotoent(), getprotobynumber(), or getprotobyname() 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 protocol names returned in the protoent structure, the job CCSID must be something other than 65535.

  4. Do not use the getprotoent() function in a multithreaded environment. See the multithread alternative getprotoent_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 getprotoent() API is mapped to qso_getprotoent98().

Related Information



API introduced: V4R2

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