leodos_protocols/transport/cfdp/class2/machine/transaction.rs
1//! Contains the shared data structures for CFDP transactions, used by both
2//! the sender and receiver state machines.
3
4use crate::transport::cfdp::filestore::FileId;
5use crate::transport::cfdp::pdu::EntityId;
6use crate::transport::cfdp::pdu::TransactionSeqNum;
7use crate::transport::cfdp::pdu::file_directive::metadata::ChecksumType;
8use crate::transport::cfdp::pdu::tlv::fault_handler_override::FaultHandlerSet;
9
10/// A unique identifier for a single CFDP transaction.
11///
12/// It is composed of the source entity's ID and a sequence number that is unique
13/// for that source.
14#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
15pub struct TransactionId {
16 /// The entity that originated this transaction.
17 pub source_id: EntityId,
18 /// The sequence number assigned by the source entity.
19 pub seq_num: TransactionSeqNum,
20}
21
22/// The static configuration for a single transaction that is shared between
23/// both sender and receiver.
24///
25/// This information is typically derived from the initial `PutRequest` (for the sender)
26/// or the received `Metadata` PDU (for the receiver).
27#[derive(Debug)]
28pub struct TransactionConfig {
29 /// The unique identifier for this transaction.
30 pub transaction_id: TransactionId,
31 /// The EntityId of the destination for this transaction.
32 pub destination_id: EntityId,
33 /// The total size of the file in bytes.
34 pub file_size: u64,
35 /// Optional fault handler overrides, one for each possible Condition Code.
36 /// If an entry is `None`, the default MIB handler is used.
37 pub fault_handlers: FaultHandlerSet,
38 /// Timeout in seconds to wait for any PDU before declaring the transaction inactive.
39 pub inactivity_timeout_secs: u16,
40 /// The type of checksum to use for data integrity verification.
41 pub checksum_type: ChecksumType,
42 /// The name of the file at the source entity.
43 pub source_file_id: FileId,
44 /// The name the file should have at the destination entity.
45 pub destination_file_id: FileId,
46}