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.

393 lines
14 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 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. #ifndef _BCHANNEL_H
  19. #define _BCHANNEL_H
  20. #define BCHANNEL_OBJECT_TYPE ((ULONG)'B')+\
  21. ((ULONG)'C'<<8)+\
  22. ((ULONG)'H'<<16)+\
  23. ((ULONG)'N'<<24)
  24. /* @doc INTERNAL BChannel BChannel_h BCHANNEL_OBJECT
  25. @struct BCHANNEL_OBJECT |
  26. This structure contains the data associated with an ISDN BChannel.
  27. Here, BChannel is defined as any channel or collection of channels
  28. capable of carrying "user" data over and existing connection. This
  29. channel is responsible for making sure the data payload is sent to or
  30. received from the remote end-point exactly as it is appeared at the
  31. originating station.
  32. @comm
  33. This logical BChannel does not necessarily map to a physical BChannel
  34. on the NIC. The NIC may in fact be bonding multiple BChannels into this
  35. logical BChannel. The NIC may in fact not have BChannels at all, as
  36. may be the case with channelized T-1. The BChannel is just a convenient
  37. abstraction for a point-to-point, bi-directional communication link.
  38. There will be one BChannel created for each communication channel on the
  39. NIC. The number of channels depends on how many ports the NIC has, and
  40. how they are provisioned and configured. The number of BChannels can be
  41. configured at install time or changed using the control panel. The driver
  42. does not allow the configuration to change at run-time, so the computer
  43. or the adapter must be restarted to enable the configuration changes.
  44. */
  45. typedef struct BCHANNEL_OBJECT
  46. {
  47. struct BCHANNEL_OBJECT * next; /* Linked list pointer */
  48. ULONG ObjectType; // @field
  49. // Four characters used to identify this type of object 'BCHN'.
  50. ULONG ObjectID; // @field
  51. // Instance number used to identify a specific object instance.
  52. PMINIPORT_ADAPTER_OBJECT pAdapter; // @field
  53. // A pointer to the <t MINIPORT_ADAPTER_OBJECT> instance.
  54. BOOLEAN IsOpen; // @field
  55. // Set TRUE if this BChannel is open, otherwise set FALSE.
  56. //���������������������������������������������������������������������������
  57. // NDIS data members
  58. ULONG BChannelIndex; // @field
  59. // This is a zero based index associated with this BChannel. It is used
  60. // to associate a TAPI <p DeviceID> with this link based on the value
  61. // TAPI provides for <p DeviceIdBase> (i.e. <p DeviceID> = <p DeviceIdBase>
  62. // + BChannelIndex). See <f GET_DEVICEID_FROM_BCHANNEL>.
  63. NDIS_HANDLE NdisLinkContext; // @field
  64. // This is the WAN Wrapper's link context which is associated with this
  65. // link in response to the Miniport calling <f NdisMIndicateStatus>
  66. // to indicate a <t NDIS_MAC_LINE_UP> condition. This value is passed
  67. // back to the WAN Wrapper to indicate activity associated with this link,
  68. // such as <f NdisMWanIndicateReceive> and <f NdisMIndicateStatus>.
  69. // See <F LinkLineUp>.
  70. ULONG LinkSpeed; // @field
  71. // The speed provided by the link in bits per second. This value is
  72. // passed up by the Miniport during the LINE_UP indication.
  73. LIST_ENTRY ReceivePendingList; // @field
  74. // Buffers currently submitted to the controller waiting for receive.
  75. LIST_ENTRY TransmitBusyList; // @field
  76. // Packets currently submitted to the controller waiting for completion.
  77. // See <t NDIS_WAN_PACKET>.
  78. BOOLEAN NeedReceiveCompleteIndication; // @field
  79. // This flag indicates whether or not <f NdisMWanIndicateReceiveComplete>
  80. // needs to be called after the completion of the event processing loop.
  81. // This is set TRUE if <f NdisMWanReceiveComplete> is called while
  82. // processing the event queues.
  83. NDIS_WAN_SET_LINK_INFO WanLinkInfo; // @field
  84. // The current settings associated with this link as passed in via
  85. // the OID_WAN_SET_LINK_INFO request.
  86. ULONG TotalRxPackets; // @field
  87. // Total packets read by driver during this session.
  88. //���������������������������������������������������������������������������
  89. // TAPI data members.
  90. HTAPI_LINE htLine; // @field
  91. // This is the Connection Wrapper's line context associated with this
  92. // link when <f TspiOpen> is called. This handle is used when calling
  93. // <f NdisMIndicateStatus> with <t NDIS_STATUS_TAPI_INDICATION>.
  94. HTAPI_CALL htCall; // @field
  95. // This is the Connection Wrapper's call context associated with this
  96. // link during <f TspiMakeCall> or a call to <f NdisMIndicateStatus>
  97. // with a <t LINE_NEWCALL> event. This handle is used as the
  98. // <f ConnectionWrapperID> in the <t NDIS_MAC_LINE_UP> structure used
  99. // by <f LinkLineUp>.
  100. BOOLEAN CallClosing; // @field
  101. // Set TRUE if call is being closed.
  102. ULONG CallState; // @field
  103. // The current TAPI LINECALLSTATE of the associated with the link.
  104. ULONG CallStateMode; // @field
  105. // Remember what mode the call was set to.
  106. ULONG CallStatesCaps; // @field
  107. // Events currently supported
  108. ULONG CallStatesMask; // @field
  109. // Events currently enabled
  110. ULONG AddressState; // @field
  111. // The current TAPI LINEADDRESSSTATE of the associated with the link.
  112. ULONG AddressStatesCaps; // @field
  113. // Events currently supported
  114. ULONG AddressStatesMask; // @field
  115. // Events currently enabled
  116. ULONG DevState; // @field
  117. // The current TAPI LINEDEVSTATE of the associated with the link.
  118. ULONG DevStatesCaps; // @field
  119. // Events currently supported
  120. ULONG DevStatesMask; // @field
  121. // Events currently enabled
  122. ULONG MediaMode; // @field
  123. // The current TAPI media mode(s) supported by the card.
  124. ULONG MediaModesCaps; // @field
  125. // Events currently supported
  126. ULONG BearerMode; // @field
  127. // The current TAPI bearer mode in use.
  128. ULONG BearerModesCaps; // @field
  129. // TAPI bearer mode(s) supported by the card.
  130. ULONG MediaModesMask; // @field
  131. // Events currently enabled
  132. ULONG AppSpecificCallInfo; // @field
  133. // This value is set by OID_TAPI_SET_APP_SPECIFIC and queried by
  134. // OID_TAPI_GET_CALL_INFO.
  135. CHAR pTapiLineAddress[0x14]; // @field
  136. // TAPI line address is assigned during installation and saved in the
  137. // registry. It is read from the registry and saved here at init time.
  138. NDIS_MINIPORT_TIMER CallTimer; // @field
  139. // This timer is used to keep track of the call state when a call is
  140. // coming in or going out.
  141. //���������������������������������������������������������������������������
  142. // CARD data members.
  143. ULONG TODO; // @field
  144. // Add your data members here.
  145. #if defined(SAMPLE_DRIVER)
  146. PBCHANNEL_OBJECT pPeerBChannel; // @field
  147. // Peer BChannel of caller or callee depending on who orginated the
  148. // call.
  149. #endif // SAMPLE_DRIVER
  150. } BCHANNEL_OBJECT;
  151. #define GET_ADAPTER_FROM_BCHANNEL(pBChannel) (pBChannel->pAdapter)
  152. #define GET_NDIS_LINK_FROM_BCHANNEL(pBChannel) (pBChannel)
  153. #define GET_TAPI_LINE_FROM_BCHANNEL(pBChannel) (pBChannel)
  154. /* @doc INTERNAL BChannel BChannel_h IS_VALID_BCHANNEL
  155. @func ULONG | IS_VALID_BCHANNEL |
  156. Use this macro to determine if a <t BCHANNEL_OBJECT> is really valid.
  157. @parm <t MINIPORT_ADAPTER_OBJECT> | pAdapter |
  158. A pointer to the <t MINIPORT_ADAPTER_OBJECT> instance.
  159. @parm <t PBCHANNEL_OBJECT> | pBChannel |
  160. A pointer to the <t BCHANNEL_OBJECT> returned by <f BChannelCreate>.
  161. @rdesc Returns TRUE if the BChannel is valid, otherwise FALSE is returned.
  162. */
  163. #define IS_VALID_BCHANNEL(pAdapter, pBChannel) \
  164. (pBChannel && pBChannel->ObjectType == BCHANNEL_OBJECT_TYPE)
  165. /* @doc INTERNAL BChannel BChannel_h GET_BCHANNEL_FROM_INDEX
  166. @func <t PBCHANNEL_OBJECT> | GET_BCHANNEL_FROM_INDEX |
  167. Use this macro to get a pointer to the <t BCHANNEL_OBJECT> associated
  168. with a zero-based Index.
  169. @parm <t MINIPORT_ADAPTER_OBJECT> | pAdapter |
  170. A pointer to the <t MINIPORT_ADAPTER_OBJECT> instance.
  171. @parm ULONG | BChannelIndex |
  172. Miniport BChannelIndex associated with a specific link.
  173. @rdesc Returns a pointer to the associated <t BCHANNEL_OBJECT>.
  174. */
  175. #define GET_BCHANNEL_FROM_INDEX(pAdapter, BChannelIndex) \
  176. (pAdapter->pBChannelArray[BChannelIndex]); \
  177. ASSERT(BChannelIndex < pAdapter->NumBChannels)
  178. /* @doc INTERNAL BChannel BChannel_h GET_BCHANNEL_FROM_DEVICEID
  179. @func <t PBCHANNEL_OBJECT> | GET_BCHANNEL_FROM_DEVICEID |
  180. Use this macro to get a pointer to the <t BCHANNEL_OBJECT> associated
  181. with a specific TAPI DeviceID.
  182. @parm <t MINIPORT_ADAPTER_OBJECT> | pAdapter |
  183. A pointer to the <t MINIPORT_ADAPTER_OBJECT> instance.
  184. @parm ULONG | ulDeviceID | TAPI DeviceID associated with a specific link.
  185. @rdesc Returns a pointer to the associated <t BCHANNEL_OBJECT>.
  186. */
  187. #define GET_BCHANNEL_FROM_DEVICEID(pAdapter, ulDeviceID) \
  188. (pAdapter->pBChannelArray[ulDeviceID - pAdapter->DeviceIdBase]); \
  189. ASSERT(ulDeviceID >= pAdapter->DeviceIdBase); \
  190. ASSERT(ulDeviceID < pAdapter->DeviceIdBase+pAdapter->NumBChannels)
  191. /* @doc INTERNAL BChannel BChannel_h GET_DEVICEID_FROM_BCHANNEL
  192. @func ULONG | GET_DEVICEID_FROM_BCHANNEL |
  193. Use this macro to get the TAPI DeviceID associated with a specific
  194. <t BCHANNEL_OBJECT>.
  195. @parm <t MINIPORT_ADAPTER_OBJECT> | pAdapter |
  196. A pointer to the <t MINIPORT_ADAPTER_OBJECT> instance.
  197. @parm <t PBCHANNEL_OBJECT> | pBChannel |
  198. A pointer to the <t BCHANNEL_OBJECT> returned by <f BChannelCreate>.
  199. */
  200. #define GET_DEVICEID_FROM_BCHANNEL(pAdapter, pBChannel) \
  201. (pBChannel->BChannelIndex + pAdapter->DeviceIdBase)
  202. /* @doc INTERNAL BChannel BChannel_h GET_BCHANNEL_FROM_HDLINE
  203. @func <t BCHANNEL_OBJECT> | GET_BCHANNEL_FROM_HDLINE |
  204. Use this macro to get a pointer to the <t BCHANNEL_OBJECT> associated
  205. with the TAPI hdLine handle.
  206. @parm <t MINIPORT_ADAPTER_OBJECT> | pAdapter |
  207. A pointer to the <t MINIPORT_ADAPTER_OBJECT> instance.
  208. @parm <t HTAPI_LINE> | hdLine |
  209. Miniport line handle associated with this <t BCHANNEL_OBJECT>.
  210. @rdesc Returns a pointer to the associated <t PBCHANNEL_OBJECT>.
  211. @devnote This driver associates TAPI lines 1:1 with BChannels so they are
  212. the same thing.
  213. */
  214. #define GET_BCHANNEL_FROM_HDLINE(pAdapter, hdLine) \
  215. (PBCHANNEL_OBJECT) hdLine
  216. /* @doc INTERNAL BChannel BChannel_h GET_BCHANNEL_FROM_HDCALL
  217. @func <t BCHANNEL_OBJECT> | GET_BCHANNEL_FROM_HDCALL |
  218. Use this macro to get a pointer to the <t BCHANNEL_OBJECT> associated
  219. with the TAPI hdCall handle.
  220. @parm <t MINIPORT_ADAPTER_OBJECT> | pAdapter |
  221. A pointer to the <t MINIPORT_ADAPTER_OBJECT> instance.
  222. @parm <t HTAPI_CALL> | hdCall |
  223. Miniport call handle associated with this <t BCHANNEL_OBJECT>.
  224. @rdesc Returns a pointer to the associated <t PBCHANNEL_OBJECT>.
  225. @devnote This driver associates TAPI calls 1:1 with BChannels so they are
  226. the same thing.
  227. */
  228. #define GET_BCHANNEL_FROM_HDCALL(pAdapter, hdCall) \
  229. (PBCHANNEL_OBJECT) hdCall
  230. /*
  231. Function prototypes.
  232. */
  233. NDIS_STATUS BChannelCreate(
  234. OUT PBCHANNEL_OBJECT * pBChannel,
  235. IN ULONG BChannelIndex,
  236. IN PUCHAR pTapiLineAddress,
  237. IN PMINIPORT_ADAPTER_OBJECT pAdapter
  238. );
  239. void BChannelDestroy(
  240. IN PBCHANNEL_OBJECT pBChannel
  241. );
  242. void BChannelInitialize(
  243. IN PBCHANNEL_OBJECT pBChannel
  244. );
  245. NDIS_STATUS BChannelOpen(
  246. IN PBCHANNEL_OBJECT pBChannel,
  247. IN HTAPI_LINE htLine
  248. );
  249. void BChannelClose(
  250. IN PBCHANNEL_OBJECT pBChannel
  251. );
  252. NDIS_STATUS BChannelAddToReceiveQueue(
  253. IN PBCHANNEL_OBJECT pBChannel,
  254. IN PVOID pReceiveContext,
  255. IN PUCHAR BufferPointer,
  256. IN ULONG BufferSize
  257. );
  258. NDIS_STATUS BChannelAddToTransmitQueue(
  259. IN PBCHANNEL_OBJECT pBChannel,
  260. IN PVOID pTransmitContext,
  261. IN PUCHAR BufferPointer,
  262. IN ULONG BufferSize
  263. );
  264. #endif // _BCHANNEL_H