view src/win32/7zip/7z/CPP/7zip/Archive/Zip/ZipHeader.h @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line source
1 // Archive/Zip/Header.h
3 #ifndef __ARCHIVE_ZIP_HEADER_H
4 #define __ARCHIVE_ZIP_HEADER_H
6 #include "../../../Common/Types.h"
8 namespace NArchive {
9 namespace NZip {
11 namespace NSignature
12 {
13 extern UInt32 kLocalFileHeader;
14 extern UInt32 kDataDescriptor;
15 extern UInt32 kCentralFileHeader;
16 extern UInt32 kEndOfCentralDir;
17 extern UInt32 kZip64EndOfCentralDir;
18 extern UInt32 kZip64EndOfCentralDirLocator;
20 static const UInt32 kMarkerSize = 4;
21 }
23 const UInt32 kEcdSize = 22;
24 const UInt32 kZip64EcdSize = 44;
25 const UInt32 kZip64EcdLocatorSize = 20;
26 /*
27 struct CEndOfCentralDirectoryRecord
28 {
29 UInt16 ThisDiskNumber;
30 UInt16 StartCentralDirectoryDiskNumber;
31 UInt16 NumEntriesInCentaralDirectoryOnThisDisk;
32 UInt16 NumEntriesInCentaralDirectory;
33 UInt32 CentralDirectorySize;
34 UInt32 CentralDirectoryStartOffset;
35 UInt16 CommentSize;
36 };
38 struct CEndOfCentralDirectoryRecordFull
39 {
40 UInt32 Signature;
41 CEndOfCentralDirectoryRecord Header;
42 };
43 */
45 namespace NFileHeader
46 {
47 /*
48 struct CVersion
49 {
50 Byte Version;
51 Byte HostOS;
52 };
53 */
55 namespace NCompressionMethod
56 {
57 enum EType
58 {
59 kStored = 0,
60 kShrunk = 1,
61 kReduced1 = 2,
62 kReduced2 = 3,
63 kReduced3 = 4,
64 kReduced4 = 5,
65 kImploded = 6,
66 kReservedTokenizing = 7, // reserved for tokenizing
67 kDeflated = 8,
68 kDeflated64 = 9,
69 kPKImploding = 10,
71 kBZip2 = 12,
72 kLZMA = 14,
73 kTerse = 18,
74 kLz77 = 19,
75 kJpeg = 0x60,
76 kWavPack = 0x61,
77 kPPMd = 0x62,
78 kWzAES = 0x63
79 };
80 const int kNumCompressionMethods = 11;
81 const Byte kMadeByProgramVersion = 20;
83 const Byte kDeflateExtractVersion = 20;
84 const Byte kStoreExtractVersion = 10;
86 const Byte kSupportedVersion = 20;
87 }
89 namespace NExtraID
90 {
91 enum
92 {
93 kZip64 = 0x01,
94 kNTFS = 0x0A,
95 kStrongEncrypt = 0x17,
96 kWzAES = 0x9901
97 };
98 }
100 namespace NNtfsExtra
101 {
102 const UInt16 kTagTime = 1;
103 enum
104 {
105 kMTime = 0,
106 kATime = 1,
107 kCTime = 2
108 };
109 }
111 const UInt32 kLocalBlockSize = 26;
112 /*
113 struct CLocalBlock
114 {
115 CVersion ExtractVersion;
117 UInt16 Flags;
118 UInt16 CompressionMethod;
119 UInt32 Time;
120 UInt32 FileCRC;
121 UInt32 PackSize;
122 UInt32 UnPackSize;
123 UInt16 NameSize;
124 UInt16 ExtraSize;
125 };
126 */
128 const UInt32 kDataDescriptorSize = 16;
129 // const UInt32 kDataDescriptor64Size = 16 + 8;
130 /*
131 struct CDataDescriptor
132 {
133 UInt32 Signature;
134 UInt32 FileCRC;
135 UInt32 PackSize;
136 UInt32 UnPackSize;
137 };
139 struct CLocalBlockFull
140 {
141 UInt32 Signature;
142 CLocalBlock Header;
143 };
144 */
146 const UInt32 kCentralBlockSize = 42;
147 /*
148 struct CBlock
149 {
150 CVersion MadeByVersion;
151 CVersion ExtractVersion;
152 UInt16 Flags;
153 UInt16 CompressionMethod;
154 UInt32 Time;
155 UInt32 FileCRC;
156 UInt32 PackSize;
157 UInt32 UnPackSize;
158 UInt16 NameSize;
159 UInt16 ExtraSize;
160 UInt16 CommentSize;
161 UInt16 DiskNumberStart;
162 UInt16 InternalAttributes;
163 UInt32 ExternalAttributes;
164 UInt32 LocalHeaderOffset;
165 };
167 struct CBlockFull
168 {
169 UInt32 Signature;
170 CBlock Header;
171 };
172 */
174 namespace NFlags
175 {
176 const int kEncrypted = 1 << 0;
177 const int kLzmaEOS = 1 << 1;
178 const int kDescriptorUsedMask = 1 << 3;
179 const int kStrongEncrypted = 1 << 6;
180 const int kUtf8 = 1 << 11;
182 const int kImplodeDictionarySizeMask = 1 << 1;
183 const int kImplodeLiteralsOnMask = 1 << 2;
185 const int kDeflateTypeBitStart = 1;
186 const int kNumDeflateTypeBits = 2;
187 const int kNumDeflateTypes = (1 << kNumDeflateTypeBits);
188 const int kDeflateTypeMask = (1 << kNumDeflateTypeBits) - 1;
189 }
191 namespace NHostOS
192 {
193 enum EEnum
194 {
195 kFAT = 0,
196 kAMIGA = 1,
197 kVMS = 2, // VAX/VMS
198 kUnix = 3,
199 kVM_CMS = 4,
200 kAtari = 5, // what if it's a minix filesystem? [cjh]
201 kHPFS = 6, // filesystem used by OS/2 (and NT 3.x)
202 kMac = 7,
203 kZ_System = 8,
204 kCPM = 9,
205 kTOPS20 = 10, // pkzip 2.50 NTFS
206 kNTFS = 11, // filesystem used by Windows NT
207 kQDOS = 12, // SMS/QDOS
208 kAcorn = 13, // Archimedes Acorn RISC OS
209 kVFAT = 14, // filesystem used by Windows 95, NT
210 kMVS = 15,
211 kBeOS = 16, // hybrid POSIX/database filesystem
212 kTandem = 17,
213 kOS400 = 18,
214 kOSX = 19
215 };
216 }
217 namespace NUnixAttribute
218 {
219 const UInt32 kIFMT = 0170000; /* Unix file type mask */
221 const UInt32 kIFDIR = 0040000; /* Unix directory */
222 const UInt32 kIFREG = 0100000; /* Unix regular file */
223 const UInt32 kIFSOCK = 0140000; /* Unix socket (BSD, not SysV or Amiga) */
224 const UInt32 kIFLNK = 0120000; /* Unix symbolic link (not SysV, Amiga) */
225 const UInt32 kIFBLK = 0060000; /* Unix block special (not Amiga) */
226 const UInt32 kIFCHR = 0020000; /* Unix character special (not Amiga) */
227 const UInt32 kIFIFO = 0010000; /* Unix fifo (BCC, not MSC or Amiga) */
229 const UInt32 kISUID = 04000; /* Unix set user id on execution */
230 const UInt32 kISGID = 02000; /* Unix set group id on execution */
231 const UInt32 kISVTX = 01000; /* Unix directory permissions control */
232 const UInt32 kENFMT = kISGID; /* Unix record locking enforcement flag */
233 const UInt32 kIRWXU = 00700; /* Unix read, write, execute: owner */
234 const UInt32 kIRUSR = 00400; /* Unix read permission: owner */
235 const UInt32 kIWUSR = 00200; /* Unix write permission: owner */
236 const UInt32 kIXUSR = 00100; /* Unix execute permission: owner */
237 const UInt32 kIRWXG = 00070; /* Unix read, write, execute: group */
238 const UInt32 kIRGRP = 00040; /* Unix read permission: group */
239 const UInt32 kIWGRP = 00020; /* Unix write permission: group */
240 const UInt32 kIXGRP = 00010; /* Unix execute permission: group */
241 const UInt32 kIRWXO = 00007; /* Unix read, write, execute: other */
242 const UInt32 kIROTH = 00004; /* Unix read permission: other */
243 const UInt32 kIWOTH = 00002; /* Unix write permission: other */
244 const UInt32 kIXOTH = 00001; /* Unix execute permission: other */
245 }
247 namespace NAmigaAttribute
248 {
249 const UInt32 kIFMT = 06000; /* Amiga file type mask */
250 const UInt32 kIFDIR = 04000; /* Amiga directory */
251 const UInt32 kIFREG = 02000; /* Amiga regular file */
252 const UInt32 kIHIDDEN = 00200; /* to be supported in AmigaDOS 3.x */
253 const UInt32 kISCRIPT = 00100; /* executable script (text command file) */
254 const UInt32 kIPURE = 00040; /* allow loading into resident memory */
255 const UInt32 kIARCHIVE = 00020; /* not modified since bit was last set */
256 const UInt32 kIREAD = 00010; /* can be opened for reading */
257 const UInt32 kIWRITE = 00004; /* can be opened for writing */
258 const UInt32 kIEXECUTE = 00002; /* executable image, a loadable runfile */
259 const UInt32 kIDELETE = 00001; /* can be deleted */
260 }
261 }
263 }}
265 #endif