xref: /aosp_15_r20/external/lzma/CPP/7zip/Archive/Tar/TarHeader.h (revision f6dc9357d832569d4d1f5d24eacdb3935a1ae8e6)
1 // Archive/TarHeader.h
2 
3 #ifndef ZIP7_INC_ARCHIVE_TAR_HEADER_H
4 #define ZIP7_INC_ARCHIVE_TAR_HEADER_H
5 
6 #include "../../../Common/MyTypes.h"
7 
8 namespace NArchive {
9 namespace NTar {
10 
11 namespace NFileHeader
12 {
13   const unsigned kRecordSize = 512;
14   const unsigned kNameSize = 100;
15   const unsigned kUserNameSize = 32;
16   const unsigned kGroupNameSize = 32;
17   const unsigned kPrefixSize = 155;
18 
19   const unsigned kUstarMagic_Offset = 257;
20 
21   /*
22   struct CHeader
23   {
24     char Name[kNameSize];
25     char Mode[8];
26     char UID[8];
27     char GID[8];
28     char Size[12];
29     char ModificationTime[12];
30     char CheckSum[8];
31     char LinkFlag;
32     char LinkName[kNameSize];
33     char Magic[8];
34     char UserName[kUserNameSize];
35     char GroupName[kGroupNameSize];
36     char DeviceMajor[8];
37     char DeviceMinor[8];
38     char Prefix[155];
39   };
40   union CRecord
41   {
42     CHeader Header;
43     Byte Padding[kRecordSize];
44   };
45   */
46 
47   namespace NLinkFlag
48   {
49     const char kOldNormal    = 0;   // Normal disk file, Unix compatible
50     const char kNormal       = '0'; // Normal disk file
51     const char kHardLink     = '1'; // Link to previously dumped file
52     const char kSymLink      = '2'; // Symbolic link
53     const char kCharacter    = '3'; // Character special file
54     const char kBlock        = '4'; // Block special file
55     const char kDirectory    = '5'; // Directory
56     const char kFIFO         = '6'; // FIFO special file
57     const char kContiguous   = '7'; // Contiguous file
58     const char kGnu_LongLink = 'K';
59     const char kGnu_LongName = 'L';
60     const char kSparse       = 'S';
61     const char kLabel        = 'V';
62     const char kPax          = 'x'; // Extended header with meta data for the next file in the archive (POSIX.1-2001)
63     const char kPax_2        = 'X';
64     const char kGlobal       = 'g'; //  Global extended header with meta data (POSIX.1-2001)
65     const char kDumpDir      = 'D'; /* GNUTYPE_DUMPDIR.
66       data: list of files created by the --incremental (-G) option
67       Each file name is preceded by either
68         - 'Y' (file should be in this archive)
69         - 'N' (file is a directory, or is not stored in the archive.)
70         Each file name is terminated by a null + an additional null after
71         the last file name. */
72     // 'A'-'Z'  Vendor specific extensions (POSIX.1-1988)
73   }
74 
75   extern const char * const kLongLink;  //   = "././@LongLink";
76   extern const char * const kLongLink2; //   = "@LongLink";
77 
78   namespace NMagic
79   {
80     // extern const char * const kUsTar;  //  = "ustar"; // 5 chars
81     // extern const char * const kGNUTar; //  = "GNUtar "; // 7 chars and a null
82     // extern const char * const kEmpty;  //  = "\0\0\0\0\0\0\0\0"
83     extern const char k_Posix_ustar_00[8];
84     extern const char k_GNU_ustar[8];
85   }
86 }
87 
88 }}
89 
90 #endif
91