Disk ARchive  2.7.15
Full featured and portable backup and archiving tool
cat_signature.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2024 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // to contact the author, see the AUTHOR file
20 /*********************************************************************/
21 
25 
26 #ifndef CAT_SIGNATURE_HPP
27 #define CAT_SIGNATURE_HPP
28 
29 #include "../my_config.h"
30 #include "generic_file.hpp"
31 #include "archive_version.hpp"
32 #include "cat_status.hpp"
33 
34 extern "C"
35 {
36 } // end extern "C"
37 
38 
39 namespace libdar
40 {
43 
45 
49  {
50  public:
52  cat_signature(unsigned char original, saved_status status); // -> mk_signature()
53 
55  cat_signature(generic_file & f, const archive_version & reading_ver);
56 
58 
64  bool read(generic_file & f, const archive_version & reading_ver);
65  void write(generic_file &f);
66 
68 
72  bool get_base_and_status(unsigned char & base, saved_status & saved) const;
73 
74  static bool compatible_signature(unsigned char a, unsigned char b);
75 
76  private:
77  static constexpr U_8 SAVED_FAKE_BIT = 0x80;
78  static constexpr U_8 SAVED_NON_DELTA_BIT = 0x40;
79 
81 
83  //. type of inode: and the nature of the object that has to be build from the following bytes
84  //. status of the info: on which depends whether some or all field should be read in the following data
95  //. lower case letters have binary values 011xxxxx
96  //. and higher case have binary values 010xxxxx
99  //. 011----- (3) status is "saved" (backward compatibility) this is a lowercase letter
100  //. 010----- (2) status is "not_saved" (backward compatibily) this is an uppercase letter
101  //. 111----- (7) status is "fake" (backward compatibility) used only with lowercase letters
102  //. 001----- (1) status is "delta" (setting back the byte 6 to 1 gives the letter value)
103  //. 100----- (4) status is "inode_only (setting back the bytes as 011 gives the letter value)
104  //. 101----- (5) status is unused (setting back the high bytes to 011 gives the letter value)
105  //. 110----- (6) status is unused (setting back the high bytes to 011 gives the letter value)
106  //. 000----- (0) status is unused (setting back the high bytes to 011 gives the letter value)
107  unsigned char field;
108  };
110 
111 } // end of namespace
112 
113 #endif
class archive_version that rules which archive format to follow
the different status of data and EA
class archive_version manages the version of the archive format
class cat_signature combines the cat_entree::signature() of the object with its saved_status and read...
cat_signature(unsigned char original, saved_status status)
set a signature from running libdar
cat_signature(generic_file &f, const archive_version &reading_ver)
set a signature from an disk archive
bool read(generic_file &f, const archive_version &reading_ver)
read a signature from archive for an existing cat_signature object (overwrite its value)
unsigned char field
stores file type and status information
bool get_base_and_status(unsigned char &base, saved_status &saved) const
provide typ and status as read from the archive
this is the interface class from which all other data transfer classes inherit
class generic_file is defined here as well as class fichier
saved_status
data saved status for an entry
Definition: cat_status.hpp:45
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47