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