CFDP SOURCE handler #157
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user