Disk ARchive  2.4.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
archive_options.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2052 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 //
19 // to contact the author : http://dar.linux.free.fr/email.html
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 "compressor.hpp"
34 #include "catalogue.hpp"
35 #include "criterium.hpp"
36 #include "hash_fichier.hpp"
37 #include "secu_string.hpp"
38 #include "nls_swap.hpp"
39 
40 #include <string>
41 
42 namespace libdar
43 {
44  class archive; // needed to be able to use pointer on archive object.
45 
46 
50 
53 
54 
57  {
58  public:
61 
63  // set back to default (this is the state just after the object is constructed
64  // this method is to be used to reuse a given object
65 
67  void clear();
68 
69 
71  // setting methods
72 
73 
75  void set_crypto_algo(crypto_algo val) { x_crypto = val; };
76 
78  void set_crypto_pass(const secu_string & pass) { x_pass = pass; };
79 
81  void set_crypto_size(U_32 crypto_size) { x_crypto_size = crypto_size; };
82 
85 
87 
90  void set_input_pipe(const std::string & input_pipe) { x_input_pipe = input_pipe; };
91 
93 
96  void set_output_pipe(const std::string & output_pipe) { x_output_pipe = output_pipe; };
97 
99 
107  void set_execute(const std::string & execute) { x_execute = execute; };
108 
110  void set_info_details(bool info_details) { x_info_details = info_details; };
111 
113  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; };
116 
118  void set_ref_crypto_algo(crypto_algo ref_crypto) { x_ref_crypto = ref_crypto; };
119 
121  void set_ref_crypto_pass(const secu_string & ref_pass) { x_ref_pass = ref_pass; };
122 
124  void set_ref_crypto_size(U_32 ref_crypto_size) { x_ref_crypto_size = ref_crypto_size; };
125 
127 
135  void set_ref_execute(const std::string & ref_execute) { x_ref_execute = ref_execute; };
136 
138 
142  void set_lax(bool val) { x_lax = val; };
143 
145 
147 
148  void set_sequential_read(bool val) { x_sequential_read = val; };
149 
151 
152  void set_slice_min_digits(infinint val) { x_slice_min_digits = val; };
153 
155 
156  void set_ref_slice_min_digits(infinint val) { x_ref_slice_min_digits = val; };
157 
158 
160  // getting methods (mainly used inside libdar, but kept public and part of the API in the case it is needed)
161 
162 
163  crypto_algo get_crypto_algo() const { return x_crypto; };
164  const secu_string & get_crypto_pass() const { return x_pass; };
165  U_32 get_crypto_size() const { return x_crypto_size; };
166  const std::string & get_input_pipe() const { return x_input_pipe; };
167  const std::string & get_output_pipe() const { return x_output_pipe; };
168  const std::string & get_execute() const { return x_execute; };
169  bool get_info_details() const { return x_info_details; };
170  bool get_lax() const { return x_lax; };
171  bool get_sequential_read() const { return x_sequential_read; };
172  infinint get_slice_min_digits() const { return x_slice_min_digits; };
173 
174  // All methods that follow concern the archive where to fetch the (isolated) catalogue from
175  bool is_external_catalogue_set() const { return external_cat; };
176  const path & get_ref_path() const;
177  const std::string & get_ref_basename() const;
178  crypto_algo get_ref_crypto_algo() const { return x_ref_crypto; };
179  const secu_string & get_ref_crypto_pass() const { return x_ref_pass; };
180  U_32 get_ref_crypto_size() const { return x_ref_crypto_size; };
181  const std::string & get_ref_execute() const { return x_ref_execute; };
182  infinint get_ref_slice_min_digits() const { return x_ref_slice_min_digits; };
183 
184 
185  private:
186  crypto_algo x_crypto;
187  secu_string x_pass;
188  U_32 x_crypto_size;
189  std::string x_input_pipe;
190  std::string x_output_pipe;
191  std::string x_execute;
192  bool x_info_details;
193  bool x_lax;
194  bool x_sequential_read;
195  infinint x_slice_min_digits;
196 
197  // external catalogue relative fields
198  bool external_cat;
199  path x_ref_chem;
200  std::string x_ref_basename;
201  crypto_algo x_ref_crypto;
202  secu_string x_ref_pass;
203  U_32 x_ref_crypto_size;
204  std::string x_ref_execute;
205  infinint x_ref_slice_min_digits;
206  };
207 
208 
212 
215  {
216  public:
217  // default constructors and destructor.
218 
219  archive_options_create() { x_selection = x_subtree = x_ea_mask = x_compr_mask = x_backup_hook_file_mask = NULL; clear(); };
220  archive_options_create(const archive_options_create & ref) { copy_from(ref); };
221  const archive_options_create & operator = (const archive_options_create & ref) { destroy(); copy_from(ref); return *this; };
222  ~archive_options_create() { destroy(); };
223 
225  // set back to default (this is the state just after the object is constructed
226  // this method is to be used to reuse a given object
227 
229  void clear();
230 
231 
233  // setting methods
234 
236  void set_reference(archive *ref_arch) { x_ref_arch = ref_arch; };
237 
239  void set_selection(const mask & selection);
240 
242  void set_subtree(const mask & subtree);
243 
245  void set_allow_over(bool allow_over) { x_allow_over = allow_over; };
246 
248  void set_warn_over(bool warn_over) { x_warn_over = warn_over; };
249 
251  void set_info_details(bool info_details) { x_info_details = info_details; };
252 
254  void set_pause(const infinint & pause) { x_pause = pause; };
255 
257  void set_empty_dir(bool empty_dir) { x_empty_dir = empty_dir; };
258 
260  void set_compression(compression compr_algo) { x_compr_algo = compr_algo; };
261 
263  void set_compression_level(U_I compression_level) { x_compression_level = compression_level; };
264 
266 
270  void set_slicing(const infinint & file_size, const infinint & first_file_size = 0)
271  {
272  x_file_size = file_size;
273  if(first_file_size == 0)
274  x_first_file_size = file_size;
275  else
276  x_first_file_size = first_file_size;
277  };
278 
279 
281  void set_ea_mask(const mask & ea_mask);
282 
284  void set_execute(const std::string & execute) { x_execute = execute; };
285 
287  void set_crypto_algo(crypto_algo crypto) { x_crypto = crypto; };
288 
291  void set_crypto_pass(const secu_string & pass) { x_pass = pass; };
292 
294  void set_crypto_size(U_32 crypto_size) { x_crypto_size = crypto_size; };
295 
297  void set_compr_mask(const mask & compr_mask);
298 
300  void set_min_compr_size(const infinint & min_compr_size) { x_min_compr_size = min_compr_size; };
301 
303  void set_nodump(bool nodump) { x_nodump = nodump; };
304 
306  void set_what_to_check(inode::comparison_fields what_to_check) { x_what_to_check = what_to_check; };
307 
309  void set_hourshift(const infinint & hourshift) { x_hourshift = hourshift; };
310 
312  void set_empty(bool empty) { x_empty = empty; };
313 
315 
318  void set_alter_atime(bool alter_atime)
319  {
320  if(x_furtive_read)
321  x_old_alter_atime = alter_atime;
322  else
323  x_alter_atime = alter_atime;
324  };
325 
328  {
329  NLS_SWAP_IN;
330  try
331  {
332 
333 #if FURTIVE_READ_MODE_AVAILABLE
334  x_furtive_read = furtive_read;
335  if(furtive_read)
336  {
337  x_old_alter_atime = x_alter_atime;
338  x_alter_atime = true;
339  // this is required to avoid libdar manipulating ctime of inodes
340  }
341  else
342  x_alter_atime = x_old_alter_atime;
343 #else
344  if(furtive_read)
345  throw Ecompilation(gettext("Furtive read mode"));
346  x_furtive_read = false;
347 #endif
348  }
349  catch(...)
350  {
351  NLS_SWAP_OUT;
352  throw;
353  }
354  NLS_SWAP_OUT;
355  };
356 
358  void set_same_fs(bool same_fs) { x_same_fs = same_fs; };
359 
361  void set_snapshot(bool snapshot) { x_snapshot = snapshot; };
362 
364  void set_cache_directory_tagging(bool cache_directory_tagging) { x_cache_directory_tagging = cache_directory_tagging; };
365 
367  void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; };
368 
370  void set_fixed_date(const infinint & fixed_date) { x_fixed_date = fixed_date; };
371 
373  void set_slice_permission(const std::string & slice_permission) { x_slice_permission = slice_permission; };
374 
376  void set_slice_user_ownership(const std::string & slice_user_ownership) { x_slice_user_ownership = slice_user_ownership; };
377 
379  void set_slice_group_ownership(const std::string & slice_group_ownership) { x_slice_group_ownership = slice_group_ownership; };
380 
382  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; };
383 
385  void set_sequential_marks(bool sequential) { x_sequential_marks = sequential; };
386 
388  void set_sparse_file_min_size(const infinint & size) { x_sparse_file_min_size = size; };
389 
391  void set_security_check(bool check) { x_security_check = check; };
392 
394  void set_user_comment(const std::string & comment) { x_user_comment = comment; };
395 
397  void set_hash_algo(hash_algo hash) { x_hash = hash; };
398 
400  void set_slice_min_digits(infinint val) { x_slice_min_digits = val; };
401 
403  void set_backup_hook(const std::string & execute, const mask & which_files);
404 
406  void set_ignore_unknown_inode_type(bool val) { x_ignore_unknown = val; };
407 
409  // getting methods
410 
411  archive *get_reference() const { return x_ref_arch; };
412  const mask & get_selection() const { if(x_selection == NULL) throw SRC_BUG; return *x_selection; };
413  const mask & get_subtree() const { if(x_subtree == NULL) throw SRC_BUG; return *x_subtree; };
414  bool get_allow_over() const { return x_allow_over; };
415  bool get_warn_over() const { return x_warn_over; };
416  bool get_info_details() const { return x_info_details; };
417  const infinint & get_pause() const { return x_pause; };
418  bool get_empty_dir() const { return x_empty_dir; };
419  compression get_compression() const { return x_compr_algo; };
420  U_I get_compression_level() const { return x_compression_level; };
421  const infinint & get_slice_size() const { return x_file_size; };
422  const infinint & get_first_slice_size() const { return x_first_file_size; };
423  const mask & get_ea_mask() const { if(x_ea_mask == NULL) throw SRC_BUG; return *x_ea_mask; };
424  const std::string & get_execute() const { return x_execute; };
425  crypto_algo get_crypto_algo() const { return x_crypto; };
426  const secu_string & get_crypto_pass() const { return x_pass; };
427  U_32 get_crypto_size() const { return x_crypto_size; };
428  const mask & get_compr_mask() const { if(x_compr_mask == NULL) throw SRC_BUG; return *x_compr_mask; };
429  const infinint & get_min_compr_size() const { return x_min_compr_size; };
430  bool get_nodump() const { return x_nodump; };
431  inode::comparison_fields get_comparison_fields() const { return x_what_to_check; };
432  const infinint & get_hourshift() const { return x_hourshift; };
433  bool get_empty() const { return x_empty; };
434  bool get_alter_atime() const { return x_alter_atime; };
435  bool get_furtive_read_mode() const { return x_furtive_read; };
436  bool get_same_fs() const { return x_same_fs; };
437  bool get_snapshot() const { return x_snapshot; };
438  bool get_cache_directory_tagging() const { return x_cache_directory_tagging; };
439  bool get_display_skipped() const { return x_display_skipped; };
440  const infinint & get_fixed_date() const { return x_fixed_date; };
441  const std::string & get_slice_permission() const { return x_slice_permission; };
442  const std::string & get_slice_user_ownership() const { return x_slice_user_ownership; };
443  const std::string & get_slice_group_ownership() const { return x_slice_group_ownership; };
444  const infinint & get_repeat_count() const { return x_repeat_count; };
445  const infinint & get_repeat_byte() const { return x_repeat_byte; };
446  bool get_sequential_marks() const { return x_sequential_marks; };
447  infinint get_sparse_file_min_size() const { return x_sparse_file_min_size; };
448  bool get_security_check() const { return x_security_check; };
449  const std::string & get_user_comment() const { return x_user_comment; };
450  hash_algo get_hash_algo() const { return x_hash; };
451  infinint get_slice_min_digits() const { return x_slice_min_digits; };
452  const std::string & get_backup_hook_file_execute() const { return x_backup_hook_file_execute; };
453  const mask & get_backup_hook_file_mask() const { return *x_backup_hook_file_mask; };
454  bool get_ignore_unknown_inode_type() const { return x_ignore_unknown; };
455 
456  private:
457  archive *x_ref_arch; //< just contains the address of an existing object, no local copy of object is done here
458  mask * x_selection; //< points to a local copy of mask (must be allocated / releases by the archive_option_create object)
459  mask * x_subtree; //< points to a local copy of mask (must be allocated / releases by the archive_option_create objects)
460  bool x_allow_over;
461  bool x_warn_over;
462  bool x_info_details;
463  infinint x_pause;
464  bool x_empty_dir;
465  compression x_compr_algo;
466  U_I x_compression_level;
467  infinint x_file_size;
468  infinint x_first_file_size;
469  mask * x_ea_mask; //< points to a local copy of mask (must be allocated / releases by the archive_option_create objects)
470  std::string x_execute;
471  crypto_algo x_crypto;
472  secu_string x_pass;
473  U_32 x_crypto_size;
474  mask * x_compr_mask; //< points to a local copy of mask (must be allocated / releases by the archive_option_create objects)
475  infinint x_min_compr_size;
476  bool x_nodump;
477  inode::comparison_fields x_what_to_check;
478  infinint x_hourshift;
479  bool x_empty;
480  bool x_alter_atime;
481  bool x_old_alter_atime; //< used to backup origina alter_atime value when activating furtive read mode
482  bool x_furtive_read;
483  bool x_same_fs;
484  bool x_snapshot;
485  bool x_cache_directory_tagging;
486  bool x_display_skipped;
487  infinint x_fixed_date;
488  std::string x_slice_permission;
489  std::string x_slice_user_ownership;
490  std::string x_slice_group_ownership;
491  infinint x_repeat_count;
492  infinint x_repeat_byte;
493  bool x_sequential_marks;
494  infinint x_sparse_file_min_size;
495  bool x_security_check;
496  std::string x_user_comment;
497  hash_algo x_hash;
498  infinint x_slice_min_digits;
499  mask * x_backup_hook_file_mask;
500  std::string x_backup_hook_file_execute;
501  bool x_ignore_unknown;
502 
503  void destroy();
504  void copy_from(const archive_options_create & ref);
505  void destroy_mask(mask * & ptr);
506  void clean_mask(mask * & ptr);
507  void check_mask(const mask & m);
508  };
509 
510 
511 
512 
513 
514 
518 
521  {
522  public:
523  archive_options_isolate() { clear(); };
524 
525  void clear();
526 
528  // setting methods
529 
531  void set_allow_over(bool allow_over) { x_allow_over = allow_over; };
532 
534  void set_warn_over(bool warn_over) { x_warn_over = warn_over; };
535 
537  void set_info_details(bool info_details) { x_info_details = info_details; };
538 
540  void set_pause(const infinint & pause) { x_pause = pause; };
541 
543  void set_compression(compression algo) { x_algo = algo; };
544 
546  void set_compression_level(U_I compression_level) { x_compression_level = compression_level; };
547 
549 
553  void set_slicing(const infinint & file_size, const infinint & first_file_size = 0)
554  {
555  x_file_size = file_size;
556  if(first_file_size == 0)
557  x_first_file_size = file_size;
558  else
559  x_first_file_size = first_file_size;
560  };
561 
563  void set_execute(const std::string & execute) { x_execute = execute; };
564 
566  void set_crypto_algo(crypto_algo crypto) { x_crypto = crypto; };
567 
569  void set_crypto_pass(const secu_string & pass) { x_pass = pass; };
570 
572  void set_crypto_size(U_32 crypto_size) { x_crypto_size = crypto_size; };
573 
575  void set_empty(bool empty) { x_empty = empty; };
576 
578  void set_slice_permission(const std::string & slice_permission) { x_slice_permission = slice_permission; };
579 
581  void set_slice_user_ownership(const std::string & slice_user_ownership) { x_slice_user_ownership = slice_user_ownership; };
582 
584  void set_slice_group_ownership(const std::string & slice_group_ownership) { x_slice_group_ownership = slice_group_ownership; };
585 
587  void set_user_comment(const std::string & comment) { x_user_comment = comment; };
588 
590  void set_hash_algo(hash_algo hash) { x_hash = hash; };
591 
593  void set_slice_min_digits(infinint val) { x_slice_min_digits = val; };
594 
596  void set_sequential_marks(bool sequential) { x_sequential_marks = sequential; };
597 
598 
599 
601  // getting methods
602 
603  bool get_allow_over() const { return x_allow_over; };
604  bool get_warn_over() const { return x_warn_over; };
605  bool get_info_details() const { return x_info_details; };
606  const infinint & get_pause() const { return x_pause; };
607  compression get_compression() const { return x_algo; };
608  U_I get_compression_level() const { return x_compression_level; };
609  const infinint & get_slice_size() const { return x_file_size; };
610  const infinint & get_first_slice_size() const { return x_first_file_size; };
611  const std::string & get_execute() const { return x_execute; };
612  crypto_algo get_crypto_algo() const { return x_crypto; };
613  const secu_string & get_crypto_pass() const { return x_pass; };
614  U_32 get_crypto_size() const { return x_crypto_size; };
615  bool get_empty() const { return x_empty; };
616  const std::string & get_slice_permission() const { return x_slice_permission; };
617  const std::string & get_slice_user_ownership() const { return x_slice_user_ownership; };
618  const std::string & get_slice_group_ownership() const { return x_slice_group_ownership; };
619  const std::string & get_user_comment() const { return x_user_comment; };
620  hash_algo get_hash_algo() const { return x_hash; };
621  infinint get_slice_min_digits() const { return x_slice_min_digits; };
622  bool get_sequential_marks() const { return x_sequential_marks; };
623 
624  private:
625  bool x_allow_over;
626  bool x_warn_over;
627  bool x_info_details;
628  infinint x_pause;
629  compression x_algo;
630  U_I x_compression_level;
631  infinint x_file_size;
632  infinint x_first_file_size;
633  std::string x_execute;
634  crypto_algo x_crypto;
635  secu_string x_pass;
636  U_32 x_crypto_size;
637  bool x_empty;
638  std::string x_slice_permission;
639  std::string x_slice_user_ownership;
640  std::string x_slice_group_ownership;
641  std::string x_user_comment;
642  hash_algo x_hash;
643  infinint x_slice_min_digits;
644  bool x_sequential_marks;
645 
646  };
647 
648 
649 
653 
656  {
657  public:
658 
659  archive_options_merge() { x_selection = x_subtree = x_ea_mask = x_compr_mask = NULL; x_overwrite = NULL; clear(); };
660  archive_options_merge(const archive_options_merge & ref) { copy_from(ref); };
661  const archive_options_merge & operator = (const archive_options_merge & ref) { destroy(); copy_from(ref); return *this; };
662  ~archive_options_merge() { destroy(); };
663 
664  void clear();
665 
667  // setting methods
668 
669  void set_auxilliary_ref(archive *ref) { x_ref = ref; };
670 
672  void set_selection(const mask & selection);
673 
675  void set_subtree(const mask & subtree);
676 
678  void set_allow_over(bool allow_over) { x_allow_over = allow_over; };
679 
681  void set_warn_over(bool warn_over) { x_warn_over = warn_over; };
682 
684  void set_overwriting_rules(const crit_action & overwrite);
685 
687  void set_info_details(bool info_details) { x_info_details = info_details; };
688 
690  void set_pause(const infinint & pause) { x_pause = pause; };
691 
693  void set_empty_dir(bool empty_dir) { x_empty_dir = empty_dir; };
694 
696  void set_compression(compression compr_algo) { x_compr_algo = compr_algo; };
697 
699  void set_compression_level(U_I compression_level) { x_compression_level = compression_level; };
700 
702 
706  void set_slicing(const infinint & file_size, const infinint & first_file_size = 0)
707  {
708  x_file_size = file_size;
709  if(first_file_size == 0)
710  x_first_file_size = file_size;
711  else
712  x_first_file_size = first_file_size;
713  };
714 
716  void set_ea_mask(const mask & ea_mask);
717 
719  void set_execute(const std::string & execute) { x_execute = execute; };
720 
722  void set_crypto_algo(crypto_algo crypto) { x_crypto = crypto; };
723 
726  void set_crypto_pass(const secu_string & pass) { x_pass = pass; };
727 
729  void set_crypto_size(U_32 crypto_size) { x_crypto_size = crypto_size; };
730 
732  void set_compr_mask(const mask & compr_mask);
733 
735  void set_min_compr_size(const infinint & min_compr_size) { x_min_compr_size = min_compr_size; };
736 
738  void set_empty(bool empty) { x_empty = empty; };
739 
741  void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; };
742 
744  void set_keep_compressed(bool keep_compressed) { x_keep_compressed = keep_compressed; };
745 
747  void set_slice_permission(const std::string & slice_permission) { x_slice_permission = slice_permission; };
748 
750  void set_slice_user_ownership(const std::string & slice_user_ownership) { x_slice_user_ownership = slice_user_ownership; };
751 
753  void set_slice_group_ownership(const std::string & slice_group_ownership) { x_slice_group_ownership = slice_group_ownership; };
754 
756  void set_decremental_mode(bool mode) { x_decremental = mode; };
757 
759  void set_sequential_marks(bool sequential) { x_sequential_marks = sequential; };
760 
762  void set_sparse_file_min_size(const infinint & size) { x_sparse_file_min_size = size; };
763 
765  void set_user_comment(const std::string & comment) { x_user_comment = comment; };
766 
768  void set_hash_algo(hash_algo hash) { x_hash = hash; };
769 
771  void set_slice_min_digits(infinint val) { x_slice_min_digits = val; };
772 
773 
774 
776  // getting methods
777 
778  archive * get_auxilliary_ref() const { return x_ref; };
779  const mask & get_selection() const { if(x_selection == NULL) throw SRC_BUG; return *x_selection; };
780  const mask & get_subtree() const { if(x_subtree == NULL) throw SRC_BUG; return *x_subtree; };
781  bool get_allow_over() const { return x_allow_over; };
782  bool get_warn_over() const { return x_warn_over; };
783  const crit_action & get_overwriting_rules() const { if(x_overwrite == NULL) throw SRC_BUG; return *x_overwrite; };
784  bool get_info_details() const { return x_info_details; };
785  const infinint & get_pause() const { return x_pause; };
786  bool get_empty_dir() const { return x_empty_dir; };
787  compression get_compression() const { return x_compr_algo; };
788  U_I get_compression_level() const { return x_compression_level; };
789  const infinint & get_slice_size() const { return x_file_size; };
790  const infinint & get_first_slice_size() const { return x_first_file_size; };
791  const mask & get_ea_mask() const { if(x_ea_mask == NULL) throw SRC_BUG; return *x_ea_mask; };
792  const std::string & get_execute() const { return x_execute; };
793  crypto_algo get_crypto_algo() const { return x_crypto; };
794  const secu_string & get_crypto_pass() const { return x_pass; };
795  U_32 get_crypto_size() const { return x_crypto_size; };
796  const mask & get_compr_mask() const { if(x_compr_mask == NULL) throw SRC_BUG; return *x_compr_mask; };
797  const infinint & get_min_compr_size() const { return x_min_compr_size; };
798  bool get_empty() const { return x_empty; };
799  bool get_display_skipped() const { return x_display_skipped; };
800  bool get_keep_compressed() const { return x_keep_compressed; };
801  const std::string & get_slice_permission() const { return x_slice_permission; };
802  const std::string & get_slice_user_ownership() const { return x_slice_user_ownership; };
803  const std::string & get_slice_group_ownership() const { return x_slice_group_ownership; };
804  bool get_decremental_mode() const { return x_decremental; };
805  bool get_sequential_marks() const { return x_sequential_marks; };
806  infinint get_sparse_file_min_size() const { return x_sparse_file_min_size; };
807  const std::string & get_user_comment() const { return x_user_comment; };
808  hash_algo get_hash_algo() const { return x_hash; };
809  infinint get_slice_min_digits() const { return x_slice_min_digits; };
810 
811  private:
812  archive * x_ref;
813  mask * x_selection;
814  mask * x_subtree;
815  bool x_allow_over;
816  bool x_warn_over;
817  crit_action * x_overwrite;
818  bool x_info_details;
819  infinint x_pause;
820  bool x_empty_dir;
821  compression x_compr_algo;
822  U_I x_compression_level;
823  infinint x_file_size;
824  infinint x_first_file_size;
825  mask * x_ea_mask;
826  std::string x_execute;
827  crypto_algo x_crypto;
828  secu_string x_pass;
829  U_32 x_crypto_size;
830  mask * x_compr_mask;
831  infinint x_min_compr_size;
832  bool x_empty;
833  bool x_display_skipped;
834  bool x_keep_compressed;
835  std::string x_slice_permission;
836  std::string x_slice_user_ownership;
837  std::string x_slice_group_ownership;
838  bool x_decremental;
839  bool x_sequential_marks;
840  infinint x_sparse_file_min_size;
841  std::string x_user_comment;
842  hash_algo x_hash;
843  infinint x_slice_min_digits;
844 
845  void destroy();
846  void copy_from(const archive_options_merge & ref);
847  };
848 
849 
853 
856  {
857  public:
858  archive_options_extract() { x_selection = x_subtree = x_ea_mask = NULL; x_overwrite = NULL; clear(); };
859  archive_options_extract(const archive_options_extract & ref) { copy_from(ref); };
860  const archive_options_extract & operator = (const archive_options_extract & ref) { destroy(); copy_from(ref); return *this; };
861  ~archive_options_extract() { destroy(); };
862 
863  void clear();
864 
866  // setting methods
867 
869  void set_selection(const mask & selection);
870 
872  void set_subtree(const mask & subtree);
873 
875  void set_warn_over(bool warn_over) { x_warn_over = warn_over; };
876 
878  void set_info_details(bool info_details) { x_info_details = info_details; };
879 
881  void set_ea_mask(const mask & ea_mask);
882 
884  void set_flat(bool flat) { x_flat = flat; };
885 
887  void set_what_to_check(inode::comparison_fields what_to_check) { x_what_to_check = what_to_check; };
888 
890  void set_warn_remove_no_match(bool warn_remove_no_match) { x_warn_remove_no_match = warn_remove_no_match; };
891 
893  void set_empty(bool empty) { x_empty = empty; };
894 
896  void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; };
897 
899  void set_empty_dir(bool empty_dir) { x_empty_dir = empty_dir; };
900 
902 
905  void set_dirty_behavior(bool ignore, bool warn) { x_dirty = ignore ? dirty_ignore : (warn ? dirty_warn : dirty_ok); };
906 
908  void set_overwriting_rules(const crit_action & over);
909 
911 
913  void set_only_deleted(bool val) { x_only_deleted = val; };
914 
915 
917 
919  void set_ignore_deleted(bool val) { x_ignore_deleted = val; };
920 
921 
923  // getting methods
924 
925  enum t_dirty { dirty_ignore, dirty_warn, dirty_ok };
926 
927  const mask & get_selection() const { if(x_selection == NULL) throw SRC_BUG; return *x_selection; };
928  const mask & get_subtree() const { if(x_subtree == NULL) throw SRC_BUG; return *x_subtree; };
929  bool get_warn_over() const { return x_warn_over; };
930  bool get_info_details() const { return x_info_details; };
931  const mask & get_ea_mask() const { if(x_ea_mask == NULL) throw SRC_BUG; return *x_ea_mask; };
932  bool get_flat() const { return x_flat; };
933  inode::comparison_fields get_what_to_check() const { return x_what_to_check; };
934  bool get_warn_remove_no_match() const { return x_warn_remove_no_match; };
935  bool get_empty() const { return x_empty; };
936  bool get_display_skipped() const { return x_display_skipped; };
937  bool get_empty_dir() const { return x_empty_dir; };
938  t_dirty get_dirty_behavior() const { return x_dirty; }
939  const crit_action & get_overwriting_rules() const { if(x_overwrite == NULL) throw SRC_BUG; return *x_overwrite; };
940  bool get_only_deleted() const { return x_only_deleted; };
941  bool get_ignore_deleted() const { return x_ignore_deleted; };
942 
943  private:
944  mask * x_selection;
945  mask * x_subtree;
946  bool x_warn_over;
947  bool x_info_details;
948  mask * x_ea_mask;
949  bool x_flat;
950  inode::comparison_fields x_what_to_check;
951  bool x_warn_remove_no_match;
952  bool x_empty;
953  bool x_display_skipped;
954  bool x_empty_dir;
955  t_dirty x_dirty;
956  crit_action *x_overwrite;
957  bool x_only_deleted;
958  bool x_ignore_deleted;
959 
960  void destroy();
961  void copy_from(const archive_options_extract & ref);
962  };
963 
964 
965 
966 
970 
973  {
974  public:
975  archive_options_listing() { x_selection = x_subtree = NULL; clear(); };
976  archive_options_listing(const archive_options_listing & ref) { copy_from(ref); };
977  const archive_options_listing & operator = (const archive_options_listing & ref) { destroy(); copy_from(ref); return *this; };
978  ~archive_options_listing() { destroy(); };
979 
980  void clear();
981 
983 
985  {
986  normal, //< the tar-like listing (this is the default)
987  tree, //< the original dar's tree listing (for those that like forest)
988  xml //< the xml catalogue output
989  };
990 
992  // setting methods
993 
994  void set_info_details(bool info_details) { x_info_details = info_details; };
995  void set_list_mode(listformat list_mode) { x_list_mode = list_mode; };
996  void set_selection(const mask & selection);
997  void set_subtree(const mask & subtree);
998  void set_filter_unsaved(bool filter_unsaved) { x_filter_unsaved = filter_unsaved; };
999  void set_display_ea(bool display_ea) { x_display_ea = display_ea; };
1000 
1002  // getting methods
1003 
1004  bool get_info_details() const { return x_info_details; };
1005  listformat get_list_mode() const { return x_list_mode; };
1006  const mask & get_selection() const;
1007  const mask & get_subtree() const;
1008  bool get_filter_unsaved() const { return x_filter_unsaved; };
1009  bool get_display_ea() const { return x_display_ea; };
1010 
1011  private:
1012  bool x_info_details;
1013  listformat x_list_mode;
1014  mask * x_selection;
1015  mask * x_subtree;
1016  bool x_filter_unsaved;
1017  bool x_display_ea;
1018 
1019  void destroy();
1020  void copy_from(const archive_options_listing & ref);
1021  };
1022 
1023 
1027 
1028 
1029  class archive_options_diff
1030  {
1031  public:
1032  archive_options_diff() { x_selection = x_subtree = x_ea_mask = NULL; clear(); };
1033  archive_options_diff(const archive_options_diff & ref) { copy_from(ref); };
1034  const archive_options_diff & operator = (const archive_options_diff & ref) { destroy(); copy_from(ref); return *this; };
1035  ~archive_options_diff() { destroy(); };
1036 
1037  void clear();
1038 
1040  // setting methods
1041 
1043  void set_selection(const mask & selection);
1044 
1046  void set_subtree(const mask & subtree);
1047 
1049  void set_info_details(bool info_details) { x_info_details = info_details; };
1050 
1052  void set_ea_mask(const mask & ea_mask);
1053 
1055  void set_what_to_check(inode::comparison_fields what_to_check) { x_what_to_check = what_to_check; };
1056 
1058 
1061  void set_alter_atime(bool alter_atime)
1062  {
1063  if(x_furtive_read)
1064  x_old_alter_atime = alter_atime;
1065  else
1066  x_alter_atime = alter_atime;
1067  };
1068 
1070  void set_furtive_read_mode(bool furtive_read);
1071 
1073  void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; };
1074 
1076  void set_hourshift(const infinint & hourshift) { x_hourshift = hourshift; };
1077 
1079  void set_compare_symlink_date(bool compare_symlink_date) { x_compare_symlink_date = compare_symlink_date; };
1080 
1081 
1083  // getting methods
1084 
1085  const mask & get_selection() const { if(x_selection == NULL) throw SRC_BUG; return *x_selection; };
1086  const mask & get_subtree() const { if(x_subtree == NULL) throw SRC_BUG; return *x_subtree; };
1087  bool get_info_details() const { return x_info_details; };
1088  const mask & get_ea_mask() const { if(x_ea_mask == NULL) throw SRC_BUG; return *x_ea_mask; };
1089  inode::comparison_fields get_what_to_check() const { return x_what_to_check; };
1090  bool get_alter_atime() const { return x_alter_atime; };
1091  bool get_furtive_read_mode() const { return x_furtive_read; };
1092  bool get_display_skipped() const { return x_display_skipped; };
1093  const infinint & get_hourshift() const { return x_hourshift; };
1094  bool get_compare_symlink_date() const { return x_compare_symlink_date; };
1095 
1096  private:
1097  mask * x_selection;
1098  mask * x_subtree;
1099  bool x_info_details;
1100  mask * x_ea_mask;
1101  inode::comparison_fields x_what_to_check;
1102  bool x_alter_atime;
1103  bool x_old_alter_atime;
1104  bool x_furtive_read;
1105  bool x_display_skipped;
1106  infinint x_hourshift;
1107  bool x_compare_symlink_date;
1108 
1109  void destroy();
1110  void copy_from(const archive_options_diff & ref);
1111  };
1112 
1113 
1114 
1115 
1119 
1122  {
1123  public:
1124  archive_options_test() { x_selection = x_subtree = NULL; clear(); };
1125  archive_options_test(const archive_options_test & ref) { copy_from(ref); };
1126  const archive_options_test & operator = (const archive_options_test & ref) { destroy(); copy_from(ref); return *this; };
1127  ~archive_options_test() { destroy(); };
1128 
1129  void clear();
1130 
1132  // setting methods
1133 
1135  void set_selection(const mask & selection);
1136 
1138  void set_subtree(const mask & subtree);
1139 
1141  void set_info_details(bool info_details) { x_info_details = info_details; };
1142 
1144  void set_empty(bool empty) { x_empty = empty; };
1145 
1147  void set_display_skipped(bool display_skipped) { x_display_skipped = display_skipped; };
1148 
1149 
1151  // getting methods
1152 
1153  const mask & get_selection() const { if(x_selection == NULL) throw SRC_BUG; return *x_selection; };
1154  const mask & get_subtree() const { if(x_subtree == NULL) throw SRC_BUG; return *x_subtree; };
1155  bool get_info_details() const { return x_info_details; };
1156  bool get_empty() const { return x_empty; };
1157  bool get_display_skipped() const { return x_display_skipped; };
1158 
1159  private:
1160  mask * x_selection;
1161  mask * x_subtree;
1162  bool x_info_details;
1163  bool x_empty;
1164  bool x_display_skipped;
1165 
1166  void destroy();
1167  void copy_from(const archive_options_test & ref);
1168  };
1169 
1171 
1172 } // end of namespace
1173 
1174 #endif