⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zmodem.h

📁 Embedded zModem C sources
💻 H
字号:
#define ZPAD		'*'	/* 052 Padding character begins frames */
#define ZDLE		030	/* Ctrl-X ZMODEM escape */
#define ZDLEE		(ZDLE^0100)		/* escaped ZDLE as transmitted */
#define ZBIN		'A'		/* Binary frame indicator (CRC-16) */
#define ZHEX		'B'		/* HEX frame indicator */
#define ZBIN32		'C'		/* Binary frame with 32 bit FCS */
#define ZBINR32		'D'		/* RLE packed Binary frame with 32 bit FCS */
#define ZVBIN		'a'		/* Binary frame indicator (CRC-16) */
#define ZVHEX		'b'		/* HEX frame indicator */
#define ZVBIN32		'c'		/* Binary frame with 32 bit FCS */
#define ZVBINR32	'd'		/* RLE packed Binary frame with 32 bit FCS */
#define ZRESC		0176	/* RLE flag/escape character */
#define ZMAXHLEN	16		/* Max header information length NEVER change */
#define ZMAXSPLEN	1024	/* Max subpacket length NEVER change */

///////////////////////////////////////////////////////////////////////////////
// frame types
#define ZRQINIT		0	/* Request receive init */
#define ZRINIT		1	/* Receive init */
#define ZSINIT		2	/* Send init sequence (optional) */
#define ZACK		3	/* ACK to above */
#define ZFILE		4	/* File name from sender */
#define ZSKIP		5	/* To sender : skip this file */
#define ZNAK		6	/* Last packet was garbled */
#define ZABORT		7	/* Abort batch transfers */
#define ZFIN		8	/* Finish session */
#define ZRPOS		9	/* Resume data trans at this position */
#define ZDATA		10	/* Data packet(s) follow */
#define ZEOF		11	/* End of file */
#define ZFERR		12	/* Fatal Read or Write error Detected */
#define ZCRC		13	/* Request for file CRC and response */
#define ZCHALLENGE	14	/* Receiver's Challenge */
#define ZCOMPL		15	/* Request is complete */
#define ZCAN		16	/* Other end canned session with CAN*5 */
#define ZFREECNT	17	/* Request for free bytes on file system */
#define ZCOMMAND	18	/* Command from sending program */
#define ZSTDERR		19	/* Output to standard error, data follows */

///////////////////////////////////////////////////////////////////////////////
// ZDLE sequences(ZDLE(030) + next character)
#define ZCRCE		'h'	/* CRC next, frame ends, header packet follows */
#define ZCRCG		'i'	/* CRC next, frame continues nonstop */
#define ZCRCQ		'j'	/* CRC next, frame continues, ZACK expected */
#define ZCRCW		'k'	/* CRC next, ZACK expected, end of frame */
#define ZRUB0		'l'	/* Translate to rubout 0177 */
#define ZRUB1		'm'	/* Translate to rubout 0377 */

///////////////////////////////////////////////////////////////////////////////
// zDLERead return values (internal)
/* -1 is general error, -2 is timeout */
#define GOTOR 	 0400
#define GOTCRCE (ZCRCE|GOTOR)	/* ZDLE-ZCRCE received */
#define GOTCRCG (ZCRCG|GOTOR)	/* ZDLE-ZCRCG received */
#define GOTCRCQ (ZCRCQ|GOTOR)	/* ZDLE-ZCRCQ received */
#define GOTCRCW (ZCRCW|GOTOR)	/* ZDLE-ZCRCW received */
#define GOTCAN	(GOTOR|030)	/* CAN*5 seen */


///////////////////////////////////////////////////////////////////////////////
// byte position within header array
#define ZF0		3	/* first flag byte */
#define ZF1		2
#define ZF2		1
#define ZF3		0
#define ZP0		0	/* low order 8 bits of position */
#define ZP1		1
#define ZP2		2
#define ZP3		3	/* high order 8 bits of file position */

///////////////////////////////////////////////////////////////////////////////
// bit mask for ZRINIT flags byte ZF0
#define CANFDX	01	/* Rx can send and receive true FDX */
#define CANOVIO	02	/* Rx can receive data during disk I/O */
#define CANBRK	04	/* Rx can send a break signal */
#define CANRLE	010	/* Receiver can decode RLE */
#define CANLZW	020	/* Receiver can uncompress */
#define CANFC32	040	/* Receiver can use 32 bit Frame Check */
#define ESCCTL 0100	/* Receiver expects ctl chars to be escaped */
#define ESC8   0200	/* Receiver expects 8th bit to be escaped */

///////////////////////////////////////////////////////////////////////////////
// bit mask for ZRINIT flags byte ZF1
#define CANVHDR	01	/* Variable haders ok */
#define ZRRQWN	8	/* Receiver specified window size in ZRPXWN */
#define ZRRQQQ	16	/* Additional control chars to quote in ZRPXQQ */
#define ZRQNVH	(ZRRQWN | ZRRQQQ)	/* Variable len hdr read to access info */

///////////////////////////////////////////////////////////////////////////////
// parameters for ZSINIT frame
#define ZATTNLEN	32	/* max length of attention string */
#define ALTCOFF		ZF1	/* offset to alternate canit string, 0 if not used */

///////////////////////////////////////////////////////////////////////////////
// bit mask for ZSINIT flags byte ZF0
#define TESCCTL	0100	/* Transmitter expects ctl chars to be escaped */
#define TESC8	0200	/* Transmitter expects 8th bits to be escaped */

///////////////////////////////////////////////////////////////////////////////
// parameters for ZFILE frame
// conversion options one of these in ZFO
#define ZCBIN	1		/* Binary transfer - inhibit conversion */
#define ZCNL	2		/* Convert NL to local end of line convention */
#define ZCRESUM	3		/* Resume interrupted file transfer */
// management include options, one of these ored in ZF1
#define ZMSKNOLOC	0200	/* Skip file if not present at rx */
// management options, one of these ored in ZF1
#define ZMMASK	037		/* Mask for the choices below */
#define ZMNEWL	1		/* Transfer if source newer or longer */
#define ZMCRC	2		/* Transfer if different file CRC or length */
#define ZMAPND	3		/* Append contents to existing file(if any) */
#define ZMCLOB	4		/* Replace existing file */
#define ZMNEW	5		/* Transfer if source newer */
// Number 5 is alive ... 
#define ZMDIFF	6		/* Transfer if dates or lengths different */
#define ZMPROT	7		/* Protect destination file */
#define ZMCHNG	8		/* Change filenames if destination exists */
// transport options, one of these in ZF2
#define ZTLZW	1		/* Limpel-Ziv comporession */
#define ZTRLE	2		/* Run Length encoding */
// Extended options for ZF3, bit encoded
#define ZXSPARS	64		/* Encoding for sparse file operations */
#define ZCANVHDR	01	/* Variable headers OK */
// Receiver window size override
#define ZRWOVR	4		/* byte position for receive window override/256 */

// parameters for ZCOMMAND frame ZF0 (otherwise 0)
#define ZCACK1	1		/* Acknowledge, then do command */

#define CAN		('X' & 037)		/* 030 == ZDLE */
#define XOFF	('s' & 037)		/* 023 == ^s */
#define XON		('q' & 037)		/* 021 == ^q */

#define OK		(0)
#define ERROR	(-1)
#define TIMEOUT	(-2)
#define RCD0	(-3)
#define GCOUNT	(-4)

extern void zPutch(char ch);
extern int zGetch(int nTime);
extern void TtyMode(int m);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -