1 // 7z/7zHeader.h
2
3 #ifndef ZIP7_INC_7Z_HEADER_H
4 #define ZIP7_INC_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 Z7_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 Z7_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 Z7_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 const UInt32 k_ARM64 = 0xa;
103 const UInt32 k_RISCV = 0xb;
104
105 const UInt32 k_LZMA2 = 0x21;
106
107 const UInt32 k_SWAP2 = 0x20302;
108 const UInt32 k_SWAP4 = 0x20304;
109
110 const UInt32 k_LZMA = 0x30101;
111 const UInt32 k_PPMD = 0x30401;
112
113 const UInt32 k_Deflate = 0x40108;
114 const UInt32 k_Deflate64 = 0x40109;
115 const UInt32 k_BZip2 = 0x40202;
116
117 const UInt32 k_BCJ = 0x3030103;
118 const UInt32 k_BCJ2 = 0x303011B;
119 const UInt32 k_PPC = 0x3030205;
120 const UInt32 k_IA64 = 0x3030401;
121 const UInt32 k_ARM = 0x3030501;
122 const UInt32 k_ARMT = 0x3030701;
123 const UInt32 k_SPARC = 0x3030805;
124
125 const UInt32 k_AES = 0x6F10701;
126
127 // const UInt32 k_ZSTD = 0x4015D; // winzip zstd
128 // 0x4F71101, 7z-zstd
129
IsFilterMethod(UInt64 m)130 inline bool IsFilterMethod(UInt64 m)
131 {
132 if (m > (UInt32)0xFFFFFFFF)
133 return false;
134 switch ((UInt32)m)
135 {
136 case k_Delta:
137 case k_ARM64:
138 case k_RISCV:
139 case k_BCJ:
140 case k_BCJ2:
141 case k_PPC:
142 case k_IA64:
143 case k_ARM:
144 case k_ARMT:
145 case k_SPARC:
146 case k_SWAP2:
147 case k_SWAP4:
148 return true;
149 default: break;
150 }
151 return false;
152 }
153
154 }}
155
156 #endif
157