5 Plain packet contains either the whole file, or file request (freq), or
6 transition packet or exec message. It is called "plain", because it
7 contains plaintext, but plain packets would never be stored on your hard
12 +--------------------------------------+--...---+
13 | MAGIC | TYPE | NICE | PATHLEN | PATH | PAYLOAD|
14 +--------------------------------------+--...---+
17 @multitable @columnfractions 0.2 0.3 0.5
18 @headitem @tab XDR type @tab Value
19 @item Magic number @tab
20 8-byte, fixed length opaque data @tab
21 @verb{|N N C P P 0x00 0x00 0x03|}
22 @item Payload type @tab
25 @item file (file transmission)
26 @item freq (file request)
27 @item exec (compressed exec)
28 @item trns (transition)
29 @item exec-fat (uncompressed exec)
30 @item area (@ref{Multicast, multicast} area message)
31 @item ack (receipt acknowledgement)
35 1-255, preferred packet @ref{Niceness, niceness} level
36 @item Path length @tab
38 actual length of @emph{path} field's payload
40 255 byte, fixed length opaque data @tab
41 Depending on packet's type, path holds:
43 @item UTF-8 encoded destination path for file transfer
44 @item UTF-8 encoded source path for file request
45 @item UTF-8 encoded, zero byte separated, exec's arguments
46 @item Node's id the transition packet must be relayed on
47 @item Multicast area's id
48 @item Packet's id (its @ref{MTH} hash)
52 Path has fixed size because of hiding its actual length -- it is
53 valuable metadata. Payload is appended to the header -- it is not stored
54 as XDR field, because XDR has no ability to pass more than 4 GiB of
55 opaque data. Moreover most XDR libraries store fields in the memory in
58 Depending on the packet's type, payload could store:
62 @item Destination path for freq
63 @item Optionally @url{https://facebook.github.io/zstd/, Zstandard}
65 @item Whole encrypted packet we need to relay on
66 @item Multicast area message wrap with another encrypted packet inside
67 @item Nothing, if it is acknowledgement packet
70 Also depending on packet's type, niceness level means:
73 @item Preferable niceness level for files sent by freq
74 @item @env{$NNCP_NICE} variable's value passed during @ref{CfgExec} invocation.
77 So plain packets can hold following paths and payloads:
83 +--------------- PATH ---------------+ +---- PAYLOAD ---+
85 +----------------------------------------+---------------...--+
86 | FILENAME | 0x00 ... variable ... 0x00 | FILE CONTENTS |
87 +----------------------------------------+---------------...--+
94 +--------------- PATH ---------------+ +---- PAYLOAD ---+
96 +----------------------------------------+---------------...--+
97 | FILENAME | 0x00 ... variable ... 0x00 | FILENAME |
98 +----------------------------------------+---------------...--+
105 +------------------------- PATH ----------------------------+ +---- PAYLOAD ---+
107 +---------------------------------------------------------------+---------------...--+
108 | HANDLE 0x00 | ARG0 0x00 ARG1 ...| 0x00 ... variable ... 0x00 | ZSTD DATA |
109 +---------------------------------------------------------------+---------------...--+
111 +-------- PATHLEN -------------+
116 +------------------------- PATH ----------------------------+ +---- PAYLOAD ---+
118 +---------------------------------------------------------------+---------------...--+
119 | HANDLE 0x00 | ARG0 0x00 ARG1 ...| 0x00 ... variable ... 0x00 | DATA |
120 +---------------------------------------------------------------+---------------...--+
122 +-------- PATHLEN -------------+
127 +------- PATH ---------+ +---- PAYLOAD ---+
129 +--------------------------+---------------...--+
130 | NODE ID | 0x00 ... 0x00 | ENCRYPTED PACKET |
131 +--------------------------+---------------...--+
138 +------- PATH ---------+ +---- PAYLOAD ---+
140 +--------------------------+---------------...--+
141 | AREA ID | 0x00 ... 0x00 | ENCRYPTED PACKET |
142 +--------------------------+---------------...--+
146 See also @ref{Encrypted area, encrypted area packet}.
150 +------- PATH --------+
152 +-------------------------+
153 | PKT ID | 0x00 ... 0x00 |
154 +-------------------------+