28#ifndef LIBSSH_CONNECTION_HPP
29#define LIBSSH_CONNECTION_HPP
32#include "../my_config.h"
36#if HAVE_LIBSSH_LIBSSH_H
37#include <libssh/libssh.h>
38#include <libssh/sftp.h>
59 class libssh_connection
63 libssh_connection(
const std::shared_ptr<user_interaction> & dialog,
64 const std::string & login,
65 const secu_string & password,
66 const std::string & host,
67 const std::string & port,
69 const std::string & sftp_pub_keyfile,
70 const std::string & sftp_prv_keyfile,
71 const std::string & sftp_known_hosts,
73 bool verbose =
false);
75 libssh_connection(
const libssh_connection & ref) =
delete;
76 libssh_connection(libssh_connection && ref) =
delete;
77 libssh_connection & operator = (
const libssh_connection & ref) =
delete;
78 libssh_connection & operator = (libssh_connection && ref) =
delete;
79 ~libssh_connection() { cleanup_session(); };
81 ssh_session & get_ssh_session() {
return sess; };
82 sftp_session & get_sftp_session() {
return sftp_sess; };
83 U_I get_retry_delay()
const {
return waiting; };
84 U_I get_max_read()
const {
return max_read; };
85 U_I get_max_write()
const {
return max_write; };
87 const char* get_sftp_error_msg()
const;
91 sftp_session sftp_sess;
97 void create_session(
const std::string & host,
98 const std::string & port,
99 const std::string & login,
100 const std::string sftp_known_hosts,
102 const std::string sftp_pub_keyfile,
103 const std::string & sftp_prv_keyfile);
105 void server_authentication(user_interaction & dialog);
106 void user_authentication(user_interaction & dialog,
107 const secu_string & password,
109 const std::string & login,
110 const std::string & host,
111 const std::string & sftp_pub_keyfile,
112 const std::string & sftp_prv_keyfile);
113 void create_sftp_session();
114 void set_max_limits();
115 void cleanup_session();
117 static const char* get_key_error_msg(
int code);
118 static const char* get_auth_error_msg(
int code);
are defined here basic integer types that tend to be portable
libdar namespace encapsulate all libdar symbols
this file contains the definition of secu_string class, a std::string like class but allocated in sec...
defines the interaction interface between libdar and users.