-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathzmodem.h
221 lines (187 loc) · 7.6 KB
/
zmodem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
// LoraBBS Version 2.41 Free Edition
// Copyright (C) 1987-98 Marco Maccaferri
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define Z_UpdateCRC(cp,crc) ( crctab[((crc >> 8) & 255) ^ cp] ^ (crc << 8))
#define Z_32UpdateCRC(c,crc) (cr3tab[((int) crc ^ c) & 0xff] ^ ((crc >> 8) & 0x00FFFFFFL))
/*--------------------------------------------------------------------------*/
/* Routines from N_Zmodem.H ... */
/*--------------------------------------------------------------------------*/
#define ZPAD '*'
#define ZDLE 030
#define ZDLEE (ZDLE^0100)
#define ZBIN 'A'
#define ZHEX 'B'
#define ZBIN32 'C'
/*--------------------------------------------------------------------------*/
/* Frame types (see array "frametypes" in zm.c) */
/*--------------------------------------------------------------------------*/
#define ZRQINIT 0
#define ZRINIT 1
#define ZSINIT 2
#define ZACK 3
#define ZFILE 4
#define ZSKIP 5
#define ZNAK 6
#define ZABORT 7
#define ZFIN 8
#define ZRPOS 9
#define ZDATA 10
#define ZEOF 11
#define ZFERR 12
#define ZCRC 13
#define ZCHALLENGE 14
#define ZCOMPL 15
#define ZCAN 16
#define ZFREECNT 17
#define ZCOMMAND 18
#define ZSTDERR 19
/*--------------------------------------------------------------------------*/
/* ZDLE sequences */
/*--------------------------------------------------------------------------*/
#define ZCRCE 'h'
#define ZCRCG 'i'
#define ZCRCQ 'j'
#define ZCRCW 'k'
#define ZRUB0 'l'
#define ZRUB1 'm'
/*--------------------------------------------------------------------------*/
/* Z_GetZDL return values (internal) */
/* -1 is general error, -2 is timeout */
/*--------------------------------------------------------------------------*/
#define GOTOR 0400
#define GOTCRCE (ZCRCE|GOTOR)
#define GOTCRCG (ZCRCG|GOTOR)
#define GOTCRCQ (ZCRCQ|GOTOR)
#define GOTCRCW (ZCRCW|GOTOR)
#define GOTCAN (GOTOR|030)
/*--------------------------------------------------------------------------*/
/* Byte positions within header array */
/*--------------------------------------------------------------------------*/
#define ZF0 3
#define ZF1 2
#define ZF2 1
#define ZF3 0
#define ZP0 0
#define ZP1 1
#define ZP2 2
#define ZP3 3
/*--------------------------------------------------------------------------*/
/* Bit Masks for ZRINIT flags byte ZF0 */
/*--------------------------------------------------------------------------*/
#define CANFDX 01
#define CANOVIO 02
#define CANBRK 04
#define CANCRY 010
#define CANLZW 020
#define CANFC32 040
/*--------------------------------------------------------------------------*/
/* PARAMETERS FOR ZFILE FRAME... */
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/* Conversion options one of these in ZF0 */
/*--------------------------------------------------------------------------*/
#define ZCBIN 1
#define ZCNL 2
#define ZCRESUM 3
/*--------------------------------------------------------------------------*/
/* Management options, one of these in ZF1 */
/*--------------------------------------------------------------------------*/
#define ZMNEW 1
#define ZMCRC 2
#define ZMAPND 3
#define ZMCLOB 4
#define ZMSPARS 5
#define ZMDIFF 6
#define ZMPROT 7
/*--------------------------------------------------------------------------*/
/* Transport options, one of these in ZF2 */
/*--------------------------------------------------------------------------*/
#define ZTLZW 1
#define ZTCRYPT 2
#define ZTRLE 3
/*--------------------------------------------------------------------------*/
/* Parameters for ZCOMMAND frame ZF0 (otherwise 0) */
/*--------------------------------------------------------------------------*/
#define ZCACK1 1
/*--------------------------------------------------------------------------*/
/* Miscellaneous definitions */
/*--------------------------------------------------------------------------*/
#define OK 0
#define ERROR (-1)
#define TIMEOUT (-2)
#define RCDO (-3)
#define FUBAR (-4)
#define XON ('Q'&037)
#define XOFF ('S'&037)
#define CPMEOF ('Z'&037)
#define RXBINARY FALSE
#define RXASCII FALSE
#define LZCONV 0
#define LZMANAG 0
#define LZTRANS 0
#define PATHLEN 128
#define KSIZE 1024
#define WAZOOMAX 8192
#define SECSPERDAY (24L*60L*60L)
/*--------------------------------------------------------------------------*/
/* Parameters for calling ZMODEM routines */
/*--------------------------------------------------------------------------*/
#define SPEC_COND 2
#define TRUE 1
#define FALSE 0
#define END_BATCH (-1)
#define NOTHING_TO_DO (-2)
#define DELETE_AFTER '-'
#define TRUNC_AFTER '#'
#define NOTHING_AFTER '@'
#define DO_WAZOO TRUE
#define DONT_WAZOO FALSE
/*--------------------------------------------------------------------------*/
/* ASCII MNEMONICS */
/*--------------------------------------------------------------------------*/
#define NUL 0x00
#define SOH 0x01
#define STX 0x02
#define ETX 0x03
#define EOT 0x04
#define ENQ 0x05
#define ACK 0x06
#define BEL 0x07
#define BS 0x08
#define HT 0x09
#define LF 0x0a
#define VT 0x0b
#define FF 0x0c
#define CR 0x0d
#define SO 0x0e
#define SI 0x0f
#define DLE 0x10
#define DC1 0x11
#define DC2 0x12
#define DC3 0x13
#define DC4 0x14
#define NAK 0x15
#define SYN 0x16
#define ETB 0x17
#define CAN 0x18
#define EM 0x19
#define SUB 0x1a
#define ESC 0x1b
#define FS 0x1c
#define GS 0x1d
#define RS 0x1e
#define US 0x1f
/* END OF FILE: zmodem.h */