home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / geninc32.pak / DLCAPI.H < prev    next >
C/C++ Source or Header  |  1997-07-23  |  34KB  |  916 lines

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