some more returncodes
All checks were successful
fsfw/fsfw/pipeline/pr-development This commit looks good

This commit is contained in:
Robin Müller 2022-09-08 11:53:06 +02:00
parent c87667c03f
commit ec1e07b466
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
7 changed files with 12 additions and 11 deletions

View File

@ -20,7 +20,7 @@ static constexpr uint8_t VERSION_BITS = CFDP_VERSION_2 << 5;
static constexpr uint8_t CFDP_CLASS_ID = CLASS_ID::CFDP;
static constexpr ReturnValue_t INVALID_TLV_TYPE = returnvalue::makeCode(CFDP_CLASS_ID, 1);
static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS = returnvalue::makeCode(CFDP_CLASS_ID, 2);
static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELD = returnvalue::makeCode(CFDP_CLASS_ID, 2);
static constexpr ReturnValue_t INVALID_PDU_DATAFIELD_LEN = returnvalue::makeCode(CFDP_CLASS_ID, 3);
static constexpr ReturnValue_t INVALID_ACK_DIRECTIVE_FIELDS =
returnvalue::makeCode(CFDP_CLASS_ID, 4);
@ -30,13 +30,14 @@ static constexpr ReturnValue_t METADATA_CANT_PARSE_OPTIONS =
returnvalue::makeCode(CFDP_CLASS_ID, 5);
static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS = returnvalue::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FINISHED_CANT_PARSE_FS_RESPONSES =
returnvalue::makeCode(CFDP_CLASS_ID, 6);
returnvalue::makeCode(CFDP_CLASS_ID, 7);
static constexpr ReturnValue_t FILESTORE_REQUIRES_SECOND_FILE =
returnvalue::makeCode(CFDP_CLASS_ID, 8);
//! Can not parse filestore response because user did not pass a valid instance
//! or remaining size is invalid
static constexpr ReturnValue_t FILESTORE_RESPONSE_CANT_PARSE_FS_MESSAGE =
returnvalue::makeCode(CFDP_CLASS_ID, 9);
static constexpr ReturnValue_t INVALID_PDU_FORMAT = returnvalue::makeCode(CFDP_CLASS_ID, 10);
//! Checksum types according to the SANA Checksum Types registry
//! https://sanaregistry.org/r/checksum_identifiers/
@ -71,6 +72,7 @@ enum WidthInBytes : uint8_t {
enum FileDirectives : uint8_t {
INVALID_DIRECTIVE = 0x0f,
// The _DIRECTIVE suffix is mandatory here because of some nameclash!
EOF_DIRECTIVE = 0x04,
FINISH = 0x05,
ACK = 0x06,

View File

@ -62,9 +62,9 @@ struct DestHandlerParams {
};
struct FsfwParams {
FsfwParams(AcceptsTelemetryIF& packetDest, MessageQueueIF* msgQueue,
EventReportingProxyIF* eventReporter, StorageManagerIF& tcStore, StorageManagerIF& tmStore)
EventReportingProxyIF* eventReporter, StorageManagerIF& tcStore,
StorageManagerIF& tmStore)
: FsfwParams(packetDest, msgQueue, eventReporter) {
this->tcStore = &tcStore;
this->tmStore = &tmStore;

View File

@ -18,7 +18,7 @@ ReturnValue_t FileDirectiveReader::parseData() {
}
size_t currentIdx = PduHeaderReader::getHeaderSize();
if (not checkFileDirective(pointers.rawPtr[currentIdx])) {
return cfdp::INVALID_DIRECTIVE_FIELDS;
return cfdp::INVALID_DIRECTIVE_FIELD;
}
setFileDirective(static_cast<cfdp::FileDirectives>(pointers.rawPtr[currentIdx]));
return returnvalue::OK;
@ -32,7 +32,7 @@ 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)) {
// Invalid directive field. TODO: Custom returnvalue
// Invalid directive field
return false;
}
return true;

View File

@ -26,10 +26,9 @@ class FileDirectiveReader : public PduHeaderReader {
void setEndianness(SerializeIF::Endianness endianness);
[[nodiscard]] SerializeIF::Endianness getEndianness() const;
protected:
static bool checkFileDirective(uint8_t rawByte);
protected:
private:
void setFileDirective(cfdp::FileDirectives fileDirective);
cfdp::FileDirectives fileDirective = cfdp::FileDirectives::INVALID_DIRECTIVE;

View File

@ -91,7 +91,7 @@ TEST_CASE("ACK PDU", "[cfdp][pdu]") {
buf[sz - 2] = prevVal;
buf[sz - 3] = cfdp::FileDirectives::INVALID_DIRECTIVE;
result = reader2.parseData();
REQUIRE(result == cfdp::INVALID_DIRECTIVE_FIELDS);
REQUIRE(result == cfdp::INVALID_DIRECTIVE_FIELD);
buf[sz - 3] = cfdp::FileDirectives::ACK;
auto maxSizeTooSmall = AckPduDeserializer(buf.data(), sz - 2, ackInfo2);
result = maxSizeTooSmall.parseData();

View File

@ -80,6 +80,6 @@ TEST_CASE("CFDP File Directive", "[cfdp][pdu]") {
serBuf[7] = 0xff;
// Invalid file directive
REQUIRE(fdDeser.parseData() == cfdp::INVALID_DIRECTIVE_FIELDS);
REQUIRE(fdDeser.parseData() == cfdp::INVALID_DIRECTIVE_FIELD);
}
}

View File

@ -72,7 +72,7 @@ TEST_CASE("CFDP Base", "[cfdp]") {
serBuf[7] = 0xff;
// Invalid file directive
REQUIRE(fdDeser.parseData() == cfdp::INVALID_DIRECTIVE_FIELDS);
REQUIRE(fdDeser.parseData() == cfdp::INVALID_DIRECTIVE_FIELD);
}
SECTION("File Size") {