Open System Services Library Calls Reference Manual (G06.28+, H06.05+)

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
H-series OSS processes: /G/system/zdllnnn/zinetdll
SYNOPSIS
#include <netdb.h>
struct protoent *getprotobynumber(
int num);
PARAMETERS
num Species the protocol number.
DESCRIPTION
The getprotobynumber() function searches the /etc/protocols le starting at the rst 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 le. The netdb.h
header le denes the protoent structure.
When using the getprotobynumber( ) function, use the endprotoent( ) function to close the pro-
tocols le.
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 le. Each record in the le occupies a
single line and has three elds: 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-007 Hewlett-Packard Company 363