put request
This commit is contained in:
parent
e4665c9394
commit
a1f36a0dd8
@ -1,6 +1,7 @@
|
|||||||
#include "PutRequest.h"
|
#include "PutRequest.h"
|
||||||
|
|
||||||
using namespace returnvalue;
|
using namespace returnvalue;
|
||||||
|
|
||||||
[[nodiscard]] bool cfdp::PutRequest::isMetadataOnly() const {
|
[[nodiscard]] bool cfdp::PutRequest::isMetadataOnly() const {
|
||||||
return destNameSize > 0 and sourceNameSize > 0;
|
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) {
|
if (result != OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
if (*size + destNameSize > maxSize) {
|
||||||
|
return SerializeIF::BUFFER_TOO_SHORT;
|
||||||
|
}
|
||||||
std::memcpy(*buffer, destName, destNameSize);
|
std::memcpy(*buffer, destName, destNameSize);
|
||||||
*buffer += destNameSize;
|
*buffer += destNameSize;
|
||||||
*size += destNameSize;
|
*size += destNameSize;
|
||||||
@ -49,11 +53,42 @@ ReturnValue_t cfdp::PutRequest::serialize(uint8_t **buffer, size_t *size, size_t
|
|||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
result =
|
||||||
return returnvalue::OK;
|
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;
|
||||||
|
|
||||||
|
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,
|
ReturnValue_t cfdp::PutRequest::deSerialize(const uint8_t **buffer, size_t *size,
|
||||||
SerializeIF::Endianness streamEndianness) {
|
SerializeIF::Endianness streamEndianness) {
|
||||||
return returnvalue::OK;
|
return OK;
|
||||||
}
|
}
|
||||||
size_t cfdp::PutRequest::getSerializedSize() const { return 0; }
|
size_t cfdp::PutRequest::getSerializedSize() const { return 0; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user