home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
ibmtool.zip
/
ibmtool.h
< prev
next >
Wrap
Text File
|
1997-11-07
|
11KB
|
381 lines
typedef unsigned short BOOLEAN;
#define DOS 0
#define OS2 1
#define MCC 0
#define MSC 1
#define MSS 2
#define MMC 3
#define SF 4
#define HELP 5
#define MUD 6
#define VENDOR 7
#define MCB 8
#define MEDIA 9
#define RED 0x74
#define YELLOW 0x7E
#define BROADCAST 0
#define DIRECTED 1
#define DIRECTED_TO_WKSTA 2
#define DIRECTED_TO_SERVER 3
#define TT_INVALID_PARAMETER 0x0001
#define TT_NO_DEBUG 0x0002
#define TT_GENREQ_NOT_COMPLETE 0x0003
#define TT_NO_SERVER 0x0004
typedef struct _WINDOW {
USHORT Top;
USHORT Left;
USHORT Bottom;
USHORT Right;
USHORT Lines;
BYTE Attr;
BYTE HighAttr;
char SelAttr;
} WINDOW;
typedef struct GENREQ {
WORD ReqHandle;
WORD Param1;
void far *Param2;
WORD OpCode;
} GENREQ;
enum TMAC_EVENTS { INDCOMP,
RXLOOK,
RXCHAIN,
REQCONF,
STATIND,
TXCONF,
SETRESULT
};
typedef struct _TMAC {
WORD EventCmd;
WORD Parm[3];
void far *DataPtr;
} TMAC;
typedef struct _INDICCNT {
WORD Rx;
WORD Tx;
WORD Stat;
WORD Comp;
WORD GenReq;
WORD RingStatus;
WORD AdapterCheck;
WORD StartReset;
WORD EndReset;
WORD Interrupt;
WORD Total;
} INDICCNT;
#define CTRLID "IBM "
typedef struct _CTRLFRAME {
BYTE far *pDest;
BYTE far *pSrc;
BYTE far *pLength;
BYTE far *pID;
BYTE far *pOpCode;
BYTE far *pData;
BYTE far *pBuffer;
} CTRLFRAME;
enum CONTROL_FRAME_CODES { CCWKSTA = 1,
CCSERVER, // 2
CCSTRESS, // 3
CCXMIT, // 4
CCDELWKSTA, // 5
CCENDSTRESS, // 6
CCENDSTRESSACK, // 7
CCQUERYWKSTA, // 8
CCQUERYACK, // 9
CCSRVSTOP // 10
};
typedef struct _WKSTAITEM {
BYTE WkstaAddr[ADDR_LEN];
BOOLEAN Stressing;
struct _WKSTAITEM *next, *prev;
} WKSTAITEM;
/********* WEDGE COMMON DATA AREA DEFINITIONS AND STRUCTURE **********/
// Indications for WEDGECOMMON.IndicFlag
#define TRANSMITCONFIRM 0x0001
#define RECEIVELOOKAHEAD 0x0002
#define INDICATIONCOMPLETE 0x0004
#define RECEIVECHAIN 0x0008
#define STATUSINDICATION 0x0010
#define GENREQCONF 0x0020
enum STATION_TYPES { PEEPER,
WORKSTATION,
SERVER
};
#define INDIC_QUEUE_SIZE 32
typedef struct _INDICQUEUE {
WORD IndicType;
WORD Parm[3];
} INDICQ;
typedef struct _WEDGECOMMON {
WORD CurrIndic; // The current indication queue slot -
// dequeued by IBMTOOL
WORD NextFreeIndic; // The next free indication queue slot -
// enqueued by WEDGE
INDICQ far *IndicQueue; // The common indication queue
DWORD IndicGDT;
BYTE far *RcvData; // The common Receive Buffer
DWORD RcvGDT;
BYTE far *RcvDataPhys; // Physical address of the common Rx Buffer
WORD RxWait; // If TRUE, tells WEDGE to return WAIT_FOR_RELEASE
// on ReceiveChain indications
WORD RspMode; // The Response Mode of the station, set by
// IBMTOOL and used by WEDGE (see STATION_TYPES)
WORD StressMode; // Set to TRUE for WEDGE's use during stress test
DWORD TotalRx; // Total Rx frames (OK + Errors), maintained by
// WEDGE during the stress test.
DWORD TotalTx; // Total Tx frames (OK + Errors), maintained by
// WEDGE during the stress test.
DWORD TotalRxErr; // Receive error frames, maintained by
// WEDGE during the stress test.
DWORD TotalTxErr; // Transmit error frames, maintained by
// WEDGE during the stress test.
DWORD TotalTxNoRsrc; // Transmit attempts that return OUT_OF_RESOURCE,
// maintained by WEDGE during the stress test.
DWORD StressCnt; // Frames to transmit during stress test passed
// down to WEDGE prior to the test
BYTE ServerAddr[ADDR_LEN]; // A place to stash the current SERVER's
// network address for a WORKSTATION
WORD CheckData; // Flag passed down to WEDGE prior to the stress
// test to tell WEDGE whether or not to perform
// data validity checking on received frames
WORD StopOnErr; // Flag passed down to WEDGE prior to the stress
// test to tell WEDGE whether or not to perform
// an INT 3 whe data check errors are found
WORD HeaderLen; // The MAC's frame header length (including the
// length field) which is topology specific
WORD StnAdrSz; // The MAC's Station Address Size - from the MAC's
// Service Specific Characteristics table
WORD DestAddrOffset; // Offset to the destination address in the MAC's
// frame header
WORD SrcAddrOffset; // Offset to the source address in the MAC's
// frame header
WORD UseGDT; // Flag maintained by IBMTOOL and used by WEDGE,
// tells whether descriptor addresses are
// physical or virtual
} WEDGECOMMON;
/******************************* Global data *******************************/
/* MAC Tables */
COMMONCHAR MACMCC; // Common Characteristics Table
SERVICECHAR MACMSC; // Service-Specific Characteristics Table
SERVICESTAT MACMSS; // Service-Specific Status Table
UPPERDISP MACMUD; // Upper Dispatch Table
PROTLWRDISP PROTLD; // Lower Dispatch Table
MCASTBUF MACMCBuff; // Multicast Address Buffer
MAC8023STAT MAC8023; // Media Specific Table (802.3)
MAC8025STAT MAC8025; // Media Specific Table (802.5)
CCB MACCCB; // CCB Table (NDIS 2.02)
extern char *RetStr[];
extern char *GenReqStr[];
int CurrMenuOpt;
BOOLEAN AllDone,
Debug,
Echo,
SLog,
ScriptMode,
Test,
TokenRing,
ServerStressAck,
WkstaResponded;
WORD IndicationCount,
LastFrameSize,
LastLookahead;
USHORT LastStatus,
ReqHandle,
DOSVersion,
WkstaStressCnt;
ULONG hWedge, // Handle to the WEDGE driver
hTestMAC; // Handle to the TESTMAC driver
FILE *LogFile,
*ScriptFile;
CTRLFRAME ControlFrame;
WKSTAITEM *WkStaTop;
INDICCNT IndicCnt;
WEDGECOMMON far *WedgeCommon;
/************************ FUNCTIONS BY MODULE ************************/
/* IBMTOOL.C */
int BindToWedge ();
void Initialize ();
int TTExit ();
/* GENREQ.C */
int GetRCInt (char *);
USHORT GenRequest ();
int GetRetCodes ();
int TTInitiateDiagnostics ();
int TTReadErrorLog ();
int TTSetStationAddr ();
int TTOpen ();
int TTClose ();
int TTResetMAC ();
int TTSetPacketFilter ();
int TTAddMulticastAddr ();
int TTDeleteMulticastAddr ();
int TTUpdateStatistics ();
int TTClearStat ();
int TTInterruptRequest ();
int TTSetFunctionalAddr ();
int TTSetLookAhead ();
int TTModifyOpenParms ();
/* INDIC.C */
int CheckControlFrame ();
int TTXmitConfirm ();
int TTReceiveLookahead ();
int TTIndicationComplete ();
int TTReceiveChain ();
int TTStatusIndication ();
int TTGenReqConf ();
/* INTRFACE.C */
void InitInterface ();
void ParseCommand (char *);
void InsertCharStr (char *, char);
void GetCommand ();
void DoScript ();
/* IOCTL.C */
void Version ();
int GenIoctl (void far *, ULONG);
/* PRIM.C */
int InitXmit ();
int TTSetTxBuffSize ();
int TTEditBuffer ();
int TTDispXmitBuf ();
int TTXmit ();
int TTMultipleXmit ();
int TTReceiveRelease ();
int TTIndicationsOff ();
int TTIndicationsOn ();
int TTRxWait ();
USHORT SendControlFrame (int);
void PrimEcho ();
/* SCREEN.C */
int aprintf (USHORT, USHORT, BYTE, char *, ...);
void Box (USHORT, USHORT, USHORT, USHORT, char);
void ClearWindow (WINDOW);
void InitMenu ();
void SelectMenuOpt (int);
void InitScreen ();
/* SERVER.C */
int TTServer ();
int TTWorkstation ();
int TTMonitor ();
void AddWorkStation ();
void DeleteWorkStation ();
USHORT QueryWorkStations ();
void StopWkStaStress ();
/* STRESS.C */
void PutStressParms (BYTE far *);
void StressLoop ();
int TTStress ();
void StressWksta ();
/* SUPPORT.C */
WORD CheckIndications ();
ULONG GetNumericParm (char *);
int TTEcho ();
int TTDispRcvBufs ();
int TTReadMAC ();
int TTUseGDT ();
int TTLog ();
int TTDebug ();
int TTCheckData ();
int TTJump ();
int TTClearIndications ();
int TTCheckIndications ();
int TTClearMAC ();
int TTServerXmit ();
int TTSleep ();
int TTCheckLookahead ();
int TTSetStatus ();
int TTCheckStatus ();
int TTRun ();
int TTCheckTokenRing ();
int TTInt3 ();
int TTVersion ();
/* INFO.C */
BYTE *GetTable (int);
void UpdateCommonChar ();
int CommonChar ();
void UpdateServiceChar ();
int ServiceChar ();
void UpdateServiceStatus ();
int ServiceStatus ();
void UpdateMCastList ();
int MulticastList ();
int Services ();
int Media ();
int CCBDisp ();
void UpdateInfo ();
void UpdateStressScr ();
void ShowStressScr ();
/* TMAC.C */
int OpenTestMAC ();
int TTIndComp ();
int TTRxLook ();
int TTRxChain ();
int TTTxConf ();
int TTReqConf ();
int TTStatInd ();
int TMIndComp ();
int TMRxLook (int, WORD, WORD, WORD);
int TMRxChain (int, WORD, WORD, WORD);
int TMTxConf (WORD, WORD);
int TMReqConf (WORD, WORD, WORD);
int TMStatInd (WORD, WORD);
int TMSetResult (WORD);
int TTSetRxBuffSize ();
/* HELP.C */
void InitHelp ();
int Help ();
int DoIHelp ();
/* MSG.C */
void InitMsg ();
void PrintMsg (BYTE, char *, ...);
void hexprint (char far *, int, BOOLEAN);
void DoMessageWindow ();