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,
73 i_entrepot_libcurl(
const i_entrepot_libcurl & ref) =
default;
74 i_entrepot_libcurl(i_entrepot_libcurl && ref) =
default;
75 i_entrepot_libcurl & operator = (
const i_entrepot_libcurl & ref) =
delete;
76 i_entrepot_libcurl & operator = (i_entrepot_libcurl && ref) noexcept =
delete;
77 ~i_entrepot_libcurl() throw () {};
86 virtual bool read_dir_next(std::string & filename)
const override;
87 virtual entrepot *
clone()
const override {
return new (std::nothrow) i_entrepot_libcurl(*
this); };
93 virtual fichier_global *inherited_open(
const std::shared_ptr<user_interaction> & dialog,
94 const std::string & filename,
96 bool force_permission,
99 bool erase)
const override;
101 virtual void inherited_unlink(
const std::string & filename)
const override;
102 virtual void read_dir_flush()
override;
106 std::string base_URL;
107 mycurl_easyhandle_sharing easyh;
108 std::deque<std::string> current_dir;
109 std::string reading_dir_tmp;
113 std::string get_libcurl_URL()
const;
114 void set_libcurl_authentication(user_interaction & dialog,
115 const std::string & location,
116 const std::string & login,
117 const secu_string & password,
119 const std::string & sftp_pub_keyfile,
120 const std::string & sftp_prv_keyfile,
121 const std::string & sftp_known_hosts
126 static std::string build_url_from(
mycurl_protocol proto,
const std::string & host,
const std::string & port);
127 static size_t get_ftp_listing_callback(
void *buffer,
size_t size,
size_t nmemb,
void *userp);
128 static size_t null_callback(
void *buffer,
size_t size,
size_t nmemb,
void *userp) {
return size*nmemb; };
virtual void read_dir_reset() const override
routines to read existing files in the current directory (see set_location() / set_root() methods)
virtual entrepot * clone() const override
generate a clone of "this"
virtual path get_full_path() const override
returns the full path of location
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, bool verbose=false)
virtual std::string get_url() const override
std::string display_without_root() const
display the path as a string but without the first member of the path
defines the implementation for remote filesystem entrepot using libcurl
mycurl_protocol
libcurl protocols supported by libdar
gf_mode
generic_file openning modes
class mem_ui definition. This class is to be used as parent class to handle user_interaction object m...
used to optimize network session establised by libcurl
libdar namespace encapsulate all libdar symbols
this file contains the definition of secu_string class, a std::string like class but allocated in sec...