/src/others/squashfs-2.2-r2-7z/p7zip/7zip/Archive/Zip/ZipHeader.h

https://gitlab.com/Red54/firmware-mod-kit · C Header · 237 lines · 127 code · 25 blank · 85 comment · 0 complexity · d5e9eeb61e325221b3dc55a77a1abfcd MD5 · raw file

  1. // Archive/Zip/Header.h
  2. #ifndef __ARCHIVE_ZIP_HEADER_H
  3. #define __ARCHIVE_ZIP_HEADER_H
  4. #include "Common/Types.h"
  5. namespace NArchive {
  6. namespace NZip {
  7. namespace NSignature
  8. {
  9. extern UInt32 kLocalFileHeader;
  10. extern UInt32 kDataDescriptor;
  11. extern UInt32 kCentralFileHeader;
  12. extern UInt32 kEndOfCentralDir;
  13. extern UInt32 kZip64EndOfCentralDir;
  14. extern UInt32 kZip64EndOfCentralDirLocator;
  15. static const UInt32 kMarkerSize = 4;
  16. }
  17. const UInt32 kZip64EndOfCentralDirRecordSize = 44;
  18. /*
  19. struct CEndOfCentralDirectoryRecord
  20. {
  21. UInt16 ThisDiskNumber;
  22. UInt16 StartCentralDirectoryDiskNumber;
  23. UInt16 NumEntriesInCentaralDirectoryOnThisDisk;
  24. UInt16 NumEntriesInCentaralDirectory;
  25. UInt32 CentralDirectorySize;
  26. UInt32 CentralDirectoryStartOffset;
  27. UInt16 CommentSize;
  28. };
  29. struct CEndOfCentralDirectoryRecordFull
  30. {
  31. UInt32 Signature;
  32. CEndOfCentralDirectoryRecord Header;
  33. };
  34. */
  35. namespace NFileHeader
  36. {
  37. /*
  38. struct CVersion
  39. {
  40. Byte Version;
  41. Byte HostOS;
  42. };
  43. */
  44. namespace NCompressionMethod
  45. {
  46. enum EType
  47. {
  48. kStored = 0,
  49. kShrunk = 1,
  50. kReduced1 = 2,
  51. kReduced2 = 3,
  52. kReduced3 = 4,
  53. kReduced4 = 5,
  54. kImploded = 6,
  55. kReservedTokenizing = 7, // reserved for tokenizing
  56. kDeflated = 8,
  57. kDeflated64 = 9,
  58. kPKImploding = 10,
  59. kBZip2 = 12,
  60. kWinZipPPMd = 0x62
  61. };
  62. const int kNumCompressionMethods = 11;
  63. const Byte kMadeByProgramVersion = 20;
  64. const Byte kDeflateExtractVersion = 20;
  65. const Byte kStoreExtractVersion = 10;
  66. const Byte kSupportedVersion = 20;
  67. }
  68. const UInt32 kLocalBlockSize = 26;
  69. /*
  70. struct CLocalBlock
  71. {
  72. CVersion ExtractVersion;
  73. UInt16 Flags;
  74. UInt16 CompressionMethod;
  75. UInt32 Time;
  76. UInt32 FileCRC;
  77. UInt32 PackSize;
  78. UInt32 UnPackSize;
  79. UInt16 NameSize;
  80. UInt16 ExtraSize;
  81. };
  82. */
  83. const UInt32 kDataDescriptorSize = 16;
  84. /*
  85. struct CDataDescriptor
  86. {
  87. UInt32 Signature;
  88. UInt32 FileCRC;
  89. UInt32 PackSize;
  90. UInt32 UnPackSize;
  91. };
  92. struct CLocalBlockFull
  93. {
  94. UInt32 Signature;
  95. CLocalBlock Header;
  96. };
  97. */
  98. const UInt32 kCentralBlockSize = 42;
  99. /*
  100. struct CBlock
  101. {
  102. CVersion MadeByVersion;
  103. CVersion ExtractVersion;
  104. UInt16 Flags;
  105. UInt16 CompressionMethod;
  106. UInt32 Time;
  107. UInt32 FileCRC;
  108. UInt32 PackSize;
  109. UInt32 UnPackSize;
  110. UInt16 NameSize;
  111. UInt16 ExtraSize;
  112. UInt16 CommentSize;
  113. UInt16 DiskNumberStart;
  114. UInt16 InternalAttributes;
  115. UInt32 ExternalAttributes;
  116. UInt32 LocalHeaderOffset;
  117. };
  118. struct CBlockFull
  119. {
  120. UInt32 Signature;
  121. CBlock Header;
  122. };
  123. */
  124. namespace NFlags
  125. {
  126. const int kNumUsedBits = 4;
  127. const int kUsedBitsMask = (1 << kNumUsedBits) - 1;
  128. const int kEncryptedMask = 1 << 0;
  129. const int kDescriptorUsedMask = 1 << 3;
  130. const int kImplodeDictionarySizeMask = 1 << 1;
  131. const int kImplodeLiteralsOnMask = 1 << 2;
  132. const int kDeflateTypeBitStart = 1;
  133. const int kNumDeflateTypeBits = 2;
  134. const int kNumDeflateTypes = (1 << kNumDeflateTypeBits);
  135. const int kDeflateTypeMask = (1 << kNumDeflateTypeBits) - 1;
  136. }
  137. namespace NHostOS
  138. {
  139. enum EEnum
  140. {
  141. kFAT = 0, // filesystem used by MS-DOS, OS/2, Win32
  142. // pkzip 2.50 (FAT / VFAT / FAT32 file systems)
  143. kAMIGA = 1,
  144. kVMS = 2, // VAX/VMS
  145. kUnix = 3,
  146. kVM_CMS = 4,
  147. kAtari = 5, // what if it's a minix filesystem? [cjh]
  148. kHPFS = 6, // filesystem used by OS/2 (and NT 3.x)
  149. kMac = 7,
  150. kZ_System = 8,
  151. kCPM = 9,
  152. kTOPS20 = 10, // pkzip 2.50 NTFS
  153. kNTFS = 11, // filesystem used by Windows NT
  154. kQDOS = 12, // SMS/QDOS
  155. kAcorn = 13, // Archimedes Acorn RISC OS
  156. kVFAT = 14, // filesystem used by Windows 95, NT
  157. kMVS = 15,
  158. kBeOS = 16, // hybrid POSIX/database filesystem
  159. // BeBOX or PowerMac
  160. kTandem = 17,
  161. kTHEOS = 18
  162. };
  163. // const int kNumHostSystems = 19;
  164. }
  165. namespace NUnixAttribute
  166. {
  167. const UInt32 kIFMT = 0170000; /* Unix file type mask */
  168. const UInt32 kIFDIR = 0040000; /* Unix directory */
  169. const UInt32 kIFREG = 0100000; /* Unix regular file */
  170. const UInt32 kIFSOCK = 0140000; /* Unix socket (BSD, not SysV or Amiga) */
  171. const UInt32 kIFLNK = 0120000; /* Unix symbolic link (not SysV, Amiga) */
  172. const UInt32 kIFBLK = 0060000; /* Unix block special (not Amiga) */
  173. const UInt32 kIFCHR = 0020000; /* Unix character special (not Amiga) */
  174. const UInt32 kIFIFO = 0010000; /* Unix fifo (BCC, not MSC or Amiga) */
  175. const UInt32 kISUID = 04000; /* Unix set user id on execution */
  176. const UInt32 kISGID = 02000; /* Unix set group id on execution */
  177. const UInt32 kISVTX = 01000; /* Unix directory permissions control */
  178. const UInt32 kENFMT = kISGID; /* Unix record locking enforcement flag */
  179. const UInt32 kIRWXU = 00700; /* Unix read, write, execute: owner */
  180. const UInt32 kIRUSR = 00400; /* Unix read permission: owner */
  181. const UInt32 kIWUSR = 00200; /* Unix write permission: owner */
  182. const UInt32 kIXUSR = 00100; /* Unix execute permission: owner */
  183. const UInt32 kIRWXG = 00070; /* Unix read, write, execute: group */
  184. const UInt32 kIRGRP = 00040; /* Unix read permission: group */
  185. const UInt32 kIWGRP = 00020; /* Unix write permission: group */
  186. const UInt32 kIXGRP = 00010; /* Unix execute permission: group */
  187. const UInt32 kIRWXO = 00007; /* Unix read, write, execute: other */
  188. const UInt32 kIROTH = 00004; /* Unix read permission: other */
  189. const UInt32 kIWOTH = 00002; /* Unix write permission: other */
  190. const UInt32 kIXOTH = 00001; /* Unix execute permission: other */
  191. }
  192. namespace NAmigaAttribute
  193. {
  194. const UInt32 kIFMT = 06000; /* Amiga file type mask */
  195. const UInt32 kIFDIR = 04000; /* Amiga directory */
  196. const UInt32 kIFREG = 02000; /* Amiga regular file */
  197. const UInt32 kIHIDDEN = 00200; /* to be supported in AmigaDOS 3.x */
  198. const UInt32 kISCRIPT = 00100; /* executable script (text command file) */
  199. const UInt32 kIPURE = 00040; /* allow loading into resident memory */
  200. const UInt32 kIARCHIVE = 00020; /* not modified since bit was last set */
  201. const UInt32 kIREAD = 00010; /* can be opened for reading */
  202. const UInt32 kIWRITE = 00004; /* can be opened for writing */
  203. const UInt32 kIEXECUTE = 00002; /* executable image, a loadable runfile */
  204. const UInt32 kIDELETE = 00001; /* can be deleted */
  205. }
  206. }
  207. }}
  208. #endif