CFDP Handler Package
Package Contents
- class cfdppy.handler.DestHandler(cfg: LocalEntityConfig, user: CfdpUserBase, remote_cfg_table: RemoteEntityConfigTable, check_timer_provider: CheckTimerProvider)
Bases:
objectThis is the primary CFDP destination handler. It models the CFDP source entity, which is primarily responsible for receiving files sent from another CFDP entity. It performs the reception side of File Copy Operations.
This handler supports both acknowledged and unacknowledged CFDP file transfers. The following core functions are the primary interface for interacting with the destination handler:
state_machine(): This state machine processes inserted packets while also generating the packets which need to be sent back to the initiator of a file copy operation. This call can also be used to insert packets into the destination handler. 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. Right now, the handler processes one packet at a time, and each packer insertion needs anotherstate_machine()call.get_next_packet(): Retrieve next packet to be sent back to the remote CFDP source entity.
A new file transfer (Metadata PDU reception) is only be accepted if the handler is in the IDLE state. Furthermore, packet insertion is not allowed until all packets to send were retrieved after a state machine call.
This handler is able to deal with file copy operations to directories, similarly to how the UNIX tool cp works. If the destination path is a directory instead of a regular full path, the source path base file name will be appended to the destination path to form the resulting new full path.
This handler also does not support concurrency out of the box but is flexible enough to be used in different concurrent contexts. For example, you can dynamically create new handlers and run them inside a thread pool, or move the newly created handler to a new thread.
- cancel_request(transaction_id: TransactionId) bool
This function models the Cancel.request CFDP primtive and is the recommended way to cancel a transaction. It will cause a Notice Of Cancellation at this entity. Please note that the state machine might still be active because a canceled transfer might still require some packets to be sent to the remote sender entity.
- Returns:
True – Current transfer was cancelled
False – The state machine is in the IDLE state or there is a transaction ID missmatch.
- property closure_requested: bool
Returns whether a closure was requested for the current transaction. Please note that this variable is only valid as long as the state is not IDLE
- property current_check_counter: int
This is the check count used for the check limit mechanism for incomplete unacknowledged file transfers. A Check Limit Reached fault will be declared once this check counter reaches the configured check limit. More information can be found in chapter 4.6.3.3 b) of the standard.
- property deferred_lost_segment_procedure_active: bool
- property entity_id: UnsignedByteField
- property file_size: int | None
The file size property which was retrieved from the Metadata PDU. This will be None if no transfer is active or more specifically if no Metadata PDU was received yet.
- get_next_packet() PduHolder | None
Retrieve the next packet which should be sent to the remote CFDP source entity.
- property nak_activity_counter: int
- property num_packets_ready: int
- property packets_ready: bool
- property positive_ack_counter: int
- property progress: int
- reset() None
This function is public to allow completely resetting the handler, but it is explicitly discouraged to do this. CFDP generally has mechanism to detect issues and errors on itself.
- property state: CfdpState
- state_machine(packet: AbstractFileDirectiveBase | AbstractPduBase | None = None) FsmResult
This is the primary state machine which performs the CFDP procedures like PDU generation or assembly of received file data PDUs into a file. The packets generated by this finite-state machine (FSM) need to be sent by the user and can be retrieved using the
get_next_packet()method.This method also allows inserting packets into the state machine via the optional packet argument.
- Raises:
NoRemoteEntityConfigFound – No remote configuration found for source entity ID extracted from the PDU packet.
InvalidPduDirection – PDU direction bit is invalid.
InvalidDestinationId – The PDU destination entity ID is not equal to the configured local ID.
InvalidPduForDestHandler – The PDU type can not be handled by the destination handler
PduIgnoredForDest – The PDU was ignored because it can not be handled for the current transmission mode or internal state.
- property step: TransactionStep
- property transaction_id: TransactionId | None
- property transmission_mode: TransmissionMode | None
- class cfdppy.handler.DestStateWrapper(state: 'CfdpState' = <CfdpState.IDLE: 0>, step: 'TransactionStep' = <TransactionStep.IDLE: 0>, transaction_id: 'TransactionId | None' = None, _num_packets_ready: 'int' = 0)
Bases:
object- property num_packets_ready: int
- property packets_ready: bool
- state: CfdpState = 0
- step: TransactionStep = 0
- transaction_id: TransactionId | None = None
- cfdppy.handler.DestTransactionStep
alias of
TransactionStep
- class cfdppy.handler.FsmResult(states: SourceStateWrapper)
Bases:
object
- class cfdppy.handler.LocalEntityConfig(local_entity_id: UnsignedByteField, indication_cfg: IndicationConfig, default_fault_handlers: DefaultFaultHandlerBase)
Bases:
objectThis models the remote entity configuration information as specified in chapter 8.2 of the CFDP standard.
- default_fault_handlers: DefaultFaultHandlerBase
- indication_cfg: IndicationConfig
- local_entity_id: UnsignedByteField
- class cfdppy.handler.PacketDestination(value)
Bases:
EnumAn enumeration.
- DEST_HANDLER = 1
- SOURCE_HANDLER = 0
- class cfdppy.handler.ProvidesSeqCount
Bases:
ABC- abstract get_and_increment() int
Contract: Retrieve the current sequence count and then increment it. The first call should yield 0
- abstract property max_bit_width: int
- class cfdppy.handler.RemoteEntityConfig(entity_id: UnsignedByteField, max_file_segment_len: int | None, max_packet_len: int, closure_requested: bool, crc_on_transmission: bool, default_transmission_mode: TransmissionMode, crc_type: ChecksumType, positive_ack_timer_interval_seconds: float = 10.0, positive_ack_timer_expiration_limit: int = 2, check_limit: int = 2, disposition_on_cancellation: bool = False, immediate_nak_mode: bool = True, nak_timer_interval_seconds: float = 10.0, nak_timer_expiration_limit: int = 2, cfdp_version: int = 1)
Bases:
objectThis 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 Python implementation were omitted. Some other fields which are not contained inside the standard but are considered necessary for the Python implementation are included.
Notes on Positive Acknowledgment Procedures
The
positive_ack_timer_interval_secondsandpositive_ack_timer_expiration_limitwill be used for positive acknowledgment procedures as specified in CFDP chapter 4.7. The sending entity will start the timer for any PDUs where an acknowledgment is required (e.g. EOF PDU). Once the expected ACK response has not been received for that interval, as counter will be incremented and the timer will be reset. Once the counter exceeds thepositive_ack_timer_expiration_limit, a Positive ACK Limit Reached fault will be declared.Notes on Deferred Lost Segment Procedures
This procedure will be active if an EOF (No Error) PDU is received in acknowledged mode. After issuing the NAK sequence which has the whole file scope, a timer will be started. The timer is reset when missing segments or missing metadata is received. The timer will be deactivated if all missing data is received. If the timer expires, a new NAK sequence will be issued and a counter will be incremented, which can lead to a NAK Limit Reached fault being declared.
- Parameters:
entity_id (UnsignedByteField) – The ID of the remote entity.
max_packet_len (int) – This determines of all PDUs generated for that remote entity in addition to the max_file_segment_len attribute which also determines the size of file data PDUs.
max_file_segment_len (int | None) – The maximum file segment length which determines the maximum size of file data PDUs in addition to the max_packet_len attribute. If this field is set to None, the maximum file segment length will be derived from the maximum packet length. If this has some value which is smaller than the segment value derived from max_packet_len, this value will be picked.
closure_requested (bool) – If the closure requested field is not supplied as part of the Put Request, it will be determined from this field in the remote configuration.
crc_on_transmission (bool) – If the CRC option is not supplied as part of the Put Request, it will be determined from this field in the remote configuration.
default_transmission_mode (TransmissionMode) – If the transmission mode is not supplied as part of the Put Request, it will be determined from this field in the remote configuration.
disposition_on_cancellation (bool) – Determines whether an incomplete received file is discard on transaction cancellation. Defaults to False.
crc_type (ChecksumType) – Default checksum type used to calculate for all file transmissions to this remote entity.
check_limit (int) – this timer determines the expiry period for incrementing a check counter after an EOF PDU is received for an incomplete file transfer. This allows out-of-order reception of file data PDUs and EOF PDUs. Also see 4.6.3.3 of the CFDP standard. Defaults to 2, so the check limit timer may expire twice.
positive_ack_timer_interval_seconds (float) – See the notes on the Positive Acknowledgment Procedures inside the class documentation. Expected as floating point seconds. Defaults to 10 seconds.
positive_ack_timer_expiration_limit (int) – See the notes on the Positive Acknowledgment Procedures inside the class documentation. Defaults to 2, so the timer may expire twice.
immediate_nak_mode (bool) – Specifies whether a NAK sequence should be issued immediately when a file data gap or lost metadata is detected in the acknowledged mode. Defaults to True.
nak_timer_interval_seconds (float) – See the notes on the Deferred Lost Segment Procedure inside the class documentation. Expected as floating point seconds. Defaults to 10 seconds.
nak_timer_expiration_limit (int) – See the notes on the Deferred Lost Segment Procedure inside the class documentation. Defaults to 2, so the timer may expire two times.
- cfdp_version: int = 1
- check_limit: int = 2
- closure_requested: bool
- crc_on_transmission: bool
- crc_type: ChecksumType
- default_transmission_mode: TransmissionMode
- disposition_on_cancellation: bool = False
- entity_id: UnsignedByteField
- immediate_nak_mode: bool = True
- max_packet_len: int
- nak_timer_expiration_limit: int = 2
- nak_timer_interval_seconds: float = 10.0
- positive_ack_timer_expiration_limit: int = 2
- positive_ack_timer_interval_seconds: float = 10.0
- class cfdppy.handler.RemoteEntityConfigTable(init_cfgs: Sequence[RemoteEntityConfig] | None = None)
Bases:
objectThin abstraction for a dictionary containing remote configurations with the remote entity ID being used as a key.
- add_config(cfg: RemoteEntityConfig) bool
- add_configs(cfgs: Sequence[RemoteEntityConfig]) None
- get_cfg(remote_entity_id: UnsignedByteField) RemoteEntityConfig | None
- class cfdppy.handler.SourceHandler(cfg: LocalEntityConfig, user: CfdpUserBase, remote_cfg_table: RemoteEntityConfigTable, check_timer_provider: CheckTimerProvider, seq_num_provider: ProvidesSeqCount)
Bases:
objectThis is the primary CFDP source handler. It models the CFDP source entity, which is primarily responsible for handling put requests to send files to another CFDP destination entity.
As such, it contains a state machine to perform all operations necessary to perform a source-to-destination file transfer. This class does not send the CFDP PDU packets directly to allow for greater flexibility. For example, a user might want to wrap the CFDP packet entities into a CCSDS space packet or into a special frame type. The handler can handle both unacknowledged (class 1) and acknowledged (class 2) file transfers.
The following core functions are the primary interface:
put_request()can be used to start transactions, most notably to start and perform a Copy File procedure to send a file or to send a Proxy Put Request to request a file.state_machine()is the primary interface to execute an active file transfer. It generates the necessary CFDP PDUs for this process. This method is also used to insert received packets with the appropriate destination ID and target handler type into the state machine.get_next_packet()retrieves the next packet which should be sent to the remote destination entity of a file copy operation.
A put request will only be accepted if the handler is in the idle state. Furthermore, packet insertion is not allowed until all packets to send were retrieved after a state machine call.
This handler also does not support concurrency out of the box but is flexible enough to be used in different concurrent contexts. For example, you can dynamically create new handlers and run them inside a thread pool, or move the newly created handler to a new thread.
- cancel_request(transaction_id: TransactionId) bool
This function models the Cancel.request CFDP primitive and is the recommended way to cancel a transaction. It will cause a Notice Of Cancellation at this entity. Please note that the state machine might still be active because a canceled transfer might still require some packets to be sent to the remote receiver entity.
- Returns:
True – Current transfer was cancelled
False – The state machine is in the IDLE state or there is a transaction ID missmatch.
- property entity_id: UnsignedByteField
- get_next_packet() PduHolder | None
Retrieve the next packet which should be sent to the remote CFDP destination entity.
- get_put_request() PutRequest | None
- property num_packets_ready: int
- property packets_ready: bool
- property pdu_conf: PduConfig
- property positive_ack_counter: int
- property progress: int
- put_request(request: PutRequest) bool
This function is used to pass a put request to the source handler, which is also used to start a file copy operation. As such, this function models the Put.request CFDP primitive.
Please note that the source handler can also process one put request at a time. The caller is responsible for creating a new source handler, one handler can only handle one file copy request at a time.
- Raises:
ValueError – Invalid transmission mode detected.
NoRemoteEntityCfgFound – No remote configuration found for destination ID specified in the Put Request.
SourceFileDoesNotExist – File specified for Put Request does not exist.
- Return type:
False if the handler is busy. True if the handling of the request was finished successfully.
- reset() None
This function is public to allow completely resetting the handler, but it is explicitly discouraged to do this. CFDP generally has mechanism to detect issues and errors on itself.
- property state: CfdpState
- state_machine(packet: AbstractFileDirectiveBase | None = None) FsmResult
This is the primary state machine which performs the CFDP procedures like PDU generation or CRC calculation. The packets generated by this finite-state machine (FSM) need to be sent by the user and can be retrieved using the
get_next_packet()method.This method also allows inserting packets into the state machine via the optional packet argument.
- Raises:
InvalidPduDirection – PDU direction field wrong.
InvalidPduForSourceHandler – Invalid PDU file directive type.
PduIgnoredForSource – The specified PDU can not be handled in the current state.
NoRemoteEntityConfigFound – No remote configuration found for specified destination entity.
InvalidSourceId – Source ID not identical to local entity ID.
InvalidDestinationId – Destination ID was found, but there is a mismatch between the packet destination ID and the remote configuration entity ID.
UnretrievedPdusToBeSent – There are still PDUs which need to be sent before calling the FSM again.
ChecksumNotImplemented – Right now, only a subset of the checksums specified for the CFDP standard are implemented.
SourceFileDoesNotExist – The source file for which a transaction was requested does not exist. This can happen if the file is deleted during a transaction.
- state_machine_no_packet() FsmResult
Helper method to call
state_machine()with None as the packet argument.
- property step: TransactionStep
- property transaction_id: TransactionId | None
- property transaction_seq_num: UnsignedByteField
- property transmission_mode: TransmissionMode | None
- class cfdppy.handler.SourceStateWrapper(state: 'CfdpState' = <CfdpState.IDLE: 0>, step: 'TransactionStep' = <TransactionStep.IDLE: 0>, _num_packets_ready: 'int' = 0)
Bases:
object- property num_packets_ready: int
- property packets_ready: bool
- state: CfdpState = 0
- step: TransactionStep = 0
- cfdppy.handler.SourceTransactionStep
alias of
TransactionStep
- cfdppy.handler.get_packet_destination(packet: AbstractFileDirectiveBase | AbstractPduBase) PacketDestination
This function routes the packets based on PDU type and directive type if applicable.
The routing is based on section 4.5 of the CFDP standard which specifies the PDU forwarding procedure.
NOTE: The standard also specifies a direction flag, which could be used for that purpose as well. However, I prefer the approach here to explicitly check the PDU types and event the ACK PDU content. I think this is more reliable than relying on that bit.
Source Handler Module
- class cfdppy.handler.source.FsmResult(states: SourceStateWrapper)
Bases:
object
- class cfdppy.handler.source.SourceHandler(cfg: LocalEntityConfig, user: CfdpUserBase, remote_cfg_table: RemoteEntityConfigTable, check_timer_provider: CheckTimerProvider, seq_num_provider: ProvidesSeqCount)
Bases:
objectThis is the primary CFDP source handler. It models the CFDP source entity, which is primarily responsible for handling put requests to send files to another CFDP destination entity.
As such, it contains a state machine to perform all operations necessary to perform a source-to-destination file transfer. This class does not send the CFDP PDU packets directly to allow for greater flexibility. For example, a user might want to wrap the CFDP packet entities into a CCSDS space packet or into a special frame type. The handler can handle both unacknowledged (class 1) and acknowledged (class 2) file transfers.
The following core functions are the primary interface:
put_request()can be used to start transactions, most notably to start and perform a Copy File procedure to send a file or to send a Proxy Put Request to request a file.state_machine()is the primary interface to execute an active file transfer. It generates the necessary CFDP PDUs for this process. This method is also used to insert received packets with the appropriate destination ID and target handler type into the state machine.get_next_packet()retrieves the next packet which should be sent to the remote destination entity of a file copy operation.
A put request will only be accepted if the handler is in the idle state. Furthermore, packet insertion is not allowed until all packets to send were retrieved after a state machine call.
This handler also does not support concurrency out of the box but is flexible enough to be used in different concurrent contexts. For example, you can dynamically create new handlers and run them inside a thread pool, or move the newly created handler to a new thread.
- cancel_request(transaction_id: TransactionId) bool
This function models the Cancel.request CFDP primitive and is the recommended way to cancel a transaction. It will cause a Notice Of Cancellation at this entity. Please note that the state machine might still be active because a canceled transfer might still require some packets to be sent to the remote receiver entity.
- Returns:
True – Current transfer was cancelled
False – The state machine is in the IDLE state or there is a transaction ID missmatch.
- property entity_id: UnsignedByteField
- get_next_packet() PduHolder | None
Retrieve the next packet which should be sent to the remote CFDP destination entity.
- get_put_request() PutRequest | None
- put_request(request: PutRequest) bool
This function is used to pass a put request to the source handler, which is also used to start a file copy operation. As such, this function models the Put.request CFDP primitive.
Please note that the source handler can also process one put request at a time. The caller is responsible for creating a new source handler, one handler can only handle one file copy request at a time.
- Raises:
ValueError – Invalid transmission mode detected.
NoRemoteEntityCfgFound – No remote configuration found for destination ID specified in the Put Request.
SourceFileDoesNotExist – File specified for Put Request does not exist.
- Return type:
False if the handler is busy. True if the handling of the request was finished successfully.
- reset() None
This function is public to allow completely resetting the handler, but it is explicitly discouraged to do this. CFDP generally has mechanism to detect issues and errors on itself.
- state_machine(packet: AbstractFileDirectiveBase | None = None) FsmResult
This is the primary state machine which performs the CFDP procedures like PDU generation or CRC calculation. The packets generated by this finite-state machine (FSM) need to be sent by the user and can be retrieved using the
get_next_packet()method.This method also allows inserting packets into the state machine via the optional packet argument.
- Raises:
InvalidPduDirection – PDU direction field wrong.
InvalidPduForSourceHandler – Invalid PDU file directive type.
PduIgnoredForSource – The specified PDU can not be handled in the current state.
NoRemoteEntityConfigFound – No remote configuration found for specified destination entity.
InvalidSourceId – Source ID not identical to local entity ID.
InvalidDestinationId – Destination ID was found, but there is a mismatch between the packet destination ID and the remote configuration entity ID.
UnretrievedPdusToBeSent – There are still PDUs which need to be sent before calling the FSM again.
ChecksumNotImplemented – Right now, only a subset of the checksums specified for the CFDP standard are implemented.
SourceFileDoesNotExist – The source file for which a transaction was requested does not exist. This can happen if the file is deleted during a transaction.
- state_machine_no_packet() FsmResult
Helper method to call
state_machine()with None as the packet argument.
- property step: TransactionStep
- property transaction_id: TransactionId | None
- property transaction_seq_num: UnsignedByteField
- property transmission_mode: TransmissionMode | None
- class cfdppy.handler.source.SourceStateWrapper(state: 'CfdpState' = <CfdpState.IDLE: 0>, step: 'TransactionStep' = <TransactionStep.IDLE: 0>, _num_packets_ready: 'int' = 0)
Bases:
object- step: TransactionStep = 0
- class cfdppy.handler.source.TransactionStep(value)
Bases:
EnumAn enumeration.
- IDLE = 0
- NOTICE_OF_COMPLETION = 10
- RETRANSMITTING = 5
Re-transmitting missing packets in acknowledged mode.
- SENDING_EOF = 6
- SENDING_FILE_DATA = 4
- SENDING_METADATA = 3
- TRANSACTION_START = 1
- WAITING_FOR_EOF_ACK = 7
- WAITING_FOR_FINISHED = 8
Destination Handler Module
- class cfdppy.handler.dest.CompletionDisposition(value)
Bases:
EnumAn enumeration.
- CANCELED = 1
- COMPLETED = 0
- class cfdppy.handler.dest.DestHandler(cfg: LocalEntityConfig, user: CfdpUserBase, remote_cfg_table: RemoteEntityConfigTable, check_timer_provider: CheckTimerProvider)
Bases:
objectThis is the primary CFDP destination handler. It models the CFDP source entity, which is primarily responsible for receiving files sent from another CFDP entity. It performs the reception side of File Copy Operations.
This handler supports both acknowledged and unacknowledged CFDP file transfers. The following core functions are the primary interface for interacting with the destination handler:
state_machine(): This state machine processes inserted packets while also generating the packets which need to be sent back to the initiator of a file copy operation. This call can also be used to insert packets into the destination handler. 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. Right now, the handler processes one packet at a time, and each packer insertion needs anotherstate_machine()call.get_next_packet(): Retrieve next packet to be sent back to the remote CFDP source entity.
A new file transfer (Metadata PDU reception) is only be accepted if the handler is in the IDLE state. Furthermore, packet insertion is not allowed until all packets to send were retrieved after a state machine call.
This handler is able to deal with file copy operations to directories, similarly to how the UNIX tool cp works. If the destination path is a directory instead of a regular full path, the source path base file name will be appended to the destination path to form the resulting new full path.
This handler also does not support concurrency out of the box but is flexible enough to be used in different concurrent contexts. For example, you can dynamically create new handlers and run them inside a thread pool, or move the newly created handler to a new thread.
- cancel_request(transaction_id: TransactionId) bool
This function models the Cancel.request CFDP primtive and is the recommended way to cancel a transaction. It will cause a Notice Of Cancellation at this entity. Please note that the state machine might still be active because a canceled transfer might still require some packets to be sent to the remote sender entity.
- Returns:
True – Current transfer was cancelled
False – The state machine is in the IDLE state or there is a transaction ID missmatch.
- property closure_requested: bool
Returns whether a closure was requested for the current transaction. Please note that this variable is only valid as long as the state is not IDLE
- property current_check_counter: int
This is the check count used for the check limit mechanism for incomplete unacknowledged file transfers. A Check Limit Reached fault will be declared once this check counter reaches the configured check limit. More information can be found in chapter 4.6.3.3 b) of the standard.
- property entity_id: UnsignedByteField
- property file_size: int | None
The file size property which was retrieved from the Metadata PDU. This will be None if no transfer is active or more specifically if no Metadata PDU was received yet.
- get_next_packet() PduHolder | None
Retrieve the next packet which should be sent to the remote CFDP source entity.
- reset() None
This function is public to allow completely resetting the handler, but it is explicitly discouraged to do this. CFDP generally has mechanism to detect issues and errors on itself.
- state_machine(packet: AbstractFileDirectiveBase | AbstractPduBase | None = None) FsmResult
This is the primary state machine which performs the CFDP procedures like PDU generation or assembly of received file data PDUs into a file. The packets generated by this finite-state machine (FSM) need to be sent by the user and can be retrieved using the
get_next_packet()method.This method also allows inserting packets into the state machine via the optional packet argument.
- Raises:
NoRemoteEntityConfigFound – No remote configuration found for source entity ID extracted from the PDU packet.
InvalidPduDirection – PDU direction bit is invalid.
InvalidDestinationId – The PDU destination entity ID is not equal to the configured local ID.
InvalidPduForDestHandler – The PDU type can not be handled by the destination handler
PduIgnoredForDest – The PDU was ignored because it can not be handled for the current transmission mode or internal state.
- property step: TransactionStep
- property transaction_id: TransactionId | None
- property transmission_mode: TransmissionMode | None
- class cfdppy.handler.dest.DestStateWrapper(state: 'CfdpState' = <CfdpState.IDLE: 0>, step: 'TransactionStep' = <TransactionStep.IDLE: 0>, transaction_id: 'TransactionId | None' = None, _num_packets_ready: 'int' = 0)
Bases:
object- step: TransactionStep = 0
- transaction_id: TransactionId | None = None
- class cfdppy.handler.dest.FsmResult(states: DestStateWrapper)
Bases:
object
- class cfdppy.handler.dest.LostSegmentTracker
Bases:
object- coalesce_lost_segments() None
Merge overlapping or adjacent segments in self.lost_segments (List[Tuple[int, int]]). After the call the list is sorted and fully coalesced.
- remove_lost_segment(segment_to_remove: tuple[int, int]) bool
Remove exactly the requested span from the lost-segment list.
Any partial overlap with an existing segment raises ValueError. However, removing segments which are a subset of an existing segment are allowed.
Returns True when the list was modified, else False.
- class cfdppy.handler.dest.TransactionStep(value)
Bases:
EnumAn enumeration.
- IDLE = 0
- RECEIVING_FILE_DATA = 3
- RECV_FILE_DATA_WITH_CHECK_LIMIT_HANDLING = 4
This is the check timer step as specified in chapter 4.6.3.3 b) of the standard. The destination handler will still check for file data PDUs which might lead to a full file transfer completion.
- SENDING_FINISHED_PDU = 8
- TRANSACTION_START = 1
Metadata was received, which triggered a transaction start.
- TRANSFER_COMPLETION = 7
File transfer complete. Perform checksum verification and notice of completion. Please note that this does not necessarily mean that the file transfer was completed successfully.
- WAITING_FOR_FINISHED_ACK = 9
- WAITING_FOR_METADATA = 2
Special state which is only used for acknowledged mode. The CFDP entity is still waiting for a missing metadata PDU to be re-sent. Until then, all arriving file data PDUs will only update the internal lost segment tracker. When the EOF PDU arrives, the state will be left. Please note that deferred lost segment handling might also be active when this state is set.
- WAITING_FOR_MISSING_DATA = 6
Wait for lost metadata and file segments as part of the deferred lost segments detection procedure.
- Type:
Only relevant for acknowledged mode
- cfdppy.handler.dest.acknowledge_inactive_eof_pdu(eof_pdu: EofPdu, status: TransactionStatus) AckPdu
This function can be used to fulfill chapter 4.7.2 of the CFDP standard: Every EOF PDU received from the CFDP sender entity MUST be acknowledged, even if the transaction ID of the EOF PDU is not active at the receiver entity. The
spacepackets.cfdp.pdu.ack.TransactionStatusis user provided with the following options:UNDEFINED: The CFDP implementation does not retain a transaction history, so it might have been formerly active and terminated since then, or never active at all.TERMINATED: The CFDP implementation does retain a transaction history and is known to have been active at this entity.UNRECOGNIZED: The CFDP implementation does retain a transaction history and has never been active at this entity.
See the
tmtccmd.cfdp.user.CfdpUserBaseand the documentation for a possible way to keep a transaction history.