home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / dlcapi.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  34KB  |  909 lines

  1. /*++
  2.  
  3. Copyright 1991-1998 Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     dlcapi.h
  8.  
  9. Abstract:
  10.  
  11.     This module defines 32-bit Windows/NT DLC structures and manifests
  12.  
  13. Revision History:
  14.  
  15. --*/
  16.  
  17. #ifndef _DLCAPI_
  18. #define _DLCAPI_
  19.  
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23.  
  24. //
  25. // DLC Command Codes
  26. //
  27.  
  28. #define LLC_DIR_INTERRUPT               0x00
  29. #define LLC_DIR_OPEN_ADAPTER            0x03
  30. #define LLC_DIR_CLOSE_ADAPTER           0x04
  31. #define LLC_DIR_SET_MULTICAST_ADDRESS   0x05
  32. #define LLC_DIR_SET_GROUP_ADDRESS       0x06
  33. #define LLC_DIR_SET_FUNCTIONAL_ADDRESS  0x07
  34. #define LLC_DIR_READ_LOG                0x08
  35. #define LLC_TRANSMIT_FRAMES             0x09
  36. #define LLC_TRANSMIT_DIR_FRAME          0x0A
  37. #define LLC_TRANSMIT_I_FRAME            0x0B
  38. #define LLC_TRANSMIT_UI_FRAME           0x0D
  39. #define LLC_TRANSMIT_XID_CMD            0x0E
  40. #define LLC_TRANSMIT_XID_RESP_FINAL     0x0F
  41. #define LLC_TRANSMIT_XID_RESP_NOT_FINAL 0x10
  42. #define LLC_TRANSMIT_TEST_CMD           0x11
  43. #define LLC_DLC_RESET                   0x14
  44. #define LLC_DLC_OPEN_SAP                0x15
  45. #define LLC_DLC_CLOSE_SAP               0x16
  46. #define LLC_DLC_REALLOCATE_STATIONS     0x17
  47. #define LLC_DLC_OPEN_STATION            0x19
  48. #define LLC_DLC_CLOSE_STATION           0x1A
  49. #define LLC_DLC_CONNECT_STATION         0x1B
  50. #define LLC_DLC_MODIFY                  0x1C
  51. #define LLC_DLC_FLOW_CONTROL            0x1D
  52. #define LLC_DLC_STATISTICS              0x1E
  53. #define LLC_DIR_INITIALIZE              0x20
  54. #define LLC_DIR_STATUS                  0x21
  55. #define LLC_DIR_TIMER_SET               0x22
  56. #define LLC_DIR_TIMER_CANCEL            0x23
  57. #define LLC_BUFFER_GET                  0x26
  58. #define LLC_BUFFER_FREE                 0x27
  59. #define LLC_RECEIVE                     0x28
  60. #define LLC_RECEIVE_CANCEL              0x29
  61. #define LLC_RECEIVE_MODIFY              0x2A
  62. #define LLC_DIR_TIMER_CANCEL_GROUP      0x2C
  63. #define LLC_DIR_SET_EXCEPTION_FLAGS     0x2D
  64. #define LLC_BUFFER_CREATE               0x30
  65. #define LLC_READ                        0x31
  66. #define LLC_READ_CANCEL                 0x32
  67. #define LLC_DLC_SET_THRESHOLD           0x33
  68. #define LLC_DIR_CLOSE_DIRECT            0x34
  69. #define LLC_DIR_OPEN_DIRECT             0x35
  70. #define LLC_MAX_DLC_COMMAND             0x37
  71.  
  72. //
  73. // forward definitions
  74. //
  75.  
  76. union _LLC_PARMS;
  77. typedef union _LLC_PARMS LLC_PARMS, *PLLC_PARMS;
  78.  
  79. //
  80. // Parameters. Can be pointer to a parameter table (32-bit flat address),
  81. // a single 32-bit ULONG, 2 16-bit USHORTs or 4 8-bit BYTEs
  82. //
  83.  
  84. typedef union {
  85.  
  86.     PLLC_PARMS pParameterTable;     // pointer to the parameter table
  87.  
  88.     struct {
  89.         USHORT usStationId;         // Station id
  90.         USHORT usParameter;         // optional parameter
  91.     } dlc;
  92.  
  93.     struct {
  94.         USHORT usParameter0;        // first optional parameter
  95.         USHORT usParameter1;        // second optional parameter
  96.     } dir;
  97.  
  98.     UCHAR auchBuffer[4];            // group/functional address
  99.  
  100.     ULONG ulParameter;
  101.  
  102. } CCB_PARMS;
  103.  
  104. //
  105. // LLC_CCB - the Command Control Block structure
  106. //
  107.  
  108. typedef struct _LLC_CCB {
  109.     UCHAR uchAdapterNumber;         // Adapter 0 or 1
  110.     UCHAR uchDlcCommand;            // DLC command
  111.     UCHAR uchDlcStatus;             // DLC command completion code
  112.     UCHAR uchReserved1;             // reserved for DLC DLL
  113.     struct _LLC_CCB* pNext;         // CCB chain
  114.     ULONG ulCompletionFlag;         // used in command completion
  115.     CCB_PARMS u;                    // parameters
  116.     HANDLE hCompletionEvent;        // event for command completion
  117.     UCHAR uchReserved2;             // reserved for DLC DLL
  118.     UCHAR uchReadFlag;              // set when special READ CCB chained
  119.     USHORT usReserved3;             // reserved for DLC DLL
  120. } LLC_CCB, *PLLC_CCB;
  121.  
  122. //
  123. // transmit/receive buffers
  124. //
  125.  
  126. union _LLC_BUFFER;
  127. typedef union _LLC_BUFFER LLC_BUFFER, *PLLC_BUFFER;
  128.  
  129. typedef struct {
  130.     PLLC_BUFFER pNextBuffer;        // next DLC buffer in frame
  131.     USHORT cbFrame;                 // length of the whole received frame
  132.     USHORT cbBuffer;                // length of this segment
  133.     USHORT offUserData;             // offset of data from descriptor header
  134.     USHORT cbUserData;              // length of the data
  135. } LLC_NEXT_BUFFER;
  136.  
  137. typedef struct {
  138.     PLLC_BUFFER pNextBuffer;        // next buffer of frame
  139.     USHORT cbFrame;                 // length of entire frame
  140.     USHORT cbBuffer;                // length of this buffer
  141.     USHORT offUserData;             // user data in this struct
  142.     USHORT cbUserData;              // length of user data
  143.     USHORT usStationId;             // ssnn station id
  144.     UCHAR uchOptions;               // option byte from RECEIVE param tbl
  145.     UCHAR uchMsgType;               // the message type
  146.     USHORT cBuffersLeft;            // number of basic buffer units left
  147.     UCHAR uchRcvFS;                 // the reveived frame status
  148.     UCHAR uchAdapterNumber;         // adapter number
  149.     PLLC_BUFFER pNextFrame;         // pointer to next frame
  150.     UCHAR cbLanHeader;              // length of the lan header
  151.     UCHAR cbDlcHeader;              // length of the DLC header
  152.     UCHAR auchLanHeader[32];        // lan header of the received frame
  153.     UCHAR auchDlcHeader[4];         // dlc header of the received frame
  154.     USHORT usPadding;               // data begins from offset 64 !!!
  155. } LLC_NOT_CONTIGUOUS_BUFFER;
  156.  
  157. typedef struct {
  158.     PLLC_BUFFER pNextBuffer;        // next buffer of frame
  159.     USHORT cbFrame;                 // length of entire frame
  160.     USHORT cbBuffer;                // length of this buffer
  161.     USHORT offUserData;             // user data in this struct
  162.     USHORT cbUserData;              // length of user data
  163.     USHORT usStationId;             // ssnn station id
  164.     UCHAR uchOptions;               // option byte from RECEIVE param tbl
  165.     UCHAR uchMsgType;               // the message type
  166.     USHORT cBuffersLeft;            // number of basic buffer units left
  167.     UCHAR uchRcvFS;                 // the reveived frame status
  168.     UCHAR uchAdapterNumber;         // adapter number
  169.     PLLC_BUFFER pNextFrame;         // pointer to next frame
  170. } LLC_CONTIGUOUS_BUFFER;
  171.  
  172. //
  173. // Received frames are returned in these data structures
  174. //
  175.  
  176. union _LLC_BUFFER {
  177.  
  178.     PLLC_BUFFER pNext;
  179.  
  180.     LLC_NEXT_BUFFER Next;
  181.  
  182.     struct LlcNextBuffer {
  183.         LLC_NEXT_BUFFER Header;
  184.         UCHAR auchData[];
  185.     } Buffer;
  186.  
  187.     LLC_NOT_CONTIGUOUS_BUFFER NotContiguous;
  188.  
  189.     struct {
  190.         LLC_NOT_CONTIGUOUS_BUFFER Header;
  191.         UCHAR auchData[];
  192.     } NotCont;
  193.  
  194.     LLC_CONTIGUOUS_BUFFER Contiguous;
  195.  
  196.     struct {
  197.         LLC_CONTIGUOUS_BUFFER Header;
  198.         UCHAR auchData[];
  199.     } Cont;
  200.  
  201. };
  202.  
  203. //
  204. // This structure is used by BUFFER.GET, BUFFER.FREE and TRANSMIT
  205. //
  206.  
  207. struct _LLC_XMIT_BUFFER;
  208. typedef struct _LLC_XMIT_BUFFER LLC_XMIT_BUFFER, *PLLC_XMIT_BUFFER;
  209.  
  210. struct _LLC_XMIT_BUFFER {
  211.     PLLC_XMIT_BUFFER pNext;         // next buffer (or NULL)
  212.     USHORT usReserved1;             //
  213.     USHORT cbBuffer;                // length of transmitted data
  214.     USHORT usReserved2;             //
  215.     USHORT cbUserData;              // length of optional header
  216.     UCHAR auchData[];               // optional header and transmitted data
  217. };
  218.  
  219. #define LLC_XMIT_BUFFER_SIZE sizeof(LLC_XMIT_BUFFER)
  220.  
  221. //
  222. // CCB parameter tables
  223. //
  224.  
  225. typedef struct {
  226.     HANDLE hBufferPool;             // handle of new buffer pool
  227.     PVOID pBuffer;                  // any buffer in memory
  228.     ULONG cbBufferSize;             // buffer size in bytes
  229.     ULONG cbMinimumSizeThreshold;   // minimum locked size
  230. } LLC_BUFFER_CREATE_PARMS, *PLLC_BUFFER_CREATE_PARMS;
  231.  
  232. typedef struct {
  233.     USHORT usReserved1;             // Station id is not used
  234.     USHORT cBuffersLeft;            // free 256 buffer segments
  235.     ULONG ulReserved;
  236.     PLLC_XMIT_BUFFER pFirstBuffer;  // buffer chain
  237. } LLC_BUFFER_FREE_PARMS, *PLLC_BUFFER_FREE_PARMS;
  238.  
  239. typedef struct {
  240.     USHORT usReserved1;             // Station id is not used
  241.     USHORT cBuffersLeft;            // free 256 buffer segments
  242.  
  243.     //
  244.     // cBuffersToGet: number of buffers to get. If 0, the returned buffer list
  245.     // may consist of segment of different size
  246.     //
  247.  
  248.     USHORT cBuffersToGet;
  249.  
  250.     //
  251.     // cbBufferSize: size of the requested buffers. This will be rounded up to
  252.     // the next largest segment size: 256, 512, 1024, 2048 or 4096
  253.     //
  254.  
  255.     USHORT cbBufferSize;
  256.     PLLC_XMIT_BUFFER pFirstBuffer;
  257. } LLC_BUFFER_GET_PARMS, *PLLC_BUFFER_GET_PARMS;
  258.  
  259. //
  260. // parameter table for DLC.CONNECT.STATION
  261. //
  262.  
  263. typedef struct {
  264.     USHORT usStationId;             // SAP or direct station ID, defines the pool
  265.     USHORT usReserved;
  266.     PUCHAR pRoutingInfo;            // offset to the routing info
  267. } LLC_DLC_CONNECT_PARMS, *PLLC_DLC_CONNECT_PARMS;
  268.  
  269. //
  270. // DLC_FLOW_CONTROL Options:
  271. //
  272.  
  273. #define LLC_RESET_LOCAL_BUSY_USER   0x80
  274. #define LLC_RESET_LOCAL_BUSY_BUFFER 0xC0
  275. #define LLC_SET_LOCAL_BUSY_USER     0
  276.  
  277. typedef struct {
  278.     USHORT usRes;
  279.     USHORT usStationId;             // SAP or link station id
  280.     UCHAR uchT1;                    // response timer
  281.     UCHAR uchT2;                    // aknowledgment timer
  282.     UCHAR uchTi;                    // inactivity timer
  283.     UCHAR uchMaxOut;                // max transmits without ack
  284.     UCHAR uchMaxIn;                 // max receives without ack
  285.     UCHAR uchMaxOutIncr;            // dynamic window increment value
  286.     UCHAR uchMaxRetryCnt;           // N2 value (retries)
  287.     UCHAR uchReserved1;
  288.     USHORT usMaxInfoFieldLength;    // Only for link stations, NEW!!!
  289.     UCHAR uchAccessPriority;        // token ring access priority
  290.     UCHAR auchReserved3[4];
  291.     UCHAR cGroupCount;              // number of group SAPs of this SAP
  292.     PUCHAR pGroupList;              // offset to the group list
  293. } LLC_DLC_MODIFY_PARMS, *PLLC_DLC_MODIFY_PARMS;
  294.  
  295. #define LLC_XID_HANDLING_IN_APPLICATION 0x08
  296. #define LLC_XID_HANDLING_IN_DLC         0
  297. #define LLC_INDIVIDUAL_SAP              0x04
  298. #define LLC_GROUP_SAP                   0x02
  299. #define LLC_MEMBER_OF_GROUP_SAP         0x01
  300.  
  301. typedef struct {
  302.     USHORT usStationId;             // SAP or link station id
  303.     USHORT usUserStatValue;         // reserved for user
  304.     UCHAR uchT1;                    // response timer
  305.     UCHAR uchT2;                    // aknowledgment timer
  306.     UCHAR uchTi;                    // inactivity timer
  307.     UCHAR uchMaxOut;                // max tramists without ack
  308.     UCHAR uchMaxIn;                 // max receives without ack
  309.     UCHAR uchMaxOutIncr;            // dynamic window increment value
  310.     UCHAR uchMaxRetryCnt;           // N2 value (retries)
  311.     UCHAR uchMaxMembers;            // maximum members for group SAP
  312.     USHORT usMaxI_Field;            // maximum length of the Info field
  313.     UCHAR uchSapValue;              // SAP value to be assigned
  314.     UCHAR uchOptionsPriority;       // SAP options and access priority
  315.     UCHAR uchcStationCount;         // maximum number of link stations in sap
  316.     UCHAR uchReserved2[2];          //
  317.     UCHAR cGroupCount;              // number of group SAPs of this SAP
  318.     PUCHAR pGroupList;              // offset to the group list
  319.     ULONG DlcStatusFlags;           // User notify flag for DLC status changes
  320.     UCHAR uchReserved3[8];          // reserved
  321.     UCHAR cLinkStationsAvail;       // total number of available link stations
  322. } LLC_DLC_OPEN_SAP_PARMS, *PLLC_DLC_OPEN_SAP_PARMS;
  323.  
  324. typedef struct {
  325.     USHORT usSapStationId;          // SAP station id
  326.     USHORT usLinkStationId;         // Link station id
  327.     UCHAR uchT1;                    // response timer
  328.     UCHAR uchT2;                    // aknowledgment timer
  329.     UCHAR uchTi;                    // inactivity timer
  330.     UCHAR uchMaxOut;                // max tramists without ack
  331.     UCHAR uchMaxIn;                 // max receives without ack
  332.     UCHAR uchMaxOutIncr;            // dynamic window increment value
  333.     UCHAR uchMaxRetryCnt;           // N2 value (retries)
  334.     UCHAR uchRemoteSap;             // remote SAP of the link
  335.     USHORT usMaxI_Field;            // max I field length
  336.     UCHAR uchAccessPriority;        // token ring access priority
  337.     PVOID pRemoteNodeAddress;       // pointer to the destination address
  338. } LLC_DLC_OPEN_STATION_PARMS, *PLLC_DLC_OPEN_STATION_PARMS;
  339.  
  340. #define LLC_INCREASE_LINK_STATIONS  0
  341. #define LLC_DECREASE_LINK_STATIONS  0x80
  342.  
  343. typedef struct {
  344.     USHORT usStationId;             // ID of affected SAP
  345.     UCHAR uchOption;                // increase of decrease indicator
  346.     UCHAR uchStationCount;
  347.     UCHAR uchStationsAvailOnAdapter;
  348.     UCHAR uchStationsAvailOnSap;
  349.     UCHAR uchTotalStationsOnAdapter;
  350.     UCHAR uchTotalStationsOnSap;
  351. } LLC_DLC_REALLOCATE_PARMS, *PLLC_DLC_REALLOCATE_PARMS;
  352.  
  353. typedef struct {
  354.     USHORT usStationId;             // SAP station ID
  355.     USHORT cBufferThreshold;        // SAP buffer pool Threshold number
  356.     PVOID AlertEvent;               // alerting event
  357. } LLC_DLC_SET_THRESHOLD_PARMS, *PLLC_DLC_SET_THRESHOLD_PARMS;
  358.  
  359. typedef struct {
  360.     PVOID TraceBuffer;              // trace buffer
  361.     ULONG TraceBufferSize;          // trace buffer size
  362.     ULONG TraceFlags;               // various trace flags
  363. } LLC_TRACE_INITIALIZE_PARMS, *PLLC_TRACE_INITIALIZE_PARMS;
  364.  
  365. #define LLC_DLC_RESET_STATISTICS    0x80
  366. #define LLC_DLC_READ_STATISTICS     0
  367.  
  368. typedef struct {
  369.     ULONG cTransmittedFrames;
  370.     ULONG cReceivedFrames;
  371.     ULONG cDiscardedFrames;
  372.     ULONG cDataLost;
  373.     USHORT cBuffersAvailable;
  374. } DLC_SAP_LOG, *PDLC_SAP_LOG;
  375.  
  376. typedef struct {
  377.     USHORT cI_FramesTransmitted;
  378.     USHORT cI_FramesReceived;
  379.     UCHAR cI_FrameReceiveErrors;
  380.     UCHAR cI_FrameTransmissionErrors;
  381.     USHORT cT1_ExpirationCount;     // Note: not OUT data xfer mode
  382.     UCHAR uchLastCmdRespReceived;
  383.     UCHAR uchLastCmdRespTransmitted;
  384.     UCHAR uchPrimaryState;
  385.     UCHAR uchSecondaryState;
  386.     UCHAR uchSendStateVariable;
  387.     UCHAR uchReceiveStateVariable;
  388.     UCHAR uchLastNr;                // last received NR
  389.     UCHAR cbLanHeader;
  390.     UCHAR auchLanHeader[32];
  391. } DLC_LINK_LOG, *PDLC_LINK_LOG;
  392.  
  393. typedef union {
  394.     DLC_SAP_LOG Sap;
  395.     DLC_LINK_LOG Link;
  396. } LLC_DLC_LOG_BUFFER, *PLLC_DLC_LOG_BUFFER;
  397.  
  398. typedef struct {
  399.     USHORT usStationId;             // ID of a SAP or a link station
  400.     USHORT cbLogBufSize;            //
  401.     PLLC_DLC_LOG_BUFFER pLogBuf;    // offset to the log buffer
  402.     USHORT usActLogLength;          // length of returned log
  403.     UCHAR uchOptions;               // command options (bit7 resets log params)
  404. } LLC_DLC_STATISTICS_PARMS, *PLLC_DLC_STATISTICS_PARMS;
  405.  
  406. typedef struct {
  407.     USHORT usBringUps;              // Token Ring adapter bring up error code
  408.     UCHAR Reserved[30];             // everything else specific to DOS or OS/2
  409. } LLC_DIR_INITIALIZE_PARMS, *PLLC_DIR_INITIALIZE_PARMS;
  410.  
  411. typedef struct {
  412.     USHORT usOpenErrorCode;         // open adapter errors detected
  413.     USHORT usOpenOptions;           // various options
  414.     UCHAR auchNodeAddress[6];       // adapters LAN address
  415.     UCHAR auchGroupAddress[4];      // multicast address added in the open
  416.     UCHAR auchFunctionalAddress[4]; // added token ring functional address
  417.     USHORT usReserved1;
  418.     USHORT usReserved2;
  419.     USHORT usMaxFrameSize;          // maximum frame size defined in NDIS
  420.     USHORT usReserved3[4];
  421.     USHORT usBringUps;              // Bring up errors, TR only
  422.     USHORT InitWarnings;
  423.     USHORT usReserved4[3];
  424. } LLC_ADAPTER_OPEN_PARMS, *PLLC_ADAPTER_OPEN_PARMS;
  425.  
  426. typedef struct {
  427.     UCHAR uchDlcMaxSaps;
  428.     UCHAR uchDlcMaxStations;
  429.     UCHAR uchDlcMaxGroupSaps;
  430.     UCHAR uchDlcMaxGroupMembers;
  431.     UCHAR uchT1_TickOne;            // Short timer interval (for 1 - 5)
  432.     UCHAR uchT2_TickOne;
  433.     UCHAR uchTi_TickOne;
  434.     UCHAR uchT1_TickTwo;            // Long timer interval (for 6 - 10)
  435.     UCHAR uchT2_TickTwo;
  436.     UCHAR uchTi_TickTwo;
  437. } LLC_DLC_PARMS, *PLLC_DLC_PARMS;
  438.  
  439. //
  440. // The ethernet mode selects the LAN header format of ethernet. SNA
  441. // applications should use the default parameter, that has been defined in the
  442. // registry. The applications using connectionless DLC services should select
  443. // the ethernet LLC LAN header format they are using (usually 802.3)
  444. //
  445.  
  446. typedef enum {
  447.     LLC_ETHERNET_TYPE_DEFAULT,      // use the parameter value set in registry
  448.     LLC_ETHERNET_TYPE_AUTO,         // automatic header type selction for links
  449.     LLC_ETHERNET_TYPE_802_3,        // use always 802.3 lan headers
  450.     LLC_ETHERNET_TYPE_DIX           // use always LLC on DIX SNA type.
  451. } LLC_ETHERNET_TYPE, *PLLC_ETHERNET_TYPE;
  452.  
  453. typedef struct {
  454.     PVOID hBufferPool;
  455.     PVOID pSecurityDescriptor;
  456.     LLC_ETHERNET_TYPE LlcEthernetType;
  457. } LLC_EXTENDED_ADAPTER_PARMS, *PLLC_EXTENDED_ADAPTER_PARMS;
  458.  
  459. typedef struct {
  460.     PLLC_ADAPTER_OPEN_PARMS pAdapterParms;      // ADAPTER_PARMS
  461.     PLLC_EXTENDED_ADAPTER_PARMS pExtendedParms; // DIRECT_PARMS
  462.     PLLC_DLC_PARMS pDlcParms;                   // DLC_PARMS
  463.     PVOID pReserved1;                           // NCB_PARMS
  464. } LLC_DIR_OPEN_ADAPTER_PARMS, *PLLC_DIR_OPEN_ADAPTER_PARMS;
  465.  
  466. typedef struct {
  467.     UCHAR auchMulticastAddress[6];  // 48 bit multicast address
  468. } LLC_DIR_MULTICAST_ADDRESS, *PLLC_DIR_MULTICAST_ADDRESS;
  469.  
  470. #define LLC_DIRECT_OPTIONS_ALL_MACS 0x1880
  471.  
  472. typedef struct {
  473.     USHORT Reserved[4];
  474.     USHORT usOpenOptions;
  475.     USHORT usEthernetType;
  476.     ULONG ulProtocolTypeMask;
  477.     ULONG ulProtocolTypeMatch;
  478.     USHORT usProtocolTypeOffset;
  479. } LLC_DIR_OPEN_DIRECT_PARMS, *PLLC_DIR_OPEN_DIRECT_PARMS;
  480.  
  481. typedef struct {
  482.     UCHAR cLineError;
  483.     UCHAR cInternalError;
  484.     UCHAR cBurstError;
  485.     UCHAR cAC_Error;
  486.     UCHAR cAbortDelimiter;
  487.     UCHAR uchReserved1;
  488.     UCHAR cLostFrame;
  489.     UCHAR cReceiveCongestion;
  490.     UCHAR cFrameCopiedError;
  491.     UCHAR cFrequencyError;
  492.     UCHAR cTokenError;
  493.     UCHAR uchReserved2;
  494.     UCHAR uchReserved3;
  495.     UCHAR uchReserved4;
  496. } LLC_ADAPTER_LOG_TR, *PLLC_ADAPTER_LOG_TR;
  497.  
  498. typedef struct {
  499.     UCHAR cCRC_Error;
  500.     UCHAR uchReserved1;
  501.     UCHAR cAlignmentError;
  502.     UCHAR uchReserved2;
  503.     UCHAR cTransmitError;
  504.     UCHAR uchReserved3;
  505.     UCHAR cCollisionError;
  506.     UCHAR cReceiveCongestion;
  507.     UCHAR uchReserved[6];
  508. } LLC_ADAPTER_LOG_ETH, *PLLC_ADAPTER_LOG_ETH;
  509.  
  510. typedef union {
  511.     LLC_ADAPTER_LOG_TR Tr;
  512.     LLC_ADAPTER_LOG_ETH Eth;
  513. } LLC_ADAPTER_LOG, *PLLC_ADAPTER_LOG;
  514.  
  515. typedef struct {
  516.     ULONG cTransmittedFrames;
  517.     ULONG cReceivedFrames;
  518.     ULONG cDiscardedFrames;
  519.     ULONG cDataLost;
  520.     USHORT cBuffersAvailable;
  521. } LLC_DIRECT_LOG, *PLLC_DIRECT_LOG;
  522.  
  523. typedef union {
  524.     LLC_ADAPTER_LOG Adapter;
  525.     LLC_DIRECT_LOG Dir;
  526.  
  527.     struct {
  528.         LLC_ADAPTER_LOG Adapter;
  529.         LLC_DIRECT_LOG Dir;
  530.     } both;
  531.  
  532. } LLC_DIR_READ_LOG_BUFFER, *PLLC_DIR_READ_LOG_BUFFER;
  533.  
  534. #define LLC_DIR_READ_LOG_ADAPTER    0
  535. #define LLC_DIR_READ_LOG_DIRECT     1
  536. #define LLC_DIR_READ_LOG_BOTH       2
  537.  
  538. typedef struct {
  539.     USHORT usTypeId;                    // 0=adapter, 1=direct, 2=both logs
  540.     USHORT cbLogBuffer;                 // size of log buffer
  541.     PLLC_DIR_READ_LOG_BUFFER pLogBuffer;// pointer to log buffer
  542.     USHORT cbActualLength;              // returned size of log buffer
  543. } LLC_DIR_READ_LOG_PARMS, *PLLC_DIR_READ_LOG_PARMS;
  544.  
  545. typedef struct {
  546.     ULONG ulAdapterCheckFlag;
  547.     ULONG ulNetworkStatusFlag;
  548.     ULONG ulPcErrorFlag;
  549.     ULONG ulSystemActionFlag;
  550. } LLC_DIR_SET_EFLAG_PARMS, *PLLC_DIR_SET_EFLAG_PARMS;
  551.  
  552. #define LLC_ADAPTER_ETHERNET    0x0010
  553. #define LLC_ADAPTER_TOKEN_RING  0x0040
  554.  
  555. typedef struct {
  556.     UCHAR auchPermanentAddress[6];  // permanent encoded address
  557.     UCHAR auchNodeAddress[6];       // adapter's network address
  558.     UCHAR auchGroupAddress[4];      // adapter's group address
  559.     UCHAR auchFunctAddr[4];         // adapter's functional address
  560.     UCHAR uchMaxSap;                // maximum allowable SAP
  561.     UCHAR uchOpenSaps;              // number of currently open saps
  562.     UCHAR uchMaxStations;           // max number of stations (always 253)
  563.     UCHAR uchOpenStation;           // number of open stations (only up to 253)
  564.     UCHAR uchAvailStations;         // number of available stations (always 253)
  565.     UCHAR uchAdapterConfig;         // adapter configuration flags
  566.     UCHAR auchReserved1[10];        // microcode level
  567.     ULONG ulReserved1;
  568.     ULONG ulReserved2;
  569.     ULONG ulMaxFrameLength;         // maximum frame length (only in Windows/Nt)
  570.     USHORT usLastNetworkStatus;
  571.     USHORT usAdapterType;           // THIS BYTE IS NOT USED IN DOS DLC !!!
  572. } LLC_DIR_STATUS_PARMS, *PLLC_DIR_STATUS_PARMS;
  573.  
  574.  
  575. #define LLC_OPTION_READ_STATION 0
  576. #define LLC_OPTION_READ_SAP     1
  577. #define LLC_OPTION_READ_ALL     2
  578.  
  579. #define LLC_EVENT_SYSTEM_ACTION         0x0040
  580. #define LLC_EVENT_NETWORK_STATUS        0x0020
  581. #define LLC_EVENT_CRITICAL_EXCEPTION    0x0010
  582. #define LLC_EVENT_STATUS_CHANGE         0x0008
  583. #define LLC_EVENT_RECEIVE_DATA          0x0004
  584. #define LLC_EVENT_TRANSMIT_COMPLETION   0x0002
  585. #define LLC_EVENT_COMMAND_COMPLETION    0x0001
  586. #define LLC_READ_ALL_EVENTS             0x007F
  587.  
  588. //
  589. // LLC_STATUS_CHANGE indications
  590. // The returned status value may be an inclusive-OR of several flags
  591. //
  592.  
  593. #define LLC_INDICATE_LINK_LOST              0x8000
  594. #define LLC_INDICATE_DM_DISC_RECEIVED       0x4000
  595. #define LLC_INDICATE_FRMR_RECEIVED          0x2000
  596. #define LLC_INDICATE_FRMR_SENT              0x1000
  597. #define LLC_INDICATE_RESET                  0x0800
  598. #define LLC_INDICATE_CONNECT_REQUEST        0x0400
  599. #define LLC_INDICATE_REMOTE_BUSY            0x0200
  600. #define LLC_INDICATE_REMOTE_READY           0x0100
  601. #define LLC_INDICATE_TI_TIMER_EXPIRED       0x0080
  602. #define LLC_INDICATE_DLC_COUNTER_OVERFLOW   0x0040
  603. #define LLC_INDICATE_ACCESS_PRTY_LOWERED    0x0020
  604. #define LLC_INDICATE_LOCAL_STATION_BUSY     0x0001
  605.  
  606. typedef struct {
  607.     USHORT usStationId;
  608.     UCHAR uchOptionIndicator;
  609.     UCHAR uchEventSet;
  610.     UCHAR uchEvent;
  611.     UCHAR uchCriticalSubset;
  612.     ULONG ulNotificationFlag;
  613.  
  614.     union {
  615.  
  616.         struct {
  617.             USHORT usCcbCount;
  618.             PLLC_CCB pCcbCompletionList;
  619.             USHORT usBufferCount;
  620.             PLLC_BUFFER pFirstBuffer;
  621.             USHORT usReceivedFrameCount;
  622.             PLLC_BUFFER pReceivedFrame;
  623.             USHORT usEventErrorCode;
  624.             USHORT usEventErrorData[3];
  625.         } Event;
  626.  
  627.         struct {
  628.             USHORT usStationId;
  629.             USHORT usDlcStatusCode;
  630.             UCHAR uchFrmrData[5];
  631.             UCHAR uchAccessPritority;
  632.             UCHAR uchRemoteNodeAddress[6];
  633.             UCHAR uchRemoteSap;
  634.             UCHAR uchReserved;
  635.             USHORT usUserStatusValue;
  636.         } Status;
  637.  
  638.     } Type;
  639.  
  640. } LLC_READ_PARMS, *PLLC_READ_PARMS;
  641.  
  642. //
  643. // This data structure gives the best performance in Windows/Nt: The DLC driver
  644. // must copy the CCB and the parameter table. If the driver knows that the
  645. // parameter table is concatenated to the CCB, it can copy both structures at
  646. // once. NOTE: The pointer to the parameter table MUST still be present in the
  647. // CCB
  648. //
  649.  
  650. typedef struct {
  651.     LLC_CCB Ccb;
  652.     LLC_READ_PARMS Parms;
  653. } LLC_READ_COMMAND, *PLLC_READ_COMMAND;
  654.  
  655. //
  656. // New receive types for direct stations, these types are ignored if the direct
  657. // station was opened with a specific ethernet type
  658. //
  659.  
  660. #define LLC_DIR_RCV_ALL_TR_FRAMES       0
  661. #define LLC_DIR_RCV_ALL_MAC_FRAMES      1
  662. #define LLC_DIR_RCV_ALL_8022_FRAMES     2
  663. #define LLC_DIR_RCV_ALL_FRAMES          4
  664. #define LLC_DIR_RCV_ALL_ETHERNET_TYPES  5
  665.  
  666. #define LLC_CONTIGUOUS_MAC      0x80
  667. #define LLC_CONTIGUOUS_DATA     0x40
  668. #define LLC_NOT_CONTIGUOUS_DATA 0x00
  669.  
  670. //
  671. // LLC_BREAK (0x20) is not supported by Windows/Nt
  672. //
  673.  
  674. #define LLC_RCV_READ_INDIVIDUAL_FRAMES  0
  675. #define LLC_RCV_CHAIN_FRAMES_ON_LINK    1
  676. #define LLC_RCV_CHAIN_FRAMES_ON_SAP     2
  677.  
  678. typedef struct {
  679.     USHORT usStationId;             // SAP, link station or direct id
  680.     USHORT usUserLength;            // length of user data in buffer header
  681.     ULONG ulReceiveFlag;            // the received data handler
  682.     PLLC_BUFFER pFirstBuffer;       // first buffer in the pool
  683.     UCHAR uchOptions;               // defines how the frame is received
  684.     UCHAR auchReserved1[3];
  685.     UCHAR uchRcvReadOption;         // defines if rcv frames are chained
  686. } LLC_RECEIVE_PARMS, *PLLC_RECEIVE_PARMS;
  687.  
  688. #define LLC_CHAIN_XMIT_COMMANDS_ON_LINK 0
  689. #define LLC_COMPLETE_SINGLE_XMIT_FRAME  1
  690. #define LLC_CHAIN_XMIT_COMMANDS_ON_SAP  2
  691.  
  692. typedef struct {
  693.     USHORT usStationId;             // SAP, link station or direct id
  694.     UCHAR uchTransmitFs;            // token-ring frame status
  695.     UCHAR uchRemoteSap;             // remote destination SAP
  696.     PLLC_XMIT_BUFFER pXmitQueue1;   // first link list of frame segments
  697.     PLLC_XMIT_BUFFER pXmitQueue2;   // another segment list returuned to pool
  698.     USHORT cbBuffer1;               // length of buffer 1
  699.     USHORT cbBuffer2;               // length of buffer 2
  700.     PVOID pBuffer1;                 // yet another segment
  701.     PVOID pBuffer2;                 // this is the last segment of frame
  702.     UCHAR uchXmitReadOption;        // defines completion event for READ
  703. } LLC_TRANSMIT_PARMS,  *PLLC_TRANSMIT_PARMS;
  704.  
  705. #define LLC_FIRST_DATA_SEGMENT  0x01
  706. #define LLC_NEXT_DATA_SEGMENT   0x02
  707.  
  708. typedef struct {
  709.     UCHAR eSegmentType;             // defines if first or next segment of frame
  710.     UCHAR boolFreeBuffer;           // if set, this buffer is released to pool
  711.     USHORT cbBuffer;                // length of this buffer
  712.     PVOID pBuffer;
  713. } LLC_TRANSMIT_DESCRIPTOR, *PLLC_TRANSMIT_DESCRIPTOR;
  714.  
  715. //
  716. // The frames types returned in the first receive buffer or used with the
  717. // TRANSMIT_FRAMES command.  A direct station may also send only ethernet
  718. // frames. The ethernet types are only for transmit. Types 0x0019 - 0x05DC
  719. // are reserved
  720. //
  721.  
  722. enum _LLC_FRAME_TYPES {                     // Purpose:
  723.     LLC_DIRECT_TRANSMIT         = 0x0000,   // transmit
  724.     LLC_DIRECT_MAC              = 0x0002,   // receive
  725.     LLC_I_FRAME                 = 0x0004,   // receive & transmit
  726.     LLC_UI_FRAME                = 0x0006,   // receive & transmit
  727.     LLC_XID_COMMAND_POLL        = 0x0008,   // receive & transmit
  728.     LLC_XID_COMMAND_NOT_POLL    = 0x000A,   // receive & transmit
  729.     LLC_XID_RESPONSE_FINAL      = 0x000C,   // receive & transmit
  730.     LLC_XID_RESPONSE_NOT_FINAL  = 0x000E,   // receive & transmit
  731.     LLC_TEST_RESPONSE_FINAL     = 0x0010,   // receive & transmit
  732.     LLC_TEST_RESPONSE_NOT_FINAL = 0x0012,   // receive & transmit
  733.     LLC_DIRECT_8022             = 0x0014,   // receive (direct station)
  734.     LLC_TEST_COMMAND_POLL       = 0x0016,   // transmit
  735.     LLC_DIRECT_ETHERNET_TYPE    = 0x0018,   // receive (direct station)
  736.     LLC_LAST_FRAME_TYPE         = 0x001a,   // reserved
  737.     LLC_FIRST_ETHERNET_TYPE     = 0x05DD    // transmit (>)
  738. };
  739.  
  740. typedef struct {
  741.     LLC_CCB Ccb;                    // use this as transmit CCB
  742.     USHORT usStationId;
  743.     USHORT usFrameType;             // DLC frame or ethernet type
  744.     UCHAR uchRemoteSap;             // used with UI, TEST, XID frames
  745.     UCHAR uchXmitReadOption;
  746.     UCHAR Reserved2[2];
  747.     ULONG cXmitBufferCount;
  748.     LLC_TRANSMIT_DESCRIPTOR aXmitBuffer[1];
  749. } LLC_TRANSMIT2_COMMAND, *PLLC_TRANSMIT2_COMMAND;
  750.  
  751. //
  752. // LLC_TRANSMIT2_VAR_PARMS - this macro allocates space for variable length
  753. // descriptor array, eg: LLC_TRANSMIT2_VAR_PARMS(8) TransmitParms;
  754. //
  755.  
  756. #define LLC_TRANSMIT2_VAR_PARMS(a)\
  757. struct {\
  758.     LLC_CCB Ccb;\
  759.     USHORT usStationId;\
  760.     USHORT usFrameType;\
  761.     UCHAR uchRemoteSap;\
  762.     UCHAR uchXmitReadOption;\
  763.     UCHAR uchReserved2[2];\
  764.     ULONG cXmitBufferCount;\
  765.     LLC_TRANSMIT_DESCRIPTOR XmitBuffer[(a)];\
  766. }
  767.  
  768. //
  769. // LLC_PARMS - All CCB parameter tables can be referred to using this union
  770. //
  771.  
  772. union _LLC_PARMS {
  773.     LLC_BUFFER_FREE_PARMS BufferFree;
  774.     LLC_BUFFER_GET_PARMS BufferGet;
  775.     LLC_DLC_CONNECT_PARMS DlcConnectStation;
  776.     LLC_DLC_MODIFY_PARMS DlcModify;
  777.     LLC_DLC_OPEN_SAP_PARMS DlcOpenSap;
  778.     LLC_DLC_OPEN_STATION_PARMS DlcOpenStation;
  779.     LLC_DLC_REALLOCATE_PARMS DlcReallocate;
  780.     LLC_DLC_SET_THRESHOLD_PARMS DlcSetThreshold;
  781.     LLC_DLC_STATISTICS_PARMS DlcStatistics;
  782.     LLC_DIR_INITIALIZE_PARMS DirInitialize;
  783.     LLC_DIR_OPEN_ADAPTER_PARMS DirOpenAdapter;
  784.     LLC_DIR_OPEN_DIRECT_PARMS DirOpenDirect;
  785.     LLC_DIR_READ_LOG_PARMS DirReadLog;
  786.     LLC_DIR_SET_EFLAG_PARMS DirSetEventFlag;
  787.     LLC_DIR_STATUS_PARMS DirStatus;
  788.     LLC_READ_PARMS Read;
  789.     LLC_RECEIVE_PARMS Receive;
  790.     LLC_TRANSMIT_PARMS Transmit;
  791.     LLC_TRANSMIT2_COMMAND Transmit2;
  792.     LLC_TRACE_INITIALIZE_PARMS TraceInitialize;
  793. };
  794.  
  795. //
  796. // LLC_STATUS - enumerates the return codes which appear in the CCB uchDlcStatus
  797. // field
  798. //
  799.  
  800. typedef enum _LLC_STATUS {
  801.     LLC_STATUS_SUCCESS                      = 0x00,
  802.     LLC_STATUS_INVALID_COMMAND              = 0x01,
  803.     LLC_STATUS_DUPLICATE_COMMAND            = 0x02,
  804.     LLC_STATUS_ADAPTER_OPEN                 = 0x03,
  805.     LLC_STATUS_ADAPTER_CLOSED               = 0x04,
  806.     LLC_STATUS_PARAMETER_MISSING            = 0x05,
  807.     LLC_STATUS_INVALID_OPTION               = 0x06,
  808.     LLC_STATUS_COMMAND_CANCELLED_FAILURE    = 0x07,
  809.     LLC_STATUS_ACCESS_DENIED                = 0x08,   // not used in Windows/Nt
  810.     LLC_STATUS_ADAPTER_NOT_INITIALIZED      = 0x09,   // not used in Windows/Nt
  811.     LLC_STATUS_CANCELLED_BY_USER            = 0x0A,
  812.     LLC_STATUS_COMMAND_CANCELLED_CLOSED     = 0x0B,   // not used in Windows/Nt
  813.     LLC_STATUS_SUCCESS_NOT_OPEN             = 0x0C,
  814.     LLC_STATUS_TIMER_ERROR                  = 0x11,
  815.     LLC_STATUS_NO_MEMORY                    = 0x12,
  816.     LLC_STATUS_INVALID_LOG_ID               = 0x13,   // not used in Windows/Nt
  817.     LLC_STATUS_LOST_LOG_DATA                = 0x15,
  818.     LLC_STATUS_BUFFER_SIZE_EXCEEDED         = 0x16,
  819.     LLC_STATUS_INVALID_BUFFER_LENGTH        = 0x18,
  820.     LLC_STATUS_INADEQUATE_BUFFERS           = 0x19,
  821.     LLC_STATUS_USER_LENGTH_TOO_LARGE        = 0x1A,
  822.     LLC_STATUS_INVALID_PARAMETER_TABLE      = 0x1B,
  823.     LLC_STATUS_INVALID_POINTER_IN_CCB       = 0x1C,
  824.     LLC_STATUS_INVALID_ADAPTER              = 0x1D,
  825.     LLC_STATUS_LOST_DATA_NO_BUFFERS         = 0x20,
  826.     LLC_STATUS_LOST_DATA_INADEQUATE_SPACE   = 0x21,
  827.     LLC_STATUS_TRANSMIT_ERROR_FS            = 0x22,
  828.     LLC_STATUS_TRANSMIT_ERROR               = 0x23,
  829.     LLC_STATUS_UNAUTHORIZED_MAC             = 0x24,   // not used in Windows/Nt
  830.     LLC_STATUS_MAX_COMMANDS_EXCEEDED        = 0x25,   // not used in Windows/Nt
  831.     LLC_STATUS_LINK_NOT_TRANSMITTING        = 0x27,
  832.     LLC_STATUS_INVALID_FRAME_LENGTH         = 0x28,
  833.     LLC_STATUS_INADEQUATE_RECEIVE           = 0x30,   // not used in Windows/Nt
  834.     LLC_STATUS_INVALID_NODE_ADDRESS         = 0x32,
  835.     LLC_STATUS_INVALID_RCV_BUFFER_LENGTH    = 0x33,
  836.     LLC_STATUS_INVALID_XMIT_BUFFER_LENGTH   = 0x34,
  837.     LLC_STATUS_INVALID_STATION_ID           = 0x40,
  838.     LLC_STATUS_LINK_PROTOCOL_ERROR          = 0x41,
  839.     LLC_STATUS_PARMETERS_EXCEEDED_MAX       = 0x42,
  840.     LLC_STATUS_INVALID_SAP_VALUE            = 0x43,
  841.     LLC_STATUS_INVALID_ROUTING_INFO         = 0x44,
  842.     LLC_STATUS_RESOURCES_NOT_AVAILABLE      = 0x46,   // not used in Windows/Nt
  843.     LLC_STATUS_LINK_STATIONS_OPEN           = 0x47,
  844.     LLC_STATUS_INCOMPATIBLE_COMMANDS        = 0x4A,
  845.     LLC_STATUS_OUTSTANDING_COMMANDS         = 0x4C,   // not used in Windows/Nt
  846.     LLC_STATUS_CONNECT_FAILED               = 0x4D,
  847.     LLC_STATUS_INVALID_REMOTE_ADDRESS       = 0x4F,
  848.     LLC_STATUS_CCB_POINTER_FIELD            = 0x50,
  849.     LLC_STATUS_INVALID_APPLICATION_ID       = 0x52,   // not used in Windows/Nt
  850.     LLC_STATUS_NO_SYSTEM_PROCESS            = 0x56,   // not used in Windows/Nt
  851.     LLC_STATUS_INADEQUATE_LINKS             = 0x57,
  852.     LLC_STATUS_INVALID_PARAMETER_1          = 0x58,
  853.     LLC_STATUS_DIRECT_STATIONS_NOT_ASSIGNED = 0x5C,
  854.     LLC_STATUS_DEVICE_DRIVER_NOT_INSTALLED  = 0x5d,
  855.     LLC_STATUS_ADAPTER_NOT_INSTALLED        = 0x5e,
  856.     LLC_STATUS_CHAINED_DIFFERENT_ADAPTERS   = 0x5f,
  857.     LLC_STATUS_INIT_COMMAND_STARTED         = 0x60,
  858.     LLC_STATUS_TOO_MANY_USERS               = 0x61,   // not used in Windows/Nt
  859.     LLC_STATUS_CANCELLED_BY_SYSTEM_ACTION   = 0x62,
  860.     LLC_STATUS_DIR_STATIONS_NOT_AVAILABLE   = 0x63,   // not used in Windows/Nt
  861.     LLC_STATUS_NO_GDT_SELECTORS             = 0x65,
  862.     LLC_STATUS_MEMORY_LOCK_FAILED           = 0x69,
  863.  
  864.     //
  865.     // New NT DLC specific error codes begin from 0x80
  866.     // These error codes are for new Windows/Nt DLC apps.
  867.     //
  868.  
  869.     LLC_STATUS_INVALID_BUFFER_ADDRESS       = 0x80,
  870.     LLC_STATUS_BUFFER_ALREADY_RELEASED      = 0x81,
  871.     LLC_STATUS_BIND_ERROR                   = 0xA0,   // not used in Windows/Nt
  872.     LLC_STATUS_INVALID_VERSION              = 0xA1,
  873.     LLC_STATUS_NT_ERROR_STATUS              = 0xA2,
  874.     LLC_STATUS_PENDING                      = 0xFF
  875. } LLC_STATUS;
  876.  
  877. #define LLC_STATUS_MAX_ERROR 0xFF
  878.  
  879. //
  880. // ACSLAN_STATUS - status codes which are returned from AcsLan
  881. //
  882.  
  883. typedef enum {
  884.     ACSLAN_STATUS_COMMAND_ACCEPTED = 0,
  885.     ACSLAN_STATUS_INVALID_CCB_POINTER = 1,
  886.     ACSLAN_STATUS_CCB_IN_ERROR = 2,
  887.     ACSLAN_STATUS_CHAINED_CCB_IN_ERROR = 3,
  888.     ACSLAN_STATUS_SYSTEM_ERROR = 4,
  889.     ACSLAN_STATUS_SYSTEM_STATUS = 5,
  890.     ACSLAN_STATUS_INVALID_COMMAND = 6
  891. } ACSLAN_STATUS;
  892.  
  893. //
  894. // prototypes
  895. //
  896.  
  897. ACSLAN_STATUS
  898. APIENTRY
  899. AcsLan(
  900.     IN OUT PLLC_CCB pCcb,
  901.     OUT PLLC_CCB* ppBadCcb
  902.     );
  903.  
  904. #ifdef __cplusplus
  905. }
  906. #endif
  907.  
  908. #endif // _DLCAPI_
  909.