cat_signature.hpp
Go to the documentation of this file.
/*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2023 Denis Corbin
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// to contact the author, see the AUTHOR file
/*********************************************************************/
#ifndef CAT_SIGNATURE_HPP
#define CAT_SIGNATURE_HPP
#include "../my_config.h"
#include "generic_file.hpp"
#include "archive_version.hpp"
#include "cat_status.hpp"
extern "C"
{
} // end extern "C"
namespace libdar
{
class cat_signature
{
public:
cat_signature(unsigned char original, saved_status status); // -> mk_signature()
cat_signature(generic_file & f, const archive_version & reading_ver);
bool read(generic_file & f, const archive_version & reading_ver);
void write(generic_file &f);
bool get_base_and_status(unsigned char & base, saved_status & saved) const;
static bool compatible_signature(unsigned char a, unsigned char b);
private:
static constexpr U_8 SAVED_FAKE_BIT = 0x80;
static constexpr U_8 SAVED_NON_DELTA_BIT = 0x40;
//. type of inode: and the nature of the object that has to be build from the following bytes
//. status of the info: on which depends whether some or all field should be read in the following data
//. lower case letters have binary values 011xxxxx
//. and higher case have binary values 010xxxxx
//. 011----- (3) status is "saved" (backward compatibility) this is a lowercase letter
//. 010----- (2) status is "not_saved" (backward compatibily) this is an uppercase letter
//. 111----- (7) status is "fake" (backward compatibility) used only with lowercase letters
//. 001----- (1) status is "delta" (setting back the byte 6 to 1 gives the letter value)
//. 100----- (4) status is "inode_only (setting back the bytes as 011 gives the letter value)
//. 101----- (5) status is unused (setting back the high bytes to 011 gives the letter value)
//. 110----- (6) status is unused (setting back the high bytes to 011 gives the letter value)
//. 000----- (0) status is unused (setting back the high bytes to 011 gives the letter value)
unsigned char field;
};
} // end of namespace
#endif
archive_version.hpp
class archive_version that rules which archive format to follow
cat_status.hpp
the different status of data and EA
libdar::archive_version
class archive_version manages the version of the archive format
Definition: archive_version.hpp:47
libdar::cat_signature
class cat_signature combines the cat_entree::signature() of the object with its saved_status and read...
Definition: cat_signature.hpp:49
libdar::cat_signature::cat_signature
cat_signature(unsigned char original, saved_status status)
set a signature from running libdar
libdar::cat_signature::cat_signature
cat_signature(generic_file &f, const archive_version &reading_ver)
set a signature from an disk archive
libdar::cat_signature::read
bool read(generic_file &f, const archive_version &reading_ver)
read a signature from archive for an existing cat_signature object (overwrite its value)
libdar::cat_signature::field
unsigned char field
stores file type and status information
Definition: cat_signature.hpp:107
libdar::cat_signature::get_base_and_status
bool get_base_and_status(unsigned char &base, saved_status &saved) const
provide typ and status as read from the archive
libdar::generic_file
this is the interface class from which all other data transfer classes inherit
Definition: generic_file.hpp:77
generic_file.hpp
class generic_file is defined here as well as class fichier
libdar::saved_status
saved_status
data saved status for an entry
Definition: cat_status.hpp:45
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47