26#ifndef I_ENTREPOT_LIBCURL_HPP
27#define I_ENTREPOT_LIBCURL_HPP
56#if defined ( LIBCURL_AVAILABLE ) && defined ( LIBTHREADAR_AVAILABLE )
58 class entrepot_libcurl::i_entrepot_libcurl :
public entrepot,
public mem_ui
61 i_entrepot_libcurl(
const std::shared_ptr<user_interaction> & dialog,
62 remote_entrepot_type proto,
63 const std::string & login,
64 const secu_string & password,
65 const std::string & host,
66 const std::string & port,
68 const std::string & sftp_pub_keyfile,
69 const std::string & sftp_prv_keyfile,
70 const std::string & sftp_known_hosts,
74 i_entrepot_libcurl(
const i_entrepot_libcurl & ref) =
default;
75 i_entrepot_libcurl(i_entrepot_libcurl && ref) =
default;
76 i_entrepot_libcurl & operator = (
const i_entrepot_libcurl & ref) =
delete;
77 i_entrepot_libcurl & operator = (i_entrepot_libcurl && ref)
noexcept =
delete;
78 ~i_entrepot_libcurl() throw () {};
85 virtual std::string get_url()
const override {
return base_URL + get_full_path().display_without_root(); };
86 virtual void change_user_interaction(
const std::shared_ptr<user_interaction> & new_dialog)
override { change_ui(new_dialog); };
87 virtual std::shared_ptr<user_interaction> get_current_user_interaction()
const override {
return get_pointer(); };
88 virtual void read_dir_reset()
const override { set_current_dir(
false); };
89 virtual bool read_dir_next(std::string & filename)
const override;
90 virtual void read_dir_reset_dirinfo()
const override { set_current_dir(
true); };
91 virtual bool read_dir_next_dirinfo(std::string & filename, inode_type &tp)
const override;
93 virtual void create_dir(
const std::string & dirname, U_I permission)
override;
95 virtual entrepot *clone()
const override {
return new (std::nothrow) i_entrepot_libcurl(*
this); };
101 virtual fichier_global *inherited_open(
const std::shared_ptr<user_interaction> & dialog,
102 const std::string & filename,
104 bool force_permission,
107 bool erase)
const override;
109 virtual void inherited_unlink(
const std::string & filename)
const override;
110 virtual void read_dir_flush()
const override;
114 std::string base_URL;
115 mutable mycurl_easyhandle_sharing easyh;
116 mutable std::map<std::string, inode_type> current_dir;
117 mutable std::string reading_dir_tmp;
118 mutable std::deque<std::string> temporary_list;
119 mutable std::map<std::string, inode_type>::const_iterator cur_dir_cursor;
122 mutable bool withdirinfo;
124 std::string get_libcurl_URL()
const;
125 void set_libcurl_authentication(user_interaction & dialog,
126 const std::string & location,
127 const std::string & login,
128 const secu_string & password,
130 const std::string & sftp_pub_keyfile,
131 const std::string & sftp_prv_keyfile,
132 const std::string & sftp_known_hosts
135 void fill_temporary_list()
const;
136 void update_current_dir_with_line(
const std::string & line)
const;
137 void set_current_dir(
bool details)
const;
140 static std::string mycurl_protocol2string(remote_entrepot_type proto);
141 static std::string build_url_from(remote_entrepot_type proto,
const std::string & host,
const std::string & port);
142 static size_t get_ftp_listing_callback(
void *buffer,
size_t size,
size_t nmemb,
void *userp);
143 static size_t null_callback(
void *buffer,
size_t size,
size_t nmemb,
void *userp) {
return size*nmemb; };
144 static bool mycurl_is_protocol_available(remote_entrepot_type proto);
147 friend class entrepot_libcurl;
defines the implementation for remote filesystem entrepot using libcurl
remote_entrepot_type
type of entrepot to create
class mem_ui definition. This class is to be used as parent class to handle user_interaction object m...
include macro defined by the configure script and some specific additional ones
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...