par1fileformat.h

Go to the documentation of this file.
00001 // This file is part of par2cmdline (a PAR 2.0 compatible file verification and
00002 // repair tool). See https://parchive.sourceforge.net for details of PAR 2.0.
00003 //
00004 // Copyright (c) 2003 Peter Brian Clements
00005 //
00006 // par2cmdline is free software; you can redistribute it and/or modify
00007 // it under the terms of the GNU General Public License as published by
00008 // the Free Software Foundation; either version 2 of the License, or
00009 // (at your option) any later version.
00010 //
00011 // par2cmdline is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014 // GNU General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU General Public License
00017 // along with this program; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00019 
00020 #ifndef __PAR1FILEFORMAT_H__
00021 #define __PAR1FILEFORMAT_H__
00022 
00023 #ifdef WIN32
00024 #pragma pack(push, 1)
00025 #define PACKED
00026 #else
00027 #define PACKED __attribute__ ((packed))
00028 #endif
00029 
00030 #ifdef _MSC_VER
00031 #pragma warning(disable:4200)
00032 #endif
00033 
00034 struct PAR1MAGIC {u8 magic[8];}PACKED;
00035 
00036 struct PAR1FILEHEADER
00037 {
00038   PAR1MAGIC   magic;
00039   leu32       fileversion;
00040   leu32       programversion;
00041   MD5Hash     controlhash;
00042   MD5Hash     sethash;
00043   leu64       volumenumber;
00044   leu64       numberoffiles;
00045   leu64       filelistoffset;
00046   leu64       filelistsize;
00047   leu64       dataoffset;
00048   leu64       datasize;
00049 }PACKED;
00050 
00051 struct PAR1FILEENTRY
00052 {
00053   leu64       entrysize;
00054   leu64       status;
00055   leu64       filesize;
00056   MD5Hash     hashfull;
00057   MD5Hash     hash16k;
00058   leu16       name[];
00059 }PACKED;
00060 
00061 enum FILEENTRYSTATUS
00062 {
00063   INPARITYVOLUME = 1,
00064   CHECKED = 2,
00065 };
00066 
00067 #ifdef _MSC_VER
00068 #pragma warning(default:4200)
00069 #endif
00070 
00071 #ifdef WIN32
00072 #pragma pack(pop)
00073 #endif
00074 #undef PACKED
00075 
00076 // Operators for comparing the MAGIC values
00077 
00078 inline bool operator == (const PAR1MAGIC &left, const PAR1MAGIC &right)
00079 {
00080   return (0==memcmp(&left, &right, sizeof(left)));
00081 }
00082 
00083 inline bool operator != (const PAR1MAGIC &left, const PAR1MAGIC &right)
00084 {
00085   return !operator==(left, right);
00086 }
00087 
00088 extern PAR1MAGIC par1_magic;
00089 
00090 #endif //__PAR1FILEFORMAT_H__

Generated on Sun Oct 12 01:45:30 2008 for NNTPGrab by  1.5.4