Expand description
rsync’s daemon protocol, pinned at protocol 29: the @RSYNCD: text handshake, the
argument list, multiplexed framing, the file list, and the MD4 checksums. Shared by the
daemon (src/server/rsync/) and the client (src/client/rsync/).
Why 29: it is the smallest version rsync 3.2.7 still speaks in full. There are no
compat flags, no checksum or compression negotiation, no incremental recursion, plain int32
file indexes, fixed-width file-list fields, and a client→daemon direction that is never
multiplexed. Everything is MD4: the whole-file sum is MD4(le32(seed) ‖ data). Advertise
exactly 29.0: a non-zero sub-version makes a 3.2.7 peer drop to 28.
Structs§
- Entry
- One file-list entry.
pathis relative to the transfer root,/-separated. - Flist
Limits - What one file list may hold: entries (every entry read counts, including the devices and specials that are skipped), and name plus symlink-target bytes over all entries.
- Flist
Writer - Encodes entries in order, keeping the “previous entry” state both ends share.
- MuxReader
- A demultiplexing reader: MSG_DATA becomes a byte stream, other messages are collected.
- Request
- The options a sender cares about, parsed from the argument list.
Enums§
Constants§
- CHUNK
- Literal data is sent in pieces of at most this many bytes (rsync’s CHUNK_SIZE).
- GREETING
- ITEM_
BASIS_ TYPE_ FOLLOWS - ITEM_
IS_ NEW - ITEM_
TRANSFER - ITEM_
XNAME_ FOLLOWS - MAX_
ARGS - MAX_
ENTRIES - Entries in one file list a daemon sends (what the client reads on a download).
- MAX_
FILTER_ BYTES - Total bytes of filter rules a client may send.
- MAX_
LINE - A text line of the handshake, an argument, or a module line.
- MAX_
NAME - A file-list name.
- MAX_
SUM_ COUNT - Block checksums one request may carry (count × (4 + s2length) bytes are read and dropped).
- MAX_
UPLOAD_ LIST_ ENTRIES - Entries in one uploading client’s file list, devices and specials included: twice the files one upload may deliver, so the directories and symlinks around them fit.
- MAX_
UPLOAD_ LIST_ NAME_ BYTES - Name and symlink-target bytes in one uploading client’s file list, all entries together.
Every name reaches the model in
rsync_upload_request, so this also bounds that event. - MSG_
DATA - MSG_
ERROR - MSG_
ERROR_ EXIT - MSG_
ERROR_ XFER - MSG_
INFO - MSG_
IO_ ERROR - MSG_
NOOP - MSG_
WARNING - NDX_
DONE - PROTOCOL
- S_IFDIR
- S_IFLNK
- S_IFMT
- S_IFREG
Functions§
- auth_
response - The answer to
@RSYNCD: AUTHREQD <challenge>at protocol 29 (no digest list was offered, so the daemon uses MD4 with a zero seed): base64 without padding of MD4(00 00 00 00 ‖ password ‖ challenge). - content_
json - Text when it is printable UTF-8, hex otherwise, with the encoding named.
- data_
frames - MSG_DATA frames for a byte stream, split at 0xFFFF bytes.
- entry_
from_ json - One entry the model described:
{path, type, content, encoding, mode, mtime, target, uid, gid}. - entry_
json - An entry as the model sees it.
- file_
sum - The whole-file checksum at protocol 29: MD4(le32(seed) ‖ data), the seed always first.
- frame
- One multiplexed frame: a little-endian (tag << 24 | len) header, then the payload.
- le32
- list_
sum - The
-cfile-list checksum: MD4 of the contents, unseeded. - longint
- md4
- MD4 over the pieces, in order.
- parse_
args - Parse the daemon argument list (
--server --sender -logDtpr . mod/path). - sort
- sort_
key - rsync’s file-list order (f_name_cmp at protocol ≥ 29) as a sort key: “.” first; within a directory, non-directories by bytes, then directories by name + “/”, each followed by its subtree.