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.

433 lines
8.2 KiB

  1. //
  2. // Copyright (c) 1998-1999, Microsoft Corporation, all rights reserved
  3. //
  4. // cm.c
  5. //
  6. // IEEE1394 mini-port/call-manager driver
  7. //
  8. // Call Manager routines
  9. //
  10. // 06/20/1999 ADube Created - Declarations for call-manager routines
  11. //
  12. // Debug counts of client oddities that should not be happening.
  13. //
  14. extern ULONG g_ulUnexpectedInCallCompletes;
  15. extern ULONG g_ulCallsNotClosable;
  16. //#define MaxNumSlistEntry 0x100
  17. #define MAX_NUM_ISOCH_DESCRIPTOR 0x20
  18. #define MAX_CHANNEL_BUFFER_SIZE 0x300
  19. #define MAX_CHANNEL_BYTES_PER_FRAME 0x280
  20. //-----------------------------------------------------------------------------
  21. // L O C A L T Y P E S F O R cm.c
  22. //-----------------------------------------------------------------------------
  23. typedef enum _VC_SEND_RECEIVE
  24. {
  25. TransmitVc = 0,
  26. ReceiveVc,
  27. TransmitAndReceiveVc,
  28. InvalidType
  29. } VC_SEND_RECEIVE ;
  30. //-----------------------------------------------------------------------------
  31. // N D I S C A L L - M A N A G E R H A N D L E R S
  32. //-----------------------------------------------------------------------------
  33. NDIS_STATUS
  34. NicCmOpenAf(
  35. IN NDIS_HANDLE CallMgrBindingContext,
  36. IN PCO_ADDRESS_FAMILY AddressFamily,
  37. IN NDIS_HANDLE NdisAfHandle,
  38. OUT PNDIS_HANDLE CallMgrAfContext
  39. );
  40. NDIS_STATUS
  41. NicCmCloseAf(
  42. IN NDIS_HANDLE CallMgrAfContext
  43. );
  44. NDIS_STATUS
  45. NicCmCreateVc(
  46. IN NDIS_HANDLE ProtocolAfContext,
  47. IN NDIS_HANDLE NdisVcHandle,
  48. OUT PNDIS_HANDLE ProtocolVcContext
  49. );
  50. NDIS_STATUS
  51. NicCmDeleteVc(
  52. IN NDIS_HANDLE ProtocolVcContext
  53. );
  54. NDIS_STATUS
  55. NicCmMakeCall(
  56. IN NDIS_HANDLE CallMgrVcContext,
  57. IN OUT PCO_CALL_PARAMETERS CallParameters,
  58. IN NDIS_HANDLE NdisPartyHandle,
  59. OUT PNDIS_HANDLE CallMgrPartyContext
  60. );
  61. NDIS_STATUS
  62. NicCmCloseCall(
  63. IN NDIS_HANDLE CallMgrVcContext,
  64. IN NDIS_HANDLE CallMgrPartyContext,
  65. IN PVOID CloseData,
  66. IN UINT Size
  67. );
  68. NDIS_STATUS
  69. NicCmModifyCallQoS(
  70. IN NDIS_HANDLE CallMgrVcContext,
  71. IN PCO_CALL_PARAMETERS CallParameters
  72. );
  73. NDIS_STATUS
  74. NicCmRequest(
  75. IN NDIS_HANDLE CallMgrAfContext,
  76. IN NDIS_HANDLE CallMgrVcContext,
  77. IN NDIS_HANDLE CallMgrPartyContext,
  78. IN OUT PNDIS_REQUEST NdisRequest
  79. );
  80. NDIS_STATUS
  81. nicRegisterSapHandler(
  82. IN NDIS_HANDLE CallMgrAfContext,
  83. IN PCO_SAP Sap,
  84. IN NDIS_HANDLE NdisSapHandle,
  85. OUT PNDIS_HANDLE CallMgrSapContext
  86. );
  87. NDIS_STATUS
  88. nicDeregisterSapHandler(
  89. IN NDIS_HANDLE CallMgrSapContext
  90. );
  91. NDIS_STATUS
  92. nicCmAddPartyHandler(
  93. IN NDIS_HANDLE CallMgrVcContext,
  94. IN OUT PCO_CALL_PARAMETERS CallParameters,
  95. IN NDIS_HANDLE NdisPartyHandle,
  96. OUT PNDIS_HANDLE CallMgrPartyContext
  97. );
  98. NDIS_STATUS
  99. nicCmDropPartyHandler(
  100. IN NDIS_HANDLE CallMgrPartyContext,
  101. IN PVOID CloseData OPTIONAL,
  102. IN UINT Size OPTIONAL
  103. );
  104. //-----------------------------------------------------------------------------
  105. // Local prototypes (alphabetically)
  106. //-----------------------------------------------------------------------------
  107. VOID
  108. InterceptMakeCallParameters(
  109. PCO_MEDIA_PARAMETERS pMediaParams,
  110. PNIC1394_MEDIA_PARAMETERS pN1394Params
  111. );
  112. NDIS_STATUS
  113. nicAllocateAddressRangeOnActiveRemoteNodes (
  114. IN PADAPTERCB pAdapter
  115. );
  116. VOID
  117. nicCallSetupComplete(
  118. IN VCCB* pVc
  119. );
  120. VOID
  121. nicChannelCallFreeResources (
  122. IN PCHANNEL_VCCB pChannelVc,
  123. IN PADAPTERCB pAdapter,
  124. IN HANDLE hResource,
  125. IN ULONG NumDescriptors,
  126. IN PISOCH_DESCRIPTOR pIsochDesciptor,
  127. IN BOOLEAN fChannelAllocated,
  128. IN ULONG Channel,
  129. IN PNIC_PACKET_POOL pPool
  130. );
  131. VOID
  132. nicChannelCallCleanDataStructure (
  133. IN PCHANNEL_VCCB pChannelVc,
  134. IN HANDLE hResource,
  135. IN ULONG NumDescriptors,
  136. IN PISOCH_DESCRIPTOR pIsochDesciptor,
  137. IN BOOLEAN fChannelAllocated,
  138. IN ULONG Channel,
  139. IN NDIS_HANDLE hPacketPoolHandle,
  140. OUT PULONG pNumRefsDecremented
  141. );
  142. NDIS_STATUS
  143. nicAllocateChannelResourcesAndListen (
  144. IN PADAPTERCB pAdapter,
  145. IN PCHANNEL_VCCB pChannelVc
  146. );
  147. NDIS_STATUS
  148. nicCmGenericMakeCallInit (
  149. IN PVCCB pVc
  150. );
  151. VOID
  152. nicCmGenrericMakeCallFailure (
  153. IN PVCCB pVc
  154. );
  155. VOID
  156. nicCmCloseCallComplete(
  157. NDIS_WORK_ITEM* pCloseCallCompleteWorkItem,
  158. IN PVOID Context
  159. );
  160. NDIS_STATUS
  161. nicCmCloseCallEthernet (
  162. IN PVCCB pVc
  163. );
  164. NDIS_STATUS
  165. nicCmCloseCallMultiChannel (
  166. IN PVCCB pVc
  167. );
  168. NDIS_STATUS
  169. nicCmCloseCallRecvFIFO (
  170. IN PVCCB pVc
  171. );
  172. NDIS_STATUS
  173. nicCmCloseCallSendFIFO (
  174. IN PVCCB pVc
  175. );
  176. NDIS_STATUS
  177. nicCmCloseCallSendRecvChannel (
  178. IN PVCCB pVc
  179. );
  180. NDIS_STATUS
  181. nicCmCloseCallSendChannel(
  182. IN PVCCB pVc
  183. );
  184. VOID
  185. nicCmMakeCallComplete (
  186. NDIS_WORK_ITEM* pMakeCallCompleteWorkItem,
  187. IN PVOID Context
  188. );
  189. VOID
  190. nicCmMakeCallCompleteFailureCleanUp(
  191. IN OUT PVCCB pVc
  192. );
  193. NDIS_STATUS
  194. nicCmMakeCallInitRecvChannelVc(
  195. IN OUT PVCCB pVc
  196. );
  197. NDIS_STATUS
  198. nicCmMakeCallInitSendChannelVc(
  199. IN OUT PVCCB pVc
  200. );
  201. NDIS_STATUS
  202. nicCmMakeCallInitSendRecvChannelVc(
  203. IN OUT PVCCB pVc
  204. );
  205. NDIS_STATUS
  206. nicCmMakeCallInitEthernet(
  207. IN PVCCB pVc
  208. );
  209. NDIS_STATUS
  210. nicCmMakeCallSendChannel (
  211. IN PVCCB pVc
  212. );
  213. NDIS_STATUS
  214. nicCmMakeCallMultiChannel (
  215. IN PVCCB pVc
  216. );
  217. NDIS_STATUS
  218. nicAllocateRequestedChannelMakeCallComplete (
  219. IN PADAPTERCB pAdapter,
  220. IN PCHANNEL_VCCB pChannelVc,
  221. IN OUT PULONG pChannel
  222. );
  223. NDIS_STATUS
  224. nicCmMakeCallInitRecvFIFOVc(
  225. IN OUT PVCCB pVc
  226. );
  227. NDIS_STATUS
  228. nicCmMakeCallInitSendFIFOVc(
  229. IN OUT PVCCB pVc
  230. );
  231. VOID
  232. nicDereferenceAF(
  233. IN AFCB* pAF
  234. );
  235. ULONG
  236. nicGetMaxPayLoadForSpeed(
  237. IN ULONG Speed,
  238. IN ULONG mtu
  239. );
  240. VOID
  241. nicInactiveCallCleanUp(
  242. IN VCCB* pVc
  243. );
  244. NDIS_STATUS
  245. nicInitRecvFifoDataStructures (
  246. IN PRECVFIFO_VCCB pRecvFIFOVc
  247. );
  248. VOID
  249. nicUnInitRecvFifoDataStructures (
  250. IN PRECVFIFO_VCCB pRecvFIFOVc
  251. );
  252. VOID
  253. nicFreeAF(
  254. IN AFCB* pAF
  255. );
  256. VOID
  257. nicReferenceAF(
  258. IN AFCB* pAF
  259. );
  260. NDIS_STATUS
  261. nicCmQueryInformation(
  262. IN NDIS_HANDLE CallMgrAfContext,
  263. IN NDIS_HANDLE CallMgrVcContext,
  264. IN NDIS_HANDLE CallMgrPartyContext,
  265. IN NDIS_OID Oid,
  266. IN PVOID InformationBuffer,
  267. IN ULONG InformationBufferLength,
  268. OUT PULONG BytesWritten,
  269. OUT PULONG BytesNeeded
  270. );
  271. NDIS_STATUS
  272. nicCmSetInformation(
  273. IN NDIS_HANDLE CallMgrAfContext,
  274. IN NDIS_HANDLE CallMgrVcContext,
  275. IN NDIS_HANDLE CallMgrPartyContext,
  276. IN NDIS_OID Oid,
  277. IN PVOID InformationBuffer,
  278. IN ULONG InformationBufferLength,
  279. OUT PULONG BytesRead,
  280. OUT PULONG BytesNeeded
  281. );
  282. NDIS_STATUS
  283. nicGetActiveRemoteNode (
  284. PADAPTERCB pAdpater,
  285. PREMOTE_NODE* ppRemoteNodePdoCb
  286. );
  287. NDIS_STATUS
  288. nicChangeChannelChar (
  289. PVCCB pVc,
  290. PNIC1394_CHANNEL_CHARACTERISTICS pMcChar
  291. );
  292. NDIS_STATUS
  293. nicCmGenericMakeCallInitChannels (
  294. IN PCHANNEL_VCCB pChannelVc,
  295. VC_SEND_RECEIVE VcType
  296. );
  297. NDIS_STATUS
  298. nicCmGenericMakeCallInitFifo (
  299. IN PVCCB pVc,
  300. VC_SEND_RECEIVE VcType
  301. );
  302. NDIS_STATUS
  303. nicCmGenericMakeCallMutilChannel (
  304. IN PVCCB pVc,
  305. VC_SEND_RECEIVE VcType
  306. );
  307. NDIS_STATUS
  308. nicCmGenericMakeCallEthernet(
  309. IN PVCCB pVc,
  310. IN VC_SEND_RECEIVE VcType
  311. );
  312. VOID
  313. nicInterceptMakeCallParameters (
  314. PCO_MEDIA_PARAMETERS pMedia
  315. );
  316. NDIS_STATUS
  317. nicQueryRemoteNodeCaps (
  318. IN PADAPTERCB pAdapter,
  319. IN PREMOTE_NODE pRemoteNode,
  320. OUT PULONG pSpeed,
  321. OUT PULONG pMaxBufferSize,
  322. OUT PULONG pMaxRec
  323. );
  324. UINT
  325. nicSpeedFlagsToSCode(
  326. IN UINT SpeedFlags
  327. );