00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00028
00029
00030 #ifndef ARCHIVE_HPP
00031 #define ARCHIVE_HPP
00032
00033 #include "../my_config.h"
00034
00035 #include "crypto.hpp"
00036 #include "path.hpp"
00037 #include "catalogue.hpp"
00038 #include "scrambler.hpp"
00039 #include "statistics.hpp"
00040
00041 namespace libdar
00042 {
00043
00045
00050 class archive
00051 {
00052 public:
00053
00055 enum listformat
00056 {
00057 normal,
00058 tree,
00059 xml
00060 };
00061
00063
00088 archive(user_interaction & dialog,
00089 const path & chem,
00090 const std::string & basename,
00091 const std::string & extension,
00092 crypto_algo crypto,
00093 const std::string &pass,
00094 U_32 crypto_size,
00095 const std::string & input_pipe,
00096 const std::string & output_pipe,
00097 const std::string & execute,
00098 bool info_details);
00099
00100
00102
00149 archive(user_interaction & dialog,
00150 const path & fs_root,
00151 const path & sauv_path,
00152 archive *ref_arch,
00153 const mask & selection,
00154 const mask & subtree,
00155 const std::string & filename,
00156 const std::string & extension,
00157 bool allow_over,
00158 bool warn_over,
00159 bool info_details,
00160 const infinint & pause,
00161 bool empty_dir,
00162 compression algo,
00163 U_I compression_level,
00164 const infinint &file_size,
00165 const infinint &first_file_size,
00166 const mask & ea_mask,
00167 const std::string & execute,
00168 crypto_algo crypto,
00169 const std::string & pass,
00170 U_32 crypto_size,
00171 const mask & compr_mask,
00172 const infinint & min_compr_size,
00173 bool nodump,
00174 inode::comparison_fields what_to_check,
00175 const infinint & hourshift,
00176 bool empty,
00177 bool alter_atime,
00178 bool same_fs,
00179 bool snapshot,
00180 bool cache_directory_tagging,
00181 bool display_skipped,
00182 const infinint & fixed_date,
00183 statistics * progressive_report);
00184
00185
00187
00206 archive(user_interaction & dialog,
00207 const path &sauv_path,
00208 archive *ref_arch,
00209 const std::string & filename,
00210 const std::string & extension,
00211 bool allow_over,
00212 bool warn_over,
00213 bool info_details,
00214 const infinint & pause,
00215 compression algo,
00216 U_I compression_level,
00217 const infinint &file_size,
00218 const infinint &first_file_size,
00219 const std::string & execute,
00220 crypto_algo crypto,
00221 const std::string & pass,
00222 U_32 crypto_size,
00223 bool empty);
00224
00225
00227
00265
00266 archive(user_interaction & dialog,
00267 const path & sauv_path,
00268 archive *ref_arch1,
00269 archive *ref_arch2,
00270 const mask & selection,
00271 const mask & subtree,
00272 const std::string & filename,
00273 const std::string & extension,
00274 bool allow_over,
00275 bool warn_over,
00276 bool info_details,
00277 const infinint & pause,
00278 bool empty_dir,
00279 compression algo,
00280 U_I compression_level,
00281 const infinint & file_size,
00282 const infinint & first_file_size,
00283 const mask & ea_mask,
00284 const std::string & execute,
00285 crypto_algo crypto,
00286 const std::string & pass,
00287 U_32 crypto_size,
00288 const mask & compr_mask,
00289 const infinint & min_compr_size,
00290 bool empty,
00291 bool display_skipped,
00292 bool keep_compressed,
00293 statistics * progressive_report);
00294
00295
00297 ~archive() { free(); };
00298
00299
00301
00332 statistics op_extract(user_interaction & dialog,
00333 const path &fs_root,
00334 const mask &selection,
00335 const mask &subtree,
00336 bool allow_over,
00337 bool warn_over,
00338 bool info_details,
00339 bool detruire,
00340 bool only_more_recent,
00341 const mask & ea_mask,
00342 bool flat,
00343 inode::comparison_fields what_to_check,
00344 bool warn_remove_no_match,
00345 const infinint & hourshift,
00346 bool empty,
00347 bool ea_erase,
00348 bool display_skipped,
00349 statistics *progressive_report);
00350
00351
00353
00359 void op_listing(user_interaction & dialog,
00360 bool info_details,
00361 archive::listformat list_mode,
00362 const mask &selection,
00363 bool filter_unsaved);
00364
00365
00367
00388 statistics op_diff(user_interaction & dialog,
00389 const path & fs_root,
00390 const mask &selection,
00391 const mask &subtree,
00392 bool info_details,
00393 const mask & ea_mask,
00394 inode::comparison_fields what_to_check,
00395 bool alter_atime,
00396 bool display_skipped,
00397 statistics * progressive_report,
00398 const infinint & hourshift = 0);
00399
00400
00402
00425 statistics op_test(user_interaction & dialog,
00426 const mask &selection,
00427 const mask &subtree,
00428 bool info_details,
00429 bool display_skipped,
00430 statistics * progressive_report);
00431
00432
00434
00442 bool get_children_of(user_interaction & dialog,
00443 const std::string & dir);
00444
00446 const entree_stats get_stats() const { if(cat == NULL) throw SRC_BUG; return cat->get_stats(); };
00447
00449
00453 const catalogue & get_catalogue() const { if(cat == NULL) throw SRC_BUG; return *cat; };
00454
00455 private:
00456 enum operation { oper_create, oper_isolate, oper_merge };
00457
00458 generic_file *level1;
00459 generic_file *scram;
00460 compressor *level2;
00461 header_version ver;
00462 catalogue *cat;
00463 infinint local_cat_size;
00464 path *local_path;
00465 bool exploitable;
00466
00467 void free();
00468 catalogue & get_cat() { if(cat == NULL) throw SRC_BUG; else return *cat; };
00469 const header_version & get_header() const { return ver; };
00470 const path & get_path() { if(local_path == NULL) throw SRC_BUG; else return *local_path; };
00471
00472 bool get_sar_param(infinint & sub_file_size, infinint & first_file_size, infinint & last_file_size,
00473 infinint & total_file_number);
00474 infinint get_level2_size();
00475 infinint get_cat_size() const { return local_cat_size; };
00476
00477 statistics op_create_in(user_interaction & dialog,
00478 operation op,
00479 const path & fs_root,
00480 const path & sauv_path,
00481 archive *ref_arch,
00482 const mask & selection,
00483 const mask & subtree,
00484 const std::string & filename,
00485 const std::string & extension,
00486 bool allow_over,
00487 bool warn_over,
00488 bool info_details,
00489 const infinint & pause,
00490 bool empty_dir,
00491 compression algo,
00492 U_I compression_level,
00493 const infinint & file_size,
00494 const infinint & first_file_size,
00495 const mask & ea_mask,
00496 const std::string & execute,
00497 crypto_algo crypto,
00498 const std::string & pass,
00499 U_32 crypto_size,
00500 const mask & compr_mask,
00501 const infinint & min_compr_size,
00502 bool nodump,
00503 const infinint & hourshift,
00504 bool empty,
00505 bool alter_atime,
00506 bool same_fs,
00507 inode::comparison_fields what_to_check,
00508 bool snapshot,
00509 bool cache_directory_tagging,
00510 bool display_skipped,
00511 const infinint & fixed_date,
00512 statistics * progressive_report);
00513
00514 void op_create_in_sub(user_interaction & dialog,
00515 operation op,
00516 const path & fs_root,
00517 const path & sauv_path_t,
00518 catalogue * ref_arch1,
00519 catalogue * ref_arch2,
00520 const path * ref_path,
00521 const mask & selection,
00522 const mask & subtree,
00523 const std::string & filename,
00524 const std::string & extension,
00525 bool allow_over,
00526 bool warn_over,
00527 bool info_details,
00528 const infinint & pause,
00529 bool empty_dir,
00530 compression algo,
00531 U_I compression_level,
00532 const infinint & file_size,
00533 const infinint & first_file_size,
00534 const mask & ea_mask,
00535 const std::string & execute,
00536 crypto_algo crypto,
00537 const std::string & pass,
00538 U_32 crypto_size,
00539 const mask & compr_mask,
00540 const infinint & min_compr_size,
00541 bool nodump,
00542 const infinint & hourshift,
00543 bool empty,
00544 bool alter_atime,
00545 bool same_fs,
00546 inode::comparison_fields what_to_check,
00547 bool snapshot,
00548 bool cache_directory_tagging,
00549 bool display_skipped,
00550 bool keep_compressed,
00551 const infinint & fixed_date,
00552 statistics * st_ptr);
00553
00554 void disable_natural_destruction();
00555 void enable_natural_destruction();
00556 };
00557
00558 }
00559
00560 #endif