| Disk ARchive 2.8.1 Full featured and portable backup and archiving tool

Loading...
Searching...
No Matches
entrepot_libcurl.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2025 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
31extern "C"
32{
33}
34
35#include <string>
36#include <deque>
37#include "entrepot.hpp"
38#include "secu_string.hpp"
39#include "remote_entrepot_api.hpp"
40
41namespace 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 remote_entrepot_type 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 change_user_interaction(const std::shared_ptr<user_interaction> & new_dialog) override;
84 virtual std::shared_ptr<user_interaction> get_current_user_interaction() const override;
85 virtual void read_dir_reset() const override;
86 virtual bool read_dir_next(std::string & filename) const override;
87 virtual void read_dir_reset_dirinfo() const override;
88 virtual bool read_dir_next_dirinfo(std::string & filename, inode_type & tp) const override;
89
90 virtual void create_dir(const std::string & dirname, U_I permission) override;
91
92 virtual entrepot *clone() const override { return new (std::nothrow) entrepot_libcurl(*this); };
93
94 protected:
95
96 // inherited from class entrepot
97
98 virtual fichier_global *inherited_open(const std::shared_ptr<user_interaction> & dialog,
99 const std::string & filename,
100 gf_mode mode,
101 bool force_permission,
102 U_I permission,
103 bool fail_if_exists,
104 bool erase) const override;
105
106 virtual void inherited_unlink(const std::string & filename) const override;
107 virtual void read_dir_flush() const override;
108
109 private:
110#if defined ( LIBCURL_AVAILABLE ) && defined ( LIBTHREADAR_AVAILABLE )
111 class i_entrepot_libcurl;
112 std::shared_ptr<i_entrepot_libcurl> pimpl;
113#endif
114 };
115
117
118} // end of namespace
119
120#endif
libdar::entrepot_libcurl
for managing archive into a remote repository
Definition entrepot_libcurl.hpp:50
libdar::entrepot_libcurl::read_dir_flush
virtual void read_dir_flush() const override
ends the read_dir_next, (no more entry available)
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::entrepot_libcurl::read_dir_next_dirinfo
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
libdar::entrepot_libcurl::read_dir_next
virtual bool read_dir_next(std::string &filename) const override
read the next filename of the current directory
libdar::entrepot_libcurl::change_user_interaction
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)
libdar::entrepot_libcurl::get_full_path
virtual path get_full_path() const override
returns the full path of location
libdar::entrepot_libcurl::get_current_user_interaction
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...
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::entrepot_libcurl::create_dir
virtual void create_dir(const std::string &dirname, U_I permission) override
create a new directory in the current directory
libdar::entrepot_libcurl::read_dir_reset_dirinfo
virtual void read_dir_reset_dirinfo() const override
routines to read existing files with dir information
libdar::entrepot_libcurl::entrepot_libcurl
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)
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::clone
virtual entrepot * clone() const override
done this way for homogeneity with open/inherited_open
Definition entrepot_libcurl.hpp:92
libdar::entrepot_libcurl::get_root
virtual const path & get_root() const override
retreives relative to root path the current location points to
libdar::entrepot_libcurl::get_url
virtual std::string get_url() const override
libdar::entrepot
the Entrepot interface
Definition entrepot.hpp:57
libdar::fichier_global
abstraction of filesystem files for entrepot
Definition fichier_global.hpp:59
libdar::path
the class path is here to manipulate paths in the Unix notation: using'/'
Definition path.hpp:51
libdar::secu_string
class secu_string
Definition secu_string.hpp:54
entrepot.hpp
defines the entrepot interface.
libdar::remote_entrepot_type
remote_entrepot_type
type of entrepot to create
Definition remote_entrepot_api.hpp:44
libdar::inode_type
inode_type
type of inode
Definition entrepot_aux.hpp:42
libdar::gf_mode
gf_mode
generic_file openning modes
Definition gf_mode.hpp:44
my_config.h
include macro defined by the configure script and some specific additional ones
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47
remote_entrepot_api.hpp
Libdar API to create entrepot objects.
secu_string.hpp
this file contains the definition of secu_string class, a std::string like class but allocated in sec...