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.

812 lines
21 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. dltyp.h
  5. Abstract:
  6. This module includes all internal typedefs and constats
  7. of data link driver.
  8. Author:
  9. Antti Saarenheimo (o-anttis) 17-MAY-1991
  10. Revision History:
  11. --*/
  12. #include "refcnt.h"
  13. //
  14. // Design notes:
  15. // All data structures are designed at first for
  16. // multiple clients to make the interface very clean.
  17. // This implements also a simple kernel level interface
  18. // of data link layer to be used by somebody that needs it.
  19. //
  20. struct _LLC_NDIS_PACKET;
  21. typedef struct _LLC_NDIS_PACKET LLC_NDIS_PACKET, *PLLC_NDIS_PACKET;
  22. struct _LLC_SAP;
  23. typedef struct _LLC_SAP LLC_SAP, *PLLC_SAP;
  24. struct _DATA_LINK;
  25. typedef struct _DATA_LINK DATA_LINK, *PDATA_LINK;
  26. struct _ADAPTER_CONTEXT;
  27. typedef struct _ADAPTER_CONTEXT ADAPTER_CONTEXT, *PADAPTER_CONTEXT;
  28. //
  29. // LLC_GENERIC_OBJECT - these fields are common in all LLC objects
  30. //
  31. struct _LLC_GENERIC_OBJECT {
  32. //
  33. // DEBUG version - we have a 16-byte identifier header for consistency
  34. // checking and to help when looking at DLC using the kernel debugger
  35. //
  36. // DBG_OBJECT_ID;
  37. //
  38. // pointer to singly-linked list of same-type structures
  39. //
  40. PLLC_OBJECT pNext;
  41. //
  42. // ObjectType - SAP, DIRECT or LINK
  43. //
  44. UCHAR ObjectType;
  45. //
  46. // EthernetType - if we have opened the adapter binding in AUTO mode then
  47. // for SAPs and Link Stations we need to determine whether to talk 802.3
  48. // or DIX
  49. //
  50. UCHAR EthernetType;
  51. //
  52. // usReserved - just aligns to DWORD (not necessary)
  53. //
  54. USHORT usReserved;
  55. PADAPTER_CONTEXT pAdapterContext;
  56. PBINDING_CONTEXT pLlcBinding;
  57. //
  58. // hClientHandle - handle to LINK object in upper layer
  59. //
  60. PVOID hClientHandle;
  61. PLLC_PACKET pCompletionPackets;
  62. ULONG ReferenceCount;
  63. };
  64. typedef struct _LLC_GENERIC_OBJECT LLC_GENERIC_OBJECT, *PLLC_GENERIC_OBJECT;
  65. //
  66. // LLC_U_RESPONSE - LLC header for U-type response frame
  67. //
  68. typedef struct _LLC_U_RESPONSE {
  69. UCHAR Dsap; // Destination Service Access Point.
  70. UCHAR Ssap; // Source Service Access Point.
  71. UCHAR Command; // command code.
  72. UCHAR Info[1]; // respomse table
  73. } LLC_U_RESPONSE, *PLLC_U_RESPONSE;
  74. //
  75. // QUEUE_PACKET - generic doubly-linked list header
  76. //
  77. typedef struct _QUEUE_PACKET {
  78. struct _QUEUE_PACKET* pNext;
  79. struct _QUEUE_PACKET* pPrev;
  80. } QUEUE_PACKET, *PQUEUE_PACKET;
  81. //
  82. // LLC_QUEUE -
  83. //
  84. typedef struct _LLC_QUEUE {
  85. LIST_ENTRY ListEntry;
  86. LIST_ENTRY ListHead; // the list head
  87. PVOID pObject; // owner handle (used if element is linked)
  88. } LLC_QUEUE, *PLLC_QUEUE;
  89. //
  90. // This information is a part of the DLC.STATISTICS
  91. // information for a link station. The whole
  92. // strcuture can be reseted.
  93. //
  94. typedef struct _LINK_STATION_STATISTICS {
  95. USHORT I_FramesTransmitted;
  96. USHORT I_FramesReceived;
  97. UCHAR I_FrameReceiveErrors;
  98. UCHAR I_FrameTransmissionErrors;
  99. USHORT T1_ExpirationCount; // not in data xfer mode
  100. } LINK_STATION_STATISTICS, *PLINK_STATION_STATISTICS;
  101. typedef struct _SAP_STATISTICS {
  102. ULONG FramesTransmitted;
  103. ULONG FramesReceived;
  104. ULONG FramesDiscardedNoRcv;
  105. ULONG DataLostCounter;
  106. } SAP_STATISTICS, *PSAP_STATISTICS;
  107. struct _LLC_SAP {
  108. LLC_GENERIC_OBJECT Gen;
  109. USHORT SourceSap; // THIS MUST OVERLAY ObjectAddress
  110. USHORT OpenOptions;
  111. SAP_STATISTICS Statistics;
  112. //
  113. // KEEP THIS SAME IN SAP STATION AND GENERIC OBJECT
  114. //
  115. DLC_LINK_PARAMETERS DefaultParameters;
  116. NDIS_SPIN_LOCK FlowControlLock;
  117. PDATA_LINK pActiveLinks; // all link stations of this sap
  118. };
  119. struct _TIMER_TICK;
  120. typedef struct _TIMER_TICK TIMER_TICK, *PTIMER_TICK;
  121. typedef struct _LLC_TIMER {
  122. struct _LLC_TIMER* pNext;
  123. struct _LLC_TIMER* pPrev;
  124. PTIMER_TICK pTimerTick;
  125. ULONG ExpirationTime;
  126. PVOID hContext;
  127. #if defined(LOCK_CHECK)
  128. ULONG Disabled;
  129. #endif
  130. } LLC_TIMER, *PLLC_TIMER;
  131. struct _TIMER_TICK {
  132. struct _TIMER_TICK* pNext;
  133. // struct _TIMER_TICK* pPrev;
  134. PLLC_TIMER pFront;
  135. UINT DeltaTime;
  136. USHORT Input;
  137. USHORT ReferenceCount;
  138. };
  139. //
  140. // DATA_LINK - these 'objects' are from a two level data storage. The hash table
  141. // provides a very fast access to links, when there are less than 100 links
  142. // (about 99 % of the cases). The binary tree keeps the search times still quite
  143. // small, when there are very many connections from/to the same server.
  144. //
  145. struct _DATA_LINK {
  146. LLC_GENERIC_OBJECT Gen;
  147. //
  148. // Data link station state machine variables, *2 means the value
  149. // to be used as 2 increments, because modulo 256 is much easier
  150. // to handle than modulo 128. UCHAR wraps around automatically.
  151. //
  152. SHORT Is_Ct; // Max number of I retries (Update_Va & xxx_Chkpt)
  153. USHORT Ia_Ct; // Number of LPDU acknowledgements since Ww was incr.
  154. UCHAR State; // current state of the finite state machine
  155. UCHAR Ir_Ct; // LPDUs possible to send before next acknowledgement
  156. UCHAR Vs; // *2, Send state variable (Ns of next sent LPDU)
  157. UCHAR VsMax; // *2, Max Send state variable (Ns of next sent LPDU)
  158. UCHAR Vr; // *2, Receive state variable( Nr of next sent LPDU)
  159. UCHAR Pf; // value of PollFinal bit in last command
  160. UCHAR Va; // *2, Last valid Nr received (ack state variable)
  161. UCHAR Vp; // *2, Poll state var. (Ns of last sent cmd with P-bit)
  162. UCHAR Vb; // Busy state (Vl, Vb, Vlb)
  163. UCHAR Vc; // Stacked command variable (only DISC is possible)
  164. UCHAR Vi; // initialization state variable
  165. //
  166. // BEGIN OF DLC_LINK_PARAMETERS (same as llc_params struct)
  167. // DON'T TOUCH !!!!
  168. //
  169. UCHAR TimerT1; // Timer T1 value
  170. UCHAR TimerT2; // Timer T2 value
  171. UCHAR TimerTi; // Timer Ti value
  172. UCHAR MaxOut; // *2, maximum transmit window size (MaxOut)
  173. UCHAR RW; // maximum receive window size (MaxIn)
  174. UCHAR Nw; // number of LPDUs acknowledged, before Ww is incr.)
  175. UCHAR N2; // Number of retires allowed (both Polls and I LPDSs)
  176. UCHAR AccessPrty; // access priority
  177. USHORT MaxIField; // maximum received info field (not used in LLC)
  178. //
  179. // End of DLC_LINK_PARAMETERS
  180. //
  181. UCHAR Ww; // *2, working window size
  182. UCHAR N3; // number of I format LPDUs between acks (with Ir_Ct)
  183. UCHAR P_Ct; // Poll retry count
  184. UCHAR Nr; // last Nr of the received frame
  185. //
  186. // Variables needed to maintain dynamic response base time for timers.
  187. //
  188. USHORT LastTimeWhenCmdPollWasSent;
  189. USHORT AverageResponseTime;
  190. UCHAR cbLanHeaderLength;
  191. UCHAR VrDuringLocalBusy;
  192. UCHAR Flags;
  193. UCHAR TW; // dynamic MaxOut value
  194. USHORT FullWindowTransmits; // succeeded Polls of full window xmits
  195. UCHAR T1_Timeouts; // T1 timeouts after I-c1
  196. UCHAR RemoteOpen;
  197. //
  198. // The link status flags contains these status bits:
  199. //
  200. // DLC_WAITING_RESPONSE_TO_POLL
  201. // DLC_FIRST_POLL
  202. // DLC_ACTIVE_REMOTE_CONECT_REQUEST
  203. // DLC_COMMAND_POLL_PENDING_IN_NDIS;
  204. // DLC_SEND_DISABLED
  205. // DLC_SEND_ACTIVE
  206. // DLC_LOCAL_BUSY_BUFFER
  207. // DLC_LOCAL_BUSY_USER
  208. //
  209. //
  210. // the timer objects
  211. //
  212. LLC_TIMER T1;
  213. LLC_TIMER T2;
  214. LLC_TIMER Ti;
  215. LLC_QUEUE SendQueue; // untransmitted queue for the I frames
  216. LIST_ENTRY SentQueue; // the sent but not acknowledged I- frames
  217. PDATA_LINK pNextNode; // for the hash table
  218. LAN802_ADDRESS LinkAddr;// 64 bit lan address of the link
  219. PLLC_SAP pSap; // link to the SAP object of this link
  220. DLC_STATUS_TABLE DlcStatus;
  221. //
  222. // Resetable link station statistics counters
  223. //
  224. LINK_STATION_STATISTICS Statistics;
  225. UCHAR LastCmdOrRespSent;
  226. UCHAR LastCmdOrRespReceived;
  227. UCHAR Dsap; // Destination SAP
  228. UCHAR Ssap; // Source SAP
  229. //
  230. // some link statistics (don't reset this)
  231. //
  232. ULONG BufferCommitment;
  233. //
  234. // FramingType - type of framing (802.3/DIX/don't care) that we should use
  235. // for this connection. Required because in AUTO mode, the actual framing
  236. // type may be different than that in the BINDING_CONTEXT, and since the
  237. // BINDING_CONTEXT is per-adapter, we cannot rely on it (this whole thing
  238. // is messed up)
  239. //
  240. ULONG FramingType;
  241. //
  242. // Network frame header (includes the full address information)
  243. //
  244. UCHAR auchLanHeader[1];
  245. //
  246. // LAN HEADER OVERFLOWS HERE !!!!
  247. //
  248. };
  249. typedef struct _LLC_STATION_OBJECT {
  250. LLC_GENERIC_OBJECT Gen;
  251. USHORT ObjectAddress;
  252. USHORT OpenOptions;
  253. SAP_STATISTICS Statistics;
  254. } LLC_STATION_OBJECT, *PLLC_STATION_OBJECT;
  255. union _LLC_OBJECT {
  256. //
  257. // KEEP THIS SAME AS DIRECT AND SAP STATIONS
  258. //
  259. LLC_GENERIC_OBJECT Gen;
  260. DATA_LINK Link;
  261. LLC_SAP Sap;
  262. LLC_STATION_OBJECT Group;
  263. LLC_STATION_OBJECT Dix;
  264. LLC_STATION_OBJECT Dir;
  265. };
  266. //*****************************************************************
  267. typedef struct _NDIS_MAC_PACKET {
  268. NDIS_PACKET_PRIVATE private;
  269. UCHAR auchMacReserved[16];
  270. } NDIS_MAC_PACKET;
  271. struct _LLC_NDIS_PACKET {
  272. NDIS_PACKET_PRIVATE private; // we accesss this also directly
  273. UCHAR auchMacReserved[16];
  274. PMDL pMdl; // MDL for LAN and LLC headers
  275. //
  276. // request handle and command completion handler are saved to
  277. // the packet until NDIS has completed the command
  278. //
  279. PLLC_PACKET pCompletionPacket;
  280. #if LLC_DBG
  281. ULONG ReferenceCount;
  282. #endif
  283. UCHAR auchLanHeader[LLC_MAX_LAN_HEADER + sizeof(LLC_U_HEADER) + sizeof(LLC_RESPONSE_INFO)];
  284. };
  285. typedef struct _LLC_TRANSFER_PACKET {
  286. NDIS_PACKET_PRIVATE private;
  287. UCHAR auchMacReserved[16];
  288. PLLC_PACKET pPacket;
  289. } LLC_TRANSFER_PACKET, *PLLC_TRANSFER_PACKET;
  290. typedef struct _EVENT_PACKET {
  291. struct _EVENT_PACKET* pNext;
  292. struct _EVENT_PACKET* pPrev;
  293. PBINDING_CONTEXT pBinding;
  294. PVOID hClientHandle;
  295. PVOID pEventInformation;
  296. UINT Event;
  297. UINT SecondaryInfo;
  298. } EVENT_PACKET, *PEVENT_PACKET;
  299. //
  300. // The next structure is used only in the allocating packets to the pool
  301. //
  302. typedef union _UNITED_PACKETS {
  303. QUEUE_PACKET queue;
  304. EVENT_PACKET event;
  305. LLC_PACKET XmitPacket;
  306. UCHAR auchLanHeader[LLC_MAX_LAN_HEADER];
  307. } UNITED_PACKETS, *PUNITED_PACKETS;
  308. //
  309. // NODE_ADDRESS - 6 byte MAC address expressed as bytes or ULONG & USHORT for
  310. // minimal comparisons/moves on 32-bit architecture
  311. //
  312. typedef union {
  313. UCHAR Bytes[6];
  314. struct {
  315. ULONG Top4;
  316. USHORT Bottom2;
  317. } Words;
  318. } NODE_ADDRESS, *PNODE_ADDRESS;
  319. //
  320. // FRAMING_DISCOVERY_CACHE_ENTRY - the solution to the LLC_ETHERNET_TYPE_AUTO
  321. // problem (where we can end up proliferating TEST/XIDs and SABME/UAs) is to
  322. // keep a cache of destinations we have 'ping'ed with TEST/XID/SABME. We send
  323. // both frame types - DIX and 802.3. We indicate the first received response
  324. // and create a cache entry, recording the remote MAC address and the framing
  325. // type. If another response frame arrives from the cached MAC address with
  326. // the other framing type, it is discarded
  327. //
  328. typedef struct {
  329. NODE_ADDRESS NodeAddress; // the remote MAC address
  330. BOOLEAN InUse; // TRUE if in use (could use TimeStamp == 0)
  331. UCHAR FramingType; // DIX or 802.3
  332. LARGE_INTEGER TimeStamp; // used for LRU throw-out
  333. } FRAMING_DISCOVERY_CACHE_ENTRY, *PFRAMING_DISCOVERY_CACHE_ENTRY;
  334. #define FRAMING_TYPE_DIX 0x1d // arbitrary value
  335. #define FRAMING_TYPE_802_3 0x83 // " "
  336. //
  337. // BINDING_CONTEXT - one of these created for each client (app/open driver
  338. // handle instance) opening the adapter. We only perform an open adapter at
  339. // NDIS level once, which creates the ADAPTER_CONTEXT for the NDIS open
  340. // adapter instance. Subsequent open adapter requests from processes cause
  341. // a BINDING_CONTEXT to be created and linked to the ADAPTER_CONTEXT
  342. //
  343. struct _BINDING_CONTEXT {
  344. //
  345. // DEBUG version - we have a 16-byte identifier header for consistency
  346. // checking and to help when looking at DLC using the kernel debugger
  347. //
  348. // DBG_OBJECT_ID;
  349. //
  350. // pointer to singly-linked list of BINDING_CONTEXT structures for this
  351. // ADAPTER_CONTEXT
  352. //
  353. struct _BINDING_CONTEXT* pNext;
  354. //
  355. // pointer to ADAPTER_CONTEXT structure for this BINDING_CONTEXT
  356. //
  357. PADAPTER_CONTEXT pAdapterContext;
  358. //
  359. // handle of/pointer to FILE_CONTEXT structure
  360. //
  361. PVOID hClientContext;
  362. //
  363. // pointers to command completion, receive and event indication functions
  364. //
  365. PFLLC_COMMAND_COMPLETE pfCommandComplete;
  366. PFLLC_RECEIVE_INDICATION pfReceiveIndication;
  367. PFLLC_EVENT_INDICATION pfEventIndication;
  368. //
  369. // Functional - functional address applied to this binding by the app
  370. //
  371. TR_BROADCAST_ADDRESS Functional;
  372. //
  373. // ulFunctionalZeroBits - mask of bits which should be off for functional
  374. // address/multicast address
  375. //
  376. ULONG ulFunctionalZeroBits;
  377. //
  378. // 0.5 second timer used for DIR.TIMER functions
  379. //
  380. LLC_TIMER DlcTimer;
  381. //
  382. // NdisMedium - the actual medium that the adapter to which we are bound talks
  383. //
  384. UINT NdisMedium;
  385. //
  386. // AddressTranslation - how the bits in addresses should be represented at
  387. // the top and bottom edges of LLC
  388. //
  389. USHORT AddressTranslation;
  390. //
  391. // BroadCastAddress - 6 byte broadcast address treated as USHORT and ULONG
  392. // entities. Used for checking promiscuous packets
  393. //
  394. USHORT usBroadcastAddress;
  395. ULONG ulBroadcastAddress;
  396. //
  397. // InternalAddressTranslation -
  398. //
  399. USHORT InternalAddressTranslation;
  400. //
  401. // EthernetType - value which determines the format of an Ethernet frame.
  402. // Different for 802.3 vs. DIX vs. ...
  403. //
  404. USHORT EthernetType;
  405. //
  406. // SwapCopiedLanAddresses - TRUE if we bit-swap LAN addresses when copying
  407. // up or down the layers
  408. //
  409. BOOLEAN SwapCopiedLanAddresses;
  410. //
  411. // The big substructures should be in the end
  412. // to produce optimal code for x86
  413. //
  414. LLC_TRANSFER_PACKET TransferDataPacket;
  415. //
  416. // FramingDiscoveryCacheEntries - maximum number of elements that can be
  417. // in DiscoveryFramingCache. Will be zero if the adapter is not ethernet and
  418. // LLC_ETHERNET_TYPE_AUTO was not requested, else number determined from
  419. // registry or default value. Number from registry may also be 0, indicating
  420. // caching is not to be used (old semantics)
  421. //
  422. ULONG FramingDiscoveryCacheEntries;
  423. //
  424. // FramingDiscoveryCache - if this EthernetType == LLC_ETHERNET_TYPE_AUTO,
  425. // we create a cache of destination MAC addresses and the DIX/802.3 framing
  426. // type they use. This array is FramingDiscoveryCacheEntries long
  427. //
  428. FRAMING_DISCOVERY_CACHE_ENTRY FramingDiscoveryCache[];
  429. };
  430. //
  431. // ADAPTER_CONTEXT - the device context of an NDIS driver. It includes links to
  432. // all dynamic data structures of the data link driver.
  433. //
  434. // This version does not support the group SAPs
  435. //
  436. #define LINK_HASH_SIZE 128
  437. struct _ADAPTER_CONTEXT {
  438. //
  439. // DEBUG version - we have a 16-byte identifier header for consistency
  440. // checking and to help when looking at DLC using the kernel debugger
  441. //
  442. // DBG_OBJECT_ID;
  443. //
  444. // pointer to singly-linked list of ADAPTER_CONTEXT structures opened by
  445. // all clients of this driver
  446. //
  447. struct _ADAPTER_CONTEXT* pNext;
  448. #if !defined(DLC_UNILOCK)
  449. NDIS_SPIN_LOCK SendSpinLock; // locked when accessing send queues
  450. NDIS_SPIN_LOCK ObjectDataBase; // used also with sap/direct create
  451. #endif
  452. PLLC_STATION_OBJECT pDirectStation; // link list of direct stations
  453. PBINDING_CONTEXT pBindings; // link list of all bindings
  454. NDIS_HANDLE NdisBindingHandle;
  455. PVOID hLinkPool; // pool for link station structs
  456. PVOID hPacketPool; // pool for usr/small LLC packets
  457. //
  458. // circular link list is free NDIS packets for send (initially maybe 5)
  459. //
  460. PLLC_NDIS_PACKET pNdisPacketPool;
  461. NDIS_HANDLE hNdisPacketPool;
  462. //
  463. // Some stuff for asynchronous receive indications
  464. //
  465. PVOID hReceiveCompletionRequest;
  466. PLLC_PACKET pResetPackets;
  467. //
  468. // pHeadBuf - pointer to the MAC header buffer, containing:
  469. //
  470. // FDDI:
  471. // 1 Byte Frame Control (FDDI)
  472. // 6 Bytes Destination MAC Address (ALL)
  473. // 6 Bytes Source MAC Address (ALL)
  474. //
  475. // Token Ring:
  476. // 1 Byte Access Control (Token Ring)
  477. // 1 Byte Frame Control (Token Ring)
  478. // 6 Bytes Destination MAC Address (ALL)
  479. // 6 Bytes Source MAC Address (ALL)
  480. // 0-18 Bytes Source Routing
  481. //
  482. // Ethernet:
  483. // 6 Bytes Destination MAC Address (ALL)
  484. // 6 Bytes Source MAC Address (ALL)
  485. // 2 Bytes Length or DIX Type
  486. //
  487. PUCHAR pHeadBuf;
  488. //
  489. // cbHeadBuf - number of bytes in pHeadBuf
  490. //
  491. UINT cbHeadBuf;
  492. //
  493. // pLookBuf - pointer to the MAC look-ahead buffer which contains the rest
  494. // of the data for this frame or as much as the MAC could fit into the look
  495. // ahead buffer (in which case NdisTransferData must be used to get the
  496. // rest)
  497. //
  498. PUCHAR pLookBuf;
  499. //
  500. // cbLookBuf - number of bytes in pLookBuf
  501. //
  502. UINT cbLookBuf;
  503. //
  504. // cbPacketSize - actual size of the whole frame. Calculated from information
  505. // in the header or supplied by the MAC, depending on the medium
  506. //
  507. UINT cbPacketSize;
  508. //
  509. // IsSnaDixFrame - true if the frame just received (on ethernet) is a DIX
  510. // frame and the DIX identifier is 0x80D5 (big-endian)
  511. //
  512. UINT IsSnaDixFrame;
  513. LAN802_ADDRESS Adapter;
  514. ULONG MaxFrameSize;
  515. ULONG LinkSpeed;
  516. //
  517. // We use UINTs, because (Move mem, ULONG) may not be an
  518. // atomic operation (in theory)
  519. //
  520. UINT NdisMedium;
  521. UINT XidTestResponses;
  522. ULONG ObjectCount; // must be zero, when adapter closed
  523. //
  524. // ConfigInfo - holds the SwapAddressBits and UseDixOverEthernet flags and
  525. // the timer tick values
  526. //
  527. ADAPTER_CONFIGURATION_INFO ConfigInfo;
  528. //
  529. // the original node addresses
  530. //
  531. ULONG ulBroadcastAddress;
  532. USHORT usBroadcastAddress;
  533. USHORT BackgroundProcessRequests;
  534. UCHAR NodeAddress[6]; // Current network format
  535. USHORT cbMaxFrameHeader;
  536. UCHAR PermanentAddress[6];
  537. USHORT OpenOptions;
  538. USHORT AddressTranslationMode;
  539. USHORT FrameType;
  540. USHORT usRcvMask;
  541. USHORT EthernetType;
  542. USHORT RcvLanHeaderLength;
  543. USHORT BindingCount;
  544. USHORT usHighFunctionalBits;
  545. //
  546. // Keep UCHAR alignment
  547. //
  548. BOOLEAN boolTranferDataNotComplete;
  549. BOOLEAN IsDirty;
  550. BOOLEAN ResetInProgress;
  551. UCHAR Unused1;
  552. #ifndef NDIS40
  553. // Not used.
  554. UCHAR AdapterNumber;
  555. #endif // NDIS40
  556. UCHAR IsBroadcast;
  557. BOOLEAN SendProcessIsActive;
  558. BOOLEAN LlcPacketInSendQueue;
  559. //
  560. // We keep the big structures and tables in the end,
  561. // that makes most x86 offsets 1 byte instead of 4.
  562. // The compiler aligns the fields naturally, whenever
  563. // it is necessary.
  564. //
  565. //
  566. // the next elements will be linked to circular
  567. // end process link list, if there are any frames to send
  568. //
  569. LIST_ENTRY NextSendTask; // pointer to active sends
  570. LIST_ENTRY QueueEvents;
  571. LIST_ENTRY QueueCommands;
  572. LLC_QUEUE QueueI;
  573. LLC_QUEUE QueueDirAndU;
  574. LLC_QUEUE QueueExpidited;
  575. UNICODE_STRING Name; // current adapter name
  576. PTIMER_TICK pTimerTicks;
  577. NDIS_STATUS AsyncOpenStatus; // used to wait async open
  578. NDIS_STATUS AsyncCloseResetStatus; // used to wait async close
  579. NDIS_STATUS OpenCompleteStatus; // used to wait the first open
  580. NDIS_STATUS LinkRcvStatus; // link state machine ret status
  581. NDIS_STATUS NdisRcvStatus; // NdisRcvIndication ret status
  582. NDIS_STATUS OpenErrorStatus; // special adapter open status
  583. //
  584. // NDIS calls back when adapter open completes. Use a Kernel Event to
  585. // synchronize LLC with NDIS
  586. //
  587. KEVENT Event;
  588. //
  589. // the following are reasonably large arrays (like 256 pointers to SAP
  590. // objects...)
  591. //
  592. PLLC_SAP apSapBindings[256]; // the clients bound to the SAPs
  593. PDATA_LINK aLinkHash[LINK_HASH_SIZE]; // hash table to links
  594. PLLC_STATION_OBJECT aDixStations[MAX_DIX_TABLE];
  595. LLC_TRANSFER_PACKET TransferDataPacket;
  596. #if DBG
  597. //
  598. // memory usage counters for memory owned by this ADAPTER_CONTEXT
  599. //
  600. MEMORY_USAGE MemoryUsage;
  601. MEMORY_USAGE StringUsage;
  602. #endif
  603. #ifdef NDIS40
  604. #define BIND_STATE_UNBOUND 1
  605. #define BIND_STATE_UNBINDING 2
  606. #define BIND_STATE_BOUND 3
  607. LONG BindState;
  608. REF_CNT AdapterRefCnt;
  609. KEVENT CloseAdapterEvent;
  610. #endif // NDIS40
  611. };
  612. typedef PLLC_PACKET (*PF_GET_PACKET)(IN PADAPTER_CONTEXT pAdapterContext);
  613.