1
0
forked from fsfw/fsfw

init dest handler unittests

This commit is contained in:
2022-09-05 14:20:01 +02:00
parent 52802f127b
commit 5ce1e76723
8 changed files with 44 additions and 8 deletions

View File

@ -37,12 +37,14 @@ ReturnValue_t cfdp::DestHandler::performStateMachine() {
// Store data was deleted in PDU handler because a store guard is used
dp.packetListRef.erase(infoIter++);
}
infoIter++;
}
if (step == TransactionStep::IDLE) {
// To decrease the already high complexity of the software, all packets arriving before
// a metadata PDU are deleted.
for (auto infoIter = dp.packetListRef.begin(); infoIter != dp.packetListRef.end();) {
fp.tcStore->deleteData(infoIter->storeId);
infoIter++;
}
dp.packetListRef.clear();
}
@ -73,6 +75,7 @@ ReturnValue_t cfdp::DestHandler::performStateMachine() {
// Store data was deleted in PDU handler because a store guard is used
dp.packetListRef.erase(infoIter++);
}
infoIter++;
}
}
if (step == TransactionStep::TRANSFER_COMPLETION) {

View File

@ -103,8 +103,9 @@ class DestHandler {
private:
struct TransactionParams {
// Initialize char vectors with length + 1 for 0 termination
explicit TransactionParams(size_t maxFileNameLen)
: sourceName(maxFileNameLen), destName(maxFileNameLen) {}
: sourceName(maxFileNameLen + 1), destName(maxFileNameLen + 1) {}
void reset() {
pduConf = PduConfig();

View File

@ -35,3 +35,5 @@ void FileDirectiveCreator::setDirectiveDataFieldLen(size_t len) {
// Set length of data field plus 1 byte for the directive octet
HeaderCreator::setPduDataFieldLen(len + 1);
}
cfdp::FileDirectives FileDirectiveCreator::getDirectiveCode() const { return directiveCode; }

View File

@ -8,6 +8,8 @@ class FileDirectiveCreator : public HeaderCreator {
FileDirectiveCreator(PduConfig& pduConf, cfdp::FileDirectives directiveCode,
size_t directiveParamFieldLen);
[[nodiscard]] cfdp::FileDirectives getDirectiveCode() const;
/**
* This only returns the size of the PDU header + 1 for the directive code octet.
* Use FileDirectiveCreator::getWholePduSize to get the full packet length, assuming

View File

@ -14,6 +14,7 @@ class MetadataPduCreator : public FileDirectiveCreator {
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override;
using FileDirectiveCreator::serialize;
private:
MetadataInfo& info;

View File

@ -12,6 +12,9 @@ class StringLv : public Lv {
StringLv();
explicit StringLv(const std::string& fileName);
explicit StringLv(const char* filename, size_t len);
// Delete the move constructor to avoid passing in a temporary
StringLv(const std::string&&) = delete;
};
} // namespace cfdp