Disk ARchive 2.4.2
|
00001 /*********************************************************************/ 00002 // dar - disk archive - a backup/restoration program 00003 // Copyright (C) 2002-2052 Denis Corbin 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 // 00019 // to contact the author : http://dar.linux.free.fr/email.html 00020 /*********************************************************************/ 00021 // $Id: archive_options.hpp,v 1.35 2011/04/12 16:31:35 edrusb Rel $ 00022 // 00023 /*********************************************************************/ 00024 // 00025 00029 00030 #ifndef ARCHIVE_OPTIONS_HPP 00031 #define ARCHIVE_OPTIONS_HPP 00032 00033 #include "../my_config.h" 00034 #include "crypto.hpp" 00035 #include "integers.hpp" 00036 #include "mask.hpp" 00037 #include "compressor.hpp" 00038 #include "catalogue.hpp" 00039 #include "criterium.hpp" 00040 #include "hash_fichier.hpp" 00041 #include "secu_string.hpp" 00042 #include "nls_swap.hpp" 00043 00044 #include <string> 00045 00046 namespace libdar 00047 { 00048 class archive; // needed to be able to use pointer on archive object. 00049 00050 00054 00057 00058 00060 class archive_options_read 00061 { 00062 public: 00064 archive_options_read(); 00065 00067 // set back to default (this is the state just after the object is constructed 00068 // this method is to be used to reuse a given object 00069 00071 void clear(); 00072 00073 00075 // setting methods 00076 00077 00079 void set_crypto_algo(crypto_algo val) { x_crypto = val; }; 00080 00082 void set_crypto_pass(const secu_string & pass) { x_pass = pass; }; 00083 00085 void set_crypto_size(U_32 crypto_size) { x_crypto_size = crypto_size; }; 00086 00088 void set_default_crypto_size(); 00089 00091 00094 void set_input_pipe(const std::string & input_pipe) { x_input_pipe = input_pipe; }; 00095 00097 00100 void set_output_pipe(const std::string & output_pipe) { x_output_pipe = output_pipe; }; 00101 00103 00111 void set_execute(const std::string & execute) { x_execute = execute; }; 00112 00114 void set_info_details(bool info_details) { x_info_details = info_details; }; 00115 00117 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; }; 00119 void unset_external_catalogue(); 00120 00122 void set_ref_crypto_algo(crypto_algo ref_crypto) { x_ref_crypto = ref_crypto; }; 00123 00125 void set_ref_crypto_pass(const secu_string & ref_pass) { x_ref_pass = ref_pass; }; 00126 00128 void set_ref_crypto_size(U_32 ref_crypto_size) { x_ref_crypto_size = ref_crypto_size; }; 00129 00131 00139 void set_ref_execute(const std::string & ref_execute) { x_ref_execute = ref_execute; }; 00140 00142 00146 void set_lax(bool val) { x_lax = val; }; 00147 00149 00151 00152 void set_sequential_read(bool val) { x_sequential_read = val; }; 00153 00155 00156 void set_slice_min_digits(infinint val) { x_slice_min_digits = val; }; 00157 00159 00160 void set_ref_slice_min_digits(infinint val) { x_ref_slice_min_digits = val; }; 00161 00162 00164 // getting methods (mainly used inside libdar, but kept public and part of the API in the case it is needed) 00165 00166 00167 crypto_algo get_crypto_algo() const { return x_crypto; }; 00168 const secu_string & get_crypto_pass() const { return x_pass; }; 00169 U_32 get_crypto_size() const { return x_crypto_size; }; 00170 const std::string & get_input_pipe() const { return x_input_pipe; }; 00171 const std::string & get_output_pipe() const { return x_output_pipe; }; 00172 const std::string & get_execute() const { return x_execute; }; 00173 bool get_info_details() const { return x_info_details; }; 00174 bool get_lax() const { return x_lax; }; 00175 bool get_sequential_read() const { return x_sequential_read; }; 00176 infinint get_slice_min_digits() const { return x_slice_min_digits; }; 00177 00178 // All methods that follow concern the archive where to fetch the (isolated) catalogue from 00179 bool is_external_catalogue_set() const { return external_cat; }; 00180 const path & get_ref_path() const; 00181 const std::string & get_ref_basename() const; 00182 crypto_algo get_ref_crypto_algo() const { return x_ref_crypto; }; 00183 const secu_string & get_ref_crypto_pass() const { return x_ref_pass; }; 00184 U_32 get_ref_crypto_size() const { return x_ref_crypto_size; }; 00185 const std::string & get_ref_execute() const { return x_ref_execute; }; 00186 infinint get_ref_slice_min_digits() const { return x_ref_slice_min_digits; }; 00187 00188 00189 private: 00190 crypto_algo x_crypto; 00191 secu_string x_pass; 00192 U_32 x_crypto_size; 00193 std::string x_input_pipe; 00194 std::string x_output_pipe; 00195 std::string x_execute; 00196 bool x_info_details; 00197 bool x_lax; 00198 bool x_sequential_read; 00199 infinint x_slice_min_digits; 00200 00201 // external catalogue relative fields 00202 bool external_cat; 00203 path x_ref_chem; 00204 std::string x_ref_basename; 00205 crypto_algo x_ref_crypto; 00206 secu_string x_ref_pass; 00207 U_32 x_ref_crypto_size; 00208 std::string x_ref_execute; 00209 infinint x_ref_slice_min_digits; 00210 }; 00211 00212 00216 00218 class archive_options_create 00219 { 00220 public: 00221 // default constructors and destructor. 00222 00223 archive_options_create() { x_selection = x_subtree = x_ea_mask = x_compr_mask = x_backup_hook_file_mask = NULL; clear(); }; 00224 archive_options_create(const archive_options_create & ref) { copy_from(ref); }; 00225 const archive_options_create & operator = (const archive_options_create & ref) { destroy(); copy_from(ref); return *this; }; 00226 ~archive_options_create() { destroy(); }; 00227 00229 // set back to default (this is the state just after the object is constructed 00230 // this method is to be used to reuse a given object 00231 00233 void clear(); 00234 00235 00237 // setting methods 00238 00240 void set_reference(archive *ref_arch) { x_ref_arch = ref_arch; }; 00241 00243 void set_selection(const mask & selection); 00244 00246 void set_subtree(const mask & subtree); 00247 00249 void set_allow_over(bool allow_over) { x_allow_over = allow_over; }; 00250 00252 void set_warn_over(bool warn_over) { x_warn_over = warn_over; }; 00253 00255 void set_info_details(bool info_details) { x_info_details = info_details; }; 00256 00258 void set_pause(const infinint & pause) { x_pause = pause; }; 00259 00261 void set_empty_dir(bool empty_dir) { x_empty_dir = empty_dir; }; 00262 00264 void set_compression(compression compr_algo) { x_compr_algo = compr_algo; }; 00265 00267 void set_compression_level(U_I compression_level) { x_compression_level = compression_level; }; 00268 00270 00274 void set_slicing(const infinint & file_size, const infinint & first_file_size = 0) 00275 { 00276 x_file_size = file_size; 00277 if(first_file_size == 0) 00278 x_first_file_size = file_size; 00279 else 00280 x_first_file_size = first_file_size; 00281 }; 00282 00283 00285 void set_ea_mask(const mask & ea_mask); 00286 00288 void set_execute(const std::string & execute) { x_execute = execute; }; 00289 00291 void set_crypto_algo(crypto_algo crypto) { x_crypto = crypto; }; 00292 00295 void set_crypto_pass(const secu_string & pass) { x_pass = pass; }; 00296 00298 void set_crypto_size(U_32 crypto_size) { x_crypto_size = crypto_size; }; 00299 00301 void set_compr_mask(const mask & compr_mask); 00302 00304 void set_min_compr_size(const infinint & min_compr_size) { x_min_compr_size = min_compr_size; }; 00305 00307 void set_nodump(bool nodump) { x_nodump = nodump; }; 00308 00310 void set_what_to_check(inode::comparison_fields what_to_check) { x_what_to_check = what_to_check; }; 00311 00313 void set_hourshift(const infinint & hourshift) { x_hourshift = hourshift; }; 00314 00316 void set_empty(bool empty) { x_empty = empty; }; 00317 00319 00322 void set_alter_atime(bool alter_atime) 00323 { 00324 if(x_furtive_read) 00325 x_old_alter_atime = alter_atime; 00326 else 00327 x_alter_atime = alter_atime; 00328 }; 00329 00331 void set_furtive_read_mode(bool furtive_read) 00332 { 00333 NLS_SWAP_IN; 00334 try 00335 { 00336 00337 #if FURTIVE_READ_MODE_AVAILABLE 00338 x_furtive_read = furtive_read; 00339 if(furtive_read) 00340 { 00341 x_old_alter_atime = x_alter_atime; 00342 x_alter_atime = true; 00343 // this is required to avoid libdar manipulating ctime of inodes 00344 } 00345 else 00346 x_alter_atime = x_old_alter_atime; 00347 #else 00348 if(furtive_read) 00349 throw Ecompilation(gettext("Furtive read mode")); 00350 x_furtive_read = false; 00351 #endif 00352 } 00353 catch(...) 00354 { 00355 NLS_SWAP_OUT; 00356 throw; 00357 } 00358 NLS_SWAP_OUT; 00359 }; 00360 00362 void set_same_fs(bool same_fs) { x_same_fs = same_fs; }; 00363 00365 void set_snapshot(bool snapshot) { x_snapshot = snapshot; }; 00366 00368 void set_cache_directory_tagging(bool cache_directory_tagging) { x_cache_directory_tagging = cache_directory_tagging; }; 00369 00371 void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; }; 00372 00374 void set_fixed_date(const infinint & fixed_date) { x_fixed_date = fixed_date; }; 00375 00377 void set_slice_permission(const std::string & slice_permission) { x_slice_permission = slice_permission; }; 00378 00380 void set_slice_user_ownership(const std::string & slice_user_ownership) { x_slice_user_ownership = slice_user_ownership; }; 00381 00383 void set_slice_group_ownership(const std::string & slice_group_ownership) { x_slice_group_ownership = slice_group_ownership; }; 00384 00386 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; }; 00387 00389 void set_sequential_marks(bool sequential) { x_sequential_marks = sequential; }; 00390 00392 void set_sparse_file_min_size(const infinint & size) { x_sparse_file_min_size = size; }; 00393 00395 void set_security_check(bool check) { x_security_check = check; }; 00396 00398 void set_user_comment(const std::string & comment) { x_user_comment = comment; }; 00399 00401 void set_hash_algo(hash_algo hash) { x_hash = hash; }; 00402 00404 void set_slice_min_digits(infinint val) { x_slice_min_digits = val; }; 00405 00407 void set_backup_hook(const std::string & execute, const mask & which_files); 00408 00410 void set_ignore_unknown_inode_type(bool val) { x_ignore_unknown = val; }; 00411 00413 // getting methods 00414 00415 archive *get_reference() const { return x_ref_arch; }; 00416 const mask & get_selection() const { if(x_selection == NULL) throw SRC_BUG; return *x_selection; }; 00417 const mask & get_subtree() const { if(x_subtree == NULL) throw SRC_BUG; return *x_subtree; }; 00418 bool get_allow_over() const { return x_allow_over; }; 00419 bool get_warn_over() const { return x_warn_over; }; 00420 bool get_info_details() const { return x_info_details; }; 00421 const infinint & get_pause() const { return x_pause; }; 00422 bool get_empty_dir() const { return x_empty_dir; }; 00423 compression get_compression() const { return x_compr_algo; }; 00424 U_I get_compression_level() const { return x_compression_level; }; 00425 const infinint & get_slice_size() const { return x_file_size; }; 00426 const infinint & get_first_slice_size() const { return x_first_file_size; }; 00427 const mask & get_ea_mask() const { if(x_ea_mask == NULL) throw SRC_BUG; return *x_ea_mask; }; 00428 const std::string & get_execute() const { return x_execute; }; 00429 crypto_algo get_crypto_algo() const { return x_crypto; }; 00430 const secu_string & get_crypto_pass() const { return x_pass; }; 00431 U_32 get_crypto_size() const { return x_crypto_size; }; 00432 const mask & get_compr_mask() const { if(x_compr_mask == NULL) throw SRC_BUG; return *x_compr_mask; }; 00433 const infinint & get_min_compr_size() const { return x_min_compr_size; }; 00434 bool get_nodump() const { return x_nodump; }; 00435 inode::comparison_fields get_comparison_fields() const { return x_what_to_check; }; 00436 const infinint & get_hourshift() const { return x_hourshift; }; 00437 bool get_empty() const { return x_empty; }; 00438 bool get_alter_atime() const { return x_alter_atime; }; 00439 bool get_furtive_read_mode() const { return x_furtive_read; }; 00440 bool get_same_fs() const { return x_same_fs; }; 00441 bool get_snapshot() const { return x_snapshot; }; 00442 bool get_cache_directory_tagging() const { return x_cache_directory_tagging; }; 00443 bool get_display_skipped() const { return x_display_skipped; }; 00444 const infinint & get_fixed_date() const { return x_fixed_date; }; 00445 const std::string & get_slice_permission() const { return x_slice_permission; }; 00446 const std::string & get_slice_user_ownership() const { return x_slice_user_ownership; }; 00447 const std::string & get_slice_group_ownership() const { return x_slice_group_ownership; }; 00448 const infinint & get_repeat_count() const { return x_repeat_count; }; 00449 const infinint & get_repeat_byte() const { return x_repeat_byte; }; 00450 bool get_sequential_marks() const { return x_sequential_marks; }; 00451 infinint get_sparse_file_min_size() const { return x_sparse_file_min_size; }; 00452 bool get_security_check() const { return x_security_check; }; 00453 const std::string & get_user_comment() const { return x_user_comment; }; 00454 hash_algo get_hash_algo() const { return x_hash; }; 00455 infinint get_slice_min_digits() const { return x_slice_min_digits; }; 00456 const std::string & get_backup_hook_file_execute() const { return x_backup_hook_file_execute; }; 00457 const mask & get_backup_hook_file_mask() const { return *x_backup_hook_file_mask; }; 00458 bool get_ignore_unknown_inode_type() const { return x_ignore_unknown; }; 00459 00460 private: 00461 archive *x_ref_arch; //< just contains the address of an existing object, no local copy of object is done here 00462 mask * x_selection; //< points to a local copy of mask (must be allocated / releases by the archive_option_create object) 00463 mask * x_subtree; //< points to a local copy of mask (must be allocated / releases by the archive_option_create objects) 00464 bool x_allow_over; 00465 bool x_warn_over; 00466 bool x_info_details; 00467 infinint x_pause; 00468 bool x_empty_dir; 00469 compression x_compr_algo; 00470 U_I x_compression_level; 00471 infinint x_file_size; 00472 infinint x_first_file_size; 00473 mask * x_ea_mask; //< points to a local copy of mask (must be allocated / releases by the archive_option_create objects) 00474 std::string x_execute; 00475 crypto_algo x_crypto; 00476 secu_string x_pass; 00477 U_32 x_crypto_size; 00478 mask * x_compr_mask; //< points to a local copy of mask (must be allocated / releases by the archive_option_create objects) 00479 infinint x_min_compr_size; 00480 bool x_nodump; 00481 inode::comparison_fields x_what_to_check; 00482 infinint x_hourshift; 00483 bool x_empty; 00484 bool x_alter_atime; 00485 bool x_old_alter_atime; //< used to backup origina alter_atime value when activating furtive read mode 00486 bool x_furtive_read; 00487 bool x_same_fs; 00488 bool x_snapshot; 00489 bool x_cache_directory_tagging; 00490 bool x_display_skipped; 00491 infinint x_fixed_date; 00492 std::string x_slice_permission; 00493 std::string x_slice_user_ownership; 00494 std::string x_slice_group_ownership; 00495 infinint x_repeat_count; 00496 infinint x_repeat_byte; 00497 bool x_sequential_marks; 00498 infinint x_sparse_file_min_size; 00499 bool x_security_check; 00500 std::string x_user_comment; 00501 hash_algo x_hash; 00502 infinint x_slice_min_digits; 00503 mask * x_backup_hook_file_mask; 00504 std::string x_backup_hook_file_execute; 00505 bool x_ignore_unknown; 00506 00507 void destroy(); 00508 void copy_from(const archive_options_create & ref); 00509 void destroy_mask(mask * & ptr); 00510 void clean_mask(mask * & ptr); 00511 void check_mask(const mask & m); 00512 }; 00513 00514 00515 00516 00517 00518 00522 00524 class archive_options_isolate 00525 { 00526 public: 00527 archive_options_isolate() { clear(); }; 00528 00529 void clear(); 00530 00532 // setting methods 00533 00535 void set_allow_over(bool allow_over) { x_allow_over = allow_over; }; 00536 00538 void set_warn_over(bool warn_over) { x_warn_over = warn_over; }; 00539 00541 void set_info_details(bool info_details) { x_info_details = info_details; }; 00542 00544 void set_pause(const infinint & pause) { x_pause = pause; }; 00545 00547 void set_compression(compression algo) { x_algo = algo; }; 00548 00550 void set_compression_level(U_I compression_level) { x_compression_level = compression_level; }; 00551 00553 00557 void set_slicing(const infinint & file_size, const infinint & first_file_size = 0) 00558 { 00559 x_file_size = file_size; 00560 if(first_file_size == 0) 00561 x_first_file_size = file_size; 00562 else 00563 x_first_file_size = first_file_size; 00564 }; 00565 00567 void set_execute(const std::string & execute) { x_execute = execute; }; 00568 00570 void set_crypto_algo(crypto_algo crypto) { x_crypto = crypto; }; 00571 00573 void set_crypto_pass(const secu_string & pass) { x_pass = pass; }; 00574 00576 void set_crypto_size(U_32 crypto_size) { x_crypto_size = crypto_size; }; 00577 00579 void set_empty(bool empty) { x_empty = empty; }; 00580 00582 void set_slice_permission(const std::string & slice_permission) { x_slice_permission = slice_permission; }; 00583 00585 void set_slice_user_ownership(const std::string & slice_user_ownership) { x_slice_user_ownership = slice_user_ownership; }; 00586 00588 void set_slice_group_ownership(const std::string & slice_group_ownership) { x_slice_group_ownership = slice_group_ownership; }; 00589 00591 void set_user_comment(const std::string & comment) { x_user_comment = comment; }; 00592 00594 void set_hash_algo(hash_algo hash) { x_hash = hash; }; 00595 00597 void set_slice_min_digits(infinint val) { x_slice_min_digits = val; }; 00598 00600 void set_sequential_marks(bool sequential) { x_sequential_marks = sequential; }; 00601 00602 00603 00605 // getting methods 00606 00607 bool get_allow_over() const { return x_allow_over; }; 00608 bool get_warn_over() const { return x_warn_over; }; 00609 bool get_info_details() const { return x_info_details; }; 00610 const infinint & get_pause() const { return x_pause; }; 00611 compression get_compression() const { return x_algo; }; 00612 U_I get_compression_level() const { return x_compression_level; }; 00613 const infinint & get_slice_size() const { return x_file_size; }; 00614 const infinint & get_first_slice_size() const { return x_first_file_size; }; 00615 const std::string & get_execute() const { return x_execute; }; 00616 crypto_algo get_crypto_algo() const { return x_crypto; }; 00617 const secu_string & get_crypto_pass() const { return x_pass; }; 00618 U_32 get_crypto_size() const { return x_crypto_size; }; 00619 bool get_empty() const { return x_empty; }; 00620 const std::string & get_slice_permission() const { return x_slice_permission; }; 00621 const std::string & get_slice_user_ownership() const { return x_slice_user_ownership; }; 00622 const std::string & get_slice_group_ownership() const { return x_slice_group_ownership; }; 00623 const std::string & get_user_comment() const { return x_user_comment; }; 00624 hash_algo get_hash_algo() const { return x_hash; }; 00625 infinint get_slice_min_digits() const { return x_slice_min_digits; }; 00626 bool get_sequential_marks() const { return x_sequential_marks; }; 00627 00628 private: 00629 bool x_allow_over; 00630 bool x_warn_over; 00631 bool x_info_details; 00632 infinint x_pause; 00633 compression x_algo; 00634 U_I x_compression_level; 00635 infinint x_file_size; 00636 infinint x_first_file_size; 00637 std::string x_execute; 00638 crypto_algo x_crypto; 00639 secu_string x_pass; 00640 U_32 x_crypto_size; 00641 bool x_empty; 00642 std::string x_slice_permission; 00643 std::string x_slice_user_ownership; 00644 std::string x_slice_group_ownership; 00645 std::string x_user_comment; 00646 hash_algo x_hash; 00647 infinint x_slice_min_digits; 00648 bool x_sequential_marks; 00649 00650 }; 00651 00652 00653 00657 00659 class archive_options_merge 00660 { 00661 public: 00662 00663 archive_options_merge() { x_selection = x_subtree = x_ea_mask = x_compr_mask = NULL; x_overwrite = NULL; clear(); }; 00664 archive_options_merge(const archive_options_merge & ref) { copy_from(ref); }; 00665 const archive_options_merge & operator = (const archive_options_merge & ref) { destroy(); copy_from(ref); return *this; }; 00666 ~archive_options_merge() { destroy(); }; 00667 00668 void clear(); 00669 00671 // setting methods 00672 00673 void set_auxilliary_ref(archive *ref) { x_ref = ref; }; 00674 00676 void set_selection(const mask & selection); 00677 00679 void set_subtree(const mask & subtree); 00680 00682 void set_allow_over(bool allow_over) { x_allow_over = allow_over; }; 00683 00685 void set_warn_over(bool warn_over) { x_warn_over = warn_over; }; 00686 00688 void set_overwriting_rules(const crit_action & overwrite); 00689 00691 void set_info_details(bool info_details) { x_info_details = info_details; }; 00692 00694 void set_pause(const infinint & pause) { x_pause = pause; }; 00695 00697 void set_empty_dir(bool empty_dir) { x_empty_dir = empty_dir; }; 00698 00700 void set_compression(compression compr_algo) { x_compr_algo = compr_algo; }; 00701 00703 void set_compression_level(U_I compression_level) { x_compression_level = compression_level; }; 00704 00706 00710 void set_slicing(const infinint & file_size, const infinint & first_file_size = 0) 00711 { 00712 x_file_size = file_size; 00713 if(first_file_size == 0) 00714 x_first_file_size = file_size; 00715 else 00716 x_first_file_size = first_file_size; 00717 }; 00718 00720 void set_ea_mask(const mask & ea_mask); 00721 00723 void set_execute(const std::string & execute) { x_execute = execute; }; 00724 00726 void set_crypto_algo(crypto_algo crypto) { x_crypto = crypto; }; 00727 00730 void set_crypto_pass(const secu_string & pass) { x_pass = pass; }; 00731 00733 void set_crypto_size(U_32 crypto_size) { x_crypto_size = crypto_size; }; 00734 00736 void set_compr_mask(const mask & compr_mask); 00737 00739 void set_min_compr_size(const infinint & min_compr_size) { x_min_compr_size = min_compr_size; }; 00740 00742 void set_empty(bool empty) { x_empty = empty; }; 00743 00745 void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; }; 00746 00748 void set_keep_compressed(bool keep_compressed) { x_keep_compressed = keep_compressed; }; 00749 00751 void set_slice_permission(const std::string & slice_permission) { x_slice_permission = slice_permission; }; 00752 00754 void set_slice_user_ownership(const std::string & slice_user_ownership) { x_slice_user_ownership = slice_user_ownership; }; 00755 00757 void set_slice_group_ownership(const std::string & slice_group_ownership) { x_slice_group_ownership = slice_group_ownership; }; 00758 00760 void set_decremental_mode(bool mode) { x_decremental = mode; }; 00761 00763 void set_sequential_marks(bool sequential) { x_sequential_marks = sequential; }; 00764 00766 void set_sparse_file_min_size(const infinint & size) { x_sparse_file_min_size = size; }; 00767 00769 void set_user_comment(const std::string & comment) { x_user_comment = comment; }; 00770 00772 void set_hash_algo(hash_algo hash) { x_hash = hash; }; 00773 00775 void set_slice_min_digits(infinint val) { x_slice_min_digits = val; }; 00776 00777 00778 00780 // getting methods 00781 00782 archive * get_auxilliary_ref() const { return x_ref; }; 00783 const mask & get_selection() const { if(x_selection == NULL) throw SRC_BUG; return *x_selection; }; 00784 const mask & get_subtree() const { if(x_subtree == NULL) throw SRC_BUG; return *x_subtree; }; 00785 bool get_allow_over() const { return x_allow_over; }; 00786 bool get_warn_over() const { return x_warn_over; }; 00787 const crit_action & get_overwriting_rules() const { if(x_overwrite == NULL) throw SRC_BUG; return *x_overwrite; }; 00788 bool get_info_details() const { return x_info_details; }; 00789 const infinint & get_pause() const { return x_pause; }; 00790 bool get_empty_dir() const { return x_empty_dir; }; 00791 compression get_compression() const { return x_compr_algo; }; 00792 U_I get_compression_level() const { return x_compression_level; }; 00793 const infinint & get_slice_size() const { return x_file_size; }; 00794 const infinint & get_first_slice_size() const { return x_first_file_size; }; 00795 const mask & get_ea_mask() const { if(x_ea_mask == NULL) throw SRC_BUG; return *x_ea_mask; }; 00796 const std::string & get_execute() const { return x_execute; }; 00797 crypto_algo get_crypto_algo() const { return x_crypto; }; 00798 const secu_string & get_crypto_pass() const { return x_pass; }; 00799 U_32 get_crypto_size() const { return x_crypto_size; }; 00800 const mask & get_compr_mask() const { if(x_compr_mask == NULL) throw SRC_BUG; return *x_compr_mask; }; 00801 const infinint & get_min_compr_size() const { return x_min_compr_size; }; 00802 bool get_empty() const { return x_empty; }; 00803 bool get_display_skipped() const { return x_display_skipped; }; 00804 bool get_keep_compressed() const { return x_keep_compressed; }; 00805 const std::string & get_slice_permission() const { return x_slice_permission; }; 00806 const std::string & get_slice_user_ownership() const { return x_slice_user_ownership; }; 00807 const std::string & get_slice_group_ownership() const { return x_slice_group_ownership; }; 00808 bool get_decremental_mode() const { return x_decremental; }; 00809 bool get_sequential_marks() const { return x_sequential_marks; }; 00810 infinint get_sparse_file_min_size() const { return x_sparse_file_min_size; }; 00811 const std::string & get_user_comment() const { return x_user_comment; }; 00812 hash_algo get_hash_algo() const { return x_hash; }; 00813 infinint get_slice_min_digits() const { return x_slice_min_digits; }; 00814 00815 private: 00816 archive * x_ref; 00817 mask * x_selection; 00818 mask * x_subtree; 00819 bool x_allow_over; 00820 bool x_warn_over; 00821 crit_action * x_overwrite; 00822 bool x_info_details; 00823 infinint x_pause; 00824 bool x_empty_dir; 00825 compression x_compr_algo; 00826 U_I x_compression_level; 00827 infinint x_file_size; 00828 infinint x_first_file_size; 00829 mask * x_ea_mask; 00830 std::string x_execute; 00831 crypto_algo x_crypto; 00832 secu_string x_pass; 00833 U_32 x_crypto_size; 00834 mask * x_compr_mask; 00835 infinint x_min_compr_size; 00836 bool x_empty; 00837 bool x_display_skipped; 00838 bool x_keep_compressed; 00839 std::string x_slice_permission; 00840 std::string x_slice_user_ownership; 00841 std::string x_slice_group_ownership; 00842 bool x_decremental; 00843 bool x_sequential_marks; 00844 infinint x_sparse_file_min_size; 00845 std::string x_user_comment; 00846 hash_algo x_hash; 00847 infinint x_slice_min_digits; 00848 00849 void destroy(); 00850 void copy_from(const archive_options_merge & ref); 00851 }; 00852 00853 00857 00859 class archive_options_extract 00860 { 00861 public: 00862 archive_options_extract() { x_selection = x_subtree = x_ea_mask = NULL; x_overwrite = NULL; clear(); }; 00863 archive_options_extract(const archive_options_extract & ref) { copy_from(ref); }; 00864 const archive_options_extract & operator = (const archive_options_extract & ref) { destroy(); copy_from(ref); return *this; }; 00865 ~archive_options_extract() { destroy(); }; 00866 00867 void clear(); 00868 00870 // setting methods 00871 00873 void set_selection(const mask & selection); 00874 00876 void set_subtree(const mask & subtree); 00877 00879 void set_warn_over(bool warn_over) { x_warn_over = warn_over; }; 00880 00882 void set_info_details(bool info_details) { x_info_details = info_details; }; 00883 00885 void set_ea_mask(const mask & ea_mask); 00886 00888 void set_flat(bool flat) { x_flat = flat; }; 00889 00891 void set_what_to_check(inode::comparison_fields what_to_check) { x_what_to_check = what_to_check; }; 00892 00894 void set_warn_remove_no_match(bool warn_remove_no_match) { x_warn_remove_no_match = warn_remove_no_match; }; 00895 00897 void set_empty(bool empty) { x_empty = empty; }; 00898 00900 void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; }; 00901 00903 void set_empty_dir(bool empty_dir) { x_empty_dir = empty_dir; }; 00904 00906 00909 void set_dirty_behavior(bool ignore, bool warn) { x_dirty = ignore ? dirty_ignore : (warn ? dirty_warn : dirty_ok); }; 00910 00912 void set_overwriting_rules(const crit_action & over); 00913 00915 00917 void set_only_deleted(bool val) { x_only_deleted = val; }; 00918 00919 00921 00923 void set_ignore_deleted(bool val) { x_ignore_deleted = val; }; 00924 00925 00927 // getting methods 00928 00929 enum t_dirty { dirty_ignore, dirty_warn, dirty_ok }; 00930 00931 const mask & get_selection() const { if(x_selection == NULL) throw SRC_BUG; return *x_selection; }; 00932 const mask & get_subtree() const { if(x_subtree == NULL) throw SRC_BUG; return *x_subtree; }; 00933 bool get_warn_over() const { return x_warn_over; }; 00934 bool get_info_details() const { return x_info_details; }; 00935 const mask & get_ea_mask() const { if(x_ea_mask == NULL) throw SRC_BUG; return *x_ea_mask; }; 00936 bool get_flat() const { return x_flat; }; 00937 inode::comparison_fields get_what_to_check() const { return x_what_to_check; }; 00938 bool get_warn_remove_no_match() const { return x_warn_remove_no_match; }; 00939 bool get_empty() const { return x_empty; }; 00940 bool get_display_skipped() const { return x_display_skipped; }; 00941 bool get_empty_dir() const { return x_empty_dir; }; 00942 t_dirty get_dirty_behavior() const { return x_dirty; } 00943 const crit_action & get_overwriting_rules() const { if(x_overwrite == NULL) throw SRC_BUG; return *x_overwrite; }; 00944 bool get_only_deleted() const { return x_only_deleted; }; 00945 bool get_ignore_deleted() const { return x_ignore_deleted; }; 00946 00947 private: 00948 mask * x_selection; 00949 mask * x_subtree; 00950 bool x_warn_over; 00951 bool x_info_details; 00952 mask * x_ea_mask; 00953 bool x_flat; 00954 inode::comparison_fields x_what_to_check; 00955 bool x_warn_remove_no_match; 00956 bool x_empty; 00957 bool x_display_skipped; 00958 bool x_empty_dir; 00959 t_dirty x_dirty; 00960 crit_action *x_overwrite; 00961 bool x_only_deleted; 00962 bool x_ignore_deleted; 00963 00964 void destroy(); 00965 void copy_from(const archive_options_extract & ref); 00966 }; 00967 00968 00969 00970 00974 00976 class archive_options_listing 00977 { 00978 public: 00979 archive_options_listing() { x_selection = x_subtree = NULL; clear(); }; 00980 archive_options_listing(const archive_options_listing & ref) { copy_from(ref); }; 00981 const archive_options_listing & operator = (const archive_options_listing & ref) { destroy(); copy_from(ref); return *this; }; 00982 ~archive_options_listing() { destroy(); }; 00983 00984 void clear(); 00985 00987 00988 enum listformat 00989 { 00990 normal, //< the tar-like listing (this is the default) 00991 tree, //< the original dar's tree listing (for those that like forest) 00992 xml //< the xml catalogue output 00993 }; 00994 00996 // setting methods 00997 00998 void set_info_details(bool info_details) { x_info_details = info_details; }; 00999 void set_list_mode(listformat list_mode) { x_list_mode = list_mode; }; 01000 void set_selection(const mask & selection); 01001 void set_subtree(const mask & subtree); 01002 void set_filter_unsaved(bool filter_unsaved) { x_filter_unsaved = filter_unsaved; }; 01003 void set_display_ea(bool display_ea) { x_display_ea = display_ea; }; 01004 01006 // getting methods 01007 01008 bool get_info_details() const { return x_info_details; }; 01009 listformat get_list_mode() const { return x_list_mode; }; 01010 const mask & get_selection() const; 01011 const mask & get_subtree() const; 01012 bool get_filter_unsaved() const { return x_filter_unsaved; }; 01013 bool get_display_ea() const { return x_display_ea; }; 01014 01015 private: 01016 bool x_info_details; 01017 listformat x_list_mode; 01018 mask * x_selection; 01019 mask * x_subtree; 01020 bool x_filter_unsaved; 01021 bool x_display_ea; 01022 01023 void destroy(); 01024 void copy_from(const archive_options_listing & ref); 01025 }; 01026 01027 01031 01032 01033 class archive_options_diff 01034 { 01035 public: 01036 archive_options_diff() { x_selection = x_subtree = x_ea_mask = NULL; clear(); }; 01037 archive_options_diff(const archive_options_diff & ref) { copy_from(ref); }; 01038 const archive_options_diff & operator = (const archive_options_diff & ref) { destroy(); copy_from(ref); return *this; }; 01039 ~archive_options_diff() { destroy(); }; 01040 01041 void clear(); 01042 01044 // setting methods 01045 01047 void set_selection(const mask & selection); 01048 01050 void set_subtree(const mask & subtree); 01051 01053 void set_info_details(bool info_details) { x_info_details = info_details; }; 01054 01056 void set_ea_mask(const mask & ea_mask); 01057 01059 void set_what_to_check(inode::comparison_fields what_to_check) { x_what_to_check = what_to_check; }; 01060 01062 01065 void set_alter_atime(bool alter_atime) 01066 { 01067 if(x_furtive_read) 01068 x_old_alter_atime = alter_atime; 01069 else 01070 x_alter_atime = alter_atime; 01071 }; 01072 01074 void set_furtive_read_mode(bool furtive_read); 01075 01077 void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; }; 01078 01080 void set_hourshift(const infinint & hourshift) { x_hourshift = hourshift; }; 01081 01083 void set_compare_symlink_date(bool compare_symlink_date) { x_compare_symlink_date = compare_symlink_date; }; 01084 01085 01087 // getting methods 01088 01089 const mask & get_selection() const { if(x_selection == NULL) throw SRC_BUG; return *x_selection; }; 01090 const mask & get_subtree() const { if(x_subtree == NULL) throw SRC_BUG; return *x_subtree; }; 01091 bool get_info_details() const { return x_info_details; }; 01092 const mask & get_ea_mask() const { if(x_ea_mask == NULL) throw SRC_BUG; return *x_ea_mask; }; 01093 inode::comparison_fields get_what_to_check() const { return x_what_to_check; }; 01094 bool get_alter_atime() const { return x_alter_atime; }; 01095 bool get_furtive_read_mode() const { return x_furtive_read; }; 01096 bool get_display_skipped() const { return x_display_skipped; }; 01097 const infinint & get_hourshift() const { return x_hourshift; }; 01098 bool get_compare_symlink_date() const { return x_compare_symlink_date; }; 01099 01100 private: 01101 mask * x_selection; 01102 mask * x_subtree; 01103 bool x_info_details; 01104 mask * x_ea_mask; 01105 inode::comparison_fields x_what_to_check; 01106 bool x_alter_atime; 01107 bool x_old_alter_atime; 01108 bool x_furtive_read; 01109 bool x_display_skipped; 01110 infinint x_hourshift; 01111 bool x_compare_symlink_date; 01112 01113 void destroy(); 01114 void copy_from(const archive_options_diff & ref); 01115 }; 01116 01117 01118 01119 01123 01125 class archive_options_test 01126 { 01127 public: 01128 archive_options_test() { x_selection = x_subtree = NULL; clear(); }; 01129 archive_options_test(const archive_options_test & ref) { copy_from(ref); }; 01130 const archive_options_test & operator = (const archive_options_test & ref) { destroy(); copy_from(ref); return *this; }; 01131 ~archive_options_test() { destroy(); }; 01132 01133 void clear(); 01134 01136 // setting methods 01137 01139 void set_selection(const mask & selection); 01140 01142 void set_subtree(const mask & subtree); 01143 01145 void set_info_details(bool info_details) { x_info_details = info_details; }; 01146 01148 void set_empty(bool empty) { x_empty = empty; }; 01149 01151 void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; }; 01152 01153 01155 // getting methods 01156 01157 const mask & get_selection() const { if(x_selection == NULL) throw SRC_BUG; return *x_selection; }; 01158 const mask & get_subtree() const { if(x_subtree == NULL) throw SRC_BUG; return *x_subtree; }; 01159 bool get_info_details() const { return x_info_details; }; 01160 bool get_empty() const { return x_empty; }; 01161 bool get_display_skipped() const { return x_display_skipped; }; 01162 01163 private: 01164 mask * x_selection; 01165 mask * x_subtree; 01166 bool x_info_details; 01167 bool x_empty; 01168 bool x_display_skipped; 01169 01170 void destroy(); 01171 void copy_from(const archive_options_test & ref); 01172 }; 01173 01175 01176 } // end of namespace 01177 01178 #endif