PacketExtraction

Trait PacketExtraction 

Source
pub trait PacketExtraction {
    type DataLossIndicator;

    // Required method
    fn data_loss_indicator(
        &mut self,
        packet_type: PacketType,
        apid: Apid,
        packet_sequence_count: PacketSequenceCount,
    ) -> Self::DataLossIndicator;

    // Provided method
    fn extract<'a>(
        &mut self,
        packet: &'a SpacePacket,
    ) -> (&'a [u8], SecondaryHeaderFlag, Self::DataLossIndicator) { ... }
}
Expand description

The PacketExtraction trait describes the “Packet Extraction” function from the CCSDS 133.0-B-2 Space Packet Protocol recommended standard. It concerns the ability to unpack Space Packets that have been received from some underlying subnetwork into the transmitted octet strings.

Required Associated Types§

Source

type DataLossIndicator

Value that may optionally be returned when extracting a packet to indicate whether (and potentially to what degree) the packet sequence count suggests data loss to have occurred.

Required Methods§

Source

fn data_loss_indicator( &mut self, packet_type: PacketType, apid: Apid, packet_sequence_count: PacketSequenceCount, ) -> Self::DataLossIndicator

Given some message ID (packet type and APID) and the sequence count found in the packet, determines whether data loss has likely occurred. Updates the packet extractor with this new packet sequence count to permit future data loss detection.

This is the “meat” of the Packet Extraction function: the actual extraction of the packet itself is otherwise quite trivial. Hence, we separately define this function, with the extract function derived based on it.

Provided Methods§

Source

fn extract<'a>( &mut self, packet: &'a SpacePacket, ) -> (&'a [u8], SecondaryHeaderFlag, Self::DataLossIndicator)

Unpacks the given Space Packet into its underlying packet data field. Shall also return whether there was a mismatch between the expected and actual Space Packet sequence counters: if so, returns an appropriate data loss indicator. Finally, the secondary header flag as contained in the primary header may also be returned.

Implementors§