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.

264 lines
11 KiB

  1. /*
  2. (C) Copyright 1998
  3. All rights reserved.
  4. Portions of this software are:
  5. (C) Copyright 1995, 1999 TriplePoint, Inc. -- http://www.TriplePoint.com
  6. License to use this software is granted under the terms outlined in
  7. the TriplePoint Software Services Agreement.
  8. (C) Copyright 1992 Microsoft Corp. -- http://www.Microsoft.com
  9. License to use this software is granted under the terms outlined in
  10. the Microsoft Windows Device Driver Development Kit.
  11. @doc INTERNAL Adapter Adapter_h
  12. @module Adapter.h |
  13. This module defines the interface to the <t MINIPORT_ADAPTER_OBJECT>.
  14. @head3 Contents |
  15. @index class,mfunc,func,msg,mdata,struct,enum | Adapter_h
  16. @end
  17. */
  18. #ifndef _ADAPTER_H
  19. #define _ADAPTER_H
  20. #define MINIPORT_ADAPTER_OBJECT_TYPE ((ULONG)'A')+\
  21. ((ULONG)'D'<<8)+\
  22. ((ULONG)'A'<<16)+\
  23. ((ULONG)'P'<<24)
  24. /* @doc INTERNAL Adapter Adapter_h MINIPORT_ADAPTER_OBJECT
  25. @struct MINIPORT_ADAPTER_OBJECT |
  26. This structure contains the data associated with a single Miniport
  27. adapter instance. Here, Adapter is defined as the manager of specific
  28. Network Interface Card (NIC) installed under the NDIS wrapper. This
  29. adapter is responsible for managing all interactions between the NIC and
  30. the host operating system using the NDIS library.
  31. @comm
  32. This structure must contain a reference to all other objects being managed
  33. by this adapter object. The adapter object is the only reference passed
  34. between NDIS and the Miniport. This is the <t MiniportAdapterContext> we
  35. pass into <f NdisMSetAttributes> from <f MiniportInitialize>. This value
  36. is passed as a parameter to the Miniport entry points called by the NDIS
  37. wrapper.
  38. One of these objects is created each time that our <f MiniportInitialize>
  39. routine is called. The NDIS wrapper calls this routine once for each of
  40. our devices installed and enabled in the system. In the case of a hot
  41. swappable NIC (e.g. PCMCIA) the adapter might come and go several times
  42. during a single Windows session.
  43. */
  44. typedef struct MINIPORT_ADAPTER_OBJECT
  45. {
  46. #if DBG
  47. ULONG DbgFlags; // @field
  48. // Debug flags control how much debug is displayed in the checked version.
  49. // Put it at the front so we can set it easily with debugger.
  50. UCHAR DbgID[12]; // @field
  51. // This field is initialized to an ASCII decimal string containing the
  52. // adapter instance number 1..N. It is only used to output debug messages.
  53. #endif // DBG
  54. ULONG ObjectType; // @field
  55. // Four characters used to identify this type of object 'ADAP'.
  56. ULONG ObjectID; // @field
  57. // Instance number used to identify a specific object instance.
  58. NDIS_HANDLE MiniportAdapterHandle; // @field
  59. // Specifies a handle identifying the miniport's NIC, which is assigned
  60. // by the NDIS library. MiniportInitialize should save this handle; it
  61. // is a required parameter in subsequent calls to NdisXxx functions.
  62. NDIS_HANDLE WrapperConfigurationContext;// @field
  63. // Specifies a handle used only during initialization for calls to
  64. // NdisXxx configuration and initialization functions. For example,
  65. // this handle is a required parameter to NdisOpenConfiguration and
  66. // the NdisImmediateReadXxx and NdisImmediateWriteXxx functions.
  67. PCARD_OBJECT pCard; // @field
  68. // Pointer to the hardware specific <t CARD_OBJECT>. Created by
  69. // <f CardCreate>.
  70. PDCHANNEL_OBJECT pDChannel; // @field
  71. // Pointer to the <t DCHANNEL_OBJECT> created by <f DChannelCreate>.
  72. // One for the entire NIC.
  73. ULONG NumBChannels; // @field
  74. // The number of <t BCHANNEL_OBJECT>'s supported by the NIC.
  75. PBCHANNEL_OBJECT * pBChannelArray; // @field
  76. // An array of <t BCHANNEL_OBJECT>'s created by <f BChannelCreate>.
  77. // One entry for each logical BChannel on NIC.
  78. #if !defined(NDIS50_MINIPORT)
  79. ULONG BusNumber; // @field
  80. // Identifies which system bus this adapter is plugged in to.
  81. ULONG BusType; // @field
  82. // Identifies the bus type this adapter is plugged in to.
  83. #endif // NDIS50_MINIPORT
  84. ULONG RunningWin95; // @field
  85. // Set TRUE only if running on Windows 95 or Windows98.
  86. ULONG NumLineOpens; // @field
  87. // The number of line open calls currently on this adapter.
  88. NDIS_SPIN_LOCK TransmitLock; // @field
  89. // This spin lock is used to provide mutual exclusion around accesses
  90. // to the transmit queue manipulation routines. This is necessary since
  91. // we can be called at any time by the B-channel services driver and
  92. // we could already be processing an NDIS request.
  93. LIST_ENTRY TransmitPendingList; // @field
  94. // Packets waiting to be sent when the controller is available.
  95. // See <t NDIS_WAN_PACKET>.
  96. LIST_ENTRY TransmitCompleteList; // @field
  97. // Packets waiting for completion processing. After the packet is
  98. // transmitted, the protocol stack is given an indication.
  99. // See <t NDIS_WAN_PACKET>.
  100. NDIS_SPIN_LOCK ReceiveLock; // @field
  101. // This spin lock is used to provide mutual exclusion around accesses
  102. // to the receive queue manipulation routines. This is necessary since
  103. // we can be called at any time by the B-channel services driver and
  104. // we could already be processing an NDIS request.
  105. LIST_ENTRY ReceiveCompleteList; // @field
  106. // Buffers waiting to be processed by the
  107. NDIS_SPIN_LOCK EventLock; // @field
  108. // This spin lock is used to provide mutual exclusion around accesses
  109. // to the event queue manipulation routines. This is necessary since
  110. // we can be called at any time by the B-channel services driver and
  111. // we could already be processing an NDIS request.
  112. LIST_ENTRY EventList; // @field
  113. // driver callback events waiting to be processed.
  114. // See <t BCHANNEL_EVENT_OBJECT>.
  115. NDIS_MINIPORT_TIMER EventTimer; // @field
  116. // This timer is used to schedule the event processing routine to run
  117. // when the system reaches a quiescent state.
  118. ULONG NextEvent; // @field
  119. // Where do we store the next event.
  120. long NestedEventHandler; // @field
  121. // Keeps track of entry to and exit from the event handler.
  122. long NestedDataHandler; // @field
  123. // Keeps track of entry to and exit from the Tx/Rx handlers.
  124. ULONG DeviceIdBase; // @field
  125. // The ulDeviceIDBase field passed in the PROVIDER_INIT request
  126. // informs a miniport of the zero-based starting index that the
  127. // Connection Wrapper will use when referring to a single adapter�s
  128. // line devices by index. For example, if a ulDeviceIDBase of two is
  129. // specified and the adapter supports three line devices, then the
  130. // Connection Wrapper will use the identifiers two, three, and four
  131. // to refer to the adapter�s three devices.
  132. NDIS_WAN_INFO WanInfo; // @field
  133. // A copy of our <t NDIS_WAN_INFO> structure is setup at init time
  134. // and doesn't change.
  135. CHAR ProviderInfo[48]; // @field
  136. // This holds the TAPI ProviderInfo string returned from TspiGetDevCaps
  137. // This is two null terminated strings packed end to end.
  138. // This size is the max allowed by RAS.
  139. ULONG ProviderInfoSize; // @field
  140. // Size in bytes of both strings.
  141. ULONG NoAnswerTimeOut; // @field
  142. // How many ms to wait for ALERTING
  143. ULONG NoAcceptTimeOut; // @field
  144. // How many ms to wait for ACCEPT
  145. ANSI_STRING MediaType; // @field
  146. // The MediaType configuration parameter is read from the registry
  147. // at init time.
  148. ANSI_STRING DeviceName; // @field
  149. // The DeviceName configuration parameter is read from the registry
  150. // at init time.
  151. ANSI_STRING TapiAddressList; // @field
  152. // The TAPI AddressList configuration parameter is read from the
  153. // registry at init time.
  154. LINE_CALL_PARAMS DefaultLineCallParams; // @field
  155. // The default call parameters used by TspiMakeCall
  156. BOOLEAN NeedStatusCompleteIndication; // @field
  157. // This flag indicates whether or not <f NdisMIndicateStatusComplete>
  158. // needs to be called after the completion of requests or event processing.
  159. // This is set TRUE if <f NdisMIndicateStatus> is called while
  160. // processing a request or event.
  161. ULONG TotalRxBytes; // @field
  162. // Total bytes read by driver during this session.
  163. ULONG TotalTxBytes; // @field
  164. // Total bytes written by driver during this session.
  165. ULONG TotalRxPackets; // @field
  166. // Total packets read by driver during this session.
  167. ULONG TotalTxPackets; // @field
  168. // Total packets written by driver during this session.
  169. ULONG TODO; // @field
  170. // Add your data members here.
  171. } MINIPORT_ADAPTER_OBJECT;
  172. extern PMINIPORT_ADAPTER_OBJECT g_Adapters[MAX_ADAPTERS];
  173. /*
  174. Function prototypes.
  175. */
  176. NDIS_STATUS AdapterCreate(
  177. OUT PMINIPORT_ADAPTER_OBJECT *ppAdapter,
  178. IN NDIS_HANDLE MiniportAdapterHandle,
  179. IN NDIS_HANDLE WrapperConfigurationContext
  180. );
  181. void AdapterDestroy(
  182. IN PMINIPORT_ADAPTER_OBJECT pAdapter
  183. );
  184. NDIS_STATUS AdapterInitialize(
  185. IN PMINIPORT_ADAPTER_OBJECT pAdapter
  186. );
  187. #endif // _ADAPTER_H