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.

293 lines
11 KiB

  1. /*
  2. (C) Copyright 1999
  3. All rights reserved.
  4. Portions of this software are:
  5. (C) Copyright 1995 TriplePoint, Inc. -- http://www.TriplePoint.com
  6. License to use this software is granted under the same terms
  7. outlined in the Microsoft Windows Device Driver Development Kit.
  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 BChannel BChannel_h
  12. @module BChannel.h |
  13. This module defines the interface to the <t BCHANNEL_OBJECT>.
  14. @head3 Contents |
  15. @index class,mfunc,func,msg,mdata,struct,enum | BChannel_h
  16. @end
  17. */
  18. /* @doc EXTERNAL INTERNAL
  19. @topic 4.4 BChannel Overview |
  20. This section describes the interfaces defined in <f BChannel\.h>.
  21. This module isolates most the channel specific interfaces. It will require
  22. some changes to accomodate your hardware device's channel access methods.
  23. There should be one <t BCHANNEL_OBJECT> for each logical channel your card
  24. supports. For instance, if your PRI card has two ports with 24 channels
  25. each, you would publish up 48 BChannels to NDIS.
  26. The driver uses the <t BCHANNEL_OBJECT> as a synonym for CO-NDIS VC. The
  27. VC handle we pass up to NDIS, is actually a pointer to a <t BCHANNEL_OBJECT>.
  28. The driver is written to assume a homogenous BChannel configuration. If
  29. your card supports multiple ISDN ports that are provisioned differrently,
  30. you will have to make some serious changes throughout the driver.
  31. */
  32. #ifndef _BCHANNEL_H
  33. #define _BCHANNEL_H
  34. #define BCHANNEL_OBJECT_TYPE ((ULONG)'B')+\
  35. ((ULONG)'C'<<8)+\
  36. ((ULONG)'H'<<16)+\
  37. ((ULONG)'N'<<24)
  38. /* @doc INTERNAL BChannel BChannel_h BCHANNEL_OBJECT
  39. @struct BCHANNEL_OBJECT |
  40. This structure contains the data associated with an ISDN BChannel.
  41. Here, BChannel is defined as any channel or collection of channels
  42. capable of carrying "user" data over and existing connection. This
  43. channel is responsible for making sure the data payload is sent to or
  44. received from the remote end-point exactly as it is appeared at the
  45. originating station.
  46. @comm
  47. This logical BChannel does not necessarily map to a physical BChannel
  48. on the NIC. The NIC may in fact be bonding multiple BChannels into this
  49. logical BChannel. The NIC may in fact not have BChannels at all, as
  50. may be the case with channelized T-1. The BChannel is just a convenient
  51. abstraction for a point-to-point, bi-directional communication link.
  52. There will be one BChannel created for each communication channel on the
  53. NIC. The number of channels depends on how many ports the NIC has, and
  54. how they are provisioned and configured. The number of BChannels can be
  55. configured at install time or changed using the control panel. The driver
  56. does not allow the configuration to change at run-time, so the computer
  57. or the adapter must be restarted to enable the configuration changes.
  58. */
  59. typedef struct BCHANNEL_OBJECT
  60. {
  61. LIST_ENTRY LinkList;
  62. // Used to maintain the linked list of available BChannels for each
  63. // adapter.
  64. ULONG ObjectType; // @field
  65. // Four characters used to identify this type of object 'BCHN'.
  66. ULONG ObjectID; // @field
  67. // Instance number used to identify a specific object instance.
  68. PMINIPORT_ADAPTER_OBJECT pAdapter; // @field
  69. // A pointer to the <t MINIPORT_ADAPTER_OBJECT> instance.
  70. BOOLEAN IsOpen; // @field
  71. // Set TRUE if this BChannel is open, otherwise set FALSE.
  72. //���������������������������������������������������������������������������
  73. // NDIS data members
  74. ULONG BChannelIndex; // @field
  75. // This is a zero based index associated with this BChannel.
  76. NDIS_HANDLE NdisVcHandle; // @field
  77. // This is the WAN Wrapper's VC context which is associated with this
  78. // link in response to the Miniport calling <f NdisMIndicateStatus>
  79. // to indicate a <t NDIS_MAC_LINE_UP> condition. This value is passed
  80. // back to the WAN Wrapper to indicate activity associated with this link,
  81. // such as <f NdisMWanIndicateReceive> and <f NdisMIndicateStatus>.
  82. // See <F MiniportCoActivateVc>.
  83. NDIS_HANDLE NdisSapHandle; // @field
  84. // Used to store the NDIS SAP handle passed into
  85. // <f ProtocolCmRegisterSap>.
  86. LONG SapRefCount;
  87. CO_AF_TAPI_SAP NdisTapiSap; // @field
  88. // A copy of the SAP registered by NDIS TAPI Proxy.
  89. ULONG LinkSpeed; // @field
  90. // The speed provided by the link in bits per second. This value is
  91. // passed up by the Miniport during the LINE_UP indication.
  92. LIST_ENTRY ReceivePendingList; // @field
  93. // Buffers currently submitted to the controller waiting for receive.
  94. LIST_ENTRY TransmitBusyList; // @field
  95. // Packets currently submitted to the controller waiting for completion.
  96. // See <t NDIS_PACKET>.
  97. BOOLEAN NeedReceiveCompleteIndication; // @field
  98. // This flag indicates whether or not <f NdisMWanIndicateReceiveComplete>
  99. // needs to be called after the completion of the event processing loop.
  100. // This is set TRUE if <f NdisMWanReceiveComplete> is called while
  101. // processing the event queues.
  102. NDIS_WAN_CO_SET_LINK_INFO WanLinkInfo; // @field
  103. // The current settings associated with this link as passed in via
  104. // the OID_WAN_SET_LINK_INFO request.
  105. ULONG TotalRxPackets; // @field
  106. // Total packets read by driver during this session.
  107. //���������������������������������������������������������������������������
  108. // TAPI data members.
  109. BOOLEAN CallClosing; // @field
  110. // Set TRUE if call is being closed.
  111. ULONG CallState; // @field
  112. // The current TAPI LINECALLSTATE of the associated with the link.
  113. ULONG CallStatesCaps; // @field
  114. // Events currently supported
  115. ULONG AddressStatesCaps; // @field
  116. // Events currently supported
  117. ULONG DevStatesCaps; // @field
  118. // Events currently supported
  119. ULONG MediaMode; // @field
  120. // The current TAPI media mode(s) supported by the card.
  121. ULONG MediaModesCaps; // @field
  122. // Events currently supported
  123. ULONG BearerMode; // @field
  124. // The current TAPI bearer mode in use.
  125. ULONG BearerModesCaps; // @field
  126. // TAPI bearer mode(s) supported by the card.
  127. ULONG CallParmsSize; // @field
  128. // Size of <p pInCallParms> memory area in bytes.
  129. PCO_CALL_PARAMETERS pInCallParms; // @field
  130. // Incoming call parameters. Allocated as needed.
  131. PCO_CALL_PARAMETERS pOutCallParms; // @field
  132. // Pointer to the client's call parameters passed into
  133. // <f ProtocolCmMakeCall>.
  134. ULONG Flags; // @field
  135. // Bit flags used to keep track of VC state.
  136. # define VCF_INCOMING_CALL 0x00000001
  137. # define VCF_OUTGOING_CALL 0x00000002
  138. # define VCF_VC_ACTIVE 0x00000004
  139. //���������������������������������������������������������������������������
  140. // CARD data members.
  141. ULONG TODO; // @field
  142. // Add your data members here.
  143. #if defined(SAMPLE_DRIVER)
  144. PBCHANNEL_OBJECT pPeerBChannel; // @field
  145. // Peer BChannel of caller or callee depending on who orginated the
  146. // call.
  147. #endif // SAMPLE_DRIVER
  148. } BCHANNEL_OBJECT;
  149. #define GET_ADAPTER_FROM_BCHANNEL(pBChannel) (pBChannel->pAdapter)
  150. /* @doc INTERNAL BChannel BChannel_h IS_VALID_BCHANNEL
  151. @func ULONG | IS_VALID_BCHANNEL |
  152. Use this macro to determine if a <t BCHANNEL_OBJECT> is really valid.
  153. @parm <t MINIPORT_ADAPTER_OBJECT> | pAdapter |
  154. A pointer to the <t MINIPORT_ADAPTER_OBJECT> instance.
  155. @parm <t PBCHANNEL_OBJECT> | pBChannel |
  156. A pointer to the <t BCHANNEL_OBJECT> returned by <f BChannelCreate>.
  157. @rdesc Returns TRUE if the BChannel is valid, otherwise FALSE is returned.
  158. */
  159. #define IS_VALID_BCHANNEL(pAdapter, pBChannel) \
  160. (pBChannel && pBChannel->ObjectType == BCHANNEL_OBJECT_TYPE)
  161. /* @doc INTERNAL BChannel BChannel_h GET_BCHANNEL_FROM_INDEX
  162. @func <t PBCHANNEL_OBJECT> | GET_BCHANNEL_FROM_INDEX |
  163. Use this macro to get a pointer to the <t BCHANNEL_OBJECT> associated
  164. with a zero-based Index.
  165. @parm <t MINIPORT_ADAPTER_OBJECT> | pAdapter |
  166. A pointer to the <t MINIPORT_ADAPTER_OBJECT> instance.
  167. @parm ULONG | BChannelIndex |
  168. Miniport BChannelIndex associated with a specific link.
  169. @rdesc Returns a pointer to the associated <t BCHANNEL_OBJECT>.
  170. */
  171. #define GET_BCHANNEL_FROM_INDEX(pAdapter, BChannelIndex) \
  172. (pAdapter->pBChannelArray[BChannelIndex]); \
  173. ASSERT(BChannelIndex < pAdapter->NumBChannels)
  174. /*
  175. Function prototypes.
  176. */
  177. NDIS_STATUS BChannelCreate(
  178. OUT PBCHANNEL_OBJECT * pBChannel,
  179. IN ULONG BChannelIndex,
  180. IN PMINIPORT_ADAPTER_OBJECT pAdapter
  181. );
  182. void BChannelDestroy(
  183. IN PBCHANNEL_OBJECT pBChannel
  184. );
  185. void BChannelInitialize(
  186. IN PBCHANNEL_OBJECT pBChannel
  187. );
  188. NDIS_STATUS BChannelOpen(
  189. IN PBCHANNEL_OBJECT pBChannel,
  190. IN NDIS_HANDLE NdisVcHandle
  191. );
  192. void BChannelClose(
  193. IN PBCHANNEL_OBJECT pBChannel
  194. );
  195. #endif // _BCHANNEL_H