CFDP SOURCE handler #157

Merged
muellerr merged 107 commits from cfdp-source-handler into develop 2023-10-19 10:59:55 +02:00
6 changed files with 14 additions and 7 deletions
Showing only changes of commit ea2e58249d - Show all commits

View File

@ -146,7 +146,7 @@ ReturnValue_t cfdp::DestHandler::handleMetadataPdu(const PacketInfo& info) {
return handleMetadataParseError(result, constAccessorPair.second.data(), return handleMetadataParseError(result, constAccessorPair.second.data(),
constAccessorPair.second.size()); constAccessorPair.second.size());
} }
return startTransaction(reader, metadataInfo); return startTransaction(reader);
} }
ReturnValue_t cfdp::DestHandler::handleFileDataPdu(const cfdp::PacketInfo& info) { ReturnValue_t cfdp::DestHandler::handleFileDataPdu(const cfdp::PacketInfo& info) {
@ -274,8 +274,7 @@ ReturnValue_t cfdp::DestHandler::handleMetadataParseError(ReturnValue_t result,
return returnvalue::FAILED; return returnvalue::FAILED;
} }
ReturnValue_t cfdp::DestHandler::startTransaction(MetadataPduReader& reader, ReturnValue_t cfdp::DestHandler::startTransaction(const MetadataPduReader& reader) {
MetadataGenericInfo& info) {
if (fsmRes.state != CfdpState::IDLE) { if (fsmRes.state != CfdpState::IDLE) {
// According to standard, discard metadata PDU if we are busy // According to standard, discard metadata PDU if we are busy
return OK; return OK;
@ -344,6 +343,7 @@ ReturnValue_t cfdp::DestHandler::startTransaction(MetadataPduReader& reader,
} else if (reader.getTransmissionMode() == TransmissionMode::ACKNOWLEDGED) { } else if (reader.getTransmissionMode() == TransmissionMode::ACKNOWLEDGED) {
fsmRes.state = CfdpState::BUSY_CLASS_2_ACKED; fsmRes.state = CfdpState::BUSY_CLASS_2_ACKED;
} }
auto& info = reader.getGenericInfo();
transactionParams.checksumType = info.getChecksumType(); transactionParams.checksumType = info.getChecksumType();
transactionParams.closureRequested = info.isClosureRequested(); transactionParams.closureRequested = info.isClosureRequested();
reader.fillConfig(transactionParams.pduConf); reader.fillConfig(transactionParams.pduConf);

View File

@ -153,7 +153,7 @@ class DestHandler {
cfdp::FsfwParams fsfwParams; cfdp::FsfwParams fsfwParams;
FsmResult fsmRes; FsmResult fsmRes;
ReturnValue_t startTransaction(MetadataPduReader& reader, MetadataGenericInfo& info); ReturnValue_t startTransaction(const MetadataPduReader& reader);
ReturnValue_t handleMetadataPdu(const PacketInfo& info); ReturnValue_t handleMetadataPdu(const PacketInfo& info);
ReturnValue_t handleFileDataPdu(const PacketInfo& info); ReturnValue_t handleFileDataPdu(const PacketInfo& info);
ReturnValue_t handleEofPdu(const PacketInfo& info); ReturnValue_t handleEofPdu(const PacketInfo& info);

View File

@ -21,7 +21,7 @@ void MetadataGenericInfo::setClosureRequested(bool closureRequested_) {
closureRequested = closureRequested_; closureRequested = closureRequested_;
} }
cfdp::Fss& MetadataGenericInfo::getFileSize() { return fileSize; } const cfdp::Fss& MetadataGenericInfo::getFileSize() const { return fileSize; }
size_t MetadataGenericInfo::getSerializedSize(bool fssLarge) { size_t MetadataGenericInfo::getSerializedSize(bool fssLarge) {
// 1 byte + minimal FSS 4 bytes // 1 byte + minimal FSS 4 bytes
@ -31,3 +31,5 @@ size_t MetadataGenericInfo::getSerializedSize(bool fssLarge) {
} }
return size; return size;
} }
cfdp::Fss& MetadataGenericInfo::getMutFileSize() { return fileSize; }

View File

@ -22,7 +22,9 @@ class MetadataGenericInfo {
[[nodiscard]] bool isClosureRequested() const; [[nodiscard]] bool isClosureRequested() const;
void setClosureRequested(bool closureRequested = false); void setClosureRequested(bool closureRequested = false);
cfdp::Fss& getFileSize(); [[nodiscard]] const cfdp::Fss& getFileSize() const;
cfdp::Fss& getMutFileSize();
private: private:
bool closureRequested = false; bool closureRequested = false;

View File

@ -25,7 +25,7 @@ ReturnValue_t MetadataPduReader::parseData() {
remSize -= 1; remSize -= 1;
buf += 1; buf += 1;
auto endianness = getEndianness(); auto endianness = getEndianness();
result = info.getFileSize().deSerialize(&buf, &remSize, endianness); result = info.getMutFileSize().deSerialize(&buf, &remSize, endianness);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -63,3 +63,5 @@ size_t MetadataPduReader::getNumberOfParsedOptions() const { return parsedOption
const cfdp::StringLv& MetadataPduReader::getSourceFileName() const { return srcFileName; } const cfdp::StringLv& MetadataPduReader::getSourceFileName() const { return srcFileName; }
const cfdp::StringLv& MetadataPduReader::getDestFileName() const { return destFileName; } const cfdp::StringLv& MetadataPduReader::getDestFileName() const { return destFileName; }
const MetadataGenericInfo& MetadataPduReader::getGenericInfo() const { return info; }

View File

@ -11,6 +11,7 @@ class MetadataPduReader : public FileDirectiveReader {
ReturnValue_t parseData() override; ReturnValue_t parseData() override;
[[nodiscard]] const MetadataGenericInfo& getGenericInfo() const;
[[nodiscard]] const cfdp::StringLv& getSourceFileName() const; [[nodiscard]] const cfdp::StringLv& getSourceFileName() const;
[[nodiscard]] const cfdp::StringLv& getDestFileName() const; [[nodiscard]] const cfdp::StringLv& getDestFileName() const;