added some basic API for finished PDU
All checks were successful
Rust/spacepackets/pipeline/pr-main This commit looks good
Rust/spacepackets/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2023-06-08 20:55:46 +02:00
parent 006bc39ff6
commit eb6bc4b8a8
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -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<EntityIdTlv>,
}
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() {}
}