CFDP SOURCE handler #157

Merged
muellerr merged 107 commits from cfdp-source-handler into develop 2023-10-19 10:59:55 +02:00
Showing only changes of commit 8f5a8b13d3 - Show all commits

View File

@ -17,13 +17,16 @@ cfdp::PutRequest::PutRequest(cfdp::EntityId destId, const uint8_t *msgsToUser,
ReturnValue_t cfdp::PutRequest::serialize(uint8_t **buffer, size_t *size, size_t maxSize, ReturnValue_t cfdp::PutRequest::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
SerializeIF::Endianness streamEndianness) const { SerializeIF::Endianness streamEndianness) const {
ReturnValue_t result = destId.serialize(buffer, size, maxSize, streamEndianness); if(buffer == nullptr or size == nullptr) {
if (result != OK) { return FAILED;
return result;
} }
if (*size + getSerializedSize() > maxSize) { if (*size + getSerializedSize() > maxSize) {
return SerializeIF::BUFFER_TOO_SHORT; return SerializeIF::BUFFER_TOO_SHORT;
} }
ReturnValue_t result = destId.serialize(buffer, size, maxSize, streamEndianness);
if (result != OK) {
return result;
}
result = SerializeAdapter::serialize(&metadataOnly, buffer, size, maxSize, streamEndianness); result = SerializeAdapter::serialize(&metadataOnly, buffer, size, maxSize, streamEndianness);
if (result != OK) { if (result != OK) {
return result; return result;
@ -152,7 +155,7 @@ ReturnValue_t cfdp::PutRequest::deSerialize(const uint8_t **buffer, size_t *size
} }
size_t cfdp::PutRequest::getSerializedSize() const { size_t cfdp::PutRequest::getSerializedSize() const {
size_t baseSize = destId.getSerializedSize() + 1; size_t baseSize = 1 + destId.getSerializedSize();
if (!metadataOnly) { if (!metadataOnly) {
baseSize += sizeof(sourceNameSize) + sourceNameSize + sizeof(destNameSize) + destNameSize + 2; baseSize += sizeof(sourceNameSize) + sourceNameSize + sizeof(destNameSize) + destNameSize + 2;
} }
@ -164,5 +167,5 @@ size_t cfdp::PutRequest::getSerializedSize() const {
void cfdp::PutRequest::setSourceAndDestName(cfdp::StringLv &sourceName_, void cfdp::PutRequest::setSourceAndDestName(cfdp::StringLv &sourceName_,
cfdp::StringLv &destName_) { cfdp::StringLv &destName_) {
this->sourceName = sourceName_.getString(sourceNameSize); this->sourceName = sourceName_.getString(sourceNameSize);
this->destName = destName_.getString(sourceNameSize); this->destName = destName_.getString(destNameSize);
} }