Leaked source code of windows server 2003
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.

211 lines
4.8 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. lbmini.h
  5. Abstract:
  6. NDIS loopback miniport prototypes
  7. Author:
  8. Jameel Hyder
  9. Environment:
  10. Kernel mode, FSD
  11. Revision History:
  12. --*/
  13. #define NDIS_MAJOR_VERSION 0x3
  14. #define NDIS_MINOR_VERSION 0x0
  15. #define LOOP_MAJOR_VERSION 0x5
  16. #define LOOP_MINOR_VERSION 0x0
  17. #define ETH_CARD_ADDRESS "\02\0LOOP"
  18. #define ETH_MAX_MULTICAST_ADDRESS 16
  19. #define TR_CARD_ADDRESS "\100\0LOOP"
  20. #define FDDI_CARD_ADDRESS "\02\0LOOP"
  21. #define FDDI_MAX_MULTICAST_LONG 16
  22. #define FDDI_MAX_MULTICAST_SHORT 16
  23. #define LTALK_CARD_ADDRESS 0xAB
  24. #define ARC_CARD_ADDRESS 'L'
  25. //
  26. // arbitrary maximums...
  27. //
  28. #define MAX_LOOKAHEAD 256
  29. #define INDICATE_MAXIMUM 256
  30. #define OID_TYPE_MASK 0xFFFF0000
  31. #define OID_TYPE 0xFF000000
  32. #define OID_TYPE_GENERAL 0x00000000
  33. #define OID_TYPE_GENERAL_OPERATIONAL 0x00010000
  34. #define OID_TYPE_GENERAL_STATISTICS 0x00020000
  35. #define OID_TYPE_802_3 0x01000000
  36. #define OID_TYPE_802_3_OPERATIONAL 0x01010000
  37. #define OID_TYPE_802_3_STATISTICS 0x01020000
  38. #define OID_TYPE_802_5 0x02000000
  39. #define OID_TYPE_802_5_OPERATIONAL 0x02010000
  40. #define OID_TYPE_802_5_STATISTICS 0x02020000
  41. #define OID_TYPE_FDDI 0x03000000
  42. #define OID_TYPE_FDDI_OPERATIONAL 0x03010000
  43. #define OID_TYPE_LTALK 0x05000000
  44. #define OID_TYPE_LTALK_OPERATIONAL 0x05010000
  45. #define OID_TYPE_ARCNET 0x06000000
  46. #define OID_TYPE_ARCNET_OPERATIONAL 0x06010000
  47. #define OID_REQUIRED_MASK 0x0000FF00
  48. #define OID_REQUIRED_MANDATORY 0x00000100
  49. #define OID_REQUIRED_OPTIONAL 0x00000200
  50. #define OID_INDEX_MASK 0x000000FF
  51. #define GM_TRANSMIT_GOOD 0x00
  52. #define GM_RECEIVE_GOOD 0x01
  53. #define GM_TRANSMIT_BAD 0x02
  54. #define GM_RECEIVE_BAD 0x03
  55. #define GM_RECEIVE_NO_BUFFER 0x04
  56. #define GM_ARRAY_SIZE 0x05
  57. #define PACKET_FILTER_802_3 0xF07F
  58. #define PACKET_FILTER_802_5 0xF07F
  59. #define PACKET_FILTER_DIX 0xF07F
  60. #define PACKET_FILTER_FDDI 0xF07F
  61. #define PACKET_FILTER_LTALK 0x8009
  62. #define PACKET_FILTER_ARCNET 0x8009
  63. #define LT_IS_BROADCAST(Address) (BOOLEAN)(Address == 0xFF)
  64. #define ARC_IS_BROADCAST(Address) (BOOLEAN)(!(Address))
  65. typedef struct _MEDIA_INFO
  66. {
  67. ULONG MaxFrameLen;
  68. UINT MacHeaderLen;
  69. ULONG PacketFilters;
  70. ULONG LinkSpeed;
  71. } MEDIA_INFO, *PMEDIA_INFO;
  72. typedef struct _ADAPTER
  73. {
  74. NDIS_MEDIUM Medium;
  75. //
  76. // NDIS Context for this interface
  77. NDIS_HANDLE MiniportHandle;
  78. UINT MaxLookAhead;
  79. UINT AddressLength;
  80. ULONG PacketFilter;
  81. //
  82. // Constants for the adapter
  83. //
  84. ULONG MediumLinkSpeed;
  85. ULONG MediumMinPacketLen;
  86. ULONG MediumMaxPacketLen;
  87. UINT MediumMacHeaderLen;
  88. ULONG MediumMaxFrameLen;
  89. ULONG MediumPacketFilters;
  90. //
  91. // media specific info
  92. //
  93. UCHAR PermanentAddress[ETH_LENGTH_OF_ADDRESS];
  94. UCHAR CurrentAddress[ETH_LENGTH_OF_ADDRESS];
  95. // statistics
  96. ULONG GeneralMandatory[GM_ARRAY_SIZE];
  97. UCHAR LoopBuffer[MAX_LOOKAHEAD];
  98. ULONG SendPackets;
  99. } ADAPTER, *PADAPTER;
  100. //
  101. // This macro returns a pointer to the LOOP reserved portion of the packet
  102. //
  103. #define PRESERVED_FROM_PACKET(Packet) ((PPACKET_RESERVED)((PVOID)((Packet)->MacReserved)))
  104. #define PPACKET_FROM_RESERVED(Reserved) ((PNDIS_PACKET)((PVOID)((Reserved)->Packet)))
  105. typedef struct _PACKET_RESERVED
  106. {
  107. PNDIS_PACKET Next;
  108. USHORT PacketLength;
  109. UCHAR HeaderLength;
  110. } PACKET_RESERVED, *PPACKET_RESERVED;
  111. //
  112. // Miniport proto-types
  113. //
  114. NDIS_STATUS
  115. LBInitialize(
  116. OUT PNDIS_STATUS OpenErrorStatus,
  117. OUT PUINT SelectedMediumIndex,
  118. IN PNDIS_MEDIUM MediumArray,
  119. IN UINT MediumArraySize,
  120. IN NDIS_HANDLE MiniportAdapterHandle,
  121. IN NDIS_HANDLE ConfigurationContext
  122. );
  123. NDIS_STATUS
  124. LBSend(
  125. IN NDIS_HANDLE MiniportAdapterContext,
  126. IN PNDIS_PACKET Packet,
  127. IN UINT Flags
  128. );
  129. NDIS_STATUS
  130. LBQueryInformation(
  131. IN NDIS_HANDLE MiniportAdapterContext,
  132. IN NDIS_OID Oid,
  133. IN PVOID InformationBuffer,
  134. IN ULONG InformationBufferLength,
  135. OUT PULONG BytesWritten,
  136. OUT PULONG BytesNeeded
  137. );
  138. NDIS_STATUS
  139. LBSetInformation(
  140. IN NDIS_HANDLE MiniportAdapterContext,
  141. IN NDIS_OID Oid,
  142. IN PVOID InformationBuffer,
  143. IN ULONG InformationBufferLength,
  144. OUT PULONG BytesRead,
  145. OUT PULONG BytesNeeded
  146. );
  147. VOID
  148. LBHalt(
  149. IN NDIS_HANDLE MiniportAdapterContext
  150. );
  151. NDIS_STATUS
  152. LBReset(
  153. OUT PBOOLEAN AddressingReset,
  154. IN NDIS_HANDLE MiniportAdapterContext
  155. );
  156. BOOLEAN
  157. LBCheckForHang(
  158. IN NDIS_HANDLE MiniportAdapterContext
  159. );
  160. NDIS_STATUS
  161. LBTransferData(
  162. OUT PNDIS_PACKET Packet,
  163. OUT PUINT BytesTransferred,
  164. IN NDIS_HANDLE MiniportAdapterContext,
  165. IN NDIS_HANDLE MiniportReceiveContext,
  166. IN UINT ByteOffset,
  167. IN UINT BytesToTransfer
  168. );