home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / C-MODEM.ARJ / DSZ.ARJ / ZMODEM.H < prev   
Encoding:
C/C++ Source or Header  |  1986-11-17  |  4.6 KB  |  104 lines

  1. /*
  2.  *   Z M O D E M . H     Manifest constants for ZMODEM
  3.  *    application to application file transfer protocol
  4.  *    6-12-86  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.  
  12. /* Frame types (see array "frametypes" in zm.c) */
  13. #define ZRQINIT 0       /* Request receive init */
  14. #define ZRINIT  1       /* Receive init */
  15. #define ZSINIT 2        /* Send init sequence (optional) */
  16. #define ZACK 3          /* ACK to above */
  17. #define ZFILE 4         /* File name from sender */
  18. #define ZSKIP 5         /* To sender: skip this file */
  19. #define ZNAK 6          /* Last packet was garbled */
  20. #define ZABORT 7        /* Abort batch transfers */
  21. #define ZFIN 8          /* Finish session */
  22. #define ZRPOS 9         /* Resume data trans at this position */
  23. #define ZDATA 10        /* Data packet(s) follow */
  24. #define ZEOF 11         /* End of file */
  25. #define ZFERR 12        /* Fatal Read or Write error Detected */
  26. #define ZCRC 13         /* Request for file CRC and response */
  27. #define ZCHALLENGE 14   /* Receiver's Challenge */
  28. #define ZCOMPL 15       /* Request is complete */
  29. #define ZCAN 16         /* Other end canned session with CAN*5 */
  30. #define ZFREECNT 17     /* Request for free bytes on filesystem */
  31. #define ZCOMMAND 18     /* Command from sending program */
  32. #define ZSTDERR 19      /* Output to standard error, data follows */
  33.  
  34. /* ZDLE sequences */
  35. #define ZCRCE 'h'       /* CRC next, frame ends, header packet follows */
  36. #define ZCRCG 'i'       /* CRC next, frame continues nonstop */
  37. #define ZCRCQ 'j'       /* CRC next, frame continues, ZACK expected */
  38. #define ZCRCW 'k'       /* CRC next, ZACK expected, end of frame */
  39. #define ZRUB0 'l'       /* Translate to rubout 0177 */
  40. #define ZRUB1 'm'       /* Translate to rubout 0377 */
  41.  
  42. /* zdlread return values (internal) */
  43. /* -1 is general error, -2 is timeout */
  44. #define GOTOR 0400
  45. #define GOTCRCE (ZCRCE|GOTOR)   /* ZDLE-ZCRCE received */
  46. #define GOTCRCG (ZCRCG|GOTOR)   /* ZDLE-ZCRCG received */
  47. #define GOTCRCQ (ZCRCQ|GOTOR)   /* ZDLE-ZCRCQ received */
  48. #define GOTCRCW (ZCRCW|GOTOR)   /* ZDLE-ZCRCW received */
  49. #define GOTCAN  (GOTOR|030)     /* CAN*5 seen */
  50.  
  51. /* Byte positions within header array */
  52. #define ZF0     3       /* First flags byte */
  53. #define ZF1     2
  54. #define ZF2     1
  55. #define ZF3     0
  56. #define ZP0     0       /* Low order 8 bits of position */
  57. #define ZP1     1
  58. #define ZP2     2
  59. #define ZP3     3       /* High order 8 bits of file position */
  60.  
  61. /* Bit Masks for ZRINIT flags byte ZF0 */
  62. #define CANFDX  01      /* Rx can send and receive true FDX */
  63. #define CANOVIO 02      /* Rx can receive data during disk I/O */
  64. #define CANBRK  04      /* Rx can send a break signal */
  65. #define CANCRY  010     /* Receiver can decrypt */
  66. #define CANLZW  020     /* Receiver can uncompress */
  67.  
  68. /* Parameters for ZSINIT frame */
  69. #define ZATTNLEN 32     /* Max length of attention string */
  70.  
  71. /* Parameters for ZFILE frame */
  72. /* Conversion options one of these in ZF0 */
  73. #define ZCBIN   1       /* Binary transfer - inhibit conversion */
  74. #define ZCNL    2       /* Convert NL to local end of line convention */
  75. #define ZCRESUM 3       /* Resume interrupted file transfer */
  76. /* Management options, one of these in ZF1 */
  77. #define ZMNEW   1       /* Transfer if source newer or longer */
  78. #define ZMCRC   2       /* Transfer if different file CRC or length */
  79. #define ZMAPND  3       /* Append contents to existing file (if any) */
  80. #define ZMCLOB  4       /* Replace existing file */
  81. #define ZMSPARS 5       /* Encoding for sparse file */
  82. #define ZMDIFF  6       /* Transfer if dates or lengths different */
  83. /* Transport options, one of these in ZF2 */
  84. #define ZTLZW   1       /* Lempel-Ziv compression */
  85. #define ZTCRYPT 2       /* Encryption */
  86. #define ZTRLE   3       /* Run Length encoding */
  87.  
  88. /* Parameters for ZCOMMAND frame ZF0 (otherwise 0) */
  89. #define ZCACK1  1       /* Acknowledge, then do command */
  90.  
  91. long rclhdr();
  92.  
  93. /* Globals used by ZMODEM functions */
  94. int Rxframeind;         /* ZBIN or ZHEX indicates type of frame received */
  95. int Rxtype;             /* Type of header received */
  96. int Rxcount;            /* Count of data bytes received */
  97. extern Rxtimeout;       /* Tenths of seconds to wait for something */
  98. char Rxhdr[4];          /* Received header */
  99. char Txhdr[4];          /* Transmitted header */
  100. long Rxpos;             /* Received file position */
  101. long Txpos;             /* Transmitted file position */
  102. char Attn[ZATTNLEN+1];  /* Attention string rx sends to tx on err */
  103.  
  104.