Next: , Previous: , Up: Top  


Synchronization protocol

So-called synchronization protocol (SP) is used in current TCP daemon’s implementation. It is used for synchronizing spool directory contents between two nodes.

It is aimed to be very simple and effective. It uses reliable transport like TCP connections. It must be effective both on single-duplex and full-duplex links: for example satellites have very high throughput but high-delay links, so acknowledging of each received packet, like XMODEM does, causes unacceptable performance degradation.

SP works on top of Noise_IK_25519_ChaChaPoly_BLAKE2b protocol. Each Noise packet are sent inside XDR envelope:

+-----------------+
| MAGIC | PAYLOAD |
+-----------------+
XDR typeValue
Magic number8-byte, fixed length opaque dataNNCPS0x10x00x00
Payloadvariable length opaque dataNoise packet itself

Peers static keys are specified as noisepub configuration entry.

Payload inside Noise packets has maximum size of 65 KiB - 256 B = 65280 B. It is sent immediately in the first message by each side. The very first payload (that is carried inside handshake messages) is always padded to the maximum size with HALT packets (read below), for hiding actual number of INFO packets (number of files available for transmission).

Each SP payload is a concatenation of SP packets. Each packet has XDR-encoded header and then corresponding XDR-encoded body. Header is just an unsigned integer telling what body structure follows.

HALT

Stop file transmission, empty sending queue on the remote side. Actually HALT packet does not have any body, only the header with the type. It is also used in the first payload for padding to the maximum size.

INFO

Information about the file we have for transmission.

+--------------------+
| NICE | SIZE | HASH |
+--------------------+
XDR typeValue
Nicenessunsigned integer1-255, file niceness level
Sizeunsigned hyper integerFile size
Hash32-byte, fixed length opaque dataUnique file identifier, its checksum
FREQ

File transmission request. Ask remote side to queue the file for transmission.

+---------------+
| HASH | OFFSET |
+---------------+
XDR typeValue
Hash32-byte, fixed length opaque dataUnique file identifier, its checksum
Offsetunsigned hyper integerOffset from which remote side must transmit the file
FILE

Chunk of file.

+-------------------------+
| HASH | OFFSET | PAYLOAD |
+-------------------------+
XDR typeValue
Hash32-byte, fixed length opaque dataUnique file identifier, its checksum
Offsetunsigned hyper integerOffset from which transmission goes
Payloadvariable length opaque dataChunk of file itself
DONE

Signal remote side that we have successfully downloaded the file.

+------+
| HASH |
+------+
XDR typeValue
Hash32-byte, fixed length opaque dataUnique file identifier, its checksum

Next: , Previous: , Up: Top