|
|
1.1 root 1: /* xmodem.h */
2:
3: /* Synchronet X/YMODEM Functions */
4:
5: /* $Id: xmodem.h,v 1.16 2006/02/24 09:50:50 rswindell Exp $ */
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: * *
11: * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html *
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) */
44:
45: typedef struct {
46:
47: void* cbdata;
48: long* mode;
49: BOOL cancelled;
50: unsigned block_size;
51: unsigned ack_timeout;
52: unsigned byte_timeout;
53: unsigned send_timeout;
54: unsigned recv_timeout;
55: unsigned errors;
56: unsigned max_errors;
57: unsigned g_delay;
58: unsigned total_files;
59: unsigned total_bytes;
60: unsigned sent_files;
61: unsigned sent_bytes;
62: int (*lputs)(void*, int level, const char* str);
63: void (*progress)(void*, unsigned block_num, ulong offset, ulong fsize, time_t t);
64: int (*send_byte)(void*, uchar ch, unsigned timeout);
65: int (*recv_byte)(void*, unsigned timeout);
66: BOOL (*is_connected)(void*);
67: BOOL (*is_cancelled)(void*);
68:
69: } xmodem_t;
70:
71:
72: void xmodem_init(xmodem_t*, void* cbdata, long* mode
73: ,int (*lputs)(void*, int level, const char* str)
74: ,void (*progress)(void* unused, unsigned block_num, ulong offset, ulong fsize, time_t t)
75: ,int (*send_byte)(void*, uchar ch, unsigned timeout)
76: ,int (*recv_byte)(void*, unsigned timeout)
77: ,BOOL (*is_connected)(void*)
78: ,BOOL (*is_cancelled)(void*)
79: );
80: char* xmodem_ver(char *buf);
81: const char* xmodem_source(void);
82: int xmodem_cancel(xmodem_t*);
83: BOOL xmodem_get_ack(xmodem_t*, unsigned tries, unsigned block_num);
84: BOOL xmodem_get_mode(xmodem_t*);
85: BOOL xmodem_put_eot(xmodem_t*);
86: int xmodem_put_ack(xmodem_t*);
87: int xmodem_put_nak(xmodem_t*, unsigned block_num);
88: int xmodem_get_block(xmodem_t*, uchar* block, unsigned block_num);
89: int xmodem_put_block(xmodem_t*, uchar* block, unsigned block_size, unsigned block_num);
90: BOOL xmodem_send_file(xmodem_t* xm, const char* fname, FILE* fp, time_t* start, ulong* sent);
91:
92: #endif /* Don't add anything after this line */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.