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.

206 lines
4.8 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. rxcexmit.c
  5. Abstract:
  6. This module implements the data transmission routines along a connection as well as
  7. datagram transmissions
  8. Revision History:
  9. Balan Sethu Raman [SethuR] 15-Feb-1995
  10. Notes:
  11. --*/
  12. #include "precomp.h"
  13. #pragma hdrstop
  14. #ifdef ALLOC_PRAGMA
  15. #pragma alloc_text(PAGE, RxCeSend)
  16. #pragma alloc_text(PAGE, RxCeSendDatagram)
  17. #endif
  18. //
  19. // The debug trace level
  20. //
  21. #define Dbg (DEBUG_TRACE_RXCEXMIT)
  22. NTSTATUS
  23. RxCeSend(
  24. IN PRXCE_VC pVc,
  25. IN ULONG SendOptions,
  26. IN PMDL pMdl,
  27. IN ULONG SendLength,
  28. IN PVOID pCompletionContext)
  29. /*++
  30. Routine Description:
  31. This routine sends a TSDU along the specified connection.
  32. Arguments:
  33. hConnection - the connection on which the TSDU is to be sent
  34. hVc - the virtual circuit Id. along which the TSDU is to be sent
  35. SendOptions - the options for the send operation
  36. pMdl - the buffer to be sent.
  37. SendLength - length of data to be sent
  38. pCompletionContext - the context passed back to the caller during SendCompletion
  39. Return Value:
  40. STATUS_SUCCESS if successfull
  41. Notes:
  42. --*/
  43. {
  44. NTSTATUS Status;
  45. PRXCE_TRANSPORT pTransport = NULL;
  46. PRXCE_ADDRESS pAddress = NULL;
  47. PRXCE_CONNECTION pConnection = NULL;
  48. PAGED_CODE();
  49. // Update profiling info.
  50. RxProfile(RxCeXmit,RxCeSend);
  51. try {
  52. Status = STATUS_CONNECTION_DISCONNECTED;
  53. // reference the objects
  54. pConnection = pVc->pConnection;
  55. pAddress = pConnection->pAddress;
  56. pTransport = pAddress->pTransport;
  57. if (RxCeIsVcValid(pVc) &&
  58. RxCeIsConnectionValid(pConnection) &&
  59. RxCeIsAddressValid(pAddress) &&
  60. RxCeIsTransportValid(pTransport)) {
  61. if (pVc->State == RXCE_VC_ACTIVE) {
  62. Status = RxTdiSend(
  63. pTransport,
  64. pAddress,
  65. pConnection,
  66. pVc,
  67. SendOptions,
  68. pMdl,
  69. SendLength,
  70. pCompletionContext);
  71. }
  72. if (!NT_SUCCESS(Status)) {
  73. RxDbgTrace(0, Dbg,("RxTdiSend returned %lx\n",Status));
  74. }
  75. }
  76. } finally {
  77. if (AbnormalTermination()) {
  78. RxLog(("RxCeSend: T: %lx A: %lx C: %lx VC: %lx\n",pTransport,pAddress,pConnection,pVc));
  79. RxWmiLog(LOG,
  80. RxCeSend,
  81. LOGPTR(pTransport)
  82. LOGPTR(pAddress)
  83. LOGPTR(pConnection)
  84. LOGPTR(pVc));
  85. Status = STATUS_CONNECTION_DISCONNECTED;
  86. }
  87. }
  88. return Status;
  89. }
  90. NTSTATUS
  91. RxCeSendDatagram(
  92. IN PRXCE_ADDRESS pAddress,
  93. IN PRXCE_CONNECTION_INFORMATION pConnectionInformation,
  94. IN ULONG SendOptions,
  95. IN PMDL pMdl,
  96. IN ULONG SendLength,
  97. IN PVOID pCompletionContext)
  98. /*++
  99. Routine Description:
  100. This routine sends a TSDU to a specified transport address.
  101. Arguments:
  102. pLocalAddress - the local address
  103. pConnectionInformation - the remote address
  104. SendOptions - the options for the send operation
  105. pMdl - the buffer to be sent.
  106. SendLength - length of data to be sent
  107. pCompletionContext - the context passed back to the caller during Send completion.
  108. Return Value:
  109. STATUS_SUCCESS if successfull
  110. Notes:
  111. --*/
  112. {
  113. NTSTATUS Status;
  114. PRXCE_TRANSPORT pTransport = NULL;
  115. PAGED_CODE();
  116. // Update profiling info.
  117. RxProfile(RxCeXmit,RxCeSendDatagram);
  118. try {
  119. Status = STATUS_CONNECTION_DISCONNECTED;
  120. pTransport = pAddress->pTransport;
  121. if (RxCeIsAddressValid(pAddress) &&
  122. RxCeIsTransportValid(pTransport)) {
  123. Status = RxTdiSendDatagram(
  124. pTransport,
  125. pAddress,
  126. pConnectionInformation,
  127. SendOptions,
  128. pMdl,
  129. SendLength,
  130. pCompletionContext);
  131. if (!NT_SUCCESS(Status)) {
  132. RxDbgTrace(0, Dbg,("RxTdiSendDatagram returned %lx\n",Status));
  133. }
  134. }
  135. } finally {
  136. if (AbnormalTermination()) {
  137. RxLog(("RxCeSendDg: T: %lx A: %lx\n",pTransport,pAddress));
  138. RxWmiLog(LOG,
  139. RxCeSendDatagram,
  140. LOGPTR(pTransport)
  141. LOGPTR(pAddress));
  142. Status = STATUS_UNEXPECTED_NETWORK_ERROR;
  143. }
  144. }
  145. return Status;
  146. }
  147.