home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / EXTRAS / UUCODE / UUPC / TEST / UPC12ES2.ZIP / UUCICO / commlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-20  |  6.9 KB  |  179 lines

  1. #ifndef COMMLIB_H
  2. #define COMMLIB_H
  3.  
  4. /*--------------------------------------------------------------------*/
  5. /*       c o m m l i b . h                                            */
  6. /*                                                                    */
  7. /*       Generic communications library interface for UUPC/extended.  */
  8. /*--------------------------------------------------------------------*/
  9.  
  10. /*--------------------------------------------------------------------*/
  11. /*    Changes Copyright (c) 1990-1993 by Kendra Electronic            */
  12. /*    Wonderworks.                                                    */
  13. /*                                                                    */
  14. /*    All rights reserved except those explicitly granted by the      */
  15. /*    UUPC/extended license agreement.                                */
  16. /*--------------------------------------------------------------------*/
  17.  
  18. /*--------------------------------------------------------------------*/
  19. /*                          RCS Information                           */
  20. /*--------------------------------------------------------------------*/
  21.  
  22. /*
  23.  *    $Id: commlib.h 1.11 1993/11/20 14:50:25 ahd Exp $
  24.  *
  25.  *    Revision history:
  26.  *    $Log: commlib.h $
  27.  * Revision 1.11  1993/11/20  14:50:25  ahd
  28.  * Add prototype for GetComHandle
  29.  *
  30.  * Revision 1.10  1993/11/06  17:57:46  rhg
  31.  * Drive Drew nuts by submitting cosmetic changes mixed in with bug fixes
  32.  *
  33.  * Revision 1.9  1993/10/12  01:35:12  ahd
  34.  * Normalize comments to PL/I style
  35.  *
  36.  * Revision 1.8  1993/10/07  22:32:45  ahd
  37.  * Add commBuffer information
  38.  *
  39.  * Revision 1.7  1993/10/02  23:51:15  ahd
  40.  * Reduce MAXPACK for 32 bit environments to 1024 bytes because
  41.  * of NT aborts  with 4096
  42.  *
  43.  * Revision 1.6  1993/09/29  04:56:11  ahd
  44.  * Suspend port by port name, not modem file name
  45.  *
  46.  * Revision 1.5  1993/09/25  03:13:04  ahd
  47.  * Add priority altering prototypes
  48.  *
  49.  * Revision 1.4  1993/09/21  01:43:46  ahd
  50.  * Move MAXPACK to commlib.h to allow use as standard comm buffer size
  51.  *
  52.  * Revision 1.3  1993/09/20  04:53:57  ahd
  53.  * TCP/IP support from Dave Watt
  54.  * 't' protocol support
  55.  * OS/2 2.x support (BC++ 1.0 for OS/2 support)
  56.  *
  57.  * Revision 1.2  1993/05/30  15:27:22  ahd
  58.  * Additional multiple comm driver support
  59.  *
  60.  * Revision 1.1  1993/05/30  00:11:03  ahd
  61.  * Initial revision
  62.  *
  63.  */
  64.  
  65. /*--------------------------------------------------------------------*/
  66. /*       Declare typedefs for pointers to the functions we use        */
  67. /*       in the communications drivers                                */
  68. /*--------------------------------------------------------------------*/
  69.  
  70. typedef int (*ref_activeopenline)(char *name, BPS baud, const boolean direct);
  71.  
  72. typedef int (*ref_passiveopenline)(char *name, BPS baud, const boolean direct);
  73. typedef unsigned int (*ref_sread)(char *buffer,
  74.                                   unsigned int wanted,
  75.                                   unsigned int timeout);
  76.  
  77. typedef int (*ref_swrite)(const char *data, unsigned int len);
  78.  
  79. typedef void (*ref_ssendbrk)(unsigned int duration);
  80.  
  81. typedef void (*ref_closeline)(void);
  82.  
  83. typedef void (*ref_SIOSpeed)(BPS baud);
  84.  
  85. typedef void (*ref_flowcontrol)(boolean);
  86.  
  87. typedef void (*ref_hangup)( void );
  88.  
  89. typedef BPS (*ref_GetSpeed)( void );
  90.  
  91. typedef boolean (*ref_CD)( void );
  92.  
  93. typedef boolean (*ref_WaitForNetConnect)(const unsigned int timeout);
  94.  
  95. typedef int (*ref_GetComHandle)( void );
  96.  
  97. /*--------------------------------------------------------------------*/
  98. /*       Define function to select communications driver functions;   */
  99. /*       returns TRUE on success.                                     */
  100. /*--------------------------------------------------------------------*/
  101.  
  102. boolean chooseCommunications( const char *suite );
  103.  
  104. boolean IsNetwork(void);         /* Report if suite is network oriented  */
  105.  
  106. /*--------------------------------------------------------------------*/
  107. /*       Trace functions for communications routines                  */
  108. /*--------------------------------------------------------------------*/
  109.  
  110. boolean traceStart( const char *port );
  111.  
  112. void traceStop( void );
  113.  
  114. void traceData( const char *data,
  115.                 const unsigned len,
  116.                 const boolean output);
  117.  
  118. /*--------------------------------------------------------------------*/
  119. /*           Declare the functions used by various routines           */
  120. /*--------------------------------------------------------------------*/
  121.  
  122. extern ref_activeopenline activeopenlinep;
  123. extern ref_passiveopenline passiveopenlinep;
  124. extern ref_sread sreadp;
  125. extern ref_swrite swritep;
  126. extern ref_ssendbrk ssendbrkp;
  127. extern ref_closeline closelinep;
  128. extern ref_SIOSpeed SIOSpeedp;
  129. extern ref_flowcontrol flowcontrolp;
  130. extern ref_hangup hangupp;
  131. extern ref_GetSpeed GetSpeedp;
  132. extern ref_CD CDp;
  133. extern ref_WaitForNetConnect WaitForNetConnectp;
  134. extern ref_GetComHandle GetComHandlep;
  135.  
  136. /*--------------------------------------------------------------------*/
  137. /*       Declare macros which define the prev-generic driver names    */
  138. /*       (and are easier to type).                                    */
  139. /*--------------------------------------------------------------------*/
  140.  
  141. #define activeopenline(name, baud, direct) (*activeopenlinep)(name, baud, direct)
  142. #define passiveopenline(name, baud, direct)(*passiveopenlinep)(name, baud, direct)
  143. #define sread(buffer, wanted, timeout) (*sreadp)(buffer, wanted, timeout)
  144. #define swrite(buffer, wanted)         (*swritep)(buffer, wanted )
  145. #define ssendbrk( duration )           (*ssendbrkp)(duration)
  146. #define closeline()                    (*closelinep)()
  147. #define flowcontrol(onoroff)           (*flowcontrolp)(onoroff)
  148. #define SIOSpeed(baud)                 (*SIOSpeedp)(baud)
  149. #define hangup()                       (*hangupp)()
  150. #define GetSpeed()                     (*GetSpeedp)()
  151. #define CD()                           (*CDp)()
  152. #define WaitForNetConnect(timeout)     (*WaitForNetConnectp)(timeout)
  153. #define GetComHandle()                 (*GetComHandlep)()
  154.  
  155. extern size_t commBufferLength;
  156. extern size_t commBufferUsed;
  157. extern char *commBuffer;
  158.  
  159. extern boolean portActive;          /* Port active flag for error handler  */
  160. extern boolean traceEnabled;        /* Enable comm port trace         */
  161.  
  162. boolean IsNetwork(void);
  163.  
  164. /*--------------------------------------------------------------------*/
  165. /*                     Priority setting functions                     */
  166. /*--------------------------------------------------------------------*/
  167.  
  168. void setPrty( const KEWSHORT priorityIn, const KEWSHORT prioritydeltaIn );
  169.  
  170. void resetPrty( void );
  171.  
  172. /*--------------------------------------------------------------------*/
  173. /*                    Declare network buffer size                     */
  174. /*--------------------------------------------------------------------*/
  175.  
  176. #define MAXPACK 1024          /* Needed for 't' protocol blocks      */
  177.  
  178. #endif
  179.