Next: , Up: Packet format   [Index]


Plain packet

Plain packet contains either the whole file, or file request (freq), or transition packet or exec message. It is called "plain", because it contains plaintext, but plain packets would never be stored on your hard drive.

            HEADER
+--------------------------------------+--...---+
| MAGIC | TYPE | NICE | PATHLEN | PATH | PAYLOAD|
+--------------------------------------+--...---+
XDR typeValue
Magic number8-byte, fixed length opaque dataN N C P P 0x00 0x00 0x03
Payload typeunsigned integer
  1. file (file transmission)
  2. freq (file request)
  3. exec (compressed exec)
  4. trns (transition)
  5. exec-fat (uncompressed exec)
  6. area (multicast area message)
  7. ack (receipt acknowledgement)
Nicenessunsigned integer1-255, preferred packet niceness level
Path lengthunsigned integeractual length of path field’s payload
Path255 byte, fixed length opaque dataDepending on packet’s type, path holds:
  • UTF-8 encoded destination path for file transfer
  • UTF-8 encoded source path for file request
  • UTF-8 encoded, zero byte separated, exec’s arguments
  • Node’s id the transition packet must be relayed on
  • Multicast area’s id
  • Packet’s id (its Merkle Tree Hashing hash)

Path has fixed size because of hiding its actual length – it is valuable metadata. Payload is appended to the header – it is not stored as XDR field, because XDR has no ability to pass more than 4 GiB of opaque data. Moreover most XDR libraries store fields in the memory in practice.

Depending on the packet’s type, payload could store:

Also depending on packet’s type, niceness level means:

So plain packets can hold following paths and payloads:

file
  +--------------- PATH ---------------+   +---- PAYLOAD ---+
 /                                      \ /                  \
+----------------------------------------+---------------...--+
| FILENAME  | 0x00 ... variable ... 0x00 |    FILE CONTENTS   |
+----------------------------------------+---------------...--+
 \         /
   PATHLEN
freq
  +--------------- PATH ---------------+   +---- PAYLOAD ---+
 /                                      \ /                  \
+----------------------------------------+---------------...--+
| FILENAME  | 0x00 ... variable ... 0x00 |       FILENAME     |
+----------------------------------------+---------------...--+
 \         /
   PATHLEN
exec
  +------------------------- PATH ----------------------------+   +---- PAYLOAD ---+
 /                                                             \ /                  \
+---------------------------------------------------------------+---------------...--+
|  HANDLE 0x00 | ARG0 0x00 ARG1 ...| 0x00 ... variable ... 0x00 |     ZSTD DATA      |
+---------------------------------------------------------------+---------------...--+
 \                                /
  +-------- PATHLEN -------------+
exec-fat
  +------------------------- PATH ----------------------------+   +---- PAYLOAD ---+
 /                                                             \ /                  \
+---------------------------------------------------------------+---------------...--+
|  HANDLE 0x00 | ARG0 0x00 ARG1 ...| 0x00 ... variable ... 0x00 |        DATA        |
+---------------------------------------------------------------+---------------...--+
 \                                /
  +-------- PATHLEN -------------+
trns
  +------- PATH ---------+   +---- PAYLOAD ---+
 /                        \ /                  \
+--------------------------+---------------...--+
|  NODE ID | 0x00 ... 0x00 |  ENCRYPTED PACKET  |
+--------------------------+---------------...--+
 \        /
   PATHLEN
area
  +------- PATH ---------+   +---- PAYLOAD ---+
 /                        \ /                  \
+--------------------------+---------------...--+
|  AREA ID | 0x00 ... 0x00 |  ENCRYPTED PACKET  |
+--------------------------+---------------...--+
 \        /
   PATHLEN

See also encrypted area packet.

ack
  +------- PATH --------+
 /                       \
+-------------------------+
|  PKT ID | 0x00 ... 0x00 |
+-------------------------+
 \       /
  PATHLEN

Next: Encrypted packet, Up: Packet format   [Index]