Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

bcs_cat(1)

protocols(4C)



getprotoent(3N)               4 BSD               getprotoent(3N)



NAME
     getprotoent, getprotobynumber, getprotobyname, setprotoent,
     endprotoent - get protocol entry

SYNOPSIS
     #include <netdb.h>

     struct protoent *getprotoent()

     struct protoent *getprotobyname(name)
     char *name;

     struct protoent *getprotobynumber(proto)
     int proto;

     setprotoent(stayopen)
     int stayopen

     endprotoent()

DESCRIPTION
     getprotoent, getprotobyname, and getprotobynumber each
     return a pointer to an object with the following structure
     containing the broken-out fields of a line in the network
     protocol data base, /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:

     p_name     The official name of the protocol.

     p_aliases  A zero terminated list of alternate names for the
                protocol.

     p_proto    The protocol number.

     CX supports both a proprietary version and an 88open  Object
     Compatibility Standard Networking Supplement (OCSNS) version
     of getprotobyname and getprotobynumber.  The OCSNS  versions
     of  these  functions check for the existence of the function
     /etc/bcs_cat and if it exists and has proper execute permis-
     sion,   will   issue   a   popen(3S)  call  of  the  command
     /etc/bcs_cat protocols.  If the file  does  not  exist,  the
     functions will access the /etc/protocols file.

     getprotoent reads the next line of the file  /etc/protocols,
     opening  the  file  if  necessary and returning a pointer to



Page 1                                           CX/UX Networking





getprotoent(3N)               4 BSD               getprotoent(3N)



     protoent structure containing the file entry.

     Setprotoent opens and rewinds the file  /etc/protocols.   If
     the stayopen flag is non-zero, the net data base will not be
     closed after each call to  getprotoent,  getprotobyname,  or
     getprotobynumber.

     Endprotoent closes the file /etc/protocols  and  clears  the
     stayopen flag.

     The functions getprotoent, setprotoent, and endprotoent  are
     defined  in  the  88open  OCSNS.  Their functionality is the
     same as described above.

     Both versions of getprotobyname and getprotobynumber sequen-
     tially  search from the beginning of the file until a match-
     ing protocol name or protocol number is found, or until  EOF
     is encountered.

NOTE
     The OCSNS versions  of  the  above  files  may  be  accessed
     through special OCS options passed to cc(1) and/or ld(1).

FILES
     /etc/protocols

SEE ALSO
     bcs_cat(1), protocols(4C)

DIAGNOSTICS
     Null pointer (0) returned on EOF or error.

BUGS
     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.



















Page 2                                           CX/UX Networking



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