finished renaming operation
This commit is contained in:
parent
73f1917c81
commit
2e27a85c95
@ -12,18 +12,18 @@ target_sources(
|
|||||||
EofPduCreator.cpp
|
EofPduCreator.cpp
|
||||||
EofPduReader.cpp
|
EofPduReader.cpp
|
||||||
NakInfo.cpp
|
NakInfo.cpp
|
||||||
NakPduSerializer.cpp
|
NakPduCreator.cpp
|
||||||
NakPduDeserializer.cpp
|
NakPduReader.cpp
|
||||||
FinishedInfo.cpp
|
FinishedInfo.cpp
|
||||||
FinishedPduCreator.cpp
|
FinishedPduCreator.cpp
|
||||||
FinishedPduReader.cpp
|
FinishedPduReader.cpp
|
||||||
MetadataInfo.cpp
|
MetadataInfo.cpp
|
||||||
MetadataPduCreator.cpp
|
MetadataPduCreator.cpp
|
||||||
MetadataPduReader.cpp
|
MetadataPduReader.cpp
|
||||||
KeepAlivePduSerializer.cpp
|
KeepAlivePduCreator.cpp
|
||||||
KeepAlivePduDeserializer.cpp
|
KeepAlivePduReader.cpp
|
||||||
PromptPduSerializer.cpp
|
PromptPduCreator.cpp
|
||||||
PromptPduDeserializer.cpp
|
PromptPduReader.cpp
|
||||||
FileDataCreator.cpp
|
FileDataCreator.cpp
|
||||||
FileDataReader.cpp
|
FileDataReader.cpp
|
||||||
FileDataInfo.cpp)
|
FileDataInfo.cpp)
|
||||||
|
@ -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) {
|
: FileDirectiveCreator(conf, cfdp::FileDirectives::KEEP_ALIVE, 4), progress(progress) {
|
||||||
updateDirectiveFieldLen();
|
updateDirectiveFieldLen();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t KeepAlivePduSerializer::getSerializedSize() const {
|
size_t KeepAlivePduCreator::getSerializedSize() const {
|
||||||
return FileDirectiveCreator::getWholePduSize();
|
return FileDirectiveCreator::getWholePduSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeepAlivePduSerializer::updateDirectiveFieldLen() {
|
void KeepAlivePduCreator::updateDirectiveFieldLen() {
|
||||||
if (this->getLargeFileFlag()) {
|
if (this->getLargeFileFlag()) {
|
||||||
this->setDirectiveDataFieldLen(8);
|
this->setDirectiveDataFieldLen(8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t KeepAlivePduSerializer::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
ReturnValue_t KeepAlivePduCreator::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
ReturnValue_t result = FileDirectiveCreator::serialize(buffer, size, maxSize, streamEndianness);
|
ReturnValue_t result = FileDirectiveCreator::serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
22
src/fsfw/cfdp/pdu/KeepAlivePduCreator.h
Normal file
22
src/fsfw/cfdp/pdu/KeepAlivePduCreator.h
Normal 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_ */
|
@ -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_ */
|
|
@ -1,10 +1,10 @@
|
|||||||
#include "KeepAlivePduDeserializer.h"
|
#include "KeepAlivePduReader.h"
|
||||||
|
|
||||||
KeepAlivePduDeserializer::KeepAlivePduDeserializer(const uint8_t* pduBuf, size_t maxSize,
|
KeepAlivePduReader::KeepAlivePduReader(const uint8_t* pduBuf, size_t maxSize,
|
||||||
cfdp::FileSize& progress)
|
cfdp::FileSize& progress)
|
||||||
: FileDirectiveReader(pduBuf, maxSize), progress(progress) {}
|
: FileDirectiveReader(pduBuf, maxSize), progress(progress) {}
|
||||||
|
|
||||||
ReturnValue_t KeepAlivePduDeserializer::parseData() {
|
ReturnValue_t KeepAlivePduReader::parseData() {
|
||||||
ReturnValue_t result = FileDirectiveReader::parseData();
|
ReturnValue_t result = FileDirectiveReader::parseData();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -15,4 +15,4 @@ ReturnValue_t KeepAlivePduDeserializer::parseData() {
|
|||||||
return progress.deSerialize(&buffer, &remLen, getEndianness());
|
return progress.deSerialize(&buffer, &remLen, getEndianness());
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdp::FileSize& KeepAlivePduDeserializer::getProgress() { return progress; }
|
cfdp::FileSize& KeepAlivePduReader::getProgress() { return progress; }
|
19
src/fsfw/cfdp/pdu/KeepAlivePduReader.h
Normal file
19
src/fsfw/cfdp/pdu/KeepAlivePduReader.h
Normal 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_ */
|
@ -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_ */
|
|
@ -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) {
|
: FileDirectiveCreator(pduConf, cfdp::FileDirectives::NAK, 0), nakInfo(nakInfo) {
|
||||||
updateDirectiveFieldLen();
|
updateDirectiveFieldLen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NakPduSerializer::updateDirectiveFieldLen() {
|
void NakPduCreator::updateDirectiveFieldLen() {
|
||||||
this->setDirectiveDataFieldLen(nakInfo.getSerializedSize(getLargeFileFlag()));
|
this->setDirectiveDataFieldLen(nakInfo.getSerializedSize(getLargeFileFlag()));
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t NakPduSerializer::getSerializedSize() const {
|
size_t NakPduCreator::getSerializedSize() const { return FileDirectiveCreator::getWholePduSize(); }
|
||||||
return FileDirectiveCreator::getWholePduSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t NakPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
ReturnValue_t NakPduCreator::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
ReturnValue_t result = FileDirectiveCreator::serialize(buffer, size, maxSize, streamEndianness);
|
ReturnValue_t result = FileDirectiveCreator::serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef FSFW_SRC_FSFW_CFDP_PDU_NAKPDUSERIALIZER_H_
|
#ifndef FSFW_CFDP_PDU_NAKPDUSERIALIZER_H_
|
||||||
#define FSFW_SRC_FSFW_CFDP_PDU_NAKPDUSERIALIZER_H_
|
#define FSFW_CFDP_PDU_NAKPDUSERIALIZER_H_
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -8,7 +8,7 @@
|
|||||||
#include "fsfw/cfdp/definitions.h"
|
#include "fsfw/cfdp/definitions.h"
|
||||||
#include "fsfw/cfdp/pdu/FileDirectiveCreator.h"
|
#include "fsfw/cfdp/pdu/FileDirectiveCreator.h"
|
||||||
|
|
||||||
class NakPduSerializer : public FileDirectiveCreator {
|
class NakPduCreator : public FileDirectiveCreator {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -18,9 +18,9 @@ class NakPduSerializer : public FileDirectiveCreator {
|
|||||||
* @param [in] segmentRequests Pointer to the start of a list of segment requests
|
* @param [in] segmentRequests Pointer to the start of a list of segment requests
|
||||||
* @param segmentRequestLen Length of the segment request list to be serialized
|
* @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,
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
Endianness streamEndianness) const override;
|
Endianness streamEndianness) const override;
|
||||||
@ -35,4 +35,4 @@ class NakPduSerializer : public FileDirectiveCreator {
|
|||||||
NakInfo& nakInfo;
|
NakInfo& nakInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_SRC_FSFW_CFDP_PDU_NAKPDUSERIALIZER_H_ */
|
#endif /* FSFW_CFDP_PDU_NAKPDUSERIALIZER_H_ */
|
@ -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_ */
|
|
@ -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) {}
|
: FileDirectiveReader(pduBuf, maxSize), nakInfo(info) {}
|
||||||
|
|
||||||
ReturnValue_t NakPduDeserializer::parseData() {
|
ReturnValue_t NakPduReader::parseData() {
|
||||||
ReturnValue_t result = FileDirectiveReader::parseData();
|
ReturnValue_t result = FileDirectiveReader::parseData();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
21
src/fsfw/cfdp/pdu/NakPduReader.h
Normal file
21
src/fsfw/cfdp/pdu/NakPduReader.h
Normal 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_ */
|
@ -1,16 +1,15 @@
|
|||||||
#include "PromptPduSerializer.h"
|
#include "PromptPduCreator.h"
|
||||||
|
|
||||||
PromptPduSerializer::PromptPduSerializer(PduConfig &conf,
|
PromptPduCreator::PromptPduCreator(PduConfig &conf, cfdp::PromptResponseRequired responseRequired)
|
||||||
cfdp::PromptResponseRequired responseRequired)
|
|
||||||
: FileDirectiveCreator(conf, cfdp::FileDirectives::PROMPT, 1),
|
: FileDirectiveCreator(conf, cfdp::FileDirectives::PROMPT, 1),
|
||||||
responseRequired(responseRequired) {}
|
responseRequired(responseRequired) {}
|
||||||
|
|
||||||
size_t PromptPduSerializer::getSerializedSize() const {
|
size_t PromptPduCreator::getSerializedSize() const {
|
||||||
return FileDirectiveCreator::getWholePduSize();
|
return FileDirectiveCreator::getWholePduSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PromptPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
ReturnValue_t PromptPduCreator::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
ReturnValue_t result = FileDirectiveCreator::serialize(buffer, size, maxSize, streamEndianness);
|
ReturnValue_t result = FileDirectiveCreator::serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
#include "fsfw/cfdp/pdu/FileDirectiveCreator.h"
|
#include "fsfw/cfdp/pdu/FileDirectiveCreator.h"
|
||||||
|
|
||||||
class PromptPduSerializer : public FileDirectiveCreator {
|
class PromptPduCreator : public FileDirectiveCreator {
|
||||||
public:
|
public:
|
||||||
PromptPduSerializer(PduConfig& conf, cfdp::PromptResponseRequired responseRequired);
|
PromptPduCreator(PduConfig& conf, cfdp::PromptResponseRequired responseRequired);
|
||||||
|
|
||||||
[[nodiscard]] size_t getSerializedSize() const override;
|
[[nodiscard]] size_t getSerializedSize() const override;
|
||||||
|
|
@ -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) {}
|
: FileDirectiveReader(pduBuf, maxSize) {}
|
||||||
|
|
||||||
cfdp::PromptResponseRequired PromptPduDeserializer::getPromptResponseRequired() const {
|
cfdp::PromptResponseRequired PromptPduReader::getPromptResponseRequired() const {
|
||||||
return responseRequired;
|
return responseRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PromptPduDeserializer::parseData() {
|
ReturnValue_t PromptPduReader::parseData() {
|
||||||
ReturnValue_t result = FileDirectiveReader::parseData();
|
ReturnValue_t result = FileDirectiveReader::parseData();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
#include "fsfw/cfdp/pdu/FileDirectiveReader.h"
|
#include "fsfw/cfdp/pdu/FileDirectiveReader.h"
|
||||||
|
|
||||||
class PromptPduDeserializer : public FileDirectiveReader {
|
class PromptPduReader : public FileDirectiveReader {
|
||||||
public:
|
public:
|
||||||
PromptPduDeserializer(const uint8_t *pduBuf, size_t maxSize);
|
PromptPduReader(const uint8_t *pduBuf, size_t maxSize);
|
||||||
|
|
||||||
[[nodiscard]] cfdp::PromptResponseRequired getPromptResponseRequired() const;
|
[[nodiscard]] cfdp::PromptResponseRequired getPromptResponseRequired() const;
|
||||||
ReturnValue_t parseData() override;
|
ReturnValue_t parseData() override;
|
@ -1,8 +1,8 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
#include "fsfw/cfdp/pdu/KeepAlivePduDeserializer.h"
|
#include "fsfw/cfdp/pdu/KeepAlivePduCreator.h"
|
||||||
#include "fsfw/cfdp/pdu/KeepAlivePduSerializer.h"
|
#include "fsfw/cfdp/pdu/KeepAlivePduReader.h"
|
||||||
#include "fsfw/globalfunctions/arrayprinter.h"
|
#include "fsfw/globalfunctions/arrayprinter.h"
|
||||||
|
|
||||||
TEST_CASE("Keep Alive PDU", "[cfdp][pdu]") {
|
TEST_CASE("Keep Alive PDU", "[cfdp][pdu]") {
|
||||||
@ -19,7 +19,7 @@ TEST_CASE("Keep Alive PDU", "[cfdp][pdu]") {
|
|||||||
FileSize progress(0x50);
|
FileSize progress(0x50);
|
||||||
|
|
||||||
SECTION("Serialize") {
|
SECTION("Serialize") {
|
||||||
KeepAlivePduSerializer serializer(pduConf, progress);
|
KeepAlivePduCreator serializer(pduConf, progress);
|
||||||
result = serializer.serialize(&buffer, &sz, kaBuffer.size(), SerializeIF::Endianness::NETWORK);
|
result = serializer.serialize(&buffer, &sz, kaBuffer.size(), SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(kaBuffer[10] == cfdp::FileDirectives::KEEP_ALIVE);
|
REQUIRE(kaBuffer[10] == cfdp::FileDirectives::KEEP_ALIVE);
|
||||||
@ -55,13 +55,13 @@ TEST_CASE("Keep Alive PDU", "[cfdp][pdu]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Deserialize") {
|
SECTION("Deserialize") {
|
||||||
KeepAlivePduSerializer serializer(pduConf, progress);
|
KeepAlivePduCreator serializer(pduConf, progress);
|
||||||
result = serializer.serialize(&buffer, &sz, kaBuffer.size(), SerializeIF::Endianness::NETWORK);
|
result = serializer.serialize(&buffer, &sz, kaBuffer.size(), SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
|
|
||||||
// Set another file size
|
// Set another file size
|
||||||
progress.setFileSize(200, false);
|
progress.setFileSize(200, false);
|
||||||
KeepAlivePduDeserializer reader(kaBuffer.data(), kaBuffer.size(), progress);
|
KeepAlivePduReader reader(kaBuffer.data(), kaBuffer.size(), progress);
|
||||||
result = reader.parseData();
|
result = reader.parseData();
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
auto& progRef = reader.getProgress();
|
auto& progRef = reader.getProgress();
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
#include "fsfw/cfdp/pdu/NakPduDeserializer.h"
|
#include "fsfw/cfdp/pdu/NakPduCreator.h"
|
||||||
#include "fsfw/cfdp/pdu/NakPduSerializer.h"
|
#include "fsfw/cfdp/pdu/NakPduReader.h"
|
||||||
#include "fsfw/cfdp/pdu/PduConfig.h"
|
#include "fsfw/cfdp/pdu/PduConfig.h"
|
||||||
#include "fsfw/globalfunctions/arrayprinter.h"
|
#include "fsfw/globalfunctions/arrayprinter.h"
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ TEST_CASE("NAK PDU", "[cfdp][pdu]") {
|
|||||||
FileSize endOfScope(1050);
|
FileSize endOfScope(1050);
|
||||||
NakInfo info(startOfScope, endOfScope);
|
NakInfo info(startOfScope, endOfScope);
|
||||||
SECTION("Serializer") {
|
SECTION("Serializer") {
|
||||||
NakPduSerializer serializer(pduConf, info);
|
NakPduCreator serializer(pduConf, info);
|
||||||
result = serializer.serialize(&buffer, &sz, nakBuffer.size(), SerializeIF::Endianness::NETWORK);
|
result = serializer.serialize(&buffer, &sz, nakBuffer.size(), SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(serializer.getSerializedSize() == 19);
|
REQUIRE(serializer.getSerializedSize() == 19);
|
||||||
@ -87,13 +87,13 @@ TEST_CASE("NAK PDU", "[cfdp][pdu]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Deserializer") {
|
SECTION("Deserializer") {
|
||||||
NakPduSerializer serializer(pduConf, info);
|
NakPduCreator serializer(pduConf, info);
|
||||||
result = serializer.serialize(&buffer, &sz, nakBuffer.size(), SerializeIF::Endianness::NETWORK);
|
result = serializer.serialize(&buffer, &sz, nakBuffer.size(), SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
|
|
||||||
info.getStartOfScope().setFileSize(0, false);
|
info.getStartOfScope().setFileSize(0, false);
|
||||||
info.getEndOfScope().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();
|
result = deserializer.parseData();
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(deserializer.getWholePduSize() == 19);
|
REQUIRE(deserializer.getWholePduSize() == 19);
|
||||||
@ -112,7 +112,7 @@ TEST_CASE("NAK PDU", "[cfdp][pdu]") {
|
|||||||
result = serializer.serialize(&buffer, &sz, nakBuffer.size(), SerializeIF::Endianness::NETWORK);
|
result = serializer.serialize(&buffer, &sz, nakBuffer.size(), SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
|
|
||||||
NakPduDeserializer deserializeWithSegReqs(nakBuffer.data(), nakBuffer.size(), info);
|
NakPduReader deserializeWithSegReqs(nakBuffer.data(), nakBuffer.size(), info);
|
||||||
result = deserializeWithSegReqs.parseData();
|
result = deserializeWithSegReqs.parseData();
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
NakInfo::SegmentRequest* segReqsPtr = nullptr;
|
NakInfo::SegmentRequest* segReqsPtr = nullptr;
|
||||||
@ -126,14 +126,14 @@ TEST_CASE("NAK PDU", "[cfdp][pdu]") {
|
|||||||
REQUIRE(deserializeWithSegReqs.getPduDataFieldLen() == 25);
|
REQUIRE(deserializeWithSegReqs.getPduDataFieldLen() == 25);
|
||||||
REQUIRE(info.getSegmentRequestsLen() == 2);
|
REQUIRE(info.getSegmentRequestsLen() == 2);
|
||||||
for (size_t idx = 0; idx < 34; idx++) {
|
for (size_t idx = 0; idx < 34; idx++) {
|
||||||
NakPduDeserializer faultyDeserializer(nakBuffer.data(), idx, info);
|
NakPduReader faultyDeserializer(nakBuffer.data(), idx, info);
|
||||||
result = faultyDeserializer.parseData();
|
result = faultyDeserializer.parseData();
|
||||||
REQUIRE(result != returnvalue::OK);
|
REQUIRE(result != returnvalue::OK);
|
||||||
}
|
}
|
||||||
for (size_t pduFieldLen = 0; pduFieldLen < 25; pduFieldLen++) {
|
for (size_t pduFieldLen = 0; pduFieldLen < 25; pduFieldLen++) {
|
||||||
nakBuffer[1] = (pduFieldLen >> 8) & 0xff;
|
nakBuffer[1] = (pduFieldLen >> 8) & 0xff;
|
||||||
nakBuffer[2] = pduFieldLen & 0xff;
|
nakBuffer[2] = pduFieldLen & 0xff;
|
||||||
NakPduDeserializer faultyDeserializer(nakBuffer.data(), nakBuffer.size(), info);
|
NakPduReader faultyDeserializer(nakBuffer.data(), nakBuffer.size(), info);
|
||||||
result = faultyDeserializer.parseData();
|
result = faultyDeserializer.parseData();
|
||||||
if (pduFieldLen == 9) {
|
if (pduFieldLen == 9) {
|
||||||
REQUIRE(info.getSegmentRequestsLen() == 0);
|
REQUIRE(info.getSegmentRequestsLen() == 0);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
#include "fsfw/cfdp/pdu/PromptPduDeserializer.h"
|
#include "fsfw/cfdp/pdu/PromptPduCreator.h"
|
||||||
#include "fsfw/cfdp/pdu/PromptPduSerializer.h"
|
#include "fsfw/cfdp/pdu/PromptPduReader.h"
|
||||||
#include "fsfw/globalfunctions/arrayprinter.h"
|
#include "fsfw/globalfunctions/arrayprinter.h"
|
||||||
|
|
||||||
TEST_CASE("Prompt PDU", "[cfdp][pdu]") {
|
TEST_CASE("Prompt PDU", "[cfdp][pdu]") {
|
||||||
@ -17,7 +17,7 @@ TEST_CASE("Prompt PDU", "[cfdp][pdu]") {
|
|||||||
PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
|
PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
|
||||||
|
|
||||||
SECTION("Serialize") {
|
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);
|
result = serializer.serialize(&buffer, &sz, rawBuf.size(), SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(serializer.getWholePduSize() == 12);
|
REQUIRE(serializer.getWholePduSize() == 12);
|
||||||
@ -41,11 +41,11 @@ TEST_CASE("Prompt PDU", "[cfdp][pdu]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Deserialize") {
|
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);
|
result = serializer.serialize(&buffer, &sz, rawBuf.size(), SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
|
|
||||||
PromptPduDeserializer deserializer(rawBuf.data(), rawBuf.size());
|
PromptPduReader deserializer(rawBuf.data(), rawBuf.size());
|
||||||
result = deserializer.parseData();
|
result = deserializer.parseData();
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(deserializer.getPromptResponseRequired() ==
|
REQUIRE(deserializer.getPromptResponseRequired() ==
|
||||||
|
Loading…
x
Reference in New Issue
Block a user