SessionRetargetResponsePacket.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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.5. SESSION RETARGET RESPONSE PACKET
  15. /// </summary>
  16. public class SessionRetargetResponsePacket : SessionPacket
  17. {
  18. uint IPAddress;
  19. ushort Port;
  20. public SessionRetargetResponsePacket() : base()
  21. {
  22. this.Type = SessionPacketTypeName.RetargetSessionResponse;
  23. }
  24. public SessionRetargetResponsePacket(byte[] buffer) : base(buffer)
  25. {
  26. IPAddress = BigEndianConverter.ToUInt32(this.Trailer, 0);
  27. Port = BigEndianConverter.ToUInt16(this.Trailer, 4);
  28. }
  29. public override byte[] GetBytes()
  30. {
  31. this.Trailer = new byte[6];
  32. BigEndianWriter.WriteUInt32(this.Trailer, 0, IPAddress);
  33. BigEndianWriter.WriteUInt16(this.Trailer, 4, Port);
  34. return base.GetBytes();
  35. }
  36. }
  37. }