# archive.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 : dar.linux@free.fr
    00020 /*********************************************************************/
    00021 // $Id: archive.hpp,v 1.32.2.2 2009/04/07 08:45:29 edrusb Rel $
    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,   //< the tar-like listing (should be the default to use)
    00058             tree,     //< the original dar's tree listing (for those that like forest)
    00059             xml       //< the xml catalogue output
    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         const entree_stats get_stats() const { if(cat == NULL) throw SRC_BUG; return cat->get_stats(); };
    00445
    00447
    00451         const catalogue & get_catalogue() const { if(cat == NULL) throw SRC_BUG; return *cat; };
    00452
    00453     private:
    00454         enum operation { oper_create, oper_isolate, oper_merge };
    00455
    00456         generic_file *level1;
    00457         generic_file *scram;
    00458         compressor *level2;
    00459         header_version ver;
    00460         catalogue *cat;
    00461         infinint local_cat_size;
    00462         path *local_path;
    00463         bool exploitable; // is false if only the catalogue is available (for reference backup or isolation).
    00464
    00465         void free();
    00466         catalogue & get_cat() { if(cat == NULL) throw SRC_BUG; else return *cat; };
    00467         const header_version & get_header() const { return ver; };
    00468         const path & get_path() { if(local_path == NULL) throw SRC_BUG; else return *local_path; };
    00469
    00470         bool get_sar_param(infinint & sub_file_size, infinint & first_file_size, infinint & last_file_size,
    00471                            infinint & total_file_number);
    00472         infinint get_level2_size();
    00473         infinint get_cat_size() const { return local_cat_size; };
    00474
    00475         statistics op_create_in(user_interaction & dialog,
    00476                                 operation op,
    00477                                 const path & fs_root,
    00478                                 const path & sauv_path,
    00479                                 archive *ref_arch,
    00480                                 const mask & selection,
    00481                                 const mask & subtree,
    00482                                 const std::string & filename,
    00483                                 const std::string & extension,
    00484                                 bool allow_over,
    00485                                 bool warn_over,
    00486                                 bool info_details,
    00487                                 const infinint & pause,
    00488                                 bool empty_dir,
    00489                                 compression algo,
    00490                                 U_I compression_level,
    00491                                 const infinint & file_size,
    00492                                 const infinint & first_file_size,
    00493                                 const mask & ea_mask,
    00494                                 const std::string & execute,
    00495                                 crypto_algo crypto,
    00496                                 const std::string & pass,
    00497                                 U_32 crypto_size,
    00498                                 const mask & compr_mask,
    00499                                 const infinint & min_compr_size,
    00500                                 bool nodump,
    00501                                 const infinint & hourshift,
    00502                                 bool empty,
    00503                                 bool alter_atime,
    00504                                 bool same_fs,
    00505                                 inode::comparison_fields what_to_check,
    00506                                 bool snapshot,
    00507                                 bool cache_directory_tagging,
    00508                                 bool display_skipped,
    00509                                 const infinint & fixed_date,
    00510                                 statistics * progressive_report);
    00511
    00512         void op_create_in_sub(user_interaction & dialog,
    00513                               operation op,
    00514                               const path & fs_root,
    00515                               const path & sauv_path_t,
    00516                               catalogue  * ref_arch1,
    00517                               catalogue  * ref_arch2,
    00518                               const path * ref_path,
    00519                               const mask & selection,
    00520                               const mask & subtree,
    00521                               const std::string & filename,
    00522                               const std::string & extension,
    00523                               bool allow_over,
    00524                               bool warn_over,
    00525                               bool info_details,
    00526                               const infinint & pause,
    00527                               bool empty_dir,
    00528                               compression algo,
    00529                               U_I compression_level,
    00530                               const infinint & file_size,
    00531                               const infinint & first_file_size,
    00532                               const mask & ea_mask,
    00533                               const std::string & execute,
    00534                               crypto_algo crypto,
    00535                               const std::string & pass,
    00536                               U_32 crypto_size,
    00537                               const mask & compr_mask,
    00538                               const infinint & min_compr_size,
    00539                               bool nodump,
    00540                               const infinint & hourshift,
    00541                               bool empty,
    00542                               bool alter_atime,
    00543                               bool same_fs,
    00544                               inode::comparison_fields what_to_check,
    00545                               bool snapshot,
    00546                               bool cache_directory_tagging,
    00547                               bool display_skipped,
    00548                               bool keep_compressed,
    00549                               const infinint & fixed_date,
    00550                               statistics * st_ptr);
    00551
    00552         void disable_natural_destruction();
    00553         void enable_natural_destruction();
    00554     };
    00555
    00556 } // end of namespace
    00557
    00558 #endif