Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

908 lines
32 KiB

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