Annotation of sbbs/sbbs3/zmodem.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * zmodem.h
        !             3:  * zmodem constants
        !             4:  * (C) Mattheij Computer Service 1994
        !             5:  */
        !             6: 
        !             7: /* $Id: zmodem.h,v 1.3 2003/09/17 03:51:58 rswindell Exp $ */
        !             8: 
        !             9: #ifndef _ZMODEM_H
        !            10: #define _ZMODEM_H
        !            11: 
        !            12: /*
        !            13:  * ascii constants
        !            14:  */
        !            15: 
        !            16: #ifndef SOH
        !            17: #define        SOH                     0x01
        !            18: #define        STX                     0x02
        !            19: #define        EOT                     0x04
        !            20: #define        ENQ                     0x05
        !            21: #define        ACK                     0x06
        !            22: #if 0
        !            23: #define        LF                      0x0a
        !            24: #define        CR                      0x0d
        !            25: #endif
        !            26: #define DLE                    0x10
        !            27: #define        XON                     0x11
        !            28: #define        XOFF            0x13
        !            29: #define        NAK                     0x15
        !            30: #define        CAN                     0x18
        !            31: #endif
        !            32: 
        !            33: /*
        !            34:  * zmodem constants
        !            35:  */
        !            36: 
        !            37: #define ZMAXHLEN    0x10               /* maximum header information length */
        !            38: #define ZMAXSPLEN      0x400           /* maximum subpacket length */
        !            39: 
        !            40: 
        !            41: #define        ZPAD            0x2a            /* pad character; begins frames */
        !            42: #define        ZDLE            0x18            /* ctrl-x zmodem escape */
        !            43: #define        ZDLEE           0x58            /* escaped ZDLE */      
        !            44: 
        !            45: #define        ZBIN            0x41            /* binary frame indicator (CRC16) */
        !            46: #define        ZHEX            0x42            /* hex frame indicator */
        !            47: #define        ZBIN32          0x43            /* binary frame indicator (CRC32) */
        !            48: #define        ZBINR32         0x44            /* run length encoded binary frame (CRC32) */
        !            49: 
        !            50: #define        ZVBIN           0x61            /* binary frame indicator (CRC16) */
        !            51: #define        ZVHEX           0x62            /* hex frame indicator */
        !            52: #define        ZVBIN32         0x63            /* binary frame indicator (CRC32) */
        !            53: #define        ZVBINR32        0x64            /* run length encoded binary frame (CRC32) */
        !            54: 
        !            55: #define        ZRESC           0x7e            /* run length encoding flag / escape character */
        !            56: 
        !            57: /*
        !            58:  * zmodem frame types
        !            59:  */
        !            60: 
        !            61: #define        ZRQINIT         0x00            /* request receive init (s->r) */
        !            62: #define        ZRINIT          0x01            /* receive init (r->s) */
        !            63: #define        ZSINIT          0x02            /* send init sequence (optional) (s->r) */
        !            64: #define        ZACK            0x03            /* ack to ZRQINIT ZRINIT or ZSINIT (s<->r) */
        !            65: #define        ZFILE           0x04            /* file name (s->r) */
        !            66: #define        ZSKIP           0x05            /* skip this file (r->s) */
        !            67: #define        ZNAK            0x06            /* last packet was corrupted (?) */
        !            68: #define        ZABORT          0x07            /* abort batch transfers (?) */
        !            69: #define        ZFIN            0x08            /* finish session (s<->r) */
        !            70: #define        ZRPOS           0x09            /* resume data transmission here (r->s) */
        !            71: #define        ZDATA           0x0a            /* data packet(s) follow (s->r) */
        !            72: #define        ZEOF            0x0b            /* end of file reached (s->r) */
        !            73: #define        ZFERR           0x0c            /* fatal read or write error detected (?) */
        !            74: #define        ZCRC            0x0d            /* request for file CRC and response (?) */
        !            75: #define        ZCHALLENGE      0x0e            /* security challenge (r->s) */
        !            76: #define        ZCOMPL          0x0f            /* request is complete (?) */   
        !            77: #define        ZCAN            0x10            /* pseudo frame; 
        !            78:                                                                   other end cancelled session with 5* CAN */
        !            79: #define        ZFREECNT        0x11            /* request free bytes on file system (s->r) */
        !            80: #define        ZCOMMAND        0x12            /* issue command (s->r) */
        !            81: #define        ZSTDERR         0x13            /* output data to stderr (??) */
        !            82: 
        !            83: /*
        !            84:  * ZDLE sequences
        !            85:  */
        !            86: 
        !            87: #define        ZCRCE           0x68            /* CRC next, frame ends, header packet follows */
        !            88: #define        ZCRCG           0x69            /* CRC next, frame continues nonstop */
        !            89: #define        ZCRCQ           0x6a            /* CRC next, frame continuous, ZACK expected */
        !            90: #define        ZCRCW           0x6b            /* CRC next, frame ends,       ZACK expected */
        !            91: #define        ZRUB0           0x6c            /* translate to rubout 0x7f */
        !            92: #define        ZRUB1           0x6d            /* translate to rubout 0xff */
        !            93: 
        !            94: /*
        !            95:  * frame specific data.
        !            96:  * entries are prefixed with their location in the header array.
        !            97:  */
        !            98: 
        !            99: /*
        !           100:  * Byte positions within header array
        !           101:  */
        !           102: 
        !           103: #define FTYPE 0                                        /* frame type */
        !           104: 
        !           105: #define ZF0    4                                       /* First flags byte */
        !           106: #define ZF1    3
        !           107: #define ZF2    2
        !           108: #define ZF3    1
        !           109: 
        !           110: #define ZP0    1                                       /* Low order 8 bits of position */
        !           111: #define ZP1    2
        !           112: #define ZP2    3
        !           113: #define ZP3    4                                       /* High order 8 bits of file position */
        !           114: 
        !           115: /*
        !           116:  * ZRINIT frame
        !           117:  * zmodem receiver capability flags
        !           118:  */
        !           119: 
        !           120: #define        ZF0_CANFDX              0x01    /* Receiver can send and receive true full duplex */
        !           121: #define        ZF0_CANOVIO             0x02    /* receiver can receive data during disk I/O */
        !           122: #define        ZF0_CANBRK              0x04    /* receiver can send a break signal */
        !           123: #define        ZF0_CANCRY              0x08    /* Receiver can decrypt DONT USE */
        !           124: #define        ZF0_CANLZW              0x10    /* Receiver can uncompress DONT USE */
        !           125: #define        ZF0_CANFC32             0x20    /* Receiver can use 32 bit Frame Check */
        !           126: #define        ZF0_ESCCTL              0x40    /* Receiver expects ctl chars to be escaped */
        !           127: #define        ZF0_ESC8                0x80    /* Receiver expects 8th bit to be escaped */
        !           128: 
        !           129: #define ZF1_CANVHDR            0x01    /* Variable headers OK */
        !           130: 
        !           131: /*
        !           132:  * ZSINIT frame
        !           133:  * zmodem sender capability
        !           134:  */
        !           135: 
        !           136: #define ZF0_TESCCTL    0x40    /* Transmitter expects ctl chars to be escaped */
        !           137: #define ZF0_TESC8      0x80    /* Transmitter expects 8th bit to be escaped */
        !           138: 
        !           139: #define ZATTNLEN               0x20    /* Max length of attention string */
        !           140: #define ALTCOFF                        ZF1             /* Offset to alternate canit string, 0 if not used */
        !           141: 
        !           142: /*
        !           143:  * ZFILE frame
        !           144:  */
        !           145: 
        !           146: /*
        !           147:  * Conversion options one of these in ZF0
        !           148:  */
        !           149: 
        !           150: #define ZF0_ZCBIN              1               /* Binary transfer - inhibit conversion */
        !           151: #define ZF0_ZCNL               2               /* Convert NL to local end of line convention */
        !           152: #define ZF0_ZCRESUM            3               /* Resume interrupted file transfer */
        !           153: 
        !           154: /*
        !           155:  * Management include options, one of these ored in ZF1
        !           156:  */
        !           157: 
        !           158: #define ZF1_ZMSKNOLOC  0x80    /* Skip file if not present at rx */
        !           159: #define ZF1_ZMMASK             0x1f    /* Mask for the choices below */
        !           160: #define ZF1_ZMNEWL             1               /* Transfer if source newer or longer */
        !           161: #define ZF1_ZMCRC              2               /* Transfer if different file CRC or length */
        !           162: #define ZF1_ZMAPND             3               /* Append contents to existing file (if any) */
        !           163: #define ZF1_ZMCLOB             4               /* Replace existing file */
        !           164: #define ZF1_ZMNEW              5               /* Transfer if source newer */
        !           165: #define ZF1_ZMDIFF             6               /* Transfer if dates or lengths different */
        !           166: #define ZF1_ZMPROT             7               /* Protect destination file */
        !           167: #define ZF1_ZMCHNG             8               /* Change filename if destination exists */
        !           168: 
        !           169: /*
        !           170:  * Transport options, one of these in ZF2
        !           171:  */
        !           172: 
        !           173: #define ZF2_ZTNOR              0               /* no compression */
        !           174: #define ZF2_ZTLZW              1               /* Lempel-Ziv compression */
        !           175: #define ZF2_ZTRLE              3               /* Run Length encoding */
        !           176: 
        !           177: /*
        !           178:  * Extended options for ZF3, bit encoded
        !           179:  */
        !           180: 
        !           181: #define ZF3_ZCANVHDR   0x01    /* Variable headers OK */
        !           182:                                                                /* Receiver window size override */
        !           183: #define ZF3_ZRWOVR             0x04    /* byte position for receive window override/256 */
        !           184: #define ZF3_ZXSPARS            0x40    /* encoding for sparse file operations */
        !           185: 
        !           186: /*
        !           187:  * ZCOMMAND frame
        !           188:  */
        !           189: 
        !           190: #define ZF0_ZCACK1             0x01    /* Acknowledge, then do command */
        !           191: 
        !           192: typedef struct {
        !           193: 
        !           194:        unsigned char rxd_header[ZMAXHLEN];                                             /* last received header */
        !           195:        int rxd_header_len;                                                                             /* last received header size */
        !           196: 
        !           197:        /*
        !           198:         * receiver capability flags
        !           199:         * extracted from the ZRINIT frame as received
        !           200:         */
        !           201: 
        !           202:        int can_full_duplex;
        !           203:        int can_overlap_io;
        !           204:        int can_break;
        !           205:        int can_fcs_32;
        !           206:        int want_fcs_16;
        !           207:        int escape_all_control_characters;                                              /* guess */
        !           208:        int escape_8th_bit;
        !           209: 
        !           210:        int use_variable_headers;                                                               /* use variable length headers */
        !           211: 
        !           212:        /*
        !           213:         * file management options.
        !           214:         * only one should be on
        !           215:         */
        !           216: 
        !           217:        int management_newer;
        !           218:        int management_clobber;
        !           219:        int management_protect;
        !           220: 
        !           221:        /* from zmtx.c */
        !           222: 
        !           223:        #define MAX_SUBPACKETSIZE 1024
        !           224: 
        !           225:        int n_files_remaining;
        !           226:        int n_bytes_remaining;
        !           227:        unsigned char tx_data_subpacket[MAX_SUBPACKETSIZE];
        !           228: 
        !           229:        long current_file_size;
        !           230:        time_t transfer_start;
        !           231: 
        !           232:        int receive_32_bit_data;
        !           233:        int raw_trace;
        !           234:        int use_crc16;
        !           235:        long ack_file_pos;                              /* file position used in acknowledgement of correctly */
        !           236:                                                                        /* received data subpackets */
        !           237: 
        !           238:        int last_sent;
        !           239: 
        !           240:        int n_cans;
        !           241: 
        !           242:        /* Stuff added by RRS */
        !           243:        SOCKET  sock;                                   /* socket descriptor */
        !           244:        long    mode;
        !           245:        FILE*   statfp;
        !           246:        FILE*   errfp;
        !           247: 
        !           248: } zmodem_t;
        !           249: 
        !           250: char*          zmodem_ver(char *buf);
        !           251: const char* zmodem_source(void);
        !           252: int                    zmodem_get_zrinit(zmodem_t* zm);
        !           253: void           zmodem_parse_zrinit(zmodem_t* zm);
        !           254: int                    zmodem_send_zfin(zmodem_t* zm);
        !           255: int                    zmodem_send_file(zmodem_t* zm, char* name, FILE* fp);
        !           256: 
        !           257: #endif
        !           258: 
        !           259: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.