home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
200-299
/
ff236.lzh
/
XprZmodem
/
defs.h
< prev
next >
Wrap
C/C++ Source or Header
|
1989-08-09
|
6KB
|
158 lines
/* defs.h: Definitions for xprzmodem.library;
Version 1.0, 29 July 1989, by Rick Huebner.
Released to the Public Domain; do as you like with this code. */
/* #define DEBUG 1 */
/* Return codes */
#define OK 0
#define ERROR (-1)
#define TIMEOUT (-2)
#define RCDO (-3)
/* Relevant control characters */
#define CR ('M'&0x1F) /* ^M */
#define DLE ('P'&0x1F) /* ^P */
#define XON ('Q'&0x1F) /* ^Q */
#define XOFF ('S'&0x1F) /* ^S */
#define CAN ('X'&0x1F) /* ^X */
#define CPMEOF ('Z'&0x1F) /* ^Z */
/* Misc. program constants */
#define LZMANAG 0 /* Default ZMODEM file management mode */
#define LZTRANS 0 /* Default ZMODEM file transport mode */
#define PATHLEN 256 /* What's the max legal path size? */
#define CONFIGLEN 32 /* Max length of transfer options string */
#define KSIZE 1024 /* Max allowable packet size */
#define MINBLOCK 32 /* Min allowable packet size */
#define MAXGOODNEEDED 8192 /* Max # good bytes required to bump packet size */
/* Provision for future 7-bit ZMODEM; for now, there's no difference */
#define sendline xsendline
/* Replacement for global variables normally used, in order to make code
fully reentrant; each invocation allocs their own Vars, and passes the
struct pointer down through the entire program so they're always available.
Pointer to this struct is usually able to be a register variable, so access
is no worse than any stack variable (all register-relative). Kinda
kludgey, but the original ZModem code design depended on lots of globals,
and I didn't want to redesign the whole damn thing. Besides, it's more
efficient than constantly pushing & popping args all over the place. */
struct Vars {
struct XPR_IO io; /* Copy of XProtocol IO struct passed in by term prog. */
struct XPR_UPDATE xpru; /* Scratchpad xpr_update() control struct */
UBYTE Zconv; /* ZMODEM file conversion request */
UBYTE Zmanag; /* ZMODEM file management request */
UBYTE Ztrans; /* ZMODEM file transport request */
UBYTE Lastsent; /* Last text char written by putsec() */
UBYTE Lastzsent; /* Last char sent by zsendline() */
UBYTE Fileflush; /* Flush file I/O buffer before closing? */
UBYTE Msgbuf[128]; /* Scratchpad buffer for printing messages */
UBYTE Filename[PATHLEN]; /* Name of the file being up/downloaded */
UBYTE Modembuf[256]; /* Input buffer for data from modem */
UBYTE *Modemchar; /* Next char to get from Modembuf */
UBYTE *Filebuf; /* File I/O buffer address */
UBYTE *Filebufptr; /* Current position within Filebuf */
char Rxbinary; /* Force binary mode download? */
char Rxascii; /* Force text mode download? */
char Thisbinary; /* Receive this file in binary mode? */
char Lzconv; /* Suggested binary/text mode for uploads */
char Eofseen; /* Text-mode EOF marker (^Z) received on download? */
short Filcnt; /* Number of files opened for transmission */
short Errcnt; /* Number of files unreadable */
short Noroom; /* Flags 'insufficient disk space' errors */
short Rxbuflen; /* Largest frame they're willing to xfer */
short Tframlen; /* Largest frame we're willing to xfer */
short Rxtimeout; /* Tenths of seconds to wait for something */
short Tryzhdrtype; /* Header type to send corresponding to Last rx close */
short Modemcount; /* Number of bytes available in Modembuf */
long File; /* Handle of file being transferred */
long Oldstatus; /* Original terminal program's modem settings */
long Baud; /* BPS setting of modem */
long Strtpos; /* Starting byte position of transfer */
long Starttime; /* Time transfer started */
long Fsize; /* Size of file being transferred */
long Rxbytes; /* Number of bytes received so far */
long Filebufpos; /* File offset of data in Filebuf */
long Filebufmax; /* Size of Filebuf */
long Filebuflen; /* Number of bytes currently stored in Filebuf */
long Filebufcnt; /* Number of bytes remaining/written in Filebuf */
UBYTE Pktbuf[KSIZE]; /* File data packet buffer */
UBYTE Rxhdr[4]; /* Received header */
UBYTE Txhdr[4]; /* Transmitted header */
UBYTE Attn[ZATTNLEN+1]; /* Attention string rx sends to tx on err */
short Rxframeind; /* ZBIN or ZHEX; type of frame received */
short Rxtype; /* Type of header received */
short Rxcount; /* Count of data bytes received */
short Znulls; /* Number of nulls to send at beginning of ZDATA hdr */
long Rxpos; /* Received file position */
long Txpos; /* Transmitted file position */
};
/* Function declarations; change to ANSI prototypes when Manx gets their act together */
long XProtocolSend();
short getzrxinit();
void sendbatch();
short sendone();
short sendname();
short zsendfile();
short zsendfdata();
short getinsync();
void saybibi();
long XProtocolReceive();
short rcvbatch();
short tryz();
short rzfiles();
short rzfile();
short procheader();
short putsec();
void ackbibi();
long XProtocolSetup();
long XProtocolCleanup();
struct Vars *setup();
void canit();
void zmputs();
void xsendline();
short readock();
char char_avail();
void update_rate();
long bfopen();
void bfclose();
void bfseek();
long bfread();
long brwrite();
void ioerr();
void upderr();
void updmsg();
long getfree();
char exist();
void zsbhdr();
void zshhdr();
void zsdata();
short zrdata();
short zgethdr();
short zrbhdr();
short zrhhdr();
void zputhex();
void zsendline();
short zgethex();
short zdlread();
short noxrd7();
void stohdr();
long rclhdr();
long calla();
long callaa();
long callad();
long calladda();
long calld();
long calldaa();