/*
 * kermitvar.h
 */

/*
 * In a fit of cleverness, here are some macro defines for variables we *
 * aren't currently using. Only now we tell Lint to ignore constant	*
 * Booleans!
 */
#define local 1		/* Local mode flag--that is, I'm on your end	*/
#define server 0	/* We are never server				*/
#define delay 0		/* Time to delay before sending first packet	*/
#define xpkt 0		/* Send X packet instead of F?			*/

#define atcapb 8	/* Attribute capability bit			*/
#define swcapb 4	/* Sliding windows capability bit		*/
#define lpcapb 2	/* Long packets capability bit			*/
#define closif zclosi	/* I use closif() to close the input file in	*
			 * case it needs to be more complex later, but	*
			 * for now it just calls the z routine.		*/
/*
 * Here are the variables which need to be set to startup values, and which
 * also can be freely changed between protocol transfers.  At first I thought
 * to declare them all "extern" in order to force definition elsewhere.
 * On reflection, it makes sense to both declare them here and set them to
 * their default startup values.  Thus they can be ignored outside of this
 * module if you so desire.
 *
 * Note that the names are very systematic:  Names beginning with "r" have
 * to do with values I use for received packets;  those beginning with "s"
 * are values I use for sending packets.  Also note we set some, others are
 * set for us.  I have made the ones we get in spar() static (local),
 * and the ones we send in rpar() global.
 *
 * First the ints.
 */

struct Vars {
	struct XPR_IO io;
	struct XPR_UPDATE xpru;
int	cx,
	cz,		/* Flags for aborting transfers.  cx (control-X)*
			 * is set to 1 if an abort of the current file	*
			 * is desired, cz (control-Z) if an abort of	*
			 * an entire batch transfer is desired.		*/
	rpsiz,		/* Maximum packet size				*/
			/* Like most of the receive packet parameters,	*
			 * this one is actually set by the sender.  But	*
			 * since the sender has the option to not send	*
			 * these, we must initialize to "reasonable"	*
			 * defaults.					*/
	bctr,		/* Block check type to request.			*/
	limit,		/* Retry limit on receive			*/
	warn,		/* 1 for warn before overwriting files		*/
	rpadn,		/* Number of pad characters I require.		*/
	rtimo;		/* How long I want you to wait before you	*
			 * you time me out.				*/
char	rmark,		/* Start of packet marker for receive		*/
	reol,		/* End of packet marker for receive		*/
	start,		/* Start state					*/
	sctlq,		/* Control character quote character for send	*/
	rpadc;		/* Pad character I want you to use		*/
/*
 * Variables which MUST be set by the external interface.
 */
int
	parity,		/* 0 for no parity--need for proper 8th-bit quote */
	text,		/* Flag 1 for text file, 0 for binary file	*/
	urpsiz;		/* Maximum receive packet size user wants.	*/
char	*cmarg;		/* Character string containing Kermit server cmd */
/*
 * This block of defines is strictly internal flags of various kinds.	*
 * I hope to Grid that I've got them all.  Someday this will be cleaner *
 */
int
	spsiz,		/* Maximum send packet size			*/
	wsize,		/* Maximum window size				*/
	sndpkl,		/* Size of packet currently being attempted	*/
	filcnt,		/* Number of files transferred so far		*/
	bctu,		/* Block check type to use			*/
	rqf,		/* Flag for 8th bit quote negotiations		*/
	ebq,		/* 8th-bit prefix				*/
	ebqflg,		/* 8th-bit quoting flag				*/
	xflag,		/* Output to screen for generic server commands	*/
	rq,		/* Received 8bq bid				*/
	sq,		/* Sent 8bq bid					*/
	rpt,		/* Repeat count					*/
	rptq,		/* Repeat prefix				*/
	rptflg,		/* Repeat processing flag			*/
	capas,		/* Final position of inbound capas mask		*/
	atcapr,		/* Attribute capability requested		*/
	atcapu,		/* Attribute capability used			*/
	swcapr,		/* Sliding windows capability requested		*/
	swcapu,		/* Sliding windows capability used		*/
	lpcapr,		/* Long packets capability requested		*/
	lpcapu,		/* Long packets capability used			*/
	rsn,		/* Received sequence number			*/
	seq,		/* Current sequence number			*/
	maxsiz,		/* Maximum data size for packet			*/
	rln,		/* Length of received data field		*/
	size,		/* Current size of output packet data		*/
	osize,		/* Previous output packet data size		*/
	first,		/* Some kind of lookahead flag			*/
	stimo,		/* Timeout interval for me to use		*/
	spadn;		/* Number of pad characters for me to use	*/

char
	smark,		/* Start of packet marker for send		*/
	spadc,		/* Pad character to use on sending		*/
	seol,		/* End of packet marker for sending		*/
	rctlq,		/* Control character quote char for receiving	*/
	filnam[50],	/* Current file name				*/
	ssc,		/* Start server command				*/
	*sndpkt,	/* Send packet.					*/
	*rcvpkt,	/* Receieve packet.				*/
	*data,		/* Data to send/receive before encode/decode	*/
	*rdatap,	/* Pointer to null-terminated data field	*/
	*isp,		/* Pointer to characters in memory		*/
	*osp;		/* Output string pointer			*/

int 	state;
};
