Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getprotoent(3N) — HP-UX 9.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ypserv(1M)

protocols(4)

ypfiles(4)

getprotoent(3N)

NAME

getprotoent(), getprotobynumber(), getprotobyname(), setprotoent(), endprotoent() − get protocol entry

SYNOPSIS

#include <netdb.h>

struct protoent *getprotoent(void);

struct protoent *getprotobyname(const char *name);

struct protoent *getprotobynumber(int proto);

int setprotoent(int stayopen);

int endprotoent(void);

DESCRIPTION

getprotoent(), getprotobyname(), and getprotobynumber() each return a pointer to a structure of type protoent containing the broken-out fields of a line in the network protocol data base, /etc/protocols. 

The members of this structure are:

p_name The official name of the protocol. 

p_aliases A null-terminated list of alternate names for the protocol. 

p_proto The protocol number. 

Functions behave as follows:

getprotoent() Reads the next line of the file, opening the file if necessary. 

setprotoent() Opens and rewinds the file.  If the stayopen flag is non-zero, the protocol data base is not closed after each call to getprotoent() (either directly or indirectly through one of the other getproto* calls). 

endprotoent() Closes the file. 

getprotobyname()

getprotobynumber() Sequentially search from the beginning of the file until a matching protocol name (among either the official names or the aliases) or protocol number is found, or until EOF is encountered. 

If the system is running Network Information Service (NFS) services, getprotobyname() and getprotobynumber() get the host information from the NIS server (see ypserv(1M) and ypfiles(4)).

RETURN VALUE

getprotoent(), getprotobyname(), and getprotobynumber() return a null pointer (0) on EOF or when they are unable to open /etc/protocols. 

WARNINGS

All information is contained in a static area so it must be copied if it is to be saved. 

AUTHOR

getprotoent() was developed by the University of California, Berkeley. 

FILES

/etc/protocols

SEE ALSO

ypserv(1M), protocols(4), ypfiles(4). 

Hewlett-Packard Company  —  HP-UX Release 9.0: August 1992

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