EchoRequest.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
  2. *
  3. * You can redistribute this program and/or modify it under the terms of
  4. * the GNU Lesser Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. */
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Text;
  10. using Utilities;
  11. namespace SMBLibrary.SMB1
  12. {
  13. /// <summary>
  14. /// SMB_COM_ECHO
  15. /// </summary>
  16. public class EchoRequest : SMB1Command
  17. {
  18. public const int ParametersLength = 2;
  19. // Parameters
  20. public ushort EchoCount;
  21. public EchoRequest() : base()
  22. {
  23. }
  24. public EchoRequest(byte[] buffer, int offset) : base(buffer, offset, false)
  25. {
  26. EchoCount = LittleEndianConverter.ToUInt16(this.SMBParameters, 0);
  27. }
  28. public override byte[] GetBytes(bool isUnicode)
  29. {
  30. this.SMBParameters = new byte[ParametersLength];
  31. LittleEndianWriter.WriteUInt16(this.SMBParameters, 0, EchoCount);
  32. return base.GetBytes(isUnicode);
  33. }
  34. public byte[] Data
  35. {
  36. get
  37. {
  38. return this.SMBData;
  39. }
  40. set
  41. {
  42. this.SMBData = value;
  43. }
  44. }
  45. public override CommandName CommandName
  46. {
  47. get
  48. {
  49. return CommandName.SMB_COM_ECHO;
  50. }
  51. }
  52. }
  53. }