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.

195 lines
5.0 KiB

  1. /*++
  2. Copyright (c) 1990-1995 Microsoft Corporation
  3. Module Name:
  4. Tapi.c
  5. Abstract:
  6. Author:
  7. Tony Bell (TonyBe) June 06, 1995
  8. Environment:
  9. Kernel Mode
  10. Revision History:
  11. TonyBe 06/06/95 Created
  12. --*/
  13. //
  14. // We want to initialize all of the global variables now!
  15. //
  16. #include "wan.h"
  17. #define __FILE_SIG__ TAPI_FILESIG
  18. EXPORT
  19. VOID
  20. NdisTapiCompleteRequest(
  21. IN NDIS_HANDLE Handle,
  22. IN PVOID NdisRequest,
  23. IN NDIS_STATUS Status
  24. );
  25. EXPORT
  26. VOID
  27. NdisTapiIndicateStatus(
  28. IN NDIS_HANDLE Handle,
  29. IN PVOID StatusBuffer,
  30. IN UINT StatusBufferSize
  31. );
  32. NDIS_STATUS
  33. NdisWanTapiRequestProc(
  34. POPENCB OpenCB,
  35. PNDIS_REQUEST NdisRequest
  36. )
  37. /*++
  38. Routine Name:
  39. NdisWanTapiRequestProc
  40. Routine Description:
  41. Procedure is called by the NdisTapi.sys driver to send
  42. requests to the WanMiniport driver. We intercept this
  43. just to moderate. NdisTapi could call the miniport directly
  44. if we wanted but we don't.
  45. Arguments:
  46. Return Values:
  47. --*/
  48. {
  49. NDIS_STATUS Status;
  50. PWAN_REQUEST WanRequest;
  51. PNDIS_REQUEST MyNdisRequest;
  52. NdisWanDbgOut(DBG_TRACE, DBG_TAPI, ("NdisWanTapiRequestProc - Enter"));
  53. NdisWanDbgOut(DBG_INFO, DBG_TAPI, ("NdisRequest: Type: 0x%x OID: 0x%x",
  54. NdisRequest->RequestType,NdisRequest->DATA.QUERY_INFORMATION.Oid));
  55. WanRequest =
  56. NdisAllocateFromNPagedLookasideList(&WanRequestList);
  57. if (WanRequest == NULL) {
  58. return (NDIS_STATUS_RESOURCES);
  59. }
  60. WanRequest->Type = ASYNC;
  61. WanRequest->Origin = NDISTAPI;
  62. WanRequest->OpenCB = OpenCB;
  63. WanRequest->OriginalRequest = NdisRequest;
  64. NdisWanInitializeNotificationEvent(&WanRequest->NotificationEvent);
  65. MyNdisRequest = &WanRequest->NdisRequest;
  66. MyNdisRequest->RequestType =
  67. NdisRequest->RequestType;
  68. if (NdisRequest->RequestType == NdisRequestQueryInformation) {
  69. MyNdisRequest->DATA.QUERY_INFORMATION.Oid =
  70. NdisRequest->DATA.QUERY_INFORMATION.Oid;
  71. MyNdisRequest->DATA.QUERY_INFORMATION.InformationBuffer =
  72. NdisRequest->DATA.QUERY_INFORMATION.InformationBuffer;
  73. MyNdisRequest->DATA.QUERY_INFORMATION.InformationBufferLength =
  74. NdisRequest->DATA.QUERY_INFORMATION.InformationBufferLength;
  75. MyNdisRequest->DATA.QUERY_INFORMATION.BytesWritten =
  76. NdisRequest->DATA.QUERY_INFORMATION.BytesWritten;
  77. } else if (NdisRequest->RequestType == NdisRequestSetInformation) {
  78. MyNdisRequest->DATA.SET_INFORMATION.Oid =
  79. NdisRequest->DATA.SET_INFORMATION.Oid;
  80. MyNdisRequest->DATA.SET_INFORMATION.InformationBuffer =
  81. NdisRequest->DATA.SET_INFORMATION.InformationBuffer;
  82. MyNdisRequest->DATA.SET_INFORMATION.InformationBufferLength =
  83. NdisRequest->DATA.SET_INFORMATION.InformationBufferLength;
  84. MyNdisRequest->DATA.SET_INFORMATION.BytesRead =
  85. NdisRequest->DATA.SET_INFORMATION.BytesRead;
  86. }
  87. Status = NdisWanSubmitNdisRequest(OpenCB, WanRequest);
  88. NdisWanDbgOut(DBG_INFO, DBG_TAPI, ("Status: 0x%x", Status));
  89. NdisWanDbgOut(DBG_TRACE, DBG_TAPI, ("NdisWanTapiRequestProc - Exit"));
  90. return (Status);
  91. }
  92. VOID
  93. NdisWanTapiRequestComplete(
  94. POPENCB OpenCB,
  95. PWAN_REQUEST WanRequest
  96. )
  97. {
  98. PNDIS_REQUEST NdisRequest, MyNdisRequest;
  99. NdisWanDbgOut(DBG_TRACE, DBG_TAPI,
  100. ("NdisWanTapiRequestComplete - Enter"));
  101. NdisRequest = WanRequest->OriginalRequest;
  102. MyNdisRequest = &WanRequest->NdisRequest;
  103. if (NdisRequest->RequestType == NdisRequestQueryInformation) {
  104. NdisRequest->DATA.QUERY_INFORMATION.BytesWritten =
  105. MyNdisRequest->DATA.QUERY_INFORMATION.BytesWritten;
  106. } else if (NdisRequest->RequestType == NdisRequestSetInformation) {
  107. NdisRequest->DATA.SET_INFORMATION.BytesRead =
  108. MyNdisRequest->DATA.SET_INFORMATION.BytesRead;
  109. }
  110. NdisWanDbgOut(DBG_INFO, DBG_TAPI,
  111. ("NdisRequest: Type: 0x%x OID: 0x%x",
  112. NdisRequest->RequestType,
  113. NdisRequest->DATA.QUERY_INFORMATION.Oid));
  114. NdisWanDbgOut(DBG_INFO, DBG_TAPI,
  115. ("Status: 0x%x", WanRequest->NotificationStatus));
  116. NdisTapiCompleteRequest(OpenCB,
  117. NdisRequest,
  118. WanRequest->NotificationStatus);
  119. NdisFreeToNPagedLookasideList(&WanRequestList, WanRequest);
  120. }
  121. VOID
  122. NdisWanTapiIndication(
  123. POPENCB OpenCB,
  124. PUCHAR StatusBuffer,
  125. ULONG StatusBufferSize
  126. )
  127. /*++
  128. Routine Name:
  129. Routine Description:
  130. Arguments:
  131. Return Values:
  132. --*/
  133. {
  134. NdisWanDbgOut(DBG_TRACE, DBG_TAPI, ("NdisWanTapiIndication - Enter"));
  135. //
  136. // If tapi is present and this miniport has registered for
  137. // connectionwrapper services give this to tapi
  138. //
  139. if (OpenCB->WanInfo.FramingBits & TAPI_PROVIDER) {
  140. NdisTapiIndicateStatus(OpenCB,
  141. StatusBuffer,
  142. StatusBufferSize);
  143. }
  144. NdisWanDbgOut(DBG_TRACE, DBG_TAPI, ("NdisWanTapiIndication - Exit"));
  145. }