| Disk ARchive 2.6.12 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-2020 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 : http://dar.linux.free.fr/email.html
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 #if LIBCURL_AVAILABLE
34 #if HAVE_CURL_CURL_H
35 #include <curl/curl.h>
36 #endif
37 #endif
38 }
39
40 #include <string>
41 #include <deque>
42 #include "entrepot.hpp"
43 #include "secu_string.hpp"
44 #include "mycurl_protocol.hpp"
45
46 namespace libdar
47 {
48
51
53
54 class entrepot_libcurl : public entrepot
55 {
56 public:
57 entrepot_libcurl(const std::shared_ptr<user_interaction> & dialog,
58 mycurl_protocol proto,
59 const std::string & login,
60 const secu_string & password,
61 const std::string & host,
62 const std::string & port,
63 bool auth_from_file,
64 const std::string & sftp_pub_keyfile,
65 const std::string & sftp_prv_keyfile,
66 const std::string & sftp_known_hosts,
67 U_I waiting_time
68 );
69 entrepot_libcurl(const entrepot_libcurl & ref) = default;
70 entrepot_libcurl(entrepot_libcurl && ref) noexcept = default;
71 entrepot_libcurl & operator = (const entrepot_libcurl & ref) = default;
72 entrepot_libcurl & operator = (entrepot_libcurl && ref) noexcept = default;
73 ~entrepot_libcurl() throw () {};
74
75
76 // inherited from class entrepot
77
78 virtual void set_location(const path & chemin) override;
79 virtual void set_root(const path & p_root) override;
80 virtual path get_full_path() const override;
83 virtual std::string get_url() const override;
84 virtual const path & get_location() const override;
85 virtual const path & get_root() const override;
86 virtual void read_dir_reset() const override;
87 virtual bool read_dir_next(std::string & filename) const override;
88 virtual entrepot *clone() const override { return new (std::nothrow) entrepot_libcurl(*this); };
89
90 protected:
91
92 // inherited from class entrepot
93
94 virtual fichier_global *inherited_open(const std::shared_ptr<user_interaction> & dialog,
95 const std::string & filename,
96 gf_mode mode,
97 bool force_permission,
98 U_I permission,
99 bool fail_if_exists,
100 bool erase) const override;
101
102 virtual void inherited_unlink(const std::string & filename) const override;
103 virtual void read_dir_flush() override;
104
105 private:
106 #if defined ( LIBCURL_AVAILABLE ) && defined ( LIBTHREADAR_AVAILABLE )
107 class i_entrepot_libcurl;
108 std::shared_ptr<i_entrepot_libcurl> pimpl;
109 #endif
110 };
111
113
114 } // end of namespace
115
116 #endif
libdar::entrepot_libcurl::set_location
virtual void set_location(const path &chemin) override
defines the directory where to proceed to future open() – this is a "chdir" semantics
libdar::entrepot_libcurl
for managing archive into a remote repository
Definition: entrepot_libcurl.hpp:55
libdar::entrepot_libcurl::get_full_path
virtual path get_full_path() const override
returns the full path of location
libdar::entrepot_libcurl::clone
virtual entrepot * clone() const override
generate a clone of "this"
Definition: entrepot_libcurl.hpp:88
libdar::gf_mode
gf_mode
generic_file openning modes
Definition: gf_mode.hpp:44
mycurl_protocol.hpp
datastructure defining the network protocols available for entrepot_libcurl class
libdar::entrepot_libcurl::entrepot_libcurl
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)
entrepot.hpp
defines the entrepot interface. Entrepot interface defines a generic way to interact with files (slic...
libdar::entrepot_libcurl::get_url
virtual std::string get_url() const override
libdar::path
the class path is here to manipulate paths in the Unix notation: using'/'
Definition: path.hpp:51
secu_string.hpp
this file contains the definition of secu_string class, a std::string like class but allocated in sec...
libdar::entrepot_libcurl::set_root
virtual void set_root(const path &p_root) override
defines the root to use if set_location is given a relative path
libdar::mycurl_protocol
mycurl_protocol
libcurl protocols supported by libdar
Definition: mycurl_protocol.hpp:49
libdar::entrepot
the Entrepot interface
Definition: entrepot.hpp:57
libdar::secu_string
class secu_string
Definition: secu_string.hpp:58
libdar::fichier_global
abstraction of filesystem files for entrepot
Definition: fichier_global.hpp:59
libdar::entrepot_libcurl::read_dir_reset
virtual void read_dir_reset() const override
routines to read existing files in the current directory (see set_location() / set_root() methods)
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47