IChannel.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System;
  2. using Renci.SshNet.Common;
  3. using Renci.SshNet.Messages.Connection;
  4. namespace Renci.SshNet.Channels
  5. {
  6. /// <summary>
  7. /// Represents SSH channel.
  8. /// </summary>
  9. internal interface IChannel : IDisposable
  10. {
  11. /// <summary>
  12. /// Occurs when <see cref="ChannelDataMessage"/> message received
  13. /// </summary>
  14. event EventHandler<ChannelDataEventArgs> DataReceived;
  15. /// <summary>
  16. /// Occurs when <see cref="ChannelExtendedDataMessage"/> message received
  17. /// </summary>
  18. event EventHandler<ChannelDataEventArgs> ExtendedDataReceived;
  19. /// <summary>
  20. /// Occurs when <see cref="ChannelRequestMessage"/> message received
  21. /// </summary>
  22. event EventHandler<ChannelRequestEventArgs> RequestReceived;
  23. /// <summary>
  24. /// Occurs when <see cref="ChannelCloseMessage"/> message received
  25. /// </summary>
  26. event EventHandler<ChannelEventArgs> Closed;
  27. /// <summary>
  28. /// Gets the local channel number.
  29. /// </summary>
  30. /// <value>
  31. /// The local channel number.
  32. /// </value>
  33. uint LocalChannelNumber { get; }
  34. /// <summary>
  35. /// Gets the maximum size of a packet.
  36. /// </summary>
  37. /// <value>
  38. /// The maximum size of a packet.
  39. /// </value>
  40. uint LocalPacketSize { get; }
  41. /// <summary>
  42. /// Gets the maximum size of a data packet that can be sent using the channel.
  43. /// </summary>
  44. /// <value>
  45. /// The maximum size of data that can be sent using a <see cref="ChannelDataMessage"/>
  46. /// on the current channel.
  47. /// </value>
  48. /// <exception cref="InvalidOperationException">The channel has not been opened, or the open has not yet been confirmed.</exception>
  49. uint RemotePacketSize { get; }
  50. /// <summary>
  51. /// Closes the channel.
  52. /// </summary>
  53. void Close();
  54. /// <summary>
  55. /// Gets a value indicating whether this channel is open.
  56. /// </summary>
  57. /// <value>
  58. /// <c>true</c> if this channel is open; otherwise, <c>false</c>.
  59. /// </value>
  60. bool IsOpen { get; }
  61. /// <summary>
  62. /// Sends a SSH_MSG_CHANNEL_DATA message with the specified payload.
  63. /// </summary>
  64. /// <param name="data">The payload to send.</param>
  65. void SendData(byte[] data);
  66. /// <summary>
  67. /// Sends the SSH_MSG_CHANNEL_EOF message.
  68. /// </summary>
  69. void SendEof();
  70. }
  71. }