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; };