leodos_protocols/transport/cfdp/class2/machine/receiver/event.rs
1use crate::transport::cfdp::class2::machine::TimerType;
2use crate::transport::cfdp::class2::machine::TransactionId;
3use crate::transport::cfdp::pdu::tlv::filestore_response::FilestoreResponse;
4use crate::transport::cfdp::pdu::Pdu;
5use heapless::Vec;
6
7/// Represents all possible inputs that can drive the `ReceiverMachine`.
8#[derive(Debug)]
9pub enum Event<'a> {
10 /// A PDU has been received from a remote entity for a transaction this machine is handling.
11 PduReceived {
12 /// The transaction this PDU belongs to.
13 transaction_id: TransactionId,
14 /// The received PDU to be processed.
15 pdu: &'a Pdu,
16 },
17 /// A timer, previously requested via an `Action`, has expired.
18 TimerExpired {
19 /// The transaction whose timer expired.
20 transaction_id: TransactionId,
21 /// The kind of timer that expired.
22 timer_type: TimerType,
23 },
24 /// A chunk of file data, requested to be written via a `WriteFileData` action, has been successfully written.
25 FileDataWritten {
26 /// The transaction this write confirmation belongs to.
27 transaction_id: TransactionId,
28 /// The byte offset within the file where the data was written.
29 offset: u64,
30 /// The number of bytes that were written.
31 len: usize,
32 },
33 /// The checksum verification, requested via an `Action`, has completed.
34 ChecksumVerified {
35 /// The transaction whose checksum was verified.
36 transaction_id: TransactionId,
37 /// Whether the computed checksum matched the expected value.
38 is_valid: bool,
39 },
40 /// A user request to suspend a transaction.
41 SuspendRequest {
42 /// The transaction to suspend.
43 transaction_id: TransactionId,
44 },
45 /// A user request to resume a suspended transaction.
46 ResumeRequest {
47 /// The transaction to resume.
48 transaction_id: TransactionId,
49 },
50 /// The filestore requests have been executed and responses are ready.
51 FilestoreResponsesReceived {
52 /// The transaction these responses belong to.
53 transaction_id: TransactionId,
54 /// The results of the executed filestore requests.
55 responses: Vec<FilestoreResponse, 4, u8>,
56 },
57}