blob: 63511c48315fa6e87cb780b54028dfa5a5086b1e (
plain) (
blame)
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
|
namespace Rhea.Nar;
/// <summary>Common strings/flags in NAR archives</summary>
public static class NarConsts
{
/// <summary>Nix archive header</summary>
public static readonly byte[] Header = NarWriter.GetLengthPrefixedPadded("nix-archive-1"u8);
/// <summary>Start of object marker</summary>
public static readonly byte[] LeftParen = NarWriter.GetLengthPrefixedPadded("("u8);
/// <summary>End of object marker</summary>
public static readonly byte[] RightParen = NarWriter.GetLengthPrefixedPadded(")"u8);
/// <summary>Indicates the node is a regular file</summary>
public static readonly byte[] Regular = NarWriter.GetLengthPrefixedPadded("regular"u8);
/// <summary>Indicates the node is a directory</summary>
public static readonly byte[] Directory = NarWriter.GetLengthPrefixedPadded("directory"u8);
/// <summary>Indicates the node is a symlink</summary>
public static readonly byte[] Symlink = NarWriter.GetLengthPrefixedPadded("symlink"u8);
/// <summary>Indicates a directory entry</summary>
public static readonly byte[] Entry = NarWriter.GetLengthPrefixedPadded("entry"u8);
/// <summary>Indicates a directory entry</summary>
public static readonly byte[] Node = NarWriter.GetLengthPrefixedPadded("node"u8);
/// <summary>Indicates the name of a directory entry</summary>
public static readonly byte[] Name = NarWriter.GetLengthPrefixedPadded("name"u8);
/// <summary>Indicates the target of a symlink</summary>
public static readonly byte[] Target = NarWriter.GetLengthPrefixedPadded("target"u8);
/// <summary>Indicates the type of an entry</summary>
public static readonly byte[] Type = NarWriter.GetLengthPrefixedPadded("type"u8);
/// <summary>Indicates that a regular file is executable</summary>
public static readonly byte[] Executable = NarWriter.GetLengthPrefixedPadded("executable"u8);
/// <summary>Indicates the start of regular file contents</summary>
public static readonly byte[] Contents = NarWriter.GetLengthPrefixedPadded("contents"u8);
}
/// <summary>Some pre-combined constants</summary>
public static class CombinedNarConsts
{
/// <summary>Entry of type Regular</summary>
public static readonly byte[] TypeRegular = [..NarConsts.Type, ..NarConsts.Regular];
/// <summary>Entry of type Directory</summary>
public static readonly byte[] TypeDirectory = [..NarConsts.Type, ..NarConsts.Directory];
/// <summary>Entry of type Symlink</summary>
public static readonly byte[] TypeSymlink = [..NarConsts.Type, ..NarConsts.Symlink];
/// <summary>Entry with name</summary>
public static readonly byte[] EntryWithName = [..NarConsts.Entry, ..NarConsts.LeftParen, ..NarConsts.Name];
/// <summary>Symlink with target</summary>
public static readonly byte[] SymlinkWithTarget = [..NarConsts.Type, ..NarConsts.Symlink, ..NarConsts.Target];
/// <summary>Executable with 8 bytes of padding</summary>
public static readonly byte[] ExecutableWithPadding = [..NarConsts.Executable, ..new byte[8]];
}
|