home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
archives
/
win100.zip
/
winkpr.h
< prev
next >
Wrap
C/C++ Source or Header
|
1991-10-20
|
7KB
|
263 lines
/*
* Windows Kermit
*
* Written by William S. Hall
* 3665 Benton Street, #66
* Santa Clara, CA 95051
*
* protocol header file
*/
#if !defined(EXTERN)
#define EXTERN extern
#endif
/* functions from protocol module */
void krmKermitDispatch(HWND, BYTE *, int);
void FAR PASCAL krmDoTimeout(HWND hWnd,unsigned message,short event,DWORD time);
void clsif(void);
clsof(int);
/* functions from extended function module */
void UpdateErrorString(HWND hWnd, char *str, int index);
void tinit(HWND hWnd, int mode);
BOOL krmInitMainDisplay(HWND hWnd, short cwidth, short cheight);
void krmMainStringDisplay(HWND hWnd, BYTE *str, short len);
/* functions from dialog box function */
BOOL FAR PASCAL krmXferDlgBox(HWND, unsigned, WORD, LONG);
BOOL FAR PASCAL SendFileDlgProc(HWND, unsigned, WORD, LONG);
BOOL FAR PASCAL GetFileList(HWND, unsigned, WORD, LONG);
BOOL FAR PASCAL SetMiscParams(HWND, unsigned, WORD, LONG);
BOOL FAR PASCAL krmRemoteChdir(HWND, unsigned, WORD, LONG);
BOOL FAR PASCAL krmRemoteCmdDlgBox(HWND, unsigned, WORD, LONG);
/* some protocol manifests */
#define KRM_WAITPACKET 1
#define KRM_WAITSEND 2
#define KRM_COMPLETE -1
#define KRM_ERROR_PKT -2
#define KRM_USERCNX -3
#define KRM_NO_SEND_FILE -4
#define KRM_FILE_OPEN_ERROR -5
#define KRM_TERM_OPEN_ERROR -6
#define KRM_FILE_WRITE_ERROR -7
#define KRM_FILE_CLOSE_ERROR -8
#define KRM_FILE_READ_ERROR -9
#define KRM_UNKNOWN_PACKET -10
#define KRM_RETRY_LIMIT -11
/* dialog boxes */
#define DT_KRM_GETFILE 10000
#define DT_KRM_SENDFILE 10001
#define DT_KRM_MXPARAMS 10002
#define DT_KRM_REMOTE2 10003
#define DT_KRM_XFER 10004
/* dialog box items */
#define IDD_GETNAME 10100
#define IDD_EDITSELECT 10100
#define IDD_LISTSELECT 10101
#define IDD_PATHDISPLAY 10102
#define IDD_PATHSELECT 10103
#define IDD_SEND 10104
#define IDD_TIMER 10100
#define IDD_FILEWARN 10101
#define IDD_FILEDISCARD 10102
#define IDD_KRM_BELL 10103
#define IDD_KRM_SAVE 10104
#define IDD_GETTEXT1 10100
#define IDD_GETTEXT2 10101
#define IDD_STATICTEXT1 10102
#define IDD_STATICTEXT2 10103
#define IDD_FILENAME 10000
#define IDD_SAVENAME 10001
#define IDD_BYTESMOVED 10002
#define IDD_PACKETS 10003
#define IDD_RETRIES 10004
#define IDD_PERCENTAGE 10005
#define IDD_OPERATION 10006
/* Menu items. Must be consecutive to end marker */
#define IDM_KRM_SEND 10200
#define IDM_KRM_RECEIVE 10201
#define IDM_KRM_GET 10202
#define IDM_KRM_FINISH 10203
#define IDM_KRM_LOGOUT 10204
#define IDM_KRM_BYE 10205
#define IDM_KRM_CWD 10206
#define IDM_KRM_REMOTEDIR 10207
#define IDM_KRM_REMOTETYPE 10208
#define IDM_KRM_REMOTEHELP 10209
#define IDM_KRM_REMOTEDEL 10210
#define IDM_KRM_REMOTEWHO 10211
#define IDM_KRM_REMOTESPACE 10212
#define IDM_KRM_REMOTEHOST 10213
/* end consecutive list */
/* these next menu items must be consecutive */
#define IDM_CANCELFILE 10220
#define IDM_CANCELBATCH 10221
#define IDM_ERRORCANCEL 10222
#define IDM_CANCELPROTOCOL 10223
#define IDM_RXPARAMS 10230
#define IDM_TXPARAMS 10231
#define IDM_MXPARAMS 10232
/* strings */
#define IDS_KRM_SENDING 10319
#define IDS_KRM_KERMIT 10320
#define IDS_KRM_ADDDEFAULTS 10321
#define IDS_KRM_GETFILES 10324
#define IDS_KRM_CWD 10325
#define IDS_KRM_PASSWORD 10326
#define IDS_KRM_REMOTEDIR 10329
#define IDS_KRM_REMOTETYPE 10332
#define IDS_KRM_REMOTEDEL 10335
#define IDS_KRM_REMOTEHELP 10338
#define IDS_KRM_REMOTEWHO 10341
#define IDS_KRM_REMOTESPACE 10344
#define IDS_KRM_REMOTEHOST 10347
#define IDS_KRM_TIMER 10400
#define IDS_KRM_FILEWARN 10401
#define IDS_KRM_DISCARD 10402
#define IDS_KRM_BELL 10403
/* states for getpacket */
#define PS_SYNCH 10000
#define PS_LEN 10001
#define PS_NUM 10002
#define PS_TYPE 10003
#define PS_DATA 10004
#define PS_CHK 10005
#define PS_DONE 10006
/* macros */
#define tochar(ch) ((ch) + ' ')
#define unchar(ch) ((ch) - ' ')
#define ctl(ch) ((ch) ^ 64)
/* send init packet structure */
struct sendinit_rec {
int maxpacketsize;
int timeout;
int padcount;
char padchar;
int eol;
char quote;
char binquote;
int chksumtype;
char rptprefix;
};
/* general kermit variables */
struct Kermit_rec {
int numtry; /* number of attempts */
int maxtry;
int maxsenddatalen; /* maximum send packet length */
int chksumtype; /* check sum type */
unsigned retrycount; /* retry count */
int pktnum; /* my packet number */
unsigned pktcount; /* packet count for display on screen */
long bytesmoved; /* bytes transferred */
long filesize; /* file size in bytes */
int percentage; /* percentage moved */
unsigned waitsendtime; /* wait in ms before sending first send_init */
unsigned mstimeout; /* remote timeout in ms */
int errorcount; /* error count */
BOOL fileabort; /* abort file transfer */
BOOL batchabort;
BOOL protocolabort;
BOOL inpacket;
BOOL newname_flag;
BOOL waitsend;
int displayfile;
BOOL ebqflg;
int rqf;
char ebq;
BOOL rptflg;
BOOL timer;
BOOL filewarning;
BOOL filediscard;
BOOL bell;
short DispCharWidth, DispCharHeight;
HANDLE hfilelist;
char *pfilelist;
char *pNextFile;
char *filename; /* filename from pathname in ofstruct */
HANDLE hRemoteCommand;
char *pRemoteCommand;
HANDLE hInFile;
HANDLE hOutFile;
FARPROC fpTimer;
WORD ids_title;
char remotecmd;
BOOL nullstrOK;
int sstate;
BOOL timeout; /* packet timed out */
};
EXTERN struct Kermit_rec Kermit;
/* packet structure */
struct packet_rec {
BYTE mark;
int len;
int num;
BYTE type;
BYTE rchksum;
int state;
BYTE cchksum;
int data_count;
BYTE data[100];
};
EXTERN struct packet_rec rcvpkt;
/* send packet structure */
struct sndpkt_rec {
BYTE mark;
BYTE data[100];
BYTE pktbuf[110];
int len;
};
EXTERN struct sndpkt_rec sndpkt;
/* default manifests */
#define KRM_DEFMARK 1
#define KRM_DEFMAXTRY 5
#define KRM_MAXPACKETSIZE 94
#define KRM_DEFPACKETSIZE 80
#define KRM_MINPACKETSIZE 10
#define KRM_DEFTIMEOUT 5
#define KRM_DEFPADCOUNT 0
#define KRM_DEFPADCHAR '\000'
#define KRM_DEFEOL 13
#define KRM_DEFQUOTE '#'
#define KRM_DEFBINQUOTE 'Y'
#define KRM_DEFCHKSUM 1
#define KRM_DEFRPTCHAR ' '
/* miscellaneous variables */
EXTERN int krmState;
EXTERN OFSTRUCT myofstruct;
EXTERN struct sendinit_rec remote;
EXTERN struct sendinit_rec local;
EXTERN HWND hWndXfer;
EXTERN FARPROC fpXfer;