Disk ARchive  2.7.15
Full featured and portable backup and archiving tool
entrepot_libcurl.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2024 Denis Corbin
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // to contact the author, see the AUTHOR file
20 /*********************************************************************/
21 
25 
26 #ifndef ENTREPOT_LIBCURL_HPP
27 #define ENTREPOT_LIBCURL_HPP
28 
29 #include "../my_config.h"
30 
31 extern "C"
32 {
33 }
34 
35 #include <string>
36 #include <deque>
37 #include "entrepot.hpp"
38 #include "secu_string.hpp"
39 #include "mycurl_protocol.hpp"
40 
41 namespace libdar
42 {
43 
46 
48 
49  class entrepot_libcurl : public entrepot
50  {
51  public:
52  entrepot_libcurl(const std::shared_ptr<user_interaction> & dialog,
53  mycurl_protocol proto,
54  const std::string & login,
55  const secu_string & password,
56  const std::string & host,
57  const std::string & port,
58  bool auth_from_file,
59  const std::string & sftp_pub_keyfile,
60  const std::string & sftp_prv_keyfile,
61  const std::string & sftp_known_hosts,
62  U_I waiting_time,
63  bool verbose = false
64  );
65 
66  entrepot_libcurl(const entrepot_libcurl & ref) = default;
67  entrepot_libcurl(entrepot_libcurl && ref) noexcept = default;
68  entrepot_libcurl & operator = (const entrepot_libcurl & ref) = default;
69  entrepot_libcurl & operator = (entrepot_libcurl && ref) noexcept = default;
70  ~entrepot_libcurl() throw () {};
71 
72 
73  // inherited from class entrepot
74 
75  virtual void set_location(const path & chemin) override;
76  virtual void set_root(const path & p_root) override;
77  virtual path get_full_path() const override;
80  virtual std::string get_url() const override;
81  virtual const path & get_location() const override;
82  virtual const path & get_root() const override;
83  virtual void read_dir_reset() const override;
84  virtual bool read_dir_next(std::string & filename) const override;
85  virtual entrepot *clone() const override { return new (std::nothrow) entrepot_libcurl(*this); };
86 
87  protected:
88 
89  // inherited from class entrepot
90 
91  virtual fichier_global *inherited_open(const std::shared_ptr<user_interaction> & dialog,
92  const std::string & filename,
93  gf_mode mode,
94  bool force_permission,
95  U_I permission,
96  bool fail_if_exists,
97  bool erase) const override;
98 
99  virtual void inherited_unlink(const std::string & filename) const override;
100  virtual void read_dir_flush() override;
101 
102  private:
103 #if defined ( LIBCURL_AVAILABLE ) && defined ( LIBTHREADAR_AVAILABLE )
104  class i_entrepot_libcurl;
105  std::shared_ptr<i_entrepot_libcurl> pimpl;
106 #endif
107  };
108 
110 
111 } // end of namespace
112 
113 #endif
for managing archive into a remote repository
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
virtual void set_root(const path &p_root) override
defines the root to use if set_location is given a relative path
virtual void set_location(const path &chemin) override
defines the directory where to proceed to future open() – this is a "chdir" semantics
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
the Entrepot interface
Definition: entrepot.hpp:56
abstraction of filesystem files for entrepot
the class path is here to manipulate paths in the Unix notation: using'/'
Definition: path.hpp:51
class secu_string
Definition: secu_string.hpp:54
defines the entrepot interface.
mycurl_protocol
libcurl protocols supported by libdar
gf_mode
generic_file openning modes
Definition: gf_mode.hpp:44
datastructure defining the network protocols available for entrepot_libcurl class
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47
this file contains the definition of secu_string class, a std::string like class but allocated in sec...