NegativeSessionResponsePacket.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* Copyright (C) 2014 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.NetBios
  12. {
  13. /// <summary>
  14. /// [RFC 1002] 4.3.4. NEGATIVE SESSION RESPONSE PACKET
  15. /// </summary>
  16. public class NegativeSessionResponsePacket : SessionPacket
  17. {
  18. public byte ErrorCode;
  19. public NegativeSessionResponsePacket() : base()
  20. {
  21. this.Type = SessionPacketTypeName.NegativeSessionResponse;
  22. }
  23. public NegativeSessionResponsePacket(byte[] buffer) : base(buffer)
  24. {
  25. ErrorCode = ByteReader.ReadByte(this.Trailer, 0);
  26. }
  27. public override byte[] GetBytes()
  28. {
  29. this.Trailer = new byte[1];
  30. this.Trailer[0] = ErrorCode;
  31. return base.GetBytes();
  32. }
  33. }
  34. }