home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR3 / KA9Q212.ZIP / ZMODEM.H < prev   
C/C++ Source or Header  |  1993-02-07  |  7KB  |  165 lines

  1. /****************************************************************************
  2. *    Language     :    Turbo C 2.0                                                *
  3. *    Logfile        :    zmodem.h                                                *
  4. *    Project        :    Comms library.                                            *
  5. *    Date         :    24 Jan 90                                                *
  6. *    Revision     :    1.1        GT    PC version.                                    *
  7. *    25 Oct 92    :    1.2        GT    KA9Q mods.                                    *
  8. *****************************************************************************
  9. *    Purpose        :    Manifest constants for ZMODEM.                            *
  10. *****************************************************************************
  11. *                :    This module is based on the equivalent module in the    *
  12. *                :    31 Aug 87 version of rz/sz.                                *
  13. *    $Id: zmodem.h 1.1 93/01/16 18:37:38 ROOT_DOS Exp $
  14. ****************************************************************************/
  15.  
  16. /*
  17.  *   Z M O D E M . H     Manifest constants for ZMODEM
  18.  *    application to application file transfer protocol
  19.  *    05-23-87  Chuck Forsberg Omen Technology Inc
  20.  */
  21.  
  22. #ifndef    ZMODEM_H
  23. #define    ZMODEM_H
  24.  
  25. #define ZPAD    '*'                /* 052 Padding character begins frames */
  26. #define ZDLE    030                /* Ctrl-X Zmodem escape - `ala BISYNC DLE */
  27. #define ZDLEE    (ZDLE^0100)        /* Escaped ZDLE as transmitted */
  28. #define ZBIN    'A'                /* Binary frame indicator */
  29. #define ZHEX    'B'                /* HEX frame indicator */
  30. #define ZBIN32    'C'                /* Binary frame with 32 bit FCS */
  31.  
  32. /* Frame types (see array "frametypes" in zm.c) */
  33.  
  34. #define ZRQINIT        0            /* Request receive init */
  35. #define ZRINIT        1            /* Receive init */
  36. #define ZSINIT        2            /* Send init sequence (optional) */
  37. #define ZACK        3            /* ACK to above */
  38. #define ZFILE        4            /* File name from sender */
  39. #define ZSKIP        5            /* To sender: skip this file */
  40. #define ZNAK        6            /* Last packet was garbled */
  41. #define ZABORT        7            /* Abort batch transfers */
  42. #define ZFIN        8            /* Finish session */
  43. #define ZRPOS        9            /* Resume data trans at this position */
  44. #define ZDATA        10            /* Data packet(s) follow */
  45. #define ZEOF        11            /* End of file */
  46. #define ZFERR        12            /* Fatal Read or Write error Detected */
  47. #define ZCRC        13            /* Request for file CRC and response */
  48. #define ZCHALLENGE    14            /* Receiver's Challenge */
  49. #define ZCOMPL        15            /* Request is complete */
  50. #define ZCAN        16            /* Other end canned session with CAN*5 */
  51. #define ZFREECNT    17            /* Request for free bytes on filesystem */
  52. #define ZCOMMAND    18            /* Command from sending program */
  53. #define ZSTDERR        19            /* Output to standard error, data follows */
  54.  
  55. /* ZDLE sequences */
  56.  
  57. #define ZCRCE    'h'            /* CRC next, frame ends, header packet follows */
  58. #define ZCRCG    'i'            /* CRC next, frame continues nonstop */
  59. #define ZCRCQ    'j'            /* CRC next, frame continues, ZACK expected */
  60. #define ZCRCW    'k'            /* CRC next, ZACK expected, end of frame */
  61. #define ZRUB0    'l'            /* Translate to rubout 0177 */
  62. #define ZRUB1    'm'            /* Translate to rubout 0377 */
  63.  
  64. /* zdlread return values (internal) */
  65. /* -1 is general error, -2 is timeout */
  66.  
  67. #define GOTOR    0400
  68. #define GOTCRCE (ZCRCE|GOTOR)    /* ZDLE-ZCRCE received */
  69. #define GOTCRCG (ZCRCG|GOTOR)    /* ZDLE-ZCRCG received */
  70. #define GOTCRCQ (ZCRCQ|GOTOR)    /* ZDLE-ZCRCQ received */
  71. #define GOTCRCW (ZCRCW|GOTOR)    /* ZDLE-ZCRCW received */
  72. #define GOTCAN    (GOTOR|030)        /* CAN*5 seen */
  73.  
  74. /* Byte positions within header array */
  75.  
  76. #define ZF0        3                /* First flags byte */
  77. #define ZF1        2
  78. #define ZF2        1
  79. #define ZF3        0
  80. #define ZP0        0                /* Low order 8 bits of position */
  81. #define ZP1        1
  82. #define ZP2        2
  83. #define ZP3        3                /* High order 8 bits of file position */
  84.  
  85. /* Bit Masks for ZRINIT flags byte ZF0 */
  86.  
  87. #define CANFDX    01                /* Rx can send and receive true FDX */
  88. #define CANOVIO    02                /* Rx can receive data during disk I/O */
  89. #define CANBRK    04                /* Rx can send a break signal */
  90. #define CANCRY    010                /* Receiver can decrypt */
  91. #define CANLZW    020                /* Receiver can uncompress */
  92. #define CANFC32    040                /* Receiver can use 32 bit Frame Check */
  93. #define ESCCTL    0100            /* Receiver expects ctl chars to be escaped */
  94. #define ESC8    0200            /* Receiver expects 8th bit to be escaped */
  95.  
  96. /* Parameters for ZSINIT frame */
  97.  
  98. #define ZATTNLEN    32            /* Max length of attention string */
  99.  
  100. /* Bit Masks for ZSINIT flags byte ZF0 */
  101.  
  102. #define TESCCTL        0100    /* Transmitter expects ctl chars to be escaped */
  103. #define TESC8       0200    /* Transmitter expects 8th bit to be escaped */
  104.  
  105. /* Parameters for ZFILE frame */
  106. /* Conversion options one of these in ZF0 */
  107.  
  108. #define ZCBIN        1        /* Binary transfer - inhibit conversion */
  109. #define ZCNL        2        /* Convert NL to local end of line convention */
  110. #define ZCRESUM        3        /* Resume interrupted file transfer */
  111.  
  112. /* Management include options, one of these ored in ZF1 */
  113.  
  114. #define ZMSKNOLOC    0200    /* Skip file if not present at rx */
  115.  
  116. /* Management options, one of these ored in ZF1 */
  117.  
  118. #define ZMMASK        037        /* Mask for the choices below */
  119. #define ZMNEWL        1        /* Transfer if source newer or longer */
  120. #define ZMCRC        2        /* Transfer if different file CRC or length */
  121. #define ZMAPND        3        /* Append contents to existing file (if any) */
  122. #define ZMCLOB        4        /* Replace existing file */
  123. #define ZMNEW        5        /* Transfer if source newer */
  124.                             /* Number 5 is alive ... */
  125. #define ZMDIFF        6        /* Transfer if dates or lengths different */
  126. #define ZMPROT        7        /* Protect destination file */
  127.  
  128. /* Transport options, one of these in ZF2 */
  129.  
  130. #define ZTLZW        1        /* Lempel-Ziv compression */
  131. #define ZTCRYPT        2        /* Encryption */
  132. #define ZTRLE        3        /* Run Length encoding */
  133.  
  134. /* Extended options for ZF3, bit encoded */
  135.  
  136. #define ZXSPARS        64        /* Encoding for sparse file operations */
  137.  
  138. /* Parameters for ZCOMMAND frame ZF0 (otherwise 0) */
  139.  
  140. #define ZCACK1        1        /* Acknowledge, then do command */
  141.  
  142.  
  143. /* Globals used by ZMODEM functions */
  144.  
  145. #if    0
  146. extern int Rxframeind;        /* ZBIN ZBIN32, or ZHEX type of frame received */
  147. extern int Rxtype;            /* Type of header received */
  148. #endif
  149. extern int _Rxcount;        /* Count of data bytes received */
  150. extern int _Zrwindow;        /* RX window size (controls garbage count) */
  151. extern int _Rxtimeout;        /* Tenths of seconds to wait for something */
  152. extern int _Txfcs32;        /* TRUE means send binary frames with 32 bit FCS */
  153. extern int _Crc32t;            /* Display flag - 32 bit CRC being sent */
  154. extern int _Crc32;            /* Display flag - 32 bit CRC being received */
  155. extern int _Znulls;            /* No of nulls to send at beginning of ZDATA hdr */
  156.  
  157. extern char _Rxhdr[4];        /* Received header */
  158. extern char _Txhdr[4];        /* Transmitted header */
  159. extern char _Attn[ZATTNLEN + 1];    /* Attention string rx sends to tx on err */
  160.  
  161. extern long _Rxpos;            /* Received file position */
  162. extern long _Txpos;            /* Transmitted file position */
  163.  
  164. #endif
  165.