home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 11 / 11.iso / n / n002 / 4.ddi / ECLHEAD.ZIP / ZM.H < prev   
Encoding:
C/C++ Source or Header  |  1991-06-19  |  8.3 KB  |  256 lines

  1. /*
  2.  *   Z M O D E M . H     Manifest constants for ZMODEM
  3.  *    application to application file transfer protocol
  4.  *    05-23-87  Chuck Forsberg Omen Technology Inc
  5.  */
  6.  
  7. #ifndef ECLZMHEAD
  8. #define ECLZMHEAD
  9.  
  10. typedef (*userfunc)( int port, int event, char *file, long bytes, long size,
  11.     int acked, int naked, int timed, int junked, int error_ck );
  12.  
  13. #define ZPAD '*'    /* 052 Padding character begins frames */
  14. #define ZDLE 030    /* Ctrl-X Zmodem escape - `ala BISYNC DLE */
  15. #define ZDLEE (ZDLE^0100)    /* Escaped ZDLE as transmitted */
  16. #define ZBIN 'A'    /* Binary frame indicator */
  17. #define ZHEX 'B'    /* HEX frame indicator */
  18. #define ZBIN32 'C'    /* Binary frame with 32 bit FCS */
  19.  
  20. /* Frame types (see array "frametypes" in zm.c) */
  21. #define ZRQINIT    0    /* Request receive init */
  22. #define ZRINIT    1    /* Receive init */
  23. #define ZSINIT 2    /* Send init sequence (optional) */
  24. #define ZACK 3        /* ACK to above */
  25. #define ZFILE 4        /* File name from sender */
  26. #define ZSKIP 5        /* To sender: skip this file */
  27. #define ZNAK 6        /* Last packet was garbled */
  28. #define ZABORT 7    /* Abort batch transfers */
  29. #define ZFIN 8        /* Finish session */
  30. #define ZRPOS 9        /* Resume data trans at this position */
  31. #define ZDATA 10    /* Data packet(s) follow */
  32. #define ZEOF 11        /* End of file */
  33. #define ZFERR 12    /* Fatal Read or Write error Detected */
  34. #define ZCRC 13        /* Request for file CRC and response */
  35. #define ZCHALLENGE 14    /* Receiver's Challenge */
  36. #define ZCOMPL 15    /* Request is complete */
  37. #define ZCAN 16        /* Other end canned session with CAN*5 */
  38. #define ZFREECNT 17    /* Request for free bytes on filesystem */
  39. #define ZCOMMAND 18    /* Command from sending program */
  40. #define ZSTDERR 19    /* Output to standard error, data follows */
  41.  
  42. /* ZDLE sequences */
  43. #define ZCRCE 'h'    /* CRC next, frame ends, header packet follows */
  44. #define ZCRCG 'i'    /* CRC next, frame continues nonstop */
  45. #define ZCRCQ 'j'    /* CRC next, frame continues, ZACK expected */
  46. #define ZCRCW 'k'    /* CRC next, ZACK expected, end of frame */
  47. #define ZRUB0 'l'    /* Translate to rubout 0177 */
  48. #define ZRUB1 'm'    /* Translate to rubout 0377 */
  49.  
  50. /* zdlread return values (internal) */
  51. /* -1 is general error, -2 is timeout */
  52. #define GOTOR 0400
  53. #define GOTCRCE (ZCRCE|GOTOR)    /* ZDLE-ZCRCE received */
  54. #define GOTCRCG (ZCRCG|GOTOR)    /* ZDLE-ZCRCG received */
  55. #define GOTCRCQ (ZCRCQ|GOTOR)    /* ZDLE-ZCRCQ received */
  56. #define GOTCRCW (ZCRCW|GOTOR)    /* ZDLE-ZCRCW received */
  57. #define GOTCAN    (GOTOR|030)    /* CAN*5 seen */
  58.  
  59. /* Byte positions within header array */
  60. #define ZF0    3    /* First flags byte */
  61. #define ZF1    2
  62. #define ZF2    1
  63. #define ZF3    0
  64. #define ZP0    0    /* Low order 8 bits of position */
  65. #define ZP1    1
  66. #define ZP2    2
  67. #define ZP3    3    /* High order 8 bits of file position */
  68.  
  69. /* Bit Masks for ZRINIT flags byte ZF0 */
  70. #define CANFDX    01    /* Rx can send and receive true FDX */
  71. #define CANOVIO    02    /* Rx can receive data during disk I/O */
  72. #define CANBRK    04    /* Rx can send a break signal */
  73. #define CANCRY    010    /* Receiver can decrypt */
  74. #define CANLZW    020    /* Receiver can uncompress */
  75. #define CANFC32    040    /* Receiver can use 32 bit Frame Check */
  76. #define ESCCTL 0100    /* Receiver expects ctl chars to be escaped */
  77. #define ESC8   0200    /* Receiver expects 8th bit to be escaped */
  78.  
  79. /* Parameters for ZSINIT frame */
  80. #define ZATTNLEN 32    /* Max length of attention string */
  81.  
  82. /* Bit Masks for ZSINIT flags byte ZF0 */
  83. #define TESCCTL 0100    /* Transmitter expects ctl chars to be escaped */
  84. #define TESC8   0200    /* Transmitter expects 8th bit to be escaped */
  85.  
  86. /* Parameters for ZFILE frame */
  87. /* Conversion options one of these in ZF0 */
  88. #define ZCBIN    1    /* Binary transfer - inhibit conversion */
  89. #define ZCNL    2    /* Convert NL to local end of line convention */
  90. #define ZCRESUM    3    /* Resume interrupted file transfer */
  91. /* Management include options, one of these ored in ZF1 */
  92. #define ZMSKNOLOC    0200    /* Skip file if not present at rx */
  93. /* Management options, one of these ored in ZF1 */
  94. #define ZMMASK    037    /* Mask for the choices below */
  95. #define ZMNEWL    1    /* Transfer if source newer or longer */
  96. #define ZMCRC    2    /* Transfer if different file CRC or length */
  97. #define ZMAPND    3    /* Append contents to existing file (if any) */
  98. #define ZMCLOB    4    /* Replace existing file */
  99. #define ZMNEW    5    /* Transfer if source newer */
  100.     /* Number 5 is alive ... */
  101. #define ZMDIFF    6    /* Transfer if dates or lengths different */
  102. #define ZMPROT    7    /* Protect destination file */
  103. /* Transport options, one of these in ZF2 */
  104. #define ZTLZW    1    /* Lempel-Ziv compression */
  105. #define ZTCRYPT    2    /* Encryption */
  106. #define ZTRLE    3    /* Run Length encoding */
  107. /* Extended options for ZF3, bit encoded */
  108. #define ZXSPARS    64    /* Encoding for sparse file operations */
  109.  
  110. /* Parameters for ZCOMMAND frame ZF0 (otherwise 0) */
  111. #define ZCACK1    1    /* Acknowledge, then do command */
  112.  
  113. /* Possible errors when running ZMODEM */
  114. #define    ZM_OUT_OF_MEM    -9
  115.  
  116. #define    ZM_OLDER    -10            /* existing file is newer than old one */
  117.                                 /* when ZMNEW option is used */
  118.  
  119. #define    ZM_MATCH    -11            /* file already exists with same date and */
  120.                                 /* length, when ZMDIFF option is used */
  121.  
  122. #define    ZM_CANT_RESUME    -12        /* can't resume - new file is smaller than */
  123.                                 /* the existing file.  */
  124.  
  125. #define    ZM_EXISTS    -13            /* file already exists, resume not specified */
  126.  
  127. #define ZM_SKIP        -14            /* file doesn't exist (and is skipped due to */
  128.                                 /* ZMSKNOLOC option */
  129.  
  130. #define    ZM_FIO        -15            /* unable to read/write/open file */
  131.  
  132. #define    ZM_CANC        -16            /* Remote cancelled */
  133.  
  134. #define    ZM_ABORT    -17            /* User pressed CTRL Break */
  135.  
  136. #define    ZM_NO_DCD    -18            /* Abort - no carrier */
  137.  
  138.  
  139. #define    ZM_ERROR    -1
  140. #define ZM_NAK        -1
  141.  
  142. #define    ZM_OK        0            /* all is ok */
  143.  
  144. /* user abort flags */
  145. #define    ZM_CB        1
  146. #define    ZM_DCD        2
  147. #define    ZM_CB_AND_DCD 3
  148.  
  149. /* ZMODEM error check methods */
  150. #define    ZM_CRC_16   0
  151. #define    ZM_CRC_32   1
  152.  
  153.  
  154. /* function type flags */
  155. #define    ZM_REC        0
  156. #define    ZM_SEND        1
  157.  
  158. #define    ZM_SESS             -1
  159.  
  160.  
  161. /* zm_setopts() parameter flags */
  162. #define    ZM_RESUME    0
  163. #define    ZM_CLOBBER    1
  164. #define    ZM_WINDOW    2
  165. #define    ZM_TIMEOUT    3
  166. #define    ZM_NULLS    4
  167. #define    ZM_ESCCTL    5
  168. #define    ZM_UNLINK    6
  169. #define    ZM_DOTTOSL    7
  170. #define    ZM_WANTCRC32 8
  171. #define ZM_USERFUNC    9
  172. #define    ZM_AUTO        10
  173.  
  174.  
  175. /*
  176. **    User function defines
  177. */
  178. #define    ZM_BADCRC        1
  179. #define    ZM_SENDERCAN    2
  180. #define    ZM_TIMED        3
  181. #define    ZM_BADSUB        4
  182. #define    ZM_SUB2LONG        5
  183. #define    ZM_GAREXCEED    6
  184. #define    ZM_BADESC        7
  185. #define    ZM_FAILSEC        8
  186. #define    ZM_CRASHREC        9
  187. #define    ZM_SENDSKIP        10
  188. #define    ZM_WAITNAK        11
  189. #define    ZM_GOTZRPOS        12
  190. #define    ZM_GOTERR        13
  191. #define    ZM_BYTES        14
  192.  
  193.  
  194. /* misc macro values */
  195. #define MAX_REINIT    10
  196. #define    TRUE        1
  197. #define    FALSE        0
  198. #define HOWMANY        133
  199. #define PATHLEN        127
  200.  
  201. #define ON            1
  202. #define OFF            0
  203.  
  204. #define    CB_ABORT    1
  205. #define    DCD_ABORT    2
  206.  
  207. /* Sorry, Regulus and some others don't work right in raw mode! */
  208. #define Readnum        1
  209.  
  210. #define DEFBYTL        2000000000L    /* default rx file size */
  211. #define TXBSIZE        1024
  212. #define TXBMASK        (TXBSIZE-1)
  213.  
  214.  
  215. /* Ward Christensen / CP/M parameters - Don't change these! */
  216. #define ENQ            005
  217. #define CAN            0x18
  218. #define XOFF        ('s'&037)
  219. #define XON            ('q'&037)
  220. #define SOH            0x01
  221. #define STX            0x02
  222. #define EOT            0x04
  223. #define ACK            0x06
  224. #define NAK            0x15
  225. #define CPMEOF        032
  226. #define WANTCRC        0103    /* send C not NAK to get crc not checksum */
  227. #define TIMEOUT        (-2)
  228. #define RCDO        (-3)
  229. #define WCEOT        (-10)
  230.  
  231. /* macros to make calling things a little easier */
  232. #ifdef __TURBOC__
  233. #define ZM_FIND_FIRST(path,buf_ptr)     findfirst(path,buf_ptr,0)
  234. #define ZM_FIND_NEXT(buf_ptr)           findnext(buf_ptr)
  235. #define ZM_FILE_NAME                    fib.ff_name
  236. #define ZM_FILE_LENGTH                  fib.ff_fsize
  237. #define ZM_FILE_DATE                    fib.ff_fdate
  238. #else
  239. #define ZM_FIND_FIRST(path,buf_ptr)     _dos_findfirst(path,_A_NORMAL,buf_ptr)
  240. #define ZM_FIND_NEXT(buf_ptr)           _dos_findnext(buf_ptr)
  241. #define ZM_FILE_NAME                    fib.name
  242. #define ZM_FILE_LENGTH                  fib.fsize
  243. #define ZM_FILE_DATE                    fib.wr_fdate
  244. #endif
  245.  
  246. #define    v_delay(t)            xct_pend((t))
  247. #define    filenstr(s)            (s)
  248. #define    setnewpath(s)        (s)
  249. #define    sleep( secs )        v_delay( (secs) * 18 )
  250. #define    sendline( c )        xc_putc( Port, (char) (c) )
  251. #define xsendline(c)        xc_putc( Port, (char) (c) )
  252.  
  253. #endif
  254.  
  255. /* End of ZMODEM.H */
  256.