Disk ARchive  2.4.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
macro_tools.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 MACRO_TOOLS_HPP
27 #define MACRO_TOOLS_HPP
28 
29 #include "../my_config.h"
30 
31 extern "C"
32 {
33 #if HAVE_LIMITS_H
34 #include <limits.h>
35 #endif
36 
37 }
38 #include <string>
39 
40 #include "catalogue.hpp"
41 #include "compressor.hpp"
42 #include "infinint.hpp"
43 #include "header_version.hpp"
44 #include "generic_file.hpp"
45 #include "scrambler.hpp"
46 #include "crypto.hpp"
47 #include "escape.hpp"
48 #include "pile.hpp"
49 
52 
53 
54 #define BUFFER_SIZE 102400
55 #ifdef SSIZE_MAX
56 #if SSIZE_MAX < BUFFER_SIZE
57 #undef BUFFER_SIZE
58 #define BUFFER_SIZE SSIZE_MAX
59 #endif
60 #endif
61 
62 namespace libdar
63 {
64 
65  extern const archive_version macro_tools_supported_version;
66  extern const std::string LIBDAR_STACK_LABEL_UNCOMPRESSED;
67  extern const std::string LIBDAR_STACK_LABEL_CLEAR;
68  extern const std::string LIBDAR_STACK_LABEL_UNCYPHERED;
69  extern const std::string LIBDAR_STACK_LABEL_LEVEL1;
70 
71  extern void macro_tools_open_archive(user_interaction & dialog,
72  const path &sauv_path, // path to slices
73  const std::string &basename, // slice basename
74  const infinint & min_digits, // minimum digits for the slice number
75  const std::string &extension, // slice extensions
76  crypto_algo crypto, // encryption algorithm
77  const secu_string &pass, // pass key for crypto/scrambling
78  U_32 crypto_size, // crypto block size
79  pile & stack, // the stack of generic_file resulting of the archive openning
80  header_version &ver, // header read from raw data
81  const std::string &input_pipe, // named pipe for input when basename is "-" (dar_slave)
82  const std::string &output_pipe, // named pipe for output when basename is "-" (dar_slave)
83  const std::string & execute, // command to execute between slices
84  infinint & second_terminateur_offset, // where to start looking for the second terminateur (set to zero if there is only one terminateur).
85  bool lax, // whether we skip&warn the usual verifications
86  bool sequential_read, // whether to use the escape sequence (if present) to get archive contents and proceed to sequential reading
87  bool info_details); // be or not verbose about the archive openning
88  // all allocated objects (ret1, ret2, scram), must be deleted when no more needed by the caller of this routine
89 
90  extern catalogue *macro_tools_get_derivated_catalogue_from(user_interaction & dialog,
91  pile & data_stack, // where to get the files and EA from
92  pile & cata_stack, // where to get the catalogue from
93  const header_version & ver, // version format as defined in the header of the archive to read
94  bool info_details, // verbose display (throught user_interaction)
95  infinint &cat_size, // return size of archive in file (not in memory !)
96  const infinint & second_terminateur_offset, // location of the second terminateur (zero if none exist)
97  bool lax_mode); // whether to do relaxed checkings
98 
99  extern catalogue *macro_tools_get_catalogue_from(user_interaction & dialog,
100  pile & stack, // raw data access object
101  const header_version & ver, // version format as defined in the header of the archive to read
102  bool info_details, // verbose display (throught user_interaction)
103  infinint &cat_size, // return size of archive in file (not in memory !)
104  const infinint & second_terminateur_offset,
105  bool lax_mode);
106 
107  extern catalogue *macro_tools_lax_search_catalogue(user_interaction & dialog,
108  pile & stack,
109  const archive_version & edition,
110  compression compr_algo,
111  bool info_details,
112  bool even_partial_catalogues,
113  const label & layer1_data_name);
114 
115  // the beginning of the catalogue.
116 
117  extern infinint macro_tools_get_terminator_start(generic_file & f, const archive_version & reading_ver);
118 
119 } // end of namespace
120 
122 
123 #endif