home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / c-kermit / ckvlcmu.txt < prev    next >
Text File  |  2020-01-01  |  22KB  |  743 lines

  1.  
  2. $!+
  3. $! FACILITY: LIBCMU
  4. $!
  5. $! Abstract:
  6. $!     Creates LIBCMU.DOC by extracting comments from LIBCMU.C  Output from
  7. $! procedure shoud be redirected to a file using the /OUTPUT qualifier.
  8. $!
  9. $! v1.0.0
  10. $!     8-DEC-1993 Mike O'Malley, 1956
  11. $!        creator -- it's alive!
  12. $!-
  13. $ v = f$verify(0)
  14.  LIBCMU, Copyright (C) 1993,1994 by Mike O'Malley
  15.  
  16.  This library is free software; you can redistribute it and/or
  17.  modify it under the terms of the GNU Library General Public
  18.  License as published by the Free Software Foundation; either
  19.  version 2 of the License, or (at your option) any later version.
  20.  
  21.  This library is distributed in the hope that it will be useful,
  22.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  23.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  24.  Library General Public License for more details.
  25.  
  26.  You should have received a copy of the GNU Library General Public
  27.  License along with this library; if not, write to the Free
  28.  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  29.  
  30.  
  31.  Facility:    LIBCMU
  32.  
  33.  Abstract:    Socket interface routines for CMU-OpenVMS/IP v6.6
  34.  
  35.  Module Description:
  36.     This collection of routines provides the standard `C' programming
  37.  interface CMU-OpenVMS/IP network transport.
  38.  
  39.  Routine provided:
  40.     int socket(int domain, int type, int protocol)
  41.     int bind(int s, struct sockaddr *name, int namelen)
  42.     int connect(int s, struct sockaddr *name, int namelen)
  43.     int listen (int s, int backlog)
  44.     int accept(int s, struct sockaddr *addr, int *addrlen)
  45.     int recv(int s, char *buf, int len, int flags)
  46.     int recvfrom(int s, char *buf, int len, int flags,
  47.             struct sockaddr *from, int *fromlen)
  48.     int send(int s, char *msg, int len, int flags)
  49.     int sendto(int s, char *msg, int len, int flags, 
  50.             struct sockaddr *to, int tolen)
  51.     int shutdown(int s, int how)
  52.  
  53.     int select(int nfds, int *readfds, int *writefds, int *execptfds,
  54.             struct timeval *timeout)
  55.  
  56.     int getsockname(int s, struct sockaddr *name, int *namelen)
  57.     int getpeername(int s, struct sockaddr *name, int *namelen)
  58.     int getsockopt(int s, int level, int optname,
  59.             char *optval, int *optlen)
  60.     int setsockopt(int s, int level, int optname,
  61.             char *optval, int *optlen)
  62.  
  63.     int gethostname(char *name, int namelen)
  64.     struct servent *getservbyname(char *name, char *proto)
  65.     struct servent *getservbyport(int port, char *proto)
  66.     struct hostent *gethostbyname(char *name)
  67.     struct hostent *gethostbyaddr(char *addr, int len, int type)
  68.  
  69.     int ioctl(int s, int request, char *argp)
  70.     int fcntl(int s, int request, int arg)
  71.  
  72.  The following routines were named to prevent conflict with routine names
  73.  in the VAXCRTL:
  74.     int cmu_read(int s, char *buf, int len)
  75.     int cmu_write(int s, char *msg, int len, int flags)
  76.     int cmu_close(int s)
  77.  
  78.  The following routines may be called from outside this library:
  79.     int *cmu_stdin_open(char *name)
  80.     int cmu_stdin_read(flags,buf,len,prompt,mask)
  81.     int cmu_get_sdc(int s)
  82.     int cmu_trnlnm(char *table, char *name, char *mode, char *buff)
  83.     int cmu_get_errno(NetIO_Status_Block *iosb)
  84.  
  85.  The following routines should not be accessed outside this library:
  86.     int cmu_listen_accept(int s)
  87.     int cmu_queue_listen(int s)
  88.     int cmu_read_ast(int s)
  89.     int cmu_write_ast(int s)
  90.     int cmu_queue_net_read(int s)
  91.  
  92.  Acknowledgements:
  93.     Guidence, concepts, examples derived from the works of:
  94.         UNIXSHR        - unknown
  95.         NETLIB        - Matt Madison, RPI
  96.  Author:
  97.     Mike O'Malley (mlo)                      September 1993
  98.     Digital Equipment Corp.            Sandia National Laboratories
  99.     Digital Consulting       Scientific Computing Center, User Support
  100.     Albuquerque, NM
  101.       Mike.OMalley@aqo.mts.dec.com              mlomall@sandia.GOV
  102.  
  103.  With modifications by:
  104.      Chen He (che) (617)566-0001 Ext.2919
  105.      IDX Systems Corp.
  106.      he@chen.idx.com
  107.  
  108.  THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE.  THIS SOFTWARE SHOULD
  109.  NOT BE CONSTRUED AS SUPPORTED, OR A COMMITMENT OF SUPPORT, BY
  110.  DIGITAL EQUIPMENT CORPORATION.
  111.  
  112.  Modifications:
  113.     14-MAR-1994 mlo 1.2
  114.         Added getpeername routine.
  115.         Modified all qio calls to use vaxc$errno for status; modified
  116.         get_cmu_errno to return EVMSERR when the IOSB is zero; perror()
  117.         will now print the vms specific error.
  118.     14-MAR-1994 mlo 1.1.3
  119.         Modified all qio calls that use cmu_read_ast to NOT use the
  120.         event flag. Set the event flag in the cmu_read_ast routine.
  121.         In cmu_read_ast make the socket invalid if a socket shutdown
  122.         was detected.
  123.         In select insure that all sockets are still valid.
  124.         Modified exception conditions in cmu_read_ast routine.
  125.      8-FEB-1994 che 1.1.2
  126.         Fixed accept function to return the remote host information.
  127.      4-FEB-1994 che 1.1.1
  128.         Fixed problem in gethostbyaddr; it worked after called 
  129.         gethostbyname but would get access violation when it was 
  130.         called first time.
  131.     18-JAN-1994 mlo 1.1.0
  132.         Removed references to `sys/', `vnet/', `netinet/' from
  133.         include files.
  134.     18-JAN-1994 mlo 1.0.8
  135.         Fixed serious problems in gethostbyaddr; never worked!
  136.     10-DEC-1993 mlo 1.0.7
  137.         In cmu_read_ast detect `socket close by peer' event.
  138.     10-DEC-1993 mlo 1.0.6
  139.         detect ENOCONN in connect.  Seems that the TCP$OPEN qio does
  140.         not fail when the remote system is not reachable.
  141.     28-NOV-1993 mlo 1.0.5
  142.         in recvfrom don't check error status if socket is not ready to
  143.         read.  Caused bad return status.
  144.      8-NOV-1993 mlo 1.0.4
  145.         detect numeric address passed to gethostbyname
  146.     18-OCT-1993 mlo 1.0.3
  147.         corrected return from cmu_get_errno
  148.      7-OCT-1993 mlo 1.0.2
  149.         add write and exception events to select.
  150.      6-OCT-1993 mlo 1.0.1
  151.         add better error reporting via errno
  152.     16-SEP-1993 mlo 1.0.0
  153.         original
  154.  
  155.  #include <types.h>
  156.  #include <socket.h>
  157.  
  158.  int socket(int domain, int type, int protocol)
  159.  
  160.  Description:
  161.     Creates an endpoint of a connection.
  162.  
  163.  domain   - AF_INET is the only address domain supported at this time.
  164.  type     - SOCK_STREAM or SOCK_DGRAM
  165.  protocol - IPPROTO_TCP, IPPROTO_UDP.  If IPPROTO_IP (default) is specified
  166.           protocol will be chosen that matches `type'.
  167.  
  168.  Returns:
  169.   If successful a socket number is returned, otherwise, a -1 is returned and
  170.   errno is set.
  171.  
  172.  #include <types.h>
  173.  #include <socket.h>
  174.  
  175.  int bind(int s, struct sockaddr *name, int namelen)
  176.  
  177.  Description:
  178.     binds a name (address/port) to a socket.  Socket (s) must have been
  179.  created with call to socket.
  180.  
  181.  s       - valid socket descriptor
  182.  name       - address of sockaddr structure for local host port information
  183.  namelen - length of the name structure in bytes
  184.  
  185.  Returns:
  186.     0 on success, -1 on error.  Addition error information is specified in
  187.  the global variable errno.
  188.  
  189.  #include <types.h>
  190.  #include <socket.h>
  191.  
  192.  int connect(int s, struct sockaddr *name, int namelen)
  193.  
  194.  Description:
  195.     initiates a connection on a socket.
  196.  
  197.  s       - valid socket descriptor
  198.  name       - pointer to an address structure for the remote port
  199.  namelen - length of the name structure in bytes
  200.  
  201.  Returns:
  202.     0 on success, -1 on error.  Addition error information is specified in
  203.  the global variable errno.
  204.  
  205.  
  206.  int listen (int s, int backlog)
  207.  
  208.  Description:
  209.     Sets the maximum limit of outstanding connection requests for a socket
  210.  that is connection-oriented.
  211.  
  212.  s       - a valid socket descriptor of type SOCK_STREAM
  213.  backlog - maximum number of pending connections that may be queued
  214.  
  215.  Returns:
  216.     0 on success, -1 on error.  Addition error information is specified in
  217.  the global variable errno.
  218.  
  219.  #include <types.h>
  220.  #include <socket.h>
  221.  
  222.  int accept(int s, struct sockaddr *addr, int *addrlen)
  223.  
  224.  Description:
  225.     Accepts a connection on a socket.
  226.  
  227.  s       - valid socket that is listening
  228.  addr       - sockaddr address structure filled with information from the accepted
  229.            connection
  230.  addrlen - length of returned address structure
  231.  
  232.  Returns:
  233.     Nonnegative integer that is the descriptor for the accepted socket or
  234.  -1 on error.  Addition error information is specified in the global
  235.  variable errno.
  236.  
  237.  #include <types.h>
  238.  #include <socket.h>
  239.  
  240.  int recv(int s, char *buf, int len, int flags)
  241.  
  242.  Description:
  243.     Receive bytes from a connected socket.
  244.  
  245.  s     - a valid socket descriptor
  246.  buf     - address of buffer to where input data is placed
  247.  len     - max size of buf
  248.  flags - 0 or MSG_PEEK may be specified.
  249.  
  250.  Returns:
  251.     Number of bytes read from the socket, -1 on error.  Addition error
  252.  information is specified in the global variable errno.
  253.  
  254.  #include <types.h>
  255.  #include <socket.h>
  256.  
  257.  int recvfrom(int s, char *buf, int len, int flags,
  258.             struct sockaddr *from, int *fromlen)
  259.  
  260.  Description:
  261.     receives bytes from a socket from any source.
  262.  
  263.  s     - a valid socket descriptor
  264.  buf     - address of buffer to where input data is placed
  265.  len     - max size of buf
  266.  flags - 0 or MSG_PEEK may be specified.
  267.  from     - address of sockaddr structure address of the socket which the data
  268.          is received from.  May be specified as 0; no information will be
  269.          returned.
  270.  fromlen - length of from structure returned.
  271.  
  272.  Returns:
  273.     Number of bytes read from the socket, -1 on error.  Addition error
  274.  information is specified in the global variable errno.
  275.  
  276.  #include <types.h>
  277.  #include <socket.h>
  278.  
  279.  int send(int s, char *msg, int len, int flags)
  280.  
  281.  Description:
  282.     Send bytes through a socket to its connected peer.
  283.  
  284.  s     - a valid socket descriptor
  285.  buf     - address of buffer of data to be sent
  286.  len     - size of buf
  287.  flags - 0 or MSG_PEEK may be specified.
  288.  
  289.  Returns:
  290.     Number of bytes written to the socket, -1 on error.  Addition error
  291.  information is specified in the global variable errno.
  292.  
  293.  #include <types.h>
  294.  #include <socket.h>
  295.  
  296.  int sendto(int s, char *msg, int len, int flags, 
  297.             struct sockaddr *to, int tolen)
  298.  
  299.  Description:
  300.     Send bytes through a socket to any other socket.
  301.  
  302.  s     - a valid socket descriptor
  303.  buf     - address of buffer of data to be sent
  304.  len     - size of buf
  305.  flags - none supported.
  306.  to     - address of sockaddr structure which contains the address of the
  307.   socket which the data is to be written.
  308.  tolen - length of from structure returned.
  309.  
  310.  Returns:
  311.     Number of bytes written to the socket, -1 on error.  Addition error
  312.  information is specified in the global variable errno.
  313.  
  314.  #include <socket.h>
  315.  
  316.  int shutdown(int s, int how)
  317.  
  318.  Description:
  319.     Shuts down all or part of a connection on a socket.
  320.  
  321.  s - a valid socket
  322.  how - one of:
  323.     0 - no more receives
  324.     1 - no more sends
  325.     2 - no more receives or sends
  326.  
  327.  Returns:
  328.     0 on success, -1 on error.  Addition error information is specified in
  329.  the global variable errno.
  330.  
  331.  #include <types.h>
  332.  #include <socket.h>
  333.  
  334.  int select(int nfds, int *readfds, int *writefds, int *execptfds,
  335.         struct timeval *timeout)
  336.  
  337.  Description:
  338.     Allows the user to poll or check a group of sockets for I/O activity.
  339.  It can check what sockets are ready to be read or written, or what sockets
  340.  have a pending exception.
  341.  
  342.  Notes:
  343.     This routine (and library) only handles 32 file descriptors max (0-31).
  344.  The `fd_set' type is long int.  To select on file descriptor 0 (stdin) the
  345.  routine cmu_stdin_open must be used to setup the file descriptor.  See
  346.  routines cmu_stdin_open and cmu_stdin_read for further information.
  347.  
  348.  nfds        - maximum file descriptor +1 to scan
  349.  readfds    - address of descriptor bit mask to scan for read events
  350.  writefds    - address of descriptor bit mask to scan for write events
  351.  exceptfds    - address of descriptor bit mask to scan for exception events
  352.  timeout    - specifies how long to wait for a read, write, or exception
  353.           event.  If timeout argument is NULL select will block until
  354.           one of the specified descriptors is ready.
  355.  
  356.  Returns:
  357.     Number of socket descriptors ready for I/O or that have exceptions, 
  358.  0 if the operation timed out, -1 on error.  Addition error information is
  359.  specified in the global variable errno.
  360.  
  361.  #include <types.h>
  362.  #include <socket.h>
  363.  
  364.  int getsockname(int s, struct sockaddr *name, int *namelen)
  365.  
  366.  Description:
  367.     Returns the name associated with a socket
  368.  
  369.  s       - a valid socket descriptor
  370.  name       - sockaddr address structure where data is to be written
  371.  namelen - number of bytes written to name
  372.  
  373.  Returns:
  374.     0 on success, -1 on error.  Addition error information is specified in
  375.  the global variable errno.
  376.  
  377.  #include <types.h>
  378.  #include <socket.h>
  379.  
  380.  int getpeername(int s, struct sockaddr *name, int *namelen)
  381.  
  382.  Description:
  383.     Returns the name associated with a socket
  384.  
  385.  s       - a valid socket descriptor
  386.  name       - sockaddr address structure where data is to be written
  387.  namelen - number of bytes written to name
  388.  
  389.  Returns:
  390.     0 on success, -1 on error.  Addition error information is specified in
  391.  the global variable errno.
  392.  
  393.  #include <types.h>
  394.  #include <socket.h>
  395.  
  396.  int getsockopt(int s, int level, int optname,
  397.             char *optval, int *optlen)
  398.  
  399.  Description:
  400.     Returns the options set on a socket.
  401.  
  402.  Note:
  403.     This routine does nothing.  Always returns -1 with errno set to
  404.  ENOPROTOOPT.
  405.  
  406.  Returns: (if it did do something)
  407.     0 on success, -1 on error.  Addition error information is specified in
  408.  the global variable errno.
  409.  
  410.  #include <types.h>
  411.  #include <socket.h>
  412.  
  413.  int setsockopt(int s, int level, int optname,
  414.             char *optval, int *optlen)
  415.  
  416.  Description: (if it did do something)
  417.     Set the options on a socket.
  418.  
  419.  Note:
  420.     This routine does nothing.  Always returns -1 with errno set to
  421.  ENOPROTOOPT.
  422.  
  423.  Returns:
  424.     0 on success, -1 on error.  Addition error information is specified in
  425.  the global variable errno.
  426.  
  427.  int gethostname(char *name, int namelen)
  428.  
  429.  Description:
  430.     Returns the name currently associated to the host.
  431.  
  432.  name       - address of buffer to write name of host
  433.  namelen - length of name buffer
  434.  
  435.  Returns:
  436.     0 on success, -1 on error.  Addition error information is specified in
  437.  the global variable errno.
  438.  
  439.  
  440.  struct servent *getservbyname(char *name, char *proto);
  441.  
  442.  Description:
  443.     returns a servent structure filled in with information about the
  444.  requested service.
  445.  
  446.  name  - pointer to character string of service to search for
  447.  proto - pointer to character string of protocol type desired (tcp, udp)
  448.  
  449.  Notes:
  450.     The usual services text file is not supported.  Instead, services are
  451.  are logical names defined in the system logical name table.  Services
  452.  logical names are defined as follows:
  453.  
  454.     $ DEFINE /SYSTEM INET$SERVICE_service_name_protocol value
  455.  
  456.  Example:
  457.    To define the service telnet, protocol tcp, port 23 use the following
  458.  statement:
  459.     $ DEFINE/SYSTEM INET$SERVICE_TELNET_TCP 23
  460.  
  461.  Returns:
  462.     Returns the address of a servent structure on success, the NULL pointer
  463.  on error (see cmu_trnlnm).
  464.  
  465.  struct servent *getservbyport(int port, char *proto);
  466.  
  467.  Description:
  468.     returns a servent structure filled in with information about the
  469.  requested port.
  470.  
  471.  port  - int value of port number to search for
  472.  proto - pointer to character string of protocol type desired (tcp, udp)
  473.  
  474.  Notes:
  475.     The usual services text file is not supported.  Instead, services are
  476.  are logical names defined in the system logical name table.  Services
  477.  logical names are defined as follows:
  478.  
  479.     $ DEFINE /SYSTEM INET$SERVICE_port_number_protocol service
  480.  
  481.  Example:
  482.    To define the service telnet, protocol tcp, port 23 use the following
  483.  statement:
  484.     $ DEFINE/SYSTEM INET$SERVICE_23_TCP TELNET
  485.  
  486.  Returns:
  487.     Returns the address of a servent structure on success, the NULL pointer
  488.  on error (see cmu_trnlnm).
  489.  
  490.  
  491.  struct hostent *gethostbyname(char *name)
  492.  
  493.  Description:
  494.     returns the host address associated with the given name.
  495.  
  496.  name - pointer to a character string that contains the host/domain name to
  497.         search for.
  498.  
  499.  Return:
  500.     Returns the address of a hostent structure on success, the NULL pointer
  501.  on error.  Additional error information is returned in the global variable
  502.  errno.
  503.  
  504.  struct hostent *gethostbyaddr(char *addr, int len, int type)
  505.  
  506.  Description:
  507.     Return official name of host given the host address.
  508.  
  509.  addr - a pointer to a series of bytes in network order specifying the
  510.         address of the host to search for.
  511.  len  - number of bytes in the addr
  512.  type - address format. Only AF_INET is supported.
  513.  
  514.  Return:
  515.     Returns the address of a hostent structure on success, the NULL pointer
  516.  on error.  Additional error information is returned in the global variable
  517.  errno.
  518.  
  519.  #include <ioctl.h>
  520.  
  521.  int ioctl(int s, int request, char *argp)
  522.  
  523.  Description:
  524.     control device.
  525.  
  526.  s       - a valid socket descriptor
  527.  request - one of:
  528.         FIOCLEX        - set exclusive use on socket
  529.         FIONCLEX    - remove exclusive use
  530.         FIONBIO        - set/clear non-blocking i/o
  531.         FIONREAD    - get # bytes ready to be read
  532.         SIOCGIFADDR    - get ifnet addres
  533.         SIOCGIFFLAGS    - get ifnet flags
  534.         SIOCGIFCONF    - get ifnet list
  535.  argp    - address of buffer for return information        
  536.         
  537.  Returns:
  538.     0 on success, -1 on error.  Addition error information is specified in
  539.  the global variable errno.
  540.  
  541.  #include <file.h>
  542.  
  543.  int fcntl(int s, int request, int arg)
  544.  
  545.  Description:
  546.     file control.
  547.  
  548.  s       - a valid socket descriptor
  549.  request - One of:
  550.         F_GETFL - get file flags
  551.         F_SETFL - set file flags
  552.  arg     - flags to set
  553.  
  554.  Returns:
  555.     Value of flags or -1 on error.  Addition error information is
  556.  specified in the global variable errno.
  557.  
  558.  #include <types.h>
  559.  #include <socket.h>
  560.  
  561.  int cmu_read(int s, char *buf, int len)
  562.  
  563.  Description:
  564.     Receive bytes from a connected socket.
  565.  
  566.  To avoid conflict and link warnings regarding the `read' routine
  567.  in the standard VAXCRTL this routine name is `cmu_read'.
  568.  A direct call to cmu_read(s,b,l) is required to read a socket.
  569.  
  570.  s   - a valid socket descriptor
  571.  buf - address of buffer to where input data is placed
  572.  len - max size of buf
  573.  
  574.  Returns:
  575.     Number of bytes read from the socket, -1 on error.  Addition error
  576.  information is specified in the global variable errno.
  577.  
  578.  #include <types.h>
  579.  #include <socket.h>
  580.  
  581.  int cmu_write(int s, char *msg, int len, int flags)
  582.  
  583.  Description:
  584.     Send bytes through a socket to its connected peer.
  585.  
  586.  s   - a valid socket descriptor
  587.  buf - address of buffer of data to be sent
  588.  len - size of buf
  589.  
  590.  Returns:
  591.     Number of bytes written to the socket, -1 on error.  Addition error
  592.  information is specified in the global variable errno.
  593.  
  594.  int cmu_close(int s)
  595.  
  596.  Description:
  597.     Closes a connection and deletes a socket descriptor.
  598.  
  599.  To avoid confusion and link warnings regarding the `close' routine
  600.  for other file descriptors this routine name is `cmu_close'.
  601.  A "#define close(s) cmu_close(s)" or direct call to cmu_close(s) is needed in routines
  602.  close sockets managed by this library.   If this routine is called with a socket
  603.  descriptor that is not managed by this library it will pass that descriptor
  604.  to the system close routine.
  605.  
  606.  s - an open socket descriptor
  607.  
  608.  Returns:
  609.     0 on success, -1 on error.  Addition error information is specified in
  610.  the global variable errno.
  611.  
  612.  #include "libcmu.h"
  613.  
  614.  int *cmu_stdin_open(char *name)
  615.  
  616.  Description:
  617.     To have stdin a device that can be selected the descriptor needs to be
  618.  allocated within the domain of these routines.  This routine allocates the
  619.  file descriptor and returns the address of the FD_ENTRY so the user can
  620.  control reads/writes and still use select to see if the descriptor is ready.
  621.  Optionally the user can use the following routine to queue reads on stdin.
  622.  
  623.  name - character string device name of the device to assign a channel to.
  624.  
  625.  Returns:
  626.     Address of an FD_ENTRY structure on success, -1 on error.  Addition
  627.  error information is specified in the global variable errno.
  628.  
  629.  int cmu_stdin_read(int flags, char *buf, int len, char *prompt, int mask)
  630.  
  631.  Description:
  632.     queue an i/o to the descriptor described in sd[0].  Since this read is
  633.  ment to be used with the select call a non-blocking qio is done.  The
  634.  completion routine will set the file descriptor and event flag on read
  635.  completion.
  636.  
  637.  flags  - qio read modifiers
  638.  buf    - to receive characters read
  639.  len    - max characters to read
  640.  prompt - prompt string for read
  641.  mask   - read terminator mask
  642.  
  643.  Returns:
  644.     Status from the SYS$QIO system service call.
  645.  
  646.  int cmu_get_sdc(int s)
  647.  
  648.  Description:
  649.     Returns the assigned VMS channel for a particular file descriptor
  650.  
  651.  s - a valid socket descriptor
  652.  
  653.  Returns:
  654.   If successful a VMS i/o channel number is returned otherwise a 0 is returned and
  655.   errno is set.
  656.  
  657.  
  658.  int cmu_trnlnm(char *table, char *name, char *mode, char *buff, int len)
  659.  
  660.  Description:
  661.     Translate a logical name.  Terminate the output buffer with a null
  662.     character.
  663.  
  664.  table - pointer to string that describes the logical name table to search
  665.  name  - pointer to character string of logical name to search for
  666.  mode  - mimimum access mode of logical name (kernel, exec, super, user)
  667.  buff  - pointer to buffer that is to receive the translation
  668.  len   - size of buff
  669.  
  670.  Returns:
  671.     0 on success.  -1 on error.  vaxc$errno is set to status of
  672.  sys$trnlnm service call and errno is set to EVMSERR.
  673.  
  674.  int cmu_get_errno(NetIO_Status_Block *iosb)
  675.  
  676.  Description:
  677.     returns best guess value for errno be examining the i/o status block.
  678.  
  679.  iosb - address of an i/o status block.
  680.  
  681.  Returns:
  682.     Returns an errno value.
  683.  
  684.  int cmu_listen_accept(int s)
  685.  
  686.  Description:
  687.     AST completion routine called when a connection completes on an open
  688.     listening socket.
  689.  
  690.  s - valid socket descriptor
  691.  
  692.  Returns:
  693.     None.
  694.  
  695.  int cmu_queue_listen(int s)
  696.  
  697.  Description:
  698.     Queue a read that will accept a TCP connection
  699.  
  700.  s - a valid socket descriptor
  701.  
  702.  Returns:
  703.     0 on success, -1 on error.  Addition error information is specified in
  704.  the global variable errno.
  705.  
  706.  int cmu_read_ast(int s)
  707.  
  708.  Description:
  709.     AST read completion routine.  Sets the global sys_readfds to
  710.  indicate the socket is ready to read or sys_exceptfds if there was an
  711.  error.
  712.  
  713.  s - valid socket descriptor
  714.  
  715.  Returns:
  716.     Nothing.
  717.  
  718.  int cmu_write_ast(int s)
  719.  
  720.  Description:
  721.     AST write completion routine.  Sets the global sys_writefds to
  722.  indicate the socket is ready to be written or sys_exceptfds if there was an
  723.  error.
  724.  
  725.  s - valid socket descriptor
  726.  
  727.  Returns:
  728.     Nothing.
  729.  
  730.  
  731.  int cmu_queue_net_read(int s)
  732.  
  733.  Description:
  734.     Queue a read on socket `s' to be completed by net_read_ast.  This
  735.  routine will also allocate an event flag and receive buffer if necessary.
  736.  
  737.  s - valid socket descriptor
  738.  
  739.  Returns:
  740.     0 on success, -1 on error.  Addition error information is specified in
  741.  the global variable errno.
  742.  
  743.