ISession.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System;
  2. using Renci.SshNet.Channels;
  3. using Renci.SshNet.Common;
  4. using Renci.SshNet.Messages;
  5. using Renci.SshNet.Messages.Authentication;
  6. namespace Renci.SshNet
  7. {
  8. /// <summary>
  9. /// Provides functionality to connect and interact with SSH server.
  10. /// </summary>
  11. internal interface ISession
  12. {
  13. ///// <summary>
  14. ///// Gets or sets the connection info.
  15. ///// </summary>
  16. ///// <value>The connection info.</value>
  17. //IConnectionInfo ConnectionInfo { get; }
  18. /// <summary>
  19. /// Create a new SSH session channel.
  20. /// </summary>
  21. /// <returns>
  22. /// A new SSH session channel.
  23. /// </returns>
  24. IChannelSession CreateChannelSession();
  25. /// <summary>
  26. /// Registers SSH message with the session.
  27. /// </summary>
  28. /// <param name="messageName">The name of the message to register with the session.</param>
  29. void RegisterMessage(string messageName);
  30. /// <summary>
  31. /// Sends a message to the server.
  32. /// </summary>
  33. /// <param name="message">The message to send.</param>
  34. /// <exception cref="SshConnectionException">The client is not connected.</exception>
  35. /// <exception cref="SshOperationTimeoutException">The operation timed out.</exception>
  36. /// <exception cref="InvalidOperationException">The size of the packet exceeds the maximum size defined by the protocol.</exception>
  37. void SendMessage(Message message);
  38. /// <summary>
  39. /// Unregister SSH message from the session.
  40. /// </summary>
  41. /// <param name="messageName">The name of the message to unregister with the session.</param>
  42. void UnRegisterMessage(string messageName);
  43. /// <summary>
  44. /// Occurs when session has been disconnected from the server.
  45. /// </summary>
  46. event EventHandler<EventArgs> Disconnected;
  47. /// <summary>
  48. /// Occurs when an error occurred.
  49. /// </summary>
  50. event EventHandler<ExceptionEventArgs> ErrorOccured;
  51. /// <summary>
  52. /// Occurs when <see cref="BannerMessage"/> message is received from the server.
  53. /// </summary>
  54. event EventHandler<MessageEventArgs<BannerMessage>> UserAuthenticationBannerReceived;
  55. }
  56. }