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 a1f36a0dd8 - Show all commits

View File

@ -1,6 +1,7 @@
#include "PutRequest.h"
using namespace returnvalue;
[[nodiscard]] bool cfdp::PutRequest::isMetadataOnly() const {
return destNameSize > 0 and sourceNameSize > 0;
}
@ -35,6 +36,9 @@ ReturnValue_t cfdp::PutRequest::serialize(uint8_t **buffer, size_t *size, size_t
if (result != OK) {
return result;
}
if (*size + destNameSize > maxSize) {
return SerializeIF::BUFFER_TOO_SHORT;
}
std::memcpy(*buffer, destName, destNameSize);
*buffer += destNameSize;
*size += destNameSize;
@ -49,11 +53,42 @@ ReturnValue_t cfdp::PutRequest::serialize(uint8_t **buffer, size_t *size, size_t
*buffer += 1;
}
}
result =
SerializeAdapter::serialize(&msgsToUsersTotalSize, buffer, size, maxSize, streamEndianness);
if (result != OK) {
return result;
}
result = SerializeAdapter::serialize(&numOfMsgsToUser, buffer, size, maxSize, streamEndianness);
if (result != OK) {
return result;
}
if (*size + msgsToUsersTotalSize > maxSize) {
return SerializeIF::BUFFER_TOO_SHORT;
}
std::memcpy(*buffer, messagesToUserStartPtr, msgsToUsersTotalSize);
*buffer += msgsToUsersTotalSize;
*size += msgsToUsersTotalSize;
return returnvalue::OK;
result =
SerializeAdapter::serialize(&fsRequestsTotalSize, buffer, size, maxSize, streamEndianness);
if (result != OK) {
return result;
}
result = SerializeAdapter::serialize(&numOfFsRequests, buffer, size, maxSize, streamEndianness);
if (result != OK) {
return result;
}
if (*size + fsRequestsTotalSize > maxSize) {
return SerializeIF::BUFFER_TOO_SHORT;
}
std::memcpy(*buffer, fsRequest, fsRequestsTotalSize);
*buffer += fsRequestsTotalSize;
*size += fsRequestsTotalSize;
return OK;
}
ReturnValue_t cfdp::PutRequest::deSerialize(const uint8_t **buffer, size_t *size,
SerializeIF::Endianness streamEndianness) {
return returnvalue::OK;
return OK;
}
size_t cfdp::PutRequest::getSerializedSize() const { return 0; }