PortForwardEventArgs.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. /// <exception cref="ArgumentNullException"><paramref name="host"/> is <c>null</c>.</exception>
  23. /// <exception cref="ArgumentOutOfRangeException"><paramref name="port" /> is not within <see cref="F:System.Net.IPEndPoint.MinPort" /> and <see cref="F:System.Net.IPEndPoint.MaxPort" />.</exception>
  24. internal PortForwardEventArgs(string host, uint port)
  25. {
  26. if (host == null)
  27. throw new ArgumentNullException("host");
  28. port.ValidatePort("port");
  29. OriginatorHost = host;
  30. OriginatorPort = port;
  31. }
  32. }
  33. }