4 Plain packet contains either the whole file, or file request (freq), or
5 transition packet or exec message. It is called "plain", because it
6 contains plaintext, but plain packets would never be stored on your hard
11 +--------------------------------------+--...---+
12 | MAGIC | TYPE | NICE | PATHLEN | PATH | PAYLOAD|
13 +--------------------------------------+--...---+
16 @multitable @columnfractions 0.2 0.3 0.5
17 @headitem @tab XDR type @tab Value
18 @item Magic number @tab
19 8-byte, fixed length opaque data @tab
20 @verb{|N N C P P 0x00 0x00 0x03|}
21 @item Payload type @tab
24 @item file (file transmission)
25 @item freq (file request)
26 @item exec (compressed exec)
27 @item trns (transition)
28 @item exec-fat (uncompressed exec)
29 @item area (@ref{Multicast, multicast} area message)
33 1-255, preferred packet @ref{Niceness, niceness} level
34 @item Path length @tab
36 actual length of @emph{path} field's payload
38 255 byte, fixed length opaque data @tab
39 Depending on packet's type, path holds:
41 @item UTF-8 encoded destination path for file transfer
42 @item UTF-8 encoded source path for file request
43 @item UTF-8 encoded, zero byte separated, exec's arguments
44 @item Node's id the transition packet must be relayed on
45 @item Multicast area's id
49 Path has fixed size because of hiding its actual length -- it is
50 valuable metadata. Payload is appended to the header -- it is not stored
51 as XDR field, because XDR has no ability to pass more than 4 GiB of
52 opaque data. Moreover most XDR libraries store fields in the memory in
55 Depending on the packet's type, payload could store:
59 @item Destination path for freq
60 @item Optionally @url{https://facebook.github.io/zstd/, Zstandard}
62 @item Whole encrypted packet we need to relay on
63 @item Multicast area message wrap with another encrypted packet inside
66 Also depending on packet's type, niceness level means:
69 @item Preferable niceness level for files sent by freq
70 @item @env{NNCP_NICE} variable's value passed during @ref{CfgExec} invocation.
73 So plain packets can hold following paths and payloads:
79 +--------------- PATH ---------------+ +---- PAYLOAD ---+
81 +----------------------------------------+---------------...--+
82 | FILENAME | 0x00 ... variable ... 0x00 | FILE CONTENTS |
83 +----------------------------------------+---------------...--+
90 +--------------- PATH ---------------+ +---- PAYLOAD ---+
92 +----------------------------------------+---------------...--+
93 | FILENAME | 0x00 ... variable ... 0x00 | FILENAME |
94 +----------------------------------------+---------------...--+
101 +------------------------- PATH ----------------------------+ +---- PAYLOAD ---+
103 +---------------------------------------------------------------+---------------...--+
104 | HANDLE 0x00 | ARG0 0x00 ARG1 ...| 0x00 ... variable ... 0x00 | ZSTD DATA |
105 +---------------------------------------------------------------+---------------...--+
107 +-------- PATHLEN -------------+
112 +------------------------- PATH ----------------------------+ +---- PAYLOAD ---+
114 +---------------------------------------------------------------+---------------...--+
115 | HANDLE 0x00 | ARG0 0x00 ARG1 ...| 0x00 ... variable ... 0x00 | DATA |
116 +---------------------------------------------------------------+---------------...--+
118 +-------- PATHLEN -------------+
123 +------- PATH ---------+ +---- PAYLOAD ---+
125 +--------------------------+---------------...--+
126 | NODE ID | 0x00 ... 0x00 | ENCRYPTED PACKET |
127 +--------------------------+---------------...--+
134 +------- PATH ---------+ +---- PAYLOAD ---+
136 +--------------------------+---------------...--+
137 | AREA ID | 0x00 ... 0x00 | ENCRYPTED PACKET |
138 +--------------------------+---------------...--+
142 See also @ref{Encrypted area, encrypted area packet}.