1*4882a593Smuzhiyun /* zmodem.h - ZMODEM protocol constants 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun Copyright (C) until 1998 Chuck Forsberg (OMEN Technology Inc) 4*4882a593Smuzhiyun Copyright (C) 1996, 1997 Uwe Ohse 5*4882a593Smuzhiyun 6*4882a593Smuzhiyun This program is free software; you can redistribute it and/or modify 7*4882a593Smuzhiyun it under the terms of the GNU General Public License as published by 8*4882a593Smuzhiyun the Free Software Foundation; either version 2, or (at your option) 9*4882a593Smuzhiyun any later version. 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun This program is distributed in the hope that it will be useful, 12*4882a593Smuzhiyun but WITHOUT ANY WARRANTY; without even the implied warranty of 13*4882a593Smuzhiyun MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*4882a593Smuzhiyun GNU General Public License for more details. 15*4882a593Smuzhiyun 16*4882a593Smuzhiyun You should have received a copy of the GNU General Public License 17*4882a593Smuzhiyun along with this program; if not, write to the Free Software 18*4882a593Smuzhiyun Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19*4882a593Smuzhiyun 02111-1307, USA. 20*4882a593Smuzhiyun 21*4882a593Smuzhiyun * 05-23-87 Chuck Forsberg Omen Technology Inc 22*4882a593Smuzhiyun */ 23*4882a593Smuzhiyun #define ZPAD '*' /* 052 Padding character begins frames */ 24*4882a593Smuzhiyun #define ZDLE 030 /* Ctrl-X Zmodem escape - `ala BISYNC DLE */ 25*4882a593Smuzhiyun #define ZDLEE (ZDLE^0100) /* Escaped ZDLE as transmitted */ 26*4882a593Smuzhiyun #define ZBIN 'A' /* Binary frame indicator */ 27*4882a593Smuzhiyun #define ZHEX 'B' /* HEX frame indicator */ 28*4882a593Smuzhiyun #define ZBIN32 'C' /* Binary frame with 32 bit FCS */ 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun /* Frame types (see array "frametypes" in zm.c) */ 31*4882a593Smuzhiyun #define ZRQINIT 0 /* Request receive init */ 32*4882a593Smuzhiyun #define ZRINIT 1 /* Receive init */ 33*4882a593Smuzhiyun #define ZSINIT 2 /* Send init sequence (optional) */ 34*4882a593Smuzhiyun #define ZACK 3 /* ACK to above */ 35*4882a593Smuzhiyun #define ZFILE 4 /* File name from sender */ 36*4882a593Smuzhiyun #define ZSKIP 5 /* To sender: skip this file */ 37*4882a593Smuzhiyun #define ZNAK 6 /* Last packet was garbled */ 38*4882a593Smuzhiyun #define ZABORT 7 /* Abort batch transfers */ 39*4882a593Smuzhiyun #define ZFIN 8 /* Finish session */ 40*4882a593Smuzhiyun #define ZRPOS 9 /* Resume data trans at this position */ 41*4882a593Smuzhiyun #define ZDATA 10 /* Data packet(s) follow */ 42*4882a593Smuzhiyun #define ZEOF 11 /* End of file */ 43*4882a593Smuzhiyun #define ZFERR 12 /* Fatal Read or Write error Detected */ 44*4882a593Smuzhiyun #define ZCRC 13 /* Request for file CRC and response */ 45*4882a593Smuzhiyun #define ZCHALLENGE 14 /* Receiver's Challenge */ 46*4882a593Smuzhiyun #define ZCOMPL 15 /* Request is complete */ 47*4882a593Smuzhiyun #define ZCAN 16 /* Other end canned session with CAN*5 */ 48*4882a593Smuzhiyun #define ZFREECNT 17 /* Request for free bytes on filesystem */ 49*4882a593Smuzhiyun #define ZCOMMAND 18 /* Command from sending program */ 50*4882a593Smuzhiyun #define ZSTDERR 19 /* Output to standard error, data follows */ 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun /* ZDLE sequences */ 53*4882a593Smuzhiyun #define ZCRCE 'h' /* CRC next, frame ends, header packet follows */ 54*4882a593Smuzhiyun #define ZCRCG 'i' /* CRC next, frame continues nonstop */ 55*4882a593Smuzhiyun #define ZCRCQ 'j' /* CRC next, frame continues, ZACK expected */ 56*4882a593Smuzhiyun #define ZCRCW 'k' /* CRC next, ZACK expected, end of frame */ 57*4882a593Smuzhiyun #define ZRUB0 'l' /* Translate to rubout 0177 */ 58*4882a593Smuzhiyun #define ZRUB1 'm' /* Translate to rubout 0377 */ 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun /* zdlread return values (internal) */ 61*4882a593Smuzhiyun /* -1 is general error, -2 is timeout */ 62*4882a593Smuzhiyun #define GOTOR 0400 63*4882a593Smuzhiyun #define GOTCRCE (ZCRCE|GOTOR) /* ZDLE-ZCRCE received */ 64*4882a593Smuzhiyun #define GOTCRCG (ZCRCG|GOTOR) /* ZDLE-ZCRCG received */ 65*4882a593Smuzhiyun #define GOTCRCQ (ZCRCQ|GOTOR) /* ZDLE-ZCRCQ received */ 66*4882a593Smuzhiyun #define GOTCRCW (ZCRCW|GOTOR) /* ZDLE-ZCRCW received */ 67*4882a593Smuzhiyun #define GOTCAN (GOTOR|030) /* CAN*5 seen */ 68*4882a593Smuzhiyun 69*4882a593Smuzhiyun /* Byte positions within header array */ 70*4882a593Smuzhiyun #define ZF0 3 /* First flags byte */ 71*4882a593Smuzhiyun #define ZF1 2 72*4882a593Smuzhiyun #define ZF2 1 73*4882a593Smuzhiyun #define ZF3 0 74*4882a593Smuzhiyun #define ZP0 0 /* Low order 8 bits of position */ 75*4882a593Smuzhiyun #define ZP1 1 76*4882a593Smuzhiyun #define ZP2 2 77*4882a593Smuzhiyun #define ZP3 3 /* High order 8 bits of file position */ 78*4882a593Smuzhiyun 79*4882a593Smuzhiyun /* Bit Masks for ZRINIT flags byte ZF0 */ 80*4882a593Smuzhiyun #define CANFDX 0x01 /* Rx can send and receive true FDX */ 81*4882a593Smuzhiyun #define CANOVIO 0x02 /* Rx can receive data during disk I/O */ 82*4882a593Smuzhiyun #define CANBRK 0x04 /* Rx can send a break signal */ 83*4882a593Smuzhiyun #define CANCRY 0x08 /* Receiver can decrypt */ 84*4882a593Smuzhiyun #define CANLZW 0x10 /* Receiver can uncompress */ 85*4882a593Smuzhiyun #define CANFC32 0x20 /* Receiver can use 32 bit Frame Check */ 86*4882a593Smuzhiyun #define ESCCTL 0x40 /* Receiver expects ctl chars to be escaped */ 87*4882a593Smuzhiyun #define ESC8 0x80 /* Receiver expects 8th bit to be escaped */ 88*4882a593Smuzhiyun /* Bit Masks for ZRINIT flags byze ZF1 */ 89*4882a593Smuzhiyun #define ZF1_CANVHDR 0x01 /* Variable headers OK, unused in lrzsz */ 90*4882a593Smuzhiyun #define ZF1_TIMESYNC 0x02 /* nonstandard, Receiver request timesync */ 91*4882a593Smuzhiyun 92*4882a593Smuzhiyun /* Parameters for ZSINIT frame */ 93*4882a593Smuzhiyun #define ZATTNLEN 32 /* Max length of attention string */ 94*4882a593Smuzhiyun /* Bit Masks for ZSINIT flags byte ZF0 */ 95*4882a593Smuzhiyun #define TESCCTL 0100 /* Transmitter expects ctl chars to be escaped */ 96*4882a593Smuzhiyun #define TESC8 0200 /* Transmitter expects 8th bit to be escaped */ 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun /* Parameters for ZFILE frame */ 99*4882a593Smuzhiyun /* Conversion options one of these in ZF0 */ 100*4882a593Smuzhiyun #define ZCBIN 1 /* Binary transfer - inhibit conversion */ 101*4882a593Smuzhiyun #define ZCNL 2 /* Convert NL to local end of line convention */ 102*4882a593Smuzhiyun #define ZCRESUM 3 /* Resume interrupted file transfer */ 103*4882a593Smuzhiyun /* Management include options, one of these ored in ZF1 */ 104*4882a593Smuzhiyun #define ZF1_ZMSKNOLOC 0x80 /* Skip file if not present at rx */ 105*4882a593Smuzhiyun /* Management options, one of these ored in ZF1 */ 106*4882a593Smuzhiyun #define ZF1_ZMMASK 0x1f /* Mask for the choices below */ 107*4882a593Smuzhiyun #define ZF1_ZMNEWL 1 /* Transfer if source newer or longer */ 108*4882a593Smuzhiyun #define ZF1_ZMCRC 2 /* Transfer if different file CRC or length */ 109*4882a593Smuzhiyun #define ZF1_ZMAPND 3 /* Append contents to existing file (if any) */ 110*4882a593Smuzhiyun #define ZF1_ZMCLOB 4 /* Replace existing file */ 111*4882a593Smuzhiyun #define ZF1_ZMNEW 5 /* Transfer if source newer */ 112*4882a593Smuzhiyun /* Number 5 is alive ... */ 113*4882a593Smuzhiyun #define ZF1_ZMDIFF 6 /* Transfer if dates or lengths different */ 114*4882a593Smuzhiyun #define ZF1_ZMPROT 7 /* Protect destination file */ 115*4882a593Smuzhiyun #define ZF1_ZMCHNG 8 /* Change filename if destination exists */ 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun /* Transport options, one of these in ZF2 */ 118*4882a593Smuzhiyun #define ZTLZW 1 /* Lempel-Ziv compression */ 119*4882a593Smuzhiyun #define ZTCRYPT 2 /* Encryption */ 120*4882a593Smuzhiyun #define ZTRLE 3 /* Run Length encoding */ 121*4882a593Smuzhiyun /* Extended options for ZF3, bit encoded */ 122*4882a593Smuzhiyun #define ZXSPARS 64 /* Encoding for sparse file operations */ 123*4882a593Smuzhiyun 124*4882a593Smuzhiyun /* Parameters for ZCOMMAND frame ZF0 (otherwise 0) */ 125*4882a593Smuzhiyun #define ZCACK1 1 /* Acknowledge, then do command */ 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun /* Globals used by ZMODEM functions */ 128*4882a593Smuzhiyun #if 0 129*4882a593Smuzhiyun extern int Rxframeind; /* ZBIN ZBIN32, or ZHEX type of frame received */ 130*4882a593Smuzhiyun extern int Rxtype; /* Type of header received */ 131*4882a593Smuzhiyun extern int Zrwindow; /* RX window size (controls garbage count) */ 132*4882a593Smuzhiyun extern char Rxhdr[4]; /* Received header */ 133*4882a593Smuzhiyun extern char Txhdr[4]; /* Transmitted header */ 134*4882a593Smuzhiyun extern long Txpos; /* Transmitted file position */ 135*4882a593Smuzhiyun extern int Txfcs32; /* TURE means send binary frames with 32 bit FCS */ 136*4882a593Smuzhiyun extern int Crc32t; /* Display flag indicating 32 bit CRC being sent */ 137*4882a593Smuzhiyun extern int Crc32; /* Display flag indicating 32 bit CRC being received */ 138*4882a593Smuzhiyun extern int Znulls; /* Number of nulls to send at beginning of ZDATA hdr */ 139*4882a593Smuzhiyun extern char Attn[ZATTNLEN+1]; /* Attention string rx sends to tx on err */ 140*4882a593Smuzhiyun #endif 141*4882a593Smuzhiyun 142*4882a593Smuzhiyun /* End of ZMODEM.H */ 143