Annotation of sbbs/src/sbbs3/xmodem.h, revision 1.1.1.2

1.1       root        1: /* xmodem.h */
                      2: 
                      3: /* Synchronet X/YMODEM Functions */
                      4: 
1.1.1.2 ! root        5: /* $Id: xmodem.h,v 1.22 2010/03/05 04:21:45 rswindell Exp $ */
1.1       root        6: 
                      7: /****************************************************************************
                      8:  * @format.tab-size 4          (Plain Text/Source Code File Header)                    *
                      9:  * @format.use-tabs true       (see http://www.synchro.net/ptsc_hdr.html)              *
                     10:  *                                                                                                                                                     *
1.1.1.2 ! root       11:  * Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html         *
1.1       root       12:  *                                                                                                                                                     *
                     13:  * This program is free software; you can redistribute it and/or                       *
                     14:  * modify it under the terms of the GNU General Public License                         *
                     15:  * as published by the Free Software Foundation; either version 2                      *
                     16:  * of the License, or (at your option) any later version.                                      *
                     17:  * See the GNU General Public License for more details: gpl.txt or                     *
                     18:  * http://www.fsf.org/copyleft/gpl.html                                                                                *
                     19:  *                                                                                                                                                     *
                     20:  * Anonymous FTP access to the most recent released source is available at     *
                     21:  * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net     *
                     22:  *                                                                                                                                                     *
                     23:  * Anonymous CVS access to the development source and modification history     *
                     24:  * is available at cvs.synchro.net:/cvsroot/sbbs, example:                                     *
                     25:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs login                       *
                     26:  *     (just hit return, no password is necessary)                                                     *
                     27:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src                *
                     28:  *                                                                                                                                                     *
                     29:  * For Synchronet coding style and modification guidelines, see                                *
                     30:  * http://www.synchro.net/source.html                                                                          *
                     31:  *                                                                                                                                                     *
                     32:  * You are encouraged to submit any modifications (preferably in Unix diff     *
                     33:  * format) via e-mail to [email protected]                                                                      *
                     34:  *                                                                                                                                                     *
                     35:  * Note: If this box doesn't appear square, then you need to fix your tabs.    *
                     36:  ****************************************************************************/
                     37: 
                     38: #ifndef _XMODEM_H_
                     39: #define _XMODEM_H_
                     40: 
                     41: #include "gen_defs.h"
                     42: 
                     43: #define CPMEOF         CTRL_Z  /* CP/M End of file (^Z)                                        */
1.1.1.2 ! root       44: #define XMODEM_MIN_BLOCK_SIZE  128
        !            45: #define XMODEM_MAX_BLOCK_SIZE  1024
1.1       root       46: 
                     47: typedef struct {
                     48: 
                     49:        void*           cbdata;
                     50:        long*           mode;
                     51:        BOOL            cancelled;
1.1.1.2 ! root       52:        BOOL            crc_mode_supported;     /* for send */
        !            53:        BOOL            g_mode_supported;       /* for send */
1.1       root       54:        unsigned        block_size;
1.1.1.2 ! root       55:        unsigned        max_block_size;         /* for recv */
1.1       root       56:        unsigned        ack_timeout;
                     57:        unsigned        byte_timeout;
                     58:        unsigned        send_timeout;
                     59:        unsigned        recv_timeout;
                     60:        unsigned        errors;
                     61:        unsigned        max_errors;
1.1.1.2 ! root       62:        unsigned        fallback_to_xmodem; /* fallback to Xmodem after this many Ymodem send attempts */
1.1       root       63:        unsigned        g_delay;
1.1.1.2 ! root       64:        ulong           total_files;
        !            65:        int64_t         total_bytes;
1.1       root       66:        unsigned        sent_files;
1.1.1.2 ! root       67:        int64_t         sent_bytes;
        !            68:        int                     *log_level;
1.1       root       69:        int                     (*lputs)(void*, int level, const char* str);
1.1.1.2 ! root       70:        void            (*progress)(void*, unsigned block_num, int64_t offset, int64_t fsize, time_t t);
1.1       root       71:        int                     (*send_byte)(void*, uchar ch, unsigned timeout);
                     72:        int                     (*recv_byte)(void*, unsigned timeout);
                     73:        BOOL            (*is_connected)(void*);
                     74:        BOOL            (*is_cancelled)(void*);
1.1.1.2 ! root       75:        void            (*flush)(void*);
1.1       root       76: 
                     77: } xmodem_t;
                     78: 
                     79: 
                     80: void           xmodem_init(xmodem_t*, void* cbdata, long* mode
                     81:                                                ,int    (*lputs)(void*, int level, const char* str)
1.1.1.2 ! root       82:                                                ,void   (*progress)(void* unused, unsigned block_num, int64_t offset, int64_t fsize, time_t t)
1.1       root       83:                                                ,int    (*send_byte)(void*, uchar ch, unsigned timeout)
                     84:                                                ,int    (*recv_byte)(void*, unsigned timeout)
                     85:                                                ,BOOL   (*is_connected)(void*)
                     86:                                                ,BOOL   (*is_cancelled)(void*)
1.1.1.2 ! root       87:                                                ,void   (*flush)(void*)
1.1       root       88:                                                );
                     89: char*          xmodem_ver(char *buf);
                     90: const char* xmodem_source(void);
                     91: int                    xmodem_cancel(xmodem_t*);
1.1.1.2 ! root       92: int                    xmodem_get_ack(xmodem_t*, unsigned tries, unsigned block_num);
1.1       root       93: BOOL           xmodem_get_mode(xmodem_t*);
                     94: BOOL           xmodem_put_eot(xmodem_t*);
                     95: int                    xmodem_put_ack(xmodem_t*);
                     96: int                    xmodem_put_nak(xmodem_t*, unsigned block_num);
                     97: int                    xmodem_get_block(xmodem_t*, uchar* block, unsigned block_num);
                     98: int                    xmodem_put_block(xmodem_t*, uchar* block, unsigned block_size, unsigned block_num);
1.1.1.2 ! root       99: BOOL           xmodem_send_file(xmodem_t* xm, const char* fname, FILE* fp, time_t* start, int64_t* sent);
1.1       root      100: 
                    101: #endif /* Don't add anything after this line */

unix.superglobalmegacorp.com

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