home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************************
- ** **
- ** Kermit for Microsoft Windows **
- ** ---------------------------- **
- ** KERMIT.H **
- ** **
- ** This is the primary include file for the application. It contains **
- ** global definitions and variables. It also contains global function **
- ** prototypes. **
- ** **
- *******************************************************************************/
-
- // DEFINITIONS ----------------------------------------------------------------
-
- #define NOMINMAX
-
- #ifdef STATIC
- #define CLASS extern
- #else
- #define CLASS
- #endif
-
- // INCLUDES -------------------------------------------------------------------
-
- #include <stdio.h>
- #include <fcntl.h>
- #include <io.h>
- #include <string.h>
- #include <stdlib.h>
- #include <stdarg.h>
- #include <time.h>
- #include <windows.h>
- #include "kermres.h"
-
- // DEBUG CONTROL --------------------------------------------------------------
-
- #include "kermdeb.h"
-
- #ifdef DEBUG
- #define DEBSTMT(stmt) stmt
- #define DEBASSERT(exp) DebAssert(__FILE__, __LINE__, exp, #exp);
- #define DEBTRACE(n, msg) DebTrace(__FILE__, __LINE__, n, msg);
- #define DEBPRINT(n, msg) WriteDebug(n, msg);
- #else
- #define DEBSTMT(stmt)
- #define DEBASSERT(exp)
- #define DEBTRACE(n, msg)
- #define DEBPRINT(n, msg)
- #endif
-
- #define COMMDEF "0 1200 8 0 0 0 0"
- #define TERMDEF "0 0 0 0 0"
- #define PACKETDEF "0 0 1 13 35 0 0 1 13 35"
- #define PROTOCOLDEF "90 90 5 7 5 0 0 0 0 1 1 0"
- #define SESLOGDEF "0 SESSION.LOG"
- #define PKTLOGDEF "0 PACKET.LOG"
- #define TRNLOGDEF "0 TRANS.LOG"
- #define DEBLOGDEF "0 DEBUG.LOG"
-
- #define TERMROWS 24
- #define TERMCOLS 80
-
- #define RXBUFSIZE 1024
- #define TXBUFSIZE 1024
-
- // VARIABLE DECLARATIONS ------------------------------------------------------
-
- CLASS char szAppName[32];
-
- CLASS HANDLE hAppInst; // instance handle
- CLASS HWND hAppWnd; // handle to the main window
- CLASS HMENU hAppMenu; // handle to menu
- CLASS HANDLE hMenuAccel; // handle to standard accelerators
- CLASS HANDLE hXferAccel; // handle to file transfer aux accelerators
- CLASS HANDLE hTermFont; // handle to terminal font
-
- CLASS HWND hXfrWnd;
- CLASS FARPROC lpXfrDlgProc;
-
- /* Terminal Window Control */
- CLASS char Screen [TERMROWS] [TERMCOLS];
- CLASS int nCurRow;
- CLASS int nCurCol;
- CLASS int xTermChar; /* current terminal font width */
- CLASS int yTermChar; /* current terminal font height */
- CLASS int xTermSize; /* current terminal window width */
- CLASS int yTermSize; /* current terminal window height */
- CLASS int xScroll; /* current max vertical scroll amt allowed */
- CLASS int yScroll; /* current max horizontal scroll amt allowed */
- CLASS int xOffset; /* current term window vertical offset */
- CLASS int yOffset; /* current term window horizontal offset */
-
- /* Communication stuff */
- CLASS int nCid; /* communications id */
-
- /* System status/configuration stuff */
- CLASS BOOL bConnected; /* TRUE when connected */
- CLASS BOOL bKermit; /* TRUE when kermit protocol active */
-
- typedef struct tagCommBlk {
- WORD CommPort; /* 0=COM1:, 1=COM2:, etc. */
- WORD BaudRate; /* 300, 1200, 2400, etc. */
- WORD DataBits; /* int Size: 4-8 valid */
- WORD Parity; /* 0-4 = None,Odd,Even,Mark,Space */
- WORD StopBits; /* Stop Bits: 0,1,2 = 1,1.5,2 */
- WORD FlowControl; /* 0=None, 1=Xon/Xoff */
- WORD HandShake; /* 0=None, 1=RTS/DTR */
- } CommBlk;
-
- CLASS CommBlk CommSet;
-
- typedef struct tagTermBlk {
- WORD Emulation; /* 0=None, 1=VT52, 2=ANSI */
- BOOL NewLine; /* TRUE=Auto LF on receipt of CR */
- BOOL LocalEcho; /* TRUE=Echo keyboard to term screen */
- BOOL LineWrap; /* TRUE=CR/LF when full line on term */
- WORD TextSize; /* 0=Normal, 1=Small */
- } TermBlk;
-
- CLASS TermBlk TermSet;
-
- typedef struct tagPktInfo {
- WORD PadChar; /* ascii char (0-31 or 127) */
- WORD PadCount; /* 0-99 characters */
- WORD StartChar; /* ascii control char (0-31) */
- WORD EndChar; /* ascii control char (0-31) */
- WORD CtlPrefix; /* ascii char (33-126) */
- } PktInfo;
-
- typedef struct tagPktBlk {
- PktInfo Send; /* send packet parameters */
- PktInfo Recv; /* receive packet parameters */
- } PktBlk;
-
- CLASS PktBlk PktSet;
-
- typedef struct tagProtBlk {
- WORD SendPktSize; /* max pkt length (20-94 or 1000) */
- WORD RecvPktSize;
- WORD SendTimeout; /* seconds to timeout (0-99) */
- WORD RecvTimeout;
- WORD RetryLimit; /* max retries (0-99) */
- WORD BlockCheck; /* Block Check: 0=type 1, 1=type 2, 2=type 3 */
- BOOL DebugPacket; /* TRUE if packet debugging requested */
- BOOL DebugState; /* TRUE if state debugging requested */
- BOOL DebugOther; /* TRUE if other debugging requested */
- BOOL Attributes; /* TRUE if file attribute capability selected */
- BOOL LongPackets; /* TRUE if long packet capability selected */
- BOOL Windowing; /* TRUE if windowing capability selected */
- } ProtBlk;
-
- CLASS ProtBlk ProtSet;
-
- typedef struct tagLogBlk {
- BOOL SessionLogFlag; /* TRUE is session log requested */
- BYTE SessionLogName [80]; /* session log filename */
- BOOL PacketLogFlag; /* TRUE if debug log requested */
- BYTE PacketLogName [80]; /* debug log filename */
- BOOL TransLogFlag; /* TRUE if transaction log requested */
- BYTE TransLogName [80]; /* transaction log filename */
- } LogBlk;
-
- CLASS LogBlk LogSet;
-
- // FUNCTION PROTOTYPES --------------------------------------------------------
-
- /* Prototypes for FAR functions in KERMIT.C */
- int FAR PASCAL WinMain(HANDLE, HANDLE, LPSTR, int);
- LONG FAR PASCAL KermitWndProc(HWND, unsigned, WORD, LONG);
-
- /* Prototypes for FAR functions in KERMINIT.C */
- BOOL KermitInit(HANDLE, HANDLE, LPSTR, int);
-
- /* Prototypes for FAR functions in KERMDLG.C */
- BOOL FAR PASCAL AboutDlgProc(HWND, unsigned, WORD, LONG);
- BOOL FAR PASCAL TermDlgProc(HWND, unsigned, WORD, LONG);
- BOOL FAR PASCAL CommDlgProc(HWND, unsigned, WORD, LONG);
- BOOL FAR PASCAL ModemDlgProc(HWND, unsigned, WORD, LONG);
- BOOL FAR PASCAL ProtocolDlgProc(HWND, unsigned, WORD, LONG);
- BOOL FAR PASCAL PacketsDlgProc(HWND, unsigned, WORD, LONG);
- BOOL FAR PASCAL LoggingDlgProc(HWND, unsigned, WORD, LONG);
-
- /* Prototypes for FAR functions in KERMMISC.C */
- int GoDialogBox(HANDLE, LPSTR, HWND, FARPROC);
- void EnableCommCommands(WORD);
- void EnableConfigCommands(WORD);
- void SetKermitCommands(LPSTR, WORD);
- int KermitFmtMsgBox(WORD, PSTR, ...);
- VOID KermAssert(int, char *, char *, int);
- VOID KermDebMsg(char *, char *, int);
-
- /* Prototypes for FAR functions in KERMCOMM.C */
- BOOL SetupComm(VOID);
- BOOL Disconnect(BOOL);
- BOOL Connect(VOID);
- VOID DebugComm(VOID);
- int ReadCommStr(LPSTR, int, BOOL);
- VOID WriteCommChar(char);
- VOID WriteCommStr(LPSTR, int);
- VOID WriteCommFmt(PSTR, ...);
-
- /* Prototypes for FAR functions in KERMTERM.C */
- VOID MoveCursor(int, int);
- HDC GetTermDC(VOID);
- VOID ReleaseTermDC(HDC);
- VOID WriteDCChar(HDC, char, BOOL);
- VOID WriteDCStr(HDC, LPSTR, int, BOOL);
- VOID WriteTermChar(char, BOOL);
- VOID WriteTermStr(LPSTR, int, BOOL);
- VOID WriteTermFmt(PSTR, ...);
- VOID ProcessTermLine(VOID);
- VOID ProcessTermChar(char);
- VOID ProcessTermKey(WORD);
- VOID InitTerm(VOID);
- VOID OpenTerm(VOID);
- VOID CloseTerm(VOID);
-
- /* Prototypes for FAR functions in KERMXFER.C */
- BOOL FAR PASCAL StatusDlgProc(HWND, unsigned, WORD, LONG);
- BOOL FAR PASCAL SendDlgProc(HWND, unsigned, WORD, LONG);
- VOID DoKermit(VOID);
- BOOL StartKermit(int);
- BOOL EndKermit(int);
- BOOL AbortXfer(BOOL);
- VOID KermitUserInt(WORD);
- BOOL KermitSend(VOID);
- BOOL KermitReceive(VOID);
- BOOL KermitServer(VOID);
- BOOL KermitGet(VOID);
- BOOL KermitHost(VOID);
- BOOL KermitGeneric(VOID);
-