diff --git a/src/cfdp/pdu/finished.rs b/src/cfdp/pdu/finished.rs index 6a2220c..0f8cb42 100644 --- a/src/cfdp/pdu/finished.rs +++ b/src/cfdp/pdu/finished.rs @@ -25,7 +25,7 @@ pub enum FileStatus { #[derive(Debug, Copy, Clone, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] -pub struct FinishPdu<'fs_responses> { +pub struct FinishedPdu<'fs_responses> { pdu_header: PduHeader, condition_code: ConditionCode, delivery_code: DeliveryCode, @@ -33,3 +33,27 @@ pub struct FinishPdu<'fs_responses> { fs_responses: Option<&'fs_responses [u8]>, fault_location: Option, } + +impl FinishedPdu<'_> { + /// Default finished PDU: No error (no fault location field) and no filestore responses. + pub fn new_default( + pdu_header: PduHeader, + delivery_code: DeliveryCode, + file_status: FileStatus, + ) -> Self { + Self { + pdu_header, + condition_code: ConditionCode::NoError, + delivery_code, + file_status, + fs_responses: None, + fault_location: None, + } + } +} + +#[cfg(test)] +mod tests { + #[test] + fn test_basic() {} +}