26 #ifndef I_ENTREPOT_LIBCURL_HPP 27 #define I_ENTREPOT_LIBCURL_HPP 29 #include "../my_config.h" 35 #include <curl/curl.h> 55 #if defined ( LIBCURL_AVAILABLE ) && defined ( LIBTHREADAR_AVAILABLE ) 57 class entrepot_libcurl::i_entrepot_libcurl :
public entrepot,
public mem_ui
60 i_entrepot_libcurl(
const std::shared_ptr<user_interaction> & dialog,
62 const std::string & login,
63 const secu_string & password,
64 const std::string & host,
65 const std::string & port,
67 const std::string & sftp_pub_keyfile,
68 const std::string & sftp_prv_keyfile,
69 const std::string & sftp_known_hosts,
72 i_entrepot_libcurl(
const i_entrepot_libcurl & ref) =
default;
73 i_entrepot_libcurl(i_entrepot_libcurl && ref) =
default;
74 i_entrepot_libcurl & operator = (
const i_entrepot_libcurl & ref) =
default;
75 i_entrepot_libcurl & operator = (i_entrepot_libcurl && ref) noexcept =
default;
76 ~i_entrepot_libcurl() throw () {};
85 virtual bool read_dir_next(std::string & filename)
const override;
86 virtual entrepot *
clone()
const override {
return new (std::nothrow) i_entrepot_libcurl(*
this); };
92 virtual fichier_global *inherited_open(
const std::shared_ptr<user_interaction> & dialog,
93 const std::string & filename,
95 bool force_permission,
98 bool erase)
const override;
100 virtual void inherited_unlink(
const std::string & filename)
const override;
101 virtual void read_dir_flush()
override;
105 std::string base_URL;
106 mycurl_easyhandle_sharing easyh;
107 std::deque<std::string> current_dir;
108 std::string reading_dir_tmp;
111 void set_libcurl_URL();
112 void set_libcurl_authentication(user_interaction & dialog,
113 const std::string & location,
114 const std::string & login,
115 const secu_string & password,
117 const std::string & sftp_pub_keyfile,
118 const std::string & sftp_prv_keyfile,
119 const std::string & sftp_known_hosts
124 static std::string build_url_from(
mycurl_protocol proto,
const std::string & host,
const std::string & port);
125 static size_t get_ftp_listing_callback(
void *buffer,
size_t size,
size_t nmemb,
void *userp);
126 static size_t null_callback(
void *buffer,
size_t size,
size_t nmemb,
void *userp) {
return size*nmemb; };
virtual path get_full_path() const override
returns the full path of location
class mem_ui definition. This class is to be used as parent class to handle user_interaction object m...
defines the implementation for remote filesystem entrepot using libcurl
gf_mode
generic_file openning modes
virtual std::string get_url() const override
entrepot_libcurl(const std::shared_ptr< user_interaction > &dialog, mycurl_protocol proto, const std::string &login, const secu_string &password, const std::string &host, const std::string &port, bool auth_from_file, const std::string &sftp_pub_keyfile, const std::string &sftp_prv_keyfile, const std::string &sftp_known_hosts, U_I waiting_time)
virtual void read_dir_reset() const override
routines to read existing files in the current directory (see set_location() / set_root() methods) ...
mycurl_protocol
libcurl protocols supported by libdar
virtual entrepot * clone() const override
generate a clone of "this"
this file contains the definition of secu_string class, a std::string like class but allocated in sec...
libdar namespace encapsulate all libdar symbols
used to optimize network session establised by libcurl
std::string display() const
convert back a path to a string