Disk ARchive  2.4.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
archive_options.hpp
Go to the documentation of this file.
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 
00025 
00026 #ifndef ARCHIVE_OPTIONS_HPP
00027 #define ARCHIVE_OPTIONS_HPP
00028 
00029 #include "../my_config.h"
00030 #include "crypto.hpp"
00031 #include "integers.hpp"
00032 #include "mask.hpp"
00033 #include "compressor.hpp"
00034 #include "catalogue.hpp"
00035 #include "criterium.hpp"
00036 #include "hash_fichier.hpp"
00037 #include "secu_string.hpp"
00038 #include "nls_swap.hpp"
00039 
00040 #include <string>
00041 
00042 namespace libdar
00043 {
00044     class archive; // needed to be able to use pointer on archive object.
00045 
00046 
00050 
00053 
00054 
00056     class archive_options_read
00057     {
00058     public:
00060         archive_options_read();
00061 
00063             // set back to default (this is the state just after the object is constructed
00064             // this method is to be used to reuse a given object
00065 
00067         void clear();
00068 
00069 
00071             // setting methods
00072 
00073 
00075         void set_crypto_algo(crypto_algo val) { x_crypto = val; };
00076 
00078         void set_crypto_pass(const secu_string & pass) { x_pass = pass; };
00079 
00081         void set_crypto_size(U_32 crypto_size) { x_crypto_size = crypto_size; };
00082 
00084         void set_default_crypto_size();
00085 
00087 
00090         void set_input_pipe(const std::string & input_pipe) { x_input_pipe = input_pipe; };
00091 
00093 
00096         void set_output_pipe(const std::string & output_pipe) { x_output_pipe = output_pipe; };
00097 
00099 
00107         void set_execute(const std::string & execute) { x_execute = execute; };
00108 
00110         void set_info_details(bool info_details) { x_info_details = info_details; };
00111 
00113         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; };
00115         void unset_external_catalogue();
00116 
00118         void set_ref_crypto_algo(crypto_algo ref_crypto) { x_ref_crypto = ref_crypto; };
00119 
00121         void set_ref_crypto_pass(const secu_string & ref_pass) { x_ref_pass = ref_pass; };
00122 
00124         void set_ref_crypto_size(U_32 ref_crypto_size) { x_ref_crypto_size = ref_crypto_size; };
00125 
00127 
00135         void set_ref_execute(const std::string & ref_execute) { x_ref_execute = ref_execute; };
00136 
00138 
00142         void set_lax(bool val) { x_lax = val; };
00143 
00145 
00147 
00148         void set_sequential_read(bool val) { x_sequential_read = val; };
00149 
00151 
00152         void set_slice_min_digits(infinint val) { x_slice_min_digits = val; };
00153 
00155 
00156         void set_ref_slice_min_digits(infinint val) { x_ref_slice_min_digits = val; };
00157 
00158 
00160             // getting methods (mainly used inside libdar, but kept public and part of the API in the case it is needed)
00161 
00162 
00163         crypto_algo get_crypto_algo() const { return x_crypto; };
00164         const secu_string & get_crypto_pass() const { return x_pass; };
00165         U_32 get_crypto_size() const { return x_crypto_size; };
00166         const std::string & get_input_pipe() const { return x_input_pipe; };
00167         const std::string & get_output_pipe() const { return x_output_pipe; };
00168         const std::string & get_execute() const { return x_execute; };
00169         bool get_info_details() const { return x_info_details; };
00170         bool get_lax() const { return x_lax; };
00171         bool get_sequential_read() const { return x_sequential_read; };
00172         infinint get_slice_min_digits() const { return x_slice_min_digits; };
00173 
00174             // All methods that follow concern the archive where to fetch the (isolated) catalogue from
00175         bool is_external_catalogue_set() const { return external_cat; };
00176         const path & get_ref_path() const;
00177         const std::string & get_ref_basename() const;
00178         crypto_algo get_ref_crypto_algo() const { return x_ref_crypto; };
00179         const secu_string & get_ref_crypto_pass() const { return x_ref_pass; };
00180         U_32 get_ref_crypto_size() const { return x_ref_crypto_size; };
00181         const std::string & get_ref_execute() const { return x_ref_execute; };
00182         infinint get_ref_slice_min_digits() const { return x_ref_slice_min_digits; };
00183 
00184 
00185     private:
00186         crypto_algo x_crypto;
00187         secu_string x_pass;
00188         U_32 x_crypto_size;
00189         std::string x_input_pipe;
00190         std::string x_output_pipe;
00191         std::string x_execute;
00192         bool x_info_details;
00193         bool x_lax;
00194         bool x_sequential_read;
00195         infinint x_slice_min_digits;
00196 
00197             // external catalogue relative fields
00198         bool external_cat;
00199         path x_ref_chem;
00200         std::string x_ref_basename;
00201         crypto_algo x_ref_crypto;
00202         secu_string x_ref_pass;
00203         U_32 x_ref_crypto_size;
00204         std::string x_ref_execute;
00205         infinint x_ref_slice_min_digits;
00206     };
00207 
00208 
00212 
00214     class archive_options_create
00215     {
00216     public:
00217             // default constructors and destructor.
00218 
00219         archive_options_create() { x_selection = x_subtree = x_ea_mask = x_compr_mask = x_backup_hook_file_mask = NULL; clear(); };
00220         archive_options_create(const archive_options_create & ref) { copy_from(ref); };
00221         const archive_options_create & operator = (const archive_options_create & ref) { destroy(); copy_from(ref); return *this; };
00222         ~archive_options_create() { destroy(); };
00223 
00225             // set back to default (this is the state just after the object is constructed
00226             // this method is to be used to reuse a given object
00227 
00229         void clear();
00230 
00231 
00233             // setting methods
00234 
00236         void set_reference(archive *ref_arch) { x_ref_arch = ref_arch; };
00237 
00239         void set_selection(const mask & selection);
00240 
00242         void set_subtree(const mask & subtree);
00243 
00245         void set_allow_over(bool allow_over) { x_allow_over = allow_over; };
00246 
00248         void set_warn_over(bool warn_over) { x_warn_over = warn_over; };
00249 
00251         void set_info_details(bool info_details) { x_info_details = info_details; };
00252 
00254         void set_pause(const infinint & pause) { x_pause = pause; };
00255 
00257         void set_empty_dir(bool empty_dir) { x_empty_dir = empty_dir; };
00258 
00260         void set_compression(compression compr_algo) { x_compr_algo = compr_algo; };
00261 
00263         void set_compression_level(U_I compression_level) { x_compression_level = compression_level; };
00264 
00266 
00270         void set_slicing(const infinint & file_size, const infinint & first_file_size = 0)
00271         {
00272             x_file_size = file_size;
00273             if(first_file_size == 0)
00274                 x_first_file_size = file_size;
00275             else
00276                 x_first_file_size = first_file_size;
00277         };
00278 
00279 
00281         void set_ea_mask(const mask & ea_mask);
00282 
00284         void set_execute(const std::string & execute) { x_execute = execute; };
00285 
00287         void set_crypto_algo(crypto_algo crypto) { x_crypto = crypto; };
00288 
00291         void set_crypto_pass(const secu_string & pass) { x_pass = pass; };
00292 
00294         void set_crypto_size(U_32 crypto_size) { x_crypto_size = crypto_size; };
00295 
00297         void set_compr_mask(const mask & compr_mask);
00298 
00300         void set_min_compr_size(const infinint & min_compr_size) { x_min_compr_size = min_compr_size; };
00301 
00303         void set_nodump(bool nodump) { x_nodump = nodump; };
00304 
00306         void set_what_to_check(inode::comparison_fields what_to_check) { x_what_to_check = what_to_check; };
00307 
00309         void set_hourshift(const infinint & hourshift) { x_hourshift = hourshift; };
00310 
00312         void set_empty(bool empty) { x_empty = empty; };
00313 
00315 
00318         void set_alter_atime(bool alter_atime)
00319         {
00320             if(x_furtive_read)
00321                 x_old_alter_atime = alter_atime;
00322             else
00323                 x_alter_atime = alter_atime;
00324         };
00325 
00327         void set_furtive_read_mode(bool furtive_read)
00328         {
00329             NLS_SWAP_IN;
00330             try
00331             {
00332 
00333 #if FURTIVE_READ_MODE_AVAILABLE
00334                 x_furtive_read = furtive_read;
00335                 if(furtive_read)
00336                 {
00337                     x_old_alter_atime = x_alter_atime;
00338                     x_alter_atime = true;
00339                         // this is required to avoid libdar manipulating ctime of inodes
00340                 }
00341                 else
00342                     x_alter_atime = x_old_alter_atime;
00343 #else
00344                 if(furtive_read)
00345                     throw Ecompilation(gettext("Furtive read mode"));
00346                 x_furtive_read = false;
00347 #endif
00348             }
00349             catch(...)
00350             {
00351                 NLS_SWAP_OUT;
00352                 throw;
00353             }
00354             NLS_SWAP_OUT;
00355         };
00356 
00358         void set_same_fs(bool same_fs) { x_same_fs = same_fs; };
00359 
00361         void set_snapshot(bool snapshot) { x_snapshot = snapshot; };
00362 
00364         void set_cache_directory_tagging(bool cache_directory_tagging) { x_cache_directory_tagging = cache_directory_tagging; };
00365 
00367         void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; };
00368 
00370         void set_fixed_date(const infinint & fixed_date) { x_fixed_date = fixed_date; };
00371 
00373         void set_slice_permission(const std::string & slice_permission) { x_slice_permission = slice_permission; };
00374 
00376         void set_slice_user_ownership(const std::string & slice_user_ownership) { x_slice_user_ownership = slice_user_ownership; };
00377 
00379         void set_slice_group_ownership(const std::string & slice_group_ownership) { x_slice_group_ownership = slice_group_ownership; };
00380 
00382         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; };
00383 
00385         void set_sequential_marks(bool sequential) { x_sequential_marks = sequential; };
00386 
00388         void set_sparse_file_min_size(const infinint & size) { x_sparse_file_min_size = size; };
00389 
00391         void set_security_check(bool check) { x_security_check = check; };
00392 
00394         void set_user_comment(const std::string & comment) { x_user_comment = comment; };
00395 
00397         void set_hash_algo(hash_algo hash) { x_hash = hash; };
00398 
00400         void set_slice_min_digits(infinint val) { x_slice_min_digits = val; };
00401 
00403         void set_backup_hook(const std::string & execute, const mask & which_files);
00404 
00406         void set_ignore_unknown_inode_type(bool val) { x_ignore_unknown = val; };
00407 
00409             // getting methods
00410 
00411         archive *get_reference() const { return x_ref_arch; };
00412         const mask & get_selection() const { if(x_selection == NULL) throw SRC_BUG; return *x_selection; };
00413         const mask & get_subtree() const { if(x_subtree == NULL) throw SRC_BUG; return *x_subtree; };
00414         bool get_allow_over() const { return x_allow_over; };
00415         bool get_warn_over() const { return x_warn_over; };
00416         bool get_info_details() const { return x_info_details; };
00417         const infinint & get_pause() const { return x_pause; };
00418         bool get_empty_dir() const { return x_empty_dir; };
00419         compression get_compression() const { return x_compr_algo; };
00420         U_I get_compression_level() const { return x_compression_level; };
00421         const infinint & get_slice_size() const { return x_file_size; };
00422         const infinint & get_first_slice_size() const { return x_first_file_size; };
00423         const mask & get_ea_mask() const { if(x_ea_mask == NULL) throw SRC_BUG; return *x_ea_mask; };
00424         const std::string & get_execute() const { return x_execute; };
00425         crypto_algo get_crypto_algo() const { return x_crypto; };
00426         const secu_string & get_crypto_pass() const { return x_pass; };
00427         U_32 get_crypto_size() const { return x_crypto_size; };
00428         const mask & get_compr_mask() const { if(x_compr_mask == NULL) throw SRC_BUG; return *x_compr_mask; };
00429         const infinint & get_min_compr_size() const { return x_min_compr_size; };
00430         bool get_nodump() const { return x_nodump; };
00431         inode::comparison_fields get_comparison_fields() const { return x_what_to_check; };
00432         const infinint & get_hourshift() const { return x_hourshift; };
00433         bool get_empty() const { return x_empty; };
00434         bool get_alter_atime() const { return x_alter_atime; };
00435         bool get_furtive_read_mode() const { return x_furtive_read; };
00436         bool get_same_fs() const { return x_same_fs; };
00437         bool get_snapshot() const { return x_snapshot; };
00438         bool get_cache_directory_tagging() const { return x_cache_directory_tagging; };
00439         bool get_display_skipped() const { return x_display_skipped; };
00440         const infinint & get_fixed_date() const { return x_fixed_date; };
00441         const std::string & get_slice_permission() const { return x_slice_permission; };
00442         const std::string & get_slice_user_ownership() const { return x_slice_user_ownership; };
00443         const std::string & get_slice_group_ownership() const { return x_slice_group_ownership; };
00444         const infinint & get_repeat_count() const { return x_repeat_count; };
00445         const infinint & get_repeat_byte() const { return x_repeat_byte; };
00446         bool get_sequential_marks() const { return x_sequential_marks; };
00447         infinint get_sparse_file_min_size() const { return x_sparse_file_min_size; };
00448         bool get_security_check() const { return  x_security_check; };
00449         const std::string & get_user_comment() const { return x_user_comment; };
00450         hash_algo get_hash_algo() const { return x_hash; };
00451         infinint get_slice_min_digits() const { return x_slice_min_digits; };
00452         const std::string & get_backup_hook_file_execute() const { return x_backup_hook_file_execute; };
00453         const mask & get_backup_hook_file_mask() const { return *x_backup_hook_file_mask; };
00454         bool get_ignore_unknown_inode_type() const { return x_ignore_unknown; };
00455 
00456     private:
00457         archive *x_ref_arch; //< just contains the address of an existing object, no local copy of object is done here
00458         mask * x_selection;  //< points to a local copy of mask (must be allocated / releases by the archive_option_create object)
00459         mask * x_subtree;    //< points to a local copy of mask (must be allocated / releases by the archive_option_create objects)
00460         bool x_allow_over;
00461         bool x_warn_over;
00462         bool x_info_details;
00463         infinint x_pause;
00464         bool x_empty_dir;
00465         compression x_compr_algo;
00466         U_I x_compression_level;
00467         infinint x_file_size;
00468         infinint x_first_file_size;
00469         mask * x_ea_mask;    //< points to a local copy of mask (must be allocated / releases by the archive_option_create objects)
00470         std::string x_execute;
00471         crypto_algo x_crypto;
00472         secu_string x_pass;
00473         U_32 x_crypto_size;
00474         mask * x_compr_mask; //< points to a local copy of mask (must be allocated / releases by the archive_option_create objects)
00475         infinint x_min_compr_size;
00476         bool x_nodump;
00477         inode::comparison_fields x_what_to_check;
00478         infinint x_hourshift;
00479         bool x_empty;
00480         bool x_alter_atime;
00481         bool x_old_alter_atime; //< used to backup origina alter_atime value when activating furtive read mode
00482         bool x_furtive_read;
00483         bool x_same_fs;
00484         bool x_snapshot;
00485         bool x_cache_directory_tagging;
00486         bool x_display_skipped;
00487         infinint x_fixed_date;
00488         std::string x_slice_permission;
00489         std::string x_slice_user_ownership;
00490         std::string x_slice_group_ownership;
00491         infinint x_repeat_count;
00492         infinint x_repeat_byte;
00493         bool x_sequential_marks;
00494         infinint x_sparse_file_min_size;
00495         bool x_security_check;
00496         std::string x_user_comment;
00497         hash_algo x_hash;
00498         infinint x_slice_min_digits;
00499         mask * x_backup_hook_file_mask;
00500         std::string x_backup_hook_file_execute;
00501         bool x_ignore_unknown;
00502 
00503         void destroy();
00504         void copy_from(const archive_options_create & ref);
00505         void destroy_mask(mask * & ptr);
00506         void clean_mask(mask * & ptr);
00507         void check_mask(const mask & m);
00508     };
00509 
00510 
00511 
00512 
00513 
00514 
00518 
00520     class archive_options_isolate
00521     {
00522     public:
00523         archive_options_isolate() { clear(); };
00524 
00525         void clear();
00526 
00528             // setting methods
00529 
00531         void set_allow_over(bool allow_over) { x_allow_over = allow_over; };
00532 
00534         void set_warn_over(bool warn_over) { x_warn_over = warn_over; };
00535 
00537         void set_info_details(bool info_details) { x_info_details = info_details; };
00538 
00540         void set_pause(const infinint & pause) { x_pause = pause; };
00541 
00543         void set_compression(compression algo) { x_algo = algo; };
00544 
00546         void set_compression_level(U_I compression_level) { x_compression_level = compression_level; };
00547 
00549 
00553         void set_slicing(const infinint & file_size, const infinint & first_file_size = 0)
00554         {
00555             x_file_size = file_size;
00556             if(first_file_size == 0)
00557                 x_first_file_size = file_size;
00558             else
00559                 x_first_file_size = first_file_size;
00560         };
00561 
00563         void set_execute(const std::string & execute) { x_execute = execute; };
00564 
00566         void set_crypto_algo(crypto_algo crypto) { x_crypto = crypto; };
00567 
00569         void set_crypto_pass(const secu_string & pass) { x_pass = pass; };
00570 
00572         void set_crypto_size(U_32 crypto_size) { x_crypto_size = crypto_size; };
00573 
00575         void set_empty(bool empty) { x_empty = empty; };
00576 
00578         void set_slice_permission(const std::string & slice_permission) { x_slice_permission = slice_permission; };
00579 
00581         void set_slice_user_ownership(const std::string & slice_user_ownership) { x_slice_user_ownership = slice_user_ownership; };
00582 
00584         void set_slice_group_ownership(const std::string & slice_group_ownership) { x_slice_group_ownership = slice_group_ownership; };
00585 
00587         void set_user_comment(const std::string & comment) { x_user_comment = comment; };
00588 
00590         void set_hash_algo(hash_algo hash) { x_hash = hash; };
00591 
00593         void set_slice_min_digits(infinint val) { x_slice_min_digits = val; };
00594 
00596         void set_sequential_marks(bool sequential) { x_sequential_marks = sequential; };
00597 
00598 
00599 
00601             // getting methods
00602 
00603         bool get_allow_over() const { return x_allow_over; };
00604         bool get_warn_over() const { return x_warn_over; };
00605         bool get_info_details() const { return x_info_details; };
00606         const infinint & get_pause() const { return x_pause; };
00607         compression get_compression() const { return x_algo; };
00608         U_I get_compression_level() const { return x_compression_level; };
00609         const infinint & get_slice_size() const { return x_file_size; };
00610         const infinint & get_first_slice_size() const { return x_first_file_size; };
00611         const std::string & get_execute() const { return x_execute; };
00612         crypto_algo get_crypto_algo() const { return x_crypto; };
00613         const secu_string & get_crypto_pass() const { return x_pass; };
00614         U_32 get_crypto_size() const { return x_crypto_size; };
00615         bool get_empty() const { return x_empty; };
00616         const std::string & get_slice_permission() const { return x_slice_permission; };
00617         const std::string & get_slice_user_ownership() const { return x_slice_user_ownership; };
00618         const std::string & get_slice_group_ownership() const { return x_slice_group_ownership; };
00619         const std::string & get_user_comment() const { return x_user_comment; };
00620         hash_algo get_hash_algo() const { return x_hash; };
00621         infinint get_slice_min_digits() const { return x_slice_min_digits; };
00622         bool get_sequential_marks() const { return x_sequential_marks; };
00623 
00624     private:
00625         bool x_allow_over;
00626         bool x_warn_over;
00627         bool x_info_details;
00628         infinint x_pause;
00629         compression x_algo;
00630         U_I x_compression_level;
00631         infinint x_file_size;
00632         infinint x_first_file_size;
00633         std::string x_execute;
00634         crypto_algo x_crypto;
00635         secu_string x_pass;
00636         U_32 x_crypto_size;
00637         bool x_empty;
00638         std::string x_slice_permission;
00639         std::string x_slice_user_ownership;
00640         std::string x_slice_group_ownership;
00641         std::string x_user_comment;
00642         hash_algo x_hash;
00643         infinint x_slice_min_digits;
00644         bool x_sequential_marks;
00645 
00646     };
00647 
00648 
00649 
00653 
00655     class archive_options_merge
00656     {
00657     public:
00658 
00659         archive_options_merge() { x_selection = x_subtree = x_ea_mask = x_compr_mask = NULL; x_overwrite = NULL; clear(); };
00660         archive_options_merge(const archive_options_merge & ref) { copy_from(ref); };
00661         const archive_options_merge & operator = (const archive_options_merge & ref) { destroy(); copy_from(ref); return *this; };
00662         ~archive_options_merge() { destroy(); };
00663 
00664         void clear();
00665 
00667             // setting methods
00668 
00669         void set_auxilliary_ref(archive *ref) { x_ref = ref; };
00670 
00672         void set_selection(const mask & selection);
00673 
00675         void set_subtree(const mask & subtree);
00676 
00678         void set_allow_over(bool allow_over) { x_allow_over = allow_over; };
00679 
00681         void set_warn_over(bool warn_over) { x_warn_over = warn_over; };
00682 
00684         void set_overwriting_rules(const crit_action & overwrite);
00685 
00687         void set_info_details(bool info_details) { x_info_details = info_details; };
00688 
00690         void set_pause(const infinint & pause) { x_pause = pause; };
00691 
00693         void set_empty_dir(bool empty_dir) { x_empty_dir = empty_dir; };
00694 
00696         void set_compression(compression compr_algo) { x_compr_algo = compr_algo; };
00697 
00699         void set_compression_level(U_I compression_level) { x_compression_level = compression_level; };
00700 
00702 
00706         void set_slicing(const infinint & file_size, const infinint & first_file_size = 0)
00707         {
00708             x_file_size = file_size;
00709             if(first_file_size == 0)
00710                 x_first_file_size = file_size;
00711             else
00712                 x_first_file_size = first_file_size;
00713         };
00714 
00716         void set_ea_mask(const mask & ea_mask);
00717 
00719         void set_execute(const std::string & execute) { x_execute = execute; };
00720 
00722         void set_crypto_algo(crypto_algo crypto) { x_crypto = crypto; };
00723 
00726         void set_crypto_pass(const secu_string & pass) { x_pass = pass; };
00727 
00729         void set_crypto_size(U_32 crypto_size) { x_crypto_size = crypto_size; };
00730 
00732         void set_compr_mask(const mask & compr_mask);
00733 
00735         void set_min_compr_size(const infinint & min_compr_size) { x_min_compr_size = min_compr_size; };
00736 
00738         void set_empty(bool empty) { x_empty = empty; };
00739 
00741         void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; };
00742 
00744         void set_keep_compressed(bool keep_compressed) { x_keep_compressed = keep_compressed; };
00745 
00747         void set_slice_permission(const std::string & slice_permission) { x_slice_permission = slice_permission; };
00748 
00750         void set_slice_user_ownership(const std::string & slice_user_ownership) { x_slice_user_ownership = slice_user_ownership; };
00751 
00753         void set_slice_group_ownership(const std::string & slice_group_ownership) { x_slice_group_ownership = slice_group_ownership; };
00754 
00756         void set_decremental_mode(bool mode) { x_decremental = mode; };
00757 
00759         void set_sequential_marks(bool sequential) { x_sequential_marks = sequential; };
00760 
00762         void set_sparse_file_min_size(const infinint & size) { x_sparse_file_min_size = size; };
00763 
00765         void set_user_comment(const std::string & comment) { x_user_comment = comment; };
00766 
00768         void set_hash_algo(hash_algo hash) { x_hash = hash; };
00769 
00771         void set_slice_min_digits(infinint val) { x_slice_min_digits = val; };
00772 
00773 
00774 
00776             // getting methods
00777 
00778         archive * get_auxilliary_ref() const { return x_ref; };
00779         const mask & get_selection() const { if(x_selection == NULL) throw SRC_BUG; return *x_selection; };
00780         const mask & get_subtree() const { if(x_subtree == NULL) throw SRC_BUG; return *x_subtree; };
00781         bool get_allow_over() const { return x_allow_over; };
00782         bool get_warn_over() const { return x_warn_over; };
00783         const crit_action & get_overwriting_rules() const { if(x_overwrite == NULL) throw SRC_BUG; return *x_overwrite; };
00784         bool get_info_details() const { return x_info_details; };
00785         const infinint & get_pause() const { return x_pause; };
00786         bool get_empty_dir() const { return x_empty_dir; };
00787         compression get_compression() const { return x_compr_algo; };
00788         U_I get_compression_level() const { return x_compression_level; };
00789         const infinint & get_slice_size() const { return x_file_size; };
00790         const infinint & get_first_slice_size() const { return x_first_file_size; };
00791         const mask & get_ea_mask() const { if(x_ea_mask == NULL) throw SRC_BUG; return *x_ea_mask; };
00792         const std::string & get_execute() const { return x_execute; };
00793         crypto_algo get_crypto_algo() const { return x_crypto; };
00794         const secu_string & get_crypto_pass() const { return x_pass; };
00795         U_32 get_crypto_size() const { return x_crypto_size; };
00796         const mask & get_compr_mask() const { if(x_compr_mask == NULL) throw SRC_BUG; return *x_compr_mask; };
00797         const infinint & get_min_compr_size() const { return x_min_compr_size; };
00798         bool get_empty() const { return x_empty; };
00799         bool get_display_skipped() const { return x_display_skipped; };
00800         bool get_keep_compressed() const { return x_keep_compressed; };
00801         const std::string & get_slice_permission() const { return x_slice_permission; };
00802         const std::string & get_slice_user_ownership() const { return x_slice_user_ownership; };
00803         const std::string & get_slice_group_ownership() const { return x_slice_group_ownership; };
00804         bool get_decremental_mode() const { return x_decremental; };
00805         bool get_sequential_marks() const { return x_sequential_marks; };
00806         infinint get_sparse_file_min_size() const { return x_sparse_file_min_size; };
00807         const std::string & get_user_comment() const { return x_user_comment; };
00808         hash_algo get_hash_algo() const { return x_hash; };
00809         infinint get_slice_min_digits() const { return x_slice_min_digits; };
00810 
00811     private:
00812         archive * x_ref;
00813         mask * x_selection;
00814         mask * x_subtree;
00815         bool x_allow_over;
00816         bool x_warn_over;
00817         crit_action * x_overwrite;
00818         bool x_info_details;
00819         infinint x_pause;
00820         bool x_empty_dir;
00821         compression x_compr_algo;
00822         U_I x_compression_level;
00823         infinint x_file_size;
00824         infinint x_first_file_size;
00825         mask * x_ea_mask;
00826         std::string x_execute;
00827         crypto_algo x_crypto;
00828         secu_string x_pass;
00829         U_32 x_crypto_size;
00830         mask * x_compr_mask;
00831         infinint x_min_compr_size;
00832         bool x_empty;
00833         bool x_display_skipped;
00834         bool x_keep_compressed;
00835         std::string x_slice_permission;
00836         std::string x_slice_user_ownership;
00837         std::string x_slice_group_ownership;
00838         bool x_decremental;
00839         bool x_sequential_marks;
00840         infinint x_sparse_file_min_size;
00841         std::string x_user_comment;
00842         hash_algo x_hash;
00843         infinint x_slice_min_digits;
00844 
00845         void destroy();
00846         void copy_from(const archive_options_merge & ref);
00847     };
00848 
00849 
00853 
00855     class archive_options_extract
00856     {
00857     public:
00858         archive_options_extract() { x_selection = x_subtree = x_ea_mask = NULL; x_overwrite = NULL; clear(); };
00859         archive_options_extract(const archive_options_extract & ref) { copy_from(ref); };
00860         const archive_options_extract & operator = (const archive_options_extract & ref) { destroy(); copy_from(ref); return *this; };
00861         ~archive_options_extract() { destroy(); };
00862 
00863         void clear();
00864 
00866             // setting methods
00867 
00869         void set_selection(const mask & selection);
00870 
00872         void set_subtree(const mask & subtree);
00873 
00875         void set_warn_over(bool warn_over) { x_warn_over = warn_over; };
00876 
00878         void set_info_details(bool info_details) { x_info_details = info_details; };
00879 
00881         void set_ea_mask(const mask & ea_mask);
00882 
00884         void set_flat(bool flat) { x_flat = flat; };
00885 
00887         void set_what_to_check(inode::comparison_fields what_to_check) { x_what_to_check = what_to_check; };
00888 
00890         void set_warn_remove_no_match(bool warn_remove_no_match) { x_warn_remove_no_match = warn_remove_no_match; };
00891 
00893         void set_empty(bool empty) { x_empty = empty; };
00894 
00896         void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; };
00897 
00899         void set_empty_dir(bool empty_dir) { x_empty_dir = empty_dir; };
00900 
00902 
00905         void set_dirty_behavior(bool ignore, bool warn) { x_dirty = ignore ? dirty_ignore : (warn ? dirty_warn : dirty_ok); };
00906 
00908         void set_overwriting_rules(const crit_action & over);
00909 
00911 
00913         void set_only_deleted(bool val) { x_only_deleted = val; };
00914 
00915 
00917 
00919         void set_ignore_deleted(bool val) { x_ignore_deleted = val; };
00920 
00921 
00923             // getting methods
00924 
00925         enum t_dirty { dirty_ignore, dirty_warn, dirty_ok };
00926 
00927         const mask & get_selection() const { if(x_selection == NULL) throw SRC_BUG; return *x_selection; };
00928         const mask & get_subtree() const { if(x_subtree == NULL) throw SRC_BUG; return *x_subtree; };
00929         bool get_warn_over() const { return x_warn_over; };
00930         bool get_info_details() const { return x_info_details; };
00931         const mask & get_ea_mask() const { if(x_ea_mask == NULL) throw SRC_BUG; return *x_ea_mask; };
00932         bool get_flat() const { return x_flat; };
00933         inode::comparison_fields get_what_to_check() const { return x_what_to_check; };
00934         bool get_warn_remove_no_match() const { return x_warn_remove_no_match; };
00935         bool get_empty() const { return x_empty; };
00936         bool get_display_skipped() const { return x_display_skipped; };
00937         bool get_empty_dir() const { return x_empty_dir; };
00938         t_dirty get_dirty_behavior() const { return x_dirty; }
00939         const crit_action & get_overwriting_rules() const { if(x_overwrite == NULL) throw SRC_BUG; return *x_overwrite; };
00940         bool get_only_deleted() const { return x_only_deleted; };
00941         bool get_ignore_deleted() const { return x_ignore_deleted; };
00942 
00943     private:
00944         mask * x_selection;
00945         mask * x_subtree;
00946         bool x_warn_over;
00947         bool x_info_details;
00948         mask * x_ea_mask;
00949         bool x_flat;
00950         inode::comparison_fields x_what_to_check;
00951         bool x_warn_remove_no_match;
00952         bool x_empty;
00953         bool x_display_skipped;
00954         bool x_empty_dir;
00955         t_dirty x_dirty;
00956         crit_action *x_overwrite;
00957         bool x_only_deleted;
00958         bool x_ignore_deleted;
00959 
00960         void destroy();
00961         void copy_from(const archive_options_extract & ref);
00962     };
00963 
00964 
00965 
00966 
00970 
00972     class archive_options_listing
00973     {
00974     public:
00975         archive_options_listing() { x_selection = x_subtree = NULL;  clear(); };
00976         archive_options_listing(const archive_options_listing & ref) { copy_from(ref); };
00977         const archive_options_listing & operator = (const archive_options_listing & ref) { destroy(); copy_from(ref); return *this; };
00978         ~archive_options_listing() { destroy(); };
00979 
00980         void clear();
00981 
00983 
00984         enum listformat
00985         {
00986             normal,   //< the tar-like listing (this is the default)
00987             tree,     //< the original dar's tree listing (for those that like forest)
00988             xml       //< the xml catalogue output
00989         };
00990 
00992             // setting methods
00993 
00994         void set_info_details(bool info_details) { x_info_details = info_details; };
00995         void set_list_mode(listformat list_mode) { x_list_mode = list_mode; };
00996         void set_selection(const mask & selection);
00997         void set_subtree(const mask & subtree);
00998         void set_filter_unsaved(bool filter_unsaved) { x_filter_unsaved = filter_unsaved; };
00999         void set_display_ea(bool display_ea) { x_display_ea = display_ea; };
01000 
01002             // getting methods
01003 
01004         bool get_info_details() const { return x_info_details; };
01005         listformat get_list_mode() const { return x_list_mode; };
01006         const mask & get_selection() const;
01007         const mask & get_subtree() const;
01008         bool get_filter_unsaved() const { return x_filter_unsaved; };
01009         bool get_display_ea() const { return x_display_ea; };
01010 
01011     private:
01012         bool x_info_details;
01013         listformat x_list_mode;
01014         mask * x_selection;
01015         mask * x_subtree;
01016         bool x_filter_unsaved;
01017         bool x_display_ea;
01018 
01019         void destroy();
01020         void copy_from(const archive_options_listing & ref);
01021     };
01022 
01023 
01027 
01028 
01029     class archive_options_diff
01030     {
01031     public:
01032         archive_options_diff() { x_selection = x_subtree = x_ea_mask = NULL; clear(); };
01033         archive_options_diff(const archive_options_diff & ref) { copy_from(ref); };
01034         const archive_options_diff & operator = (const archive_options_diff & ref) { destroy(); copy_from(ref); return *this; };
01035         ~archive_options_diff() { destroy(); };
01036 
01037         void clear();
01038 
01040             // setting methods
01041 
01043         void set_selection(const mask & selection);
01044 
01046         void set_subtree(const mask & subtree);
01047 
01049         void set_info_details(bool info_details) { x_info_details = info_details; };
01050 
01052         void set_ea_mask(const mask & ea_mask);
01053 
01055         void set_what_to_check(inode::comparison_fields what_to_check) { x_what_to_check = what_to_check; };
01056 
01058 
01061         void set_alter_atime(bool alter_atime)
01062         {
01063             if(x_furtive_read)
01064                 x_old_alter_atime = alter_atime;
01065             else
01066                 x_alter_atime = alter_atime;
01067         };
01068 
01070         void set_furtive_read_mode(bool furtive_read);
01071 
01073         void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; };
01074 
01076         void set_hourshift(const infinint & hourshift) { x_hourshift = hourshift; };
01077 
01079         void set_compare_symlink_date(bool compare_symlink_date) { x_compare_symlink_date = compare_symlink_date; };
01080 
01081 
01083             // getting methods
01084 
01085         const mask & get_selection() const { if(x_selection == NULL) throw SRC_BUG; return *x_selection; };
01086         const mask & get_subtree() const { if(x_subtree == NULL) throw SRC_BUG; return *x_subtree; };
01087         bool get_info_details() const { return x_info_details; };
01088         const mask & get_ea_mask() const { if(x_ea_mask == NULL) throw SRC_BUG; return *x_ea_mask; };
01089         inode::comparison_fields get_what_to_check() const { return x_what_to_check; };
01090         bool get_alter_atime() const { return x_alter_atime; };
01091         bool get_furtive_read_mode() const { return x_furtive_read; };
01092         bool get_display_skipped() const { return x_display_skipped; };
01093         const infinint & get_hourshift() const { return x_hourshift; };
01094         bool get_compare_symlink_date() const { return x_compare_symlink_date; };
01095 
01096     private:
01097         mask * x_selection;
01098         mask * x_subtree;
01099         bool x_info_details;
01100         mask * x_ea_mask;
01101         inode::comparison_fields x_what_to_check;
01102         bool x_alter_atime;
01103         bool x_old_alter_atime;
01104         bool x_furtive_read;
01105         bool x_display_skipped;
01106         infinint x_hourshift;
01107         bool x_compare_symlink_date;
01108 
01109         void destroy();
01110         void copy_from(const archive_options_diff & ref);
01111     };
01112 
01113 
01114 
01115 
01119 
01121     class archive_options_test
01122     {
01123     public:
01124         archive_options_test() { x_selection = x_subtree = NULL; clear(); };
01125         archive_options_test(const archive_options_test & ref) { copy_from(ref); };
01126         const archive_options_test & operator = (const archive_options_test & ref) { destroy(); copy_from(ref); return *this; };
01127         ~archive_options_test() { destroy(); };
01128 
01129         void clear();
01130 
01132             // setting methods
01133 
01135         void set_selection(const mask & selection);
01136 
01138         void set_subtree(const mask & subtree);
01139 
01141         void set_info_details(bool info_details) { x_info_details = info_details; };
01142 
01144         void set_empty(bool empty) { x_empty = empty; };
01145 
01147         void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; };
01148 
01149 
01151             // getting methods
01152 
01153         const mask & get_selection() const { if(x_selection == NULL) throw SRC_BUG; return *x_selection; };
01154         const mask & get_subtree() const { if(x_subtree == NULL) throw SRC_BUG; return *x_subtree; };
01155         bool get_info_details() const { return x_info_details; };
01156         bool get_empty() const { return x_empty; };
01157         bool get_display_skipped() const { return x_display_skipped; };
01158 
01159     private:
01160         mask * x_selection;
01161         mask * x_subtree;
01162         bool x_info_details;
01163         bool x_empty;
01164         bool x_display_skipped;
01165 
01166         void destroy();
01167         void copy_from(const archive_options_test & ref);
01168     };
01169 
01171 
01172 } // end of namespace
01173 
01174 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines