PortForwardEventArgs.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. namespace Renci.SshNet.Common
  3. {
  4. /// <summary>
  5. /// Provides data for <see cref="Renci.SshNet.ForwardedPort.RequestReceived"/> event.
  6. /// </summary>
  7. public class PortForwardEventArgs : EventArgs
  8. {
  9. /// <summary>
  10. /// Gets request originator host.
  11. /// </summary>
  12. public string OriginatorHost { get; private set; }
  13. /// <summary>
  14. /// Gets request originator port.
  15. /// </summary>
  16. public uint OriginatorPort { get; private set; }
  17. /// <summary>
  18. /// Initializes a new instance of the <see cref="PortForwardEventArgs"/> class.
  19. /// </summary>
  20. /// <param name="host">The host.</param>
  21. /// <param name="port">The port.</param>
  22. internal PortForwardEventArgs(string host, uint port)
  23. {
  24. if (host == null)
  25. throw new ArgumentNullException("host");
  26. if (!host.IsValidHost())
  27. throw new ArgumentException("host");
  28. if (!port.IsValidPort())
  29. throw new ArgumentOutOfRangeException("port");
  30. this.OriginatorHost = host;
  31. this.OriginatorPort = port;
  32. }
  33. }
  34. }