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

📄 zmdos.h

📁 这个程序是用于通讯的
💻 H
📖 第 1 页 / 共 2 页
字号:

/*/////////////////////////////////////////////////////////////////////
//                                                                   //
//  ZMDOS.H -- zmodem protocol header file                           //
//                                                                   //
//    Mike Dumdei, 6 Holly Lane, Texarkana TX, 75503                 //
//                                                                   //
//////////////////////////////////////////////////////////////////// */
#ifdef __cplusplus
  extern "C" {
#endif

/*/////////////////////////////////////////////////////////
//                                                       //
//  general                                              //
//                                                       //
//////////////////////////////////////////////////////// */
typedef unsigned char BYTE;
typedef unsigned int WORD;
typedef unsigned long DWORD;

/*/////////////////////////////////////////////////////////
//                                                       //
//  compiler specific                                    //
//                                                       //
//////////////////////////////////////////////////////// */
#ifndef __TURBOC__
  #ifndef __ZTC__
    #define __MSC__
  #endif
#endif

#define MAX_PATH            148
#define KBHIT               _bios_keybrd(1)
#define KBREAD              _bios_keybrd(0)
#define Upd16Crc(crc,c)     ((Crc16Tbl[(crc) >> 8]) ^ (((crc) << 8) ^ (c)))

/*--------------------------------------------+
|  DOS findfirst/findnext structure           |
+--------------------------------------------*/
typedef struct
{
    char reserved[21];
    char attrib;
    unsigned time;
    unsigned date;
    long size;
    char name[13];
} DF;

#ifdef __TURBOC__
  #if (__TURBOC__ < 0x400)
    #define _A_NORMAL           0
    #define _A_RDONLY           FA_RDONLY
    #define _A_SUBDIR           FA_DIREC
    #define _A_HIDDEN           FA_HIDDEN
    #define _A_SYSTEM           FA_SYSTEM
    #define _A_VOLID            FA_LABEL
  #endif
#endif

#ifndef _MAX_PATH
 #define _MAX_PATH 148
#endif

/*/////////////////////////////////////////////////////////
//                                                       //
//  selected definitions from Chuck Forsberg's PD zmodem //
//                                                       //
//////////////////////////////////////////////////////// */
/*--------------------------------------------+
|  limits                                     |
+--------------------------------------------*/
#define ZATTNLEN    32        /* max length of attention string */
#define MAXPACKET 1024        /* maximum size of a packet */

/*--------------------------------------------+
|  special character definitions              |
+--------------------------------------------*/
#define ZPAD        '*'       /* pad char - begins zmodem frames */
#define ZDLE      '\x18'      /* zmodem escape - aka CAN, Ctrl-X */
#define ZBIN        'A'       /* binary frame indicator (CRC-16) */
#define ZHEX        'B'       /* hex frame indicator */
#define ZBIN32      'C'       /* binary frame indicator (CRC-32) */
#define XON       '\x11'      /* XON character */
 /*++ zdle sequences ++*/
#define ZCRCE       'h'       /* CRC next, frame ends, hdr 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 DEL '\x7f' */
#define ZRUB1       'm'       /* translate to DEL '\xff' */
#define GOTCRCE (ZCRCE|256)   /* ZDLE-ZCRCE received */
#define GOTCRCG (ZCRCG|256)   /* ZDLE-ZCRCG received */
#define GOTCRCQ (ZCRCQ|256)   /* ZDLE-ZCRCQ received */
#define GOTCRCW (ZCRCW|256)   /* ZDLE-ZCRCW received */
#define GOTCAN     (256)      /* got 5 ZDLEs */

/*--------------------------------------------+
|  zmodem frame types                         |
+--------------------------------------------*/
#define ZRQINIT      0        /* request receiver init */
#define ZRINIT       1        /* receiver init */
#define ZSINIT       2        /* sender init sequence (optional) */
#define ZACK         3        /* zmodem ACK */
#define ZFILE        4        /* file name from sender */
#define ZSKIP        5        /* to sender: skip this file */
#define ZNAK         6        /* zmodem NAK */
#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        /* disk I/O 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 filesystem */
#define ZCOMMAND    18        /* command from sending program */
#define ZSTDERR     19        /* output to standard error, data follows */

/*--------------------------------------------+
|  Bit Masks for ZRINIT ZF0 flags             |
+--------------------------------------------*/
#define CANFDX     0x01       /* receiver can send and receive true FDX */
#define CANOVIO    0x02       /* receiver can receive during disk I/O */
#define CANBRK     0x04       /* receiver can send a break signal */
#define CANCRY     0x08       /* receiver can decrypt */
#define CANLZW     0x10       /* receiver can uncompress */
#define CANFC32    0x20       /* receiver can use 32 bit Frame Check */
#define ESCCTL     0x40       /* receiver expects ctl chars to be escaped */
#define ESC8       0x80       /* receiver expects 8th bit to be escaped */

/*--------------------------------------------+
|  Bit Masks for ZSINIT ZF0 flags             |
+--------------------------------------------*/
#define TESCCTL    0x40       /* tx expects ctl chars to be escaped */
#define TESC8      0x80       /* tx expects 8th bit to be escaped */

/*--------------------------------------------+
|  Bit masks for ZFILE header flags           |
+--------------------------------------------*/
 /*++ ZF0 flag, conversion options ++*/
#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 */
 /*++ ZF1 flag, management options ++*/
#define ZMSKNOLOC  0x80     /* skip file if not present at rx */
#define ZMMASK     0x1f     /* 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 */
#define ZMDIFF       6      /* transfer if dates or lengths different */
#define ZMPROT       7      /* protect destination file */

/*--------------------------------------------+
|  Error return values                        |
+--------------------------------------------*/
#define GARB_COUNT     (-12)    /* header not found on call to ZRecvHdr */
#define LONG_PKT       (-11)    /* exceeded expected block length */
#define GARBLED_PKT    (-10)    /* unexpected data/invalid ZDLE sequence */
#define BAD_CRC         (-9)    /* CRC incorrect */
#define TIMED_OUT       (-8)    /* timed out on character receive */

#define SYNC_ERR        (-6)    /* couldn't synchronize file positions */
#define MEM_ERR         (-5)    /* memory allocation error */
#define FILE_ERR        (-4)    /* DOS read/write error */
#define LOST_CARRIER    (-3)    /* lost carrier */
#define REM_ABORT       (-2)    /* aborted by remote */
#define LCL_ABORT       (-1)    /* aborted by local operator */

/*/////////////////////////////////////////////////////////
//                                                       //
//  zmodem definitions specific to this implementation   //
//                                                       //
//////////////////////////////////////////////////////// */
/*--------------------------------------------+
|  zmodem message types                       |
+--------------------------------------------*/
#define M_RHDR      0       /* received header */
#define M_SHDR      1       /* sent header */
#define M_BLK0      2       /* block 0 data processed (name, size, etc.) */
#define M_CLASH     3       /* file name clash occurred (use ExistOpts) */
#define M_FILE      4       /* start of transfer, FilePos = 1st position */
#define M_EOF       5       /* end of transfer (1 file) */
#define M_DATA      6       /* sent or received file data packet */
#define M_FLOW      7       /* change in XOFF or CTS flow status */
#define M_IDLE      8       /* waiting for character or for tx to empty */
#define M_RESET     9       /* reset to 'first file' condition */

⌨️ 快捷键说明

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