LogoffRequest.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Copyright (C) 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 Utilities;
  10. namespace SMBLibrary.SMB2
  11. {
  12. /// <summary>
  13. /// SMB2 LOGOFF Request
  14. /// </summary>
  15. public class LogoffRequest : SMB2Command
  16. {
  17. public const int DeclaredSize = 4;
  18. private ushort StructureSize;
  19. public ushort Reserved;
  20. public LogoffRequest() : base(SMB2CommandName.Logoff)
  21. {
  22. StructureSize = DeclaredSize;
  23. }
  24. public LogoffRequest(byte[] buffer, int offset) : base(buffer, offset)
  25. {
  26. StructureSize = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 0);
  27. Reserved = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 2);
  28. }
  29. public override void WriteCommandBytes(byte[] buffer, int offset)
  30. {
  31. LittleEndianWriter.WriteUInt16(buffer, offset + 0, StructureSize);
  32. LittleEndianWriter.WriteUInt16(buffer, offset + 2, Reserved);
  33. }
  34. public override int CommandLength
  35. {
  36. get
  37. {
  38. return DeclaredSize;
  39. }
  40. }
  41. }
  42. }