Expand description
§cfdp
- High-level support for implementing CFDP
This is a high-level support library for implementing the CCSDS File Delivery Protocol according to the CCSDS 727.0-B-5 standard.
§Features
cfdp-rs
currently supports following high-level features:
- Unacknowledged (class 1) file transfers for both source and destination side.
- Acknowledged (class 2) file transfers for both source and destination side.
The following features have not been implemented yet. PRs or notifications for demand are welcome!
- Suspending transfers
- Inactivity handling
- Start and end of transmission and reception opportunity handling
- Keep Alive and Prompt PDU handling
§Overview
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.
The core handlers inside this library do not allocate memory dynamically. The internal buffer size used for PDU generation and checksum calculation is statically determined via a Rust feature and defaults to 2048 bytes.
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.
§Rust Features
§Default features
std
: Enables functionality relying on the standard library.alloc
: Enables features which require allocation support. Enabled by thestd
feature.
§Optional Features
serde
: Addsserde
support for most types by addingSerialize
andDeserialize
derive
sdefmt
: Add support for thedefmt
by adding thedefmt::Format
derive on many types.
§Buffer size selection
The following features can be used to select the internal buffer size used for PDU generation and checksum calculation. Selection of this value possibly limits the size of the generated PDU packets. Only one feature may be enabled.
packet-buf-256
for 256 bytespacket-buf-512
for 512 bytespacket-buf-1k
for 1024 bytespacket-buf-2k
for 2048 bytes. This is the default.packet-buf-4k
for 4096 bytes
§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 UserFaultHook 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§
Modules§
- alloc_
mod alloc
- buf_len
- dest
- CFDP Destination Entity Module
- filestore
- lost_
segments - Lost Segment Store Module
- request
- source
- CFDP Source Entity Module
- std_mod
std
- time
- user
Structs§
- Dummy
Fault Hook - Dummy fault hook which implements UserFaultHook but only provides empty implementations.
- Dummy
PduProvider - Fault
Handler - This structure is used to implement the fault handling as specified in chapter 4.8 of the CFDP standard.
- Fault
Info - Indication
Config - Local
Entity Config - Each CFDP entity handler has a LocalEntityConfiguration.
- PduRaw
With Info - 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.
- Remote
Config List alloc
- This is a thin wrapper around a alloc::vec::Vec to store remote entity configurations. It implements the full RemoteEntityConfig trait.
- Remote
Config List Heapless - This is a thin wrapper around a heapless::vec::Vec to store remote entity configurations. It implements the full RemoteEntityConfig trait.
- Remote
Config Store Std alloc
- This is a thin wrapper around a hashbrown::HashMap to store remote entity configurations. It implements the full RemoteEntityConfig trait.
- Remote
Entity Config - This structure models the remote entity configuration information as specified in chapter 8.3 of the CFDP standard.
- Transaction
Id - 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.
Enums§
- Entity
Type - Generic
Send Error - Generic error type for sending a PDU via a message queue.
- Packet
Target - Remote
Config Store Error - State
- Timer
Context
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.
- PduSender
- Remote
Config Store - Timer
Creator - 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.
- User
Fault Hook - This trait introduces some callbacks which will be called when a particular CFDP fault handler is called.