Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getprotobynumber(3) — OSF/1 SILVER Baselevel 4 rev36

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getprotobyname(3)

getprotoent(3)

setprotoent(3)

endprotoent(3)

getprotobynumber(3)  —  Subroutines

OSF  —  Environment_Note_Added

NAME

getprotobynumber − Gets a protocol entry by number

LIBRARY

Sockets Library (libc.a)

SYNOPSIS

#include <netdb.h> struct protoent ∗getprotobynumber (
int proto );

PARAMETERS

protoSpecifies the protocol number. 

DESCRIPTION

The getprotobynumber() function returns a pointer to a structure of type protoent. Its members specify data in fields from a record line in the /etc/protocols network protocols database file. The netdb.h header file defines the protoent structure. 

The getprotobynumber() function searches the protocol file sequentially until a match with the proto parameter occurs. The proto parameter must specify the official protocol number. When EOF (End-Of-File) is reached without a match, an error value is returned by this function. 

Use the endprotoent() function to close the protocols file. 

NOTES

The return value points to static data, which is overwritten by any subsequently called functions using the same structure. 

RETURN VALUES

Upon successful completion, a pointer to a protoent structure is returned.  A null pointer is returned when an error occurs or whenever the end of the protocols file is reached. 

FILES

/etc/protocols
The DARPA Internet network protocols name database. Each record in the file occupies a single line and has three fields consisting of the official protocol name, protocol number, and protocol alias.

ENVIRONMENT NOTES

This section describes system features that are not generic to OSF/1 but that are provided in this OSF/1 implementation. 

Digital Extensions

The system searches either the local /etc/protocols file or the NIS distributed networks file for the requested information.  To determine which file or files to search, and in which order, the system uses the switches in the /etc/svc.conf file. 
 

RELATED INFORMATION

Functions: getprotobyname(3), getprotoent(3), setprotoent(3), endprotoent(3)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026