1 // 7z/7zHeader.h
2 
3 #ifndef __7Z_HEADER_H
4 #define __7Z_HEADER_H
5 
6 #include "../../../Common/MyTypes.h"
7 
8 namespace NArchive {
9 namespace N7z {
10 
11 const unsigned kSignatureSize = 6;
12 extern Byte kSignature[kSignatureSize];
13 
14 // #define _7Z_VOL
15 // 7z-MultiVolume is not finished yet.
16 // It can work already, but I still do not like some
17 // things of that new multivolume format.
18 // So please keep it commented.
19 
20 #ifdef _7Z_VOL
21 extern Byte kFinishSignature[kSignatureSize];
22 #endif
23 
24 struct CArchiveVersion
25 {
26   Byte Major;
27   Byte Minor;
28 };
29 
30 const Byte kMajorVersion = 0;
31 
32 struct CStartHeader
33 {
34   UInt64 NextHeaderOffset;
35   UInt64 NextHeaderSize;
36   UInt32 NextHeaderCRC;
37 };
38 
39 const UInt32 kStartHeaderSize = 20;
40 
41 #ifdef _7Z_VOL
42 struct CFinishHeader: public CStartHeader
43 {
44   UInt64 ArchiveStartOffset;  // data offset from end if that struct
45   UInt64 AdditionalStartBlockSize; // start  signature & start header size
46 };
47 
48 const UInt32 kFinishHeaderSize = kStartHeaderSize + 16;
49 #endif
50 
51 namespace NID
52 {
53   enum EEnum
54   {
55     kEnd,
56 
57     kHeader,
58 
59     kArchiveProperties,
60 
61     kAdditionalStreamsInfo,
62     kMainStreamsInfo,
63     kFilesInfo,
64 
65     kPackInfo,
66     kUnpackInfo,
67     kSubStreamsInfo,
68 
69     kSize,
70     kCRC,
71 
72     kFolder,
73 
74     kCodersUnpackSize,
75     kNumUnpackStream,
76 
77     kEmptyStream,
78     kEmptyFile,
79     kAnti,
80 
81     kName,
82     kCTime,
83     kATime,
84     kMTime,
85     kWinAttrib,
86     kComment,
87 
88     kEncodedHeader,
89 
90     kStartPos,
91     kDummy
92 
93     // kNtSecure,
94     // kParent,
95     // kIsAux
96   };
97 }
98 
99 
100 const UInt32 k_Copy = 0;
101 const UInt32 k_Delta = 3;
102 
103 const UInt32 k_LZMA2 = 0x21;
104 
105 const UInt32 k_SWAP2 = 0x20302;
106 const UInt32 k_SWAP4 = 0x20304;
107 
108 const UInt32 k_LZMA  = 0x30101;
109 const UInt32 k_PPMD  = 0x30401;
110 
111 const UInt32 k_Deflate = 0x40108;
112 const UInt32 k_BZip2   = 0x40202;
113 
114 const UInt32 k_BCJ   = 0x3030103;
115 const UInt32 k_BCJ2  = 0x303011B;
116 const UInt32 k_PPC   = 0x3030205;
117 const UInt32 k_IA64  = 0x3030401;
118 const UInt32 k_ARM   = 0x3030501;
119 const UInt32 k_ARMT  = 0x3030701;
120 const UInt32 k_SPARC = 0x3030805;
121 
122 const UInt32 k_AES   = 0x6F10701;
123 
124 
IsFilterMethod(UInt64 m)125 static inline bool IsFilterMethod(UInt64 m)
126 {
127   if (m > (UInt64)0xFFFFFFFF)
128     return false;
129   switch ((UInt32)m)
130   {
131     case k_Delta:
132     case k_BCJ:
133     case k_BCJ2:
134     case k_PPC:
135     case k_IA64:
136     case k_ARM:
137     case k_ARMT:
138     case k_SPARC:
139     case k_SWAP2:
140     case k_SWAP4:
141       return true;
142   }
143   return false;
144 }
145 
146 }}
147 
148 #endif
149