/usr/include/dar/tlv.hpp is in libdar-dev 2.4.15-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | /*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2052 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// to contact the author : http://dar.linux.free.fr/email.html
/*********************************************************************/
/// \file tlv.hpp
/// \brief Generic Type Length Value data structures
/// \ingroup Private
#ifndef TLV_HPP
#define TLV_HPP
#include "/usr/include/dar/memory_file.hpp"
#include "/usr/include/dar/storage.hpp"
namespace libdar
{
/// \addtogroup Private
/// @{
/// Type Length Value Structure
/// this structure holds arbitrary type of data
/// this is used in particular for the slice header
class tlv
{
public:
// constructors & Co.
tlv() { type = 0; value = NULL; };
tlv(generic_file & f) { init(f); };
tlv(const tlv & ref) { copy_from(ref); };
~tlv() { detruit(); };
const tlv & operator = (const tlv & ref) { detruit(); copy_from(ref); return *this; };
// methods (read / write tlv datastructure to file)
void read(generic_file & f); //< same as the constructor but on an existing object
void write(generic_file & f) const; //< dumps the tlv contents to file
// methods to fill the tlv object
U_16 get_type() const { return type; }; //< get the TLV type
void set_type(U_16 val) { type = val; }; //< set the TLV type
void set_contents(const memory_file & contents); //< the generic_file object is provided to dump data to the tlv object
void get_contents(memory_file & contents) const; //< the generic_file object is provided to read data from the tlv object
#ifdef LIBDAR_SPECIAL_ALLOC
USE_SPECIAL_ALLOC(tlv);
#endif
private:
U_16 type;
storage *value;
void init(generic_file & f);
void copy_from(const tlv & ref);
void detruit() { if(value != NULL) { delete value; value = NULL; } };
};
/// @}
} // end of namespace
#endif
|