home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / modem / rzsz.arc / ZMODEM.H < prev    next >
C/C++ Source or Header  |  1987-06-03  |  5KB  |  124 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. #define ZPAD '*'    /* 052 Padding character begins frames */
  7. #define ZDLE 030    /* Ctrl-X Zmodem escape - `ala BISYNC DLE */
  8. #define ZDLEE (ZDLE^0100)    /* Escaped ZDLE as transmitted */
  9. #define ZBIN 'A'    /* Binary frame indicator */
  10. #define ZHEX 'B'    /* HEX frame indicator */
  11. #define ZBIN32 'C'    /* Binary frame with 32 bit FCS */
  12.  
  13. /* Frame types (see array "frametypes" in zm.c) */
  14. #define ZRQINIT    0    /* Request receive init */
  15. #define ZRINIT    1    /* Receive init */
  16. #define ZSINIT 2    /* Send init sequence (optional) */
  17. #define ZACK 3        /* ACK to above */
  18. #define ZFILE 4        /* File name from sender */
  19. #define ZSKIP 5        /* To sender: skip this file */
  20. #define ZNAK 6        /* Last packet was garbled */
  21. #define ZABORT 7    /* Abort batch transfers */
  22. #define ZFIN 8        /* Finish session */
  23. #define ZRPOS 9        /* Resume data trans at this position */
  24. #define ZDATA 10    /* Data packet(s) follow */
  25. #define ZEOF 11        /* End of file */
  26. #define ZFERR 12    /* Fatal Read or Write error Detected */
  27. #define ZCRC 13        /* Request for file CRC and response */
  28. #define ZCHALLENGE 14    /* Receiver's Challenge */
  29. #define ZCOMPL 15    /* Request is complete */
  30. #define ZCAN 16        /* Other end canned session with CAN*5 */
  31. #define ZFREECNT 17    /* Request for free bytes on filesystem */
  32. #define ZCOMMAND 18    /* Command from sending program */
  33. #define ZSTDERR 19    /* Output to standard error, data follows */
  34.  
  35. /* ZDLE sequences */
  36. #define ZCRCE 'h'    /* CRC next, frame ends, header packet follows */
  37. #define ZCRCG 'i'    /* CRC next, frame continues nonstop */
  38. #define ZCRCQ 'j'    /* CRC next, frame continues, ZACK expected */
  39. #define ZCRCW 'k'    /* CRC next, ZACK expected, end of frame */
  40. #define ZRUB0 'l'    /* Translate to rubout 0177 */
  41. #define ZRUB1 'm'    /* Translate to rubout 0377 */
  42.  
  43. /* zdlread return values (internal) */
  44. /* -1 is general error, -2 is timeout */
  45. #define GOTOR 0400
  46. #define GOTCRCE (ZCRCE|GOTOR)    /* ZDLE-ZCRCE received */
  47. #define GOTCRCG (ZCRCG|GOTOR)    /* ZDLE-ZCRCG received */
  48. #define GOTCRCQ (ZCRCQ|GOTOR)    /* ZDLE-ZCRCQ received */
  49. #define GOTCRCW (ZCRCW|GOTOR)    /* ZDLE-ZCRCW received */
  50. #define GOTCAN    (GOTOR|030)    /* CAN*5 seen */
  51.  
  52. /* Byte positions within header array */
  53. #define ZF0    3    /* First flags byte */
  54. #define ZF1    2
  55. #define ZF2    1
  56. #define ZF3    0
  57. #define ZP0    0    /* Low order 8 bits of position */
  58. #define ZP1    1
  59. #define ZP2    2
  60. #define ZP3    3    /* High order 8 bits of file position */
  61.  
  62. /* Bit Masks for ZRINIT flags byte ZF0 */
  63. #define CANFDX    01    /* Rx can send and receive true FDX */
  64. #define CANOVIO    02    /* Rx can receive data during disk I/O */
  65. #define CANBRK    04    /* Rx can send a break signal */
  66. #define CANCRY    010    /* Receiver can decrypt */
  67. #define CANLZW    020    /* Receiver can uncompress */
  68. #define CANFC32    040    /* Receiver can use 32 bit Frame Check */
  69. #define ESCCTL 0100    /* Receiver expects ctl chars to be escaped */
  70. #define ESC8   0200    /* Receiver expects 8th bit to be escaped */
  71.  
  72. /* Parameters for ZSINIT frame */
  73. #define ZATTNLEN 32    /* Max length of attention string */
  74. /* Bit Masks for ZSINIT flags byte ZF0 */
  75. #define TESCCTL 0100    /* Transmitter expects ctl chars to be escaped */
  76. #define TESC8   0200    /* Transmitter expects 8th bit to be escaped */
  77.  
  78. /* Parameters for ZFILE frame */
  79. /* Conversion options one of these in ZF0 */
  80. #define ZCBIN    1    /* Binary transfer - inhibit conversion */
  81. #define ZCNL    2    /* Convert NL to local end of line convention */
  82. #define ZCRESUM    3    /* Resume interrupted file transfer */
  83. /* Management include options, one of these ored in ZF1 */
  84. #define ZMSKNOLOC    0200    /* Skip file if not present at rx */
  85. /* Management options, one of these ored in ZF1 */
  86. #define ZMMASK    037    /* Mask for the choices below */
  87. #define ZMNEWL    1    /* Transfer if source newer or longer */
  88. #define ZMCRC    2    /* Transfer if different file CRC or length */
  89. #define ZMAPND    3    /* Append contents to existing file (if any) */
  90. #define ZMCLOB    4    /* Replace existing file */
  91. #define ZMNEW    5    /* Transfer if source newer */
  92.     /* Number 5 is alive ... */
  93. #define ZMDIFF    6    /* Transfer if dates or lengths different */
  94. #define ZMPROT    7    /* Protect destination file */
  95. /* Transport options, one of these in ZF2 */
  96. #define ZTLZW    1    /* Lempel-Ziv compression */
  97. #define ZTCRYPT    2    /* Encryption */
  98. #define ZTRLE    3    /* Run Length encoding */
  99. /* Extended options for ZF3, bit encoded */
  100. #define ZXSPARS    64    /* Encoding for sparse file operations */
  101.  
  102. /* Parameters for ZCOMMAND frame ZF0 (otherwise 0) */
  103. #define ZCACK1    1    /* Acknowledge, then do command */
  104.  
  105. long rclhdr();
  106.  
  107. /* Globals used by ZMODEM functions */
  108. extern Rxframeind;    /* ZBIN ZBIN32, or ZHEX type of frame received */
  109. extern Rxtype;        /* Type of header received */
  110. extern Rxcount;        /* Count of data bytes received */
  111. extern Zrwindow;    /* RX window size (controls garbage count) */
  112. extern Rxtimeout;    /* Tenths of seconds to wait for something */
  113. extern char Rxhdr[4];    /* Received header */
  114. extern char Txhdr[4];    /* Transmitted header */
  115. extern long Rxpos;    /* Received file position */
  116. extern long Txpos;    /* Transmitted file position */
  117. extern Txfcs32;        /* TURE means send binary frames with 32 bit FCS */
  118. extern Crc32t;        /* Display flag indicating 32 bit CRC being sent */
  119. extern Crc32;        /* Display flag indicating 32 bit CRC being received */
  120. extern Znulls;        /* Number of nulls to send at beginning of ZDATA hdr */
  121. extern char Attn[ZATTNLEN+1];    /* Attention string rx sends to tx on err */
  122.  
  123. /* End of ZMODEM.H */
  124.