1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// SPDX-License-Identifier: MIT OR Apache-2.0
// Copyright (c) 2017-2020 Alexey Arbuzov
// Copyright (c) 2023-2026 Jarkko Sakkinen
//! ZMODEM file transfer protocol library. [`Sender`] and [`Receiver`] are
//! caller-driven state machines for sending and receiving files with the
//! ZMODEM protocol. The crate is `no_std` compatible and heapless.
//!
//! The caller owns all I/O. The loop is the same for both roles:
//! 1. Create a [`Sender`] or [`Receiver`].
//! 2. Call `poll()` to get the next [`Action`]:
//! - [`Action::WriteWire`] — write the bytes to the transport, then call
//! `wire_written(n)`.
//! - [`Action::ReadFile`] (sender) — read the requested file bytes and
//! provide them with [`Sender::submit_file`].
//! - [`Action::WriteFile`] (receiver) — persist the bytes, then call
//! [`Receiver::file_written`].
//! - [`Action::Event`] — handle a protocol [`Event`].
//! - [`Action::Idle`] — feed incoming transport bytes with `submit_wire()`,
//! or call `timeout()` if none arrive.
//! 3. The sender offers files with [`Sender::start_file`] and ends the session
//! with [`Sender::finish`].
pub use *;
pub use *;
pub use *;
pub const ZPAD: u8 = b'*';
pub const ZDLE: u8 = 0x18;
pub const XON: u8 = 0x11;
/// The cancel sequence sent by `Sender::abort` and `Receiver::abort`:
/// ten CAN (ZDLE) bytes, which make the other end give up (five in a row
/// are enough), then ten backspaces to erase them from a terminal that
/// shows them. The same bytes as lrzsz's `canit()`.
pub const ABORT_SEQUENCE: = ;