DirectTcpIpMessage.cs 865 B

123456789101112131415161718192021222324252627
  1. using System;
  2. using System.Net;
  3. using System.Text;
  4. namespace FxSsh.Messages.Connection
  5. {
  6. public class DirectTcpIpMessage : ChannelOpenMessage
  7. {
  8. public string Host { get; private set; }
  9. public uint Port { get; private set; }
  10. public string OriginatorIPAddress { get; private set; }
  11. public uint OriginatorPort { get; private set; }
  12. protected override void OnLoad(SshDataWorker reader)
  13. {
  14. base.OnLoad(reader);
  15. if (ChannelType != "direct-tcpip")
  16. throw new ArgumentException(string.Format("Channel type {0} is not valid.", ChannelType));
  17. Host = reader.ReadString(Encoding.ASCII);
  18. Port = reader.ReadUInt32();
  19. OriginatorIPAddress = reader.ReadString(Encoding.ASCII);
  20. OriginatorPort = reader.ReadUInt32();
  21. }
  22. }
  23. }