Crate cfdp

Source
Expand description

This module contains the implementation of the CCSDS File Delivery Protocol (CFDP) high level abstractions as specified in CCSDS 727.0-B-5.

The basic idea of CFDP is to convert files of any size into a stream of packets called packet data units (PDU). CFPD has an unacknowledged and acknowledged mode, with the option to request a transaction closure for the unacknowledged mode. Using the unacknowledged mode with no transaction closure is applicable for simplex communication paths, while the unacknowledged mode with closure is the easiest way to get a confirmation of a successful file transfer, including a CRC check on the remote side to verify file integrity. The acknowledged mode is the most complex mode which includes multiple mechanism to ensure succesfull packet transaction even for unreliable connections, including lost segment detection. As such, it can be compared to a specialized TCP for file transfers with remote systems.

The goal of this library is to be flexible enough to support the use-cases of both on-board software and of ground software. It has support to make integration on std systems as simple as possible, but also has sufficient abstraction to allow for integration on no_std environments and can be used on these systems as well as long as the alloc feature is used as well.

Please note even though the alloc feature is required for the core handlers, these components will only allocate memory at initialization time and thus are still viable for systems where run-time allocation is prohibited.

The core of this library are the crate::dest::DestinationHandler and the crate::source::SourceHandler components which model the CFDP destination and source entity respectively. You can find high-level and API documentation for both handlers in the respective crate::dest and crate::source module.

§Examples

This library currently features two example application which showcase how the provided components could be used to provide CFDP services.

The end-to-end test is an integration tests which spawns a CFDP source entity and a CFDP destination entity, moves them to separate threads and then performs a small file copy operation. You can run the integration test for a transfer with no closure and with printout to the standard console by running:

cargo test end_to_end_test_no_closure -- --nocapture

or with closure:

cargo test end_to_end_test_with_closure -- --nocapture

The Python Interoperability example showcases the interoperability of the CFDP handlers written in Rust with a Python implementation. The dedicated example documentation shows how to run this example.

§Notes on the user hooks and scheduling

Both examples feature implementations of the UserFaultHookProvider and the user::CfdpUser trait which simply print some information to the console to monitor the progress of a file copy operation. These implementations could be adapted for other handler integrations. For example, they could signal a GUI application to display some information for the user.

Even though both examples move the newly spawned handlers to dedicated threads, this is not the only way they could be scheduled. For example, to support an arbitrary (or bounded) amount of file copy operations on either source or destination side, those handlers could be moved into a std::collections::HashMap structure which is then scheduled inside a thread, or you could schedule a fixed amount of handlers inside a threadpool.

Re-exports§

pub use alloc_mod::*;alloc
pub use std_mod::*;std

Modules§

alloc_modalloc
destalloc
CFDP Destination Entity Module
filestore
request
sourcealloc
CFDP Source Entity Module
std_modstd
time
user

Structs§

DummyFaultHook
Dummy fault hook which implements UserFaultHookProvider but only provides empty implementations.
DummyPduProvider
FaultHandler
This structure is used to implement the fault handling as specified in chapter 4.8 of the CFDP standard.
IndicationConfig
LocalEntityConfig
Each CFDP entity handler has a LocalEntityConfiguration.
PduRawWithInfo
This is a helper struct which contains base information about a particular PDU packet. This is also necessary information for CFDP packet routing. For example, some packet types like file data PDUs can only be used by CFDP source entities.
RemoteEntityConfig
This structure models the remote entity configuration information as specified in chapter 8.3 of the CFDP standard. Some of the fields which were not considered necessary for the Rust implementation were omitted. Some other fields which are not contained inside the standard but are considered necessary for the Rust implementation are included.
StdRemoteEntityConfigProvideralloc
This is a thin wrapper around a hashbrown::HashMap to store remote entity configurations. It implements the full RemoteEntityConfigProvider trait.
TransactionId
The CFDP transaction ID of a CFDP transaction consists of the source entity ID and the sequence number of that transfer which is also determined by the CFDP source entity.
VecRemoteEntityConfigProvideralloc
This is a thin wrapper around a alloc::vec::Vec to store remote entity configurations. It implements the full RemoteEntityConfigProvider trait.

Enums§

EntityType
GenericSendErrorstd
Generic error type for sending a PDU via a message queue.
PacketTarget
State
TimerContext

Constants§

CRC_32
crc::Crc instance using crc::CRC_32_ISO_HDLC.
CRC_32C
crc::Crc instance using crc::CRC_32_ISCSI.

Traits§

PduProvider
Generic trait which models a raw CFDP packet data unit (PDU) block with some additional context information.
PduSendProviderstd
RemoteEntityConfigProvider
TimerCreatorProvider
A generic trait which allows CFDP entities to create check timers which are required to implement special procedures in unacknowledged transmission mode, as specified in 4.6.3.2 and 4.6.3.3.
UserFaultHookProvider
This trait introduces some callbacks which will be called when a particular CFDP fault handler is called.

Functions§

determine_packet_target