Disk ARchive 2.7.15
Full featured and portable backup and archiving tool
archive_options.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 ARCHIVE_OPTIONS_HPP
27#define ARCHIVE_OPTIONS_HPP
28
29#include "../my_config.h"
30#include "crypto.hpp"
31#include "integers.hpp"
32#include "mask.hpp"
33#include "mask_list.hpp"
34#include "crit_action.hpp"
35#include "secu_string.hpp"
36#include "entrepot.hpp"
37#include "fsa_family.hpp"
39#include "archive_aux.hpp"
40#include "compression.hpp"
42#include "filesystem_ids.hpp"
43
44#include <string>
45#include <vector>
46#include <set>
47#include <memory>
48
49namespace libdar
50{
51 class archive; // needed to be able to use pointer on archive object.
52
53
57
60
61
63
65 {
66 public:
69
71 archive_options_read(const archive_options_read & ref) : x_ref_chem(ref.x_ref_chem) { copy_from(ref); };
73 archive_options_read & operator = (const archive_options_read & ref) { copy_from(ref); return *this; };
74 archive_options_read & operator = (archive_options_read && ref) noexcept { move_from(std::move(ref)); return *this; };
75 ~archive_options_read() = default;
76
77
79 // set back to default (this is the state just after the object is constructed
80 // this method is to be used to reuse a given object
81
83 void clear();
84
85
87 // setting methods
88
89
91
97 void set_crypto_algo(crypto_algo val) { x_crypto = val; };
98
100 void set_crypto_pass(const secu_string & pass) { x_pass = pass; };
101
103 void set_crypto_size(U_32 crypto_size) { x_crypto_size = crypto_size; };
104
107
109
112 void set_input_pipe(const std::string & input_pipe) { x_input_pipe = input_pipe; };
113
115
118 void set_output_pipe(const std::string & output_pipe) { x_output_pipe = output_pipe; };
119
121
131 void set_execute(const std::string & execute) { x_execute = execute; };
132
134 void set_info_details(bool info_details) { x_info_details = info_details; };
135
137
141 void set_lax(bool val) { x_lax = val; };
142
144
146
147 void set_sequential_read(bool val) { x_sequential_read = val; };
148
150
151 void set_slice_min_digits(infinint val) { x_slice_min_digits = val; };
152
153
155 void set_entrepot(const std::shared_ptr<entrepot> & entr) { if(!entr) throw Erange("archive_options_read::set_entrepot", "null entrepot pointer given in argument"); x_entrepot = entr; };
156
158 void set_ignore_signature_check_failure(bool val) { x_ignore_signature_check_failure = val; };
159
161
164 void set_multi_threaded(bool val) { x_multi_threaded_crypto = 2; x_multi_threaded_compress = 2; };
165
167 void set_multi_threaded_crypto(U_I num) { x_multi_threaded_crypto = num; };
168
170 void set_multi_threaded_compress(U_I num) { x_multi_threaded_compress = num; };
171
172
174
176 void set_external_catalogue(const path & ref_chem, const std::string & ref_basename) { x_ref_chem = ref_chem, x_ref_basename = ref_basename; external_cat = true; };
179
181 void set_ref_crypto_algo(crypto_algo ref_crypto) { x_ref_crypto = ref_crypto; };
182
184 void set_ref_crypto_pass(const secu_string & ref_pass) { x_ref_pass = ref_pass; };
185
187 void set_ref_crypto_size(U_32 ref_crypto_size) { x_ref_crypto_size = ref_crypto_size; };
188
190
200 void set_ref_execute(const std::string & ref_execute) { x_ref_execute = ref_execute; };
201
202
204
205 void set_ref_slice_min_digits(infinint val) { x_ref_slice_min_digits = val; };
206
208 void set_ref_entrepot(const std::shared_ptr<entrepot> & entr) { if(!entr) throw Erange("archive_options_read::set_ref_entrepot", "null entrepot pointer given in argument"); x_ref_entrepot = entr; };
209
211 void set_header_only(bool val) { x_header_only = val; };
212
213
214
216 // getting methods (mainly used inside libdar, but kept public and part of the API in the case it is needed)
217
218
219 crypto_algo get_crypto_algo() const { return x_crypto; };
220 const secu_string & get_crypto_pass() const { return x_pass; };
221 U_32 get_crypto_size() const { return x_crypto_size; };
222 const std::string & get_input_pipe() const { return x_input_pipe; };
223 const std::string & get_output_pipe() const { return x_output_pipe; };
224 const std::string & get_execute() const { return x_execute; };
225 bool get_info_details() const { return x_info_details; };
226 bool get_lax() const { return x_lax; };
227 bool get_sequential_read() const { return x_sequential_read; };
228 infinint get_slice_min_digits() const { return x_slice_min_digits; };
229 const std::shared_ptr<entrepot> & get_entrepot() const { return x_entrepot; };
230 bool get_ignore_signature_check_failure() const { return x_ignore_signature_check_failure; };
231 U_I get_multi_threaded_crypto() const { return x_multi_threaded_crypto; };
232 U_I get_multi_threaded_compress() const { return x_multi_threaded_compress; };
233
234 // All methods that follow concern the archive where to fetch the (isolated) catalogue from
235 bool is_external_catalogue_set() const { return external_cat; };
236 const path & get_ref_path() const;
237 const std::string & get_ref_basename() const;
238 crypto_algo get_ref_crypto_algo() const { return x_ref_crypto; };
239 const secu_string & get_ref_crypto_pass() const { return x_ref_pass; };
240 U_32 get_ref_crypto_size() const { return x_ref_crypto_size; };
241 const std::string & get_ref_execute() const { return x_ref_execute; };
242 infinint get_ref_slice_min_digits() const { return x_ref_slice_min_digits; };
243 const std::shared_ptr<entrepot> & get_ref_entrepot() const { return x_ref_entrepot; };
244 bool get_header_only() const { return x_header_only; };
245
246
247 private:
248 crypto_algo x_crypto;
249 secu_string x_pass;
250 U_32 x_crypto_size;
251 std::string x_input_pipe;
252 std::string x_output_pipe;
253 std::string x_execute;
254 bool x_info_details;
255 bool x_lax;
256 bool x_sequential_read;
257 infinint x_slice_min_digits;
258 std::shared_ptr<entrepot> x_entrepot;
259 bool x_ignore_signature_check_failure;
260 U_I x_multi_threaded_crypto;
261 U_I x_multi_threaded_compress;
262
263
264 // external catalogue relative fields
265 bool external_cat;
266 path x_ref_chem;
267 std::string x_ref_basename;
268 crypto_algo x_ref_crypto;
269 secu_string x_ref_pass;
270 U_32 x_ref_crypto_size;
271 std::string x_ref_execute;
272 infinint x_ref_slice_min_digits;
273 std::shared_ptr<entrepot> x_ref_entrepot;
274 bool x_header_only;
275
276 void copy_from(const archive_options_read & ref);
277 void move_from(archive_options_read && ref) noexcept;
278 };
279
280
284
286
288 {
289 public:
290 // default constructors and destructor.
291
294 archive_options_create(archive_options_create && ref) noexcept { nullifyptr(); move_from(std::move(ref)); };
295 archive_options_create & operator = (const archive_options_create & ref) { destroy(); copy_from(ref); return *this; };
296 archive_options_create & operator = (archive_options_create && ref) noexcept { move_from(std::move(ref)); return *this; };
297 ~archive_options_create() { destroy(); };
298
300 // set back to default (this is the state just after the object is constructed
301 // this method is to be used to reuse a given object
302
304 void clear();
305
306
308 // setting methods
309
311 void set_reference(std::shared_ptr<archive> ref_arch) { x_ref_arch = ref_arch; };
312
314 void set_selection(const mask & selection);
315
317
325 void set_subtree(const mask & subtree);
326
328 void set_allow_over(bool allow_over) { x_allow_over = allow_over; };
329
331 void set_warn_over(bool warn_over) { x_warn_over = warn_over; };
332
334
339 void set_info_details(bool info_details) { x_info_details = info_details; };
340
342
345 void set_display_treated(bool display_treated, bool only_dir) { x_display_treated = display_treated; x_display_treated_only_dir = only_dir; };
346
348 void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; };
349
351 void set_display_finished(bool display_finished) { x_display_finished = display_finished; };
352
354 void set_pause(const infinint & pause) { x_pause = pause; };
355
357 void set_empty_dir(bool empty_dir) { x_empty_dir = empty_dir; };
358
360 void set_compression(compression compr_algo) { x_compr_algo = compr_algo; };
361
363 void set_compression_level(U_I compression_level) { x_compression_level = compression_level; };
364
366
375 void set_compression_block_size(U_I compression_block_size) { x_compression_block_size = compression_block_size; };
376
378
382 void set_slicing(const infinint & file_size, const infinint & first_file_size = 0)
383 {
384 x_file_size = file_size;
385 if(first_file_size.is_zero())
386 x_first_file_size = file_size;
387 else
388 x_first_file_size = first_file_size;
389 };
390
391
393 void set_ea_mask(const mask & ea_mask);
394
396
406 void set_execute(const std::string & execute) { x_execute = execute; };
407
409 void set_crypto_algo(crypto_algo crypto) { x_crypto = crypto; };
410
413 void set_crypto_pass(const secu_string & pass) { x_pass = pass; };
414
416 void set_crypto_size(U_32 crypto_size) { x_crypto_size = crypto_size; };
417
419
427 void set_gnupg_recipients(const std::vector<std::string> & gnupg_recipients) { x_gnupg_recipients = gnupg_recipients; };
428
429
433 void set_gnupg_signatories(const std::vector<std::string> & gnupg_signatories) { x_gnupg_signatories = gnupg_signatories; };
434
436 void set_compr_mask(const mask & compr_mask);
437
439 void set_min_compr_size(const infinint & min_compr_size) { x_min_compr_size = min_compr_size; };
440
442 void set_nodump(bool nodump) { x_nodump = nodump; };
443
446 void set_exclude_by_ea(const std::string & ea_name)
447 { exclude_by_ea = (ea_name == "" ? "user.libdar_no_backup" : ea_name); };
448
450 void set_what_to_check(comparison_fields what_to_check) { x_what_to_check = what_to_check; };
451
453 void set_hourshift(const infinint & hourshift) { x_hourshift = hourshift; };
454
456 void set_empty(bool empty) { x_empty = empty; };
457
459
462 void set_alter_atime(bool alter_atime)
463 {
464 if(x_furtive_read)
465 x_old_alter_atime = alter_atime;
466 else
467 x_alter_atime = alter_atime;
468 };
469
472
474
477 void set_same_fs(bool same_fs) { x_same_fs = same_fs; x_same_fs_include.clear(); x_same_fs_exclude.clear(); };
478
480
482 void set_same_fs_include(const std::string & included_path_to_fs) { x_same_fs_include.push_back(included_path_to_fs); };
483
485
487 void set_same_fs_exclude(const std::string & excluded_path_to_fs) { x_same_fs_exclude.push_back(excluded_path_to_fs); };
488
490 void set_snapshot(bool snapshot) { x_snapshot = snapshot; };
491
493 void set_cache_directory_tagging(bool cache_directory_tagging) { x_cache_directory_tagging = cache_directory_tagging; };
494
496 void set_fixed_date(const infinint & fixed_date) { x_fixed_date = fixed_date; };
497
499 void set_slice_permission(const std::string & slice_permission) { x_slice_permission = slice_permission; };
500
502 void set_slice_user_ownership(const std::string & slice_user_ownership) { x_slice_user_ownership = slice_user_ownership; };
503
505 void set_slice_group_ownership(const std::string & slice_group_ownership) { x_slice_group_ownership = slice_group_ownership; };
506
508 void set_retry_on_change(const infinint & count_max_per_file, const infinint & global_max_byte_overhead = 0) { x_repeat_count = count_max_per_file; x_repeat_byte = global_max_byte_overhead; };
509
511 void set_sequential_marks(bool sequential) { x_sequential_marks = sequential; };
512
514 void set_sparse_file_min_size(const infinint & size) { x_sparse_file_min_size = size; };
515
517 void set_security_check(bool check) { x_security_check = check; };
518
520 void set_user_comment(const std::string & comment) { x_user_comment = comment; };
521
523
527
529 void set_slice_min_digits(infinint val) { x_slice_min_digits = val; };
530
532 void set_backup_hook(const std::string & execute, const mask & which_files);
533
535 void set_ignore_unknown_inode_type(bool val) { x_ignore_unknown = val; };
536
538 void set_entrepot(const std::shared_ptr<entrepot> & entr) { if(!entr) throw Erange("archive_options_create::set_entrepot", "null entrepot pointer given in argument"); x_entrepot = entr; };
539
541 void set_fsa_scope(const fsa_scope & scope) { x_scope = scope; };
542
544
547 void set_multi_threaded(bool val) { x_multi_threaded_crypto = 2; x_multi_threaded_compress = 2; };
548
550 void set_multi_threaded_crypto(U_I num) { x_multi_threaded_crypto = num; };
551
553 void set_multi_threaded_compress(U_I num) { x_multi_threaded_compress = num; };
554
556
558 void set_delta_diff(bool val) { if(val && !compile_time::librsync()) throw Ecompilation("librsync"); x_delta_diff = val; };
559
561 void set_delta_signature(bool val) { x_delta_signature = val; };
562
564 void set_delta_mask(const mask & delta_mask);
565
567
569 void set_delta_sig_min_size(const infinint & val) { x_delta_sig_min_size = val; };
570
572 void set_auto_zeroing_neg_dates(bool val) { x_auto_zeroing_neg_dates = val; };
573
575
578 void set_ignored_as_symlink(const std::set<std::string> & list) { x_ignored_as_symlink = list; };
579
581
582 void set_modified_data_detection(modified_data_detection val) { x_modified_data_detection = val; };
583
585 void set_iteration_count(const infinint & val) { x_iteration_count = val; };
586
588 void set_kdf_hash(hash_algo algo) { x_kdf_hash = algo; };
589
591 void set_sig_block_len(delta_sig_block_size val) { val.check(); x_sig_block_len = val; };
592
593
595 // getting methods
596
597 std::shared_ptr<archive> get_reference() const { return x_ref_arch; };
598 const mask & get_selection() const { if(x_selection == nullptr) throw SRC_BUG; return *x_selection; };
599 const mask & get_subtree() const { if(x_subtree == nullptr) throw SRC_BUG; return *x_subtree; };
600 bool get_allow_over() const { return x_allow_over; };
601 bool get_warn_over() const { return x_warn_over; };
602 bool get_info_details() const { return x_info_details; };
603 bool get_display_treated() const { return x_display_treated; };
604 bool get_display_treated_only_dir() const { return x_display_treated_only_dir; };
605 bool get_display_skipped() const { return x_display_skipped; };
606 bool get_display_finished() const { return x_display_finished; };
607 const infinint & get_pause() const { return x_pause; };
608 bool get_empty_dir() const { return x_empty_dir; };
609 compression get_compression() const { return x_compr_algo; };
610 U_I get_compression_level() const { return x_compression_level; };
611 U_I get_compression_block_size() const { return x_compression_block_size; };
612 const infinint & get_slice_size() const { return x_file_size; };
613 const infinint & get_first_slice_size() const { return x_first_file_size; };
614 const mask & get_ea_mask() const { if(x_ea_mask == nullptr) throw SRC_BUG; return *x_ea_mask; };
615 const std::string & get_execute() const { return x_execute; };
616 crypto_algo get_crypto_algo() const { return x_crypto; };
617 const secu_string & get_crypto_pass() const { return x_pass; };
618 U_32 get_crypto_size() const { return x_crypto_size; };
619 const std::vector<std::string> & get_gnupg_recipients() const { return x_gnupg_recipients; };
620 const std::vector<std::string> & get_gnupg_signatories() const { return x_gnupg_signatories; };
621 const mask & get_compr_mask() const { if(x_compr_mask == nullptr) throw SRC_BUG; return *x_compr_mask; };
622 const infinint & get_min_compr_size() const { return x_min_compr_size; };
623 bool get_nodump() const { return x_nodump; };
624 const std::string & get_exclude_by_ea() const { return exclude_by_ea; };
625 comparison_fields get_comparison_fields() const { return x_what_to_check; };
626 const infinint & get_hourshift() const { return x_hourshift; };
627 bool get_empty() const { return x_empty; };
628 bool get_alter_atime() const { return x_alter_atime; };
629 bool get_furtive_read_mode() const { return x_furtive_read; };
630 bool get_same_fs() const { return x_same_fs; };
631 std::deque<std::string> get_same_fs_include() const { return x_same_fs_include; };
632 std::deque<std::string> get_same_fs_exclude() const { return x_same_fs_exclude; };
633 bool get_snapshot() const { return x_snapshot; };
634 bool get_cache_directory_tagging() const { return x_cache_directory_tagging; };
635 const infinint & get_fixed_date() const { return x_fixed_date; };
636 const std::string & get_slice_permission() const { return x_slice_permission; };
637 const std::string & get_slice_user_ownership() const { return x_slice_user_ownership; };
638 const std::string & get_slice_group_ownership() const { return x_slice_group_ownership; };
639 const infinint & get_repeat_count() const { return x_repeat_count; };
640 const infinint & get_repeat_byte() const { return x_repeat_byte; };
641 bool get_sequential_marks() const { return x_sequential_marks; };
642 infinint get_sparse_file_min_size() const { return x_sparse_file_min_size; };
643 bool get_security_check() const { return x_security_check; };
644 const std::string & get_user_comment() const { return x_user_comment; };
645 hash_algo get_hash_algo() const { return x_hash; };
646 infinint get_slice_min_digits() const { return x_slice_min_digits; };
647 const std::string & get_backup_hook_file_execute() const { return x_backup_hook_file_execute; };
648 const mask & get_backup_hook_file_mask() const { return *x_backup_hook_file_mask; };
649 bool get_ignore_unknown_inode_type() const { return x_ignore_unknown; };
650 const std::shared_ptr<entrepot> & get_entrepot() const { return x_entrepot; };
651 const fsa_scope & get_fsa_scope() const { return x_scope; };
652 U_I get_multi_threaded_crypto() const { return x_multi_threaded_crypto; };
653 U_I get_multi_threaded_compress() const { return x_multi_threaded_compress; };
654 bool get_delta_diff() const { return x_delta_diff; };
655 bool get_delta_signature() const { return x_delta_signature; };
656 const mask & get_delta_mask() const { return *x_delta_mask; }
657 bool get_has_delta_mask_been_set() const { return has_delta_mask_been_set; };
658 const infinint & get_delta_sig_min_size() const { return x_delta_sig_min_size; };
659 bool get_auto_zeroing_neg_dates() const { return x_auto_zeroing_neg_dates; };
660 const std::set<std::string> & get_ignored_as_symlink() const { return x_ignored_as_symlink; };
661 modified_data_detection get_modified_data_detection() const { return x_modified_data_detection; };
662 const infinint & get_iteration_count() const { return x_iteration_count; };
663 hash_algo get_kdf_hash() const { return x_kdf_hash; };
664 delta_sig_block_size get_sig_block_len() const { return x_sig_block_len; };
665
666 private:
667 std::shared_ptr<archive> x_ref_arch;
670 bool x_allow_over;
671 bool x_warn_over;
672 bool x_info_details;
673 bool x_display_treated;
674 bool x_display_treated_only_dir;
675 bool x_display_skipped;
676 bool x_display_finished;
677 infinint x_pause;
678 bool x_empty_dir;
679 compression x_compr_algo;
680 U_I x_compression_level;
681 U_I x_compression_block_size;
682 infinint x_file_size;
683 infinint x_first_file_size;
685 std::string x_execute;
686 crypto_algo x_crypto;
687 secu_string x_pass;
688 U_32 x_crypto_size;
689 std::vector<std::string> x_gnupg_recipients;
690 std::vector<std::string> x_gnupg_signatories;
692 infinint x_min_compr_size;
693 bool x_nodump;
694 std::string exclude_by_ea;
695 comparison_fields x_what_to_check;
696 infinint x_hourshift;
697 bool x_empty;
698 bool x_alter_atime;
700 bool x_furtive_read;
701 bool x_same_fs;
702 std::deque<std::string> x_same_fs_include;
703 std::deque<std::string> x_same_fs_exclude;
704 bool x_snapshot;
705 bool x_cache_directory_tagging;
706 infinint x_fixed_date;
707 std::string x_slice_permission;
708 std::string x_slice_user_ownership;
709 std::string x_slice_group_ownership;
710 infinint x_repeat_count;
711 infinint x_repeat_byte;
712 bool x_sequential_marks;
713 infinint x_sparse_file_min_size;
714 bool x_security_check;
715 std::string x_user_comment;
716 hash_algo x_hash;
717 infinint x_slice_min_digits;
718 mask * x_backup_hook_file_mask;
719 std::string x_backup_hook_file_execute;
720 bool x_ignore_unknown;
721 std::shared_ptr<entrepot> x_entrepot;
722 fsa_scope x_scope;
723 U_I x_multi_threaded_crypto;
724 U_I x_multi_threaded_compress;
725 bool x_delta_diff;
726 bool x_delta_signature;
727 mask *x_delta_mask;
728 bool has_delta_mask_been_set;
729 infinint x_delta_sig_min_size;
730 bool x_auto_zeroing_neg_dates;
731 std::set<std::string> x_ignored_as_symlink;
732 modified_data_detection x_modified_data_detection;
733 infinint x_iteration_count;
734 hash_algo x_kdf_hash;
735 delta_sig_block_size x_sig_block_len;
736
737 void nullifyptr() noexcept;
738 void destroy() noexcept;
739 void copy_from(const archive_options_create & ref);
740 void move_from(archive_options_create && ref) noexcept;
741 void destroy_mask(mask * & ptr);
742 void clean_mask(mask * & ptr);
743 void check_mask(const mask & m);
744 };
745
746
747
748
749
750
754
756
758 {
759 public:
762 archive_options_isolate(archive_options_isolate && ref) noexcept { nullifyptr(); move_from(std::move(ref)); };
763 archive_options_isolate & operator = (const archive_options_isolate & ref) { destroy(); copy_from(ref); return *this; };
764 archive_options_isolate & operator = (archive_options_isolate && ref) noexcept { move_from(std::move(ref)); return *this; };
765 ~archive_options_isolate() { destroy(); };
766
767
768 void clear();
769
771 // setting methods
772
774 void set_allow_over(bool allow_over) { x_allow_over = allow_over; };
775
777 void set_warn_over(bool warn_over) { x_warn_over = warn_over; };
778
780 void set_info_details(bool info_details) { x_info_details = info_details; };
781
783 void set_pause(const infinint & pause) { x_pause = pause; };
784
786 void set_compression(compression algo) { x_algo = algo; };
787
789 void set_compression_level(U_I compression_level) { x_compression_level = compression_level; };
790
792
793 void set_compression_block_size(U_I compression_block_size) { x_compression_block_size = compression_block_size; };
794
796
800 void set_slicing(const infinint & file_size, const infinint & first_file_size = 0)
801 {
802 x_file_size = file_size;
803 if(first_file_size.is_zero())
804 x_first_file_size = file_size;
805 else
806 x_first_file_size = first_file_size;
807 };
808
810
820 void set_execute(const std::string & execute) { x_execute = execute; };
821
823 void set_crypto_algo(crypto_algo crypto) { x_crypto = crypto; };
824
826 void set_crypto_pass(const secu_string & pass) { x_pass = pass; };
827
829 void set_crypto_size(U_32 crypto_size) { x_crypto_size = crypto_size; };
830
835 void set_gnupg_recipients(const std::vector<std::string> & gnupg_recipients) { x_gnupg_recipients = gnupg_recipients; };
836
840 void set_gnupg_signatories(const std::vector<std::string> & gnupg_signatories) { x_gnupg_signatories = gnupg_signatories; };
841
843 void set_empty(bool empty) { x_empty = empty; };
844
846 void set_slice_permission(const std::string & slice_permission) { x_slice_permission = slice_permission; };
847
849 void set_slice_user_ownership(const std::string & slice_user_ownership) { x_slice_user_ownership = slice_user_ownership; };
850
852 void set_slice_group_ownership(const std::string & slice_group_ownership) { x_slice_group_ownership = slice_group_ownership; };
853
855 void set_user_comment(const std::string & comment) { x_user_comment = comment; };
856
859
861 void set_slice_min_digits(infinint val) { x_slice_min_digits = val; };
862
864 void set_sequential_marks(bool sequential) { x_sequential_marks = sequential; };
865
867 void set_entrepot(const std::shared_ptr<entrepot> & entr) { if(!entr) throw Erange("archive_options_isolated::set_entrepot", "null entrepot pointer given in argument"); x_entrepot = entr; };
868
870
873 void set_multi_threaded(bool val) { x_multi_threaded_crypto = 2; x_multi_threaded_compress = 2; };
874
876 void set_multi_threaded_crypto(U_I num) { x_multi_threaded_crypto = num; };
877
879 void set_multi_threaded_compress(U_I num) { x_multi_threaded_compress = num; };
880
881
883 void set_delta_signature(bool val) { x_delta_signature = val; };
884
886 void set_delta_mask(const mask & delta_mask);
887
891 void set_delta_sig_min_size(const infinint & val) { x_delta_sig_min_size = val; };
892
894 void set_iteration_count(const infinint & val) { x_iteration_count = val; };
895
897 void set_kdf_hash(hash_algo algo) { x_kdf_hash = algo; };
898
900 void set_sig_block_len(delta_sig_block_size val) { val.check(); x_sig_block_len = val; };
901
903 // getting methods
904
905 bool get_allow_over() const { return x_allow_over; };
906 bool get_warn_over() const { return x_warn_over; };
907 bool get_info_details() const { return x_info_details; };
908 const infinint & get_pause() const { return x_pause; };
909 compression get_compression() const { return x_algo; };
910 U_I get_compression_level() const { return x_compression_level; };
911 U_I get_compression_block_size() const { return x_compression_block_size; };
912 const infinint & get_slice_size() const { return x_file_size; };
913 const infinint & get_first_slice_size() const { return x_first_file_size; };
914 const std::string & get_execute() const { return x_execute; };
915 crypto_algo get_crypto_algo() const { return x_crypto; };
916 const secu_string & get_crypto_pass() const { return x_pass; };
917 U_32 get_crypto_size() const { return x_crypto_size; };
918 const std::vector<std::string> & get_gnupg_recipients() const { return x_gnupg_recipients; };
919 const std::vector<std::string> & get_gnupg_signatories() const { return x_gnupg_signatories; };
920 bool get_empty() const { return x_empty; };
921 const std::string & get_slice_permission() const { return x_slice_permission; };
922 const std::string & get_slice_user_ownership() const { return x_slice_user_ownership; };
923 const std::string & get_slice_group_ownership() const { return x_slice_group_ownership; };
924 const std::string & get_user_comment() const { return x_user_comment; };
925 hash_algo get_hash_algo() const { return x_hash; };
926 infinint get_slice_min_digits() const { return x_slice_min_digits; };
927 bool get_sequential_marks() const { return x_sequential_marks; };
928 const std::shared_ptr<entrepot> & get_entrepot() const { return x_entrepot; };
929 U_I get_multi_threaded_crypto() const { return x_multi_threaded_crypto; };
930 U_I get_multi_threaded_compress() const { return x_multi_threaded_compress; };
931 bool get_delta_signature() const { return x_delta_signature; };
932 const mask & get_delta_mask() const { return *x_delta_mask; }
933 bool get_has_delta_mask_been_set() const { return has_delta_mask_been_set; };
934 const infinint & get_delta_sig_min_size() const { return x_delta_sig_min_size; };
935 const infinint & get_iteration_count() const { return x_iteration_count; };
936 hash_algo get_kdf_hash() const { return x_kdf_hash; };
937 delta_sig_block_size get_sig_block_len() const { return x_sig_block_len; };
938
939
940 private:
941 bool x_allow_over;
942 bool x_warn_over;
943 bool x_info_details;
944 infinint x_pause;
945 compression x_algo;
946 U_I x_compression_level;
947 U_I x_compression_block_size;
948 infinint x_file_size;
949 infinint x_first_file_size;
950 std::string x_execute;
951 crypto_algo x_crypto;
952 secu_string x_pass;
953 U_32 x_crypto_size;
954 std::vector<std::string> x_gnupg_recipients;
955 std::vector<std::string> x_gnupg_signatories;
956 bool x_empty;
957 std::string x_slice_permission;
958 std::string x_slice_user_ownership;
959 std::string x_slice_group_ownership;
960 std::string x_user_comment;
961 hash_algo x_hash;
962 infinint x_slice_min_digits;
963 bool x_sequential_marks;
964 std::shared_ptr<entrepot> x_entrepot;
965 U_I x_multi_threaded_crypto;
966 U_I x_multi_threaded_compress;
967 bool x_delta_signature;
968 mask *x_delta_mask;
969 bool has_delta_mask_been_set;
970 infinint x_delta_sig_min_size;
971 infinint x_iteration_count;
972 hash_algo x_kdf_hash;
973 delta_sig_block_size x_sig_block_len;
974
975 void copy_from(const archive_options_isolate & ref);
976 void move_from(archive_options_isolate && ref) noexcept;
977 void destroy() noexcept;
978 void nullifyptr() noexcept;
979 };
980
981
982
986
989 {
990 public:
991
992 archive_options_merge() { nullifyptr(); clear(); };
993 archive_options_merge(const archive_options_merge & ref) { copy_from(ref); };
994 archive_options_merge(archive_options_merge && ref) noexcept { nullifyptr(); move_from(std::move(ref)); };
995 archive_options_merge & operator = (const archive_options_merge & ref) { destroy(); copy_from(ref); return *this; };
996 archive_options_merge & operator = (archive_options_merge && ref) noexcept { move_from(std::move(ref)); return *this; };
997 ~archive_options_merge() { destroy(); };
998
999 void clear();
1000
1002 // setting methods
1003
1004 void set_auxiliary_ref(std::shared_ptr<archive> ref) { x_ref = ref; };
1005
1007 void set_selection(const mask & selection);
1008
1010
1020 void set_subtree(const mask & subtree);
1021
1023 void set_allow_over(bool allow_over) { x_allow_over = allow_over; };
1024
1026 void set_warn_over(bool warn_over) { x_warn_over = warn_over; };
1027
1029 void set_overwriting_rules(const crit_action & overwrite);
1030
1032
1037 void set_info_details(bool info_details) { x_info_details = info_details; };
1038
1040
1043 void set_display_treated(bool display_treated, bool only_dir) { x_display_treated = display_treated; x_display_treated_only_dir = only_dir; };
1044
1046 void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; };
1047
1049 void set_pause(const infinint & pause) { x_pause = pause; };
1050
1052 void set_empty_dir(bool empty_dir) { x_empty_dir = empty_dir; };
1053
1055 void set_compression(compression compr_algo) { x_compr_algo = compr_algo; };
1056
1058 void set_compression_level(U_I compression_level) { x_compression_level = compression_level; };
1059
1061 void set_compression_block_size(U_I compression_block_size) { x_compression_block_size = compression_block_size; };
1062
1064
1068 void set_slicing(const infinint & file_size, const infinint & first_file_size = 0)
1069 {
1070 x_file_size = file_size;
1071 if(first_file_size.is_zero())
1072 x_first_file_size = file_size;
1073 else
1074 x_first_file_size = first_file_size;
1075 };
1076
1078 void set_ea_mask(const mask & ea_mask);
1079
1081
1091 void set_execute(const std::string & execute) { x_execute = execute; };
1092
1094 void set_crypto_algo(crypto_algo crypto) { x_crypto = crypto; };
1095
1098 void set_crypto_pass(const secu_string & pass) { x_pass = pass; };
1099
1101 void set_crypto_size(U_32 crypto_size) { x_crypto_size = crypto_size; };
1102
1107 void set_gnupg_recipients(const std::vector<std::string> & gnupg_recipients) { x_gnupg_recipients = gnupg_recipients; };
1108
1112 void set_gnupg_signatories(const std::vector<std::string> & gnupg_signatories) { x_gnupg_signatories = gnupg_signatories; };
1113
1115 void set_compr_mask(const mask & compr_mask);
1116
1118 void set_min_compr_size(const infinint & min_compr_size) { x_min_compr_size = min_compr_size; };
1119
1121 void set_empty(bool empty) { x_empty = empty; };
1122
1124 void set_keep_compressed(bool keep_compressed) { x_keep_compressed = keep_compressed; };
1125
1127 void set_slice_permission(const std::string & slice_permission) { x_slice_permission = slice_permission; };
1128
1130 void set_slice_user_ownership(const std::string & slice_user_ownership) { x_slice_user_ownership = slice_user_ownership; };
1131
1133 void set_slice_group_ownership(const std::string & slice_group_ownership) { x_slice_group_ownership = slice_group_ownership; };
1134
1136 void set_decremental_mode(bool mode) { x_decremental = mode; };
1137
1139 void set_sequential_marks(bool sequential) { x_sequential_marks = sequential; };
1140
1142 void set_sparse_file_min_size(const infinint & size) { x_sparse_file_min_size = size; };
1143
1145 void set_user_comment(const std::string & comment) { x_user_comment = comment; };
1146
1149
1151 void set_slice_min_digits(infinint val) { x_slice_min_digits = val; };
1152
1154 void set_entrepot(const std::shared_ptr<entrepot> & entr) { if(!entr) throw Erange("archive_options_merge::set_entrepot", "null entrepot pointer given in argument"); x_entrepot = entr; };
1155
1157 void set_fsa_scope(const fsa_scope & scope) { x_scope = scope; };
1158
1160
1163 void set_multi_threaded(bool val) { x_multi_threaded_crypto = 2; x_multi_threaded_compress = 2; };
1164
1166 void set_multi_threaded_crypto(U_I num) { x_multi_threaded_crypto = num; };
1167
1169 void set_multi_threaded_compress(U_I num) { x_multi_threaded_compress = num; };
1170
1176 void set_delta_signature(bool val) { x_delta_signature = val; };
1177
1179 void set_delta_mask(const mask & delta_mask);
1180
1182
1184 void set_delta_sig_min_size(const infinint & val) { x_delta_sig_min_size = val; };
1185
1187 void set_iteration_count(const infinint & val) { x_iteration_count = val; };
1188
1190 void set_kdf_hash(hash_algo algo) { x_kdf_hash = algo; };
1191
1193 void set_sig_block_len(delta_sig_block_size val) { val.check(); x_sig_block_len = val; };
1194
1195
1197 // getting methods
1198
1199 std::shared_ptr<archive> get_auxiliary_ref() const { return x_ref; };
1200 const mask & get_selection() const { if(x_selection == nullptr) throw SRC_BUG; return *x_selection; };
1201 const mask & get_subtree() const { if(x_subtree == nullptr) throw SRC_BUG; return *x_subtree; };
1202 bool get_allow_over() const { return x_allow_over; };
1203 bool get_warn_over() const { return x_warn_over; };
1204 const crit_action & get_overwriting_rules() const { if(x_overwrite == nullptr) throw SRC_BUG; return *x_overwrite; };
1205 bool get_info_details() const { return x_info_details; };
1206 bool get_display_treated() const { return x_display_treated; };
1207 bool get_display_treated_only_dir() const { return x_display_treated_only_dir; };
1208 bool get_display_skipped() const { return x_display_skipped; };
1209 const infinint & get_pause() const { return x_pause; };
1210 bool get_empty_dir() const { return x_empty_dir; };
1211 compression get_compression() const { return x_compr_algo; };
1212 U_I get_compression_level() const { return x_compression_level; };
1213 U_I get_compression_block_size() const { return x_compression_block_size; };
1214 const infinint & get_slice_size() const { return x_file_size; };
1215 const infinint & get_first_slice_size() const { return x_first_file_size; };
1216 const mask & get_ea_mask() const { if(x_ea_mask == nullptr) throw SRC_BUG; return *x_ea_mask; };
1217 const std::string & get_execute() const { return x_execute; };
1218 crypto_algo get_crypto_algo() const { return x_crypto; };
1219 const secu_string & get_crypto_pass() const { return x_pass; };
1220 U_32 get_crypto_size() const { return x_crypto_size; };
1221 const std::vector<std::string> & get_gnupg_recipients() const { return x_gnupg_recipients; };
1222 const std::vector<std::string> & get_gnupg_signatories() const { return x_gnupg_signatories; };
1223 const mask & get_compr_mask() const { if(x_compr_mask == nullptr) throw SRC_BUG; return *x_compr_mask; };
1224 const infinint & get_min_compr_size() const { return x_min_compr_size; };
1225 bool get_empty() const { return x_empty; };
1226 bool get_keep_compressed() const { return x_keep_compressed; };
1227 const std::string & get_slice_permission() const { return x_slice_permission; };
1228 const std::string & get_slice_user_ownership() const { return x_slice_user_ownership; };
1229 const std::string & get_slice_group_ownership() const { return x_slice_group_ownership; };
1230 bool get_decremental_mode() const { return x_decremental; };
1231 bool get_sequential_marks() const { return x_sequential_marks; };
1232 infinint get_sparse_file_min_size() const { return x_sparse_file_min_size; };
1233 const std::string & get_user_comment() const { return x_user_comment; };
1234 hash_algo get_hash_algo() const { return x_hash; };
1235 infinint get_slice_min_digits() const { return x_slice_min_digits; };
1236 const std::shared_ptr<entrepot> & get_entrepot() const { return x_entrepot; };
1237 const fsa_scope & get_fsa_scope() const { return x_scope; };
1238 U_I get_multi_threaded_crypto() const { return x_multi_threaded_crypto; };
1239 U_I get_multi_threaded_compress() const { return x_multi_threaded_compress; };
1240 bool get_delta_signature() const { return x_delta_signature; };
1241 const mask & get_delta_mask() const { return *x_delta_mask; }
1242 bool get_has_delta_mask_been_set() const { return has_delta_mask_been_set; };
1243 const infinint & get_delta_sig_min_size() const { return x_delta_sig_min_size; };
1244 const infinint & get_iteration_count() const { return x_iteration_count; };
1245 hash_algo get_kdf_hash() const { return x_kdf_hash; };
1246 delta_sig_block_size get_sig_block_len() const { return x_sig_block_len; };
1247
1248
1249 private:
1250 std::shared_ptr<archive> x_ref;
1251 mask * x_selection;
1252 mask * x_subtree;
1253 bool x_allow_over;
1254 bool x_warn_over;
1255 crit_action * x_overwrite;
1256 bool x_info_details;
1257 bool x_display_treated;
1258 bool x_display_treated_only_dir;
1259 bool x_display_skipped;
1260 infinint x_pause;
1261 bool x_empty_dir;
1262 compression x_compr_algo;
1263 U_I x_compression_level;
1264 U_I x_compression_block_size;
1265 infinint x_file_size;
1266 infinint x_first_file_size;
1267 mask * x_ea_mask;
1268 std::string x_execute;
1269 crypto_algo x_crypto;
1270 secu_string x_pass;
1271 U_32 x_crypto_size;
1272 std::vector<std::string> x_gnupg_recipients;
1273 std::vector<std::string> x_gnupg_signatories;
1274 mask * x_compr_mask;
1275 infinint x_min_compr_size;
1276 bool x_empty;
1277 bool x_keep_compressed;
1278 std::string x_slice_permission;
1279 std::string x_slice_user_ownership;
1280 std::string x_slice_group_ownership;
1281 bool x_decremental;
1282 bool x_sequential_marks;
1283 infinint x_sparse_file_min_size;
1284 std::string x_user_comment;
1285 hash_algo x_hash;
1286 infinint x_slice_min_digits;
1287 std::shared_ptr<entrepot> x_entrepot;
1288 fsa_scope x_scope;
1289 U_I x_multi_threaded_crypto;
1290 U_I x_multi_threaded_compress;
1291 bool x_delta_signature;
1292 mask *x_delta_mask;
1293 bool has_delta_mask_been_set;
1294 infinint x_delta_sig_min_size;
1295 infinint x_iteration_count;
1296 hash_algo x_kdf_hash;
1297 delta_sig_block_size x_sig_block_len;
1298
1299 void destroy() noexcept;
1300 void copy_from(const archive_options_merge & ref);
1301 void move_from(archive_options_merge && ref) noexcept;
1302 void nullifyptr() noexcept;
1303 };
1304
1305
1309
1312 {
1313 public:
1314 enum t_dirty { dirty_ignore, dirty_warn, dirty_ok };
1315
1316 archive_options_extract() { nullifyptr(); clear(); };
1317 archive_options_extract(const archive_options_extract & ref) { copy_from(ref); };
1318 archive_options_extract(archive_options_extract && ref) noexcept { nullifyptr(); move_from(std::move(ref)); };
1319 archive_options_extract & operator = (const archive_options_extract & ref) { destroy(); copy_from(ref); return *this; };
1320 archive_options_extract & operator = (archive_options_extract & ref) { destroy(); copy_from(ref); archive_options_extract & ref) { destroy(destroy(); cooy_from(ref); ?span class="keywordflow">return*this; a;
9span class="lineno"> 1320 get_has_dn class="keyword">this; a;
return*this< class="comment">// All methods that follow concern te="l01320">
sev>
ine"> const { <1pan class="keywordflow">return x_multi_threaded_crypto; };

232 U_I get_mul5a7e">set_decremental_mode(bool 232 U_I get_mul5a