Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
OSS Library Calls (g - h) getprotoent(3)
NAME
getprotoent - Gets the next protocol entry
LIBRARY
G-series native OSS processes: /G/system/sysnn/zinetsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zinetdll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yinetdll |
SYNOPSIS
[#include <sys/socket.h>]
#include <netdb.h>
struct protoent *getprotoent(void);
PARAMETERS
None.
DESCRIPTION
The getprotoent( ) (get protocol entry) function retrieves the next entry from /etc/protocols, the
network protocol database.
The getprotoent( ) function returns a pointer to a protoent structure, whose members contain
information from the /etc/protocols file. The netdb.h header file defines the protoent structure.
An application program can use the getprotoent( ) function to access a protocol name, its aliases,
and protocol number. Use the endprotoent( ) function to close the /etc/protocols file.
If multiple threads interleave calls to getprotobyname_r( ), getprotobynumber_r( ),
getprotoent_r( ) and their base versions, the threads enumerate disjoint subsets of the protocol
database.
NOTES
In a threaded environment, the behavior of the application is undetermined if more than one
thread in application is calling different sequences of the setprotoent( ), getprotoent( ),
getprotoent_r( ), getprotobyname( ), getprotobyname_r( ), or endprotoent( ) functions.
The getprotoent( ) function return value points to static data, which is overwritten by any subse-
quent calls to getprotobyname( ), getprotobynumber( ),orgetprotoent( ).
RETURN VALUES
Upon successful completion, the getprotoent( ) function returns a pointer to a protoent structure
if an entry was found, and a null pointer if the end of the file was reached. If the call to getpro-
toent( ) fails, a null pointer is returned.
ERRORS
The getprotoent( ) function does not set errno.
FILES
/etc/protocols The Internet network protocols database. Each record in the file occupies a sin-
gle line and has three fields: the protocol name, the protocol number, and proto-
col aliases.
RELATED INFORMATION
Functions: getprotobynumber(3), getprotobyname(3), setprotoent(3), endprotoent(3).
Files: protocols(4), thread_safety(5).
527187-017 Hewlett-Packard Company 3−113