DlcAPI.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:33k
源码类别:

模拟服务器

开发平台:

C/C++

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