pub struct DestinationHandler { /* private fields */ }alloc and std only.Expand description
This is the primary CFDP destination handler. It models the CFDP destination entity, which is primarily responsible for receiving files sent from another CFDP entity. It performs the reception side of File Copy Operations.
The DestinationHandler::state_machine function is the primary function to drive the destination handler. It can be used to insert packets into the destination handler and driving the state machine, which might generate new packets to be sent to the remote entity. Please note that the destination handler can also only process Metadata, EOF and Prompt PDUs in addition to ACK PDUs where the acknowledged PDU is the Finished PDU.
All generated packets are sent via the CfdpPacketSender trait, which is implemented by the user and passed as a constructor parameter. The number of generated packets is returned by the state machine call.
Implementations§
Source§impl DestinationHandler
impl DestinationHandler
Sourcepub fn new(
local_cfg: LocalEntityConfig,
max_packet_len: usize,
packet_sender: Box<dyn CfdpPacketSender>,
vfs: Box<dyn VirtualFilestore>,
remote_cfg_table: Box<dyn RemoteEntityConfigProvider>,
check_timer_creator: Box<dyn CheckTimerCreator>,
) -> Self
pub fn new( local_cfg: LocalEntityConfig, max_packet_len: usize, packet_sender: Box<dyn CfdpPacketSender>, vfs: Box<dyn VirtualFilestore>, remote_cfg_table: Box<dyn RemoteEntityConfigProvider>, check_timer_creator: Box<dyn CheckTimerCreator>, ) -> Self
Constructs a new destination handler.
§Arguments
local_cfg- The local CFDP entity configuration, consisting of the local entity ID, the indication configuration, and the fault handlers.max_packet_len- The maximum expected generated packet size in bytes. Each time a packet is sent, it will be buffered inside an internal buffer. The length of this buffer will be determined by this parameter. This parameter can either be a known upper bound, or it can specifically be determined by the largest packet size parameter of all remote entity configurations in the passedremote_cfg_table.packet_sender- All generated packets are sent via this abstraction.vfs- Virtual filestore implementation to decouple the CFDP implementation from the underlying filestore/filesystem. This allows to use this handler for embedded systems where a standard runtime might not be available.remote_cfg_table- A table of all expected remote entities this entity will communicate with. It contains various configuration parameters required for file transfers.check_timer_creator- This is used by the CFDP handler to generate timers required by various tasks.
Sourcepub fn state_machine(
&mut self,
cfdp_user: &mut impl CfdpUser,
packet_to_insert: Option<&PacketInfo<'_>>,
) -> Result<u32, DestError>
pub fn state_machine( &mut self, cfdp_user: &mut impl CfdpUser, packet_to_insert: Option<&PacketInfo<'_>>, ) -> Result<u32, DestError>
This is the core function to drive the destination handler. It is also used to insert packets into the destination handler.
The state machine should either be called if a packet with the appropriate destination ID is received, or periodically in IDLE periods to perform all CFDP related tasks, for example checking for timeouts or missed file segments.
Sourcepub fn transmission_mode(&self) -> Option<TransmissionMode>
pub fn transmission_mode(&self) -> Option<TransmissionMode>
Returns None if the state machine is IDLE, and the transmission mode of the current request otherwise.
pub fn transaction_id(&self) -> Option<TransactionId>
pub fn handle_prompt_pdu(&mut self, _raw_packet: &[u8]) -> Result<(), DestError>
Sourcepub fn step(&self) -> TransactionStep
pub fn step(&self) -> TransactionStep
Get the step, which denotes the exact step of a pending CFDP transaction when applicable.
Auto Trait Implementations§
impl !Freeze for DestinationHandler
impl !RefUnwindSafe for DestinationHandler
impl !Send for DestinationHandler
impl !Sync for DestinationHandler
impl Unpin for DestinationHandler
impl !UnwindSafe for DestinationHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.