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.

143 lines
2.4 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. aep.c
  5. Abstract:
  6. This module contains the echo protocol support code.
  7. Author:
  8. Jameel Hyder (jameelh@microsoft.com)
  9. Nikhil Kamkolkar (nikhilk@microsoft.com)
  10. Revision History:
  11. 19 Jun 1992 Initial Version
  12. Notes: Tab stop: 4
  13. --*/
  14. #define FILENUM AEP
  15. #include <atalk.h>
  16. #pragma hdrstop
  17. VOID
  18. AtalkAepPacketIn(
  19. IN PPORT_DESCRIPTOR pPortDesc,
  20. IN PDDP_ADDROBJ pDdpAddr,
  21. IN PBYTE pPkt,
  22. IN USHORT PktLen,
  23. IN PATALK_ADDR pSrcAddr,
  24. IN PATALK_ADDR pDestAddr,
  25. IN ATALK_ERROR ErrorCode,
  26. IN BYTE DdpType,
  27. IN PVOID pHandlerCtx,
  28. IN BOOLEAN OptimizedPath,
  29. IN PVOID OptimizeCtx
  30. )
  31. /*++
  32. Routine Description:
  33. Arguments:
  34. Return Value:
  35. --*/
  36. {
  37. PBUFFER_DESC pBufDesc;
  38. SEND_COMPL_INFO SendInfo;
  39. ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
  40. // Turn around and send the packet back to the destination address.
  41. if (ATALK_SUCCESS(ErrorCode))
  42. {
  43. if ((DdpType == DDPPROTO_EP) &&
  44. (PktLen > 0))
  45. {
  46. if (*pPkt == EP_COMMAND_REQUEST)
  47. {
  48. // This is an echo request, we have some data that needs
  49. // to be echoed back! Do it.
  50. pBufDesc = AtalkAllocBuffDesc(
  51. NULL,
  52. PktLen,
  53. (BD_CHAR_BUFFER | BD_FREE_BUFFER));
  54. if (pBufDesc)
  55. {
  56. // Change command to be Reply
  57. *pPkt = EP_COMMAND_REPLY;
  58. // This *does not* set the PktLen in pBufDesc. Set it.
  59. AtalkCopyBufferToBuffDesc(
  60. pPkt,
  61. PktLen,
  62. pBufDesc,
  63. 0);
  64. AtalkSetSizeOfBuffDescData(pBufDesc, PktLen);
  65. // Call AtalkDdpSend.
  66. SendInfo.sc_TransmitCompletion = atalkAepSendComplete;
  67. SendInfo.sc_Ctx1 = pBufDesc;
  68. // SendInfo.sc_Ctx2 = NULL;
  69. // SendInfo.sc_Ctx3 = NULL;
  70. if (!ATALK_SUCCESS(AtalkDdpSend(pDdpAddr,
  71. pSrcAddr,
  72. (BYTE)DDPPROTO_EP,
  73. FALSE,
  74. pBufDesc,
  75. NULL,
  76. 0,
  77. NULL,
  78. &SendInfo)))
  79. {
  80. AtalkFreeBuffDesc(pBufDesc);
  81. }
  82. }
  83. }
  84. }
  85. }
  86. else
  87. {
  88. DBGPRINT(DBG_COMP_AEP, DBG_LEVEL_ERR,
  89. ("AtalkAepPacketIn: Ignoring incoming packet AepPacketIn %lx\n",
  90. ErrorCode));
  91. }
  92. }
  93. VOID FASTCALL
  94. atalkAepSendComplete(
  95. IN NDIS_STATUS Status,
  96. IN PSEND_COMPL_INFO pSendInfo
  97. )
  98. /*++
  99. Routine Description:
  100. Arguments:
  101. Return Value:
  102. --*/
  103. {
  104. AtalkFreeBuffDesc((PBUFFER_DESC)(pSendInfo->sc_Ctx1));
  105. }
  106.