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