source: box/trunk/lib/backupstore/BackupStoreFileWire.h @ 2945

Revision 2945, 2.1 KB checked in by chris, 13 months ago (diff)

Major refactoring to make lib/backupclient depend on lib/backupstore rather
than the other way around. This is needed to allow clients to have all the
code that they'd need to implement local backups (using the Local protocol)
in subsequent commits.

  • Property svn:eol-style set to native
Line 
1// --------------------------------------------------------------------------
2//
3// File
4//              Name:    BackupStoreFileWire.h
5//              Purpose: On the wire / disc formats for backup store files
6//              Created: 12/1/04
7//
8// --------------------------------------------------------------------------
9
10#ifndef BACKUPSTOREFILEWIRE__H
11#define BACKUPSTOREFILEWIRE__H
12
13#include "MD5Digest.h"
14
15// set packing to one byte
16#ifdef STRUCTURE_PACKING_FOR_WIRE_USE_HEADERS
17#include "BeginStructPackForWire.h"
18#else
19BEGIN_STRUCTURE_PACKING_FOR_WIRE
20#endif
21
22typedef struct
23{
24        int32_t mMagicValue;    // also the version number
25        int64_t mNumBlocks;             // number of blocks contained in the file
26        int64_t mContainerID;
27        int64_t mModificationTime;
28        int32_t mMaxBlockClearSize;             // Maximum clear size that can be expected for a block
29        int32_t mOptions;               // bitmask of options used
30        // Then a BackupStoreFilename
31        // Then a BackupClientFileAttributes
32} file_StreamFormat;
33
34typedef struct
35{
36        int32_t mMagicValue;    // different magic value
37        int64_t mOtherFileID;   // the file ID of the 'other' file which may be referenced by the index
38        uint64_t mEntryIVBase;  // base value for block IV
39        int64_t mNumBlocks;             // repeat of value in file header
40} file_BlockIndexHeader;
41
42typedef struct
43{
44        int32_t mSize;                  // size in clear
45        uint32_t mWeakChecksum; // weak, rolling checksum
46        uint8_t mStrongChecksum[MD5Digest::DigestLength];       // strong digest based checksum
47} file_BlockIndexEntryEnc;
48
49typedef struct
50{
51        union
52        {
53                int64_t mEncodedSize;           // size encoded, if > 0
54                int64_t mOtherBlockIndex;       // 0 - block number in other file, if <= 0
55        };
56        uint8_t mEnEnc[sizeof(file_BlockIndexEntryEnc)];        // Encoded section
57} file_BlockIndexEntry;
58
59// Use default packing
60#ifdef STRUCTURE_PACKING_FOR_WIRE_USE_HEADERS
61#include "EndStructPackForWire.h"
62#else
63END_STRUCTURE_PACKING_FOR_WIRE
64#endif
65
66// header for blocks of compressed data in files
67#define HEADER_CHUNK_IS_COMPRESSED              1       // bit
68#define HEADER_ENCODING_SHIFT                   1       // shift value
69#define HEADER_BLOWFISH_ENCODING                1       // value stored in bits 1 -- 7
70#define HEADER_AES_ENCODING                             2       // value stored in bits 1 -- 7
71
72
73#endif // BACKUPSTOREFILEWIRE__H
74
Note: See TracBrowser for help on using the repository browser.