Bump FSFW #31
@ -282,21 +282,25 @@ ReturnValue_t cfdp::DestHandler::startTransaction(const MetadataPduReader& reade
|
|||||||
ReturnValue_t result = OK;
|
ReturnValue_t result = OK;
|
||||||
size_t sourceNameSize = 0;
|
size_t sourceNameSize = 0;
|
||||||
|
|
||||||
const uint8_t* sourceNamePtr = reader.getSourceFileName().getValue(&sourceNameSize);
|
if (not reader.getSourceFileName().isEmpty()) {
|
||||||
if (sourceNameSize + 1 > transactionParams.sourceName.size()) {
|
const uint8_t* sourceNamePtr = reader.getSourceFileName().getValue(&sourceNameSize);
|
||||||
fileErrorHandler(events::FILENAME_TOO_LARGE_ERROR, 0, "source filename too large");
|
if (sourceNameSize + 1 > transactionParams.sourceName.size()) {
|
||||||
return FAILED;
|
fileErrorHandler(events::FILENAME_TOO_LARGE_ERROR, 0, "source filename too large");
|
||||||
|
return FAILED;
|
||||||
|
}
|
||||||
|
std::memcpy(transactionParams.sourceName.data(), sourceNamePtr, sourceNameSize);
|
||||||
|
transactionParams.sourceName[sourceNameSize] = '\0';
|
||||||
}
|
}
|
||||||
std::memcpy(transactionParams.sourceName.data(), sourceNamePtr, sourceNameSize);
|
|
||||||
transactionParams.sourceName[sourceNameSize] = '\0';
|
|
||||||
size_t destNameSize = 0;
|
size_t destNameSize = 0;
|
||||||
const uint8_t* destNamePtr = reader.getDestFileName().getValue(&destNameSize);
|
if (not reader.getDestFileName().isEmpty()) {
|
||||||
if (destNameSize + 1 > transactionParams.destName.size()) {
|
const uint8_t* destNamePtr = reader.getDestFileName().getValue(&destNameSize);
|
||||||
fileErrorHandler(events::FILENAME_TOO_LARGE_ERROR, 0, "dest filename too large");
|
if (destNameSize + 1 > transactionParams.destName.size()) {
|
||||||
return FAILED;
|
fileErrorHandler(events::FILENAME_TOO_LARGE_ERROR, 0, "dest filename too large");
|
||||||
|
return FAILED;
|
||||||
|
}
|
||||||
|
std::memcpy(transactionParams.destName.data(), destNamePtr, destNameSize);
|
||||||
|
transactionParams.destName[destNameSize] = '\0';
|
||||||
}
|
}
|
||||||
std::memcpy(transactionParams.destName.data(), destNamePtr, destNameSize);
|
|
||||||
transactionParams.destName[destNameSize] = '\0';
|
|
||||||
|
|
||||||
// If both dest name size and source name size are 0, we are dealing with a metadata only PDU,
|
// If both dest name size and source name size are 0, we are dealing with a metadata only PDU,
|
||||||
// so there is no need to create a file or truncate an existing file
|
// so there is no need to create a file or truncate an existing file
|
||||||
|
@ -95,3 +95,5 @@ cfdp::Lv& cfdp::Lv::operator=(cfdp::Lv&& other) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t cfdp::Lv::getValueLen() const { return getSerializedSize() - 1; }
|
size_t cfdp::Lv::getValueLen() const { return getSerializedSize() - 1; }
|
||||||
|
|
||||||
|
bool cfdp::Lv::isEmpty() const { return zeroLen; }
|
||||||
|
@ -50,6 +50,8 @@ class Lv : public SerializeIF {
|
|||||||
*/
|
*/
|
||||||
const uint8_t* getValue(size_t* size) const;
|
const uint8_t* getValue(size_t* size) const;
|
||||||
|
|
||||||
|
bool isEmpty() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool zeroLen = true;
|
bool zeroLen = true;
|
||||||
SerialBufferAdapter<uint8_t> value;
|
SerialBufferAdapter<uint8_t> value;
|
||||||
|
@ -107,14 +107,6 @@ uint8_t* SerialBufferAdapter<count_t>::getBuffer() {
|
|||||||
|
|
||||||
template <typename count_t>
|
template <typename count_t>
|
||||||
const uint8_t* SerialBufferAdapter<count_t>::getConstBuffer() const {
|
const uint8_t* SerialBufferAdapter<count_t>::getConstBuffer() const {
|
||||||
if (constBuffer == nullptr) {
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
||||||
sif::error << "SerialBufferAdapter::getConstBuffer:"
|
|
||||||
" Buffers are unitialized!"
|
|
||||||
<< std::endl;
|
|
||||||
#endif
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return constBuffer;
|
return constBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,17 @@ class SerialBufferAdapter : public SerializeIF {
|
|||||||
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
Endianness streamEndianness) override;
|
Endianness streamEndianness) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Please note that this function can also return a nullpointer in case the length field contains
|
||||||
|
* 0.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
uint8_t* getBuffer();
|
uint8_t* getBuffer();
|
||||||
|
/**
|
||||||
|
* Please note that this function can also return a nullpointer in case the length field contains
|
||||||
|
* 0.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
[[nodiscard]] const uint8_t* getConstBuffer() const;
|
[[nodiscard]] const uint8_t* getConstBuffer() const;
|
||||||
void setConstBuffer(const uint8_t* buf, count_t bufLen);
|
void setConstBuffer(const uint8_t* buf, count_t bufLen);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user