home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / RTLWIN32.PAK / DLCAPI.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  33.2 KB  |  912 lines

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