![]() |
Disk ARchive
2.5.2
Full featured and portable backup and archiving tool
|
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 MACRO_TOOLS_HPP 00027 #define MACRO_TOOLS_HPP 00028 00029 #include "../my_config.h" 00030 00031 extern "C" 00032 { 00033 #if HAVE_LIMITS_H 00034 #include <limits.h> 00035 #endif 00036 } 00037 #include <string> 00038 00039 #include "catalogue.hpp" 00040 #include "compressor.hpp" 00041 #include "infinint.hpp" 00042 #include "header_version.hpp" 00043 #include "generic_file.hpp" 00044 #include "scrambler.hpp" 00045 #include "crypto.hpp" 00046 #include "escape.hpp" 00047 #include "pile.hpp" 00048 #include "entrepot.hpp" 00049 #include "tools.hpp" 00050 #include "range.hpp" 00051 #include "slice_layout.hpp" 00052 #include "trivial_sar.hpp" 00053 00054 00057 00058 00059 #define BUFFER_SIZE 102400 00060 #ifdef SSIZE_MAX 00061 #if SSIZE_MAX < BUFFER_SIZE 00062 #undef BUFFER_SIZE 00063 #define BUFFER_SIZE SSIZE_MAX 00064 #endif 00065 #endif 00066 00067 #define GLOBAL_ELASTIC_BUFFER_SIZE 51200 00068 00069 namespace libdar 00070 { 00071 00072 extern const archive_version macro_tools_supported_version; 00073 extern const std::string LIBDAR_STACK_LABEL_UNCOMPRESSED; 00074 extern const std::string LIBDAR_STACK_LABEL_CLEAR; 00075 extern const std::string LIBDAR_STACK_LABEL_UNCYPHERED; 00076 extern const std::string LIBDAR_STACK_LABEL_LEVEL1; 00077 00079 extern trivial_sar *macro_tools_open_archive_tuyau(user_interaction & dialog, 00080 memory_pool *pool, 00081 S_I fd, 00082 gf_mode mode, 00083 const label & internal_name, 00084 const label & data_name, 00085 bool slice_header_format_07, 00086 const std::string & execute); 00087 00088 00115 00116 extern void macro_tools_open_archive(user_interaction & dialog, //< for user interaction 00117 memory_pool *pool, //< whether memory_pool allocation has to be performed 00118 const entrepot &where, //< slices location 00119 const std::string &basename, //< slice basename 00120 const infinint & min_digits, //< minimum digits for the slice number 00121 const std::string &extension, //< slice extensions 00122 crypto_algo crypto, //< encryption algorithm 00123 const secu_string &pass, //< pass key for crypto/scrambling 00124 U_32 crypto_size, //< crypto block size 00125 pile & stack, //< the stack of generic_file resulting of the archive openning 00126 header_version &ver, //< header read from raw data 00127 const std::string &input_pipe, //< named pipe for input when basename is "-" (dar_slave) 00128 const std::string &output_pipe, //< named pipe for output when basename is "-" (dar_slave) 00129 const std::string & execute, //< command to execute between slices 00130 infinint & second_terminateur_offset, //< where to start looking for the second terminateur (set to zero if there is only one terminateur). 00131 bool lax, // whether we skip&warn the usual verifications 00132 bool sequential_read, // whether to use the escape sequence (if present) to get archive contents and proceed to sequential reading 00133 bool info_details, // be or not verbose about the archive openning 00134 std::list<signator> & gnupg_signed, //< list of existing signature found for that archive (valid or not) 00135 slice_layout & sl, //< slicing layout of the archive 00136 bool multi_threaded); //< true if several thread shall be run concurrently by libdar 00137 // all allocated objects (ret1, ret2, scram), must be deleted when no more needed by the caller of this routine 00138 00140 extern catalogue *macro_tools_get_derivated_catalogue_from(user_interaction & dialog, 00141 memory_pool *pool, 00142 pile & data_stack, // where to get the files and EA from 00143 pile & cata_stack, // where to get the catalogue from 00144 const header_version & ver, // version format as defined in the header of the archive to read 00145 bool info_details, // verbose display (throught user_interaction) 00146 infinint &cat_size, // return size of archive in file (not in memory !) 00147 const infinint & second_terminateur_offset, // location of the second terminateur (zero if none exist) 00148 std::list<signator> & signatories, // returns the list of signatories (empty if archive is was not signed) 00149 bool lax_mode); // whether to do relaxed checkings 00150 00152 extern catalogue *macro_tools_get_catalogue_from(user_interaction & dialog, 00153 memory_pool *pool, 00154 pile & stack, // raw data access object 00155 const header_version & ver, // version format as defined in the header of the archive to read 00156 bool info_details, // verbose display (throught user_interaction) 00157 infinint &cat_size, // return size of archive in file (not in memory !) 00158 const infinint & second_terminateur_offset, 00159 std::list<signator> & signatories, // returns the list of signatories (empty if archive is was not signed) 00160 bool lax_mode); 00161 00163 extern catalogue *macro_tools_read_catalogue(user_interaction & dialog, 00164 memory_pool *pool, 00165 const header_version & ver, 00166 const pile_descriptor & cata_pdesc, 00167 const infinint & cat_size, 00168 std::list<signator> & signatories, 00169 bool lax_mode, 00170 const label & lax_layer1_data_name, 00171 bool only_detruits); 00172 00173 extern catalogue *macro_tools_lax_search_catalogue(user_interaction & dialog, 00174 memory_pool *pool, 00175 pile & stack, 00176 const archive_version & edition, 00177 compression compr_algo, 00178 bool info_details, 00179 bool even_partial_catalogues, 00180 const label & layer1_data_name); 00181 00182 // return the offset of the beginning of the catalogue. 00183 extern infinint macro_tools_get_terminator_start(generic_file & f, const archive_version & reading_ver); 00184 00244 00245 extern void macro_tools_create_layers(user_interaction & dialog, 00246 pile & layers, 00247 header_version & ver, 00248 slice_layout & slicing, 00249 const slice_layout *ref_slicing, 00250 memory_pool *pool, 00251 const entrepot & sauv_path_t, 00252 const std::string & filename, 00253 const std::string & extension, 00254 bool allow_over, 00255 bool warn_over, 00256 bool info_details, 00257 const infinint & pause, 00258 compression algo, 00259 U_I compression_level, 00260 const infinint & file_size, 00261 const infinint & first_file_size, 00262 const std::string & execute, 00263 crypto_algo crypto, 00264 const secu_string & pass, 00265 U_32 crypto_size, 00266 const std::vector<std::string> & gnupg_recipients, 00267 const std::vector<std::string> & gnupg_signatories, 00268 bool empty, 00269 const std::string & slice_permission, 00270 bool add_marks_for_sequential_reading, 00271 const std::string & user_comment, 00272 hash_algo hash, 00273 const infinint & slice_min_digits, 00274 const label & internal_name, 00275 const label & data_name, 00276 bool multi_threaded); 00277 00290 void macro_tools_close_layers(user_interaction & dialog, 00291 pile & layers, 00292 const header_version & ver, 00293 const catalogue & cat, 00294 bool info_details, 00295 crypto_algo crypto, 00296 compression algo, 00297 const std::vector<std::string> & gnupg_recipients, 00298 const std::vector<std::string> & gnupg_signatories, 00299 bool empty); 00300 00301 00308 range macro_tools_get_slices(const cat_nomme *obj, slice_layout sl); 00309 00310 } // end of namespace 00311 00313 00314 #endif