From 423a9540edaad417416479b02f47e3c603bd4b16 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Sep 2022 13:51:59 +0200 Subject: [PATCH 1/3] doc corrections --- docs/README-highlevel.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/README-highlevel.md b/docs/README-highlevel.md index 9005af8d..cf2daee7 100644 --- a/docs/README-highlevel.md +++ b/docs/README-highlevel.md @@ -4,12 +4,14 @@ High-level overview # Structure The general structure is driven by the usage of interfaces provided by objects. -The FSFW uses C++11 as baseline. The intention behind this is that this C++ Standard should be -widely available, even with older compilers. -The FSFW uses dynamic allocation during the initialization but provides static containers during runtime. -This simplifies the instantiation of objects and allows the usage of some standard containers. -Dynamic Allocation after initialization is discouraged and different solutions are provided in the -FSFW to achieve that. The fsfw uses run-time type information but exceptions are not allowed. +The FSFW uses C++17 as baseline. Most modern compilers like GCC should have support for this +standard, even for micocontrollers. + +The FSFW uses dynamic allocation during the initialization but provides static containers during +runtime.This simplifies the instantiation of objects and allows the usage of some standard +containers. Dynamic Allocation after initialization is discouraged and different solutions are +provided in the FSFW to achieve that. The fsfw uses run-time type information but will not throw +exceptions. # Failure Handling From 131e3ff1e3fb7f9846b39aac4c6ff06db57da1d0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Sep 2022 13:52:28 +0200 Subject: [PATCH 2/3] Revert "doc corrections" This reverts commit 423a9540edaad417416479b02f47e3c603bd4b16. --- docs/README-highlevel.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/docs/README-highlevel.md b/docs/README-highlevel.md index cf2daee7..9005af8d 100644 --- a/docs/README-highlevel.md +++ b/docs/README-highlevel.md @@ -4,14 +4,12 @@ High-level overview # Structure The general structure is driven by the usage of interfaces provided by objects. -The FSFW uses C++17 as baseline. Most modern compilers like GCC should have support for this -standard, even for micocontrollers. - -The FSFW uses dynamic allocation during the initialization but provides static containers during -runtime.This simplifies the instantiation of objects and allows the usage of some standard -containers. Dynamic Allocation after initialization is discouraged and different solutions are -provided in the FSFW to achieve that. The fsfw uses run-time type information but will not throw -exceptions. +The FSFW uses C++11 as baseline. The intention behind this is that this C++ Standard should be +widely available, even with older compilers. +The FSFW uses dynamic allocation during the initialization but provides static containers during runtime. +This simplifies the instantiation of objects and allows the usage of some standard containers. +Dynamic Allocation after initialization is discouraged and different solutions are provided in the +FSFW to achieve that. The fsfw uses run-time type information but exceptions are not allowed. # Failure Handling From 6f8ccf83e71b8e08b76b27dbb3528ee9e2fa88cb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Sep 2022 18:41:15 +0200 Subject: [PATCH 3/3] use singular enum names --- src/fsfw/cfdp/definitions.h | 15 +++-- src/fsfw/cfdp/handler/FaultHandlerBase.cpp | 26 ++++----- src/fsfw/cfdp/handler/FaultHandlerBase.h | 44 +++++++------- src/fsfw/cfdp/handler/UserBase.h | 10 ++-- src/fsfw/cfdp/handler/mib.h | 4 +- src/fsfw/cfdp/helpers.cpp | 32 +++++------ src/fsfw/cfdp/helpers.h | 2 +- src/fsfw/cfdp/pdu/AckInfo.cpp | 14 ++--- src/fsfw/cfdp/pdu/AckInfo.h | 14 ++--- src/fsfw/cfdp/pdu/AckPduCreator.cpp | 10 ++-- src/fsfw/cfdp/pdu/AckPduReader.cpp | 14 ++--- src/fsfw/cfdp/pdu/AckPduReader.h | 2 +- src/fsfw/cfdp/pdu/EofInfo.cpp | 10 ++-- src/fsfw/cfdp/pdu/EofInfo.h | 8 +-- src/fsfw/cfdp/pdu/EofPduCreator.cpp | 4 +- src/fsfw/cfdp/pdu/EofPduReader.cpp | 4 +- src/fsfw/cfdp/pdu/FileDataCreator.cpp | 2 +- src/fsfw/cfdp/pdu/FileDirectiveCreator.cpp | 6 +- src/fsfw/cfdp/pdu/FileDirectiveCreator.h | 6 +- src/fsfw/cfdp/pdu/FileDirectiveReader.cpp | 10 ++-- src/fsfw/cfdp/pdu/FileDirectiveReader.h | 6 +- src/fsfw/cfdp/pdu/FinishedInfo.cpp | 6 +- src/fsfw/cfdp/pdu/FinishedInfo.h | 8 +-- src/fsfw/cfdp/pdu/FinishedPduCreator.cpp | 2 +- src/fsfw/cfdp/pdu/FinishedPduReader.cpp | 16 +++--- src/fsfw/cfdp/pdu/FinishedPduReader.h | 2 +- src/fsfw/cfdp/pdu/HeaderCreator.cpp | 8 +-- src/fsfw/cfdp/pdu/HeaderCreator.h | 10 ++-- src/fsfw/cfdp/pdu/HeaderReader.cpp | 8 +-- src/fsfw/cfdp/pdu/KeepAlivePduCreator.cpp | 2 +- src/fsfw/cfdp/pdu/MetadataInfo.cpp | 6 +- src/fsfw/cfdp/pdu/MetadataInfo.h | 8 +-- src/fsfw/cfdp/pdu/MetadataPduCreator.cpp | 2 +- src/fsfw/cfdp/pdu/MetadataPduReader.cpp | 2 +- src/fsfw/cfdp/pdu/NakPduCreator.cpp | 2 +- src/fsfw/cfdp/pdu/PduConfig.cpp | 2 +- src/fsfw/cfdp/pdu/PduConfig.h | 4 +- src/fsfw/cfdp/pdu/PduHeaderIF.h | 4 +- src/fsfw/cfdp/pdu/PduHeaderReader.h | 4 +- src/fsfw/cfdp/pdu/PromptPduCreator.cpp | 2 +- src/fsfw/cfdp/tlv/EntityIdTlv.cpp | 8 +-- src/fsfw/cfdp/tlv/EntityIdTlv.h | 2 +- src/fsfw/cfdp/tlv/FaultHandlerOverrideTlv.cpp | 14 ++--- src/fsfw/cfdp/tlv/FaultHandlerOverrideTlv.h | 8 +-- src/fsfw/cfdp/tlv/FilestoreRequestTlv.cpp | 2 +- src/fsfw/cfdp/tlv/FilestoreRequestTlv.h | 2 +- src/fsfw/cfdp/tlv/FilestoreResponseTlv.cpp | 2 +- src/fsfw/cfdp/tlv/FilestoreResponseTlv.h | 2 +- src/fsfw/cfdp/tlv/FilestoreTlvBase.h | 2 +- src/fsfw/cfdp/tlv/FlowLabelTlv.cpp | 2 +- src/fsfw/cfdp/tlv/MessageToUserTlv.cpp | 4 +- src/fsfw/cfdp/tlv/Tlv.cpp | 10 ++-- src/fsfw/cfdp/tlv/Tlv.h | 8 +-- src/fsfw/cfdp/tlv/TlvIF.h | 2 +- unittests/cfdp/handler/testDistributor.cpp | 4 +- unittests/cfdp/handler/testFaultHandler.cpp | 57 ++++++++++--------- unittests/cfdp/pdu/testAckPdu.cpp | 32 +++++------ unittests/cfdp/pdu/testCfdpHeader.cpp | 32 +++++------ unittests/cfdp/pdu/testEofPdu.cpp | 10 ++-- unittests/cfdp/pdu/testFileData.cpp | 2 +- unittests/cfdp/pdu/testFileDirective.cpp | 10 ++-- unittests/cfdp/pdu/testFinishedPdu.cpp | 6 +- unittests/cfdp/pdu/testKeepAlivePdu.cpp | 4 +- unittests/cfdp/pdu/testMetadataPdu.cpp | 18 +++--- unittests/cfdp/pdu/testNakPdu.cpp | 4 +- unittests/cfdp/pdu/testPromptPdu.cpp | 4 +- unittests/cfdp/testCfdp.cpp | 10 ++-- unittests/cfdp/testOtherTlvs.cpp | 10 ++-- unittests/cfdp/testTlv.cpp | 24 ++++---- unittests/mocks/cfdp/FaultHandlerMock.cpp | 20 +++---- unittests/mocks/cfdp/FaultHandlerMock.h | 20 +++---- 71 files changed, 337 insertions(+), 339 deletions(-) diff --git a/src/fsfw/cfdp/definitions.h b/src/fsfw/cfdp/definitions.h index e6297bd7..2d7a37fc 100644 --- a/src/fsfw/cfdp/definitions.h +++ b/src/fsfw/cfdp/definitions.h @@ -41,7 +41,7 @@ static constexpr ReturnValue_t INVALID_PDU_FORMAT = returnvalue::makeCode(CFDP_C //! Checksum types according to the SANA Checksum Types registry //! https://sanaregistry.org/r/checksum_identifiers/ -enum ChecksumTypes { +enum ChecksumType { // Modular legacy checksum MODULAR = 0, CRC_32_PROXIMITY_1 = 1, @@ -50,9 +50,9 @@ enum ChecksumTypes { NULL_CHECKSUM = 15 }; -enum PduTypes : uint8_t { FILE_DIRECTIVE = 0, FILE_DATA = 1 }; +enum PduType : uint8_t { FILE_DIRECTIVE = 0, FILE_DATA = 1 }; -enum TransmissionModes : uint8_t { ACKNOWLEDGED = 0, UNACKNOWLEDGED = 1 }; +enum TransmissionMode : uint8_t { ACKNOWLEDGED = 0, UNACKNOWLEDGED = 1 }; enum SegmentMetadataFlag : bool { NOT_PRESENT = false, PRESENT = true }; @@ -70,7 +70,7 @@ enum WidthInBytes : uint8_t { FOUR_BYTES = 4, }; -enum FileDirectives : uint8_t { +enum FileDirective : uint8_t { INVALID_DIRECTIVE = 0x0f, // The _DIRECTIVE suffix is mandatory here because of some nameclash! EOF_DIRECTIVE = 0x04, @@ -82,7 +82,7 @@ enum FileDirectives : uint8_t { KEEP_ALIVE = 0x0c }; -enum ConditionCodes : uint8_t { +enum ConditionCode : uint8_t { NO_CONDITION_FIELD = 0xff, NO_ERROR = 0b0000, POSITIVE_ACK_LIMIT_REACHED = 0b0001, @@ -99,8 +99,7 @@ enum ConditionCodes : uint8_t { CANCEL_REQUEST_RECEIVED = 0b1111 }; - -enum FaultHandlerCodes { +enum FaultHandlerCode { RESERVED = 0b0000, NOTICE_OF_CANCELLATION = 0b0001, NOTICE_OF_SUSPENSION = 0b0010, @@ -126,7 +125,7 @@ enum FileDeliveryStatus { enum PromptResponseRequired : uint8_t { PROMPT_NAK = 0, PROMPT_KEEP_ALIVE = 1 }; -enum TlvTypes : uint8_t { +enum TlvType : uint8_t { FILESTORE_REQUEST = 0x00, FILESTORE_RESPONSE = 0x01, MSG_TO_USER = 0x02, diff --git a/src/fsfw/cfdp/handler/FaultHandlerBase.cpp b/src/fsfw/cfdp/handler/FaultHandlerBase.cpp index 0531846c..4e16692e 100644 --- a/src/fsfw/cfdp/handler/FaultHandlerBase.cpp +++ b/src/fsfw/cfdp/handler/FaultHandlerBase.cpp @@ -5,8 +5,8 @@ namespace cfdp { FaultHandlerBase::FaultHandlerBase() = default; FaultHandlerBase::~FaultHandlerBase() = default; -bool FaultHandlerBase::getFaultHandler(cfdp::ConditionCodes code, - cfdp::FaultHandlerCodes& handler) const { +bool FaultHandlerBase::getFaultHandler(cfdp::ConditionCode code, + cfdp::FaultHandlerCode& handler) const { auto iter = faultHandlerMap.find(code); if (iter == faultHandlerMap.end()) { return false; @@ -15,32 +15,32 @@ bool FaultHandlerBase::getFaultHandler(cfdp::ConditionCodes code, return true; } -bool FaultHandlerBase::setFaultHandler(cfdp::ConditionCodes code, cfdp::FaultHandlerCodes handler) { +bool FaultHandlerBase::setFaultHandler(cfdp::ConditionCode code, cfdp::FaultHandlerCode handler) { if (not faultHandlerMap.contains(code)) { return false; } - if (handler != FaultHandlerCodes::NOTICE_OF_SUSPENSION and - handler != FaultHandlerCodes::ABANDON_TRANSACTION and - handler != FaultHandlerCodes::NOTICE_OF_CANCELLATION and - handler != FaultHandlerCodes::IGNORE_ERROR) { + if (handler != FaultHandlerCode::NOTICE_OF_SUSPENSION and + handler != FaultHandlerCode::ABANDON_TRANSACTION and + handler != FaultHandlerCode::NOTICE_OF_CANCELLATION and + handler != FaultHandlerCode::IGNORE_ERROR) { return false; } faultHandlerMap[code] = handler; return true; } -bool FaultHandlerBase::reportFault(cfdp::TransactionId& id, cfdp::ConditionCodes code) { +bool FaultHandlerBase::reportFault(cfdp::TransactionId& id, cfdp::ConditionCode code) { if (not faultHandlerMap.contains(code)) { return false; } - cfdp::FaultHandlerCodes fh = faultHandlerMap[code]; - if (fh == cfdp::FaultHandlerCodes::IGNORE_ERROR) { + cfdp::FaultHandlerCode fh = faultHandlerMap[code]; + if (fh == cfdp::FaultHandlerCode::IGNORE_ERROR) { ignoreCb(id, code); - } else if (fh == cfdp::FaultHandlerCodes::ABANDON_TRANSACTION) { + } else if (fh == cfdp::FaultHandlerCode::ABANDON_TRANSACTION) { abandonCb(id, code); - } else if (fh == cfdp::FaultHandlerCodes::NOTICE_OF_CANCELLATION) { + } else if (fh == cfdp::FaultHandlerCode::NOTICE_OF_CANCELLATION) { noticeOfCancellationCb(id, code); - } else if (fh == cfdp::FaultHandlerCodes::NOTICE_OF_SUSPENSION) { + } else if (fh == cfdp::FaultHandlerCode::NOTICE_OF_SUSPENSION) { noticeOfSuspensionCb(id, code); } else { // Should never happen, but use defensive programming diff --git a/src/fsfw/cfdp/handler/FaultHandlerBase.h b/src/fsfw/cfdp/handler/FaultHandlerBase.h index 0c7f534c..39b8e180 100644 --- a/src/fsfw/cfdp/handler/FaultHandlerBase.h +++ b/src/fsfw/cfdp/handler/FaultHandlerBase.h @@ -43,33 +43,33 @@ class FaultHandlerBase { * - true if the condition code is valid * - false otherwise */ - bool getFaultHandler(cfdp::ConditionCodes code, cfdp::FaultHandlerCodes& handler) const; + bool getFaultHandler(cfdp::ConditionCode code, cfdp::FaultHandlerCode& handler) const; - bool setFaultHandler(cfdp::ConditionCodes code, cfdp::FaultHandlerCodes handler); + bool setFaultHandler(cfdp::ConditionCode code, cfdp::FaultHandlerCode handler); - bool reportFault(cfdp::TransactionId& id, cfdp::ConditionCodes code); + bool reportFault(cfdp::TransactionId& id, cfdp::ConditionCode code); - virtual void noticeOfSuspensionCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0; - virtual void noticeOfCancellationCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0; - virtual void abandonCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0; - virtual void ignoreCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0; + virtual void noticeOfSuspensionCb(cfdp::TransactionId& id, cfdp::ConditionCode code) = 0; + virtual void noticeOfCancellationCb(cfdp::TransactionId& id, cfdp::ConditionCode code) = 0; + virtual void abandonCb(cfdp::TransactionId& id, cfdp::ConditionCode code) = 0; + virtual void ignoreCb(cfdp::TransactionId& id, cfdp::ConditionCode code) = 0; private: - etl::flat_map faultHandlerMap = { - etl::pair{cfdp::ConditionCodes::POSITIVE_ACK_LIMIT_REACHED, - cfdp::FaultHandlerCodes::IGNORE_ERROR}, - etl::pair{cfdp::ConditionCodes::KEEP_ALIVE_LIMIT_REACHED, - cfdp::FaultHandlerCodes::IGNORE_ERROR}, - etl::pair{cfdp::ConditionCodes::INVALID_TRANSMISSION_MODE, - cfdp::FaultHandlerCodes::IGNORE_ERROR}, - etl::pair{cfdp::ConditionCodes::FILE_CHECKSUM_FAILURE, cfdp::FaultHandlerCodes::IGNORE_ERROR}, - etl::pair{cfdp::ConditionCodes::FILE_SIZE_ERROR, cfdp::FaultHandlerCodes::IGNORE_ERROR}, - etl::pair{cfdp::ConditionCodes::NAK_LIMIT_REACHED, cfdp::FaultHandlerCodes::IGNORE_ERROR}, - etl::pair{cfdp::ConditionCodes::INACTIVITY_DETECTED, cfdp::FaultHandlerCodes::IGNORE_ERROR}, - etl::pair{cfdp::ConditionCodes::UNSUPPORTED_CHECKSUM_TYPE, - cfdp::FaultHandlerCodes::IGNORE_ERROR}, - etl::pair{cfdp::ConditionCodes::FILESTORE_REJECTION, cfdp::FaultHandlerCodes::IGNORE_ERROR}, - etl::pair{cfdp::ConditionCodes::CHECK_LIMIT_REACHED, cfdp::FaultHandlerCodes::IGNORE_ERROR}}; + etl::flat_map faultHandlerMap = { + etl::pair{cfdp::ConditionCode::POSITIVE_ACK_LIMIT_REACHED, + cfdp::FaultHandlerCode::IGNORE_ERROR}, + etl::pair{cfdp::ConditionCode::KEEP_ALIVE_LIMIT_REACHED, + cfdp::FaultHandlerCode::IGNORE_ERROR}, + etl::pair{cfdp::ConditionCode::INVALID_TRANSMISSION_MODE, + cfdp::FaultHandlerCode::IGNORE_ERROR}, + etl::pair{cfdp::ConditionCode::FILE_CHECKSUM_FAILURE, cfdp::FaultHandlerCode::IGNORE_ERROR}, + etl::pair{cfdp::ConditionCode::FILE_SIZE_ERROR, cfdp::FaultHandlerCode::IGNORE_ERROR}, + etl::pair{cfdp::ConditionCode::NAK_LIMIT_REACHED, cfdp::FaultHandlerCode::IGNORE_ERROR}, + etl::pair{cfdp::ConditionCode::INACTIVITY_DETECTED, cfdp::FaultHandlerCode::IGNORE_ERROR}, + etl::pair{cfdp::ConditionCode::UNSUPPORTED_CHECKSUM_TYPE, + cfdp::FaultHandlerCode::IGNORE_ERROR}, + etl::pair{cfdp::ConditionCode::FILESTORE_REJECTION, cfdp::FaultHandlerCode::IGNORE_ERROR}, + etl::pair{cfdp::ConditionCode::CHECK_LIMIT_REACHED, cfdp::FaultHandlerCode::IGNORE_ERROR}}; }; } // namespace cfdp diff --git a/src/fsfw/cfdp/handler/UserBase.h b/src/fsfw/cfdp/handler/UserBase.h index 4ff5eb96..e367b4a8 100644 --- a/src/fsfw/cfdp/handler/UserBase.h +++ b/src/fsfw/cfdp/handler/UserBase.h @@ -14,12 +14,12 @@ namespace cfdp { struct TransactionFinishedParams { - TransactionFinishedParams(const TransactionId& id, ConditionCodes code, FileDeliveryCode delivCode, + TransactionFinishedParams(const TransactionId& id, ConditionCode code, FileDeliveryCode delivCode, FileDeliveryStatus status) : id(id), condCode(code), status(status), deliveryCode(delivCode) {} const TransactionId& id; - ConditionCodes condCode; + ConditionCode condCode; FileDeliveryStatus status; FileDeliveryCode deliveryCode; std::vector fsResponses; @@ -85,10 +85,10 @@ class UserBase { virtual void metadataRecvdIndication(const MetadataRecvdParams& params) = 0; virtual void fileSegmentRecvdIndication(const FileSegmentRecvdParams& params) = 0; virtual void reportIndication(const TransactionId& id, StatusReportIF& report) = 0; - virtual void suspendedIndication(const TransactionId& id, ConditionCodes code) = 0; + virtual void suspendedIndication(const TransactionId& id, ConditionCode code) = 0; virtual void resumedIndication(const TransactionId& id, size_t progress) = 0; - virtual void faultIndication(const TransactionId& id, ConditionCodes code, size_t progress) = 0; - virtual void abandonedIndication(const TransactionId& id, ConditionCodes code, + virtual void faultIndication(const TransactionId& id, ConditionCode code, size_t progress) = 0; + virtual void abandonedIndication(const TransactionId& id, ConditionCode code, size_t progress) = 0; virtual void eofRecvIndication(const TransactionId& id) = 0; diff --git a/src/fsfw/cfdp/handler/mib.h b/src/fsfw/cfdp/handler/mib.h index 76284f2d..553596a6 100644 --- a/src/fsfw/cfdp/handler/mib.h +++ b/src/fsfw/cfdp/handler/mib.h @@ -32,8 +32,8 @@ struct RemoteEntityCfg { size_t maxFileSegmentLen = 2048; bool closureRequested = false; bool crcOnTransmission = false; - TransmissionModes defaultTransmissionMode = TransmissionModes::UNACKNOWLEDGED; - ChecksumTypes defaultChecksum = ChecksumTypes::NULL_CHECKSUM; + TransmissionMode defaultTransmissionMode = TransmissionMode::UNACKNOWLEDGED; + ChecksumType defaultChecksum = ChecksumType::NULL_CHECKSUM; const uint8_t version = CFDP_VERSION_2; }; diff --git a/src/fsfw/cfdp/helpers.cpp b/src/fsfw/cfdp/helpers.cpp index 49839e1f..fdb7d5ff 100644 --- a/src/fsfw/cfdp/helpers.cpp +++ b/src/fsfw/cfdp/helpers.cpp @@ -1,23 +1,21 @@ #include "helpers.h" -const char* COND_CODE_STRINGS[14] = { - "Unknown", - "No Error", - "Positive ACK Limit Reached", - "Keep Alive Limit Reached", - "Invalid Transmission Mode", - "Filestore Rejection", - "File Checksum Failure", - "File Size Error", - "NAK limit reached", - "Inactivity Detected", - "Check Limit Reached", - "Unsupported Checksum Type", - "Suspend Request Received", - "Cancel Request Received" -}; +const char* COND_CODE_STRINGS[14] = {"Unknown", + "No Error", + "Positive ACK Limit Reached", + "Keep Alive Limit Reached", + "Invalid Transmission Mode", + "Filestore Rejection", + "File Checksum Failure", + "File Size Error", + "NAK limit reached", + "Inactivity Detected", + "Check Limit Reached", + "Unsupported Checksum Type", + "Suspend Request Received", + "Cancel Request Received"}; -const char* cfdp::getConditionCodeString(cfdp::ConditionCodes code) { +const char* cfdp::getConditionCodeString(cfdp::ConditionCode code) { switch (code) { case NO_CONDITION_FIELD: return COND_CODE_STRINGS[0]; diff --git a/src/fsfw/cfdp/helpers.h b/src/fsfw/cfdp/helpers.h index df64c847..37428108 100644 --- a/src/fsfw/cfdp/helpers.h +++ b/src/fsfw/cfdp/helpers.h @@ -5,7 +5,7 @@ namespace cfdp { -const char* getConditionCodeString(cfdp::ConditionCodes code); +const char* getConditionCodeString(cfdp::ConditionCode code); } #endif // FSFW_EXAMPLE_HOSTED_HELPER_H diff --git a/src/fsfw/cfdp/pdu/AckInfo.cpp b/src/fsfw/cfdp/pdu/AckInfo.cpp index 240f1bfb..963f7cbb 100644 --- a/src/fsfw/cfdp/pdu/AckInfo.cpp +++ b/src/fsfw/cfdp/pdu/AckInfo.cpp @@ -1,32 +1,32 @@ #include "AckInfo.h" -AckInfo::AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCodes ackedConditionCode, +AckInfo::AckInfo(cfdp::FileDirective ackedDirective, cfdp::ConditionCode ackedConditionCode, cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode) : ackedDirective(ackedDirective), ackedConditionCode(ackedConditionCode), transactionStatus(transactionStatus), directiveSubtypeCode(directiveSubtypeCode) { - if (ackedDirective == cfdp::FileDirectives::FINISH) { + if (ackedDirective == cfdp::FileDirective::FINISH) { this->directiveSubtypeCode = 0b0001; } else { this->directiveSubtypeCode = 0b0000; } } -cfdp::ConditionCodes AckInfo::getAckedConditionCode() const { return ackedConditionCode; } +cfdp::ConditionCode AckInfo::getAckedConditionCode() const { return ackedConditionCode; } -void AckInfo::setAckedConditionCode(cfdp::ConditionCodes ackedConditionCode) { +void AckInfo::setAckedConditionCode(cfdp::ConditionCode ackedConditionCode) { this->ackedConditionCode = ackedConditionCode; - if (ackedDirective == cfdp::FileDirectives::FINISH) { + if (ackedDirective == cfdp::FileDirective::FINISH) { this->directiveSubtypeCode = 0b0001; } else { this->directiveSubtypeCode = 0b0000; } } -cfdp::FileDirectives AckInfo::getAckedDirective() const { return ackedDirective; } +cfdp::FileDirective AckInfo::getAckedDirective() const { return ackedDirective; } -void AckInfo::setAckedDirective(cfdp::FileDirectives ackedDirective) { +void AckInfo::setAckedDirective(cfdp::FileDirective ackedDirective) { this->ackedDirective = ackedDirective; } diff --git a/src/fsfw/cfdp/pdu/AckInfo.h b/src/fsfw/cfdp/pdu/AckInfo.h index 2781ee73..23e4d6ab 100644 --- a/src/fsfw/cfdp/pdu/AckInfo.h +++ b/src/fsfw/cfdp/pdu/AckInfo.h @@ -6,14 +6,14 @@ class AckInfo { public: AckInfo(); - AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCodes ackedConditionCode, + AckInfo(cfdp::FileDirective ackedDirective, cfdp::ConditionCode ackedConditionCode, cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode = 0); - cfdp::ConditionCodes getAckedConditionCode() const; - void setAckedConditionCode(cfdp::ConditionCodes ackedConditionCode); + cfdp::ConditionCode getAckedConditionCode() const; + void setAckedConditionCode(cfdp::ConditionCode ackedConditionCode); - cfdp::FileDirectives getAckedDirective() const; - void setAckedDirective(cfdp::FileDirectives ackedDirective); + cfdp::FileDirective getAckedDirective() const; + void setAckedDirective(cfdp::FileDirective ackedDirective); uint8_t getDirectiveSubtypeCode() const; void setDirectiveSubtypeCode(uint8_t directiveSubtypeCode); @@ -22,8 +22,8 @@ class AckInfo { void setTransactionStatus(cfdp::AckTransactionStatus transactionStatus); private: - cfdp::FileDirectives ackedDirective = cfdp::FileDirectives::INVALID_DIRECTIVE; - cfdp::ConditionCodes ackedConditionCode = cfdp::ConditionCodes::NO_CONDITION_FIELD; + cfdp::FileDirective ackedDirective = cfdp::FileDirective::INVALID_DIRECTIVE; + cfdp::ConditionCode ackedConditionCode = cfdp::ConditionCode::NO_CONDITION_FIELD; cfdp::AckTransactionStatus transactionStatus = cfdp::AckTransactionStatus::UNDEFINED; uint8_t directiveSubtypeCode = 0; }; diff --git a/src/fsfw/cfdp/pdu/AckPduCreator.cpp b/src/fsfw/cfdp/pdu/AckPduCreator.cpp index 8683c65f..f7623e57 100644 --- a/src/fsfw/cfdp/pdu/AckPduCreator.cpp +++ b/src/fsfw/cfdp/pdu/AckPduCreator.cpp @@ -1,7 +1,7 @@ #include "AckPduCreator.h" AckPduCreator::AckPduCreator(AckInfo &ackInfo, PduConfig &pduConf) - : FileDirectiveCreator(pduConf, cfdp::FileDirectives::ACK, 2), ackInfo(ackInfo) {} + : FileDirectiveCreator(pduConf, cfdp::FileDirective::ACK, 2), ackInfo(ackInfo) {} size_t AckPduCreator::getSerializedSize() const { return FileDirectiveCreator::getWholePduSize(); } @@ -11,12 +11,12 @@ ReturnValue_t AckPduCreator::serialize(uint8_t **buffer, size_t *size, size_t ma if (result != returnvalue::OK) { return result; } - cfdp::FileDirectives ackedDirective = ackInfo.getAckedDirective(); + cfdp::FileDirective ackedDirective = ackInfo.getAckedDirective(); uint8_t directiveSubtypeCode = ackInfo.getDirectiveSubtypeCode(); - cfdp::ConditionCodes ackedConditionCode = ackInfo.getAckedConditionCode(); + cfdp::ConditionCode ackedConditionCode = ackInfo.getAckedConditionCode(); cfdp::AckTransactionStatus transactionStatus = ackInfo.getTransactionStatus(); - if (ackedDirective != cfdp::FileDirectives::FINISH and - ackedDirective != cfdp::FileDirectives::EOF_DIRECTIVE) { + if (ackedDirective != cfdp::FileDirective::FINISH and + ackedDirective != cfdp::FileDirective::EOF_DIRECTIVE) { // TODO: better returncode return returnvalue::FAILED; } diff --git a/src/fsfw/cfdp/pdu/AckPduReader.cpp b/src/fsfw/cfdp/pdu/AckPduReader.cpp index efa6f6df..7204ced0 100644 --- a/src/fsfw/cfdp/pdu/AckPduReader.cpp +++ b/src/fsfw/cfdp/pdu/AckPduReader.cpp @@ -19,7 +19,7 @@ ReturnValue_t AckPduReader::parseData() { } bool AckPduReader::checkAndSetCodes(uint8_t firstByte, uint8_t secondByte) { - cfdp::FileDirectives directive; + cfdp::FileDirective directive; if (not checkAckedDirectiveField(firstByte, directive)) { return false; } @@ -29,17 +29,17 @@ bool AckPduReader::checkAndSetCodes(uint8_t firstByte, uint8_t secondByte) { return false; } this->info.setDirectiveSubtypeCode(directiveSubtypeCode); - this->info.setAckedConditionCode(static_cast(secondByte >> 4)); + this->info.setAckedConditionCode(static_cast(secondByte >> 4)); this->info.setTransactionStatus(static_cast(secondByte & 0x0f)); return true; } bool AckPduReader::checkAckedDirectiveField(uint8_t firstPduDataByte, - cfdp::FileDirectives& ackedDirective) { - uint8_t ackedDirectiveRaw = static_cast(firstPduDataByte >> 4); - if (ackedDirectiveRaw != cfdp::FileDirectives::EOF_DIRECTIVE and - ackedDirectiveRaw != cfdp::FileDirectives::FINISH) { + cfdp::FileDirective& ackedDirective) { + uint8_t ackedDirectiveRaw = static_cast(firstPduDataByte >> 4); + if (ackedDirectiveRaw != cfdp::FileDirective::EOF_DIRECTIVE and + ackedDirectiveRaw != cfdp::FileDirective::FINISH) { return false; } - ackedDirective = (static_cast(ackedDirectiveRaw)); + ackedDirective = (static_cast(ackedDirectiveRaw)); return true; } diff --git a/src/fsfw/cfdp/pdu/AckPduReader.h b/src/fsfw/cfdp/pdu/AckPduReader.h index 2b5dd411..8f8b515b 100644 --- a/src/fsfw/cfdp/pdu/AckPduReader.h +++ b/src/fsfw/cfdp/pdu/AckPduReader.h @@ -16,7 +16,7 @@ class AckPduReader : public FileDirectiveReader { ReturnValue_t parseData() override; static bool checkAckedDirectiveField(uint8_t firstPduDataByte, - cfdp::FileDirectives& ackedDirective); + cfdp::FileDirective& ackedDirective); private: bool checkAndSetCodes(uint8_t rawAckedByte, uint8_t rawAckedConditionCode); diff --git a/src/fsfw/cfdp/pdu/EofInfo.cpp b/src/fsfw/cfdp/pdu/EofInfo.cpp index b19a709b..98e79df7 100644 --- a/src/fsfw/cfdp/pdu/EofInfo.cpp +++ b/src/fsfw/cfdp/pdu/EofInfo.cpp @@ -1,18 +1,18 @@ #include "EofInfo.h" -EofInfo::EofInfo(cfdp::ConditionCodes conditionCode, uint32_t checksum, cfdp::FileSize fileSize, +EofInfo::EofInfo(cfdp::ConditionCode conditionCode, uint32_t checksum, cfdp::FileSize fileSize, EntityIdTlv* faultLoc) : conditionCode(conditionCode), checksum(checksum), fileSize(fileSize), faultLoc(faultLoc) {} EofInfo::EofInfo(EntityIdTlv* faultLoc) - : conditionCode(cfdp::ConditionCodes::NO_CONDITION_FIELD), + : conditionCode(cfdp::ConditionCode::NO_CONDITION_FIELD), checksum(0), fileSize(0), faultLoc(faultLoc) {} uint32_t EofInfo::getChecksum() const { return checksum; } -cfdp::ConditionCodes EofInfo::getConditionCode() const { return conditionCode; } +cfdp::ConditionCode EofInfo::getConditionCode() const { return conditionCode; } EntityIdTlv* EofInfo::getFaultLoc() const { return faultLoc; } @@ -20,7 +20,7 @@ cfdp::FileSize& EofInfo::getFileSize() { return fileSize; } void EofInfo::setChecksum(uint32_t checksum) { this->checksum = checksum; } -void EofInfo::setConditionCode(cfdp::ConditionCodes conditionCode) { +void EofInfo::setConditionCode(cfdp::ConditionCode conditionCode) { this->conditionCode = conditionCode; } @@ -36,7 +36,7 @@ size_t EofInfo::getSerializedSize(bool fssLarge) { } // Do not account for fault location if the condition code is NO_ERROR. We assume that // a serializer will not serialize the fault location here. - if (getFaultLoc() != nullptr and getConditionCode() != cfdp::ConditionCodes::NO_ERROR) { + if (getFaultLoc() != nullptr and getConditionCode() != cfdp::ConditionCode::NO_ERROR) { size += faultLoc->getSerializedSize(); } return size; diff --git a/src/fsfw/cfdp/pdu/EofInfo.h b/src/fsfw/cfdp/pdu/EofInfo.h index bd6e6493..4b4fb057 100644 --- a/src/fsfw/cfdp/pdu/EofInfo.h +++ b/src/fsfw/cfdp/pdu/EofInfo.h @@ -8,23 +8,23 @@ struct EofInfo { public: explicit EofInfo(EntityIdTlv* faultLoc = nullptr); - EofInfo(cfdp::ConditionCodes conditionCode, uint32_t checksum, cfdp::FileSize fileSize, + EofInfo(cfdp::ConditionCode conditionCode, uint32_t checksum, cfdp::FileSize fileSize, EntityIdTlv* faultLoc = nullptr); size_t getSerializedSize(bool fssLarge = false); [[nodiscard]] uint32_t getChecksum() const; - [[nodiscard]] cfdp::ConditionCodes getConditionCode() const; + [[nodiscard]] cfdp::ConditionCode getConditionCode() const; [[nodiscard]] EntityIdTlv* getFaultLoc() const; cfdp::FileSize& getFileSize(); void setChecksum(uint32_t checksum); - void setConditionCode(cfdp::ConditionCodes conditionCode); + void setConditionCode(cfdp::ConditionCode conditionCode); void setFaultLoc(EntityIdTlv* faultLoc); ReturnValue_t setFileSize(size_t size, bool isLarge); private: - cfdp::ConditionCodes conditionCode; + cfdp::ConditionCode conditionCode; uint32_t checksum; cfdp::FileSize fileSize; EntityIdTlv* faultLoc = nullptr; diff --git a/src/fsfw/cfdp/pdu/EofPduCreator.cpp b/src/fsfw/cfdp/pdu/EofPduCreator.cpp index 3e196e02..12a3e696 100644 --- a/src/fsfw/cfdp/pdu/EofPduCreator.cpp +++ b/src/fsfw/cfdp/pdu/EofPduCreator.cpp @@ -3,7 +3,7 @@ #include "fsfw/FSFW.h" EofPduCreator::EofPduCreator(PduConfig &conf, EofInfo &info) - : FileDirectiveCreator(conf, cfdp::FileDirectives::EOF_DIRECTIVE, 9), info(info) { + : FileDirectiveCreator(conf, cfdp::FileDirective::EOF_DIRECTIVE, 9), info(info) { setDirectiveDataFieldLen(info.getSerializedSize(HeaderCreator::getLargeFileFlag())); } @@ -33,7 +33,7 @@ ReturnValue_t EofPduCreator::serialize(uint8_t **buffer, size_t *size, size_t ma uint32_t fileSizeValue = info.getFileSize().getSize(); result = SerializeAdapter::serialize(&fileSizeValue, buffer, size, maxSize, streamEndianness); } - if (info.getFaultLoc() != nullptr and info.getConditionCode() != cfdp::ConditionCodes::NO_ERROR) { + if (info.getFaultLoc() != nullptr and info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) { result = info.getFaultLoc()->serialize(buffer, size, maxSize, streamEndianness); } return result; diff --git a/src/fsfw/cfdp/pdu/EofPduReader.cpp b/src/fsfw/cfdp/pdu/EofPduReader.cpp index 333e1224..c80c501c 100644 --- a/src/fsfw/cfdp/pdu/EofPduReader.cpp +++ b/src/fsfw/cfdp/pdu/EofPduReader.cpp @@ -25,7 +25,7 @@ ReturnValue_t EofPduReader::parseData() { bufPtr += currentIdx; deserLen -= currentIdx; - info.setConditionCode(static_cast(*bufPtr >> 4)); + info.setConditionCode(static_cast(*bufPtr >> 4)); bufPtr += 1; deserLen -= 1; uint32_t checksum = 0; @@ -47,7 +47,7 @@ ReturnValue_t EofPduReader::parseData() { if (result != returnvalue::OK) { return result; } - if (info.getConditionCode() != cfdp::ConditionCodes::NO_ERROR) { + if (info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) { EntityIdTlv* tlvPtr = info.getFaultLoc(); if (tlvPtr == nullptr) { #if FSFW_VERBOSE_LEVEL >= 1 diff --git a/src/fsfw/cfdp/pdu/FileDataCreator.cpp b/src/fsfw/cfdp/pdu/FileDataCreator.cpp index b9a45b5a..956752fb 100644 --- a/src/fsfw/cfdp/pdu/FileDataCreator.cpp +++ b/src/fsfw/cfdp/pdu/FileDataCreator.cpp @@ -3,7 +3,7 @@ #include FileDataCreator::FileDataCreator(PduConfig& conf, FileDataInfo& info) - : HeaderCreator(conf, cfdp::PduTypes::FILE_DATA, 0, info.getSegmentMetadataFlag()), info(info) { + : HeaderCreator(conf, cfdp::PduType::FILE_DATA, 0, info.getSegmentMetadataFlag()), info(info) { update(); } diff --git a/src/fsfw/cfdp/pdu/FileDirectiveCreator.cpp b/src/fsfw/cfdp/pdu/FileDirectiveCreator.cpp index 1e4da14d..20f93df9 100644 --- a/src/fsfw/cfdp/pdu/FileDirectiveCreator.cpp +++ b/src/fsfw/cfdp/pdu/FileDirectiveCreator.cpp @@ -1,8 +1,8 @@ #include "FileDirectiveCreator.h" -FileDirectiveCreator::FileDirectiveCreator(PduConfig &pduConf, cfdp::FileDirectives directiveCode, +FileDirectiveCreator::FileDirectiveCreator(PduConfig &pduConf, cfdp::FileDirective directiveCode, size_t directiveParamFieldLen) - : HeaderCreator(pduConf, cfdp::PduTypes::FILE_DIRECTIVE, directiveParamFieldLen + 1), + : HeaderCreator(pduConf, cfdp::PduType::FILE_DIRECTIVE, directiveParamFieldLen + 1), directiveCode(directiveCode) {} size_t FileDirectiveCreator::getSerializedSize() const { @@ -36,4 +36,4 @@ void FileDirectiveCreator::setDirectiveDataFieldLen(size_t len) { HeaderCreator::setPduDataFieldLen(len + 1); } -cfdp::FileDirectives FileDirectiveCreator::getDirectiveCode() const { return directiveCode; } +cfdp::FileDirective FileDirectiveCreator::getDirectiveCode() const { return directiveCode; } diff --git a/src/fsfw/cfdp/pdu/FileDirectiveCreator.h b/src/fsfw/cfdp/pdu/FileDirectiveCreator.h index a3b676b0..9b7f2f52 100644 --- a/src/fsfw/cfdp/pdu/FileDirectiveCreator.h +++ b/src/fsfw/cfdp/pdu/FileDirectiveCreator.h @@ -5,10 +5,10 @@ class FileDirectiveCreator : public HeaderCreator { public: - FileDirectiveCreator(PduConfig& pduConf, cfdp::FileDirectives directiveCode, + FileDirectiveCreator(PduConfig& pduConf, cfdp::FileDirective directiveCode, size_t directiveParamFieldLen); - [[nodiscard]] cfdp::FileDirectives getDirectiveCode() const; + [[nodiscard]] cfdp::FileDirective getDirectiveCode() const; /** * This only returns the size of the PDU header + 1 for the directive code octet. @@ -28,7 +28,7 @@ class FileDirectiveCreator : public HeaderCreator { void setDirectiveDataFieldLen(size_t len); private: - cfdp::FileDirectives directiveCode = cfdp::FileDirectives::INVALID_DIRECTIVE; + cfdp::FileDirective directiveCode = cfdp::FileDirective::INVALID_DIRECTIVE; }; #endif /* FSFW_SRC_FSFW_CFDP_PDU_FILEDIRECTIVESERIALIZER_H_ */ diff --git a/src/fsfw/cfdp/pdu/FileDirectiveReader.cpp b/src/fsfw/cfdp/pdu/FileDirectiveReader.cpp index 748ac830..f5fc6e58 100644 --- a/src/fsfw/cfdp/pdu/FileDirectiveReader.cpp +++ b/src/fsfw/cfdp/pdu/FileDirectiveReader.cpp @@ -3,7 +3,7 @@ FileDirectiveReader::FileDirectiveReader(const uint8_t *pduBuf, size_t maxSize) : PduHeaderReader(pduBuf, maxSize) {} -cfdp::FileDirectives FileDirectiveReader::getFileDirective() const { return fileDirective; } +cfdp::FileDirective FileDirectiveReader::getFileDirective() const { return fileDirective; } ReturnValue_t FileDirectiveReader::parseData() { ReturnValue_t result = PduHeaderReader::parseData(); @@ -20,7 +20,7 @@ ReturnValue_t FileDirectiveReader::parseData() { if (not checkFileDirective(pointers.rawPtr[currentIdx])) { return cfdp::INVALID_DIRECTIVE_FIELD; } - setFileDirective(static_cast(pointers.rawPtr[currentIdx])); + setFileDirective(static_cast(pointers.rawPtr[currentIdx])); return returnvalue::OK; } @@ -30,15 +30,15 @@ size_t FileDirectiveReader::getHeaderSize() const { } bool FileDirectiveReader::checkFileDirective(uint8_t rawByte) { - if (rawByte < cfdp::FileDirectives::EOF_DIRECTIVE or - (rawByte > cfdp::FileDirectives::PROMPT and rawByte != cfdp::FileDirectives::KEEP_ALIVE)) { + if (rawByte < cfdp::FileDirective::EOF_DIRECTIVE or + (rawByte > cfdp::FileDirective::PROMPT and rawByte != cfdp::FileDirective::KEEP_ALIVE)) { // Invalid directive field return false; } return true; } -void FileDirectiveReader::setFileDirective(cfdp::FileDirectives fileDirective_) { +void FileDirectiveReader::setFileDirective(cfdp::FileDirective fileDirective_) { fileDirective = fileDirective_; } diff --git a/src/fsfw/cfdp/pdu/FileDirectiveReader.h b/src/fsfw/cfdp/pdu/FileDirectiveReader.h index 5bec486c..9e88e006 100644 --- a/src/fsfw/cfdp/pdu/FileDirectiveReader.h +++ b/src/fsfw/cfdp/pdu/FileDirectiveReader.h @@ -22,7 +22,7 @@ class FileDirectiveReader : public PduHeaderReader { ReturnValue_t parseData() override; [[nodiscard]] size_t getHeaderSize() const override; - [[nodiscard]] cfdp::FileDirectives getFileDirective() const; + [[nodiscard]] cfdp::FileDirective getFileDirective() const; void setEndianness(SerializeIF::Endianness endianness); [[nodiscard]] SerializeIF::Endianness getEndianness() const; @@ -30,8 +30,8 @@ class FileDirectiveReader : public PduHeaderReader { protected: private: - void setFileDirective(cfdp::FileDirectives fileDirective); - cfdp::FileDirectives fileDirective = cfdp::FileDirectives::INVALID_DIRECTIVE; + void setFileDirective(cfdp::FileDirective fileDirective); + cfdp::FileDirective fileDirective = cfdp::FileDirective::INVALID_DIRECTIVE; SerializeIF::Endianness endianness = SerializeIF::Endianness::NETWORK; }; diff --git a/src/fsfw/cfdp/pdu/FinishedInfo.cpp b/src/fsfw/cfdp/pdu/FinishedInfo.cpp index 5b4ae0ca..2f986e85 100644 --- a/src/fsfw/cfdp/pdu/FinishedInfo.cpp +++ b/src/fsfw/cfdp/pdu/FinishedInfo.cpp @@ -2,7 +2,7 @@ FinishedInfo::FinishedInfo() {} -FinishedInfo::FinishedInfo(cfdp::ConditionCodes conditionCode, cfdp::FileDeliveryCode deliveryCode, +FinishedInfo::FinishedInfo(cfdp::ConditionCode conditionCode, cfdp::FileDeliveryCode deliveryCode, cfdp::FileDeliveryStatus fileStatus) : conditionCode(conditionCode), deliveryCode(deliveryCode), fileStatus(fileStatus) {} @@ -76,9 +76,9 @@ ReturnValue_t FinishedInfo::getFaultLocation(EntityIdTlv** faultLocation) { return returnvalue::OK; } -cfdp::ConditionCodes FinishedInfo::getConditionCode() const { return conditionCode; } +cfdp::ConditionCode FinishedInfo::getConditionCode() const { return conditionCode; } -void FinishedInfo::setConditionCode(cfdp::ConditionCodes conditionCode) { +void FinishedInfo::setConditionCode(cfdp::ConditionCode conditionCode) { this->conditionCode = conditionCode; } diff --git a/src/fsfw/cfdp/pdu/FinishedInfo.h b/src/fsfw/cfdp/pdu/FinishedInfo.h index 1a2beade..49d7c64d 100644 --- a/src/fsfw/cfdp/pdu/FinishedInfo.h +++ b/src/fsfw/cfdp/pdu/FinishedInfo.h @@ -8,7 +8,7 @@ class FinishedInfo { public: FinishedInfo(); - FinishedInfo(cfdp::ConditionCodes conditionCode, cfdp::FileDeliveryCode deliveryCode, + FinishedInfo(cfdp::ConditionCode conditionCode, cfdp::FileDeliveryCode deliveryCode, cfdp::FileDeliveryStatus fileStatus); [[nodiscard]] size_t getSerializedSize() const; @@ -25,15 +25,15 @@ class FinishedInfo { [[nodiscard]] size_t getFsResponsesLen() const; void setFilestoreResponsesArrayLen(size_t fsResponsesLen); ReturnValue_t getFaultLocation(EntityIdTlv** entityId); - [[nodiscard]] cfdp::ConditionCodes getConditionCode() const; - void setConditionCode(cfdp::ConditionCodes conditionCode); + [[nodiscard]] cfdp::ConditionCode getConditionCode() const; + void setConditionCode(cfdp::ConditionCode conditionCode); [[nodiscard]] cfdp::FileDeliveryCode getDeliveryCode() const; void setDeliveryCode(cfdp::FileDeliveryCode deliveryCode); [[nodiscard]] cfdp::FileDeliveryStatus getFileStatus() const; void setFileStatus(cfdp::FileDeliveryStatus fileStatus); private: - cfdp::ConditionCodes conditionCode = cfdp::ConditionCodes::NO_CONDITION_FIELD; + cfdp::ConditionCode conditionCode = cfdp::ConditionCode::NO_CONDITION_FIELD; cfdp::FileDeliveryCode deliveryCode = cfdp::FileDeliveryCode::DATA_COMPLETE; cfdp::FileDeliveryStatus fileStatus = cfdp::FileDeliveryStatus::DISCARDED_DELIBERATELY; FilestoreResponseTlv** fsResponses = nullptr; diff --git a/src/fsfw/cfdp/pdu/FinishedPduCreator.cpp b/src/fsfw/cfdp/pdu/FinishedPduCreator.cpp index 88f4491c..8ac22e0a 100644 --- a/src/fsfw/cfdp/pdu/FinishedPduCreator.cpp +++ b/src/fsfw/cfdp/pdu/FinishedPduCreator.cpp @@ -1,7 +1,7 @@ #include "FinishedPduCreator.h" FinishPduCreator::FinishPduCreator(PduConfig &conf, FinishedInfo &finishInfo) - : FileDirectiveCreator(conf, cfdp::FileDirectives::FINISH, 0), finishInfo(finishInfo) { + : FileDirectiveCreator(conf, cfdp::FileDirective::FINISH, 0), finishInfo(finishInfo) { updateDirectiveFieldLen(); } diff --git a/src/fsfw/cfdp/pdu/FinishedPduReader.cpp b/src/fsfw/cfdp/pdu/FinishedPduReader.cpp index a34abf07..08dd3a82 100644 --- a/src/fsfw/cfdp/pdu/FinishedPduReader.cpp +++ b/src/fsfw/cfdp/pdu/FinishedPduReader.cpp @@ -15,7 +15,7 @@ ReturnValue_t FinishPduReader::parseData() { return SerializeIF::STREAM_TOO_SHORT; } uint8_t firstByte = *buf; - auto condCode = static_cast((firstByte >> 4) & 0x0f); + auto condCode = static_cast((firstByte >> 4) & 0x0f); finishedInfo.setConditionCode(condCode); finishedInfo.setDeliveryCode(static_cast(firstByte >> 2 & 0b1)); finishedInfo.setFileStatus(static_cast(firstByte & 0b11)); @@ -31,14 +31,14 @@ ReturnValue_t FinishPduReader::parseData() { FinishedInfo& FinishPduReader::getInfo() { return finishedInfo; } ReturnValue_t FinishPduReader::parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf, - cfdp::ConditionCodes conditionCode) { + cfdp::ConditionCode conditionCode) { ReturnValue_t result = returnvalue::OK; size_t fsResponsesIdx = 0; auto endianness = getEndianness(); FilestoreResponseTlv** fsResponseArray = nullptr; size_t fsResponseMaxArrayLen = 0; EntityIdTlv* faultLocation = nullptr; - cfdp::TlvTypes nextTlv = cfdp::TlvTypes::INVALID_TLV; + cfdp::TlvType nextTlv = cfdp::TlvType::INVALID_TLV; while (remLen > 0) { // Simply forward parse the TLV type. Every TLV type except the last one must be a Filestore // Response TLV, and even the last one can be a Filestore Response TLV if the fault @@ -46,8 +46,8 @@ ReturnValue_t FinishPduReader::parseTlvs(size_t remLen, size_t currentIdx, const if (currentIdx + 2 > maxSize) { return SerializeIF::STREAM_TOO_SHORT; } - nextTlv = static_cast(*buf); - if (nextTlv == cfdp::TlvTypes::FILESTORE_RESPONSE) { + nextTlv = static_cast(*buf); + if (nextTlv == cfdp::TlvType::FILESTORE_RESPONSE) { if (fsResponseArray == nullptr) { if (not finishedInfo.canHoldFsResponses()) { return cfdp::FINISHED_CANT_PARSE_FS_RESPONSES; @@ -63,11 +63,11 @@ ReturnValue_t FinishPduReader::parseTlvs(size_t remLen, size_t currentIdx, const return result; } fsResponsesIdx += 1; - } else if (nextTlv == cfdp::TlvTypes::ENTITY_ID) { + } else if (nextTlv == cfdp::TlvType::ENTITY_ID) { // This needs to be the last TLV and it should not be here if the condition code // is "No Error" or "Unsupported Checksum Type" - if (conditionCode == cfdp::ConditionCodes::NO_ERROR or - conditionCode == cfdp::ConditionCodes::UNSUPPORTED_CHECKSUM_TYPE) { + if (conditionCode == cfdp::ConditionCode::NO_ERROR or + conditionCode == cfdp::ConditionCode::UNSUPPORTED_CHECKSUM_TYPE) { return cfdp::INVALID_TLV_TYPE; } result = finishedInfo.getFaultLocation(&faultLocation); diff --git a/src/fsfw/cfdp/pdu/FinishedPduReader.h b/src/fsfw/cfdp/pdu/FinishedPduReader.h index ce489fcd..791a2ef4 100644 --- a/src/fsfw/cfdp/pdu/FinishedPduReader.h +++ b/src/fsfw/cfdp/pdu/FinishedPduReader.h @@ -16,7 +16,7 @@ class FinishPduReader : public FileDirectiveReader { FinishedInfo& finishedInfo; ReturnValue_t parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf, - cfdp::ConditionCodes conditionCode); + cfdp::ConditionCode conditionCode); }; #endif /* FSFW_CFDP_PDU_FINISHEDPDUDESERIALIZER_H_ */ diff --git a/src/fsfw/cfdp/pdu/HeaderCreator.cpp b/src/fsfw/cfdp/pdu/HeaderCreator.cpp index 3c50c396..29688575 100644 --- a/src/fsfw/cfdp/pdu/HeaderCreator.cpp +++ b/src/fsfw/cfdp/pdu/HeaderCreator.cpp @@ -1,6 +1,6 @@ #include "HeaderCreator.h" -HeaderCreator::HeaderCreator(PduConfig &pduConf, cfdp::PduTypes pduType, size_t initPduDataFieldLen, +HeaderCreator::HeaderCreator(PduConfig &pduConf, cfdp::PduType pduType, size_t initPduDataFieldLen, cfdp::SegmentMetadataFlag segmentMetadataFlag, cfdp::SegmentationControl segCtrl) : pduType(pduType), @@ -65,17 +65,17 @@ void HeaderCreator::setPduDataFieldLen(size_t pduDataFieldLen_) { pduDataFieldLen = pduDataFieldLen_; } -void HeaderCreator::setPduType(cfdp::PduTypes pduType_) { pduType = pduType_; } +void HeaderCreator::setPduType(cfdp::PduType pduType_) { pduType = pduType_; } void HeaderCreator::setSegmentMetadataFlag(cfdp::SegmentMetadataFlag segmentMetadataFlag_) { segmentMetadataFlag = segmentMetadataFlag_; } -cfdp::PduTypes HeaderCreator::getPduType() const { return pduType; } +cfdp::PduType HeaderCreator::getPduType() const { return pduType; } cfdp::Direction HeaderCreator::getDirection() const { return pduConf.direction; } -cfdp::TransmissionModes HeaderCreator::getTransmissionMode() const { return pduConf.mode; } +cfdp::TransmissionMode HeaderCreator::getTransmissionMode() const { return pduConf.mode; } bool HeaderCreator::getCrcFlag() const { return pduConf.crcFlag; } diff --git a/src/fsfw/cfdp/pdu/HeaderCreator.h b/src/fsfw/cfdp/pdu/HeaderCreator.h index a4b5c7ff..173a6239 100644 --- a/src/fsfw/cfdp/pdu/HeaderCreator.h +++ b/src/fsfw/cfdp/pdu/HeaderCreator.h @@ -9,7 +9,7 @@ class HeaderCreator : public SerializeIF, public PduHeaderIF { public: HeaderCreator( - PduConfig& pduConf, cfdp::PduTypes pduType, size_t initPduDataFieldLen, + PduConfig& pduConf, cfdp::PduType pduType, size_t initPduDataFieldLen, cfdp::SegmentMetadataFlag segmentMetadataFlag = cfdp::SegmentMetadataFlag::NOT_PRESENT, cfdp::SegmentationControl segCtrl = cfdp::SegmentationControl::NO_RECORD_BOUNDARIES_PRESERVATION); @@ -29,15 +29,15 @@ class HeaderCreator : public SerializeIF, public PduHeaderIF { Endianness streamEndianness) override; void setPduDataFieldLen(size_t pduDataFieldLen); - void setPduType(cfdp::PduTypes pduType); + void setPduType(cfdp::PduType pduType); void setSegmentMetadataFlag(cfdp::SegmentMetadataFlag); [[nodiscard]] size_t getPduDataFieldLen() const override; [[nodiscard]] size_t getWholePduSize() const override; - [[nodiscard]] cfdp::PduTypes getPduType() const override; + [[nodiscard]] cfdp::PduType getPduType() const override; [[nodiscard]] cfdp::Direction getDirection() const override; - [[nodiscard]] cfdp::TransmissionModes getTransmissionMode() const override; + [[nodiscard]] cfdp::TransmissionMode getTransmissionMode() const override; [[nodiscard]] bool getCrcFlag() const override; [[nodiscard]] bool getLargeFileFlag() const override; [[nodiscard]] cfdp::SegmentationControl getSegmentationControl() const override; @@ -52,7 +52,7 @@ class HeaderCreator : public SerializeIF, public PduHeaderIF { void getTransactionSeqNum(cfdp::TransactionSeqNum& seqNum) const override; private: - cfdp::PduTypes pduType; + cfdp::PduType pduType; cfdp::SegmentMetadataFlag segmentMetadataFlag; cfdp::SegmentationControl segmentationCtrl; size_t pduDataFieldLen; diff --git a/src/fsfw/cfdp/pdu/HeaderReader.cpp b/src/fsfw/cfdp/pdu/HeaderReader.cpp index f8b19ce2..9edf2394 100644 --- a/src/fsfw/cfdp/pdu/HeaderReader.cpp +++ b/src/fsfw/cfdp/pdu/HeaderReader.cpp @@ -57,16 +57,16 @@ size_t PduHeaderReader::getWholePduSize() const { return getPduDataFieldLen() + PduHeaderReader::getHeaderSize(); } -cfdp::PduTypes PduHeaderReader::getPduType() const { - return static_cast((pointers.fixedHeader->firstByte >> 4) & 0x01); +cfdp::PduType PduHeaderReader::getPduType() const { + return static_cast((pointers.fixedHeader->firstByte >> 4) & 0x01); } cfdp::Direction PduHeaderReader::getDirection() const { return static_cast((pointers.fixedHeader->firstByte >> 3) & 0x01); } -cfdp::TransmissionModes PduHeaderReader::getTransmissionMode() const { - return static_cast((pointers.fixedHeader->firstByte >> 2) & 0x01); +cfdp::TransmissionMode PduHeaderReader::getTransmissionMode() const { + return static_cast((pointers.fixedHeader->firstByte >> 2) & 0x01); } bool PduHeaderReader::getCrcFlag() const { return (pointers.fixedHeader->firstByte >> 1) & 0x01; } diff --git a/src/fsfw/cfdp/pdu/KeepAlivePduCreator.cpp b/src/fsfw/cfdp/pdu/KeepAlivePduCreator.cpp index 8b0ad6c8..40747751 100644 --- a/src/fsfw/cfdp/pdu/KeepAlivePduCreator.cpp +++ b/src/fsfw/cfdp/pdu/KeepAlivePduCreator.cpp @@ -1,7 +1,7 @@ #include "KeepAlivePduCreator.h" KeepAlivePduCreator::KeepAlivePduCreator(PduConfig &conf, cfdp::FileSize &progress) - : FileDirectiveCreator(conf, cfdp::FileDirectives::KEEP_ALIVE, 4), progress(progress) { + : FileDirectiveCreator(conf, cfdp::FileDirective::KEEP_ALIVE, 4), progress(progress) { updateDirectiveFieldLen(); } diff --git a/src/fsfw/cfdp/pdu/MetadataInfo.cpp b/src/fsfw/cfdp/pdu/MetadataInfo.cpp index e1eb3ad8..d88bdd87 100644 --- a/src/fsfw/cfdp/pdu/MetadataInfo.cpp +++ b/src/fsfw/cfdp/pdu/MetadataInfo.cpp @@ -1,6 +1,6 @@ #include "MetadataInfo.h" -MetadataInfo::MetadataInfo(bool closureRequested, cfdp::ChecksumTypes checksumType, +MetadataInfo::MetadataInfo(bool closureRequested, cfdp::ChecksumType checksumType, cfdp::FileSize& fileSize, cfdp::StringLv& sourceFileName, cfdp::StringLv& destFileName) : MetadataInfo(fileSize, sourceFileName, destFileName) { @@ -23,9 +23,9 @@ void MetadataInfo::setOptionsArray(cfdp::Tlv** optionsArray_, std::optional optionsLen, std::optional maxOptionsLen); - [[nodiscard]] cfdp::ChecksumTypes getChecksumType() const; - void setChecksumType(cfdp::ChecksumTypes checksumType); + [[nodiscard]] cfdp::ChecksumType getChecksumType() const; + void setChecksumType(cfdp::ChecksumType checksumType); [[nodiscard]] bool isClosureRequested() const; void setClosureRequested(bool closureRequested = false); @@ -42,7 +42,7 @@ class MetadataInfo { private: bool closureRequested = false; - cfdp::ChecksumTypes checksumType = cfdp::ChecksumTypes::NULL_CHECKSUM; + cfdp::ChecksumType checksumType = cfdp::ChecksumType::NULL_CHECKSUM; cfdp::FileSize& fileSize; cfdp::StringLv& sourceFileName; cfdp::StringLv& destFileName; diff --git a/src/fsfw/cfdp/pdu/MetadataPduCreator.cpp b/src/fsfw/cfdp/pdu/MetadataPduCreator.cpp index fe0d04c2..536a48f4 100644 --- a/src/fsfw/cfdp/pdu/MetadataPduCreator.cpp +++ b/src/fsfw/cfdp/pdu/MetadataPduCreator.cpp @@ -1,7 +1,7 @@ #include "MetadataPduCreator.h" MetadataPduCreator::MetadataPduCreator(PduConfig &conf, MetadataInfo &info) - : FileDirectiveCreator(conf, cfdp::FileDirectives::METADATA, 5), info(info) { + : FileDirectiveCreator(conf, cfdp::FileDirective::METADATA, 5), info(info) { updateDirectiveFieldLen(); } diff --git a/src/fsfw/cfdp/pdu/MetadataPduReader.cpp b/src/fsfw/cfdp/pdu/MetadataPduReader.cpp index caf8287b..66025140 100644 --- a/src/fsfw/cfdp/pdu/MetadataPduReader.cpp +++ b/src/fsfw/cfdp/pdu/MetadataPduReader.cpp @@ -15,7 +15,7 @@ ReturnValue_t MetadataPduReader::parseData() { return SerializeIF::STREAM_TOO_SHORT; } info.setClosureRequested((*buf >> 6) & 0x01); - info.setChecksumType(static_cast(*buf & 0x0f)); + info.setChecksumType(static_cast(*buf & 0x0f)); remSize -= 1; buf += 1; auto endianness = getEndianness(); diff --git a/src/fsfw/cfdp/pdu/NakPduCreator.cpp b/src/fsfw/cfdp/pdu/NakPduCreator.cpp index c4493fcb..11f3aba9 100644 --- a/src/fsfw/cfdp/pdu/NakPduCreator.cpp +++ b/src/fsfw/cfdp/pdu/NakPduCreator.cpp @@ -1,7 +1,7 @@ #include "NakPduCreator.h" NakPduCreator::NakPduCreator(PduConfig &pduConf, NakInfo &nakInfo) - : FileDirectiveCreator(pduConf, cfdp::FileDirectives::NAK, 0), nakInfo(nakInfo) { + : FileDirectiveCreator(pduConf, cfdp::FileDirective::NAK, 0), nakInfo(nakInfo) { updateDirectiveFieldLen(); } diff --git a/src/fsfw/cfdp/pdu/PduConfig.cpp b/src/fsfw/cfdp/pdu/PduConfig.cpp index dd04e986..ccb20f51 100644 --- a/src/fsfw/cfdp/pdu/PduConfig.cpp +++ b/src/fsfw/cfdp/pdu/PduConfig.cpp @@ -2,7 +2,7 @@ #include -PduConfig::PduConfig(cfdp::EntityId sourceId, cfdp::EntityId destId, cfdp::TransmissionModes mode, +PduConfig::PduConfig(cfdp::EntityId sourceId, cfdp::EntityId destId, cfdp::TransmissionMode mode, cfdp::TransactionSeqNum seqNum, bool crcFlag, bool largeFile, cfdp::Direction direction) : mode(mode), diff --git a/src/fsfw/cfdp/pdu/PduConfig.h b/src/fsfw/cfdp/pdu/PduConfig.h index 368999cc..70f37e38 100644 --- a/src/fsfw/cfdp/pdu/PduConfig.h +++ b/src/fsfw/cfdp/pdu/PduConfig.h @@ -7,11 +7,11 @@ class PduConfig { public: PduConfig() = default; - PduConfig(cfdp::EntityId sourceId, cfdp::EntityId destId, cfdp::TransmissionModes mode, + PduConfig(cfdp::EntityId sourceId, cfdp::EntityId destId, cfdp::TransmissionMode mode, cfdp::TransactionSeqNum seqNum, bool crcFlag = false, bool largeFile = false, cfdp::Direction direction = cfdp::Direction::TOWARDS_RECEIVER); - cfdp::TransmissionModes mode = cfdp::TransmissionModes::ACKNOWLEDGED; + cfdp::TransmissionMode mode = cfdp::TransmissionMode::ACKNOWLEDGED; cfdp::TransactionSeqNum seqNum; cfdp::EntityId sourceId; cfdp::EntityId destId; diff --git a/src/fsfw/cfdp/pdu/PduHeaderIF.h b/src/fsfw/cfdp/pdu/PduHeaderIF.h index d9e4017d..341b0335 100644 --- a/src/fsfw/cfdp/pdu/PduHeaderIF.h +++ b/src/fsfw/cfdp/pdu/PduHeaderIF.h @@ -17,9 +17,9 @@ class PduHeaderIF { [[nodiscard]] virtual size_t getWholePduSize() const = 0; [[nodiscard]] virtual size_t getPduDataFieldLen() const = 0; - [[nodiscard]] virtual cfdp::PduTypes getPduType() const = 0; + [[nodiscard]] virtual cfdp::PduType getPduType() const = 0; [[nodiscard]] virtual cfdp::Direction getDirection() const = 0; - [[nodiscard]] virtual cfdp::TransmissionModes getTransmissionMode() const = 0; + [[nodiscard]] virtual cfdp::TransmissionMode getTransmissionMode() const = 0; [[nodiscard]] virtual bool getCrcFlag() const = 0; [[nodiscard]] virtual bool getLargeFileFlag() const = 0; [[nodiscard]] virtual cfdp::SegmentationControl getSegmentationControl() const = 0; diff --git a/src/fsfw/cfdp/pdu/PduHeaderReader.h b/src/fsfw/cfdp/pdu/PduHeaderReader.h index a36b2145..a2e122cd 100644 --- a/src/fsfw/cfdp/pdu/PduHeaderReader.h +++ b/src/fsfw/cfdp/pdu/PduHeaderReader.h @@ -56,9 +56,9 @@ class PduHeaderReader : public RedirectableDataPointerIF, public PduHeaderIF { [[nodiscard]] size_t getPduDataFieldLen() const override; [[nodiscard]] size_t getWholePduSize() const override; - [[nodiscard]] cfdp::PduTypes getPduType() const override; + [[nodiscard]] cfdp::PduType getPduType() const override; [[nodiscard]] cfdp::Direction getDirection() const override; - [[nodiscard]] cfdp::TransmissionModes getTransmissionMode() const override; + [[nodiscard]] cfdp::TransmissionMode getTransmissionMode() const override; [[nodiscard]] bool getCrcFlag() const override; [[nodiscard]] bool getLargeFileFlag() const override; [[nodiscard]] cfdp::SegmentationControl getSegmentationControl() const override; diff --git a/src/fsfw/cfdp/pdu/PromptPduCreator.cpp b/src/fsfw/cfdp/pdu/PromptPduCreator.cpp index 43077cf6..f4141fdb 100644 --- a/src/fsfw/cfdp/pdu/PromptPduCreator.cpp +++ b/src/fsfw/cfdp/pdu/PromptPduCreator.cpp @@ -1,7 +1,7 @@ #include "PromptPduCreator.h" PromptPduCreator::PromptPduCreator(PduConfig &conf, cfdp::PromptResponseRequired responseRequired) - : FileDirectiveCreator(conf, cfdp::FileDirectives::PROMPT, 1), + : FileDirectiveCreator(conf, cfdp::FileDirective::PROMPT, 1), responseRequired(responseRequired) {} size_t PromptPduCreator::getSerializedSize() const { diff --git a/src/fsfw/cfdp/tlv/EntityIdTlv.cpp b/src/fsfw/cfdp/tlv/EntityIdTlv.cpp index 87f55db8..d4c4d6a8 100644 --- a/src/fsfw/cfdp/tlv/EntityIdTlv.cpp +++ b/src/fsfw/cfdp/tlv/EntityIdTlv.cpp @@ -11,7 +11,7 @@ ReturnValue_t EntityIdTlv::serialize(uint8_t **buffer, size_t *size, size_t maxS if (maxSize < this->getSerializedSize()) { return BUFFER_TOO_SHORT; } - **buffer = cfdp::TlvTypes::ENTITY_ID; + **buffer = cfdp::TlvType::ENTITY_ID; *size += 1; *buffer += 1; size_t serLen = entityId.getSerializedSize(); @@ -28,8 +28,8 @@ ReturnValue_t EntityIdTlv::deSerialize(const uint8_t **buffer, size_t *size, if (*size < 3) { return STREAM_TOO_SHORT; } - cfdp::TlvTypes type = static_cast(**buffer); - if (type != cfdp::TlvTypes::ENTITY_ID) { + cfdp::TlvType type = static_cast(**buffer); + if (type != cfdp::TlvType::ENTITY_ID) { return cfdp::INVALID_TLV_TYPE; } *buffer += 1; @@ -54,6 +54,6 @@ ReturnValue_t EntityIdTlv::deSerialize(cfdp::Tlv &tlv, Endianness endianness) { uint8_t EntityIdTlv::getLengthField() const { return 1 + entityId.getSerializedSize(); } -cfdp::TlvTypes EntityIdTlv::getType() const { return cfdp::TlvTypes::ENTITY_ID; } +cfdp::TlvType EntityIdTlv::getType() const { return cfdp::TlvType::ENTITY_ID; } cfdp::EntityId &EntityIdTlv::getEntityId() { return entityId; } diff --git a/src/fsfw/cfdp/tlv/EntityIdTlv.h b/src/fsfw/cfdp/tlv/EntityIdTlv.h index 1443cc17..ac310899 100644 --- a/src/fsfw/cfdp/tlv/EntityIdTlv.h +++ b/src/fsfw/cfdp/tlv/EntityIdTlv.h @@ -27,7 +27,7 @@ class EntityIdTlv : public TlvIF { Endianness streamEndianness) override; uint8_t getLengthField() const override; - cfdp::TlvTypes getType() const override; + cfdp::TlvType getType() const override; cfdp::EntityId& getEntityId(); diff --git a/src/fsfw/cfdp/tlv/FaultHandlerOverrideTlv.cpp b/src/fsfw/cfdp/tlv/FaultHandlerOverrideTlv.cpp index 684d47c2..90b71361 100644 --- a/src/fsfw/cfdp/tlv/FaultHandlerOverrideTlv.cpp +++ b/src/fsfw/cfdp/tlv/FaultHandlerOverrideTlv.cpp @@ -1,7 +1,7 @@ #include "FaultHandlerOverrideTlv.h" -FaultHandlerOverrideTlv::FaultHandlerOverrideTlv(cfdp::ConditionCodes conditionCode, - cfdp::FaultHandlerCodes handlerCode) +FaultHandlerOverrideTlv::FaultHandlerOverrideTlv(cfdp::ConditionCode conditionCode, + cfdp::FaultHandlerCode handlerCode) : conditionCode(conditionCode), handlerCode(handlerCode) {} FaultHandlerOverrideTlv::FaultHandlerOverrideTlv() = default; @@ -32,8 +32,8 @@ ReturnValue_t FaultHandlerOverrideTlv::deSerialize(const uint8_t **buffer, size_ if (*size < 3) { return SerializeIF::STREAM_TOO_SHORT; } - auto detectedType = static_cast(**buffer); - if (detectedType != cfdp::TlvTypes::FAULT_HANDLER) { + auto detectedType = static_cast(**buffer); + if (detectedType != cfdp::TlvType::FAULT_HANDLER) { return cfdp::INVALID_TLV_TYPE; } *buffer += 1; @@ -44,11 +44,11 @@ ReturnValue_t FaultHandlerOverrideTlv::deSerialize(const uint8_t **buffer, size_ } *buffer += 1; *size += 1; - this->conditionCode = static_cast((**buffer >> 4) & 0x0f); - this->handlerCode = static_cast(**buffer & 0x0f); + this->conditionCode = static_cast((**buffer >> 4) & 0x0f); + this->handlerCode = static_cast(**buffer & 0x0f); *buffer += 1; *size += 1; return returnvalue::OK; } -cfdp::TlvTypes FaultHandlerOverrideTlv::getType() const { return cfdp::TlvTypes::FAULT_HANDLER; } +cfdp::TlvType FaultHandlerOverrideTlv::getType() const { return cfdp::TlvType::FAULT_HANDLER; } diff --git a/src/fsfw/cfdp/tlv/FaultHandlerOverrideTlv.h b/src/fsfw/cfdp/tlv/FaultHandlerOverrideTlv.h index 33a7fdab..9f5cd486 100644 --- a/src/fsfw/cfdp/tlv/FaultHandlerOverrideTlv.h +++ b/src/fsfw/cfdp/tlv/FaultHandlerOverrideTlv.h @@ -6,7 +6,7 @@ class FaultHandlerOverrideTlv : public TlvIF { public: FaultHandlerOverrideTlv(); - FaultHandlerOverrideTlv(cfdp::ConditionCodes conditionCode, cfdp::FaultHandlerCodes handlerCode); + FaultHandlerOverrideTlv(cfdp::ConditionCode conditionCode, cfdp::FaultHandlerCode handlerCode); ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, Endianness streamEndianness) const override; @@ -16,11 +16,11 @@ class FaultHandlerOverrideTlv : public TlvIF { ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size, Endianness streamEndianness) override; [[nodiscard]] uint8_t getLengthField() const override; - [[nodiscard]] cfdp::TlvTypes getType() const override; + [[nodiscard]] cfdp::TlvType getType() const override; private: - cfdp::ConditionCodes conditionCode = cfdp::ConditionCodes::NO_CONDITION_FIELD; - cfdp::FaultHandlerCodes handlerCode = cfdp::FaultHandlerCodes::RESERVED; + cfdp::ConditionCode conditionCode = cfdp::ConditionCode::NO_CONDITION_FIELD; + cfdp::FaultHandlerCode handlerCode = cfdp::FaultHandlerCode::RESERVED; }; #endif /* FSFW_SRC_FSFW_CFDP_TLV_FAULTHANDLEROVERRIDETLV_H_ */ diff --git a/src/fsfw/cfdp/tlv/FilestoreRequestTlv.cpp b/src/fsfw/cfdp/tlv/FilestoreRequestTlv.cpp index 744d79c1..1022a7d1 100644 --- a/src/fsfw/cfdp/tlv/FilestoreRequestTlv.cpp +++ b/src/fsfw/cfdp/tlv/FilestoreRequestTlv.cpp @@ -76,4 +76,4 @@ ReturnValue_t FilestoreRequestTlv::deSerializeFromValue(const uint8_t **buffer, return result; } -cfdp::TlvTypes FilestoreRequestTlv::getType() const { return cfdp::TlvTypes::FILESTORE_REQUEST; } +cfdp::TlvType FilestoreRequestTlv::getType() const { return cfdp::TlvType::FILESTORE_REQUEST; } diff --git a/src/fsfw/cfdp/tlv/FilestoreRequestTlv.h b/src/fsfw/cfdp/tlv/FilestoreRequestTlv.h index 94faaa07..02e639b8 100644 --- a/src/fsfw/cfdp/tlv/FilestoreRequestTlv.h +++ b/src/fsfw/cfdp/tlv/FilestoreRequestTlv.h @@ -30,7 +30,7 @@ class FilestoreRequestTlv : public cfdp::FilestoreTlvBase { Endianness streamEndianness) override; [[nodiscard]] uint8_t getLengthField() const override; - [[nodiscard]] cfdp::TlvTypes getType() const override; + [[nodiscard]] cfdp::TlvType getType() const override; private: cfdp::Lv *secondFileName = nullptr; diff --git a/src/fsfw/cfdp/tlv/FilestoreResponseTlv.cpp b/src/fsfw/cfdp/tlv/FilestoreResponseTlv.cpp index 51dccfb7..38b56077 100644 --- a/src/fsfw/cfdp/tlv/FilestoreResponseTlv.cpp +++ b/src/fsfw/cfdp/tlv/FilestoreResponseTlv.cpp @@ -112,4 +112,4 @@ ReturnValue_t FilestoreResponseTlv::deSerialize(const cfdp::Tlv &tlv, Endianness uint8_t FilestoreResponseTlv::getStatusCode() const { return statusCode; } -cfdp::TlvTypes FilestoreResponseTlv::getType() const { return cfdp::TlvTypes::FILESTORE_RESPONSE; } +cfdp::TlvType FilestoreResponseTlv::getType() const { return cfdp::TlvType::FILESTORE_RESPONSE; } diff --git a/src/fsfw/cfdp/tlv/FilestoreResponseTlv.h b/src/fsfw/cfdp/tlv/FilestoreResponseTlv.h index 47868693..110f1bb4 100644 --- a/src/fsfw/cfdp/tlv/FilestoreResponseTlv.h +++ b/src/fsfw/cfdp/tlv/FilestoreResponseTlv.h @@ -33,7 +33,7 @@ class FilestoreResponseTlv : public cfdp::FilestoreTlvBase { Endianness streamEndianness) override; [[nodiscard]] uint8_t getLengthField() const override; - [[nodiscard]] cfdp::TlvTypes getType() const override; + [[nodiscard]] cfdp::TlvType getType() const override; private: uint8_t statusCode; diff --git a/src/fsfw/cfdp/tlv/FilestoreTlvBase.h b/src/fsfw/cfdp/tlv/FilestoreTlvBase.h index 4aa47c7e..a5974087 100644 --- a/src/fsfw/cfdp/tlv/FilestoreTlvBase.h +++ b/src/fsfw/cfdp/tlv/FilestoreTlvBase.h @@ -102,7 +102,7 @@ class FilestoreTlvBase : public TlvIF { if (*size < 3) { return SerializeIF::STREAM_TOO_SHORT; } - auto type = static_cast(**buffer); + auto type = static_cast(**buffer); if (type != getType()) { return cfdp::INVALID_TLV_TYPE; } diff --git a/src/fsfw/cfdp/tlv/FlowLabelTlv.cpp b/src/fsfw/cfdp/tlv/FlowLabelTlv.cpp index 938af9f4..5f225669 100644 --- a/src/fsfw/cfdp/tlv/FlowLabelTlv.cpp +++ b/src/fsfw/cfdp/tlv/FlowLabelTlv.cpp @@ -1,4 +1,4 @@ #include "FlowLabelTlv.h" FlowLabelTlv::FlowLabelTlv(uint8_t* value, size_t size) - : Tlv(cfdp::TlvTypes::FLOW_LABEL, value, size) {} + : Tlv(cfdp::TlvType::FLOW_LABEL, value, size) {} diff --git a/src/fsfw/cfdp/tlv/MessageToUserTlv.cpp b/src/fsfw/cfdp/tlv/MessageToUserTlv.cpp index c6bf3633..9a3e55ff 100644 --- a/src/fsfw/cfdp/tlv/MessageToUserTlv.cpp +++ b/src/fsfw/cfdp/tlv/MessageToUserTlv.cpp @@ -1,9 +1,9 @@ #include "MessageToUserTlv.h" MessageToUserTlv::MessageToUserTlv(uint8_t* value, size_t size) - : Tlv(cfdp::TlvTypes::MSG_TO_USER, value, size) {} + : Tlv(cfdp::TlvType::MSG_TO_USER, value, size) {} MessageToUserTlv::MessageToUserTlv() : Tlv() {} MessageToUserTlv::MessageToUserTlv(const std::vector& data) - : Tlv(cfdp::TlvTypes::MSG_TO_USER, data.data(), data.size()) {} + : Tlv(cfdp::TlvType::MSG_TO_USER, data.data(), data.size()) {} diff --git a/src/fsfw/cfdp/tlv/Tlv.cpp b/src/fsfw/cfdp/tlv/Tlv.cpp index 9d5f7f15..c3fce612 100644 --- a/src/fsfw/cfdp/tlv/Tlv.cpp +++ b/src/fsfw/cfdp/tlv/Tlv.cpp @@ -1,6 +1,6 @@ #include "Tlv.h" -cfdp::Tlv::Tlv(TlvTypes type, const uint8_t *value, size_t size) +cfdp::Tlv::Tlv(TlvType type, const uint8_t *value, size_t size) : type(type), value(value, size, true) { if (size > 0) { zeroLen = false; @@ -17,7 +17,7 @@ ReturnValue_t cfdp::Tlv::serialize(uint8_t **buffer, size_t *size, size_t maxSiz if (*size + 2 > maxSize) { return BUFFER_TOO_SHORT; } - if (type == TlvTypes::INVALID_TLV) { + if (type == TlvType::INVALID_TLV) { return INVALID_TLV_TYPE; } **buffer = type; @@ -59,7 +59,7 @@ ReturnValue_t cfdp::Tlv::deSerialize(const uint8_t **buffer, size_t *size, return INVALID_TLV_TYPE; } - type = static_cast(rawType); + type = static_cast(rawType); *buffer += 1; *size -= 1; @@ -83,7 +83,7 @@ ReturnValue_t cfdp::Tlv::deSerialize(const uint8_t **buffer, size_t *size, const uint8_t *cfdp::Tlv::getValue() const { return value.getConstBuffer(); } -cfdp::TlvTypes cfdp::Tlv::getType() const { return type; } +cfdp::TlvType cfdp::Tlv::getType() const { return type; } bool cfdp::Tlv::checkType(uint8_t rawType) { if (rawType != 0x03 and rawType <= 6) { @@ -101,4 +101,4 @@ void cfdp::Tlv::setValue(uint8_t *value, size_t len) { uint8_t cfdp::Tlv::getLengthField() const { return this->value.getSerializedSize() - 1; } -void cfdp::Tlv::setType(TlvTypes type) { this->type = type; } +void cfdp::Tlv::setType(TlvType type) { this->type = type; } diff --git a/src/fsfw/cfdp/tlv/Tlv.h b/src/fsfw/cfdp/tlv/Tlv.h index ef39f88b..786a3b79 100644 --- a/src/fsfw/cfdp/tlv/Tlv.h +++ b/src/fsfw/cfdp/tlv/Tlv.h @@ -13,7 +13,7 @@ namespace cfdp { */ class Tlv : public TlvIF { public: - Tlv(TlvTypes type, const uint8_t *value, size_t size); + Tlv(TlvType type, const uint8_t *value, size_t size); Tlv(); /** @@ -47,15 +47,15 @@ class Tlv : public TlvIF { void setValue(uint8_t *value, size_t len); [[nodiscard]] const uint8_t *getValue() const; - void setType(TlvTypes type); - [[nodiscard]] TlvTypes getType() const override; + void setType(TlvType type); + [[nodiscard]] TlvType getType() const override; [[nodiscard]] uint8_t getLengthField() const override; private: bool checkType(uint8_t rawType); bool zeroLen = true; - TlvTypes type = TlvTypes::INVALID_TLV; + TlvType type = TlvType::INVALID_TLV; SerialBufferAdapter value; }; diff --git a/src/fsfw/cfdp/tlv/TlvIF.h b/src/fsfw/cfdp/tlv/TlvIF.h index 9a02b241..317d970a 100644 --- a/src/fsfw/cfdp/tlv/TlvIF.h +++ b/src/fsfw/cfdp/tlv/TlvIF.h @@ -8,7 +8,7 @@ class TlvIF : public SerializeIF { virtual ~TlvIF(){}; virtual uint8_t getLengthField() const = 0; - virtual cfdp::TlvTypes getType() const = 0; + virtual cfdp::TlvType getType() const = 0; }; #endif /* FSFW_SRC_FSFW_CFDP_TLVIF_H_ */ diff --git a/unittests/cfdp/handler/testDistributor.cpp b/unittests/cfdp/handler/testDistributor.cpp index f33e1115..8b6c46af 100644 --- a/unittests/cfdp/handler/testDistributor.cpp +++ b/unittests/cfdp/handler/testDistributor.cpp @@ -25,12 +25,12 @@ TEST_CASE("CFDP Distributor", "[cfdp][distributor]") { const cfdp::EntityId& sourceId(groundEntityId); const cfdp::EntityId& destId(obswEntityId); cfdp::TransactionSeqNum seqNum(UnsignedByteField(12)); - auto pduConf = PduConfig(sourceId, destId, cfdp::TransmissionModes::UNACKNOWLEDGED, seqNum); + auto pduConf = PduConfig(sourceId, destId, cfdp::TransmissionMode::UNACKNOWLEDGED, seqNum); std::string sourceFileString = "hello.txt"; cfdp::StringLv sourceFileName(sourceFileString); std::string destFileString = "hello2.txt"; cfdp::StringLv destFileName(destFileString); - MetadataInfo metadataInfo(false, cfdp::ChecksumTypes::CRC_32, fileSize, sourceFileName, + MetadataInfo metadataInfo(false, cfdp::ChecksumType::CRC_32, fileSize, sourceFileName, destFileName); MetadataPduCreator creator(pduConf, metadataInfo); uint8_t* dataPtr = nullptr; diff --git a/unittests/cfdp/handler/testFaultHandler.cpp b/unittests/cfdp/handler/testFaultHandler.cpp index 559744d7..5da9a70d 100644 --- a/unittests/cfdp/handler/testFaultHandler.cpp +++ b/unittests/cfdp/handler/testFaultHandler.cpp @@ -5,80 +5,81 @@ TEST_CASE("CFDP Fault Handler", "[cfdp]") { using namespace cfdp; auto fhMock = FaultHandlerMock(); - cfdp::FaultHandlerCodes fhCode; + cfdp::FaultHandlerCode fhCode; + cfdp::TransactionId id; SECTION("State") { // Verify initial condition CHECK(fhMock.getFaultHandler(ConditionCode::UNSUPPORTED_CHECKSUM_TYPE, fhCode)); - CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR); + CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR); CHECK(fhMock.getFaultHandler(ConditionCode::POSITIVE_ACK_LIMIT_REACHED, fhCode)); - CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR); + CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR); CHECK(fhMock.getFaultHandler(ConditionCode::KEEP_ALIVE_LIMIT_REACHED, fhCode)); - CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR); + CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR); CHECK(fhMock.getFaultHandler(ConditionCode::INVALID_TRANSMISSION_MODE, fhCode)); - CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR); + CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR); CHECK(fhMock.getFaultHandler(ConditionCode::FILESTORE_REJECTION, fhCode)); - CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR); + CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR); CHECK(fhMock.getFaultHandler(ConditionCode::FILE_CHECKSUM_FAILURE, fhCode)); - CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR); + CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR); CHECK(fhMock.getFaultHandler(ConditionCode::FILE_SIZE_ERROR, fhCode)); - CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR); + CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR); CHECK(fhMock.getFaultHandler(ConditionCode::NAK_LIMIT_REACHED, fhCode)); - CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR); + CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR); CHECK(fhMock.getFaultHandler(ConditionCode::INACTIVITY_DETECTED, fhCode)); - CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR); + CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR); CHECK(fhMock.getFaultHandler(ConditionCode::CHECK_LIMIT_REACHED, fhCode)); - CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR); + CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR); } SECTION("Call Handler, Ignore Fault") { - auto& info = fhMock.getFhInfo(FaultHandlerCodes::IGNORE_ERROR); - CHECK(fhMock.reportFault(ConditionCode::CHECK_LIMIT_REACHED)); + auto& info = fhMock.getFhInfo(FaultHandlerCode::IGNORE_ERROR); + CHECK(fhMock.reportFault(id, ConditionCode::CHECK_LIMIT_REACHED)); CHECK(info.callCount == 1); CHECK(info.condCodes.back() == ConditionCode::CHECK_LIMIT_REACHED); - fhMock.reportFault(ConditionCode::FILE_CHECKSUM_FAILURE); + fhMock.reportFault(id, ConditionCode::FILE_CHECKSUM_FAILURE); CHECK(info.callCount == 2); CHECK(info.condCodes.back() == ConditionCode::FILE_CHECKSUM_FAILURE); } - SECTION("Invalid Reported Code") { CHECK(not fhMock.reportFault(ConditionCode::NO_ERROR)); } + SECTION("Invalid Reported Code") { CHECK(not fhMock.reportFault(id, ConditionCode::NO_ERROR)); } SECTION("Invalid FH code") { CHECK(not fhMock.setFaultHandler(ConditionCode::KEEP_ALIVE_LIMIT_REACHED, - FaultHandlerCodes::RESERVED)); + FaultHandlerCode::RESERVED)); CHECK(fhMock.getFaultHandler(ConditionCode::KEEP_ALIVE_LIMIT_REACHED, fhCode)); - CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR); - CHECK(not fhMock.setFaultHandler(ConditionCode::NO_ERROR, FaultHandlerCodes::IGNORE_ERROR)); + CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR); + CHECK(not fhMock.setFaultHandler(ConditionCode::NO_ERROR, FaultHandlerCode::IGNORE_ERROR)); CHECK(not fhMock.getFaultHandler(ConditionCode::NO_ERROR, fhCode)); } SECTION("Set Other Fault Handler") { CHECK(fhMock.setFaultHandler(ConditionCode::FILE_CHECKSUM_FAILURE, - FaultHandlerCodes::NOTICE_OF_CANCELLATION)); + FaultHandlerCode::NOTICE_OF_CANCELLATION)); CHECK(fhMock.setFaultHandler(ConditionCode::INACTIVITY_DETECTED, - FaultHandlerCodes::ABANDON_TRANSACTION)); + FaultHandlerCode::ABANDON_TRANSACTION)); CHECK(fhMock.setFaultHandler(ConditionCode::KEEP_ALIVE_LIMIT_REACHED, - FaultHandlerCodes::NOTICE_OF_SUSPENSION)); - auto& ignoreInfo = fhMock.getFhInfo(FaultHandlerCodes::IGNORE_ERROR); - auto& cancellationInfo = fhMock.getFhInfo(FaultHandlerCodes::NOTICE_OF_CANCELLATION); - auto& suspensionInfo = fhMock.getFhInfo(FaultHandlerCodes::NOTICE_OF_SUSPENSION); - auto& abandonInfo = fhMock.getFhInfo(FaultHandlerCodes::ABANDON_TRANSACTION); + FaultHandlerCode::NOTICE_OF_SUSPENSION)); + auto& ignoreInfo = fhMock.getFhInfo(FaultHandlerCode::IGNORE_ERROR); + auto& cancellationInfo = fhMock.getFhInfo(FaultHandlerCode::NOTICE_OF_CANCELLATION); + auto& suspensionInfo = fhMock.getFhInfo(FaultHandlerCode::NOTICE_OF_SUSPENSION); + auto& abandonInfo = fhMock.getFhInfo(FaultHandlerCode::ABANDON_TRANSACTION); - CHECK(fhMock.reportFault(ConditionCode::FILE_CHECKSUM_FAILURE)); + CHECK(fhMock.reportFault(id, ConditionCode::FILE_CHECKSUM_FAILURE)); CHECK(cancellationInfo.callCount == 1); CHECK(cancellationInfo.condCodes.back() == ConditionCode::FILE_CHECKSUM_FAILURE); CHECK(ignoreInfo.callCount == 0); CHECK(suspensionInfo.callCount == 0); CHECK(abandonInfo.callCount == 0); - CHECK(fhMock.reportFault(ConditionCode::INACTIVITY_DETECTED)); + CHECK(fhMock.reportFault(id, ConditionCode::INACTIVITY_DETECTED)); CHECK(cancellationInfo.callCount == 1); CHECK(ignoreInfo.callCount == 0); CHECK(suspensionInfo.callCount == 0); CHECK(abandonInfo.callCount == 1); CHECK(abandonInfo.condCodes.back() == ConditionCode::INACTIVITY_DETECTED); - CHECK(fhMock.reportFault(ConditionCode::KEEP_ALIVE_LIMIT_REACHED)); + CHECK(fhMock.reportFault(id, ConditionCode::KEEP_ALIVE_LIMIT_REACHED)); CHECK(cancellationInfo.callCount == 1); CHECK(ignoreInfo.callCount == 0); CHECK(suspensionInfo.callCount == 1); diff --git a/unittests/cfdp/pdu/testAckPdu.cpp b/unittests/cfdp/pdu/testAckPdu.cpp index 44b66bd5..10b264ec 100644 --- a/unittests/cfdp/pdu/testAckPdu.cpp +++ b/unittests/cfdp/pdu/testAckPdu.cpp @@ -15,19 +15,19 @@ TEST_CASE("ACK PDU", "[cfdp][pdu]") { auto seqNum = TransactionSeqNum(WidthInBytes::TWO_BYTES, 15); auto sourceId = EntityId(WidthInBytes::TWO_BYTES, 1); auto destId = EntityId(WidthInBytes::TWO_BYTES, 2); - auto pduConf = PduConfig(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum); - AckInfo ackInfo(FileDirectives::EOF_DIRECTIVE, ConditionCode::NO_ERROR, + auto pduConf = PduConfig(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum); + AckInfo ackInfo(FileDirective::EOF_DIRECTIVE, ConditionCode::NO_ERROR, AckTransactionStatus::ACTIVE); auto ackSerializer = AckPduCreator(ackInfo, pduConf); result = ackSerializer.serialize(&bufptr, &sz, maxsz, SerializeIF::Endianness::NETWORK); REQUIRE(result == returnvalue::OK); SECTION("Serialize") { - REQUIRE(buf[sz - 3] == cfdp::FileDirectives::ACK); - REQUIRE((buf[sz - 2] >> 4) == FileDirectives::EOF_DIRECTIVE); + REQUIRE(buf[sz - 3] == cfdp::FileDirective::ACK); + REQUIRE((buf[sz - 2] >> 4) == FileDirective::EOF_DIRECTIVE); REQUIRE((buf[sz - 2] & 0x0f) == 0); REQUIRE(buf[sz - 1] == AckTransactionStatus::ACTIVE); - ackInfo.setAckedDirective(FileDirectives::FINISH); + ackInfo.setAckedDirective(FileDirective::FINISH); ackInfo.setAckedConditionCode(ConditionCode::FILESTORE_REJECTION); ackInfo.setTransactionStatus(AckTransactionStatus::TERMINATED); auto ackSerializer2 = AckPduCreator(ackInfo, pduConf); @@ -35,21 +35,21 @@ TEST_CASE("ACK PDU", "[cfdp][pdu]") { sz = 0; result = ackSerializer2.serialize(&bufptr, &sz, maxsz, SerializeIF::Endianness::NETWORK); REQUIRE(result == returnvalue::OK); - REQUIRE(buf[sz - 3] == cfdp::FileDirectives::ACK); - REQUIRE((buf[sz - 2] >> 4) == FileDirectives::FINISH); + REQUIRE(buf[sz - 3] == cfdp::FileDirective::ACK); + REQUIRE((buf[sz - 2] >> 4) == FileDirective::FINISH); REQUIRE((buf[sz - 2] & 0x0f) == 0b0001); REQUIRE((buf[sz - 1] >> 4) == ConditionCode::FILESTORE_REJECTION); REQUIRE((buf[sz - 1] & 0b11) == AckTransactionStatus::TERMINATED); bufptr = buf.data(); sz = 0; - ackInfo.setAckedDirective(FileDirectives::KEEP_ALIVE); + ackInfo.setAckedDirective(FileDirective::KEEP_ALIVE); auto ackSerializer3 = AckPduCreator(ackInfo, pduConf); result = ackSerializer3.serialize(&bufptr, &sz, maxsz, SerializeIF::Endianness::NETWORK); // Invalid file directive REQUIRE(result != returnvalue::OK); - ackInfo.setAckedDirective(FileDirectives::FINISH); + ackInfo.setAckedDirective(FileDirective::FINISH); // buffer too small result = ackSerializer.serialize(&bufptr, &sz, 8, SerializeIF::Endianness::NETWORK); REQUIRE(result == SerializeIF::BUFFER_TOO_SHORT); @@ -60,12 +60,12 @@ TEST_CASE("ACK PDU", "[cfdp][pdu]") { auto reader = AckPduReader(buf.data(), sz, ackInfo2); result = reader.parseData(); REQUIRE(result == returnvalue::OK); - REQUIRE(ackInfo2.getAckedDirective() == FileDirectives::EOF_DIRECTIVE); + REQUIRE(ackInfo2.getAckedDirective() == FileDirective::EOF_DIRECTIVE); REQUIRE(ackInfo2.getAckedConditionCode() == ConditionCode::NO_ERROR); REQUIRE(ackInfo2.getDirectiveSubtypeCode() == 0); REQUIRE(ackInfo2.getTransactionStatus() == AckTransactionStatus::ACTIVE); - AckInfo newInfo = AckInfo(FileDirectives::FINISH, ConditionCode::FILESTORE_REJECTION, + AckInfo newInfo = AckInfo(FileDirective::FINISH, ConditionCode::FILESTORE_REJECTION, AckTransactionStatus::TERMINATED); auto ackSerializer2 = AckPduCreator(newInfo, pduConf); bufptr = buf.data(); @@ -76,23 +76,23 @@ TEST_CASE("ACK PDU", "[cfdp][pdu]") { auto reader2 = AckPduReader(buf.data(), sz, ackInfo2); result = reader2.parseData(); REQUIRE(result == returnvalue::OK); - REQUIRE(ackInfo2.getAckedDirective() == FileDirectives::FINISH); + REQUIRE(ackInfo2.getAckedDirective() == FileDirective::FINISH); REQUIRE(ackInfo2.getAckedConditionCode() == ConditionCode::FILESTORE_REJECTION); REQUIRE(ackInfo2.getDirectiveSubtypeCode() == 0b0001); REQUIRE(ackInfo2.getTransactionStatus() == AckTransactionStatus::TERMINATED); uint8_t prevVal = buf[sz - 2]; - buf[sz - 2] = FileDirectives::INVALID_DIRECTIVE << 4; + buf[sz - 2] = FileDirective::INVALID_DIRECTIVE << 4; result = reader2.parseData(); REQUIRE(result == cfdp::INVALID_ACK_DIRECTIVE_FIELDS); - buf[sz - 2] = FileDirectives::FINISH << 4 | 0b1111; + buf[sz - 2] = FileDirective::FINISH << 4 | 0b1111; result = reader2.parseData(); REQUIRE(result == cfdp::INVALID_ACK_DIRECTIVE_FIELDS); buf[sz - 2] = prevVal; - buf[sz - 3] = cfdp::FileDirectives::INVALID_DIRECTIVE; + buf[sz - 3] = cfdp::FileDirective::INVALID_DIRECTIVE; result = reader2.parseData(); REQUIRE(result == cfdp::INVALID_DIRECTIVE_FIELD); - buf[sz - 3] = cfdp::FileDirectives::ACK; + buf[sz - 3] = cfdp::FileDirective::ACK; auto maxSizeTooSmall = AckPduReader(buf.data(), sz - 2, ackInfo2); result = maxSizeTooSmall.parseData(); REQUIRE(result == SerializeIF::STREAM_TOO_SHORT); diff --git a/unittests/cfdp/pdu/testCfdpHeader.cpp b/unittests/cfdp/pdu/testCfdpHeader.cpp index b51450ec..5f81bec9 100644 --- a/unittests/cfdp/pdu/testCfdpHeader.cpp +++ b/unittests/cfdp/pdu/testCfdpHeader.cpp @@ -17,11 +17,11 @@ TEST_CASE("CFDP Header", "[cfdp]") { cfdp::EntityId sourceId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 0); cfdp::EntityId destId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 1); PduConfig pduConf = - PduConfig(sourceId, destId, cfdp::TransmissionModes::ACKNOWLEDGED, seqNum, false); + PduConfig(sourceId, destId, cfdp::TransmissionMode::ACKNOWLEDGED, seqNum, false); uint8_t* serTarget = serBuf.data(); const uint8_t* deserTarget = serTarget; size_t serSize = 0; - auto creator = HeaderCreator(pduConf, cfdp::PduTypes::FILE_DIRECTIVE, 0); + auto creator = HeaderCreator(pduConf, cfdp::PduType::FILE_DIRECTIVE, 0); SECTION("Header State") { REQUIRE(seqNum.getSerializedSize() == 1); @@ -33,10 +33,10 @@ TEST_CASE("CFDP Header", "[cfdp]") { REQUIRE(creator.getLargeFileFlag() == false); REQUIRE(creator.getLenEntityIds() == 1); REQUIRE(creator.getLenSeqNum() == 1); - REQUIRE(creator.getPduType() == cfdp::PduTypes::FILE_DIRECTIVE); + REQUIRE(creator.getPduType() == cfdp::PduType::FILE_DIRECTIVE); REQUIRE(creator.getSegmentMetadataFlag() == cfdp::SegmentMetadataFlag::NOT_PRESENT); REQUIRE(creator.getSegmentationControl() == false); - REQUIRE(creator.getTransmissionMode() == cfdp::TransmissionModes::ACKNOWLEDGED); + REQUIRE(creator.getTransmissionMode() == cfdp::TransmissionMode::ACKNOWLEDGED); cfdp::TransactionSeqNum seqNumLocal; creator.getTransactionSeqNum(seqNumLocal); REQUIRE(seqNumLocal.getWidth() == cfdp::WidthInBytes::ONE_BYTE); @@ -85,9 +85,9 @@ TEST_CASE("CFDP Header", "[cfdp]") { pduConf.crcFlag = true; pduConf.largeFile = true; pduConf.direction = cfdp::Direction::TOWARDS_SENDER; - pduConf.mode = cfdp::TransmissionModes::UNACKNOWLEDGED; + pduConf.mode = cfdp::TransmissionMode::UNACKNOWLEDGED; creator.setSegmentationControl(cfdp::SegmentationControl::RECORD_BOUNDARIES_PRESERVATION); - creator.setPduType(cfdp::PduTypes::FILE_DATA); + creator.setPduType(cfdp::PduType::FILE_DATA); creator.setSegmentMetadataFlag(cfdp::SegmentMetadataFlag::PRESENT); serTarget = serBuf.data(); serSize = 0; @@ -103,9 +103,9 @@ TEST_CASE("CFDP Header", "[cfdp]") { REQUIRE(creator.getLargeFileFlag() == true); REQUIRE(creator.getLenEntityIds() == 1); REQUIRE(creator.getLenSeqNum() == 1); - REQUIRE(creator.getPduType() == cfdp::PduTypes::FILE_DATA); + REQUIRE(creator.getPduType() == cfdp::PduType::FILE_DATA); REQUIRE(creator.getSegmentMetadataFlag() == cfdp::SegmentMetadataFlag::PRESENT); - REQUIRE(creator.getTransmissionMode() == cfdp::TransmissionModes::UNACKNOWLEDGED); + REQUIRE(creator.getTransmissionMode() == cfdp::TransmissionMode::UNACKNOWLEDGED); REQUIRE(creator.getSegmentationControl() == true); } @@ -122,9 +122,9 @@ TEST_CASE("CFDP Header", "[cfdp]") { REQUIRE(creator.getLargeFileFlag() == true); REQUIRE(creator.getLenEntityIds() == 4); REQUIRE(creator.getLenSeqNum() == 2); - REQUIRE(creator.getPduType() == cfdp::PduTypes::FILE_DATA); + REQUIRE(creator.getPduType() == cfdp::PduType::FILE_DATA); REQUIRE(creator.getSegmentMetadataFlag() == cfdp::SegmentMetadataFlag::PRESENT); - REQUIRE(creator.getTransmissionMode() == cfdp::TransmissionModes::UNACKNOWLEDGED); + REQUIRE(creator.getTransmissionMode() == cfdp::TransmissionMode::UNACKNOWLEDGED); REQUIRE(creator.getSegmentationControl() == true); // Last three bits are 2 now (length of seq number) and bit 1 to bit 3 is 4 (len entity IDs) REQUIRE(serBuf[3] == 0b11001010); @@ -235,10 +235,10 @@ TEST_CASE("CFDP Header", "[cfdp]") { REQUIRE(reader.getLargeFileFlag() == false); REQUIRE(reader.getLenEntityIds() == 1); REQUIRE(reader.getLenSeqNum() == 1); - REQUIRE(reader.getPduType() == cfdp::PduTypes::FILE_DIRECTIVE); + REQUIRE(reader.getPduType() == cfdp::PduType::FILE_DIRECTIVE); REQUIRE(reader.getSegmentMetadataFlag() == cfdp::SegmentMetadataFlag::NOT_PRESENT); REQUIRE(reader.getSegmentationControl() == false); - REQUIRE(reader.getTransmissionMode() == cfdp::TransmissionModes::ACKNOWLEDGED); + REQUIRE(reader.getTransmissionMode() == cfdp::TransmissionMode::ACKNOWLEDGED); // No PDU data contained, so the PDU data field is empty REQUIRE(reader.getPduDataField() == nullptr); @@ -253,9 +253,9 @@ TEST_CASE("CFDP Header", "[cfdp]") { pduConf.crcFlag = true; pduConf.largeFile = true; pduConf.direction = cfdp::Direction::TOWARDS_SENDER; - pduConf.mode = cfdp::TransmissionModes::UNACKNOWLEDGED; + pduConf.mode = cfdp::TransmissionMode::UNACKNOWLEDGED; creator.setSegmentationControl(cfdp::SegmentationControl::RECORD_BOUNDARIES_PRESERVATION); - creator.setPduType(cfdp::PduTypes::FILE_DATA); + creator.setPduType(cfdp::PduType::FILE_DATA); creator.setSegmentMetadataFlag(cfdp::SegmentMetadataFlag::PRESENT); result = pduConf.seqNum.setValue(cfdp::WidthInBytes::TWO_BYTES, 0x0fff); REQUIRE(result == returnvalue::OK); @@ -278,10 +278,10 @@ TEST_CASE("CFDP Header", "[cfdp]") { REQUIRE(reader.getLargeFileFlag() == true); REQUIRE(reader.getLenEntityIds() == 4); REQUIRE(reader.getLenSeqNum() == 2); - REQUIRE(reader.getPduType() == cfdp::PduTypes::FILE_DATA); + REQUIRE(reader.getPduType() == cfdp::PduType::FILE_DATA); REQUIRE(reader.getSegmentMetadataFlag() == cfdp::SegmentMetadataFlag::PRESENT); REQUIRE(reader.getSegmentationControl() == true); - REQUIRE(reader.getTransmissionMode() == cfdp::TransmissionModes::UNACKNOWLEDGED); + REQUIRE(reader.getTransmissionMode() == cfdp::TransmissionMode::UNACKNOWLEDGED); // Again, no data field set because this is a header only REQUIRE(reader.getPduDataField() == nullptr); diff --git a/unittests/cfdp/pdu/testEofPdu.cpp b/unittests/cfdp/pdu/testEofPdu.cpp index c6718e20..83e61780 100644 --- a/unittests/cfdp/pdu/testEofPdu.cpp +++ b/unittests/cfdp/pdu/testEofPdu.cpp @@ -20,7 +20,7 @@ TEST_CASE("EOF PDU", "[cfdp][pdu]") { TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15); EntityId sourceId(WidthInBytes::TWO_BYTES, 1); - PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum); + PduConfig pduConf(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum); auto eofSerializer = EofPduCreator(pduConf, eofInfo); SECTION("Serialize") { @@ -37,7 +37,7 @@ TEST_CASE("EOF PDU", "[cfdp][pdu]") { SerializeIF::Endianness::NETWORK); REQUIRE(result == returnvalue::OK); REQUIRE(fileSizeVal == 12); - REQUIRE(buf[sz - 10] == cfdp::FileDirectives::EOF_DIRECTIVE); + REQUIRE(buf[sz - 10] == cfdp::FileDirective::EOF_DIRECTIVE); REQUIRE(buf[sz - 9] == 0x00); REQUIRE(sz == 20); @@ -52,13 +52,13 @@ TEST_CASE("EOF PDU", "[cfdp][pdu]") { SerializeIF::Endianness::NETWORK); REQUIRE(result == returnvalue::OK); REQUIRE(sz == 28); - REQUIRE(buf[10] == cfdp::FileDirectives::EOF_DIRECTIVE); + REQUIRE(buf[10] == cfdp::FileDirective::EOF_DIRECTIVE); REQUIRE(buf[11] >> 4 == cfdp::ConditionCode::FILESTORE_REJECTION); uint64_t fileSizeLarge = 0; result = SerializeAdapter::deSerialize(&fileSizeLarge, buf.data() + 16, nullptr, SerializeIF::Endianness::NETWORK); REQUIRE(fileSizeLarge == 0x10ffffff10); - REQUIRE(buf[sz - 4] == cfdp::TlvTypes::ENTITY_ID); + REQUIRE(buf[sz - 4] == cfdp::TlvType::ENTITY_ID); // width of entity ID is 2 REQUIRE(buf[sz - 3] == 2); uint16_t entityIdRaw = 0; @@ -105,7 +105,7 @@ TEST_CASE("EOF PDU", "[cfdp][pdu]") { REQUIRE(emptyInfo.getConditionCode() == cfdp::ConditionCode::FILESTORE_REJECTION); REQUIRE(emptyInfo.getChecksum() == 5); REQUIRE(emptyInfo.getFileSize().getSize() == 0x10ffffff10); - REQUIRE(emptyInfo.getFaultLoc()->getType() == cfdp::TlvTypes::ENTITY_ID); + REQUIRE(emptyInfo.getFaultLoc()->getType() == cfdp::TlvType::ENTITY_ID); REQUIRE(emptyInfo.getFaultLoc()->getSerializedSize() == 4); uint16_t destId = emptyInfo.getFaultLoc()->getEntityId().getValue(); REQUIRE(destId == 2); diff --git a/unittests/cfdp/pdu/testFileData.cpp b/unittests/cfdp/pdu/testFileData.cpp index 8dfd7db3..258ef9c1 100644 --- a/unittests/cfdp/pdu/testFileData.cpp +++ b/unittests/cfdp/pdu/testFileData.cpp @@ -17,7 +17,7 @@ TEST_CASE("File Data PDU", "[cfdp][pdu]") { EntityId destId(WidthInBytes::TWO_BYTES, 2); TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15); EntityId sourceId(WidthInBytes::TWO_BYTES, 1); - PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum); + PduConfig pduConf(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum); for (uint8_t idx = 0; idx < 10; idx++) { fileBuffer[idx] = idx; diff --git a/unittests/cfdp/pdu/testFileDirective.cpp b/unittests/cfdp/pdu/testFileDirective.cpp index 31e627a6..e1158a1a 100644 --- a/unittests/cfdp/pdu/testFileDirective.cpp +++ b/unittests/cfdp/pdu/testFileDirective.cpp @@ -12,11 +12,11 @@ TEST_CASE("CFDP File Directive", "[cfdp][pdu]") { cfdp::EntityId sourceId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 0); cfdp::EntityId destId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 1); PduConfig pduConf = - PduConfig(sourceId, destId, cfdp::TransmissionModes::ACKNOWLEDGED, seqNum, false); + PduConfig(sourceId, destId, cfdp::TransmissionMode::ACKNOWLEDGED, seqNum, false); uint8_t* serTarget = serBuf.data(); const uint8_t* deserTarget = serTarget; size_t serSize = 0; - auto fdSer = FileDirectiveCreator(pduConf, FileDirectives::ACK, 4); + auto fdSer = FileDirectiveCreator(pduConf, FileDirective::ACK, 4); SECTION("Serialization") { REQUIRE(fdSer.getSerializedSize() == 8); @@ -37,7 +37,7 @@ TEST_CASE("CFDP File Directive", "[cfdp][pdu]") { REQUIRE(serBuf[5] == 2); // Dest ID REQUIRE(serBuf[6] == 1); - REQUIRE(serBuf[7] == FileDirectives::ACK); + REQUIRE(serBuf[7] == FileDirective::ACK); } SECTION("Serialization fails") { @@ -73,10 +73,10 @@ TEST_CASE("CFDP File Directive", "[cfdp][pdu]") { REQUIRE(fdDeser.parseData() == returnvalue::OK); REQUIRE(not fdDeser.isNull()); REQUIRE(fdDeser); - REQUIRE(fdDeser.getFileDirective() == FileDirectives::ACK); + REQUIRE(fdDeser.getFileDirective() == FileDirective::ACK); REQUIRE(fdDeser.getPduDataFieldLen() == 5); REQUIRE(fdDeser.getHeaderSize() == 8); - REQUIRE(fdDeser.getPduType() == cfdp::PduTypes::FILE_DIRECTIVE); + REQUIRE(fdDeser.getPduType() == cfdp::PduType::FILE_DIRECTIVE); serBuf[7] = 0xff; // Invalid file directive diff --git a/unittests/cfdp/pdu/testFinishedPdu.cpp b/unittests/cfdp/pdu/testFinishedPdu.cpp index 194e4252..b8b395cb 100644 --- a/unittests/cfdp/pdu/testFinishedPdu.cpp +++ b/unittests/cfdp/pdu/testFinishedPdu.cpp @@ -14,7 +14,7 @@ TEST_CASE("Finished PDU", "[cfdp][pdu]") { EntityId destId(WidthInBytes::TWO_BYTES, 2); TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15); EntityId sourceId(WidthInBytes::TWO_BYTES, 1); - PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum); + PduConfig pduConf(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum); cfdp::Lv emptyFsMsg; FinishedInfo info(cfdp::ConditionCode::INACTIVITY_DETECTED, @@ -27,7 +27,7 @@ TEST_CASE("Finished PDU", "[cfdp][pdu]") { REQUIRE(result == returnvalue::OK); REQUIRE(serializer.getSerializedSize() == 12); REQUIRE(((fnBuffer[1] << 8) | fnBuffer[2]) == 2); - REQUIRE(fnBuffer[10] == cfdp::FileDirectives::FINISH); + REQUIRE(fnBuffer[10] == cfdp::FileDirective::FINISH); REQUIRE(((fnBuffer[sz - 1] >> 4) & 0x0f) == cfdp::ConditionCode::INACTIVITY_DETECTED); REQUIRE(((fnBuffer[sz - 1] >> 2) & 0x01) == cfdp::FileDeliveryCode::DATA_INCOMPLETE); REQUIRE((fnBuffer[sz - 1] & 0b11) == cfdp::FileDeliveryStatus::DISCARDED_DELIBERATELY); @@ -176,7 +176,7 @@ TEST_CASE("Finished PDU", "[cfdp][pdu]") { fnBuffer[11] = tmp; // Invalid TLV type, should be entity ID - fnBuffer[sz - 4] = cfdp::TlvTypes::FILESTORE_REQUEST; + fnBuffer[sz - 4] = cfdp::TlvType::FILESTORE_REQUEST; result = deserializer3.parseData(); REQUIRE(result == cfdp::INVALID_TLV_TYPE); diff --git a/unittests/cfdp/pdu/testKeepAlivePdu.cpp b/unittests/cfdp/pdu/testKeepAlivePdu.cpp index 9b0e9669..d07bccae 100644 --- a/unittests/cfdp/pdu/testKeepAlivePdu.cpp +++ b/unittests/cfdp/pdu/testKeepAlivePdu.cpp @@ -14,7 +14,7 @@ TEST_CASE("Keep Alive PDU", "[cfdp][pdu]") { EntityId destId(WidthInBytes::TWO_BYTES, 2); TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15); EntityId sourceId(WidthInBytes::TWO_BYTES, 1); - PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum); + PduConfig pduConf(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum); FileSize progress(0x50); @@ -22,7 +22,7 @@ TEST_CASE("Keep Alive PDU", "[cfdp][pdu]") { KeepAlivePduCreator serializer(pduConf, progress); result = serializer.serialize(&buffer, &sz, kaBuffer.size(), SerializeIF::Endianness::NETWORK); REQUIRE(result == returnvalue::OK); - REQUIRE(kaBuffer[10] == cfdp::FileDirectives::KEEP_ALIVE); + REQUIRE(kaBuffer[10] == cfdp::FileDirective::KEEP_ALIVE); uint32_t fsRaw = 0; result = SerializeAdapter::deSerialize(&fsRaw, kaBuffer.data() + 11, nullptr, SerializeIF::Endianness::NETWORK); diff --git a/unittests/cfdp/pdu/testMetadataPdu.cpp b/unittests/cfdp/pdu/testMetadataPdu.cpp index 18b60409..a9f8bf86 100644 --- a/unittests/cfdp/pdu/testMetadataPdu.cpp +++ b/unittests/cfdp/pdu/testMetadataPdu.cpp @@ -17,13 +17,13 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") { EntityId destId(WidthInBytes::TWO_BYTES, 2); TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15); EntityId sourceId(WidthInBytes::TWO_BYTES, 1); - PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum); + PduConfig pduConf(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum); std::string firstFileName = "hello.txt"; cfdp::StringLv sourceFileName(firstFileName); cfdp::StringLv destFileName; FileSize fileSize(35); - MetadataInfo info(false, ChecksumTypes::MODULAR, fileSize, sourceFileName, destFileName); + MetadataInfo info(false, ChecksumType::MODULAR, fileSize, sourceFileName, destFileName); FilestoreResponseTlv response(FilestoreActionCode::CREATE_DIRECTORY, FSR_CREATE_NOT_ALLOWED, sourceFileName, nullptr); @@ -46,7 +46,7 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") { REQUIRE(info.getDestFileName().getSerializedSize() == 1); REQUIRE(info.getSerializedSize() == 16); REQUIRE((mdBuffer[1] << 8 | mdBuffer[2]) == 17); - REQUIRE(mdBuffer[10] == FileDirectives::METADATA); + REQUIRE(mdBuffer[10] == FileDirective::METADATA); // no closure requested and checksum type is modular => 0x00 REQUIRE(mdBuffer[11] == 0x00); uint32_t fileSizeRaw = 0; @@ -74,7 +74,7 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") { REQUIRE(info.getMaxOptionsLen() == 2); info.setMaxOptionsLen(3); REQUIRE(info.getMaxOptionsLen() == 3); - info.setChecksumType(cfdp::ChecksumTypes::CRC_32C); + info.setChecksumType(cfdp::ChecksumType::CRC_32C); info.setClosureRequested(true); uint8_t* buffer = mdBuffer.data(); size_t sz = 0; @@ -83,8 +83,8 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") { result = serializer.serialize(&buffer, &sz, mdBuffer.size(), SerializeIF::Endianness::NETWORK); REQUIRE(result == returnvalue::OK); REQUIRE((mdBuffer[1] << 8 | mdBuffer[2]) == 37); - auto checksumType = static_cast(mdBuffer[11] & 0x0f); - REQUIRE(checksumType == cfdp::ChecksumTypes::CRC_32C); + auto checksumType = static_cast(mdBuffer[11] & 0x0f); + REQUIRE(checksumType == cfdp::ChecksumType::CRC_32C); bool closureRequested = mdBuffer[11] >> 6 & 0x01; REQUIRE(closureRequested == true); // The size of the two options is 19. Summing up: @@ -130,7 +130,7 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") { size_t maxSize = 4; info.setOptionsArray(options.data(), sizeOfOptions, maxSize); REQUIRE(info.getOptionsLen() == 2); - info.setChecksumType(cfdp::ChecksumTypes::CRC_32C); + info.setChecksumType(cfdp::ChecksumType::CRC_32C); info.setClosureRequested(true); uint8_t* buffer = mdBuffer.data(); size_t sz = 0; @@ -143,9 +143,9 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") { MetadataPduReader deserializer2(mdBuffer.data(), mdBuffer.size(), info); result = deserializer2.parseData(); REQUIRE(result == returnvalue::OK); - REQUIRE(options[0]->getType() == cfdp::TlvTypes::FILESTORE_RESPONSE); + REQUIRE(options[0]->getType() == cfdp::TlvType::FILESTORE_RESPONSE); REQUIRE(options[0]->getSerializedSize() == 14); - REQUIRE(options[1]->getType() == cfdp::TlvTypes::MSG_TO_USER); + REQUIRE(options[1]->getType() == cfdp::TlvType::MSG_TO_USER); REQUIRE(options[1]->getSerializedSize() == 5); for (size_t invalidFieldLen = 0; invalidFieldLen < 36; invalidFieldLen++) { diff --git a/unittests/cfdp/pdu/testNakPdu.cpp b/unittests/cfdp/pdu/testNakPdu.cpp index f2779788..7974dab1 100644 --- a/unittests/cfdp/pdu/testNakPdu.cpp +++ b/unittests/cfdp/pdu/testNakPdu.cpp @@ -15,7 +15,7 @@ TEST_CASE("NAK PDU", "[cfdp][pdu]") { EntityId destId(WidthInBytes::TWO_BYTES, 2); TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15); EntityId sourceId(WidthInBytes::TWO_BYTES, 1); - PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum); + PduConfig pduConf(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum); FileSize startOfScope(50); FileSize endOfScope(1050); @@ -29,7 +29,7 @@ TEST_CASE("NAK PDU", "[cfdp][pdu]") { REQUIRE(sz == 19); REQUIRE(serializer.getPduDataFieldLen() == 9); REQUIRE(((nakBuffer[1] << 8) | nakBuffer[2]) == 0x09); - REQUIRE(nakBuffer[10] == cfdp::FileDirectives::NAK); + REQUIRE(nakBuffer[10] == cfdp::FileDirective::NAK); uint32_t scope = 0; result = SerializeAdapter::deSerialize(&scope, nakBuffer.data() + 11, nullptr, SerializeIF::Endianness::NETWORK); diff --git a/unittests/cfdp/pdu/testPromptPdu.cpp b/unittests/cfdp/pdu/testPromptPdu.cpp index 538f6459..6032f44e 100644 --- a/unittests/cfdp/pdu/testPromptPdu.cpp +++ b/unittests/cfdp/pdu/testPromptPdu.cpp @@ -14,7 +14,7 @@ TEST_CASE("Prompt PDU", "[cfdp][pdu]") { EntityId destId(WidthInBytes::TWO_BYTES, 2); TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15); EntityId sourceId(WidthInBytes::TWO_BYTES, 1); - PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum); + PduConfig pduConf(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum); SECTION("Serialize") { PromptPduCreator serializer(pduConf, cfdp::PromptResponseRequired::PROMPT_KEEP_ALIVE); @@ -23,7 +23,7 @@ TEST_CASE("Prompt PDU", "[cfdp][pdu]") { REQUIRE(serializer.getWholePduSize() == 12); REQUIRE(sz == 12); REQUIRE(serializer.getPduDataFieldLen() == 2); - REQUIRE(rawBuf[10] == FileDirectives::PROMPT); + REQUIRE(rawBuf[10] == FileDirective::PROMPT); REQUIRE(((rawBuf[sz - 1] >> 7) & 0x01) == cfdp::PromptResponseRequired::PROMPT_KEEP_ALIVE); for (size_t invalidMaxSz = 0; invalidMaxSz < sz; invalidMaxSz++) { diff --git a/unittests/cfdp/testCfdp.cpp b/unittests/cfdp/testCfdp.cpp index 38504a5b..eacc83de 100644 --- a/unittests/cfdp/testCfdp.cpp +++ b/unittests/cfdp/testCfdp.cpp @@ -16,13 +16,13 @@ TEST_CASE("CFDP Base", "[cfdp]") { cfdp::EntityId sourceId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 0); cfdp::EntityId destId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 1); PduConfig pduConf = - PduConfig(sourceId, destId, cfdp::TransmissionModes::ACKNOWLEDGED, seqNum, false); + PduConfig(sourceId, destId, cfdp::TransmissionMode::ACKNOWLEDGED, seqNum, false); uint8_t* serTarget = serBuf.data(); const uint8_t* deserTarget = serTarget; size_t serSize = 0; SECTION("File Directive") { - auto fdSer = FileDirectiveCreator(pduConf, FileDirectives::ACK, 4); + auto fdSer = FileDirectiveCreator(pduConf, FileDirective::ACK, 4); REQUIRE(fdSer.getSerializedSize() == 8); serTarget = serBuf.data(); serSize = 0; @@ -41,7 +41,7 @@ TEST_CASE("CFDP Base", "[cfdp]") { REQUIRE(serBuf[5] == 2); // Dest ID REQUIRE(serBuf[6] == 1); - REQUIRE(serBuf[7] == FileDirectives::ACK); + REQUIRE(serBuf[7] == FileDirective::ACK); serTarget = serBuf.data(); size_t deserSize = 20; @@ -65,10 +65,10 @@ TEST_CASE("CFDP Base", "[cfdp]") { REQUIRE(fdDeser.getEndianness() == SerializeIF::Endianness::MACHINE); fdDeser.setEndianness(SerializeIF::Endianness::NETWORK); REQUIRE(fdDeser.parseData() == returnvalue::OK); - REQUIRE(fdDeser.getFileDirective() == FileDirectives::ACK); + REQUIRE(fdDeser.getFileDirective() == FileDirective::ACK); REQUIRE(fdDeser.getPduDataFieldLen() == 5); REQUIRE(fdDeser.getHeaderSize() == 8); - REQUIRE(fdDeser.getPduType() == cfdp::PduTypes::FILE_DIRECTIVE); + REQUIRE(fdDeser.getPduType() == cfdp::PduType::FILE_DIRECTIVE); serBuf[7] = 0xff; // Invalid file directive diff --git a/unittests/cfdp/testOtherTlvs.cpp b/unittests/cfdp/testOtherTlvs.cpp index 4eb51a7c..88413195 100644 --- a/unittests/cfdp/testOtherTlvs.cpp +++ b/unittests/cfdp/testOtherTlvs.cpp @@ -41,7 +41,7 @@ TEST_CASE("CFDP Other TLVs", "[cfdp][tlv]") { result = response.convertToTlv(rawResponse, serBuf.data(), serBuf.size(), SerializeIF::Endianness::NETWORK); REQUIRE(result == returnvalue::OK); - REQUIRE(rawResponse.getType() == cfdp::TlvTypes::FILESTORE_RESPONSE); + REQUIRE(rawResponse.getType() == cfdp::TlvType::FILESTORE_RESPONSE); cfdp::StringLv emptyMsg; cfdp::StringLv emptySecondName; FilestoreResponseTlv emptyTlv(firstName, &emptyMsg); @@ -96,12 +96,12 @@ TEST_CASE("CFDP Other TLVs", "[cfdp][tlv]") { result = request.convertToTlv(rawRequest, serBuf.data(), serBuf.size(), SerializeIF::Endianness::NETWORK); REQUIRE(result == returnvalue::OK); - REQUIRE(rawRequest.getType() == cfdp::TlvTypes::FILESTORE_REQUEST); + REQUIRE(rawRequest.getType() == cfdp::TlvType::FILESTORE_REQUEST); emptyRequest.setActionCode(cfdp::FilestoreActionCode::DELETE_FILE); result = emptyRequest.deSerialize(rawRequest, SerializeIF::Endianness::NETWORK); REQUIRE(result == returnvalue::OK); - REQUIRE(emptyRequest.getType() == cfdp::TlvTypes::FILESTORE_REQUEST); + REQUIRE(emptyRequest.getType() == cfdp::TlvType::FILESTORE_REQUEST); REQUIRE(emptyRequest.getActionCode() == cfdp::FilestoreActionCode::APPEND_FILE); } @@ -111,7 +111,7 @@ TEST_CASE("CFDP Other TLVs", "[cfdp][tlv]") { FlowLabelTlv flowLabelTlv(&flowLabel, 1); FaultHandlerOverrideTlv faultOverrideTlv(cfdp::ConditionCode::FILESTORE_REJECTION, - cfdp::FaultHandlerCodes::NOTICE_OF_CANCELLATION); + cfdp::FaultHandlerCode::NOTICE_OF_CANCELLATION); size_t sz = 0; result = faultOverrideTlv.serialize(&serPtr, &sz, rawBuf.size(), SerializeIF::Endianness::NETWORK); @@ -128,7 +128,7 @@ TEST_CASE("CFDP Other TLVs", "[cfdp][tlv]") { EntityIdTlv idTlv(emptyId); serPtr = rawBuf.data(); result = idTlv.serialize(&serPtr, &deserSize, rawBuf.size(), SerializeIF::Endianness::NETWORK); - cfdp::Tlv rawTlv(cfdp::TlvTypes::ENTITY_ID, rawBuf.data() + 2, 2); + cfdp::Tlv rawTlv(cfdp::TlvType::ENTITY_ID, rawBuf.data() + 2, 2); REQUIRE(result == returnvalue::OK); deserPtr = rawBuf.data(); result = idTlv.deSerialize(rawTlv, SerializeIF::Endianness::NETWORK); diff --git a/unittests/cfdp/testTlv.cpp b/unittests/cfdp/testTlv.cpp index b78d8a80..979bfac5 100644 --- a/unittests/cfdp/testTlv.cpp +++ b/unittests/cfdp/testTlv.cpp @@ -22,14 +22,14 @@ TEST_CASE("CFDP TLV", "[cfdp][tlv]") { SECTION("TLV Serialization") { std::array tlvBuf{}; REQUIRE(sourceId.serializeBe(tlvBuf.data(), deserSize, tlvBuf.size()) == returnvalue::OK); - auto tlv = Tlv(TlvTypes::ENTITY_ID, tlvBuf.data(), deserSize); + auto tlv = Tlv(TlvType::ENTITY_ID, tlvBuf.data(), deserSize); REQUIRE(tlv.getSerializedSize() == 4); REQUIRE(tlv.getLengthField() == 2); deserSize = 0; REQUIRE(tlv.serialize(&serPtr, &deserSize, rawBuf.size(), SerializeIF::Endianness::NETWORK) == returnvalue::OK); REQUIRE(deserSize == 4); - REQUIRE(rawBuf[0] == TlvTypes::ENTITY_ID); + REQUIRE(rawBuf[0] == TlvType::ENTITY_ID); REQUIRE(rawBuf[1] == 2); uint16_t entityId = 0; REQUIRE(SerializeAdapter::deSerialize(&entityId, rawBuf.data() + 2, &deserSize, @@ -38,7 +38,7 @@ TEST_CASE("CFDP TLV", "[cfdp][tlv]") { } SECTION("TLV Other Value") { - auto tlv = Tlv(TlvTypes::ENTITY_ID, rawBuf.data(), deserSize); + auto tlv = Tlv(TlvType::ENTITY_ID, rawBuf.data(), deserSize); // Set new value sourceId.setValue(cfdp::WidthInBytes::FOUR_BYTES, 12); REQUIRE(sourceId.serialize(&serPtr, &deserSize, rawBuf.size(), @@ -48,17 +48,17 @@ TEST_CASE("CFDP TLV", "[cfdp][tlv]") { deserSize = 0; result = tlv.serialize(&serPtr, &deserSize, rawBuf.size(), SerializeIF::Endianness::NETWORK); REQUIRE(result == returnvalue::OK); - REQUIRE(rawBuf[0] == TlvTypes::ENTITY_ID); + REQUIRE(rawBuf[0] == TlvType::ENTITY_ID); REQUIRE(rawBuf[1] == 4); REQUIRE(result == returnvalue::OK); } SECTION("TLV Invalid") { - auto tlvInvalid = Tlv(cfdp::TlvTypes::INVALID_TLV, rawBuf.data(), 0); + auto tlvInvalid = Tlv(cfdp::TlvType::INVALID_TLV, rawBuf.data(), 0); REQUIRE(tlvInvalid.serialize(&serPtr, &deserSize, rawBuf.size(), SerializeIF::Endianness::NETWORK) != returnvalue::OK); - tlvInvalid = Tlv(cfdp::TlvTypes::ENTITY_ID, nullptr, 3); + tlvInvalid = Tlv(cfdp::TlvType::ENTITY_ID, nullptr, 3); REQUIRE(tlvInvalid.serialize(&serPtr, &deserSize, rawBuf.size(), SerializeIF::Endianness::NETWORK) != returnvalue::OK); REQUIRE(tlvInvalid.serialize(&serPtr, &deserSize, 0, SerializeIF::Endianness::NETWORK) != @@ -69,13 +69,13 @@ TEST_CASE("CFDP TLV", "[cfdp][tlv]") { } SECTION("TLV Zero Length Field") { - Tlv zeroLenField(TlvTypes::FAULT_HANDLER, nullptr, 0); + Tlv zeroLenField(TlvType::FAULT_HANDLER, nullptr, 0); REQUIRE(zeroLenField.getSerializedSize() == 2); serPtr = rawBuf.data(); deserSize = 0; REQUIRE(zeroLenField.serialize(&serPtr, &deserSize, rawBuf.size(), SerializeIF::Endianness::NETWORK) == returnvalue::OK); - REQUIRE(rawBuf[0] == TlvTypes::FAULT_HANDLER); + REQUIRE(rawBuf[0] == TlvType::FAULT_HANDLER); REQUIRE(rawBuf[1] == 0); } @@ -85,7 +85,7 @@ TEST_CASE("CFDP TLV", "[cfdp][tlv]") { serPtr = tlvRawBuf.data(); result = sourceId.serialize(&serPtr, &deserSize, tlvRawBuf.size(), SerializeIF::Endianness::NETWORK); - auto tlvSerialization = Tlv(TlvTypes::ENTITY_ID, tlvRawBuf.data(), deserSize); + auto tlvSerialization = Tlv(TlvType::ENTITY_ID, tlvRawBuf.data(), deserSize); serPtr = rawBuf.data(); deserSize = 0; result = tlvSerialization.serialize(&serPtr, &deserSize, rawBuf.size(), @@ -95,7 +95,7 @@ TEST_CASE("CFDP TLV", "[cfdp][tlv]") { result = tlv.deSerialize(&deserPtr, &deserSize, SerializeIF::Endianness::NETWORK); REQUIRE(result == returnvalue::OK); REQUIRE(tlv.getSerializedSize() == 4); - REQUIRE(tlv.getType() == TlvTypes::ENTITY_ID); + REQUIRE(tlv.getType() == TlvType::ENTITY_ID); deserPtr = tlv.getValue(); uint16_t entityId = 0; deserSize = 0; @@ -109,12 +109,12 @@ TEST_CASE("CFDP TLV", "[cfdp][tlv]") { REQUIRE(tlv.deSerialize(&deserPtr, &deserSize, SerializeIF::Endianness::NETWORK) == SerializeIF::STREAM_TOO_SHORT); // Set invalid TLV - rawBuf[0] = TlvTypes::INVALID_TLV; + rawBuf[0] = TlvType::INVALID_TLV; deserSize = 4; REQUIRE(tlv.deSerialize(&deserPtr, &deserSize, SerializeIF::Endianness::NETWORK) != returnvalue::OK); - Tlv zeroLenField(TlvTypes::FAULT_HANDLER, nullptr, 0); + Tlv zeroLenField(TlvType::FAULT_HANDLER, nullptr, 0); serPtr = rawBuf.data(); deserSize = 0; REQUIRE(zeroLenField.serialize(&serPtr, &deserSize, rawBuf.size(), diff --git a/unittests/mocks/cfdp/FaultHandlerMock.cpp b/unittests/mocks/cfdp/FaultHandlerMock.cpp index 26bebda5..03736f71 100644 --- a/unittests/mocks/cfdp/FaultHandlerMock.cpp +++ b/unittests/mocks/cfdp/FaultHandlerMock.cpp @@ -2,31 +2,31 @@ namespace cfdp { -void FaultHandlerMock::noticeOfSuspensionCb(cfdp::ConditionCode code) { - auto& info = fhInfoMap.at(cfdp::FaultHandlerCodes::NOTICE_OF_SUSPENSION); +void FaultHandlerMock::noticeOfSuspensionCb(TransactionId& id, cfdp::ConditionCode code) { + auto& info = fhInfoMap.at(cfdp::FaultHandlerCode::NOTICE_OF_SUSPENSION); info.callCount++; info.condCodes.push(code); } -void FaultHandlerMock::noticeOfCancellationCb(cfdp::ConditionCode code) { - auto& info = fhInfoMap.at(cfdp::FaultHandlerCodes::NOTICE_OF_CANCELLATION); +void FaultHandlerMock::noticeOfCancellationCb(TransactionId& id, cfdp::ConditionCode code) { + auto& info = fhInfoMap.at(cfdp::FaultHandlerCode::NOTICE_OF_CANCELLATION); info.callCount++; info.condCodes.push(code); } -void FaultHandlerMock::abandonCb(cfdp::ConditionCode code) { - auto& info = fhInfoMap.at(cfdp::FaultHandlerCodes::ABANDON_TRANSACTION); +void FaultHandlerMock::abandonCb(TransactionId& id, cfdp::ConditionCode code) { + auto& info = fhInfoMap.at(cfdp::FaultHandlerCode::ABANDON_TRANSACTION); info.callCount++; info.condCodes.push(code); } -void FaultHandlerMock::ignoreCb(cfdp::ConditionCode code) { - auto& info = fhInfoMap.at(cfdp::FaultHandlerCodes::IGNORE_ERROR); +void FaultHandlerMock::ignoreCb(TransactionId& id, cfdp::ConditionCode code) { + auto& info = fhInfoMap.at(cfdp::FaultHandlerCode::IGNORE_ERROR); info.callCount++; info.condCodes.push(code); } -FaultHandlerMock::FaultInfo& FaultHandlerMock::getFhInfo(cfdp::FaultHandlerCodes fhCode) { +FaultHandlerMock::FaultInfo& FaultHandlerMock::getFhInfo(cfdp::FaultHandlerCode fhCode) { return fhInfoMap.at(fhCode); } @@ -34,7 +34,7 @@ void FaultHandlerMock::reset() { fhInfoMap.clear(); } bool FaultHandlerMock::faultCbWasCalled() const { return std::any_of(fhInfoMap.begin(), fhInfoMap.end(), - [](const std::pair& pair) { + [](const std::pair& pair) { return pair.second.callCount > 0; }); } diff --git a/unittests/mocks/cfdp/FaultHandlerMock.h b/unittests/mocks/cfdp/FaultHandlerMock.h index a35d3d2b..1c59485c 100644 --- a/unittests/mocks/cfdp/FaultHandlerMock.h +++ b/unittests/mocks/cfdp/FaultHandlerMock.h @@ -15,21 +15,21 @@ class FaultHandlerMock : public FaultHandlerBase { std::queue condCodes; }; - void noticeOfSuspensionCb(ConditionCode code) override; - void noticeOfCancellationCb(ConditionCode code) override; - void abandonCb(ConditionCode code) override; - void ignoreCb(ConditionCode code) override; + void noticeOfSuspensionCb(TransactionId& id, ConditionCode code) override; + void noticeOfCancellationCb(TransactionId& id, ConditionCode code) override; + void abandonCb(TransactionId& id,ConditionCode code) override; + void ignoreCb(TransactionId& id, ConditionCode code) override; - FaultInfo& getFhInfo(FaultHandlerCodes fhCode); + FaultInfo& getFhInfo(FaultHandlerCode fhCode); [[nodiscard]] bool faultCbWasCalled() const; void reset(); private: - std::map fhInfoMap = { - std::pair{cfdp::FaultHandlerCodes::IGNORE_ERROR, FaultInfo()}, - std::pair{cfdp::FaultHandlerCodes::NOTICE_OF_CANCELLATION, FaultInfo()}, - std::pair{cfdp::FaultHandlerCodes::NOTICE_OF_SUSPENSION, FaultInfo()}, - std::pair{cfdp::FaultHandlerCodes::ABANDON_TRANSACTION, FaultInfo()}}; + std::map fhInfoMap = { + std::pair{cfdp::FaultHandlerCode::IGNORE_ERROR, FaultInfo()}, + std::pair{cfdp::FaultHandlerCode::NOTICE_OF_CANCELLATION, FaultInfo()}, + std::pair{cfdp::FaultHandlerCode::NOTICE_OF_SUSPENSION, FaultInfo()}, + std::pair{cfdp::FaultHandlerCode::ABANDON_TRANSACTION, FaultInfo()}}; }; } // namespace cfdp