home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / win100 / winkpr.h < prev    next >
C/C++ Source or Header  |  1991-10-19  |  7KB  |  263 lines

  1. /*
  2.  * Windows Kermit
  3.  * 
  4.  * Written by William S. Hall
  5.  *          3665 Benton Street, #66
  6.  *          Santa Clara, CA 95051
  7.  *
  8.  * protocol header file
  9.  */
  10.  
  11. #if !defined(EXTERN)
  12. #define EXTERN extern
  13. #endif
  14.  
  15. /* functions from protocol module */
  16. void krmKermitDispatch(HWND, BYTE *, int);
  17. void FAR PASCAL krmDoTimeout(HWND hWnd,unsigned message,short event,DWORD time);
  18. void clsif(void);
  19. clsof(int);
  20.  
  21. /* functions from extended function module */
  22. void UpdateErrorString(HWND hWnd, char *str, int index);
  23. void tinit(HWND hWnd, int mode);
  24. BOOL krmInitMainDisplay(HWND hWnd, short cwidth, short cheight);
  25. void krmMainStringDisplay(HWND hWnd, BYTE *str, short len);
  26.  
  27. /* functions from dialog box function */
  28. BOOL FAR PASCAL krmXferDlgBox(HWND, unsigned, WORD, LONG);
  29. BOOL FAR PASCAL SendFileDlgProc(HWND, unsigned, WORD, LONG);
  30. BOOL FAR PASCAL GetFileList(HWND, unsigned, WORD, LONG);
  31. BOOL FAR PASCAL SetMiscParams(HWND, unsigned, WORD, LONG);
  32. BOOL FAR PASCAL krmRemoteChdir(HWND, unsigned, WORD, LONG);
  33. BOOL FAR PASCAL krmRemoteCmdDlgBox(HWND, unsigned, WORD, LONG);
  34.  
  35. /* some protocol manifests */
  36. #define KRM_WAITPACKET        1
  37. #define KRM_WAITSEND        2
  38. #define KRM_COMPLETE        -1
  39. #define KRM_ERROR_PKT        -2
  40. #define KRM_USERCNX        -3
  41. #define KRM_NO_SEND_FILE    -4
  42. #define KRM_FILE_OPEN_ERROR    -5
  43. #define KRM_TERM_OPEN_ERROR    -6
  44. #define KRM_FILE_WRITE_ERROR    -7
  45. #define KRM_FILE_CLOSE_ERROR    -8
  46. #define KRM_FILE_READ_ERROR    -9
  47. #define KRM_UNKNOWN_PACKET    -10
  48. #define KRM_RETRY_LIMIT        -11
  49.  
  50. /* dialog boxes */
  51. #define DT_KRM_GETFILE        10000
  52. #define DT_KRM_SENDFILE        10001
  53. #define DT_KRM_MXPARAMS        10002
  54. #define DT_KRM_REMOTE2        10003
  55. #define DT_KRM_XFER        10004
  56.  
  57. /* dialog box items */
  58. #define IDD_GETNAME        10100
  59.  
  60. #define IDD_EDITSELECT        10100
  61. #define IDD_LISTSELECT        10101
  62. #define IDD_PATHDISPLAY     10102    
  63. #define IDD_PATHSELECT        10103
  64. #define IDD_SEND        10104
  65.  
  66. #define IDD_TIMER        10100
  67. #define IDD_FILEWARN        10101
  68. #define IDD_FILEDISCARD        10102
  69. #define IDD_KRM_BELL        10103
  70. #define IDD_KRM_SAVE        10104
  71.  
  72. #define IDD_GETTEXT1        10100
  73. #define IDD_GETTEXT2        10101
  74. #define IDD_STATICTEXT1        10102
  75. #define IDD_STATICTEXT2        10103
  76.  
  77. #define    IDD_FILENAME    10000
  78. #define IDD_SAVENAME    10001
  79. #define IDD_BYTESMOVED    10002
  80. #define IDD_PACKETS    10003
  81. #define IDD_RETRIES    10004
  82. #define IDD_PERCENTAGE    10005
  83. #define IDD_OPERATION    10006
  84.  
  85. /* Menu items.  Must be consecutive to end marker */
  86. #define IDM_KRM_SEND        10200
  87. #define IDM_KRM_RECEIVE        10201
  88. #define IDM_KRM_GET        10202
  89.  
  90. #define IDM_KRM_FINISH        10203
  91. #define IDM_KRM_LOGOUT        10204
  92. #define IDM_KRM_BYE        10205
  93. #define IDM_KRM_CWD        10206
  94. #define IDM_KRM_REMOTEDIR    10207
  95. #define IDM_KRM_REMOTETYPE    10208
  96. #define IDM_KRM_REMOTEHELP    10209
  97. #define IDM_KRM_REMOTEDEL    10210
  98. #define IDM_KRM_REMOTEWHO    10211
  99. #define IDM_KRM_REMOTESPACE    10212
  100. #define IDM_KRM_REMOTEHOST    10213
  101. /* end consecutive list */
  102.  
  103. /* these next menu items must be consecutive */
  104. #define IDM_CANCELFILE        10220
  105. #define IDM_CANCELBATCH        10221
  106. #define IDM_ERRORCANCEL        10222
  107. #define IDM_CANCELPROTOCOL    10223
  108.  
  109. #define IDM_RXPARAMS        10230
  110. #define IDM_TXPARAMS        10231
  111. #define IDM_MXPARAMS        10232
  112.  
  113. /* strings */
  114. #define IDS_KRM_SENDING        10319
  115. #define IDS_KRM_KERMIT        10320
  116. #define IDS_KRM_ADDDEFAULTS    10321
  117. #define IDS_KRM_GETFILES    10324
  118. #define IDS_KRM_CWD        10325
  119. #define IDS_KRM_PASSWORD    10326
  120. #define IDS_KRM_REMOTEDIR    10329
  121. #define IDS_KRM_REMOTETYPE    10332
  122. #define IDS_KRM_REMOTEDEL    10335
  123. #define IDS_KRM_REMOTEHELP    10338
  124. #define IDS_KRM_REMOTEWHO    10341
  125. #define IDS_KRM_REMOTESPACE    10344
  126. #define IDS_KRM_REMOTEHOST    10347
  127. #define IDS_KRM_TIMER        10400
  128. #define IDS_KRM_FILEWARN    10401
  129. #define IDS_KRM_DISCARD        10402
  130. #define IDS_KRM_BELL        10403
  131.  
  132. /* states for getpacket */
  133. #define PS_SYNCH        10000
  134. #define PS_LEN            10001
  135. #define PS_NUM            10002
  136. #define PS_TYPE            10003
  137. #define PS_DATA            10004
  138. #define PS_CHK            10005
  139. #define PS_DONE            10006
  140.  
  141. /* macros */
  142. #define tochar(ch) ((ch) + ' ')
  143. #define unchar(ch) ((ch) - ' ')
  144. #define ctl(ch) ((ch) ^ 64)
  145.  
  146. /* send init packet structure */
  147. struct sendinit_rec {
  148.     int maxpacketsize;
  149.     int timeout;
  150.     int padcount;
  151.     char padchar;
  152.     int eol;
  153.     char quote;
  154.     char binquote;
  155.     int chksumtype;
  156.     char rptprefix;
  157. };
  158.  
  159. /* general kermit variables */
  160. struct Kermit_rec {
  161.     int numtry;            /* number of attempts */
  162.     int maxtry;
  163.     int maxsenddatalen;        /* maximum send packet length */
  164.     int chksumtype;        /* check sum type */
  165.     unsigned retrycount;    /* retry count */
  166.     int pktnum;            /* my packet number */
  167.     unsigned pktcount;        /* packet count for display on screen */
  168.     long bytesmoved;        /* bytes transferred */
  169.     long filesize;        /* file size in bytes */
  170.     int percentage;        /* percentage moved */
  171.     unsigned waitsendtime;    /* wait in ms before sending first send_init */
  172.     unsigned mstimeout;        /* remote timeout in ms */
  173.     int errorcount;        /* error count */
  174.  
  175.     BOOL fileabort;        /* abort file transfer */
  176.     BOOL batchabort;
  177.     BOOL protocolabort;
  178.     BOOL inpacket;
  179.     BOOL newname_flag;
  180.     BOOL waitsend;
  181.     int displayfile;
  182.     
  183.     BOOL ebqflg;
  184.     int rqf;
  185.     char ebq;
  186.  
  187.     BOOL rptflg;
  188.  
  189.     BOOL timer;
  190.     BOOL filewarning;
  191.     BOOL filediscard;
  192.     BOOL bell;
  193.  
  194.     short DispCharWidth, DispCharHeight;
  195.  
  196.     HANDLE hfilelist;
  197.     char *pfilelist;
  198.     char *pNextFile;
  199.     char *filename;        /* filename from pathname in ofstruct */
  200.     HANDLE hRemoteCommand;
  201.     char *pRemoteCommand;
  202.     HANDLE hInFile;
  203.     HANDLE hOutFile;
  204.     FARPROC fpTimer;
  205.  
  206.     WORD ids_title;
  207.     char remotecmd;
  208.     BOOL nullstrOK;
  209.  
  210.     int sstate;
  211.     BOOL timeout;        /* packet timed out */
  212. };
  213.  
  214. EXTERN struct Kermit_rec Kermit;
  215.  
  216. /* packet structure */
  217. struct packet_rec {
  218.     BYTE mark;
  219.     int len;
  220.     int num;    
  221.     BYTE type;
  222.     BYTE rchksum;
  223.     int state;
  224.     BYTE cchksum;
  225.     int data_count;
  226.     BYTE data[100];
  227. };
  228.  
  229. EXTERN struct packet_rec rcvpkt;
  230.  
  231. /* send packet structure */
  232. struct sndpkt_rec {
  233.     BYTE mark;
  234.     BYTE data[100];
  235.     BYTE pktbuf[110];
  236.     int len;
  237. };
  238.  
  239. EXTERN struct sndpkt_rec sndpkt;
  240.  
  241. /* default manifests */
  242. #define KRM_DEFMARK        1
  243. #define KRM_DEFMAXTRY        5
  244. #define KRM_MAXPACKETSIZE    94
  245. #define KRM_DEFPACKETSIZE     80
  246. #define KRM_MINPACKETSIZE    10
  247. #define KRM_DEFTIMEOUT         5
  248. #define KRM_DEFPADCOUNT     0
  249. #define KRM_DEFPADCHAR         '\000'
  250. #define KRM_DEFEOL        13
  251. #define KRM_DEFQUOTE        '#'
  252. #define KRM_DEFBINQUOTE        'Y'
  253. #define KRM_DEFCHKSUM        1
  254. #define KRM_DEFRPTCHAR        ' '
  255.  
  256. /* miscellaneous variables */
  257. EXTERN int krmState;
  258. EXTERN OFSTRUCT myofstruct;
  259. EXTERN struct sendinit_rec remote;
  260. EXTERN struct sendinit_rec local;
  261. EXTERN HWND hWndXfer;
  262. EXTERN FARPROC fpXfer;
  263.