Skip to main content

Module wire

Module wire 

Source
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. path is relative to the transfer root, /-separated.
FlistLimits
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.
FlistWriter
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§

Kind

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 -c file-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.