getprotobyname(3) — Subroutines
OSF — Environment_Note_Added
NAME
getprotobyname − Gets protocol entry by protocol name
LIBRARY
Sockets Library (libc.a)
SYNOPSIS
#include <netdb.h>
struct protoent ∗getprotobyname (
char ∗name );
PARAMETERS
nameSpecifies the official protocol name or alias.
DESCRIPTION
The getprotobyname() 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 getprotobyname() function searches the protocols file sequentially until a match with the name parameter occurs. The name parameter may specify either the official protocol name or an alias. 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 when 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: getprotobynumber(3), getprotoent(3), setprotoent(3), endprotoent(3)