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