Disk ARchive
2.4.5
|
00001 /*********************************************************************/ 00002 // dar - disk archive - a backup/restoration program 00003 // Copyright (C) 2002-2052 Denis Corbin 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 // 00019 // to contact the author : dar.linux@free.fr 00020 /*********************************************************************/ 00021 // $Id$ 00022 // 00023 /*********************************************************************/ 00024 00025 #ifndef HEADER_VERSION_HPP 00026 #define HEADER_VERSION_HPP 00027 00028 #pragma interface 00029 00030 #include "generic_file.hpp" 00031 #include "tools.hpp" 00032 00033 #define VERSION_FLAG_SAVED_EA_ROOT 0x80 00034 #define VERSION_FLAG_SAVED_EA_USER 0x40 00035 #define VERSION_FLAG_SCRAMBLED 0x20 00036 00037 #define VERSION_SIZE 3 00038 typedef char version[VERSION_SIZE]; 00039 extern void version_copy(version & left, const version & right); 00040 extern bool version_greater(const version & left, const version & right); 00041 // operation left > right 00042 00043 struct header_version 00044 { 00045 version edition; 00046 char algo_zip; 00047 string cmd_line; 00048 unsigned char flag; // added at edition 02 00049 00050 void read(generic_file &f) 00051 { 00052 f.read(edition, sizeof(edition)); 00053 f.read(&algo_zip, sizeof(algo_zip)); 00054 tools_read_string(f, cmd_line); 00055 if(version_greater(edition, "01")) 00056 f.read((char *)&flag, (size_t)1); 00057 else 00058 flag = 0; 00059 }; 00060 void write(generic_file &f) 00061 { 00062 f.write(edition, sizeof(edition)); 00063 f.write(&algo_zip, sizeof(algo_zip)); 00064 tools_write_string(f, cmd_line); 00065 f.write((char *)&flag, (size_t)1); 00066 }; 00067 }; 00068 00069 #endif