ISubsystemSession.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.Threading;
  3. using Renci.SshNet.Common;
  4. namespace Renci.SshNet
  5. {
  6. /// <summary>
  7. /// Base interface for SSH subsystem implementations.
  8. /// </summary>
  9. internal interface ISubsystemSession : IDisposable
  10. {
  11. /// <summary>
  12. /// Gets a value indicating whether this session is open.
  13. /// </summary>
  14. /// <value>
  15. /// <c>true</c> if this session is open; otherwise, <c>false</c>.
  16. /// </value>
  17. bool IsOpen { get; }
  18. /// <summary>
  19. /// Connects the subsystem using a new SSH channel session.
  20. /// </summary>
  21. /// <exception cref="InvalidOperationException">The session is already connected.</exception>
  22. /// <exception cref="ObjectDisposedException">The method was called after the session was disposed.</exception>
  23. void Connect();
  24. /// <summary>
  25. /// Disconnects the subsystem channel.
  26. /// </summary>
  27. void Disconnect();
  28. /// <summary>
  29. /// Waits a specified time for a given <see cref="WaitHandle"/> to get signaled.
  30. /// </summary>
  31. /// <param name="waitHandle">The handle to wait for.</param>
  32. /// <param name="operationTimeout">The time to wait for <paramref name="waitHandle"/> to get signaled.</param>
  33. /// <exception cref="SshException">The connection was closed by the server.</exception>
  34. /// <exception cref="SshException">The channel was closed.</exception>
  35. /// <exception cref="SshOperationTimeoutException">The handle did not get signaled within the specified <paramref name="operationTimeout"/>.</exception>
  36. void WaitOnHandle(WaitHandle waitHandle, TimeSpan operationTimeout);
  37. }
  38. }