ForwardedTcpipChannelInfo.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. namespace Renci.SshNet.Messages.Connection
  2. {
  3. /// <summary>
  4. /// Used to open "forwarded-tcpip" channel type
  5. /// </summary>
  6. internal class ForwardedTcpipChannelInfo : ChannelOpenInfo
  7. {
  8. /// <summary>
  9. /// Specifies channel open type
  10. /// </summary>
  11. public const string NAME = "forwarded-tcpip";
  12. /// <summary>
  13. /// Gets the type of the channel to open.
  14. /// </summary>
  15. /// <value>
  16. /// The type of the channel to open.
  17. /// </value>
  18. public override string ChannelType
  19. {
  20. get { return NAME; }
  21. }
  22. /// <summary>
  23. /// Gets the connected address.
  24. /// </summary>
  25. public string ConnectedAddress { get; private set; }
  26. /// <summary>
  27. /// Gets the connected port.
  28. /// </summary>
  29. public uint ConnectedPort { get; private set; }
  30. /// <summary>
  31. /// Gets the originator address.
  32. /// </summary>
  33. public string OriginatorAddress { get; private set; }
  34. /// <summary>
  35. /// Gets the originator port.
  36. /// </summary>
  37. public uint OriginatorPort { get; private set; }
  38. /// <summary>
  39. /// Called when type specific data need to be loaded.
  40. /// </summary>
  41. protected override void LoadData()
  42. {
  43. base.LoadData();
  44. this.ConnectedAddress = this.ReadString();
  45. this.ConnectedPort = this.ReadUInt32();
  46. this.OriginatorAddress = this.ReadString();
  47. this.OriginatorPort = this.ReadUInt32();
  48. }
  49. /// <summary>
  50. /// Called when type specific data need to be saved.
  51. /// </summary>
  52. protected override void SaveData()
  53. {
  54. base.SaveData();
  55. this.Write(this.ConnectedAddress);
  56. this.Write(this.ConnectedPort);
  57. this.Write(this.OriginatorAddress);
  58. this.Write(this.OriginatorPort);
  59. }
  60. }
  61. }