LogoffResponse.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 Response
  14. /// </summary>
  15. public class LogoffResponse : SMB2Command
  16. {
  17. public const int DeclaredSize = 4;
  18. private ushort StructureSize;
  19. public ushort Reserved;
  20. public LogoffResponse() : base(SMB2CommandName.Logoff)
  21. {
  22. Header.IsResponse = true;
  23. StructureSize = DeclaredSize;
  24. }
  25. public LogoffResponse(byte[] buffer, int offset) : base(buffer, offset)
  26. {
  27. StructureSize = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 0);
  28. Reserved = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 2);
  29. }
  30. public override void WriteCommandBytes(byte[] buffer, int offset)
  31. {
  32. LittleEndianWriter.WriteUInt16(buffer, offset + 0, StructureSize);
  33. LittleEndianWriter.WriteUInt16(buffer, offset + 2, Reserved);
  34. }
  35. public override int CommandLength
  36. {
  37. get
  38. {
  39. return DeclaredSize;
  40. }
  41. }
  42. }
  43. }