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

  1. /*
  2.  *
  3.  * Copyright (C) 1989,1990 DWB Associates, All Rights Reserved
  4.  *
  5.  * Description:
  6.  *      Definitions and structures related to the Network Driver Interface
  7.  *      Specification (NDIS) generic model. This version conforms to the
  8.  *      NDIS Spec rev 2.0.1.
  9.  *
  10.  *      Names of structures, types, tables, and functions follow the
  11.  *      NDIS naming conventions, whenever practical.
  12.  */
  13.  
  14. /* prevent multiple inclusions */
  15. #ifndef NDIS_H
  16. #define NDIS_H
  17.  
  18. typedef unsigned short     WORD;
  19. typedef unsigned long      DWORD;
  20. typedef BYTE          far *LPBUF;
  21.  
  22. /* NDIS drivers cannot have legal NULL pointers. */
  23. /* Hence, the use of 0 as a NULL pointer value.  */
  24. #ifndef NULL
  25. #define NULL 0
  26. #endif
  27.  
  28. /* define the length of names and addresses in the Common Characteristics */
  29. /* and Specific Characteristics table.                                    */
  30. #define NAME_LEN        16
  31. #define ADDR_LEN        16
  32. #define ADDR_SIZE        6
  33.  
  34. /* Maximum number of multicast addresses.                                    */
  35. /* This should probably be defined in HW.H since it is more driver specific. */
  36. #define NUM_MCADDRS     32
  37.  
  38. /* NDIS System request opcodes supported by the generic model. */
  39. #define INITIATEBIND     1
  40. #define BIND             2
  41.  
  42. /* Protocol Manager opcodes used by the generic model */
  43. #define GETPMINFO                1
  44. #define REGISTERMODULE           2
  45. #define BINDANDSTART             3
  46. #define GETPMLINKAGE             4
  47.  
  48. /* NDIS General Request opcodes supported by the generic model */
  49. #define INITIATEDIAGNOSTICS      1
  50. #define READERRORLOG             2
  51. #define SETSTATIONADDRESS        3
  52. #define OPENADAPTER              4
  53. #define CLOSEADAPTER             5
  54. #define RESETMAC                 6
  55. #define SETPACKETFILTER          7
  56. #define ADDMULTICASTADDRESS      8
  57. #define DELETEMULTICASTADDRESS   9
  58. #define UPDATESTATISTICS        10
  59. #define CLEARSTATISTICS         11
  60. #define INTERRUPT               12
  61. #define SETFUNCTIONALADDRESS    13
  62. #define SETLOOKAHEAD            14
  63. #define MODIFYOPENPARMS         16
  64.  
  65. /* NDIS Status Indication opcodes */
  66. #define RINGSTATUS               1
  67. #define ADAPTERCHECK             2
  68. #define STARTRESET               3
  69. #define INTERRUPTSTATUS          4
  70. #define ENDRESET                 5
  71.  
  72. /* All possible return error codes that are defined by the NDIS Spec. 2.0.1 */
  73. #define SUCCESS                      0x0000
  74. #define WAIT_FOR_RELEASE             0x0001
  75. #define REQUEST_QUEUED               0x0002
  76. #define FRAME_NOT_RECOGNIZED         0x0003
  77. #define FRAME_REJECTED               0x0004
  78. #define FORWARD_FRAME                0x0005
  79. #define OUT_OF_RESOURCE              0x0006
  80. #define INVALID_PARAMETER            0x0007
  81. #define INVALID_FUNCTION             0x0008
  82. #define NOT_SUPPORTED                0x0009
  83. #define HARDWARE_ERROR               0x000A
  84. #define TRANSMIT_ERROR               0x000B
  85. #define NO_SUCH_DESTINATION          0x000C
  86. #define ALREADY_STARTED              0x0020
  87. #define INCOMPLETE_BINDING           0x0021
  88. #define DRIVER_NOT_INITIALIZED       0x0022
  89. #define HARDWARE_NOT_FOUND           0x0023
  90. #define HARDWARE_FAILURE             0x0024
  91. #define CONFIGURATION_FAILURE        0x0025
  92. #define INTERRUPT_CONFLICT           0x0026
  93. #define INCOMPATIBLE_MAC             0x0027
  94. #define INITIALIZATION_FAILED        0x0028
  95. #define NETWORK_MAY_NOT_BE_CONNECTED 0x002A
  96. #define GENERAL_FAILURE              0x00FF
  97.  
  98. /* NDIS Adapter Check error codes */
  99. #define ADAPCHECKINOPERATIVE        0x8000
  100. #define ADAPCHECKILLEGALOP          0x1000
  101. #define ADAPCHECKLOCALPARITYERR     0x0800
  102. #define ADAPCHECKPARITYERR          0x0400
  103. #define ADAPCHECKINTERNALPARITYERR  0x0100
  104. #define ADAPCHECKRINGXMITPARITYERR  0x0080
  105. #define ADAPCHECKRINGRCVPARITYERR   0x0040
  106. #define ADAPCHECKXMITOVERRUN        0x0020
  107. #define ADAPCHECKRCVOVERRUN         0x0010
  108. #define ADAPCHECKUNRECOGINTERRUPT   0x0008
  109. #define ADAPCHECKUNRECOGERRINT      0x0004
  110. #define ADAPCHECKNOPCSYSSERVICE     0x0003
  111. #define ADAPCHECKUNRECOGSUPERREQ    0x0002
  112. #define ADAPCHECKPROGRAMREQUEST     0x0001
  113.  
  114. /* NDIS protocol levels, interface type */
  115. #define MACLVL                      1
  116. #define MACTYP                      1
  117.  
  118. /* NDIS Protocol Table structure definitions */
  119.  
  120. /* NDIS Common Characteristics table */
  121. typedef struct _COMMONCHAR {
  122.   WORD    CcSize;                   /* Table size                           */
  123.   BYTE    CcNDISMjrVer;             /* Major NDIS Version                   */
  124.   BYTE    CcNDISMnrVer;             /* Minor NDIS Version                   */
  125.   WORD    CcSpLvl;                  /* Level of spec tables                 */
  126.   BYTE    CcMjrVer;                 /* Module Major version number          */
  127.   BYTE    CcMnrVer;                 /* Module Minor version number          */
  128.   DWORD   CcBindFnc;                /* "Hints" on binding support           */
  129.   BYTE    CcName[NAME_LEN];         /* Module name                          */
  130.   BYTE    CcUPLevel;                /* Upper protocol level                 */
  131.   BYTE    CcUIType;                 /* Upper interface type                 */
  132.   BYTE    CcLPLevel;                /* Lower protocol level                 */
  133.   BYTE    CcLIType;                 /* Lower interface type                 */
  134.   WORD    CcModuleID;               /* Module ID (supplied by PM)           */
  135.   WORD    CcDataSeg;                /* Module Data Segment                  */
  136.  
  137.   /* System request function pointer                                        */
  138.   WORD    (far pascal *CcSysReq) (DWORD, DWORD, WORD, WORD, WORD);
  139.  
  140.   // links to other NDIS characteristics tables.
  141.   struct MACSpecChar far  *CcSCp;   /* specific characteristics             */
  142.   struct MACSpecStat far  *CcSSp;   /* specific status                      */
  143.   struct MACUprDisp far   *CcUDp;   /* upper dispatch table                 */
  144.   struct ProtLwrDisp far  *CcLDp;   /* lower dispatch table                 */
  145.   DWORD   CcRsv1;                   /* reserved                             */
  146.   DWORD   CcRsv2;                   /* reserved                             */
  147. } COMMONCHAR;
  148.  
  149. // Definintions for the MAC Service Supported Flags. Bits 0-14.
  150. #define BROADCAST_SUPP          (DWORD) 0x00000001
  151. #define MULTICAST_SUPP          (DWORD) 0x00000002
  152. #define FUNC_GROUP_ADDR_SUPP    (DWORD) 0x00000004
  153. #define PROMISCUOUS_SUPP        (DWORD) 0x00000008
  154. #define SET_STN_ADDR_SUPP       (DWORD) 0x00000010
  155. #define STAT_ALWAYS_CURR        (DWORD) 0x00000020
  156. #define DIAGNOSTICS_SUPP        (DWORD) 0x00000040
  157. #define LOOPBACK_SUPP           (DWORD) 0x00000080
  158. #define RECEIVECHAIN_MOSTLY     (DWORD) 0x00000100
  159. #define IBM_SOURCE_R_SUPP       (DWORD) 0x00000200
  160. #define RESET_MAC_SUPP          (DWORD) 0x00000400
  161. #define OPEN_ADAPTER_SUPP       (DWORD) 0x00000800
  162. #define INTERRUPT_RQ_SUPP       (DWORD) 0x00001000
  163. #define SRC_RTNG_BRDG_SUPP      (DWORD) 0x00002000
  164. #define GDT_ADDRESS_SUPP        (DWORD) 0x00004000
  165. #define MULTIPLE_XFER_DATA_SUPP (DWORD) 0x00008000
  166. #define RCVLK_FRAME_SIZE_ZERO   (DWORD) 0x00010000
  167. #define MODOPENPARMS_SUPP       (DWORD) 0x00020000
  168.  
  169. /* multicast address structure is ADDR_LEN bytes long */
  170. typedef struct _MCASTBUFF {
  171.   BYTE    mAddr[ADDR_LEN];
  172. } MCASTBUFF;
  173.  
  174. /* the multicast address buffer manages NUM_MCADDRS multicast address structs */
  175. typedef struct _MCASTBUF {
  176.   WORD      McbMax;         /* max # of multicast addresses                 */
  177.   WORD      McbCnt;         /* curr# "              "                       */
  178.   MCASTBUFF McbAddrs[NUM_MCADDRS];
  179. } MCASTBUF;
  180.  
  181. // CCB Table structure (NDIS 2.02)
  182. typedef struct _CCB {
  183.   BYTE    CcbAdapterConfig;
  184.   BYTE    CcbReserved;
  185.   BYTE    CcbMicroCodeLevel[10];
  186.   DWORD   CcbAdapterParmsAddr;
  187.   DWORD   CcbAdapterMACAddr;
  188.   WORD    CcbSRAMAddress;
  189.   WORD    CcbBringUps;
  190.   WORD    CcbAdapterType;
  191. } CCB;
  192.  
  193. // MAC Service Specific characteristics table
  194. typedef struct _SERVICECHAR {
  195.   WORD    MscSize;                  /* Table size                           */
  196.   BYTE    MscType[NAME_LEN];        /* MAC type name                        */
  197.   WORD    MscStnAdrSz;              /* Station address length               */
  198.   BYTE    MscPermStnAdr[ADDR_LEN];  /* Permanent station address            */
  199.   BYTE    MscCurrStnAdr[ADDR_LEN];  /* Current station address              */
  200.   DWORD   MscCurrFncAdr;            /* Current functional address           */
  201.   MCASTBUF far *MscMCp;             /* Address of multicast buffer          */
  202.   DWORD   MscLinkSpd;               /* Link speed (bits/sec)                */
  203.   DWORD   MscService;               /* Services supported flags             */
  204.   WORD    MscMaxFrame;              /* Maximum frame size                   */
  205.   DWORD   MscTBufCap;               /* Transmit buffer capacity             */
  206.   WORD    MscTBlkSz;                /* Transmit buf alloc block size        */
  207.   DWORD   MscRBufCap;               /* Receive buffer capacity              */
  208.   WORD    MscRBlkSz;                /* Receive buf alloc block size         */
  209.   BYTE    MscVenCode[3];            /* Vendor code                          */
  210.   BYTE    MscVenAdapter;            /* Vendor adapter code                  */
  211.   BYTE far *MscVenAdaptDesc;        /* Ptr to vendor adapter desc           */
  212.   WORD    MscInterrupt;             /* Interrupt level used                 */
  213.   WORD    MscTxQDepth;              /* Transmit Queue Depth                 */
  214.   WORD    MscMaxDataBlocks;         /* Max buff descriptor data blocks      */
  215.   CCB far *MscCCB;                  /* Ptr to CCB table                     */
  216. } SERVICECHAR;
  217.  
  218. // MAC service-specific status table
  219. typedef struct _SERVICESTAT {
  220.   WORD    MssSize;          /* Table size                                                   */
  221.   DWORD   MssDiagDT;        /* Last diagnostic Date/Time                    */
  222.   DWORD   MssStatus;        /* MAC status - bit mask                        */
  223.   WORD    MssFilter;        /* Current packet filter                        */
  224.   void far *MssM8Sp;        /* pointer to Media specific status             */
  225.   DWORD   MssClearDT;       /* Last clear stats Date/Time                   */
  226.   DWORD   MssFR;            /* Frames received: total                       */
  227.   DWORD   MssRFCRC;         /* Receive fail: CRC error                      */
  228.   DWORD   MssFRByt;         /* Frames received: total bytes                 */
  229.   DWORD   MssRFLack;        /* Receive fail: lack of buffers                */
  230.   DWORD   MssFRMC;          /* Frames received: multicast                   */
  231.   DWORD   MssFRBC;          /* Frames received: broadcast                   */
  232.   DWORD   MssRFErr;         /* rcv fail: errors in general                  */
  233.   DWORD   MssRFMax;         /* rcv fail: exceeds max size                   */
  234.   DWORD   MssRFMin;         /* rcv fail: less than min size                 */
  235.   DWORD   MssFRMCByt;       /* Frames rcvd: multicast bytes                 */
  236.   DWORD   MssFRBCByt;       /* Frames rcvd: broadcast bytes                 */
  237.   DWORD   MssRFHW;          /* rcv fail: hardware error                     */
  238.   DWORD   MssFS;            /* Frames sent: total                           */
  239.   DWORD   MssFSByt;         /* Frames sent: total bytes                     */
  240.   DWORD   MssFSMC;          /* Frames sent: multicast                       */
  241.   DWORD   MssFSBC;          /* Frames sent: broadcast                       */
  242.   DWORD   MssFSBCByt;       /* Frames sent: broadcast bytes                 */
  243.   DWORD   MssFSMCByt;       /* Frames sent: multicast bytes                 */
  244.   DWORD   MssSFTime;        /* Send fail: time-out                          */
  245.   DWORD   MssSFHW;          /* Send fail: hardware error                    */
  246. } SERVICESTAT;
  247.  
  248. /* Packet filter bit definitions. */
  249. #define FLTR_DIRECTED   0x01
  250. #define FLTR_BRDCST     0x02
  251. #define FLTR_PRMSCS     0x04
  252. #define FLTR_SRC_RTG    0x08
  253.  
  254. /*
  255.  * MAC status bits in the MAC Specific Characteristics table.
  256.  * Bits 0-2 are coded to reflect the hardware status.
  257.  */
  258. #define HW_MISSING      0x0000
  259. #define HW_BUD_ERR      0x0001
  260. #define HW_CFG_ERR      0x0002
  261. #define HW_FAULT        0x0003
  262. #define HW_SOFT_ERR     0x0004
  263. #define HW_OK           0x0007
  264. #define MS_BOUND        0x0008
  265. #define MS_OPEN         0x0010
  266. #define MS_DIAGS_ON     0x0020
  267.  
  268. /* 802.3 (Ethernet) status table */
  269. typedef struct _MAC8023STAT {
  270.   WORD    M83sSize;         /* Table size                                   */
  271.   WORD    M83sVer;          /* Version                                      */
  272.   DWORD   M83sRFAln;        /* Receive fail: Alignment error                */
  273.   DWORD   M83sRMask;        /* Receive fail bit mask (below)                */
  274.   DWORD   M83sRFOvrn;       /* Receive fail: Overrun                        */
  275.   DWORD   M83sFSCols;       /* Frames sent: after collisions                */
  276.   DWORD   M83sFSDfr;        /* Frames sent: after deferring                 */
  277.   DWORD   M83sSFColMx;      /* Frames not sent: Max collisions              */
  278.   DWORD   M83sTotCol;       /* Total collision during tran attempts         */
  279.   DWORD   M83sTotLCol;      /* Total late collisions                        */
  280.   DWORD   M83sFSCol1;       /* Frames sent: after 1 collision               */
  281.   DWORD   M83sFSColM;       /* Frames sent: multpl collisions               */
  282.   DWORD   M83sFSHrtB;       /* Frames sent: CD heart beat                   */
  283.   DWORD   M83sJabber;       /* Jabber errors                                */
  284.   DWORD   M83sLostCS;       /* Lost carrier sense during tran               */
  285.   DWORD   M83sTMask;        /* Transmit fail bit mask (below)               */
  286. } MAC8023STAT;
  287.  
  288. /* Receive error failure codes. */
  289. #define M83Sb_RFCRC     1       /* Recv bit 0   CRC error                   */
  290. #define M83Sb_RFFE      2       /*          1   Framing error               */
  291. #define M83Sb_RFMaxSz   4       /*          2   Frame size > Max            */
  292.  
  293. /* Transmit error failure codes. */
  294. #define M83Sb_TFColMx   1       /* Xmit bit 0   Excessive collisions        */
  295. #define M83Sb_TFCrr     2       /*          1   Carrier check failed        */
  296. #define M83Sb_TFShrt    4       /*          2   Short circuit               */
  297. #define M83Sb_TFOpen    8       /*          3   Open circuit                */
  298. #define M83Sb_TFLong    16      /*          4   Frame size > Max            */
  299. #define M83Sb_TFRemFl   32      /*          5   Remote fail to defer        */
  300.  
  301. /* 802.5 (Token Rimg) status table */
  302. typedef struct _MAC8025STAT {
  303.   WORD    M85sSize;         /* Table size                                   */
  304.   WORD    M85sVer;          /* Version                                      */
  305.   DWORD   M85sFCS;          /* FCS error or repeat frame code error         */
  306.   DWORD   M85sRMask;        /* Receive fail bit mask (below)                */
  307.   DWORD   M85s5hbtt;        /* "5 half-bit transition" errors.              */
  308.   DWORD   M85sACerr;        /* Access Control errors                        */
  309.   DWORD   M85sFsAbrtD;      /* Frames sent: w/ abort delimiter              */
  310.   DWORD   M85sFsNrcv;       /* Frames sent: Not received.                   */
  311.   DWORD   M85sFrNoBuf;      /* Frames recognized, no buffers                */
  312.   DWORD   M85sFcopyErr;     /* Frame copy errors                            */
  313.   DWORD   M85sFreqErr;      /* Frequency errors                             */
  314.   DWORD   M85sMonRegen;     /* Active Monitor regeneration count.           */
  315.   DWORD   M85sRsrvd1;       /* reserved                                     */
  316.   DWORD   M85sRsrvd2;       /* reserved                                     */
  317.   DWORD   M85sRsrvd3;       /* reserved                                     */
  318.   DWORD   M85sTMask;        /* Transmit fail bit mask (below)               */
  319.   WORD    M85sRingUtilMeas; /* Ring Utilization Measurement (NDIS 2.02)     */
  320. } MAC8025STAT;
  321.  
  322. /* Receive error failure codes. */
  323. #define M85Sb_RFCon     1       /* Recv bit 0   Receiver Congestion         */
  324. #define M85Sb_RFCopy    2       /*          1   Frame Copy error            */
  325.  
  326. /* Transmit error failure codes. */
  327. #define M85Sb_TFunrun   1       /* Xmit bit 0   Transmit underrrun          */
  328. #define M85Sb_TFLine    2       /*          1   Transmit Line error         */
  329. #define M85Sb_TFAbDlm   4       /*          2   Abort delimiter xmitted     */
  330. #define M85Sb_TFLost    8       /*          3   Frame Lost                  */
  331. #define M85Sb_TFToken   16      /*          4   Token error                 */
  332.  
  333. /* MAC upper dispatch table */
  334. typedef struct _UPPERDISP {
  335.   struct CommChar far *MudCCp;    /* Back pointer to CC table         */
  336.   /*
  337.    * MAC entry points, all are assembly functions that conform to the
  338.    * Microsoft FAR PASCAL calling conventions.
  339.    */
  340.   WORD (far pascal *MudGReq)       (WORD,  WORD,  WORD, DWORD, WORD, WORD);
  341.   WORD (far pascal *MudXmitChain)  (WORD,  WORD, LPBUF, WORD);
  342.   WORD (far pascal *MudXferData)   (LPBUF, WORD, LPBUF, WORD);
  343.   WORD (far pascal *MudRcvRelease) (WORD,  WORD);
  344.   WORD (far pascal *MudIndOn)      (WORD);
  345.   WORD (far pascal *MudIndOff)     (WORD);
  346. } UPPERDISP;
  347.  
  348. /* protocol lower dispatch table */
  349. typedef struct _PROTLWRDISP {
  350.   struct CommChar far *PldCCp;      /* Back pointer to CC table     */
  351.   DWORD PldIFF;                     /* Interface flags              */
  352.   /* Protocol stack entry points. */
  353.   WORD (far pascal *PldReqConfirm)  (WORD, WORD,  WORD,  WORD,  WORD, WORD);
  354.   WORD (far pascal *PldXmitConfirm) (WORD, WORD,  WORD,  WORD,  WORD);
  355.   WORD (far pascal *PldRcvLkAhead)  (WORD, WORD,  WORD, LPBUF, LPBUF, WORD);
  356.   WORD (far pascal *PldIndComplete) (WORD, WORD);
  357.   WORD (far pascal *PldRcvChain)    (WORD, WORD,  WORD, LPBUF, LPBUF, WORD);
  358.   WORD (far pascal *PldStatInd)     (WORD, WORD, LPBUF,  WORD,  WORD);
  359. } PROTLWRDISP;
  360.  
  361. /*
  362.  * Data structures for TransmitChain (Tx), TransferData (TD), and
  363.  * ReceiveChain (Rx).
  364.  */
  365. typedef struct _TXDATABLOCK {
  366.   BYTE  TxPtrType;      /* 0 => Physical pointer, 1 => GDT pointer      */
  367.   BYTE  TxRsvdByte;     /* Reserverd, must be zero.                     */
  368.   WORD  TxDataLen;      /* Data block length in bytes.                  */
  369.   LPBUF TxDataPtr;      /* Far pointer to data block.                   */
  370. } TXDATABLOCK;
  371.  
  372. /* Maximum number of data blocks supported in a descriptor. */
  373. #define MAX_DATABLK     8
  374.  
  375. /* immediate data buffer length cannot exceed 64 bytes. */
  376. #define MAX_IMMED_LEN   64
  377.  
  378. /* Maximum number of data blocks supported in a Tx descriptor. */
  379. #define MAX_TX_DATABLK  MAX_DATABLK
  380.  
  381. /* TransmitChain descriptor structure definition */
  382. typedef struct _TXBUFDESC {
  383.   WORD        TxImmedLen;   /* Byte count of immediate data (max = 64)      */
  384.   LPBUF       TxImmedPtr;   /* Virtual address of Immediate data            */
  385.   WORD        TxDataCnt;    /* Number of Data Blocks (max = 8)              */
  386.   TXDATABLOCK TxDataBlk[MAX_TX_DATABLK];
  387. } TXBUFDESC;
  388.  
  389. /* TransferData data block description */
  390. typedef struct _TDDATABLOCK {
  391.   BYTE  TDPtrType;          /* 0 => Physical pointer, 1 => GDT pointer      */
  392.   BYTE  TDRsvdByte;         /* Reserverd, must be zero.                     */
  393.   WORD  TDDataLen;          /* Data block length in bytes.                  */
  394.   LPBUF TDDataPtr;          /* Far pointer to data block.                   */
  395. } TDDATABLOCK;
  396.  
  397. /* Max number of TransferData blocks */
  398. #define MAX_TD_DATABLK  MAX_DATABLK
  399.  
  400. /* TransferData descriptor structure */
  401. typedef struct _TDBUFDESC {
  402.   WORD        TDDataCount;  /* Number of Data Blocks (max = 8)              */
  403.   TDDATABLOCK TDDataBlk[MAX_TD_DATABLK];
  404. } TDBUFDESC;
  405.  
  406. /* ReceiveChain data block structure definition */
  407. typedef struct _RXDATABLOCK {
  408.   WORD  RxDataLen;          /* Length of the Data Block                     */
  409.   LPBUF RxDataPtr;          /* Far Pointer to Data Block                    */
  410. } RXDATABLOCK;
  411.  
  412. /* Maximum number of ReceiveChain data blocks */
  413. #define MAX_RX_DATABLK  MAX_DATABLK
  414.  
  415. /* ReceiveChain descriptor structure definition */
  416. typedef struct _RXBUFDESC {
  417.   WORD        RxDataCnt;    /* Number of Data Blocks.                       */
  418.   RXDATABLOCK RxDataBlk[MAX_RX_DATABLK];
  419. } RXBUFDESC;
  420.  
  421. /*
  422.  * Data structures for the "Module Configuration" structure parsed from
  423.  * the PROTOCOL.INI file. see NDIS spec for details.
  424.  */
  425. struct Param {
  426.   WORD ParamType;           /* 0 => 31 bit signed integer, 1 => string      */
  427.   WORD ParamLen;            /* String length (including null) or 4.         */
  428.  
  429.   /*
  430.    * the parameter immediately follows this structure, it can be any
  431.    * length or type and follows the union structure. the AWK script that
  432.    * generates ndis.inc is just dumb enough that it's not able to parse
  433.    * union definitions. so all references to ParNum and ParStr are indirect.
  434.    */
  435.   /*
  436.    *    union ParValu
  437.    *       {
  438.    *       long ParNum;
  439.    *       BYTE ParStr[1];
  440.    *       } ParVal;
  441.    */
  442. };
  443.  
  444. struct KeywordEntry {
  445.   struct KeywordEntry far *NextKeywordEntry;    /* Forward pointer          */
  446.   struct KeywordEntry far *PrevKeywordEntry;    /* Back Pointer             */
  447.  
  448.   BYTE    KeyWord[NAME_LEN];    /* Keyword on left side of "="              */
  449.   WORD    NumParams;            /* Number of parameters on r. side of "="   */
  450.  
  451.   struct Param Params[1];       /* Actual size depends on NumParams         */
  452. };
  453.  
  454. struct ModCfg {
  455.   struct ModCfg far *NextModCfg;    /* Module config images are in a        */
  456.   struct ModCfg far *PrevModCfg;    /* double-linked list.                  */
  457.  
  458.   BYTE    ModName[NAME_LEN];        /* Bracketed Module Name.               */
  459.  
  460.   struct KeywordEntry KE[1];        /* Head of Keyword list, always one     */
  461.                                     /* or more entries per module.          */
  462. };
  463.  
  464. struct ProIni {
  465.   struct ModCfg MC[1];              /* Head of Module config list.          */
  466. };
  467.  
  468. /* request block structure used to register a module */
  469. struct RqBlk {
  470.   WORD  Opcode;
  471.   WORD  Status;
  472.   void  far *Pointer1;
  473.   void  far *Pointer2;
  474.   WORD  Word1;
  475. };
  476.  
  477. /* the minimum lookahead defaults to 64, maximum is 256 bytes. */
  478. #define MIN_LOOKAHEAD_DEFAULT   64
  479. #define MAX_LOOKAHEAD          256
  480.  
  481. /* Device driver CONFIG.SYS lines are a maximum of 132 bytes. */
  482. #define DEVINIT_LEN            132
  483.  
  484. /*
  485.  * define a general structure used to coalesce a variety of variables into
  486.  * one place. these varables include the indications nest flag, level 0
  487.  * CS and DS register values, etc.
  488.  */
  489. struct ndisGeneral {
  490.   /*
  491.    * this pointer is set when a packet is received. transferData will use
  492.    * it to move the data up to the protocol. the size of the buffer must
  493.    * also be remembered. If multiple TransferData calls are supported,
  494.    * currBuff and currBuffSize must be preserved until the next
  495.    * ReceiveLookAhead call.
  496.    */
  497.   BYTE  far *currBuff;
  498.   WORD       currBuffSize;
  499.  
  500.   /*
  501.    * the protocol has a notion of minimum lookahead data. it can call down
  502.    * to change it at will.
  503.    */
  504.   WORD       minLookAhead;
  505.  
  506.   /*
  507.    * indications are tracked using a nesting level byte. If this byte is
  508.    * non-zero, then indications are disabled.
  509.    */
  510.   BYTE       indicationNestLevel;
  511.  
  512.   /*
  513.    * allocate space for a GDT selector. the selector is allocated at driver
  514.    * startup and is generally used to initialize currBuff. gdt0 is used for
  515.    * OS/2 on a 80386. note that gdt0 cannot be used until after init time.
  516.    */
  517.   WORD    gdt;
  518.   WORD    gdt0;
  519.   WORD    gdt0set;
  520.  
  521.   /*
  522.    * this flag is 0 during init time, non-zero at ring 0 time. The most
  523.    * important use is for debug after init time. Character output after
  524.    * init time must go direct to the UART, not to DOSWRITE.
  525.    */
  526.   BYTE    ring0;
  527.  
  528.   /*
  529.    * This flag is set to true everytime an indication (Receive or status)
  530.    * upcall is made to the stack.
  531.    * the ISR should check this just before exiting in order to see if an
  532.    * indication complete is needed.
  533.    */
  534.   BYTE    needIndCmplt;
  535.  
  536.   /*
  537.    * Specifies which adapter must be used. This number may be non-zero if
  538.    * there are multiple adapters in the box. The current generic model
  539.    * requires one driver per adapter. In the future, one driver should
  540.    * be able to manage multiple adapters.
  541.    */
  542.   WORD    adapterNum;
  543.  
  544.   /* The PROTMAN$ file handle goes here during init time. */
  545.   WORD    PMHandle;
  546.  
  547.   /* remember the processor type */
  548.   WORD    procType;
  549.  
  550.   /* store the device= string here at init time. */
  551.   BYTE    devInitStr[DEVINIT_LEN];
  552. };
  553.  
  554. /*
  555.  * the C function generalRequests() gets a far pointer to a structure of this
  556.  * type.
  557.  */
  558. struct GenReq {
  559.   WORD    GReqProtID;
  560.   WORD    GReqReqHandle;
  561.   WORD    GReqP1;
  562.   DWORD   GReqP2;
  563.   WORD    GReqOpCode;
  564.   WORD    GReqMacDs;
  565. };
  566.  
  567. /* ndis.c generally instantiates this structure. */
  568. extern struct ndisGeneral ndisGen;
  569.  
  570. /*
  571.  * At bind time, the protocol gives a pointer to it's common characteristics
  572.  * table. The contents of that table are cached in protCC for faster access
  573.  * without incurring segment register hits.
  574.  */
  575. extern struct CommChar protCC;
  576.  
  577. /*
  578.  * Protocol lower dispatch table. The contents of that table are cached in
  579.  * pldDsptchTble for faster access without incurring segment register hits.
  580.  */
  581. extern struct ProtLwrDisp pldDsptchTble;
  582.  
  583. /* Characteristics table names */
  584. //extern struct MACSpecChar   MSC;
  585. //extern struct MACSpecStat   MSS;
  586. //extern struct MACUprDisp    MUD;
  587. //extern struct MCastBuf      MCBuff;
  588. //extern struct CommChar      MCC;
  589.  
  590. #endif
  591.  
  592.