1370b324cSopenharmony_ci// 7z/7zHeader.h
2370b324cSopenharmony_ci
3370b324cSopenharmony_ci#ifndef ZIP7_INC_7Z_HEADER_H
4370b324cSopenharmony_ci#define ZIP7_INC_7Z_HEADER_H
5370b324cSopenharmony_ci
6370b324cSopenharmony_ci#include "../../../Common/MyTypes.h"
7370b324cSopenharmony_ci
8370b324cSopenharmony_cinamespace NArchive {
9370b324cSopenharmony_cinamespace N7z {
10370b324cSopenharmony_ci
11370b324cSopenharmony_ciconst unsigned kSignatureSize = 6;
12370b324cSopenharmony_ciextern Byte kSignature[kSignatureSize];
13370b324cSopenharmony_ci
14370b324cSopenharmony_ci// #define Z7_7Z_VOL
15370b324cSopenharmony_ci// 7z-MultiVolume is not finished yet.
16370b324cSopenharmony_ci// It can work already, but I still do not like some
17370b324cSopenharmony_ci// things of that new multivolume format.
18370b324cSopenharmony_ci// So please keep it commented.
19370b324cSopenharmony_ci
20370b324cSopenharmony_ci#ifdef Z7_7Z_VOL
21370b324cSopenharmony_ciextern Byte kFinishSignature[kSignatureSize];
22370b324cSopenharmony_ci#endif
23370b324cSopenharmony_ci
24370b324cSopenharmony_cistruct CArchiveVersion
25370b324cSopenharmony_ci{
26370b324cSopenharmony_ci  Byte Major;
27370b324cSopenharmony_ci  Byte Minor;
28370b324cSopenharmony_ci};
29370b324cSopenharmony_ci
30370b324cSopenharmony_ciconst Byte kMajorVersion = 0;
31370b324cSopenharmony_ci
32370b324cSopenharmony_cistruct CStartHeader
33370b324cSopenharmony_ci{
34370b324cSopenharmony_ci  UInt64 NextHeaderOffset;
35370b324cSopenharmony_ci  UInt64 NextHeaderSize;
36370b324cSopenharmony_ci  UInt32 NextHeaderCRC;
37370b324cSopenharmony_ci};
38370b324cSopenharmony_ci
39370b324cSopenharmony_ciconst UInt32 kStartHeaderSize = 20;
40370b324cSopenharmony_ci
41370b324cSopenharmony_ci#ifdef Z7_7Z_VOL
42370b324cSopenharmony_cistruct CFinishHeader: public CStartHeader
43370b324cSopenharmony_ci{
44370b324cSopenharmony_ci  UInt64 ArchiveStartOffset;  // data offset from end if that struct
45370b324cSopenharmony_ci  UInt64 AdditionalStartBlockSize; // start  signature & start header size
46370b324cSopenharmony_ci};
47370b324cSopenharmony_ci
48370b324cSopenharmony_ciconst UInt32 kFinishHeaderSize = kStartHeaderSize + 16;
49370b324cSopenharmony_ci#endif
50370b324cSopenharmony_ci
51370b324cSopenharmony_cinamespace NID
52370b324cSopenharmony_ci{
53370b324cSopenharmony_ci  enum EEnum
54370b324cSopenharmony_ci  {
55370b324cSopenharmony_ci    kEnd,
56370b324cSopenharmony_ci
57370b324cSopenharmony_ci    kHeader,
58370b324cSopenharmony_ci
59370b324cSopenharmony_ci    kArchiveProperties,
60370b324cSopenharmony_ci
61370b324cSopenharmony_ci    kAdditionalStreamsInfo,
62370b324cSopenharmony_ci    kMainStreamsInfo,
63370b324cSopenharmony_ci    kFilesInfo,
64370b324cSopenharmony_ci
65370b324cSopenharmony_ci    kPackInfo,
66370b324cSopenharmony_ci    kUnpackInfo,
67370b324cSopenharmony_ci    kSubStreamsInfo,
68370b324cSopenharmony_ci
69370b324cSopenharmony_ci    kSize,
70370b324cSopenharmony_ci    kCRC,
71370b324cSopenharmony_ci
72370b324cSopenharmony_ci    kFolder,
73370b324cSopenharmony_ci
74370b324cSopenharmony_ci    kCodersUnpackSize,
75370b324cSopenharmony_ci    kNumUnpackStream,
76370b324cSopenharmony_ci
77370b324cSopenharmony_ci    kEmptyStream,
78370b324cSopenharmony_ci    kEmptyFile,
79370b324cSopenharmony_ci    kAnti,
80370b324cSopenharmony_ci
81370b324cSopenharmony_ci    kName,
82370b324cSopenharmony_ci    kCTime,
83370b324cSopenharmony_ci    kATime,
84370b324cSopenharmony_ci    kMTime,
85370b324cSopenharmony_ci    kWinAttrib,
86370b324cSopenharmony_ci    kComment,
87370b324cSopenharmony_ci
88370b324cSopenharmony_ci    kEncodedHeader,
89370b324cSopenharmony_ci
90370b324cSopenharmony_ci    kStartPos,
91370b324cSopenharmony_ci    kDummy
92370b324cSopenharmony_ci
93370b324cSopenharmony_ci    // kNtSecure,
94370b324cSopenharmony_ci    // kParent,
95370b324cSopenharmony_ci    // kIsAux
96370b324cSopenharmony_ci  };
97370b324cSopenharmony_ci}
98370b324cSopenharmony_ci
99370b324cSopenharmony_ci
100370b324cSopenharmony_ciconst UInt32 k_Copy = 0;
101370b324cSopenharmony_ciconst UInt32 k_Delta = 3;
102370b324cSopenharmony_ciconst UInt32 k_ARM64 = 0xa;
103370b324cSopenharmony_ci
104370b324cSopenharmony_ciconst UInt32 k_LZMA2 = 0x21;
105370b324cSopenharmony_ci
106370b324cSopenharmony_ciconst UInt32 k_SWAP2 = 0x20302;
107370b324cSopenharmony_ciconst UInt32 k_SWAP4 = 0x20304;
108370b324cSopenharmony_ci
109370b324cSopenharmony_ciconst UInt32 k_LZMA  = 0x30101;
110370b324cSopenharmony_ciconst UInt32 k_PPMD  = 0x30401;
111370b324cSopenharmony_ci
112370b324cSopenharmony_ciconst UInt32 k_Deflate   = 0x40108;
113370b324cSopenharmony_ciconst UInt32 k_Deflate64 = 0x40109;
114370b324cSopenharmony_ciconst UInt32 k_BZip2     = 0x40202;
115370b324cSopenharmony_ci
116370b324cSopenharmony_ciconst UInt32 k_BCJ   = 0x3030103;
117370b324cSopenharmony_ciconst UInt32 k_BCJ2  = 0x303011B;
118370b324cSopenharmony_ciconst UInt32 k_PPC   = 0x3030205;
119370b324cSopenharmony_ciconst UInt32 k_IA64  = 0x3030401;
120370b324cSopenharmony_ciconst UInt32 k_ARM   = 0x3030501;
121370b324cSopenharmony_ciconst UInt32 k_ARMT  = 0x3030701;
122370b324cSopenharmony_ciconst UInt32 k_SPARC = 0x3030805;
123370b324cSopenharmony_ci
124370b324cSopenharmony_ciconst UInt32 k_AES   = 0x6F10701;
125370b324cSopenharmony_ci
126370b324cSopenharmony_ci// const UInt32 k_ZSTD = 0x4015D; // winzip zstd
127370b324cSopenharmony_ci// 0x4F71101, 7z-zstd
128370b324cSopenharmony_ci
129370b324cSopenharmony_cistatic inline bool IsFilterMethod(UInt64 m)
130370b324cSopenharmony_ci{
131370b324cSopenharmony_ci  if (m > (UInt32)0xFFFFFFFF)
132370b324cSopenharmony_ci    return false;
133370b324cSopenharmony_ci  switch ((UInt32)m)
134370b324cSopenharmony_ci  {
135370b324cSopenharmony_ci    case k_Delta:
136370b324cSopenharmony_ci    case k_ARM64:
137370b324cSopenharmony_ci    case k_BCJ:
138370b324cSopenharmony_ci    case k_BCJ2:
139370b324cSopenharmony_ci    case k_PPC:
140370b324cSopenharmony_ci    case k_IA64:
141370b324cSopenharmony_ci    case k_ARM:
142370b324cSopenharmony_ci    case k_ARMT:
143370b324cSopenharmony_ci    case k_SPARC:
144370b324cSopenharmony_ci    case k_SWAP2:
145370b324cSopenharmony_ci    case k_SWAP4:
146370b324cSopenharmony_ci      return true;
147370b324cSopenharmony_ci  }
148370b324cSopenharmony_ci  return false;
149370b324cSopenharmony_ci}
150370b324cSopenharmony_ci
151370b324cSopenharmony_ci}}
152370b324cSopenharmony_ci
153370b324cSopenharmony_ci#endif
154