home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / c / WINKERM.ZIP / KERMIT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-08-08  |  8.5 KB  |  232 lines

  1. /*******************************************************************************
  2. **                                                                            **
  3. **                      Kermit for Microsoft Windows                          **
  4. **                      ----------------------------                          **
  5. **                                KERMIT.H                                    **
  6. **                                                                            **
  7. **  This is the primary include file for the application.  It contains        **
  8. **  global definitions and variables.  It also contains global function       **
  9. **  prototypes.                                                               **
  10. **                                                                            **
  11. *******************************************************************************/
  12.  
  13. // DEFINITIONS ----------------------------------------------------------------
  14.  
  15. #define NOMINMAX
  16.  
  17. #ifdef STATIC
  18.     #define CLASS extern
  19. #else
  20.     #define CLASS
  21. #endif
  22.  
  23. // INCLUDES -------------------------------------------------------------------
  24.  
  25. #include <stdio.h>
  26. #include <fcntl.h>
  27. #include <io.h>
  28. #include <string.h>
  29. #include <stdlib.h>
  30. #include <stdarg.h>
  31. #include <time.h>
  32. #include <windows.h>
  33. #include "kermres.h"
  34.  
  35. // DEBUG CONTROL --------------------------------------------------------------
  36.  
  37. #include "kermdeb.h"
  38.  
  39. #ifdef DEBUG
  40.     #define DEBSTMT(stmt) stmt
  41.     #define DEBASSERT(exp) DebAssert(__FILE__, __LINE__, exp, #exp);
  42.     #define DEBTRACE(n, msg) DebTrace(__FILE__, __LINE__, n, msg);
  43.     #define DEBPRINT(n, msg) WriteDebug(n, msg);
  44. #else
  45.     #define DEBSTMT(stmt)
  46.     #define DEBASSERT(exp)
  47.     #define DEBTRACE(n, msg)
  48.     #define DEBPRINT(n, msg)
  49. #endif
  50.  
  51. #define COMMDEF "0 1200 8 0 0 0 0"
  52. #define TERMDEF "0 0 0 0 0"
  53. #define PACKETDEF "0 0 1 13 35 0 0 1 13 35"
  54. #define PROTOCOLDEF "90 90 5 7 5 0 0 0 0 1 1 0"
  55. #define SESLOGDEF "0 SESSION.LOG"
  56. #define PKTLOGDEF "0 PACKET.LOG"
  57. #define TRNLOGDEF "0 TRANS.LOG"
  58. #define DEBLOGDEF "0 DEBUG.LOG"
  59.  
  60. #define TERMROWS 24
  61. #define TERMCOLS 80
  62.  
  63. #define RXBUFSIZE 1024
  64. #define TXBUFSIZE 1024
  65.      
  66. // VARIABLE DECLARATIONS ------------------------------------------------------
  67.  
  68. CLASS char szAppName[32];
  69.      
  70. CLASS HANDLE hAppInst;          // instance handle
  71. CLASS HWND   hAppWnd;           // handle to the main window
  72. CLASS HMENU  hAppMenu;          // handle to menu
  73. CLASS HANDLE hMenuAccel;        // handle to standard accelerators
  74. CLASS HANDLE hXferAccel;        // handle to file transfer aux accelerators
  75. CLASS HANDLE hTermFont;         // handle to terminal font
  76.  
  77. CLASS HWND    hXfrWnd;
  78. CLASS FARPROC lpXfrDlgProc;
  79.  
  80. /* Terminal Window Control */
  81. CLASS char Screen [TERMROWS] [TERMCOLS];
  82. CLASS int  nCurRow;
  83. CLASS int  nCurCol;
  84. CLASS int  xTermChar;           /* current terminal font width */
  85. CLASS int  yTermChar;           /* current terminal font height */
  86. CLASS int  xTermSize;           /* current terminal window width */
  87. CLASS int  yTermSize;           /* current terminal window height */
  88. CLASS int  xScroll;             /* current max vertical scroll amt allowed */
  89. CLASS int  yScroll;             /* current max horizontal scroll amt allowed */
  90. CLASS int  xOffset;             /* current term window vertical offset */
  91. CLASS int  yOffset;             /* current term window horizontal offset */
  92.      
  93. /* Communication stuff */
  94. CLASS int nCid;                /* communications id */
  95.      
  96. /* System status/configuration stuff */
  97. CLASS BOOL bConnected;          /* TRUE when connected */
  98. CLASS BOOL bKermit;             /* TRUE when kermit protocol active */
  99.  
  100. typedef struct tagCommBlk {
  101.     WORD CommPort;          /* 0=COM1:, 1=COM2:, etc. */
  102.     WORD BaudRate;          /* 300, 1200, 2400, etc. */
  103.     WORD DataBits;          /* int Size: 4-8 valid */
  104.     WORD Parity;            /* 0-4 = None,Odd,Even,Mark,Space */
  105.     WORD StopBits;          /* Stop Bits: 0,1,2 = 1,1.5,2 */
  106.     WORD FlowControl;       /* 0=None, 1=Xon/Xoff */
  107.     WORD HandShake;         /* 0=None, 1=RTS/DTR */
  108. } CommBlk;
  109.  
  110. CLASS CommBlk     CommSet;
  111.  
  112. typedef struct tagTermBlk {
  113.     WORD Emulation;         /* 0=None, 1=VT52, 2=ANSI */
  114.     BOOL NewLine;           /* TRUE=Auto LF on receipt of CR */
  115.     BOOL LocalEcho;         /* TRUE=Echo keyboard to term screen */
  116.     BOOL LineWrap;          /* TRUE=CR/LF when full line on term */
  117.     WORD TextSize;          /* 0=Normal, 1=Small */
  118. } TermBlk;
  119.  
  120. CLASS TermBlk     TermSet;
  121.  
  122. typedef struct tagPktInfo {
  123.     WORD PadChar;           /* ascii char (0-31 or 127) */
  124.     WORD PadCount;          /* 0-99 characters */
  125.     WORD StartChar;         /* ascii control char (0-31) */
  126.     WORD EndChar;           /* ascii control char (0-31) */
  127.     WORD CtlPrefix;         /* ascii char (33-126) */
  128. } PktInfo;
  129.  
  130. typedef struct tagPktBlk {
  131.     PktInfo Send;           /* send packet parameters */
  132.     PktInfo Recv;           /* receive packet parameters */
  133. } PktBlk;
  134.  
  135. CLASS PktBlk      PktSet;
  136.  
  137. typedef struct tagProtBlk {
  138.     WORD SendPktSize;       /* max pkt length (20-94 or 1000) */
  139.     WORD RecvPktSize;
  140.     WORD SendTimeout;       /* seconds to timeout (0-99) */
  141.     WORD RecvTimeout;
  142.     WORD RetryLimit;        /* max retries (0-99) */
  143.     WORD BlockCheck;        /* Block Check: 0=type 1, 1=type 2, 2=type 3 */
  144.     BOOL DebugPacket;       /* TRUE if packet debugging requested */
  145.     BOOL DebugState;        /* TRUE if state debugging requested */
  146.     BOOL DebugOther;        /* TRUE if other debugging requested */
  147.     BOOL Attributes;        /* TRUE if file attribute capability selected */
  148.     BOOL LongPackets;       /* TRUE if long packet capability selected */
  149.     BOOL Windowing;         /* TRUE if windowing capability selected */
  150. } ProtBlk;
  151.  
  152. CLASS ProtBlk     ProtSet;
  153.  
  154. typedef struct tagLogBlk {
  155.     BOOL SessionLogFlag;        /* TRUE is session log requested */
  156.     BYTE SessionLogName [80];   /* session log filename */
  157.     BOOL PacketLogFlag;         /* TRUE if debug log requested */
  158.     BYTE PacketLogName [80];    /* debug log filename */
  159.     BOOL TransLogFlag;          /* TRUE if transaction log requested */
  160.     BYTE TransLogName [80];     /* transaction log filename */
  161. } LogBlk;
  162.  
  163. CLASS LogBlk      LogSet;
  164.  
  165. // FUNCTION PROTOTYPES --------------------------------------------------------
  166.  
  167. /* Prototypes for FAR functions in KERMIT.C */
  168. int FAR PASCAL WinMain(HANDLE, HANDLE, LPSTR, int);
  169. LONG FAR PASCAL KermitWndProc(HWND, unsigned, WORD, LONG);
  170.  
  171. /* Prototypes for FAR functions in KERMINIT.C */
  172. BOOL KermitInit(HANDLE, HANDLE, LPSTR, int);
  173.  
  174. /* Prototypes for FAR functions in KERMDLG.C */
  175. BOOL FAR PASCAL AboutDlgProc(HWND, unsigned, WORD, LONG);
  176. BOOL FAR PASCAL TermDlgProc(HWND, unsigned, WORD, LONG);
  177. BOOL FAR PASCAL CommDlgProc(HWND, unsigned, WORD, LONG);
  178. BOOL FAR PASCAL ModemDlgProc(HWND, unsigned, WORD, LONG);
  179. BOOL FAR PASCAL ProtocolDlgProc(HWND, unsigned, WORD, LONG);
  180. BOOL FAR PASCAL PacketsDlgProc(HWND, unsigned, WORD, LONG);
  181. BOOL FAR PASCAL LoggingDlgProc(HWND, unsigned, WORD, LONG);
  182.  
  183. /* Prototypes for FAR functions in KERMMISC.C */
  184. int  GoDialogBox(HANDLE, LPSTR, HWND, FARPROC);
  185. void EnableCommCommands(WORD);
  186. void EnableConfigCommands(WORD);
  187. void SetKermitCommands(LPSTR, WORD);
  188. int  KermitFmtMsgBox(WORD, PSTR, ...);
  189. VOID KermAssert(int, char *, char *, int);
  190. VOID KermDebMsg(char *, char *, int);
  191.  
  192. /* Prototypes for FAR functions in KERMCOMM.C */
  193. BOOL SetupComm(VOID);
  194. BOOL Disconnect(BOOL);
  195. BOOL Connect(VOID);
  196. VOID DebugComm(VOID);
  197. int  ReadCommStr(LPSTR, int, BOOL);
  198. VOID WriteCommChar(char);
  199. VOID WriteCommStr(LPSTR, int);
  200. VOID WriteCommFmt(PSTR, ...);
  201.  
  202. /* Prototypes for FAR functions in KERMTERM.C */
  203. VOID MoveCursor(int, int);
  204. HDC  GetTermDC(VOID);
  205. VOID ReleaseTermDC(HDC);
  206. VOID WriteDCChar(HDC, char, BOOL);
  207. VOID WriteDCStr(HDC, LPSTR, int, BOOL);
  208. VOID WriteTermChar(char, BOOL);
  209. VOID WriteTermStr(LPSTR, int, BOOL);
  210. VOID WriteTermFmt(PSTR, ...);
  211. VOID ProcessTermLine(VOID);
  212. VOID ProcessTermChar(char);
  213. VOID ProcessTermKey(WORD);
  214. VOID InitTerm(VOID);
  215. VOID OpenTerm(VOID);
  216. VOID CloseTerm(VOID);
  217.  
  218. /* Prototypes for FAR functions in KERMXFER.C */
  219. BOOL FAR PASCAL StatusDlgProc(HWND, unsigned, WORD, LONG);
  220. BOOL FAR PASCAL SendDlgProc(HWND, unsigned, WORD, LONG);
  221. VOID DoKermit(VOID);
  222. BOOL StartKermit(int);
  223. BOOL EndKermit(int);
  224. BOOL AbortXfer(BOOL);
  225. VOID KermitUserInt(WORD);
  226. BOOL KermitSend(VOID);
  227. BOOL KermitReceive(VOID);
  228. BOOL KermitServer(VOID);
  229. BOOL KermitGet(VOID);
  230. BOOL KermitHost(VOID);
  231. BOOL KermitGeneric(VOID);
  232.