1 // distribution boxbackup-0.11_trunk_2979 (svn version: 2979) 2 // Box Backup, http://www.boxbackup.org/ 3 // 4 // Copyright (c) 2003-2010, Ben Summers and contributors. 5 // All rights reserved. 6 // 7 // Note that this project uses mixed licensing. Any file with this license 8 // attached, or where the code LICENSE-GPL appears on the first line, falls 9 // under the "Box Backup GPL" license. See the file COPYING.txt for more 10 // information about this license. 11 // 12 // --------------------------------------------------------------------- 13 // This program is free software; you can redistribute it and/or 14 // modify it under the terms of the GNU General Public License 15 // as published by the Free Software Foundation; either version 2 16 // of the License, or (at your option) any later version. 17 // 18 // This program is distributed in the hope that it will be useful, 19 // but WITHOUT ANY WARRANTY; without even the implied warranty of 20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 // GNU General Public License for more details. 22 // 23 // You should have received a copy of the GNU General Public License 24 // along with this program; if not, write to the Free Software 25 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 26 // 27 // [http://www.gnu.org/licenses/old-licenses/gpl-2.0.html#SEC4] 28 // 29 // As a special exception to the GPLv2, the Box Backup Project gives 30 // permission to link any code falling under this license (the Box Backup 31 // GPL) with any software that can be downloaded from 32 // the OpenSSL website [http://www.openssl.org] under either the 33 // "OpenSSL License" or the "Original SSLeay License", and to distribute 34 // the linked executables under the terms of the "Box Backup GPL" license. 35 // 36 // As a special exception to the GPLv2, the Box Backup Project gives 37 // permission to link any code falling under this license (the Box Backup 38 // GPL) with any version of Microsoft's Volume Shadow Copy Service 7.2 SDK 39 // or Microsoft Windows Software Development Kit (SDK), including 40 // vssapi.lib, that can be downloaded from the Microsoft website 41 // [*.microsoft.com], and to distribute the linked executables under the 42 // terms of the "Box Backup GPL" license. 43 // -------------------------------------------------------------------------- 44 // 45 // File 46 // Name: BackupStoreFileWire.h 47 // Purpose: On the wire / disc formats for backup store files 48 // Created: 12/1/04 49 // 50 // -------------------------------------------------------------------------- 51 52 #ifndef BACKUPSTOREFILEWIRE__H 53 #define BACKUPSTOREFILEWIRE__H 54 55 #include "MD5Digest.h" 56 57 // set packing to one byte 58 #ifdef STRUCTURE_PACKING_FOR_WIRE_USE_HEADERS 59 #include "BeginStructPackForWire.h" 60 #else 61 BEGIN_STRUCTURE_PACKING_FOR_WIRE 62 #endif 63 64 typedef struct 65 { 66 int32_t mMagicValue; // also the version number 67 int64_t mNumBlocks; // number of blocks contained in the file 68 int64_t mContainerID; 69 int64_t mModificationTime; 70 int32_t mMaxBlockClearSize; // Maximum clear size that can be expected for a block 71 int32_t mOptions; // bitmask of options used 72 // Then a BackupStoreFilename 73 // Then a BackupClientFileAttributes 74 } file_StreamFormat; 75 76 typedef struct 77 { 78 int32_t mMagicValue; // different magic value 79 int64_t mOtherFileID; // the file ID of the 'other' file which may be referenced by the index 80 uint64_t mEntryIVBase; // base value for block IV 81 int64_t mNumBlocks; // repeat of value in file header 82 } file_BlockIndexHeader; 83 84 typedef struct 85 { 86 int32_t mSize; // size in clear 87 uint32_t mWeakChecksum; // weak, rolling checksum 88 uint8_t mStrongChecksum[MD5Digest::DigestLength]; // strong digest based checksum 89 } file_BlockIndexEntryEnc; 90 91 typedef struct 92 { 93 union 94 { 95 int64_t mEncodedSize; // size encoded, if > 0 96 int64_t mOtherBlockIndex; // 0 - block number in other file, if <= 0 97 }; 98 uint8_t mEnEnc[sizeof(file_BlockIndexEntryEnc)]; // Encoded section 99 } file_BlockIndexEntry; 100 101 // Use default packing 102 #ifdef STRUCTURE_PACKING_FOR_WIRE_USE_HEADERS 103 #include "EndStructPackForWire.h" 104 #else 105 END_STRUCTURE_PACKING_FOR_WIRE 106 #endif 107 108 // header for blocks of compressed data in files 109 #define HEADER_CHUNK_IS_COMPRESSED 1 // bit 110 #define HEADER_ENCODING_SHIFT 1 // shift value 111 #define HEADER_BLOWFISH_ENCODING 1 // value stored in bits 1 -- 7 112 #define HEADER_AES_ENCODING 2 // value stored in bits 1 -- 7 113 114 115 #endif // BACKUPSTOREFILEWIRE__H 116 117