finished renaming operation

This commit is contained in:
Robin Müller 2022-09-14 19:48:11 +02:00
parent 73f1917c81
commit 2e27a85c95
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
19 changed files with 125 additions and 128 deletions

View File

@ -12,18 +12,18 @@ target_sources(
EofPduCreator.cpp
EofPduReader.cpp
NakInfo.cpp
NakPduSerializer.cpp
NakPduDeserializer.cpp
NakPduCreator.cpp
NakPduReader.cpp
FinishedInfo.cpp
FinishedPduCreator.cpp
FinishedPduReader.cpp
MetadataInfo.cpp
MetadataPduCreator.cpp
MetadataPduReader.cpp
KeepAlivePduSerializer.cpp
KeepAlivePduDeserializer.cpp
PromptPduSerializer.cpp
PromptPduDeserializer.cpp
KeepAlivePduCreator.cpp
KeepAlivePduReader.cpp
PromptPduCreator.cpp
PromptPduReader.cpp
FileDataCreator.cpp
FileDataReader.cpp
FileDataInfo.cpp)

View File

@ -1,22 +1,22 @@
#include "KeepAlivePduSerializer.h"
#include "KeepAlivePduCreator.h"
KeepAlivePduSerializer::KeepAlivePduSerializer(PduConfig &conf, cfdp::FileSize &progress)
KeepAlivePduCreator::KeepAlivePduCreator(PduConfig &conf, cfdp::FileSize &progress)
: FileDirectiveCreator(conf, cfdp::FileDirectives::KEEP_ALIVE, 4), progress(progress) {
updateDirectiveFieldLen();
}
size_t KeepAlivePduSerializer::getSerializedSize() const {
size_t KeepAlivePduCreator::getSerializedSize() const {
return FileDirectiveCreator::getWholePduSize();
}
void KeepAlivePduSerializer::updateDirectiveFieldLen() {
void KeepAlivePduCreator::updateDirectiveFieldLen() {
if (this->getLargeFileFlag()) {
this->setDirectiveDataFieldLen(8);
}
}
ReturnValue_t KeepAlivePduSerializer::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const {
ReturnValue_t KeepAlivePduCreator::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const {
ReturnValue_t result = FileDirectiveCreator::serialize(buffer, size, maxSize, streamEndianness);
if (result != returnvalue::OK) {
return result;

View File

@ -0,0 +1,22 @@
#ifndef FSFW_CFDP_PDU_KEEPALIVEPDUSERIALIZER_H_
#define FSFW_CFDP_PDU_KEEPALIVEPDUSERIALIZER_H_
#include "fsfw/cfdp/FileSize.h"
#include "fsfw/cfdp/pdu/FileDirectiveCreator.h"
class KeepAlivePduCreator : public FileDirectiveCreator {
public:
KeepAlivePduCreator(PduConfig& conf, cfdp::FileSize& progress);
void updateDirectiveFieldLen();
[[nodiscard]] size_t getSerializedSize() const override;
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override;
private:
cfdp::FileSize& progress;
};
#endif /* FSFW_CFDP_PDU_KEEPALIVEPDUSERIALIZER_H_ */

View File

@ -1,19 +0,0 @@
#ifndef FSFW_SRC_FSFW_CFDP_PDU_KEEPALIVEPDUDESERIALIZER_H_
#define FSFW_SRC_FSFW_CFDP_PDU_KEEPALIVEPDUDESERIALIZER_H_
#include "fsfw/cfdp/FileSize.h"
#include "fsfw/cfdp/pdu/FileDirectiveReader.h"
class KeepAlivePduDeserializer : public FileDirectiveReader {
public:
KeepAlivePduDeserializer(const uint8_t* pduBuf, size_t maxSize, cfdp::FileSize& progress);
ReturnValue_t parseData() override;
cfdp::FileSize& getProgress();
private:
cfdp::FileSize& progress;
};
#endif /* FSFW_SRC_FSFW_CFDP_PDU_KEEPALIVEPDUDESERIALIZER_H_ */

View File

@ -1,10 +1,10 @@
#include "KeepAlivePduDeserializer.h"
#include "KeepAlivePduReader.h"
KeepAlivePduDeserializer::KeepAlivePduDeserializer(const uint8_t* pduBuf, size_t maxSize,
cfdp::FileSize& progress)
KeepAlivePduReader::KeepAlivePduReader(const uint8_t* pduBuf, size_t maxSize,
cfdp::FileSize& progress)
: FileDirectiveReader(pduBuf, maxSize), progress(progress) {}
ReturnValue_t KeepAlivePduDeserializer::parseData() {
ReturnValue_t KeepAlivePduReader::parseData() {
ReturnValue_t result = FileDirectiveReader::parseData();
if (result != returnvalue::OK) {
return result;
@ -15,4 +15,4 @@ ReturnValue_t KeepAlivePduDeserializer::parseData() {
return progress.deSerialize(&buffer, &remLen, getEndianness());
}
cfdp::FileSize& KeepAlivePduDeserializer::getProgress() { return progress; }
cfdp::FileSize& KeepAlivePduReader::getProgress() { return progress; }

View File

@ -0,0 +1,19 @@
#ifndef FSFW_CFDP_PDU_KEEPALIVEREADER_H_
#define FSFW_CFDP_PDU_KEEPALIVEREADER_H_
#include "fsfw/cfdp/FileSize.h"
#include "fsfw/cfdp/pdu/FileDirectiveReader.h"
class KeepAlivePduReader : public FileDirectiveReader {
public:
KeepAlivePduReader(const uint8_t* pduBuf, size_t maxSize, cfdp::FileSize& progress);
ReturnValue_t parseData() override;
cfdp::FileSize& getProgress();
private:
cfdp::FileSize& progress;
};
#endif /* FSFW_CFDP_PDU_KEEPALIVEPDUREADER_H_ */

View File

@ -1,22 +0,0 @@
#ifndef FSFW_SRC_FSFW_CFDP_PDU_KEEPALIVEPDUSERIALIZER_H_
#define FSFW_SRC_FSFW_CFDP_PDU_KEEPALIVEPDUSERIALIZER_H_
#include "fsfw/cfdp/FileSize.h"
#include "fsfw/cfdp/pdu/FileDirectiveCreator.h"
class KeepAlivePduSerializer : public FileDirectiveCreator {
public:
KeepAlivePduSerializer(PduConfig& conf, cfdp::FileSize& progress);
void updateDirectiveFieldLen();
size_t getSerializedSize() const override;
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override;
private:
cfdp::FileSize& progress;
};
#endif /* FSFW_SRC_FSFW_CFDP_PDU_KEEPALIVEPDUSERIALIZER_H_ */

View File

@ -1,20 +1,18 @@
#include "NakPduSerializer.h"
#include "NakPduCreator.h"
NakPduSerializer::NakPduSerializer(PduConfig &pduConf, NakInfo &nakInfo)
NakPduCreator::NakPduCreator(PduConfig &pduConf, NakInfo &nakInfo)
: FileDirectiveCreator(pduConf, cfdp::FileDirectives::NAK, 0), nakInfo(nakInfo) {
updateDirectiveFieldLen();
}
void NakPduSerializer::updateDirectiveFieldLen() {
void NakPduCreator::updateDirectiveFieldLen() {
this->setDirectiveDataFieldLen(nakInfo.getSerializedSize(getLargeFileFlag()));
}
size_t NakPduSerializer::getSerializedSize() const {
return FileDirectiveCreator::getWholePduSize();
}
size_t NakPduCreator::getSerializedSize() const { return FileDirectiveCreator::getWholePduSize(); }
ReturnValue_t NakPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const {
ReturnValue_t NakPduCreator::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const {
ReturnValue_t result = FileDirectiveCreator::serialize(buffer, size, maxSize, streamEndianness);
if (result != returnvalue::OK) {
return result;

View File

@ -1,5 +1,5 @@
#ifndef FSFW_SRC_FSFW_CFDP_PDU_NAKPDUSERIALIZER_H_
#define FSFW_SRC_FSFW_CFDP_PDU_NAKPDUSERIALIZER_H_
#ifndef FSFW_CFDP_PDU_NAKPDUSERIALIZER_H_
#define FSFW_CFDP_PDU_NAKPDUSERIALIZER_H_
#include <vector>
@ -8,7 +8,7 @@
#include "fsfw/cfdp/definitions.h"
#include "fsfw/cfdp/pdu/FileDirectiveCreator.h"
class NakPduSerializer : public FileDirectiveCreator {
class NakPduCreator : public FileDirectiveCreator {
public:
/**
*
@ -18,9 +18,9 @@ class NakPduSerializer : public FileDirectiveCreator {
* @param [in] segmentRequests Pointer to the start of a list of segment requests
* @param segmentRequestLen Length of the segment request list to be serialized
*/
NakPduSerializer(PduConfig& PduConf, NakInfo& nakInfo);
NakPduCreator(PduConfig& PduConf, NakInfo& nakInfo);
size_t getSerializedSize() const override;
[[nodiscard]] size_t getSerializedSize() const override;
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override;
@ -35,4 +35,4 @@ class NakPduSerializer : public FileDirectiveCreator {
NakInfo& nakInfo;
};
#endif /* FSFW_SRC_FSFW_CFDP_PDU_NAKPDUSERIALIZER_H_ */
#endif /* FSFW_CFDP_PDU_NAKPDUSERIALIZER_H_ */

View File

@ -1,21 +0,0 @@
#ifndef FSFW_SRC_FSFW_CFDP_PDU_NAKPDUDESERIALIZER_H_
#define FSFW_SRC_FSFW_CFDP_PDU_NAKPDUDESERIALIZER_H_
#include "fsfw/cfdp/pdu/FileDirectiveReader.h"
#include "fsfw/cfdp/pdu/NakInfo.h"
class NakPduDeserializer : public FileDirectiveReader {
public:
NakPduDeserializer(const uint8_t* pduBuf, size_t maxSize, NakInfo& info);
/**
* This needs to be called before accessing the PDU fields to avoid segmentation faults.
* @return
*/
virtual ReturnValue_t parseData() override;
private:
NakInfo& nakInfo;
};
#endif /* FSFW_SRC_FSFW_CFDP_PDU_NAKPDUDESERIALIZER_H_ */

View File

@ -1,9 +1,9 @@
#include "NakPduDeserializer.h"
#include "NakPduReader.h"
NakPduDeserializer::NakPduDeserializer(const uint8_t* pduBuf, size_t maxSize, NakInfo& info)
NakPduReader::NakPduReader(const uint8_t* pduBuf, size_t maxSize, NakInfo& info)
: FileDirectiveReader(pduBuf, maxSize), nakInfo(info) {}
ReturnValue_t NakPduDeserializer::parseData() {
ReturnValue_t NakPduReader::parseData() {
ReturnValue_t result = FileDirectiveReader::parseData();
if (result != returnvalue::OK) {
return result;

View File

@ -0,0 +1,21 @@
#ifndef FSFW_CFDP_PDU_NAKPDUDESERIALIZER_H_
#define FSFW_CFDP_PDU_NAKPDUDESERIALIZER_H_
#include "fsfw/cfdp/pdu/FileDirectiveReader.h"
#include "fsfw/cfdp/pdu/NakInfo.h"
class NakPduReader : public FileDirectiveReader {
public:
NakPduReader(const uint8_t* pduBuf, size_t maxSize, NakInfo& info);
/**
* This needs to be called before accessing the PDU fields to avoid segmentation faults.
* @return
*/
ReturnValue_t parseData() override;
private:
NakInfo& nakInfo;
};
#endif /* FSFW_CFDP_PDU_NAKPDUDESERIALIZER_H_ */

View File

@ -1,16 +1,15 @@
#include "PromptPduSerializer.h"
#include "PromptPduCreator.h"
PromptPduSerializer::PromptPduSerializer(PduConfig &conf,
cfdp::PromptResponseRequired responseRequired)
PromptPduCreator::PromptPduCreator(PduConfig &conf, cfdp::PromptResponseRequired responseRequired)
: FileDirectiveCreator(conf, cfdp::FileDirectives::PROMPT, 1),
responseRequired(responseRequired) {}
size_t PromptPduSerializer::getSerializedSize() const {
size_t PromptPduCreator::getSerializedSize() const {
return FileDirectiveCreator::getWholePduSize();
}
ReturnValue_t PromptPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const {
ReturnValue_t PromptPduCreator::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const {
ReturnValue_t result = FileDirectiveCreator::serialize(buffer, size, maxSize, streamEndianness);
if (result != returnvalue::OK) {
return result;

View File

@ -3,9 +3,9 @@
#include "fsfw/cfdp/pdu/FileDirectiveCreator.h"
class PromptPduSerializer : public FileDirectiveCreator {
class PromptPduCreator : public FileDirectiveCreator {
public:
PromptPduSerializer(PduConfig& conf, cfdp::PromptResponseRequired responseRequired);
PromptPduCreator(PduConfig& conf, cfdp::PromptResponseRequired responseRequired);
[[nodiscard]] size_t getSerializedSize() const override;

View File

@ -1,13 +1,13 @@
#include "PromptPduDeserializer.h"
#include "PromptPduReader.h"
PromptPduDeserializer::PromptPduDeserializer(const uint8_t *pduBuf, size_t maxSize)
PromptPduReader::PromptPduReader(const uint8_t *pduBuf, size_t maxSize)
: FileDirectiveReader(pduBuf, maxSize) {}
cfdp::PromptResponseRequired PromptPduDeserializer::getPromptResponseRequired() const {
cfdp::PromptResponseRequired PromptPduReader::getPromptResponseRequired() const {
return responseRequired;
}
ReturnValue_t PromptPduDeserializer::parseData() {
ReturnValue_t PromptPduReader::parseData() {
ReturnValue_t result = FileDirectiveReader::parseData();
if (result != returnvalue::OK) {
return result;

View File

@ -3,9 +3,9 @@
#include "fsfw/cfdp/pdu/FileDirectiveReader.h"
class PromptPduDeserializer : public FileDirectiveReader {
class PromptPduReader : public FileDirectiveReader {
public:
PromptPduDeserializer(const uint8_t *pduBuf, size_t maxSize);
PromptPduReader(const uint8_t *pduBuf, size_t maxSize);
[[nodiscard]] cfdp::PromptResponseRequired getPromptResponseRequired() const;
ReturnValue_t parseData() override;

View File

@ -1,8 +1,8 @@
#include <array>
#include <catch2/catch_test_macros.hpp>
#include "fsfw/cfdp/pdu/KeepAlivePduDeserializer.h"
#include "fsfw/cfdp/pdu/KeepAlivePduSerializer.h"
#include "fsfw/cfdp/pdu/KeepAlivePduCreator.h"
#include "fsfw/cfdp/pdu/KeepAlivePduReader.h"
#include "fsfw/globalfunctions/arrayprinter.h"
TEST_CASE("Keep Alive PDU", "[cfdp][pdu]") {
@ -19,7 +19,7 @@ TEST_CASE("Keep Alive PDU", "[cfdp][pdu]") {
FileSize progress(0x50);
SECTION("Serialize") {
KeepAlivePduSerializer serializer(pduConf, progress);
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);
@ -55,13 +55,13 @@ TEST_CASE("Keep Alive PDU", "[cfdp][pdu]") {
}
SECTION("Deserialize") {
KeepAlivePduSerializer serializer(pduConf, progress);
KeepAlivePduCreator serializer(pduConf, progress);
result = serializer.serialize(&buffer, &sz, kaBuffer.size(), SerializeIF::Endianness::NETWORK);
REQUIRE(result == returnvalue::OK);
// Set another file size
progress.setFileSize(200, false);
KeepAlivePduDeserializer reader(kaBuffer.data(), kaBuffer.size(), progress);
KeepAlivePduReader reader(kaBuffer.data(), kaBuffer.size(), progress);
result = reader.parseData();
REQUIRE(result == returnvalue::OK);
auto& progRef = reader.getProgress();

View File

@ -1,8 +1,8 @@
#include <array>
#include <catch2/catch_test_macros.hpp>
#include "fsfw/cfdp/pdu/NakPduDeserializer.h"
#include "fsfw/cfdp/pdu/NakPduSerializer.h"
#include "fsfw/cfdp/pdu/NakPduCreator.h"
#include "fsfw/cfdp/pdu/NakPduReader.h"
#include "fsfw/cfdp/pdu/PduConfig.h"
#include "fsfw/globalfunctions/arrayprinter.h"
@ -21,7 +21,7 @@ TEST_CASE("NAK PDU", "[cfdp][pdu]") {
FileSize endOfScope(1050);
NakInfo info(startOfScope, endOfScope);
SECTION("Serializer") {
NakPduSerializer serializer(pduConf, info);
NakPduCreator serializer(pduConf, info);
result = serializer.serialize(&buffer, &sz, nakBuffer.size(), SerializeIF::Endianness::NETWORK);
REQUIRE(result == returnvalue::OK);
REQUIRE(serializer.getSerializedSize() == 19);
@ -87,13 +87,13 @@ TEST_CASE("NAK PDU", "[cfdp][pdu]") {
}
SECTION("Deserializer") {
NakPduSerializer serializer(pduConf, info);
NakPduCreator serializer(pduConf, info);
result = serializer.serialize(&buffer, &sz, nakBuffer.size(), SerializeIF::Endianness::NETWORK);
REQUIRE(result == returnvalue::OK);
info.getStartOfScope().setFileSize(0, false);
info.getEndOfScope().setFileSize(0, false);
NakPduDeserializer deserializer(nakBuffer.data(), nakBuffer.size(), info);
NakPduReader deserializer(nakBuffer.data(), nakBuffer.size(), info);
result = deserializer.parseData();
REQUIRE(result == returnvalue::OK);
REQUIRE(deserializer.getWholePduSize() == 19);
@ -112,7 +112,7 @@ TEST_CASE("NAK PDU", "[cfdp][pdu]") {
result = serializer.serialize(&buffer, &sz, nakBuffer.size(), SerializeIF::Endianness::NETWORK);
REQUIRE(result == returnvalue::OK);
NakPduDeserializer deserializeWithSegReqs(nakBuffer.data(), nakBuffer.size(), info);
NakPduReader deserializeWithSegReqs(nakBuffer.data(), nakBuffer.size(), info);
result = deserializeWithSegReqs.parseData();
REQUIRE(result == returnvalue::OK);
NakInfo::SegmentRequest* segReqsPtr = nullptr;
@ -126,14 +126,14 @@ TEST_CASE("NAK PDU", "[cfdp][pdu]") {
REQUIRE(deserializeWithSegReqs.getPduDataFieldLen() == 25);
REQUIRE(info.getSegmentRequestsLen() == 2);
for (size_t idx = 0; idx < 34; idx++) {
NakPduDeserializer faultyDeserializer(nakBuffer.data(), idx, info);
NakPduReader faultyDeserializer(nakBuffer.data(), idx, info);
result = faultyDeserializer.parseData();
REQUIRE(result != returnvalue::OK);
}
for (size_t pduFieldLen = 0; pduFieldLen < 25; pduFieldLen++) {
nakBuffer[1] = (pduFieldLen >> 8) & 0xff;
nakBuffer[2] = pduFieldLen & 0xff;
NakPduDeserializer faultyDeserializer(nakBuffer.data(), nakBuffer.size(), info);
NakPduReader faultyDeserializer(nakBuffer.data(), nakBuffer.size(), info);
result = faultyDeserializer.parseData();
if (pduFieldLen == 9) {
REQUIRE(info.getSegmentRequestsLen() == 0);

View File

@ -1,8 +1,8 @@
#include <array>
#include <catch2/catch_test_macros.hpp>
#include "fsfw/cfdp/pdu/PromptPduDeserializer.h"
#include "fsfw/cfdp/pdu/PromptPduSerializer.h"
#include "fsfw/cfdp/pdu/PromptPduCreator.h"
#include "fsfw/cfdp/pdu/PromptPduReader.h"
#include "fsfw/globalfunctions/arrayprinter.h"
TEST_CASE("Prompt PDU", "[cfdp][pdu]") {
@ -17,7 +17,7 @@ TEST_CASE("Prompt PDU", "[cfdp][pdu]") {
PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
SECTION("Serialize") {
PromptPduSerializer serializer(pduConf, cfdp::PromptResponseRequired::PROMPT_KEEP_ALIVE);
PromptPduCreator serializer(pduConf, cfdp::PromptResponseRequired::PROMPT_KEEP_ALIVE);
result = serializer.serialize(&buffer, &sz, rawBuf.size(), SerializeIF::Endianness::NETWORK);
REQUIRE(result == returnvalue::OK);
REQUIRE(serializer.getWholePduSize() == 12);
@ -41,11 +41,11 @@ TEST_CASE("Prompt PDU", "[cfdp][pdu]") {
}
SECTION("Deserialize") {
PromptPduSerializer serializer(pduConf, cfdp::PromptResponseRequired::PROMPT_KEEP_ALIVE);
PromptPduCreator serializer(pduConf, cfdp::PromptResponseRequired::PROMPT_KEEP_ALIVE);
result = serializer.serialize(&buffer, &sz, rawBuf.size(), SerializeIF::Endianness::NETWORK);
REQUIRE(result == returnvalue::OK);
PromptPduDeserializer deserializer(rawBuf.data(), rawBuf.size());
PromptPduReader deserializer(rawBuf.data(), rawBuf.size());
result = deserializer.parseData();
REQUIRE(result == returnvalue::OK);
REQUIRE(deserializer.getPromptResponseRequired() ==