26#ifndef I_ENTREPOT_LIBCURL_HPP 
   27#define I_ENTREPOT_LIBCURL_HPP 
   29#include "../my_config.h" 
   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,         
 
   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 () {};
 
   86    virtual void change_user_interaction(
const std::shared_ptr<user_interaction> & new_dialog)
 override { change_ui(new_dialog); };
 
   88    virtual void read_dir_reset()
 const override { set_current_dir(
false); };
 
   89    virtual bool read_dir_next(std::string & filename) 
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;
 
  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;  
 
  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; };
 
virtual void read_dir_flush() const override
ends the read_dir_next, (no more entry available)
 
virtual void read_dir_reset() const override
routines to read existing files in the current directory (see set_location() / set_root() methods)
 
virtual bool read_dir_next_dirinfo(std::string &filename, inode_type &tp) const override
alternative to the method read_dir_next, should be implemented also
 
virtual bool read_dir_next(std::string &filename) const override
read the next filename of the current directory
 
virtual void change_user_interaction(const std::shared_ptr< user_interaction > &new_dialog) override
change user_interaction if the implementation recorded it (at construction time for example)
 
virtual path get_full_path() const override
returns the full path of location
 
virtual std::shared_ptr< user_interaction > get_current_user_interaction() const override
get the current user_interaction if the implementation reocrded it at construction time (may be nullp...
 
virtual void create_dir(const std::string &dirname, U_I permission) override
create a new directory in the current directory
 
virtual void read_dir_reset_dirinfo() const override
routines to read existing files with dir information
 
entrepot_libcurl(const std::shared_ptr< user_interaction > &dialog, remote_entrepot_type 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 entrepot * clone() const override
done this way for homogeneity with open/inherited_open
 
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
 
remote_entrepot_type
type of entrepot to create
 
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...