Windows NT 4.0 source code leak
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.

223 lines
5.8 KiB

4 years ago
  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. ltsft.h
  5. Abstract:
  6. This module contains the main adapter/binding definitions and all
  7. other main definitions.
  8. Author:
  9. Stephen Hou (stephh@microsoft.com)
  10. Nikhil Kamkolkar (nikhilk@microsoft.com)
  11. Revision History:
  12. 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com)
  13. Notes: Tab stop: 4
  14. --*/
  15. #ifndef _LTSFT_
  16. #define _LTSFT_
  17. // We use STATIC to define procedures that will be static in the
  18. // final build but which we now make extern to allow them to be
  19. // debugged.
  20. #if DBG
  21. #define STATIC
  22. #else
  23. #define STATIC static
  24. #endif
  25. #define NDIS_MAJOR_VERSION 3
  26. #define NDIS_MINOR_VERSION 0
  27. #define LT_MAJOR_VERSION 2
  28. #define LT_MINOR_VERSION 0
  29. #define LT_MAX_INDICATE_SIZE 603
  30. #define LT_MAX_PACKET_SIZE 603
  31. #define LT_MIN_PACKET_SIZE 3
  32. #define LT_MIN_INDICATE_SIZE 13
  33. // Offset into packet from where the datagram begins.
  34. #define LT_LINK_HEADER_LENGTH 3
  35. #define LT_DGRAM_OFFSET (LT_LINK_HEADER_LENGTH)
  36. // Localtalk separates node id's into two classes, server/client. We attempt
  37. // to get ours in the Server Class.
  38. #define LT_MAX_CLIENT_NODE_ID 127
  39. #define LT_MIN_SERVER_NODE_ID 128
  40. #define LT_BROADCAST_NODE_ID 0xFF
  41. // Indexes in the GeneralMandatory array.
  42. #define GM_TRANSMIT_GOOD 0x00
  43. #define GM_RECEIVE_GOOD 0x01
  44. #define GM_TRANSMIT_BAD 0x02
  45. #define GM_RECEIVE_BAD 0x03
  46. #define GM_RECEIVE_NO_BUFFER 0x04
  47. #define GM_ARRAY_SIZE 0x05
  48. // Indexes in the GeneralOptional array. There are
  49. // two sections, the ones up to COUNT_ARRAY_SIZE
  50. // have entries for number (4 bytes) and number of
  51. // bytes (8 bytes), the rest are a normal array.
  52. #define GO_DIRECTED_TRANSMITS 0x00
  53. #define GO_MULTICAST_TRANSMITS 0x01
  54. #define GO_BROADCAST_TRANSMITS 0x02
  55. #define GO_DIRECTED_RECEIVES 0x03
  56. #define GO_MULTICAST_RECEIVES 0x04
  57. #define GO_BROADCAST_RECEIVES 0x05
  58. #define GO_COUNT_ARRAY_SIZE 0x06
  59. #define GO_ARRAY_START 0x0C
  60. #define GO_RECEIVE_CRC 0x0C
  61. #define GO_TRANSMIT_QUEUE_LENGTH 0x0D
  62. #define GO_ARRAY_SIZE 0x0E
  63. // Indexes in the MediaMandatory array.
  64. #define MM_IN_BROADCASTS 0x00
  65. #define MM_IN_LENGTH_ERRORS 0x01
  66. #define MM_ARRAY_SIZE 0x02
  67. // Indexes in the MediaOptional array.
  68. #define MO_NO_HANDLERS 0x00
  69. #define MO_TRANSMIT_MAX_COLLISIONS 0x01
  70. #define MO_TRANSMIT_DEFERS 0x02
  71. #define MO_NO_DATA_ERRORS 0x03
  72. #define MO_RANDOM_CTS_ERRORS 0x04
  73. #define MO_FCS_ERRORS 0x05
  74. #define MO_ARRAY_SIZE 0x06
  75. // Adapter States/Conditions.
  76. #define ADAPTER_OPEN 0x00000001
  77. #define ADAPTER_CLOSING 0x00000002
  78. #define ADAPTER_NODE_ID_VALID 0x00000004
  79. #define ADAPTER_XMIT_IN_PROGRESS 0x00000008
  80. #define ADAPTER_REQ_IN_PROGRESS 0x00000010
  81. #define ADAPTER_RESET_IN_PROGRESS 0x00000020
  82. #define ADAPTER_QUEUE_RECV_COMPLETION 0x00000040
  83. #define ADAPTER_QUEUED_RECV_COMPLETION 0x00000080
  84. #define ADAPTER_TIMER_QUEUED 0x00000100
  85. typedef struct _LT_ADAPTER {
  86. #if DBG
  87. ULONG Signature;
  88. #endif
  89. ULONG Flags;
  90. ULONG RefCount;
  91. NDIS_SPIN_LOCK Lock;
  92. // Node ID. Localtalk acquires a node id dynamically.
  93. UCHAR NodeId;
  94. UCHAR PramNodeId;
  95. // List of Bindings
  96. UINT OpenCount;
  97. LIST_ENTRY OpenBindings;
  98. // We have a Polling timer which will handle all the work that this
  99. // driver needs to do.
  100. NDIS_TIMER PollingTimer;
  101. // Hardware settings on the card. From the configuration manager
  102. ULONG MappedIoBaseAddr;
  103. NDIS_INTERFACE_TYPE BusType;
  104. // Handles for our adapter and the MAC driver itself.
  105. NDIS_HANDLE NdisMacHandle;
  106. NDIS_HANDLE NdisAdapterHandle;
  107. // Reset processing.
  108. struct _LT_OPEN * ResetOwner;
  109. // Queues
  110. LIST_ENTRY LoopBack;
  111. LIST_ENTRY Transmit;
  112. LIST_ENTRY Receive;
  113. LIST_ENTRY Request;
  114. // Current loopback packet
  115. PNDIS_PACKET CurrentLoopbackPacket;
  116. // Statistics
  117. ULONG GlobalPacketFilter;
  118. ULONG GlobalLookAheadSize;
  119. LT_STATUS_RESPONSE LastCardStatusResponse;
  120. ULONG GeneralMandatory[GM_ARRAY_SIZE];
  121. LARGE_INTEGER GeneralOptionalByteCount[GO_COUNT_ARRAY_SIZE];
  122. ULONG GeneralOptionalFrameCount[GO_COUNT_ARRAY_SIZE];
  123. ULONG GeneralOptional[GO_ARRAY_SIZE - GO_ARRAY_START];
  124. ULONG MediaMandatory[MM_ARRAY_SIZE];
  125. ULONG MediaOptional[MO_ARRAY_SIZE];
  126. } LT_ADAPTER, *PLT_ADAPTER;
  127. // Binding states
  128. #define BINDING_OPEN 0x00000001
  129. #define BINDING_CLOSING 0x00000002
  130. #define BINDING_DO_RECV_COMPLETION 0x00000004
  131. typedef struct _LT_OPEN {
  132. #if DBG
  133. ULONG Signature;
  134. #endif
  135. ULONG Flags;
  136. ULONG RefCount;
  137. LIST_ENTRY Linkage;
  138. PLT_ADAPTER LtAdapter;
  139. NDIS_HANDLE NdisBindingContext;
  140. UINT CurrentLookAheadSize;
  141. UINT CurrentPacketFilter;
  142. } LT_OPEN, *PLT_OPEN;
  143. #define LT_DIRECTED 1
  144. #define LT_BROADCAST 2
  145. #define LT_LOOPBACK 3
  146. // This record type is inserted into the MacReserved portion
  147. // of the packet header when the packet is going through the
  148. // staged allocation of buffer space prior to the actual send.
  149. typedef struct _LT_PACKET_RESERVED {
  150. // This must be the first entry so we can use CONTAINING_RECORD
  151. // to get back to the packet.
  152. LIST_ENTRY Linkage;
  153. NDIS_HANDLE MacBindingHandle;
  154. } LT_PACKET_RESERVED, *PLT_PACKET_RESERVED;
  155. // This structure is used in the MacReserved field of
  156. // an NDIS_REQUEST_BLOCK, passed in during multicast
  157. // address/packet filter operations.
  158. typedef struct _LT_REQUEST_RESERVED {
  159. LIST_ENTRY RequestList;
  160. PLT_OPEN * OpenBlock;
  161. } LT_REQUEST_RESERVED, *PLT_REQUEST_RESERVED;
  162. #ifdef LTSFT_LOCALS
  163. #endif // LTSFT_LOCALS
  164. #endif // _LTSFT_