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