Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

OSS Library Calls (g - h) getprotobynumber(3)
NAME
getprotobynumber - Gets a protocol entry by number
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 <netdb.h>
struct protoent *getprotobynumber(
int num);
PARAMETERS
num Specifies the protocol number.
DESCRIPTION
The getprotobynumber( ) function searches the /etc/protocols file starting at the first entry until
a match with the num parameter is found.
The getprotobynumber( ) function returns a pointer to a structure of type protoent whose
members specify data from the /etc/protocols network protocols database file. The netdb.h
header file defines the protoent structure.
When using the getprotobynumber( ) function, use the endprotoent( ) function to close the pro-
tocols file.
NOTES
The getprotobynumber( ) function return value points to static data, which is overwritten by
subsequent calls to getprotobyname( ), getprotobynumber( ),orgetprotoent( ).
RETURN VALUES
Upon successful completion, the getprotobynumber( ) function returns a pointer to a protoent
structure if the entry was found, and a null pointer if the entry was not found. If the call to get-
protobynumber( ) fails, a null pointer is returned.
ERRORS
The getprotobynumber( ) function does not set errno.
FILES
/etc/protocols The Internet network protocols database file. Each record in the file occupies a
single line and has three fields: the protocol name, the protocol number, and pro-
tocol aliases.
RELATED INFORMATION
Functions: getprotobyname(3), getprotoent(3), setprotoent(3), endprotoent(3).
Files: protocols(4).
527187-017 Hewlett-Packard Company 3109