#[non_exhaustive]pub struct Config {Show 15 fields
pub check: Check,
pub crc_attempts: u32,
pub crc_interval: Duration,
pub block_size: BlockSize,
pub checksum_1k: bool,
pub short_tail: bool,
pub pad: u8,
pub start_timeout: Duration,
pub timeout: Duration,
pub byte_timeout: Duration,
pub purge: Duration,
pub retries: u32,
pub recv_start_timeout: Option<Duration>,
pub linger: Duration,
pub max_size: Option<usize>,
}Expand description
Tunables of a Transfer.
Non-exhaustive: start from Config::default and set the fields you
need.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.check: CheckReceiver: the check asked for first. Check::HpCrc (default) sends
D, Check::Crc16 sends C; both fall back to NAK (checksum)
after Config::crc_attempts unanswered start characters.
Check::Checksum sends NAK from the start. The sender ignores this
and uses whatever the receiver asks for (NAK, C or D). Before
the first ACK the sender follows a later C or D, and a NAK after
D (the 49G’s fallback); a NAK in CRC-16 mode only resends block 1
in CRC-16, since a standard receiver NAKs a damaged block that way.
D is the default because no HP calculator answers C: the 49G’s
XSEND answers D with HP-CRC blocks (1k blocks when the object is big
enough) and ignores C; the 48GX’s XSEND ignores both and answers the
NAK. Verified on the emulated 49G and 48GX (traces 49g-xsend*,
48gx-xsend*).
crc_attempts: u32Receiver: Cs (or Ds) sent before falling back to checksum
(default 3).
crc_interval: DurationReceiver: wait after each C or D before the next start character
(default 3 s).
block_size: BlockSizeSender: block size for full blocks (default 128). 1k blocks go out
only when the receiver asked for a CRC (C or D), unless
Config::checksum_1k is set: a receiver that opens with NAK gets
128-byte blocks.
checksum_1k: boolSender: also send 1k blocks when the receiver asked for checksum mode
(default false). The 48GX, which knows only checksum mode, NAKs every
1k block and cancels after nine (trace 48gx-xrecv-1k); XModem-1K
is classically used with CRC only.
short_tail: boolSender with 1k blocks: send the tail of the file in 128-byte blocks once no more than 896 bytes (7 x 128) remain, so no block carries 128 or more bytes of padding (default true). The 49G does not convert a received object with more than about 255 bytes of padding (as HP’s Conn4x source notes).
pad: u8Sender: padding byte for the last block (default 0x1A, SUB).
start_timeout: DurationSender: how long to wait for the receiver’s first start character
(default 60 s). Receiver: the overall wait for the first block is
bounded by the start-character retries instead, or by
Config::recv_start_timeout.
timeout: DurationWait for an ACK/NAK (sender) or for the next block (receiver) (default 10 s).
byte_timeout: DurationReceiver: longest gap between two bytes of one block (default 1 s).
purge: DurationReceiver: after a bad block, input must be silent this long before we NAK, so the sender hears the NAK (default 1 s).
retries: u32Retries per block (or per EOT, or NAKs while starting) before giving up (default 10).
recv_start_timeout: Option<Duration>Receiver: keep sending start characters until this much time has
passed since Transfer::start, instead of stopping after
crc_attempts + retries of them (default None: count only). For
a transfer a human starts on the calculator keyboard. The switch
from C/D to NAK still happens after Config::crc_attempts.
linger: DurationReceiver: after we ACK the EOT, keep answering a retransmitted EOT
with ACK for this long (default 1 s), in case our ACK was damaged or
lost. FileEnd and Done are emitted when the ACK is queued; the
linger emits nothing. Transfer::is_idle is false while it lasts;
Transfer::start ends it early. Duration::ZERO turns it off. A
sender that only retransmits after its reply timeout is caught only
by a linger that long.
max_size: Option<usize>Receiver: most data bytes (padding included) accepted; a block that
would go beyond fails the transfer with Error::TooLarge and CANs.
Default 4 MiB, well above the largest HP object; None means no
limit. XModem has no length field and block numbers wrap, so without
a limit a peer can grow the buffer without bound.