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
00387 statistics op_diff(user_interaction & dialog,
00388 const path & fs_root,
00389 const mask &selection,
00390 const mask &subtree,
00391 bool info_details,
00392 const mask & ea_mask,
00393 inode::comparison_fields what_to_check,
00394 bool alter_atime,
00395 bool display_skipped,
00396 statistics * progressive_report);
00397
00398
00400
00423 statistics op_test(user_interaction & dialog,
00424 const mask &selection,
00425 const mask &subtree,
00426 bool info_details,
00427 bool display_skipped,
00428 statistics * progressive_report);
00429
00430
00432
00440 bool get_children_of(user_interaction & dialog,
00441 const std::string & dir);
00442
00444
00448 const catalogue & get_catalogue() const { if(cat == NULL) throw SRC_BUG; return *cat; };
00449
00450 private:
00451 enum operation { oper_create, oper_isolate, oper_merge };
00452
00453 generic_file *level1;
00454 generic_file *scram;
00455 compressor *level2;
00456 header_version ver;
00457 catalogue *cat;
00458 infinint local_cat_size;
00459 path *local_path;
00460 bool exploitable;
00461
00462 void free();
00463 catalogue & get_cat() { if(cat == NULL) throw SRC_BUG; else return *cat; };
00464 const header_version & get_header() const { return ver; };
00465 const path & get_path() { if(local_path == NULL) throw SRC_BUG; else return *local_path; };
00466
00467 bool get_sar_param(infinint & sub_file_size, infinint & first_file_size, infinint & last_file_size,
00468 infinint & total_file_number);
00469 infinint get_level2_size();
00470 infinint get_cat_size() const { return local_cat_size; };
00471
00472 statistics op_create_in(user_interaction & dialog,
00473 operation op,
00474 const path & fs_root,
00475 const path & sauv_path,
00476 archive *ref_arch,
00477 const mask & selection,
00478 const mask & subtree,
00479 const std::string & filename,
00480 const std::string & extension,
00481 bool allow_over,
00482 bool warn_over,
00483 bool info_details,
00484 const infinint & pause,
00485 bool empty_dir,
00486 compression algo,
00487 U_I compression_level,
00488 const infinint & file_size,
00489 const infinint & first_file_size,
00490 const mask & ea_mask,
00491 const std::string & execute,
00492 crypto_algo crypto,
00493 const std::string & pass,
00494 U_32 crypto_size,
00495 const mask & compr_mask,
00496 const infinint & min_compr_size,
00497 bool nodump,
00498 const infinint & hourshift,
00499 bool empty,
00500 bool alter_atime,
00501 bool same_fs,
00502 inode::comparison_fields what_to_check,
00503 bool snapshot,
00504 bool cache_directory_tagging,
00505 bool display_skipped,
00506 const infinint & fixed_date,
00507 statistics * progressive_report);
00508
00509 void op_create_in_sub(user_interaction & dialog,
00510 operation op,
00511 const path & fs_root,
00512 const path & sauv_path_t,
00513 catalogue * ref_arch1,
00514 catalogue * ref_arch2,
00515 const path * ref_path,
00516 const mask & selection,
00517 const mask & subtree,
00518 const std::string & filename,
00519 const std::string & extension,
00520 bool allow_over,
00521 bool warn_over,
00522 bool info_details,
00523 const infinint & pause,
00524 bool empty_dir,
00525 compression algo,
00526 U_I compression_level,
00527 const infinint & file_size,
00528 const infinint & first_file_size,
00529 const mask & ea_mask,
00530 const std::string & execute,
00531 crypto_algo crypto,
00532 const std::string & pass,
00533 U_32 crypto_size,
00534 const mask & compr_mask,
00535 const infinint & min_compr_size,
00536 bool nodump,
00537 const infinint & hourshift,
00538 bool empty,
00539 bool alter_atime,
00540 bool same_fs,
00541 inode::comparison_fields what_to_check,
00542 bool snapshot,
00543 bool cache_directory_tagging,
00544 bool display_skipped,
00545 bool keep_compressed,
00546 const infinint & fixed_date,
00547 statistics * st_ptr);
00548
00549 void disable_natural_destruction();
00550 void enable_natural_destruction();
00551 };
00552
00553 }
00554
00555 #endif