|
|
1.1 root 1: /*
2: Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
3:
4: Governed by the TrueCrypt License 2.4 the full text of which is contained
5: in the file License.txt included in TrueCrypt binary and source code
6: distribution packages.
7: */
8:
9: #ifndef TC_HEADER_Volume_VolumeLayout
10: #define TC_HEADER_Volume_VolumeLayout
11:
12: #include "Platform/Platform.h"
13: #include "Volume/EncryptionAlgorithm.h"
14: #include "Volume/EncryptionMode.h"
15: #include "VolumeHeader.h"
16:
17: namespace TrueCrypt
18: {
19: class VolumeLayout;
20: typedef list < shared_ptr <VolumeLayout> > VolumeLayoutList;
21:
22: class VolumeLayout
23: {
24: public:
25: virtual ~VolumeLayout ();
26:
27: static VolumeLayoutList GetAvailableLayouts (VolumeType::Enum type = VolumeType::Unknown);
28: virtual uint64 GetDataOffset (uint64 volumeHostSize) const = 0;
29: virtual uint64 GetDataSize (uint64 volumeHostSize) const = 0;
30: virtual shared_ptr <VolumeHeader> GetHeader ();
31: virtual int GetHeaderOffset () const { return HeaderOffset; } // Positive value: offset from the start of host, negative: offset from the end
32: virtual uint32 GetHeaderSize () const { return HeaderSize; }
33: virtual EncryptionAlgorithmList GetSupportedEncryptionAlgorithms () const { return SupportedEncryptionAlgorithms; }
34: virtual EncryptionModeList GetSupportedEncryptionModes () const { return SupportedEncryptionModes; }
35: virtual VolumeType::Enum GetType () const { return Type; }
36:
37: protected:
38: VolumeLayout ();
39:
40: EncryptionAlgorithmList SupportedEncryptionAlgorithms;
41: EncryptionModeList SupportedEncryptionModes;
42:
43: int HeaderOffset;
44: uint32 HeaderSize;
45: VolumeType::Enum Type;
46:
47: shared_ptr <VolumeHeader> Header;
48:
49: private:
50: VolumeLayout (const VolumeLayout &);
51: VolumeLayout &operator= (const VolumeLayout &);
52: };
53:
54: class VolumeLayoutV1Normal : public VolumeLayout
55: {
56: public:
57: VolumeLayoutV1Normal ();
58: virtual ~VolumeLayoutV1Normal () { }
59:
60: virtual uint64 GetDataOffset (uint64 volumeHostSize) const;
61: virtual uint64 GetDataSize (uint64 volumeHostSize) const;
62:
63: private:
64: VolumeLayoutV1Normal (const VolumeLayoutV1Normal &);
65: VolumeLayoutV1Normal &operator= (const VolumeLayoutV1Normal &);
66: };
67:
68: class VolumeLayoutV1Hidden : public VolumeLayout
69: {
70: public:
71: VolumeLayoutV1Hidden ();
72: virtual ~VolumeLayoutV1Hidden () { }
73:
74: virtual uint64 GetDataOffset (uint64 volumeHostSize) const;
75: virtual uint64 GetDataSize (uint64 volumeHostSize) const;
76:
77: private:
78: VolumeLayoutV1Hidden (const VolumeLayoutV1Hidden &);
79: VolumeLayoutV1Hidden &operator= (const VolumeLayoutV1Hidden &);
80: };
81: }
82:
83: #endif // TC_HEADER_Volume_VolumeLayout
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.