rlm@1: // Archive/Tar/Header.h rlm@1: rlm@1: #ifndef __ARCHIVE_TAR_HEADER_H rlm@1: #define __ARCHIVE_TAR_HEADER_H rlm@1: rlm@1: #include "Common/Types.h" rlm@1: rlm@1: namespace NArchive { rlm@1: namespace NTar { rlm@1: rlm@1: namespace NFileHeader rlm@1: { rlm@1: const int kRecordSize = 512; rlm@1: const int kNameSize = 100; rlm@1: const int kUserNameSize = 32; rlm@1: const int kGroupNameSize = 32; rlm@1: const int kPrefixSize = 155; rlm@1: rlm@1: /* rlm@1: struct CHeader rlm@1: { rlm@1: char Name[kNameSize]; rlm@1: char Mode[8]; rlm@1: char UID[8]; rlm@1: char GID[8]; rlm@1: char Size[12]; rlm@1: char ModificationTime[12]; rlm@1: char CheckSum[8]; rlm@1: char LinkFlag; rlm@1: char LinkName[kNameSize]; rlm@1: char Magic[8]; rlm@1: char UserName[kUserNameSize]; rlm@1: char GroupName[kGroupNameSize]; rlm@1: char DeviceMajor[8]; rlm@1: char DeviceMinor[8]; rlm@1: char Prefix[155]; rlm@1: }; rlm@1: union CRecord rlm@1: { rlm@1: CHeader Header; rlm@1: Byte Padding[kRecordSize]; rlm@1: }; rlm@1: */ rlm@1: rlm@1: namespace NMode rlm@1: { rlm@1: const int kSetUID = 04000; // Set UID on execution rlm@1: const int kSetGID = 02000; // Set GID on execution rlm@1: const int kSaveText = 01000; // Save text (sticky bit) rlm@1: } rlm@1: rlm@1: namespace NFilePermissions rlm@1: { rlm@1: const int kUserRead = 00400; // read by owner rlm@1: const int kUserWrite = 00200; // write by owner rlm@1: const int kUserExecute = 00100; // execute/search by owner rlm@1: const int kGroupRead = 00040; // read by group rlm@1: const int kGroupWrite = 00020; // write by group rlm@1: const int kGroupExecute = 00010; // execute/search by group rlm@1: const int kOtherRead = 00004; // read by other rlm@1: const int kOtherWrite = 00002; // write by other rlm@1: const int kOtherExecute = 00001; // execute/search by other rlm@1: } rlm@1: rlm@1: rlm@1: // The linkflag defines the type of file rlm@1: namespace NLinkFlag rlm@1: { rlm@1: const char kOldNormal = '\0'; // Normal disk file, Unix compatible rlm@1: const char kNormal = '0'; // Normal disk file rlm@1: const char kLink = '1'; // Link to previously dumped file rlm@1: const char kSymbolicLink = '2'; // Symbolic link rlm@1: const char kCharacter = '3'; // Character special file rlm@1: const char kBlock = '4'; // Block special file rlm@1: const char kDirectory = '5'; // Directory rlm@1: const char kFIFO = '6'; // FIFO special file rlm@1: const char kContiguous = '7'; // Contiguous file rlm@1: rlm@1: const char kDumpDir = 'D'; /* GNUTYPE_DUMPDIR. rlm@1: data: list of files created by the --incremental (-G) option rlm@1: Each file name is preceded by either rlm@1: - 'Y' (file should be in this archive) rlm@1: - 'N' (file is a directory, or is not stored in the archive.) rlm@1: Each file name is terminated by a null + an additional null after rlm@1: the last file name. */ rlm@1: rlm@1: } rlm@1: // Further link types may be defined later. rlm@1: rlm@1: // The checksum field is filled with this while the checksum is computed. rlm@1: extern const char *kCheckSumBlanks;// = " "; // 8 blanks, no null rlm@1: rlm@1: extern const char *kLongLink; // = "././@LongLink"; rlm@1: extern const char *kLongLink2; // = "@LongLink"; rlm@1: rlm@1: // The magic field is filled with this if uname and gname are valid. rlm@1: namespace NMagic rlm@1: { rlm@1: extern const char *kUsTar; // = "ustar"; // 5 chars rlm@1: extern const char *kGNUTar; // = "GNUtar "; // 7 chars and a null rlm@1: extern const char *kEmpty; // = "GNUtar "; // 7 chars and a null rlm@1: } rlm@1: rlm@1: } rlm@1: rlm@1: }} rlm@1: rlm@1: #endif