NegativeSessionResponsePacket.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 Utilities;
  10. namespace SMBLibrary.NetBios
  11. {
  12. /// <summary>
  13. /// [RFC 1002] 4.3.4. NEGATIVE SESSION RESPONSE PACKET
  14. /// </summary>
  15. public class NegativeSessionResponsePacket : SessionPacket
  16. {
  17. public byte ErrorCode;
  18. public NegativeSessionResponsePacket() : base()
  19. {
  20. this.Type = SessionPacketTypeName.NegativeSessionResponse;
  21. }
  22. public NegativeSessionResponsePacket(byte[] buffer, int offset) : base(buffer, offset)
  23. {
  24. ErrorCode = ByteReader.ReadByte(this.Trailer, offset + 0);
  25. }
  26. public override byte[] GetBytes()
  27. {
  28. this.Trailer = new byte[1];
  29. this.Trailer[0] = ErrorCode;
  30. return base.GetBytes();
  31. }
  32. public override int Length
  33. {
  34. get
  35. {
  36. return HeaderLength + 1;
  37. }
  38. }
  39. }
  40. }