using System;
using System.Threading;
using Renci.SshNet.Common;
namespace Renci.SshNet
{
///
/// Base interface for SSH subsystem implementations.
///
internal interface ISubsystemSession : IDisposable
{
///
/// Gets or set the number of seconds to wait for an operation to complete.
///
///
/// The number of seconds to wait for an operation to complete, or -1 to wait indefinitely.
///
int OperationTimeout { get; }
///
/// Gets a value indicating whether this session is open.
///
///
/// true if this session is open; otherwise, false.
///
bool IsOpen { get; }
///
/// Connects the subsystem using a new SSH channel session.
///
/// The session is already connected.
/// The method was called after the session was disposed.
void Connect();
///
/// Disconnects the subsystem channel.
///
void Disconnect();
///
/// Waits a specified time for a given to get signaled.
///
/// The handle to wait for.
/// The number of millieseconds wait for to get signaled, or -1 to wait indefinitely.
/// The connection was closed by the server.
/// The channel was closed.
/// The handle did not get signaled within the specified timeout.
void WaitOnHandle(WaitHandle waitHandle, int millisecondsTimeout);
///
/// Blocks the current thread until the specified gets signaled, using a
/// 32-bit signed integer to specify the time interval in milliseconds.
///
/// The handle to wait for.
/// To number of milliseconds to wait for to get signaled, or -1 to wait indefinitely.
///
/// true if received a signal within the specified timeout;
/// otherwise, false.
///
/// The connection was closed by the server.
/// The channel was closed.
///
/// The blocking wait is also interrupted when either the established channel is closed, the current
/// session is disconnected or an unexpected occurred while processing a channel
/// or session event.
///
bool WaitOne(WaitHandle waitHandle, int millisecondsTimeout);
///
/// Blocks the current thread until the specified gets signaled, using a
/// 32-bit signed integer to specify the time interval in milliseconds.
///
/// The first handle to wait for.
/// The second handle to wait for.
/// To number of milliseconds to wait for a to get signaled, or -1 to wait indefinitely.
///
/// 0 if received a signal within the specified timeout and 1
/// if received a signal within the specified timeout, or
/// if no object satisfied the wait.
///
/// The connection was closed by the server.
/// The channel was closed.
///
///
/// The blocking wait is also interrupted when either the established channel is closed, the current
/// session is disconnected or an unexpected occurred while processing a channel
/// or session event.
///
///
/// When both and are signaled during the call,
/// then 0 is returned.
///
///
int WaitAny(WaitHandle waitHandleA, WaitHandle waitHandleB, int millisecondsTimeout);
///
/// Waits for any of the elements in the specified array to receive a signal, using a 32-bit signed
/// integer to specify the time interval.
///
/// A array - constructed using - containing the objects to wait for.
/// To number of milliseconds to wait for a to get signaled, or -1 to wait indefinitely.
///
/// The array index of the first non-system object that satisfied the wait.
///
/// The connection was closed by the server.
/// The channel was closed.
/// No object satified the wait and a time interval equivalent to has passed.
///
/// For the return value, the index of the first non-system object is considered to be zero.
///
int WaitAny(WaitHandle[] waitHandles, int millisecondsTimeout);
///
/// Creates a array that is composed of system objects and the specified
/// elements.
///
/// A array containing the objects to wait for.
///
/// A array that is composed of system objects and the specified elements.
///
WaitHandle[] CreateWaitHandleArray(params WaitHandle[] waitHandles);
///
/// Creates a array that is composed of system objects and the specified
/// elements.
///
/// The first to wait for.
/// The second to wait for.
///
/// A array that is composed of system objects and the specified elements.
///
WaitHandle[] CreateWaitHandleArray(WaitHandle waitHandle1, WaitHandle waitHandle2);
}
}