HP 3000 Manuals

GETPROTOENT [ Berkeley Sockets/iX Reference Manual ] MPE/iX 5.0 Documentation


Berkeley Sockets/iX Reference Manual

GETPROTOENT 

C Interface 

          #include <netdb.h>

          struct protoent *getprotoent()

          struct protoent *getprotobyname(name)
          char *name;

          struct protoent *getprotobynumber(proto)
          int proto;

          setprotoent(stayopen)
          int stayopen;

          endprotoent()

Description 

The getprotoent, getprotobyname, and getprotobynumber subroutines each
return a pointer to an object with the following structure.  This
structure contains fields found in the network protocol database,
/etc/protocols.

     struct    protoent {
          char *p_name;        /* official name of protocol */
          char **p_aliases;    /* alias list                */
          long p_proto;        /* protocol number           */
     };

The members of this structure are as follows:

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.

The getprotoent subroutine reads the next line of the file, opening the
file if necessary.

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

The endprotoent subroutine closes the file.

The getprotobyname and getprotobynumber subroutines sequentially search
from the beginning of the file until a protocol name matching the
parameter name or a protocol number matching the parameter proto is
found, or until EOF is encountered.

Restrictions 

All information is contained in a static area, so it must be copied if it
is to be saved.  Only the Internet protocols are currently understood.

Return Value 

The getprotoent, getprotobyname, and getprotobynumber subroutines
return a null pointer (0) on EOF or when they are unable to open
PROTOCOL.NET.SYS.

MPE/iX Specific 

The name of the protocols file on MPE/iX is PROTOCOL.NET.SYS, as opposed
to /etc/protocols on HP-UX.

Author 

UCB (University of California at Berkeley)

Files 

PROTOCOL.NET.SYS

See Also 

protocols



MPE/iX 5.0 Documentation