home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ibmtool.zip / ibmtool.h < prev    next >
Text File  |  1997-11-07  |  11KB  |  381 lines

  1.  
  2. typedef unsigned short BOOLEAN;
  3.  
  4. #define DOS                 0
  5. #define OS2                 1
  6.  
  7. #define MCC                 0
  8. #define MSC                 1
  9. #define MSS                 2
  10. #define MMC                 3
  11. #define SF                  4
  12. #define HELP                5
  13. #define MUD                 6
  14. #define VENDOR              7
  15. #define MCB                 8
  16. #define MEDIA               9
  17.  
  18. #define RED                 0x74
  19. #define YELLOW              0x7E
  20.  
  21. #define BROADCAST           0
  22. #define DIRECTED            1
  23. #define DIRECTED_TO_WKSTA   2
  24. #define DIRECTED_TO_SERVER  3
  25.  
  26. #define TT_INVALID_PARAMETER   0x0001
  27. #define TT_NO_DEBUG            0x0002
  28. #define TT_GENREQ_NOT_COMPLETE 0x0003
  29. #define TT_NO_SERVER           0x0004
  30.  
  31. typedef struct _WINDOW {
  32.   USHORT    Top;
  33.   USHORT    Left;
  34.   USHORT    Bottom;
  35.   USHORT    Right;
  36.   USHORT    Lines;
  37.   BYTE      Attr;
  38.   BYTE      HighAttr;
  39.   char      SelAttr;
  40. } WINDOW;
  41.  
  42. typedef struct GENREQ {
  43.   WORD      ReqHandle;
  44.   WORD      Param1;
  45.   void far *Param2;
  46.   WORD      OpCode;
  47. } GENREQ;
  48.  
  49. enum TMAC_EVENTS { INDCOMP,
  50.                    RXLOOK,
  51.                    RXCHAIN,
  52.                    REQCONF,
  53.                    STATIND,
  54.                    TXCONF,
  55.                    SETRESULT
  56.                  };
  57.  
  58. typedef struct _TMAC {
  59.   WORD      EventCmd;
  60.   WORD      Parm[3];
  61.   void far *DataPtr;
  62. } TMAC;
  63.  
  64. typedef struct _INDICCNT {
  65.   WORD Rx;
  66.   WORD Tx;
  67.   WORD Stat;
  68.   WORD Comp;
  69.   WORD GenReq;
  70.   WORD RingStatus;
  71.   WORD AdapterCheck;
  72.   WORD StartReset;
  73.   WORD EndReset;
  74.   WORD Interrupt;
  75.   WORD Total;
  76. } INDICCNT;
  77.  
  78. #define CTRLID  "IBM "
  79.  
  80. typedef struct _CTRLFRAME {
  81.   BYTE far *pDest;
  82.   BYTE far *pSrc;
  83.   BYTE far *pLength;
  84.   BYTE far *pID;
  85.   BYTE far *pOpCode;
  86.   BYTE far *pData;
  87.   BYTE far *pBuffer;
  88. } CTRLFRAME;
  89.  
  90. enum CONTROL_FRAME_CODES { CCWKSTA            = 1,
  91.                            CCSERVER,        //  2
  92.                            CCSTRESS,        //  3
  93.                            CCXMIT,          //  4
  94.                            CCDELWKSTA,      //  5
  95.                            CCENDSTRESS,     //  6
  96.                            CCENDSTRESSACK,  //  7
  97.                            CCQUERYWKSTA,    //  8
  98.                            CCQUERYACK,      //  9
  99.                            CCSRVSTOP        // 10
  100.                          };
  101.  
  102. typedef struct _WKSTAITEM {
  103.   BYTE    WkstaAddr[ADDR_LEN];
  104.   BOOLEAN Stressing;
  105.   struct _WKSTAITEM *next, *prev;
  106. } WKSTAITEM;
  107.  
  108. /********* WEDGE COMMON DATA AREA DEFINITIONS AND STRUCTURE **********/
  109.  
  110. // Indications for WEDGECOMMON.IndicFlag
  111. #define TRANSMITCONFIRM    0x0001
  112. #define RECEIVELOOKAHEAD   0x0002
  113. #define INDICATIONCOMPLETE 0x0004
  114. #define RECEIVECHAIN       0x0008
  115. #define STATUSINDICATION   0x0010
  116. #define GENREQCONF         0x0020
  117.  
  118. enum STATION_TYPES { PEEPER,
  119.                      WORKSTATION,
  120.                      SERVER
  121.                    };
  122.  
  123. #define INDIC_QUEUE_SIZE    32
  124.  
  125. typedef struct _INDICQUEUE {
  126.   WORD IndicType;
  127.   WORD Parm[3];
  128. } INDICQ;
  129.  
  130. typedef struct _WEDGECOMMON {
  131.   WORD      CurrIndic;      // The current indication queue slot -
  132.                             //    dequeued by IBMTOOL
  133.   WORD      NextFreeIndic;  // The next free indication queue slot -
  134.                             //    enqueued by WEDGE
  135.   INDICQ far *IndicQueue;   // The common indication queue
  136.   DWORD     IndicGDT;
  137.   BYTE far *RcvData;        // The common Receive Buffer
  138.   DWORD     RcvGDT;
  139.   BYTE far *RcvDataPhys;    // Physical address of the common Rx Buffer
  140.   WORD      RxWait;         // If TRUE, tells WEDGE to return WAIT_FOR_RELEASE
  141.                             // on ReceiveChain indications
  142.   WORD      RspMode;        // The Response Mode of the station, set by
  143.                             // IBMTOOL and used by WEDGE (see STATION_TYPES)
  144.   WORD      StressMode;     // Set to TRUE for WEDGE's use during stress test
  145.   DWORD     TotalRx;        // Total Rx frames (OK + Errors), maintained by
  146.                             // WEDGE during the stress test.
  147.   DWORD     TotalTx;        // Total Tx frames (OK + Errors), maintained by
  148.                             // WEDGE during the stress test.
  149.   DWORD     TotalRxErr;     // Receive error frames, maintained by
  150.                             // WEDGE during the stress test.
  151.   DWORD     TotalTxErr;     // Transmit error frames, maintained by
  152.                             // WEDGE during the stress test.
  153.   DWORD     TotalTxNoRsrc;  // Transmit attempts that return OUT_OF_RESOURCE,
  154.                             // maintained by WEDGE during the stress test.
  155.   DWORD     StressCnt;      // Frames to transmit during stress test passed
  156.                             // down to WEDGE prior to the test
  157.   BYTE      ServerAddr[ADDR_LEN]; // A place to stash the current SERVER's
  158.                                   // network address for a WORKSTATION
  159.   WORD      CheckData;      // Flag passed down to WEDGE prior to the stress
  160.                             // test to tell WEDGE whether or not to perform
  161.                             // data validity checking on received frames
  162.   WORD      StopOnErr;      // Flag passed down to WEDGE prior to the stress
  163.                             // test to tell WEDGE whether or not to perform
  164.                             // an INT 3 whe data check errors are found
  165.   WORD      HeaderLen;      // The MAC's frame header length (including the
  166.                             // length field) which is topology specific
  167.   WORD      StnAdrSz;       // The MAC's Station Address Size - from the MAC's
  168.                             // Service Specific Characteristics table
  169.   WORD      DestAddrOffset; // Offset to the destination address in the MAC's
  170.                             // frame header
  171.   WORD      SrcAddrOffset;  // Offset to the source address in the MAC's
  172.                             // frame header
  173.   WORD      UseGDT;         // Flag maintained by IBMTOOL and used by WEDGE,
  174.                             // tells whether descriptor addresses are
  175.                             // physical or virtual
  176. } WEDGECOMMON;
  177.  
  178. /*******************************  Global data  *******************************/
  179.  
  180. /* MAC Tables */
  181. COMMONCHAR   MACMCC;            // Common Characteristics Table
  182. SERVICECHAR  MACMSC;            // Service-Specific Characteristics Table
  183. SERVICESTAT  MACMSS;            // Service-Specific Status Table
  184. UPPERDISP    MACMUD;            // Upper Dispatch Table
  185. PROTLWRDISP  PROTLD;            // Lower Dispatch Table
  186. MCASTBUF     MACMCBuff;         // Multicast Address Buffer
  187. MAC8023STAT  MAC8023;           // Media Specific Table (802.3)
  188. MAC8025STAT  MAC8025;           // Media Specific Table (802.5)
  189. CCB          MACCCB;            // CCB Table (NDIS 2.02)
  190.  
  191. extern char *RetStr[];
  192. extern char *GenReqStr[];
  193.  
  194. int          CurrMenuOpt;
  195.  
  196. BOOLEAN      AllDone,
  197.              Debug,
  198.              Echo,
  199.              SLog,
  200.              ScriptMode,
  201.              Test,
  202.              TokenRing,
  203.              ServerStressAck,
  204.              WkstaResponded;
  205.  
  206. WORD         IndicationCount,
  207.              LastFrameSize,
  208.              LastLookahead;
  209.  
  210. USHORT       LastStatus,
  211.              ReqHandle,
  212.              DOSVersion,
  213.              WkstaStressCnt;
  214.  
  215. ULONG        hWedge,               // Handle to the WEDGE driver
  216.              hTestMAC;             // Handle to the TESTMAC driver
  217.  
  218. FILE        *LogFile,
  219.             *ScriptFile;
  220.  
  221. CTRLFRAME    ControlFrame;
  222. WKSTAITEM   *WkStaTop;
  223.  
  224. INDICCNT     IndicCnt;
  225.  
  226. WEDGECOMMON far *WedgeCommon;
  227.  
  228. /************************ FUNCTIONS BY MODULE ************************/
  229.  
  230. /* IBMTOOL.C */
  231. int    BindToWedge ();
  232. void   Initialize ();
  233. int    TTExit ();
  234.  
  235. /* GENREQ.C */
  236. int    GetRCInt (char *);
  237. USHORT GenRequest ();
  238. int    GetRetCodes ();
  239. int    TTInitiateDiagnostics ();
  240. int    TTReadErrorLog ();
  241. int    TTSetStationAddr ();
  242. int    TTOpen ();
  243. int    TTClose ();
  244. int    TTResetMAC ();
  245. int    TTSetPacketFilter ();
  246. int    TTAddMulticastAddr ();
  247. int    TTDeleteMulticastAddr ();
  248. int    TTUpdateStatistics ();
  249. int    TTClearStat ();
  250. int    TTInterruptRequest ();
  251. int    TTSetFunctionalAddr ();
  252. int    TTSetLookAhead ();
  253. int    TTModifyOpenParms ();
  254.  
  255. /* INDIC.C */
  256. int    CheckControlFrame ();
  257. int    TTXmitConfirm ();
  258. int    TTReceiveLookahead ();
  259. int    TTIndicationComplete ();
  260. int    TTReceiveChain ();
  261. int    TTStatusIndication ();
  262. int    TTGenReqConf ();
  263.  
  264. /* INTRFACE.C */
  265. void   InitInterface ();
  266. void   ParseCommand (char *);
  267. void   InsertCharStr (char *, char);
  268. void   GetCommand ();
  269. void   DoScript ();
  270.  
  271. /* IOCTL.C */
  272. void   Version ();
  273. int    GenIoctl (void far *, ULONG);
  274.  
  275. /* PRIM.C */
  276. int    InitXmit ();
  277. int    TTSetTxBuffSize ();
  278. int    TTEditBuffer ();
  279. int    TTDispXmitBuf ();
  280. int    TTXmit ();
  281. int    TTMultipleXmit ();
  282. int    TTReceiveRelease ();
  283. int    TTIndicationsOff ();
  284. int    TTIndicationsOn ();
  285. int    TTRxWait ();
  286. USHORT SendControlFrame (int);
  287. void   PrimEcho ();
  288.  
  289. /* SCREEN.C */
  290. int    aprintf (USHORT, USHORT, BYTE, char *, ...);
  291. void   Box (USHORT, USHORT, USHORT, USHORT, char);
  292. void   ClearWindow (WINDOW);
  293. void   InitMenu ();
  294. void   SelectMenuOpt (int);
  295. void   InitScreen ();
  296.  
  297. /* SERVER.C */
  298. int    TTServer ();
  299. int    TTWorkstation ();
  300. int    TTMonitor ();
  301. void   AddWorkStation ();
  302. void   DeleteWorkStation ();
  303. USHORT QueryWorkStations ();
  304. void   StopWkStaStress ();
  305.  
  306. /* STRESS.C */
  307. void   PutStressParms (BYTE far *);
  308. void   StressLoop ();
  309. int    TTStress ();
  310. void   StressWksta ();
  311.  
  312. /* SUPPORT.C */
  313. WORD   CheckIndications ();
  314. ULONG  GetNumericParm (char *);
  315. int    TTEcho ();
  316. int    TTDispRcvBufs ();
  317. int    TTReadMAC ();
  318. int    TTUseGDT ();
  319. int    TTLog ();
  320. int    TTDebug ();
  321. int    TTCheckData ();
  322. int    TTJump ();
  323. int    TTClearIndications ();
  324. int    TTCheckIndications ();
  325. int    TTClearMAC ();
  326. int    TTServerXmit ();
  327. int    TTSleep ();
  328. int    TTCheckLookahead ();
  329. int    TTSetStatus ();
  330. int    TTCheckStatus ();
  331. int    TTRun ();
  332. int    TTCheckTokenRing ();
  333. int    TTInt3 ();
  334. int    TTVersion ();
  335.  
  336. /* INFO.C */
  337. BYTE  *GetTable (int);
  338. void   UpdateCommonChar ();
  339. int    CommonChar ();
  340. void   UpdateServiceChar ();
  341. int    ServiceChar ();
  342. void   UpdateServiceStatus ();
  343. int    ServiceStatus ();
  344. void   UpdateMCastList ();
  345. int    MulticastList ();
  346. int    Services ();
  347. int    Media ();
  348. int    CCBDisp ();
  349. void   UpdateInfo ();
  350. void   UpdateStressScr ();
  351. void   ShowStressScr ();
  352.  
  353. /* TMAC.C */
  354. int    OpenTestMAC ();
  355. int    TTIndComp ();
  356. int    TTRxLook ();
  357. int    TTRxChain ();
  358. int    TTTxConf ();
  359. int    TTReqConf ();
  360. int    TTStatInd ();
  361. int    TMIndComp ();
  362. int    TMRxLook (int, WORD, WORD, WORD);
  363. int    TMRxChain (int, WORD, WORD, WORD);
  364. int    TMTxConf (WORD, WORD);
  365. int    TMReqConf (WORD, WORD, WORD);
  366. int    TMStatInd (WORD, WORD);
  367. int    TMSetResult (WORD);
  368. int    TTSetRxBuffSize ();
  369.  
  370. /* HELP.C */
  371. void   InitHelp ();
  372. int    Help ();
  373. int    DoIHelp ();
  374.  
  375. /* MSG.C */
  376. void   InitMsg ();
  377. void   PrintMsg (BYTE, char *, ...);
  378. void   hexprint (char far *, int, BOOLEAN);
  379. void   DoMessageWindow ();
  380.  
  381.