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 | /* Globals used by ZMODEM functions */
|
---|
106 | extern Rxframeind; /* ZBIN ZBIN32, or ZHEX type of frame received */
|
---|
107 | extern Rxtype; /* Type of header received */
|
---|
108 | extern Rxcount; /* Count of data bytes received */
|
---|
109 | extern Zrwindow; /* RX window size (controls garbage count) */
|
---|
110 | extern Rxtimeout; /* Tenths of seconds to wait for something */
|
---|
111 | extern char Rxhdr[4]; /* Received header */
|
---|
112 | extern char Txhdr[4]; /* Transmitted header */
|
---|
113 | extern long Rxpos; /* Received file position */
|
---|
114 | extern long Txpos; /* Transmitted file position */
|
---|
115 | extern Txfcs32; /* TURE means send binary frames with 32 bit FCS */
|
---|
116 | extern Crc32t; /* Display flag indicating 32 bit CRC being sent */
|
---|
117 | extern Crc32; /* Display flag indicating 32 bit CRC being received */
|
---|
118 | extern Znulls; /* Number of nulls to send at beginning of ZDATA hdr */
|
---|
119 | extern char Attn[ZATTNLEN+1]; /* Attention string rx sends to tx on err */
|
---|
120 |
|
---|
121 | /* crctab.c */
|
---|
122 |
|
---|
123 | _PROTOTYPE(long UPDC32 , (int b , long c ));
|
---|
124 |
|
---|
125 | /* rbsb.c */
|
---|
126 |
|
---|
127 | _PROTOTYPE(void from_cu , (void));
|
---|
128 | _PROTOTYPE(void cucheck , (void));
|
---|
129 | _PROTOTYPE(int rdchk , (int f ));
|
---|
130 | _PROTOTYPE(int rdchk , (int f ));
|
---|
131 | _PROTOTYPE(int mode , (int n ));
|
---|
132 | _PROTOTYPE(void sendbrk , (void));
|
---|
133 |
|
---|
134 | /* zm.c */
|
---|
135 |
|
---|
136 | _PROTOTYPE(void zsbhdr , (int type , char *hdr ));
|
---|
137 | _PROTOTYPE(void zsbh32 , (char *hdr , int type ));
|
---|
138 | _PROTOTYPE(void zshhdr , (int type , char *hdr ));
|
---|
139 | _PROTOTYPE(void zsdata , (char *buf , int length , int frameend ));
|
---|
140 | _PROTOTYPE(void zsda32 , (char *buf , int length , int frameend ));
|
---|
141 | _PROTOTYPE(int zrdata , (char *buf , int length ));
|
---|
142 | _PROTOTYPE(int zrdat32 , (char *buf , int length ));
|
---|
143 | _PROTOTYPE(int zgethdr , (char *hdr , int eflag ));
|
---|
144 | _PROTOTYPE(int zrbhdr , (char *hdr ));
|
---|
145 | _PROTOTYPE(int zrbhdr32 , (char *hdr ));
|
---|
146 | _PROTOTYPE(int zrhhdr , (char *hdr ));
|
---|
147 | _PROTOTYPE(void zputhex , (int c ));
|
---|
148 | _PROTOTYPE(void zsendline , (int c ));
|
---|
149 | _PROTOTYPE(int zgethex , (void));
|
---|
150 | _PROTOTYPE(int zgeth1 , (void));
|
---|
151 | _PROTOTYPE(int zdlread , (void));
|
---|
152 | _PROTOTYPE(int noxrd7 , (void));
|
---|
153 | _PROTOTYPE(void stohdr , (long pos ));
|
---|
154 | _PROTOTYPE(long rclhdr , (char *hdr ));
|
---|
155 |
|
---|
156 | /* rz.c sz.c */
|
---|
157 |
|
---|
158 | void vfile();
|
---|
159 | _PROTOTYPE(void bibi , (int n ));
|
---|
160 |
|
---|
161 | /* End of ZMODEM.H */
|
---|