using System;
using Renci.SshNet.Common;
using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Channels
{
///
/// Represents SSH channel.
///
internal interface IChannel : IDisposable
{
///
/// Occurs when is received.
///
event EventHandler DataReceived;
///
/// Occurs when an exception is thrown when processing channel messages.
///
event EventHandler Exception;
///
/// Occurs when is received.
///
event EventHandler ExtendedDataReceived;
///
/// Occurs when is received.
///
event EventHandler RequestReceived;
///
/// Occurs when is received.
///
event EventHandler Closed;
///
/// Gets the local channel number.
///
///
/// The local channel number.
///
uint LocalChannelNumber { get; }
///
/// Gets the maximum size of a packet.
///
///
/// The maximum size of a packet.
///
uint LocalPacketSize { get; }
///
/// Gets the maximum size of a data packet that can be sent using the channel.
///
///
/// The maximum size of data that can be sent using a
/// on the current channel.
///
/// The channel has not been opened, or the open has not yet been confirmed.
uint RemotePacketSize { get; }
///
/// Gets a value indicating whether this channel is open.
///
///
/// true if this channel is open; otherwise, false.
///
bool IsOpen { get; }
///
/// Sends a SSH_MSG_CHANNEL_DATA message with the specified payload.
///
/// The payload to send.
void SendData(byte[] data);
///
/// Sends a SSH_MSG_CHANNEL_DATA message with the specified payload.
///
/// An array of containing the payload to send.
/// The zero-based offset in at which to begin taking data from.
/// The number of bytes of to send.
///
///
/// When the size of the data to send exceeds the maximum packet size or the remote window
/// size does not allow the full data to be sent, then this method will send the data in
/// multiple chunks and will wait for the remote window size to be adjusted when it's zero.
///
///
/// This is done to support SSH servers will a small window size that do not agressively
/// increase their window size. We need to take into account that there may be SSH servers
/// that only increase their window size when it has reached zero.
///
///
void SendData(byte[] data, int offset, int size);
///
/// Sends a SSH_MSG_CHANNEL_EOF message to the remote server.
///
/// The channel is closed.
void SendEof();
}
}