summaryrefslogtreecommitdiffstats
path: root/src/libs/7zip/win/CPP/7zip/Archive/Tar/TarHeader.h
blob: 0b78bdc262c8c35d1e57966f39d7c274329fa64c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// Archive/Tar/Header.h

#ifndef __ARCHIVE_TAR_HEADER_H
#define __ARCHIVE_TAR_HEADER_H

#include "Common/Types.h"

namespace NArchive {
namespace NTar {

namespace NFileHeader
{
  const int kRecordSize = 512;
  const int kNameSize = 100;
  const int kUserNameSize = 32;
  const int kGroupNameSize = 32;
  const int kPrefixSize = 155;

  /*
  struct CHeader
  {
    char Name[kNameSize];
    char Mode[8];
    char UID[8];
    char GID[8];
    char Size[12];
    char ModificationTime[12];
    char CheckSum[8];
    char LinkFlag;
    char LinkName[kNameSize];
    char Magic[8];
    char UserName[kUserNameSize];
    char GroupName[kGroupNameSize];
    char DeviceMajor[8];
    char DeviceMinor[8];
    char Prefix[155];
  };
  union CRecord
  {
    CHeader Header;
    Byte Padding[kRecordSize];
  };
  */

  namespace NMode
  {
    const int kSetUID   = 04000;  // Set UID on execution
    const int kSetGID   = 02000;  // Set GID on execution
    const int kSaveText = 01000;  // Save text (sticky bit)
  }

  namespace NFilePermissions
  {
    const int kUserRead     = 00400;  // read by owner
    const int kUserWrite    = 00200;  // write by owner
    const int kUserExecute  = 00100;  // execute/search by owner
    const int kGroupRead    = 00040;  // read by group
    const int kGroupWrite   = 00020;  // write by group
    const int kGroupExecute = 00010;  // execute/search by group
    const int kOtherRead    = 00004;  // read by other
    const int kOtherWrite   = 00002;  // write by other
    const int kOtherExecute = 00001;  // execute/search by other
  }


  // The linkflag defines the type of file
  namespace NLinkFlag
  {
    const char kOldNormal    = '\0'; // Normal disk file, Unix compatible
    const char kNormal       = '0'; // Normal disk file
    const char kLink         = '1'; // Link to previously dumped file
    const char kSymbolicLink = '2'; // Symbolic link
    const char kCharacter    = '3'; // Character special file
    const char kBlock        = '4'; // Block special file
    const char kDirectory    = '5'; // Directory
    const char kFIFO         = '6'; // FIFO special file
    const char kContiguous   = '7'; // Contiguous file

    const char kDumpDir       = 'D'; /* GNUTYPE_DUMPDIR.
      data: list of files created by the --incremental (-G) option
      Each file name is preceded by either
        - 'Y' (file should be in this archive)
        - 'N' (file is a directory, or is not stored in the archive.)
        Each file name is terminated by a null + an additional null after
        the last file name. */

  }
  // Further link types may be defined later.

  // The checksum field is filled with this while the checksum is computed.
  extern const char *kCheckSumBlanks;//   = "        ";   // 8 blanks, no null

  extern const char *kLongLink;  //   = "././@LongLink";
  extern const char *kLongLink2; //   = "@LongLink";

  // The magic field is filled with this if uname and gname are valid.
  namespace NMagic
  {
    extern const char *kUsTar; //   = "ustar"; // 5 chars
    extern const char *kGNUTar; //  = "GNUtar "; // 7 chars and a null
    extern const char *kEmpty; //  = "GNUtar "; // 7 chars and a null
  }

}

}}

#endif