Merge branch 'mueller/cfdp-update-without-handlers' into mueller/new-cfdp-update-with-handlers

This commit is contained in:
Robin Müller 2022-09-15 16:46:25 +02:00
commit 36ca35da77
21 changed files with 134 additions and 69 deletions

View File

@ -1,5 +1,5 @@
target_sources(${LIB_FSFW_NAME} PRIVATE CfdpMessage.cpp CfdpDistributor.cpp target_sources(${LIB_FSFW_NAME} PRIVATE CfdpMessage.cpp CfdpDistributor.cpp
VarLenFields.cpp) VarLenFields.cpp helpers.cpp)
add_subdirectory(pdu) add_subdirectory(pdu)
add_subdirectory(tlv) add_subdirectory(tlv)

View File

@ -82,7 +82,7 @@ enum FileDirectives : uint8_t {
KEEP_ALIVE = 0x0c KEEP_ALIVE = 0x0c
}; };
enum ConditionCode : uint8_t { enum ConditionCodes : uint8_t {
NO_CONDITION_FIELD = 0xff, NO_CONDITION_FIELD = 0xff,
NO_ERROR = 0b0000, NO_ERROR = 0b0000,
POSITIVE_ACK_LIMIT_REACHED = 0b0001, POSITIVE_ACK_LIMIT_REACHED = 0b0001,
@ -99,6 +99,7 @@ enum ConditionCode : uint8_t {
CANCEL_REQUEST_RECEIVED = 0b1111 CANCEL_REQUEST_RECEIVED = 0b1111
}; };
enum FaultHandlerCodes { enum FaultHandlerCodes {
RESERVED = 0b0000, RESERVED = 0b0000,
NOTICE_OF_CANCELLATION = 0b0001, NOTICE_OF_CANCELLATION = 0b0001,

View File

@ -5,7 +5,7 @@ namespace cfdp {
FaultHandlerBase::FaultHandlerBase() = default; FaultHandlerBase::FaultHandlerBase() = default;
FaultHandlerBase::~FaultHandlerBase() = default; FaultHandlerBase::~FaultHandlerBase() = default;
bool FaultHandlerBase::getFaultHandler(cfdp::ConditionCode code, bool FaultHandlerBase::getFaultHandler(cfdp::ConditionCodes code,
cfdp::FaultHandlerCodes& handler) const { cfdp::FaultHandlerCodes& handler) const {
auto iter = faultHandlerMap.find(code); auto iter = faultHandlerMap.find(code);
if (iter == faultHandlerMap.end()) { if (iter == faultHandlerMap.end()) {
@ -15,7 +15,7 @@ bool FaultHandlerBase::getFaultHandler(cfdp::ConditionCode code,
return true; return true;
} }
bool FaultHandlerBase::setFaultHandler(cfdp::ConditionCode code, cfdp::FaultHandlerCodes handler) { bool FaultHandlerBase::setFaultHandler(cfdp::ConditionCodes code, cfdp::FaultHandlerCodes handler) {
if (not faultHandlerMap.contains(code)) { if (not faultHandlerMap.contains(code)) {
return false; return false;
} }
@ -29,19 +29,19 @@ bool FaultHandlerBase::setFaultHandler(cfdp::ConditionCode code, cfdp::FaultHand
return true; return true;
} }
bool FaultHandlerBase::reportFault(cfdp::ConditionCode code) { bool FaultHandlerBase::reportFault(cfdp::TransactionId& id, cfdp::ConditionCodes code) {
if (not faultHandlerMap.contains(code)) { if (not faultHandlerMap.contains(code)) {
return false; return false;
} }
cfdp::FaultHandlerCodes fh = faultHandlerMap[code]; cfdp::FaultHandlerCodes fh = faultHandlerMap[code];
if (fh == cfdp::FaultHandlerCodes::IGNORE_ERROR) { if (fh == cfdp::FaultHandlerCodes::IGNORE_ERROR) {
ignoreCb(code); ignoreCb(id, code);
} else if (fh == cfdp::FaultHandlerCodes::ABANDON_TRANSACTION) { } else if (fh == cfdp::FaultHandlerCodes::ABANDON_TRANSACTION) {
abandonCb(code); abandonCb(id, code);
} else if (fh == cfdp::FaultHandlerCodes::NOTICE_OF_CANCELLATION) { } else if (fh == cfdp::FaultHandlerCodes::NOTICE_OF_CANCELLATION) {
noticeOfCancellationCb(code); noticeOfCancellationCb(id, code);
} else if (fh == cfdp::FaultHandlerCodes::NOTICE_OF_SUSPENSION) { } else if (fh == cfdp::FaultHandlerCodes::NOTICE_OF_SUSPENSION) {
noticeOfSuspensionCb(code); noticeOfSuspensionCb(id, code);
} else { } else {
// Should never happen, but use defensive programming // Should never happen, but use defensive programming
return false; return false;

View File

@ -3,6 +3,7 @@
#include <etl/flat_map.h> #include <etl/flat_map.h>
#include "fsfw/cfdp/VarLenFields.h"
#include "fsfw/cfdp/definitions.h" #include "fsfw/cfdp/definitions.h"
namespace cfdp { namespace cfdp {
@ -42,33 +43,33 @@ class FaultHandlerBase {
* - true if the condition code is valid * - true if the condition code is valid
* - false otherwise * - false otherwise
*/ */
bool getFaultHandler(cfdp::ConditionCode code, cfdp::FaultHandlerCodes& handler) const; bool getFaultHandler(cfdp::ConditionCodes code, cfdp::FaultHandlerCodes& handler) const;
bool setFaultHandler(cfdp::ConditionCode code, cfdp::FaultHandlerCodes handler); bool setFaultHandler(cfdp::ConditionCodes code, cfdp::FaultHandlerCodes handler);
bool reportFault(cfdp::ConditionCode code); bool reportFault(cfdp::TransactionId& id, cfdp::ConditionCodes code);
virtual void noticeOfSuspensionCb(cfdp::ConditionCode code) = 0; virtual void noticeOfSuspensionCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0;
virtual void noticeOfCancellationCb(cfdp::ConditionCode code) = 0; virtual void noticeOfCancellationCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0;
virtual void abandonCb(cfdp::ConditionCode code) = 0; virtual void abandonCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0;
virtual void ignoreCb(cfdp::ConditionCode code) = 0; virtual void ignoreCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0;
private: private:
etl::flat_map<cfdp::ConditionCode, cfdp::FaultHandlerCodes, 10> faultHandlerMap = { etl::flat_map<cfdp::ConditionCodes, cfdp::FaultHandlerCodes, 10> faultHandlerMap = {
etl::pair{cfdp::ConditionCode::POSITIVE_ACK_LIMIT_REACHED, etl::pair{cfdp::ConditionCodes::POSITIVE_ACK_LIMIT_REACHED,
cfdp::FaultHandlerCodes::IGNORE_ERROR}, cfdp::FaultHandlerCodes::IGNORE_ERROR},
etl::pair{cfdp::ConditionCode::KEEP_ALIVE_LIMIT_REACHED, etl::pair{cfdp::ConditionCodes::KEEP_ALIVE_LIMIT_REACHED,
cfdp::FaultHandlerCodes::IGNORE_ERROR}, cfdp::FaultHandlerCodes::IGNORE_ERROR},
etl::pair{cfdp::ConditionCode::INVALID_TRANSMISSION_MODE, etl::pair{cfdp::ConditionCodes::INVALID_TRANSMISSION_MODE,
cfdp::FaultHandlerCodes::IGNORE_ERROR}, cfdp::FaultHandlerCodes::IGNORE_ERROR},
etl::pair{cfdp::ConditionCode::FILE_CHECKSUM_FAILURE, cfdp::FaultHandlerCodes::IGNORE_ERROR}, etl::pair{cfdp::ConditionCodes::FILE_CHECKSUM_FAILURE, cfdp::FaultHandlerCodes::IGNORE_ERROR},
etl::pair{cfdp::ConditionCode::FILE_SIZE_ERROR, cfdp::FaultHandlerCodes::IGNORE_ERROR}, etl::pair{cfdp::ConditionCodes::FILE_SIZE_ERROR, cfdp::FaultHandlerCodes::IGNORE_ERROR},
etl::pair{cfdp::ConditionCode::NAK_LIMIT_REACHED, cfdp::FaultHandlerCodes::IGNORE_ERROR}, etl::pair{cfdp::ConditionCodes::NAK_LIMIT_REACHED, cfdp::FaultHandlerCodes::IGNORE_ERROR},
etl::pair{cfdp::ConditionCode::INACTIVITY_DETECTED, cfdp::FaultHandlerCodes::IGNORE_ERROR}, etl::pair{cfdp::ConditionCodes::INACTIVITY_DETECTED, cfdp::FaultHandlerCodes::IGNORE_ERROR},
etl::pair{cfdp::ConditionCode::UNSUPPORTED_CHECKSUM_TYPE, etl::pair{cfdp::ConditionCodes::UNSUPPORTED_CHECKSUM_TYPE,
cfdp::FaultHandlerCodes::IGNORE_ERROR}, cfdp::FaultHandlerCodes::IGNORE_ERROR},
etl::pair{cfdp::ConditionCode::FILESTORE_REJECTION, cfdp::FaultHandlerCodes::IGNORE_ERROR}, etl::pair{cfdp::ConditionCodes::FILESTORE_REJECTION, cfdp::FaultHandlerCodes::IGNORE_ERROR},
etl::pair{cfdp::ConditionCode::CHECK_LIMIT_REACHED, cfdp::FaultHandlerCodes::IGNORE_ERROR}}; etl::pair{cfdp::ConditionCodes::CHECK_LIMIT_REACHED, cfdp::FaultHandlerCodes::IGNORE_ERROR}};
}; };
} // namespace cfdp } // namespace cfdp

View File

@ -14,12 +14,12 @@
namespace cfdp { namespace cfdp {
struct TransactionFinishedParams { struct TransactionFinishedParams {
TransactionFinishedParams(const TransactionId& id, ConditionCode code, FileDeliveryCode delivCode, TransactionFinishedParams(const TransactionId& id, ConditionCodes code, FileDeliveryCode delivCode,
FileDeliveryStatus status) FileDeliveryStatus status)
: id(id), condCode(code), status(status), deliveryCode(delivCode) {} : id(id), condCode(code), status(status), deliveryCode(delivCode) {}
const TransactionId& id; const TransactionId& id;
ConditionCode condCode; ConditionCodes condCode;
FileDeliveryStatus status; FileDeliveryStatus status;
FileDeliveryCode deliveryCode; FileDeliveryCode deliveryCode;
std::vector<FilestoreResponseTlv*> fsResponses; std::vector<FilestoreResponseTlv*> fsResponses;
@ -85,10 +85,10 @@ class UserBase {
virtual void metadataRecvdIndication(const MetadataRecvdParams& params) = 0; virtual void metadataRecvdIndication(const MetadataRecvdParams& params) = 0;
virtual void fileSegmentRecvdIndication(const FileSegmentRecvdParams& params) = 0; virtual void fileSegmentRecvdIndication(const FileSegmentRecvdParams& params) = 0;
virtual void reportIndication(const TransactionId& id, StatusReportIF& report) = 0; virtual void reportIndication(const TransactionId& id, StatusReportIF& report) = 0;
virtual void suspendedIndication(const TransactionId& id, ConditionCode code) = 0; virtual void suspendedIndication(const TransactionId& id, ConditionCodes code) = 0;
virtual void resumedIndication(const TransactionId& id, size_t progress) = 0; virtual void resumedIndication(const TransactionId& id, size_t progress) = 0;
virtual void faultIndication(const TransactionId& id, ConditionCode code, size_t progress) = 0; virtual void faultIndication(const TransactionId& id, ConditionCodes code, size_t progress) = 0;
virtual void abandonedIndication(const TransactionId& id, ConditionCode code, virtual void abandonedIndication(const TransactionId& id, ConditionCodes code,
size_t progress) = 0; size_t progress) = 0;
virtual void eofRecvIndication(const TransactionId& id) = 0; virtual void eofRecvIndication(const TransactionId& id) = 0;

52
src/fsfw/cfdp/helpers.cpp Normal file
View File

@ -0,0 +1,52 @@
#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* cfdp::getConditionCodeString(cfdp::ConditionCodes code) {
switch (code) {
case NO_CONDITION_FIELD:
return COND_CODE_STRINGS[0];
case NO_ERROR:
return COND_CODE_STRINGS[1];
case POSITIVE_ACK_LIMIT_REACHED:
return COND_CODE_STRINGS[2];
case KEEP_ALIVE_LIMIT_REACHED:
return COND_CODE_STRINGS[3];
case INVALID_TRANSMISSION_MODE:
return COND_CODE_STRINGS[4];
case FILESTORE_REJECTION:
return COND_CODE_STRINGS[5];
case FILE_CHECKSUM_FAILURE:
return COND_CODE_STRINGS[6];
case FILE_SIZE_ERROR:
return COND_CODE_STRINGS[7];
case NAK_LIMIT_REACHED:
return COND_CODE_STRINGS[8];
case INACTIVITY_DETECTED:
return COND_CODE_STRINGS[9];
case CHECK_LIMIT_REACHED:
return COND_CODE_STRINGS[10];
case UNSUPPORTED_CHECKSUM_TYPE:
return COND_CODE_STRINGS[11];
case SUSPEND_REQUEST_RECEIVED:
return COND_CODE_STRINGS[12];
case CANCEL_REQUEST_RECEIVED:
return COND_CODE_STRINGS[13];
}
return "Unknown";
}

11
src/fsfw/cfdp/helpers.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef FSFW_EXAMPLE_HOSTED_HELPER_H
#define FSFW_EXAMPLE_HOSTED_HELPER_H
#include "definitions.h"
namespace cfdp {
const char* getConditionCodeString(cfdp::ConditionCodes code);
}
#endif // FSFW_EXAMPLE_HOSTED_HELPER_H

View File

@ -1,6 +1,6 @@
#include "AckInfo.h" #include "AckInfo.h"
AckInfo::AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCode ackedConditionCode, AckInfo::AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCodes ackedConditionCode,
cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode) cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode)
: ackedDirective(ackedDirective), : ackedDirective(ackedDirective),
ackedConditionCode(ackedConditionCode), ackedConditionCode(ackedConditionCode),
@ -13,9 +13,9 @@ AckInfo::AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCode ackedC
} }
} }
cfdp::ConditionCode AckInfo::getAckedConditionCode() const { return ackedConditionCode; } cfdp::ConditionCodes AckInfo::getAckedConditionCode() const { return ackedConditionCode; }
void AckInfo::setAckedConditionCode(cfdp::ConditionCode ackedConditionCode) { void AckInfo::setAckedConditionCode(cfdp::ConditionCodes ackedConditionCode) {
this->ackedConditionCode = ackedConditionCode; this->ackedConditionCode = ackedConditionCode;
if (ackedDirective == cfdp::FileDirectives::FINISH) { if (ackedDirective == cfdp::FileDirectives::FINISH) {
this->directiveSubtypeCode = 0b0001; this->directiveSubtypeCode = 0b0001;

View File

@ -6,11 +6,11 @@
class AckInfo { class AckInfo {
public: public:
AckInfo(); AckInfo();
AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCode ackedConditionCode, AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCodes ackedConditionCode,
cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode = 0); cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode = 0);
cfdp::ConditionCode getAckedConditionCode() const; cfdp::ConditionCodes getAckedConditionCode() const;
void setAckedConditionCode(cfdp::ConditionCode ackedConditionCode); void setAckedConditionCode(cfdp::ConditionCodes ackedConditionCode);
cfdp::FileDirectives getAckedDirective() const; cfdp::FileDirectives getAckedDirective() const;
void setAckedDirective(cfdp::FileDirectives ackedDirective); void setAckedDirective(cfdp::FileDirectives ackedDirective);
@ -23,7 +23,7 @@ class AckInfo {
private: private:
cfdp::FileDirectives ackedDirective = cfdp::FileDirectives::INVALID_DIRECTIVE; cfdp::FileDirectives ackedDirective = cfdp::FileDirectives::INVALID_DIRECTIVE;
cfdp::ConditionCode ackedConditionCode = cfdp::ConditionCode::NO_CONDITION_FIELD; cfdp::ConditionCodes ackedConditionCode = cfdp::ConditionCodes::NO_CONDITION_FIELD;
cfdp::AckTransactionStatus transactionStatus = cfdp::AckTransactionStatus::UNDEFINED; cfdp::AckTransactionStatus transactionStatus = cfdp::AckTransactionStatus::UNDEFINED;
uint8_t directiveSubtypeCode = 0; uint8_t directiveSubtypeCode = 0;
}; };

View File

@ -13,7 +13,7 @@ ReturnValue_t AckPduCreator::serialize(uint8_t **buffer, size_t *size, size_t ma
} }
cfdp::FileDirectives ackedDirective = ackInfo.getAckedDirective(); cfdp::FileDirectives ackedDirective = ackInfo.getAckedDirective();
uint8_t directiveSubtypeCode = ackInfo.getDirectiveSubtypeCode(); uint8_t directiveSubtypeCode = ackInfo.getDirectiveSubtypeCode();
cfdp::ConditionCode ackedConditionCode = ackInfo.getAckedConditionCode(); cfdp::ConditionCodes ackedConditionCode = ackInfo.getAckedConditionCode();
cfdp::AckTransactionStatus transactionStatus = ackInfo.getTransactionStatus(); cfdp::AckTransactionStatus transactionStatus = ackInfo.getTransactionStatus();
if (ackedDirective != cfdp::FileDirectives::FINISH and if (ackedDirective != cfdp::FileDirectives::FINISH and
ackedDirective != cfdp::FileDirectives::EOF_DIRECTIVE) { ackedDirective != cfdp::FileDirectives::EOF_DIRECTIVE) {

View File

@ -29,7 +29,7 @@ bool AckPduReader::checkAndSetCodes(uint8_t firstByte, uint8_t secondByte) {
return false; return false;
} }
this->info.setDirectiveSubtypeCode(directiveSubtypeCode); this->info.setDirectiveSubtypeCode(directiveSubtypeCode);
this->info.setAckedConditionCode(static_cast<cfdp::ConditionCode>(secondByte >> 4)); this->info.setAckedConditionCode(static_cast<cfdp::ConditionCodes>(secondByte >> 4));
this->info.setTransactionStatus(static_cast<cfdp::AckTransactionStatus>(secondByte & 0x0f)); this->info.setTransactionStatus(static_cast<cfdp::AckTransactionStatus>(secondByte & 0x0f));
return true; return true;
} }

View File

@ -1,18 +1,18 @@
#include "EofInfo.h" #include "EofInfo.h"
EofInfo::EofInfo(cfdp::ConditionCode conditionCode, uint32_t checksum, cfdp::FileSize fileSize, EofInfo::EofInfo(cfdp::ConditionCodes conditionCode, uint32_t checksum, cfdp::FileSize fileSize,
EntityIdTlv* faultLoc) EntityIdTlv* faultLoc)
: conditionCode(conditionCode), checksum(checksum), fileSize(fileSize), faultLoc(faultLoc) {} : conditionCode(conditionCode), checksum(checksum), fileSize(fileSize), faultLoc(faultLoc) {}
EofInfo::EofInfo(EntityIdTlv* faultLoc) EofInfo::EofInfo(EntityIdTlv* faultLoc)
: conditionCode(cfdp::ConditionCode::NO_CONDITION_FIELD), : conditionCode(cfdp::ConditionCodes::NO_CONDITION_FIELD),
checksum(0), checksum(0),
fileSize(0), fileSize(0),
faultLoc(faultLoc) {} faultLoc(faultLoc) {}
uint32_t EofInfo::getChecksum() const { return checksum; } uint32_t EofInfo::getChecksum() const { return checksum; }
cfdp::ConditionCode EofInfo::getConditionCode() const { return conditionCode; } cfdp::ConditionCodes EofInfo::getConditionCode() const { return conditionCode; }
EntityIdTlv* EofInfo::getFaultLoc() const { return faultLoc; } 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::setChecksum(uint32_t checksum) { this->checksum = checksum; }
void EofInfo::setConditionCode(cfdp::ConditionCode conditionCode) { void EofInfo::setConditionCode(cfdp::ConditionCodes conditionCode) {
this->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 // 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. // a serializer will not serialize the fault location here.
if (getFaultLoc() != nullptr and getConditionCode() != cfdp::ConditionCode::NO_ERROR) { if (getFaultLoc() != nullptr and getConditionCode() != cfdp::ConditionCodes::NO_ERROR) {
size += faultLoc->getSerializedSize(); size += faultLoc->getSerializedSize();
} }
return size; return size;

View File

@ -8,23 +8,23 @@
struct EofInfo { struct EofInfo {
public: public:
explicit EofInfo(EntityIdTlv* faultLoc = nullptr); explicit EofInfo(EntityIdTlv* faultLoc = nullptr);
EofInfo(cfdp::ConditionCode conditionCode, uint32_t checksum, cfdp::FileSize fileSize, EofInfo(cfdp::ConditionCodes conditionCode, uint32_t checksum, cfdp::FileSize fileSize,
EntityIdTlv* faultLoc = nullptr); EntityIdTlv* faultLoc = nullptr);
size_t getSerializedSize(bool fssLarge = false); size_t getSerializedSize(bool fssLarge = false);
[[nodiscard]] uint32_t getChecksum() const; [[nodiscard]] uint32_t getChecksum() const;
[[nodiscard]] cfdp::ConditionCode getConditionCode() const; [[nodiscard]] cfdp::ConditionCodes getConditionCode() const;
[[nodiscard]] EntityIdTlv* getFaultLoc() const; [[nodiscard]] EntityIdTlv* getFaultLoc() const;
cfdp::FileSize& getFileSize(); cfdp::FileSize& getFileSize();
void setChecksum(uint32_t checksum); void setChecksum(uint32_t checksum);
void setConditionCode(cfdp::ConditionCode conditionCode); void setConditionCode(cfdp::ConditionCodes conditionCode);
void setFaultLoc(EntityIdTlv* faultLoc); void setFaultLoc(EntityIdTlv* faultLoc);
ReturnValue_t setFileSize(size_t size, bool isLarge); ReturnValue_t setFileSize(size_t size, bool isLarge);
private: private:
cfdp::ConditionCode conditionCode; cfdp::ConditionCodes conditionCode;
uint32_t checksum; uint32_t checksum;
cfdp::FileSize fileSize; cfdp::FileSize fileSize;
EntityIdTlv* faultLoc = nullptr; EntityIdTlv* faultLoc = nullptr;

View File

@ -33,7 +33,7 @@ ReturnValue_t EofPduCreator::serialize(uint8_t **buffer, size_t *size, size_t ma
uint32_t fileSizeValue = info.getFileSize().getSize(); uint32_t fileSizeValue = info.getFileSize().getSize();
result = SerializeAdapter::serialize(&fileSizeValue, buffer, size, maxSize, streamEndianness); result = SerializeAdapter::serialize(&fileSizeValue, buffer, size, maxSize, streamEndianness);
} }
if (info.getFaultLoc() != nullptr and info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) { if (info.getFaultLoc() != nullptr and info.getConditionCode() != cfdp::ConditionCodes::NO_ERROR) {
result = info.getFaultLoc()->serialize(buffer, size, maxSize, streamEndianness); result = info.getFaultLoc()->serialize(buffer, size, maxSize, streamEndianness);
} }
return result; return result;

View File

@ -25,7 +25,7 @@ ReturnValue_t EofPduReader::parseData() {
bufPtr += currentIdx; bufPtr += currentIdx;
deserLen -= currentIdx; deserLen -= currentIdx;
info.setConditionCode(static_cast<cfdp::ConditionCode>(*bufPtr >> 4)); info.setConditionCode(static_cast<cfdp::ConditionCodes>(*bufPtr >> 4));
bufPtr += 1; bufPtr += 1;
deserLen -= 1; deserLen -= 1;
uint32_t checksum = 0; uint32_t checksum = 0;
@ -47,7 +47,7 @@ ReturnValue_t EofPduReader::parseData() {
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) { if (info.getConditionCode() != cfdp::ConditionCodes::NO_ERROR) {
EntityIdTlv* tlvPtr = info.getFaultLoc(); EntityIdTlv* tlvPtr = info.getFaultLoc();
if (tlvPtr == nullptr) { if (tlvPtr == nullptr) {
#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_VERBOSE_LEVEL >= 1

View File

@ -2,7 +2,7 @@
FinishedInfo::FinishedInfo() {} FinishedInfo::FinishedInfo() {}
FinishedInfo::FinishedInfo(cfdp::ConditionCode conditionCode, cfdp::FileDeliveryCode deliveryCode, FinishedInfo::FinishedInfo(cfdp::ConditionCodes conditionCode, cfdp::FileDeliveryCode deliveryCode,
cfdp::FileDeliveryStatus fileStatus) cfdp::FileDeliveryStatus fileStatus)
: conditionCode(conditionCode), deliveryCode(deliveryCode), fileStatus(fileStatus) {} : conditionCode(conditionCode), deliveryCode(deliveryCode), fileStatus(fileStatus) {}
@ -76,9 +76,9 @@ ReturnValue_t FinishedInfo::getFaultLocation(EntityIdTlv** faultLocation) {
return returnvalue::OK; return returnvalue::OK;
} }
cfdp::ConditionCode FinishedInfo::getConditionCode() const { return conditionCode; } cfdp::ConditionCodes FinishedInfo::getConditionCode() const { return conditionCode; }
void FinishedInfo::setConditionCode(cfdp::ConditionCode conditionCode) { void FinishedInfo::setConditionCode(cfdp::ConditionCodes conditionCode) {
this->conditionCode = conditionCode; this->conditionCode = conditionCode;
} }

View File

@ -8,7 +8,7 @@
class FinishedInfo { class FinishedInfo {
public: public:
FinishedInfo(); FinishedInfo();
FinishedInfo(cfdp::ConditionCode conditionCode, cfdp::FileDeliveryCode deliveryCode, FinishedInfo(cfdp::ConditionCodes conditionCode, cfdp::FileDeliveryCode deliveryCode,
cfdp::FileDeliveryStatus fileStatus); cfdp::FileDeliveryStatus fileStatus);
[[nodiscard]] size_t getSerializedSize() const; [[nodiscard]] size_t getSerializedSize() const;
@ -25,15 +25,15 @@ class FinishedInfo {
[[nodiscard]] size_t getFsResponsesLen() const; [[nodiscard]] size_t getFsResponsesLen() const;
void setFilestoreResponsesArrayLen(size_t fsResponsesLen); void setFilestoreResponsesArrayLen(size_t fsResponsesLen);
ReturnValue_t getFaultLocation(EntityIdTlv** entityId); ReturnValue_t getFaultLocation(EntityIdTlv** entityId);
[[nodiscard]] cfdp::ConditionCode getConditionCode() const; [[nodiscard]] cfdp::ConditionCodes getConditionCode() const;
void setConditionCode(cfdp::ConditionCode conditionCode); void setConditionCode(cfdp::ConditionCodes conditionCode);
[[nodiscard]] cfdp::FileDeliveryCode getDeliveryCode() const; [[nodiscard]] cfdp::FileDeliveryCode getDeliveryCode() const;
void setDeliveryCode(cfdp::FileDeliveryCode deliveryCode); void setDeliveryCode(cfdp::FileDeliveryCode deliveryCode);
[[nodiscard]] cfdp::FileDeliveryStatus getFileStatus() const; [[nodiscard]] cfdp::FileDeliveryStatus getFileStatus() const;
void setFileStatus(cfdp::FileDeliveryStatus fileStatus); void setFileStatus(cfdp::FileDeliveryStatus fileStatus);
private: private:
cfdp::ConditionCode conditionCode = cfdp::ConditionCode::NO_CONDITION_FIELD; cfdp::ConditionCodes conditionCode = cfdp::ConditionCodes::NO_CONDITION_FIELD;
cfdp::FileDeliveryCode deliveryCode = cfdp::FileDeliveryCode::DATA_COMPLETE; cfdp::FileDeliveryCode deliveryCode = cfdp::FileDeliveryCode::DATA_COMPLETE;
cfdp::FileDeliveryStatus fileStatus = cfdp::FileDeliveryStatus::DISCARDED_DELIBERATELY; cfdp::FileDeliveryStatus fileStatus = cfdp::FileDeliveryStatus::DISCARDED_DELIBERATELY;
FilestoreResponseTlv** fsResponses = nullptr; FilestoreResponseTlv** fsResponses = nullptr;

View File

@ -15,7 +15,7 @@ ReturnValue_t FinishPduReader::parseData() {
return SerializeIF::STREAM_TOO_SHORT; return SerializeIF::STREAM_TOO_SHORT;
} }
uint8_t firstByte = *buf; uint8_t firstByte = *buf;
auto condCode = static_cast<cfdp::ConditionCode>((firstByte >> 4) & 0x0f); auto condCode = static_cast<cfdp::ConditionCodes>((firstByte >> 4) & 0x0f);
finishedInfo.setConditionCode(condCode); finishedInfo.setConditionCode(condCode);
finishedInfo.setDeliveryCode(static_cast<cfdp::FileDeliveryCode>(firstByte >> 2 & 0b1)); finishedInfo.setDeliveryCode(static_cast<cfdp::FileDeliveryCode>(firstByte >> 2 & 0b1));
finishedInfo.setFileStatus(static_cast<cfdp::FileDeliveryStatus>(firstByte & 0b11)); finishedInfo.setFileStatus(static_cast<cfdp::FileDeliveryStatus>(firstByte & 0b11));
@ -31,7 +31,7 @@ ReturnValue_t FinishPduReader::parseData() {
FinishedInfo& FinishPduReader::getInfo() { return finishedInfo; } FinishedInfo& FinishPduReader::getInfo() { return finishedInfo; }
ReturnValue_t FinishPduReader::parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf, ReturnValue_t FinishPduReader::parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf,
cfdp::ConditionCode conditionCode) { cfdp::ConditionCodes conditionCode) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
size_t fsResponsesIdx = 0; size_t fsResponsesIdx = 0;
auto endianness = getEndianness(); auto endianness = getEndianness();
@ -66,8 +66,8 @@ ReturnValue_t FinishPduReader::parseTlvs(size_t remLen, size_t currentIdx, const
} else if (nextTlv == cfdp::TlvTypes::ENTITY_ID) { } else if (nextTlv == cfdp::TlvTypes::ENTITY_ID) {
// This needs to be the last TLV and it should not be here if the condition code // This needs to be the last TLV and it should not be here if the condition code
// is "No Error" or "Unsupported Checksum Type" // is "No Error" or "Unsupported Checksum Type"
if (conditionCode == cfdp::ConditionCode::NO_ERROR or if (conditionCode == cfdp::ConditionCodes::NO_ERROR or
conditionCode == cfdp::ConditionCode::UNSUPPORTED_CHECKSUM_TYPE) { conditionCode == cfdp::ConditionCodes::UNSUPPORTED_CHECKSUM_TYPE) {
return cfdp::INVALID_TLV_TYPE; return cfdp::INVALID_TLV_TYPE;
} }
result = finishedInfo.getFaultLocation(&faultLocation); result = finishedInfo.getFaultLocation(&faultLocation);

View File

@ -16,7 +16,7 @@ class FinishPduReader : public FileDirectiveReader {
FinishedInfo& finishedInfo; FinishedInfo& finishedInfo;
ReturnValue_t parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf, ReturnValue_t parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf,
cfdp::ConditionCode conditionCode); cfdp::ConditionCodes conditionCode);
}; };
#endif /* FSFW_CFDP_PDU_FINISHEDPDUDESERIALIZER_H_ */ #endif /* FSFW_CFDP_PDU_FINISHEDPDUDESERIALIZER_H_ */

View File

@ -1,6 +1,6 @@
#include "FaultHandlerOverrideTlv.h" #include "FaultHandlerOverrideTlv.h"
FaultHandlerOverrideTlv::FaultHandlerOverrideTlv(cfdp::ConditionCode conditionCode, FaultHandlerOverrideTlv::FaultHandlerOverrideTlv(cfdp::ConditionCodes conditionCode,
cfdp::FaultHandlerCodes handlerCode) cfdp::FaultHandlerCodes handlerCode)
: conditionCode(conditionCode), handlerCode(handlerCode) {} : conditionCode(conditionCode), handlerCode(handlerCode) {}
@ -44,7 +44,7 @@ ReturnValue_t FaultHandlerOverrideTlv::deSerialize(const uint8_t **buffer, size_
} }
*buffer += 1; *buffer += 1;
*size += 1; *size += 1;
this->conditionCode = static_cast<cfdp::ConditionCode>((**buffer >> 4) & 0x0f); this->conditionCode = static_cast<cfdp::ConditionCodes>((**buffer >> 4) & 0x0f);
this->handlerCode = static_cast<cfdp::FaultHandlerCodes>(**buffer & 0x0f); this->handlerCode = static_cast<cfdp::FaultHandlerCodes>(**buffer & 0x0f);
*buffer += 1; *buffer += 1;
*size += 1; *size += 1;

View File

@ -6,7 +6,7 @@
class FaultHandlerOverrideTlv : public TlvIF { class FaultHandlerOverrideTlv : public TlvIF {
public: public:
FaultHandlerOverrideTlv(); FaultHandlerOverrideTlv();
FaultHandlerOverrideTlv(cfdp::ConditionCode conditionCode, cfdp::FaultHandlerCodes handlerCode); FaultHandlerOverrideTlv(cfdp::ConditionCodes conditionCode, cfdp::FaultHandlerCodes handlerCode);
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const override; Endianness streamEndianness) const override;
@ -19,7 +19,7 @@ class FaultHandlerOverrideTlv : public TlvIF {
[[nodiscard]] cfdp::TlvTypes getType() const override; [[nodiscard]] cfdp::TlvTypes getType() const override;
private: private:
cfdp::ConditionCode conditionCode = cfdp::ConditionCode::NO_CONDITION_FIELD; cfdp::ConditionCodes conditionCode = cfdp::ConditionCodes::NO_CONDITION_FIELD;
cfdp::FaultHandlerCodes handlerCode = cfdp::FaultHandlerCodes::RESERVED; cfdp::FaultHandlerCodes handlerCode = cfdp::FaultHandlerCodes::RESERVED;
}; };