IServiceFactory.cs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Renci.SshNet.Common;
  5. using Renci.SshNet.Security;
  6. using Renci.SshNet.Sftp;
  7. namespace Renci.SshNet
  8. {
  9. /// <summary>
  10. /// Factory for creating new services.
  11. /// </summary>
  12. internal partial interface IServiceFactory
  13. {
  14. IClientAuthentication CreateClientAuthentication();
  15. /// <summary>
  16. /// Creates a new <see cref="ISession"/> with the specified <see cref="ConnectionInfo"/>.
  17. /// </summary>
  18. /// <param name="connectionInfo">The <see cref="ConnectionInfo"/> to use for creating a new session.</param>
  19. /// <returns>
  20. /// An <see cref="ISession"/> for the specified <see cref="ConnectionInfo"/>.
  21. /// </returns>
  22. /// <exception cref="ArgumentNullException"><paramref name="connectionInfo"/> is <c>null</c>.</exception>
  23. ISession CreateSession(ConnectionInfo connectionInfo);
  24. /// <summary>
  25. /// Creates a new <see cref="ISftpSession"/> in a given <see cref="ISession"/> and with
  26. /// the specified operation timeout and encoding.
  27. /// </summary>
  28. /// <param name="session">The <see cref="ISession"/> to create the <see cref="ISftpSession"/> in.</param>
  29. /// <param name="operationTimeout">The operation timeout.</param>
  30. /// <param name="encoding">The encoding.</param>
  31. /// <returns>
  32. /// An <see cref="ISftpSession"/>.
  33. /// </returns>
  34. ISftpSession CreateSftpSession(ISession session, TimeSpan operationTimeout, Encoding encoding);
  35. /// <summary>
  36. /// Create a new <see cref="PipeStream"/>.
  37. /// </summary>
  38. /// <returns>
  39. /// A <see cref="PipeStream"/>.
  40. /// </returns>
  41. PipeStream CreatePipeStream();
  42. /// <summary>
  43. /// Negotiates a key exchange algorithm, and creates a <see cref="IKeyExchange" /> for the negotiated
  44. /// algorithm.
  45. /// </summary>
  46. /// <param name="clientAlgorithms">A <see cref="IDictionary{String, Type}"/> of the key exchange algorithms supported by the client where the key is the name of the algorithm, and the value is the type implementing this algorithm.</param>
  47. /// <param name="serverAlgorithms">The names of the key exchange algorithms supported by the SSH server.</param>
  48. /// <returns>
  49. /// A <see cref="IKeyExchange"/> that was negotiated between client and server.
  50. /// </returns>
  51. /// <exception cref="ArgumentNullException"><paramref name="clientAlgorithms"/> is <c>null</c>.</exception>
  52. /// <exception cref="ArgumentNullException"><paramref name="serverAlgorithms"/> is <c>null</c>.</exception>
  53. /// <exception cref="SshConnectionException">No key exchange algorithm is supported by both client and server.</exception>
  54. IKeyExchange CreateKeyExchange(IDictionary<string, Type> clientAlgorithms, string[] serverAlgorithms);
  55. }
  56. }