use singular enum names
This commit is contained in:
parent
67f1cd0b5f
commit
6f8ccf83e7
@ -41,7 +41,7 @@ static constexpr ReturnValue_t INVALID_PDU_FORMAT = returnvalue::makeCode(CFDP_C
|
|||||||
|
|
||||||
//! Checksum types according to the SANA Checksum Types registry
|
//! Checksum types according to the SANA Checksum Types registry
|
||||||
//! https://sanaregistry.org/r/checksum_identifiers/
|
//! https://sanaregistry.org/r/checksum_identifiers/
|
||||||
enum ChecksumTypes {
|
enum ChecksumType {
|
||||||
// Modular legacy checksum
|
// Modular legacy checksum
|
||||||
MODULAR = 0,
|
MODULAR = 0,
|
||||||
CRC_32_PROXIMITY_1 = 1,
|
CRC_32_PROXIMITY_1 = 1,
|
||||||
@ -50,9 +50,9 @@ enum ChecksumTypes {
|
|||||||
NULL_CHECKSUM = 15
|
NULL_CHECKSUM = 15
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PduTypes : uint8_t { FILE_DIRECTIVE = 0, FILE_DATA = 1 };
|
enum PduType : uint8_t { FILE_DIRECTIVE = 0, FILE_DATA = 1 };
|
||||||
|
|
||||||
enum TransmissionModes : uint8_t { ACKNOWLEDGED = 0, UNACKNOWLEDGED = 1 };
|
enum TransmissionMode : uint8_t { ACKNOWLEDGED = 0, UNACKNOWLEDGED = 1 };
|
||||||
|
|
||||||
enum SegmentMetadataFlag : bool { NOT_PRESENT = false, PRESENT = true };
|
enum SegmentMetadataFlag : bool { NOT_PRESENT = false, PRESENT = true };
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ enum WidthInBytes : uint8_t {
|
|||||||
FOUR_BYTES = 4,
|
FOUR_BYTES = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum FileDirectives : uint8_t {
|
enum FileDirective : uint8_t {
|
||||||
INVALID_DIRECTIVE = 0x0f,
|
INVALID_DIRECTIVE = 0x0f,
|
||||||
// The _DIRECTIVE suffix is mandatory here because of some nameclash!
|
// The _DIRECTIVE suffix is mandatory here because of some nameclash!
|
||||||
EOF_DIRECTIVE = 0x04,
|
EOF_DIRECTIVE = 0x04,
|
||||||
@ -82,7 +82,7 @@ enum FileDirectives : uint8_t {
|
|||||||
KEEP_ALIVE = 0x0c
|
KEEP_ALIVE = 0x0c
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ConditionCodes : uint8_t {
|
enum ConditionCode : uint8_t {
|
||||||
NO_CONDITION_FIELD = 0xff,
|
NO_CONDITION_FIELD = 0xff,
|
||||||
NO_ERROR = 0b0000,
|
NO_ERROR = 0b0000,
|
||||||
POSITIVE_ACK_LIMIT_REACHED = 0b0001,
|
POSITIVE_ACK_LIMIT_REACHED = 0b0001,
|
||||||
@ -99,8 +99,7 @@ enum ConditionCodes : uint8_t {
|
|||||||
CANCEL_REQUEST_RECEIVED = 0b1111
|
CANCEL_REQUEST_RECEIVED = 0b1111
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum FaultHandlerCode {
|
||||||
enum FaultHandlerCodes {
|
|
||||||
RESERVED = 0b0000,
|
RESERVED = 0b0000,
|
||||||
NOTICE_OF_CANCELLATION = 0b0001,
|
NOTICE_OF_CANCELLATION = 0b0001,
|
||||||
NOTICE_OF_SUSPENSION = 0b0010,
|
NOTICE_OF_SUSPENSION = 0b0010,
|
||||||
@ -126,7 +125,7 @@ enum FileDeliveryStatus {
|
|||||||
|
|
||||||
enum PromptResponseRequired : uint8_t { PROMPT_NAK = 0, PROMPT_KEEP_ALIVE = 1 };
|
enum PromptResponseRequired : uint8_t { PROMPT_NAK = 0, PROMPT_KEEP_ALIVE = 1 };
|
||||||
|
|
||||||
enum TlvTypes : uint8_t {
|
enum TlvType : uint8_t {
|
||||||
FILESTORE_REQUEST = 0x00,
|
FILESTORE_REQUEST = 0x00,
|
||||||
FILESTORE_RESPONSE = 0x01,
|
FILESTORE_RESPONSE = 0x01,
|
||||||
MSG_TO_USER = 0x02,
|
MSG_TO_USER = 0x02,
|
||||||
|
@ -5,8 +5,8 @@ namespace cfdp {
|
|||||||
FaultHandlerBase::FaultHandlerBase() = default;
|
FaultHandlerBase::FaultHandlerBase() = default;
|
||||||
FaultHandlerBase::~FaultHandlerBase() = default;
|
FaultHandlerBase::~FaultHandlerBase() = default;
|
||||||
|
|
||||||
bool FaultHandlerBase::getFaultHandler(cfdp::ConditionCodes code,
|
bool FaultHandlerBase::getFaultHandler(cfdp::ConditionCode code,
|
||||||
cfdp::FaultHandlerCodes& handler) const {
|
cfdp::FaultHandlerCode& handler) const {
|
||||||
auto iter = faultHandlerMap.find(code);
|
auto iter = faultHandlerMap.find(code);
|
||||||
if (iter == faultHandlerMap.end()) {
|
if (iter == faultHandlerMap.end()) {
|
||||||
return false;
|
return false;
|
||||||
@ -15,32 +15,32 @@ bool FaultHandlerBase::getFaultHandler(cfdp::ConditionCodes code,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FaultHandlerBase::setFaultHandler(cfdp::ConditionCodes code, cfdp::FaultHandlerCodes handler) {
|
bool FaultHandlerBase::setFaultHandler(cfdp::ConditionCode code, cfdp::FaultHandlerCode handler) {
|
||||||
if (not faultHandlerMap.contains(code)) {
|
if (not faultHandlerMap.contains(code)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (handler != FaultHandlerCodes::NOTICE_OF_SUSPENSION and
|
if (handler != FaultHandlerCode::NOTICE_OF_SUSPENSION and
|
||||||
handler != FaultHandlerCodes::ABANDON_TRANSACTION and
|
handler != FaultHandlerCode::ABANDON_TRANSACTION and
|
||||||
handler != FaultHandlerCodes::NOTICE_OF_CANCELLATION and
|
handler != FaultHandlerCode::NOTICE_OF_CANCELLATION and
|
||||||
handler != FaultHandlerCodes::IGNORE_ERROR) {
|
handler != FaultHandlerCode::IGNORE_ERROR) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
faultHandlerMap[code] = handler;
|
faultHandlerMap[code] = handler;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FaultHandlerBase::reportFault(cfdp::TransactionId& id, cfdp::ConditionCodes code) {
|
bool FaultHandlerBase::reportFault(cfdp::TransactionId& id, cfdp::ConditionCode code) {
|
||||||
if (not faultHandlerMap.contains(code)) {
|
if (not faultHandlerMap.contains(code)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
cfdp::FaultHandlerCodes fh = faultHandlerMap[code];
|
cfdp::FaultHandlerCode fh = faultHandlerMap[code];
|
||||||
if (fh == cfdp::FaultHandlerCodes::IGNORE_ERROR) {
|
if (fh == cfdp::FaultHandlerCode::IGNORE_ERROR) {
|
||||||
ignoreCb(id, code);
|
ignoreCb(id, code);
|
||||||
} else if (fh == cfdp::FaultHandlerCodes::ABANDON_TRANSACTION) {
|
} else if (fh == cfdp::FaultHandlerCode::ABANDON_TRANSACTION) {
|
||||||
abandonCb(id, code);
|
abandonCb(id, code);
|
||||||
} else if (fh == cfdp::FaultHandlerCodes::NOTICE_OF_CANCELLATION) {
|
} else if (fh == cfdp::FaultHandlerCode::NOTICE_OF_CANCELLATION) {
|
||||||
noticeOfCancellationCb(id, code);
|
noticeOfCancellationCb(id, code);
|
||||||
} else if (fh == cfdp::FaultHandlerCodes::NOTICE_OF_SUSPENSION) {
|
} else if (fh == cfdp::FaultHandlerCode::NOTICE_OF_SUSPENSION) {
|
||||||
noticeOfSuspensionCb(id, code);
|
noticeOfSuspensionCb(id, code);
|
||||||
} else {
|
} else {
|
||||||
// Should never happen, but use defensive programming
|
// Should never happen, but use defensive programming
|
||||||
|
@ -43,33 +43,33 @@ class FaultHandlerBase {
|
|||||||
* - true if the condition code is valid
|
* - true if the condition code is valid
|
||||||
* - false otherwise
|
* - false otherwise
|
||||||
*/
|
*/
|
||||||
bool getFaultHandler(cfdp::ConditionCodes code, cfdp::FaultHandlerCodes& handler) const;
|
bool getFaultHandler(cfdp::ConditionCode code, cfdp::FaultHandlerCode& handler) const;
|
||||||
|
|
||||||
bool setFaultHandler(cfdp::ConditionCodes code, cfdp::FaultHandlerCodes handler);
|
bool setFaultHandler(cfdp::ConditionCode code, cfdp::FaultHandlerCode handler);
|
||||||
|
|
||||||
bool reportFault(cfdp::TransactionId& id, cfdp::ConditionCodes code);
|
bool reportFault(cfdp::TransactionId& id, cfdp::ConditionCode code);
|
||||||
|
|
||||||
virtual void noticeOfSuspensionCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0;
|
virtual void noticeOfSuspensionCb(cfdp::TransactionId& id, cfdp::ConditionCode code) = 0;
|
||||||
virtual void noticeOfCancellationCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0;
|
virtual void noticeOfCancellationCb(cfdp::TransactionId& id, cfdp::ConditionCode code) = 0;
|
||||||
virtual void abandonCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0;
|
virtual void abandonCb(cfdp::TransactionId& id, cfdp::ConditionCode code) = 0;
|
||||||
virtual void ignoreCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0;
|
virtual void ignoreCb(cfdp::TransactionId& id, cfdp::ConditionCode code) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
etl::flat_map<cfdp::ConditionCodes, cfdp::FaultHandlerCodes, 10> faultHandlerMap = {
|
etl::flat_map<cfdp::ConditionCode, cfdp::FaultHandlerCode, 10> faultHandlerMap = {
|
||||||
etl::pair{cfdp::ConditionCodes::POSITIVE_ACK_LIMIT_REACHED,
|
etl::pair{cfdp::ConditionCode::POSITIVE_ACK_LIMIT_REACHED,
|
||||||
cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||||
etl::pair{cfdp::ConditionCodes::KEEP_ALIVE_LIMIT_REACHED,
|
etl::pair{cfdp::ConditionCode::KEEP_ALIVE_LIMIT_REACHED,
|
||||||
cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||||
etl::pair{cfdp::ConditionCodes::INVALID_TRANSMISSION_MODE,
|
etl::pair{cfdp::ConditionCode::INVALID_TRANSMISSION_MODE,
|
||||||
cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||||
etl::pair{cfdp::ConditionCodes::FILE_CHECKSUM_FAILURE, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
etl::pair{cfdp::ConditionCode::FILE_CHECKSUM_FAILURE, cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||||
etl::pair{cfdp::ConditionCodes::FILE_SIZE_ERROR, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
etl::pair{cfdp::ConditionCode::FILE_SIZE_ERROR, cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||||
etl::pair{cfdp::ConditionCodes::NAK_LIMIT_REACHED, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
etl::pair{cfdp::ConditionCode::NAK_LIMIT_REACHED, cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||||
etl::pair{cfdp::ConditionCodes::INACTIVITY_DETECTED, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
etl::pair{cfdp::ConditionCode::INACTIVITY_DETECTED, cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||||
etl::pair{cfdp::ConditionCodes::UNSUPPORTED_CHECKSUM_TYPE,
|
etl::pair{cfdp::ConditionCode::UNSUPPORTED_CHECKSUM_TYPE,
|
||||||
cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||||
etl::pair{cfdp::ConditionCodes::FILESTORE_REJECTION, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
etl::pair{cfdp::ConditionCode::FILESTORE_REJECTION, cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||||
etl::pair{cfdp::ConditionCodes::CHECK_LIMIT_REACHED, cfdp::FaultHandlerCodes::IGNORE_ERROR}};
|
etl::pair{cfdp::ConditionCode::CHECK_LIMIT_REACHED, cfdp::FaultHandlerCode::IGNORE_ERROR}};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cfdp
|
} // namespace cfdp
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
namespace cfdp {
|
namespace cfdp {
|
||||||
|
|
||||||
struct TransactionFinishedParams {
|
struct TransactionFinishedParams {
|
||||||
TransactionFinishedParams(const TransactionId& id, ConditionCodes code, FileDeliveryCode delivCode,
|
TransactionFinishedParams(const TransactionId& id, ConditionCode code, FileDeliveryCode delivCode,
|
||||||
FileDeliveryStatus status)
|
FileDeliveryStatus status)
|
||||||
: id(id), condCode(code), status(status), deliveryCode(delivCode) {}
|
: id(id), condCode(code), status(status), deliveryCode(delivCode) {}
|
||||||
|
|
||||||
const TransactionId& id;
|
const TransactionId& id;
|
||||||
ConditionCodes condCode;
|
ConditionCode condCode;
|
||||||
FileDeliveryStatus status;
|
FileDeliveryStatus status;
|
||||||
FileDeliveryCode deliveryCode;
|
FileDeliveryCode deliveryCode;
|
||||||
std::vector<FilestoreResponseTlv*> fsResponses;
|
std::vector<FilestoreResponseTlv*> fsResponses;
|
||||||
@ -85,10 +85,10 @@ class UserBase {
|
|||||||
virtual void metadataRecvdIndication(const MetadataRecvdParams& params) = 0;
|
virtual void metadataRecvdIndication(const MetadataRecvdParams& params) = 0;
|
||||||
virtual void fileSegmentRecvdIndication(const FileSegmentRecvdParams& params) = 0;
|
virtual void fileSegmentRecvdIndication(const FileSegmentRecvdParams& params) = 0;
|
||||||
virtual void reportIndication(const TransactionId& id, StatusReportIF& report) = 0;
|
virtual void reportIndication(const TransactionId& id, StatusReportIF& report) = 0;
|
||||||
virtual void suspendedIndication(const TransactionId& id, ConditionCodes code) = 0;
|
virtual void suspendedIndication(const TransactionId& id, ConditionCode code) = 0;
|
||||||
virtual void resumedIndication(const TransactionId& id, size_t progress) = 0;
|
virtual void resumedIndication(const TransactionId& id, size_t progress) = 0;
|
||||||
virtual void faultIndication(const TransactionId& id, ConditionCodes code, size_t progress) = 0;
|
virtual void faultIndication(const TransactionId& id, ConditionCode code, size_t progress) = 0;
|
||||||
virtual void abandonedIndication(const TransactionId& id, ConditionCodes code,
|
virtual void abandonedIndication(const TransactionId& id, ConditionCode code,
|
||||||
size_t progress) = 0;
|
size_t progress) = 0;
|
||||||
virtual void eofRecvIndication(const TransactionId& id) = 0;
|
virtual void eofRecvIndication(const TransactionId& id) = 0;
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ struct RemoteEntityCfg {
|
|||||||
size_t maxFileSegmentLen = 2048;
|
size_t maxFileSegmentLen = 2048;
|
||||||
bool closureRequested = false;
|
bool closureRequested = false;
|
||||||
bool crcOnTransmission = false;
|
bool crcOnTransmission = false;
|
||||||
TransmissionModes defaultTransmissionMode = TransmissionModes::UNACKNOWLEDGED;
|
TransmissionMode defaultTransmissionMode = TransmissionMode::UNACKNOWLEDGED;
|
||||||
ChecksumTypes defaultChecksum = ChecksumTypes::NULL_CHECKSUM;
|
ChecksumType defaultChecksum = ChecksumType::NULL_CHECKSUM;
|
||||||
const uint8_t version = CFDP_VERSION_2;
|
const uint8_t version = CFDP_VERSION_2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
const char* COND_CODE_STRINGS[14] = {
|
const char* COND_CODE_STRINGS[14] = {"Unknown",
|
||||||
"Unknown",
|
|
||||||
"No Error",
|
"No Error",
|
||||||
"Positive ACK Limit Reached",
|
"Positive ACK Limit Reached",
|
||||||
"Keep Alive Limit Reached",
|
"Keep Alive Limit Reached",
|
||||||
@ -14,10 +13,9 @@ const char* COND_CODE_STRINGS[14] = {
|
|||||||
"Check Limit Reached",
|
"Check Limit Reached",
|
||||||
"Unsupported Checksum Type",
|
"Unsupported Checksum Type",
|
||||||
"Suspend Request Received",
|
"Suspend Request Received",
|
||||||
"Cancel Request Received"
|
"Cancel Request Received"};
|
||||||
};
|
|
||||||
|
|
||||||
const char* cfdp::getConditionCodeString(cfdp::ConditionCodes code) {
|
const char* cfdp::getConditionCodeString(cfdp::ConditionCode code) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case NO_CONDITION_FIELD:
|
case NO_CONDITION_FIELD:
|
||||||
return COND_CODE_STRINGS[0];
|
return COND_CODE_STRINGS[0];
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace cfdp {
|
namespace cfdp {
|
||||||
|
|
||||||
const char* getConditionCodeString(cfdp::ConditionCodes code);
|
const char* getConditionCodeString(cfdp::ConditionCode code);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif // FSFW_EXAMPLE_HOSTED_HELPER_H
|
#endif // FSFW_EXAMPLE_HOSTED_HELPER_H
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
#include "AckInfo.h"
|
#include "AckInfo.h"
|
||||||
|
|
||||||
AckInfo::AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCodes ackedConditionCode,
|
AckInfo::AckInfo(cfdp::FileDirective ackedDirective, cfdp::ConditionCode ackedConditionCode,
|
||||||
cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode)
|
cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode)
|
||||||
: ackedDirective(ackedDirective),
|
: ackedDirective(ackedDirective),
|
||||||
ackedConditionCode(ackedConditionCode),
|
ackedConditionCode(ackedConditionCode),
|
||||||
transactionStatus(transactionStatus),
|
transactionStatus(transactionStatus),
|
||||||
directiveSubtypeCode(directiveSubtypeCode) {
|
directiveSubtypeCode(directiveSubtypeCode) {
|
||||||
if (ackedDirective == cfdp::FileDirectives::FINISH) {
|
if (ackedDirective == cfdp::FileDirective::FINISH) {
|
||||||
this->directiveSubtypeCode = 0b0001;
|
this->directiveSubtypeCode = 0b0001;
|
||||||
} else {
|
} else {
|
||||||
this->directiveSubtypeCode = 0b0000;
|
this->directiveSubtypeCode = 0b0000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdp::ConditionCodes AckInfo::getAckedConditionCode() const { return ackedConditionCode; }
|
cfdp::ConditionCode AckInfo::getAckedConditionCode() const { return ackedConditionCode; }
|
||||||
|
|
||||||
void AckInfo::setAckedConditionCode(cfdp::ConditionCodes ackedConditionCode) {
|
void AckInfo::setAckedConditionCode(cfdp::ConditionCode ackedConditionCode) {
|
||||||
this->ackedConditionCode = ackedConditionCode;
|
this->ackedConditionCode = ackedConditionCode;
|
||||||
if (ackedDirective == cfdp::FileDirectives::FINISH) {
|
if (ackedDirective == cfdp::FileDirective::FINISH) {
|
||||||
this->directiveSubtypeCode = 0b0001;
|
this->directiveSubtypeCode = 0b0001;
|
||||||
} else {
|
} else {
|
||||||
this->directiveSubtypeCode = 0b0000;
|
this->directiveSubtypeCode = 0b0000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdp::FileDirectives AckInfo::getAckedDirective() const { return ackedDirective; }
|
cfdp::FileDirective AckInfo::getAckedDirective() const { return ackedDirective; }
|
||||||
|
|
||||||
void AckInfo::setAckedDirective(cfdp::FileDirectives ackedDirective) {
|
void AckInfo::setAckedDirective(cfdp::FileDirective ackedDirective) {
|
||||||
this->ackedDirective = ackedDirective;
|
this->ackedDirective = ackedDirective;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
class AckInfo {
|
class AckInfo {
|
||||||
public:
|
public:
|
||||||
AckInfo();
|
AckInfo();
|
||||||
AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCodes ackedConditionCode,
|
AckInfo(cfdp::FileDirective ackedDirective, cfdp::ConditionCode ackedConditionCode,
|
||||||
cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode = 0);
|
cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode = 0);
|
||||||
|
|
||||||
cfdp::ConditionCodes getAckedConditionCode() const;
|
cfdp::ConditionCode getAckedConditionCode() const;
|
||||||
void setAckedConditionCode(cfdp::ConditionCodes ackedConditionCode);
|
void setAckedConditionCode(cfdp::ConditionCode ackedConditionCode);
|
||||||
|
|
||||||
cfdp::FileDirectives getAckedDirective() const;
|
cfdp::FileDirective getAckedDirective() const;
|
||||||
void setAckedDirective(cfdp::FileDirectives ackedDirective);
|
void setAckedDirective(cfdp::FileDirective ackedDirective);
|
||||||
|
|
||||||
uint8_t getDirectiveSubtypeCode() const;
|
uint8_t getDirectiveSubtypeCode() const;
|
||||||
void setDirectiveSubtypeCode(uint8_t directiveSubtypeCode);
|
void setDirectiveSubtypeCode(uint8_t directiveSubtypeCode);
|
||||||
@ -22,8 +22,8 @@ class AckInfo {
|
|||||||
void setTransactionStatus(cfdp::AckTransactionStatus transactionStatus);
|
void setTransactionStatus(cfdp::AckTransactionStatus transactionStatus);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cfdp::FileDirectives ackedDirective = cfdp::FileDirectives::INVALID_DIRECTIVE;
|
cfdp::FileDirective ackedDirective = cfdp::FileDirective::INVALID_DIRECTIVE;
|
||||||
cfdp::ConditionCodes ackedConditionCode = cfdp::ConditionCodes::NO_CONDITION_FIELD;
|
cfdp::ConditionCode ackedConditionCode = cfdp::ConditionCode::NO_CONDITION_FIELD;
|
||||||
cfdp::AckTransactionStatus transactionStatus = cfdp::AckTransactionStatus::UNDEFINED;
|
cfdp::AckTransactionStatus transactionStatus = cfdp::AckTransactionStatus::UNDEFINED;
|
||||||
uint8_t directiveSubtypeCode = 0;
|
uint8_t directiveSubtypeCode = 0;
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "AckPduCreator.h"
|
#include "AckPduCreator.h"
|
||||||
|
|
||||||
AckPduCreator::AckPduCreator(AckInfo &ackInfo, PduConfig &pduConf)
|
AckPduCreator::AckPduCreator(AckInfo &ackInfo, PduConfig &pduConf)
|
||||||
: FileDirectiveCreator(pduConf, cfdp::FileDirectives::ACK, 2), ackInfo(ackInfo) {}
|
: FileDirectiveCreator(pduConf, cfdp::FileDirective::ACK, 2), ackInfo(ackInfo) {}
|
||||||
|
|
||||||
size_t AckPduCreator::getSerializedSize() const { return FileDirectiveCreator::getWholePduSize(); }
|
size_t AckPduCreator::getSerializedSize() const { return FileDirectiveCreator::getWholePduSize(); }
|
||||||
|
|
||||||
@ -11,12 +11,12 @@ ReturnValue_t AckPduCreator::serialize(uint8_t **buffer, size_t *size, size_t ma
|
|||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
cfdp::FileDirectives ackedDirective = ackInfo.getAckedDirective();
|
cfdp::FileDirective ackedDirective = ackInfo.getAckedDirective();
|
||||||
uint8_t directiveSubtypeCode = ackInfo.getDirectiveSubtypeCode();
|
uint8_t directiveSubtypeCode = ackInfo.getDirectiveSubtypeCode();
|
||||||
cfdp::ConditionCodes ackedConditionCode = ackInfo.getAckedConditionCode();
|
cfdp::ConditionCode ackedConditionCode = ackInfo.getAckedConditionCode();
|
||||||
cfdp::AckTransactionStatus transactionStatus = ackInfo.getTransactionStatus();
|
cfdp::AckTransactionStatus transactionStatus = ackInfo.getTransactionStatus();
|
||||||
if (ackedDirective != cfdp::FileDirectives::FINISH and
|
if (ackedDirective != cfdp::FileDirective::FINISH and
|
||||||
ackedDirective != cfdp::FileDirectives::EOF_DIRECTIVE) {
|
ackedDirective != cfdp::FileDirective::EOF_DIRECTIVE) {
|
||||||
// TODO: better returncode
|
// TODO: better returncode
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ ReturnValue_t AckPduReader::parseData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool AckPduReader::checkAndSetCodes(uint8_t firstByte, uint8_t secondByte) {
|
bool AckPduReader::checkAndSetCodes(uint8_t firstByte, uint8_t secondByte) {
|
||||||
cfdp::FileDirectives directive;
|
cfdp::FileDirective directive;
|
||||||
if (not checkAckedDirectiveField(firstByte, directive)) {
|
if (not checkAckedDirectiveField(firstByte, directive)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -29,17 +29,17 @@ bool AckPduReader::checkAndSetCodes(uint8_t firstByte, uint8_t secondByte) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this->info.setDirectiveSubtypeCode(directiveSubtypeCode);
|
this->info.setDirectiveSubtypeCode(directiveSubtypeCode);
|
||||||
this->info.setAckedConditionCode(static_cast<cfdp::ConditionCodes>(secondByte >> 4));
|
this->info.setAckedConditionCode(static_cast<cfdp::ConditionCode>(secondByte >> 4));
|
||||||
this->info.setTransactionStatus(static_cast<cfdp::AckTransactionStatus>(secondByte & 0x0f));
|
this->info.setTransactionStatus(static_cast<cfdp::AckTransactionStatus>(secondByte & 0x0f));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool AckPduReader::checkAckedDirectiveField(uint8_t firstPduDataByte,
|
bool AckPduReader::checkAckedDirectiveField(uint8_t firstPduDataByte,
|
||||||
cfdp::FileDirectives& ackedDirective) {
|
cfdp::FileDirective& ackedDirective) {
|
||||||
uint8_t ackedDirectiveRaw = static_cast<cfdp::FileDirectives>(firstPduDataByte >> 4);
|
uint8_t ackedDirectiveRaw = static_cast<cfdp::FileDirective>(firstPduDataByte >> 4);
|
||||||
if (ackedDirectiveRaw != cfdp::FileDirectives::EOF_DIRECTIVE and
|
if (ackedDirectiveRaw != cfdp::FileDirective::EOF_DIRECTIVE and
|
||||||
ackedDirectiveRaw != cfdp::FileDirectives::FINISH) {
|
ackedDirectiveRaw != cfdp::FileDirective::FINISH) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ackedDirective = (static_cast<cfdp::FileDirectives>(ackedDirectiveRaw));
|
ackedDirective = (static_cast<cfdp::FileDirective>(ackedDirectiveRaw));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ class AckPduReader : public FileDirectiveReader {
|
|||||||
ReturnValue_t parseData() override;
|
ReturnValue_t parseData() override;
|
||||||
|
|
||||||
static bool checkAckedDirectiveField(uint8_t firstPduDataByte,
|
static bool checkAckedDirectiveField(uint8_t firstPduDataByte,
|
||||||
cfdp::FileDirectives& ackedDirective);
|
cfdp::FileDirective& ackedDirective);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool checkAndSetCodes(uint8_t rawAckedByte, uint8_t rawAckedConditionCode);
|
bool checkAndSetCodes(uint8_t rawAckedByte, uint8_t rawAckedConditionCode);
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
#include "EofInfo.h"
|
#include "EofInfo.h"
|
||||||
|
|
||||||
EofInfo::EofInfo(cfdp::ConditionCodes conditionCode, uint32_t checksum, cfdp::FileSize fileSize,
|
EofInfo::EofInfo(cfdp::ConditionCode conditionCode, uint32_t checksum, cfdp::FileSize fileSize,
|
||||||
EntityIdTlv* faultLoc)
|
EntityIdTlv* faultLoc)
|
||||||
: conditionCode(conditionCode), checksum(checksum), fileSize(fileSize), faultLoc(faultLoc) {}
|
: conditionCode(conditionCode), checksum(checksum), fileSize(fileSize), faultLoc(faultLoc) {}
|
||||||
|
|
||||||
EofInfo::EofInfo(EntityIdTlv* faultLoc)
|
EofInfo::EofInfo(EntityIdTlv* faultLoc)
|
||||||
: conditionCode(cfdp::ConditionCodes::NO_CONDITION_FIELD),
|
: conditionCode(cfdp::ConditionCode::NO_CONDITION_FIELD),
|
||||||
checksum(0),
|
checksum(0),
|
||||||
fileSize(0),
|
fileSize(0),
|
||||||
faultLoc(faultLoc) {}
|
faultLoc(faultLoc) {}
|
||||||
|
|
||||||
uint32_t EofInfo::getChecksum() const { return checksum; }
|
uint32_t EofInfo::getChecksum() const { return checksum; }
|
||||||
|
|
||||||
cfdp::ConditionCodes EofInfo::getConditionCode() const { return conditionCode; }
|
cfdp::ConditionCode EofInfo::getConditionCode() const { return conditionCode; }
|
||||||
|
|
||||||
EntityIdTlv* EofInfo::getFaultLoc() const { return faultLoc; }
|
EntityIdTlv* EofInfo::getFaultLoc() const { return faultLoc; }
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ cfdp::FileSize& EofInfo::getFileSize() { return fileSize; }
|
|||||||
|
|
||||||
void EofInfo::setChecksum(uint32_t checksum) { this->checksum = checksum; }
|
void EofInfo::setChecksum(uint32_t checksum) { this->checksum = checksum; }
|
||||||
|
|
||||||
void EofInfo::setConditionCode(cfdp::ConditionCodes conditionCode) {
|
void EofInfo::setConditionCode(cfdp::ConditionCode conditionCode) {
|
||||||
this->conditionCode = conditionCode;
|
this->conditionCode = conditionCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ size_t EofInfo::getSerializedSize(bool fssLarge) {
|
|||||||
}
|
}
|
||||||
// Do not account for fault location if the condition code is NO_ERROR. We assume that
|
// Do not account for fault location if the condition code is NO_ERROR. We assume that
|
||||||
// a serializer will not serialize the fault location here.
|
// a serializer will not serialize the fault location here.
|
||||||
if (getFaultLoc() != nullptr and getConditionCode() != cfdp::ConditionCodes::NO_ERROR) {
|
if (getFaultLoc() != nullptr and getConditionCode() != cfdp::ConditionCode::NO_ERROR) {
|
||||||
size += faultLoc->getSerializedSize();
|
size += faultLoc->getSerializedSize();
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
|
@ -8,23 +8,23 @@
|
|||||||
struct EofInfo {
|
struct EofInfo {
|
||||||
public:
|
public:
|
||||||
explicit EofInfo(EntityIdTlv* faultLoc = nullptr);
|
explicit EofInfo(EntityIdTlv* faultLoc = nullptr);
|
||||||
EofInfo(cfdp::ConditionCodes conditionCode, uint32_t checksum, cfdp::FileSize fileSize,
|
EofInfo(cfdp::ConditionCode conditionCode, uint32_t checksum, cfdp::FileSize fileSize,
|
||||||
EntityIdTlv* faultLoc = nullptr);
|
EntityIdTlv* faultLoc = nullptr);
|
||||||
|
|
||||||
size_t getSerializedSize(bool fssLarge = false);
|
size_t getSerializedSize(bool fssLarge = false);
|
||||||
|
|
||||||
[[nodiscard]] uint32_t getChecksum() const;
|
[[nodiscard]] uint32_t getChecksum() const;
|
||||||
[[nodiscard]] cfdp::ConditionCodes getConditionCode() const;
|
[[nodiscard]] cfdp::ConditionCode getConditionCode() const;
|
||||||
|
|
||||||
[[nodiscard]] EntityIdTlv* getFaultLoc() const;
|
[[nodiscard]] EntityIdTlv* getFaultLoc() const;
|
||||||
cfdp::FileSize& getFileSize();
|
cfdp::FileSize& getFileSize();
|
||||||
void setChecksum(uint32_t checksum);
|
void setChecksum(uint32_t checksum);
|
||||||
void setConditionCode(cfdp::ConditionCodes conditionCode);
|
void setConditionCode(cfdp::ConditionCode conditionCode);
|
||||||
void setFaultLoc(EntityIdTlv* faultLoc);
|
void setFaultLoc(EntityIdTlv* faultLoc);
|
||||||
ReturnValue_t setFileSize(size_t size, bool isLarge);
|
ReturnValue_t setFileSize(size_t size, bool isLarge);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cfdp::ConditionCodes conditionCode;
|
cfdp::ConditionCode conditionCode;
|
||||||
uint32_t checksum;
|
uint32_t checksum;
|
||||||
cfdp::FileSize fileSize;
|
cfdp::FileSize fileSize;
|
||||||
EntityIdTlv* faultLoc = nullptr;
|
EntityIdTlv* faultLoc = nullptr;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "fsfw/FSFW.h"
|
#include "fsfw/FSFW.h"
|
||||||
|
|
||||||
EofPduCreator::EofPduCreator(PduConfig &conf, EofInfo &info)
|
EofPduCreator::EofPduCreator(PduConfig &conf, EofInfo &info)
|
||||||
: FileDirectiveCreator(conf, cfdp::FileDirectives::EOF_DIRECTIVE, 9), info(info) {
|
: FileDirectiveCreator(conf, cfdp::FileDirective::EOF_DIRECTIVE, 9), info(info) {
|
||||||
setDirectiveDataFieldLen(info.getSerializedSize(HeaderCreator::getLargeFileFlag()));
|
setDirectiveDataFieldLen(info.getSerializedSize(HeaderCreator::getLargeFileFlag()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ ReturnValue_t EofPduCreator::serialize(uint8_t **buffer, size_t *size, size_t ma
|
|||||||
uint32_t fileSizeValue = info.getFileSize().getSize();
|
uint32_t fileSizeValue = info.getFileSize().getSize();
|
||||||
result = SerializeAdapter::serialize(&fileSizeValue, buffer, size, maxSize, streamEndianness);
|
result = SerializeAdapter::serialize(&fileSizeValue, buffer, size, maxSize, streamEndianness);
|
||||||
}
|
}
|
||||||
if (info.getFaultLoc() != nullptr and info.getConditionCode() != cfdp::ConditionCodes::NO_ERROR) {
|
if (info.getFaultLoc() != nullptr and info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) {
|
||||||
result = info.getFaultLoc()->serialize(buffer, size, maxSize, streamEndianness);
|
result = info.getFaultLoc()->serialize(buffer, size, maxSize, streamEndianness);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -25,7 +25,7 @@ ReturnValue_t EofPduReader::parseData() {
|
|||||||
|
|
||||||
bufPtr += currentIdx;
|
bufPtr += currentIdx;
|
||||||
deserLen -= currentIdx;
|
deserLen -= currentIdx;
|
||||||
info.setConditionCode(static_cast<cfdp::ConditionCodes>(*bufPtr >> 4));
|
info.setConditionCode(static_cast<cfdp::ConditionCode>(*bufPtr >> 4));
|
||||||
bufPtr += 1;
|
bufPtr += 1;
|
||||||
deserLen -= 1;
|
deserLen -= 1;
|
||||||
uint32_t checksum = 0;
|
uint32_t checksum = 0;
|
||||||
@ -47,7 +47,7 @@ ReturnValue_t EofPduReader::parseData() {
|
|||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (info.getConditionCode() != cfdp::ConditionCodes::NO_ERROR) {
|
if (info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) {
|
||||||
EntityIdTlv* tlvPtr = info.getFaultLoc();
|
EntityIdTlv* tlvPtr = info.getFaultLoc();
|
||||||
if (tlvPtr == nullptr) {
|
if (tlvPtr == nullptr) {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
FileDataCreator::FileDataCreator(PduConfig& conf, FileDataInfo& info)
|
FileDataCreator::FileDataCreator(PduConfig& conf, FileDataInfo& info)
|
||||||
: HeaderCreator(conf, cfdp::PduTypes::FILE_DATA, 0, info.getSegmentMetadataFlag()), info(info) {
|
: HeaderCreator(conf, cfdp::PduType::FILE_DATA, 0, info.getSegmentMetadataFlag()), info(info) {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "FileDirectiveCreator.h"
|
#include "FileDirectiveCreator.h"
|
||||||
|
|
||||||
FileDirectiveCreator::FileDirectiveCreator(PduConfig &pduConf, cfdp::FileDirectives directiveCode,
|
FileDirectiveCreator::FileDirectiveCreator(PduConfig &pduConf, cfdp::FileDirective directiveCode,
|
||||||
size_t directiveParamFieldLen)
|
size_t directiveParamFieldLen)
|
||||||
: HeaderCreator(pduConf, cfdp::PduTypes::FILE_DIRECTIVE, directiveParamFieldLen + 1),
|
: HeaderCreator(pduConf, cfdp::PduType::FILE_DIRECTIVE, directiveParamFieldLen + 1),
|
||||||
directiveCode(directiveCode) {}
|
directiveCode(directiveCode) {}
|
||||||
|
|
||||||
size_t FileDirectiveCreator::getSerializedSize() const {
|
size_t FileDirectiveCreator::getSerializedSize() const {
|
||||||
@ -36,4 +36,4 @@ void FileDirectiveCreator::setDirectiveDataFieldLen(size_t len) {
|
|||||||
HeaderCreator::setPduDataFieldLen(len + 1);
|
HeaderCreator::setPduDataFieldLen(len + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdp::FileDirectives FileDirectiveCreator::getDirectiveCode() const { return directiveCode; }
|
cfdp::FileDirective FileDirectiveCreator::getDirectiveCode() const { return directiveCode; }
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
|
|
||||||
class FileDirectiveCreator : public HeaderCreator {
|
class FileDirectiveCreator : public HeaderCreator {
|
||||||
public:
|
public:
|
||||||
FileDirectiveCreator(PduConfig& pduConf, cfdp::FileDirectives directiveCode,
|
FileDirectiveCreator(PduConfig& pduConf, cfdp::FileDirective directiveCode,
|
||||||
size_t directiveParamFieldLen);
|
size_t directiveParamFieldLen);
|
||||||
|
|
||||||
[[nodiscard]] cfdp::FileDirectives getDirectiveCode() const;
|
[[nodiscard]] cfdp::FileDirective getDirectiveCode() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This only returns the size of the PDU header + 1 for the directive code octet.
|
* This only returns the size of the PDU header + 1 for the directive code octet.
|
||||||
@ -28,7 +28,7 @@ class FileDirectiveCreator : public HeaderCreator {
|
|||||||
void setDirectiveDataFieldLen(size_t len);
|
void setDirectiveDataFieldLen(size_t len);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cfdp::FileDirectives directiveCode = cfdp::FileDirectives::INVALID_DIRECTIVE;
|
cfdp::FileDirective directiveCode = cfdp::FileDirective::INVALID_DIRECTIVE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_SRC_FSFW_CFDP_PDU_FILEDIRECTIVESERIALIZER_H_ */
|
#endif /* FSFW_SRC_FSFW_CFDP_PDU_FILEDIRECTIVESERIALIZER_H_ */
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
FileDirectiveReader::FileDirectiveReader(const uint8_t *pduBuf, size_t maxSize)
|
FileDirectiveReader::FileDirectiveReader(const uint8_t *pduBuf, size_t maxSize)
|
||||||
: PduHeaderReader(pduBuf, maxSize) {}
|
: PduHeaderReader(pduBuf, maxSize) {}
|
||||||
|
|
||||||
cfdp::FileDirectives FileDirectiveReader::getFileDirective() const { return fileDirective; }
|
cfdp::FileDirective FileDirectiveReader::getFileDirective() const { return fileDirective; }
|
||||||
|
|
||||||
ReturnValue_t FileDirectiveReader::parseData() {
|
ReturnValue_t FileDirectiveReader::parseData() {
|
||||||
ReturnValue_t result = PduHeaderReader::parseData();
|
ReturnValue_t result = PduHeaderReader::parseData();
|
||||||
@ -20,7 +20,7 @@ ReturnValue_t FileDirectiveReader::parseData() {
|
|||||||
if (not checkFileDirective(pointers.rawPtr[currentIdx])) {
|
if (not checkFileDirective(pointers.rawPtr[currentIdx])) {
|
||||||
return cfdp::INVALID_DIRECTIVE_FIELD;
|
return cfdp::INVALID_DIRECTIVE_FIELD;
|
||||||
}
|
}
|
||||||
setFileDirective(static_cast<cfdp::FileDirectives>(pointers.rawPtr[currentIdx]));
|
setFileDirective(static_cast<cfdp::FileDirective>(pointers.rawPtr[currentIdx]));
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,15 +30,15 @@ size_t FileDirectiveReader::getHeaderSize() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool FileDirectiveReader::checkFileDirective(uint8_t rawByte) {
|
bool FileDirectiveReader::checkFileDirective(uint8_t rawByte) {
|
||||||
if (rawByte < cfdp::FileDirectives::EOF_DIRECTIVE or
|
if (rawByte < cfdp::FileDirective::EOF_DIRECTIVE or
|
||||||
(rawByte > cfdp::FileDirectives::PROMPT and rawByte != cfdp::FileDirectives::KEEP_ALIVE)) {
|
(rawByte > cfdp::FileDirective::PROMPT and rawByte != cfdp::FileDirective::KEEP_ALIVE)) {
|
||||||
// Invalid directive field
|
// Invalid directive field
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileDirectiveReader::setFileDirective(cfdp::FileDirectives fileDirective_) {
|
void FileDirectiveReader::setFileDirective(cfdp::FileDirective fileDirective_) {
|
||||||
fileDirective = fileDirective_;
|
fileDirective = fileDirective_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class FileDirectiveReader : public PduHeaderReader {
|
|||||||
ReturnValue_t parseData() override;
|
ReturnValue_t parseData() override;
|
||||||
[[nodiscard]] size_t getHeaderSize() const override;
|
[[nodiscard]] size_t getHeaderSize() const override;
|
||||||
|
|
||||||
[[nodiscard]] cfdp::FileDirectives getFileDirective() const;
|
[[nodiscard]] cfdp::FileDirective getFileDirective() const;
|
||||||
|
|
||||||
void setEndianness(SerializeIF::Endianness endianness);
|
void setEndianness(SerializeIF::Endianness endianness);
|
||||||
[[nodiscard]] SerializeIF::Endianness getEndianness() const;
|
[[nodiscard]] SerializeIF::Endianness getEndianness() const;
|
||||||
@ -30,8 +30,8 @@ class FileDirectiveReader : public PduHeaderReader {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
private:
|
private:
|
||||||
void setFileDirective(cfdp::FileDirectives fileDirective);
|
void setFileDirective(cfdp::FileDirective fileDirective);
|
||||||
cfdp::FileDirectives fileDirective = cfdp::FileDirectives::INVALID_DIRECTIVE;
|
cfdp::FileDirective fileDirective = cfdp::FileDirective::INVALID_DIRECTIVE;
|
||||||
SerializeIF::Endianness endianness = SerializeIF::Endianness::NETWORK;
|
SerializeIF::Endianness endianness = SerializeIF::Endianness::NETWORK;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
FinishedInfo::FinishedInfo() {}
|
FinishedInfo::FinishedInfo() {}
|
||||||
|
|
||||||
FinishedInfo::FinishedInfo(cfdp::ConditionCodes conditionCode, cfdp::FileDeliveryCode deliveryCode,
|
FinishedInfo::FinishedInfo(cfdp::ConditionCode conditionCode, cfdp::FileDeliveryCode deliveryCode,
|
||||||
cfdp::FileDeliveryStatus fileStatus)
|
cfdp::FileDeliveryStatus fileStatus)
|
||||||
: conditionCode(conditionCode), deliveryCode(deliveryCode), fileStatus(fileStatus) {}
|
: conditionCode(conditionCode), deliveryCode(deliveryCode), fileStatus(fileStatus) {}
|
||||||
|
|
||||||
@ -76,9 +76,9 @@ ReturnValue_t FinishedInfo::getFaultLocation(EntityIdTlv** faultLocation) {
|
|||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdp::ConditionCodes FinishedInfo::getConditionCode() const { return conditionCode; }
|
cfdp::ConditionCode FinishedInfo::getConditionCode() const { return conditionCode; }
|
||||||
|
|
||||||
void FinishedInfo::setConditionCode(cfdp::ConditionCodes conditionCode) {
|
void FinishedInfo::setConditionCode(cfdp::ConditionCode conditionCode) {
|
||||||
this->conditionCode = conditionCode;
|
this->conditionCode = conditionCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
class FinishedInfo {
|
class FinishedInfo {
|
||||||
public:
|
public:
|
||||||
FinishedInfo();
|
FinishedInfo();
|
||||||
FinishedInfo(cfdp::ConditionCodes conditionCode, cfdp::FileDeliveryCode deliveryCode,
|
FinishedInfo(cfdp::ConditionCode conditionCode, cfdp::FileDeliveryCode deliveryCode,
|
||||||
cfdp::FileDeliveryStatus fileStatus);
|
cfdp::FileDeliveryStatus fileStatus);
|
||||||
|
|
||||||
[[nodiscard]] size_t getSerializedSize() const;
|
[[nodiscard]] size_t getSerializedSize() const;
|
||||||
@ -25,15 +25,15 @@ class FinishedInfo {
|
|||||||
[[nodiscard]] size_t getFsResponsesLen() const;
|
[[nodiscard]] size_t getFsResponsesLen() const;
|
||||||
void setFilestoreResponsesArrayLen(size_t fsResponsesLen);
|
void setFilestoreResponsesArrayLen(size_t fsResponsesLen);
|
||||||
ReturnValue_t getFaultLocation(EntityIdTlv** entityId);
|
ReturnValue_t getFaultLocation(EntityIdTlv** entityId);
|
||||||
[[nodiscard]] cfdp::ConditionCodes getConditionCode() const;
|
[[nodiscard]] cfdp::ConditionCode getConditionCode() const;
|
||||||
void setConditionCode(cfdp::ConditionCodes conditionCode);
|
void setConditionCode(cfdp::ConditionCode conditionCode);
|
||||||
[[nodiscard]] cfdp::FileDeliveryCode getDeliveryCode() const;
|
[[nodiscard]] cfdp::FileDeliveryCode getDeliveryCode() const;
|
||||||
void setDeliveryCode(cfdp::FileDeliveryCode deliveryCode);
|
void setDeliveryCode(cfdp::FileDeliveryCode deliveryCode);
|
||||||
[[nodiscard]] cfdp::FileDeliveryStatus getFileStatus() const;
|
[[nodiscard]] cfdp::FileDeliveryStatus getFileStatus() const;
|
||||||
void setFileStatus(cfdp::FileDeliveryStatus fileStatus);
|
void setFileStatus(cfdp::FileDeliveryStatus fileStatus);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cfdp::ConditionCodes conditionCode = cfdp::ConditionCodes::NO_CONDITION_FIELD;
|
cfdp::ConditionCode conditionCode = cfdp::ConditionCode::NO_CONDITION_FIELD;
|
||||||
cfdp::FileDeliveryCode deliveryCode = cfdp::FileDeliveryCode::DATA_COMPLETE;
|
cfdp::FileDeliveryCode deliveryCode = cfdp::FileDeliveryCode::DATA_COMPLETE;
|
||||||
cfdp::FileDeliveryStatus fileStatus = cfdp::FileDeliveryStatus::DISCARDED_DELIBERATELY;
|
cfdp::FileDeliveryStatus fileStatus = cfdp::FileDeliveryStatus::DISCARDED_DELIBERATELY;
|
||||||
FilestoreResponseTlv** fsResponses = nullptr;
|
FilestoreResponseTlv** fsResponses = nullptr;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "FinishedPduCreator.h"
|
#include "FinishedPduCreator.h"
|
||||||
|
|
||||||
FinishPduCreator::FinishPduCreator(PduConfig &conf, FinishedInfo &finishInfo)
|
FinishPduCreator::FinishPduCreator(PduConfig &conf, FinishedInfo &finishInfo)
|
||||||
: FileDirectiveCreator(conf, cfdp::FileDirectives::FINISH, 0), finishInfo(finishInfo) {
|
: FileDirectiveCreator(conf, cfdp::FileDirective::FINISH, 0), finishInfo(finishInfo) {
|
||||||
updateDirectiveFieldLen();
|
updateDirectiveFieldLen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ ReturnValue_t FinishPduReader::parseData() {
|
|||||||
return SerializeIF::STREAM_TOO_SHORT;
|
return SerializeIF::STREAM_TOO_SHORT;
|
||||||
}
|
}
|
||||||
uint8_t firstByte = *buf;
|
uint8_t firstByte = *buf;
|
||||||
auto condCode = static_cast<cfdp::ConditionCodes>((firstByte >> 4) & 0x0f);
|
auto condCode = static_cast<cfdp::ConditionCode>((firstByte >> 4) & 0x0f);
|
||||||
finishedInfo.setConditionCode(condCode);
|
finishedInfo.setConditionCode(condCode);
|
||||||
finishedInfo.setDeliveryCode(static_cast<cfdp::FileDeliveryCode>(firstByte >> 2 & 0b1));
|
finishedInfo.setDeliveryCode(static_cast<cfdp::FileDeliveryCode>(firstByte >> 2 & 0b1));
|
||||||
finishedInfo.setFileStatus(static_cast<cfdp::FileDeliveryStatus>(firstByte & 0b11));
|
finishedInfo.setFileStatus(static_cast<cfdp::FileDeliveryStatus>(firstByte & 0b11));
|
||||||
@ -31,14 +31,14 @@ ReturnValue_t FinishPduReader::parseData() {
|
|||||||
FinishedInfo& FinishPduReader::getInfo() { return finishedInfo; }
|
FinishedInfo& FinishPduReader::getInfo() { return finishedInfo; }
|
||||||
|
|
||||||
ReturnValue_t FinishPduReader::parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf,
|
ReturnValue_t FinishPduReader::parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf,
|
||||||
cfdp::ConditionCodes conditionCode) {
|
cfdp::ConditionCode conditionCode) {
|
||||||
ReturnValue_t result = returnvalue::OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
size_t fsResponsesIdx = 0;
|
size_t fsResponsesIdx = 0;
|
||||||
auto endianness = getEndianness();
|
auto endianness = getEndianness();
|
||||||
FilestoreResponseTlv** fsResponseArray = nullptr;
|
FilestoreResponseTlv** fsResponseArray = nullptr;
|
||||||
size_t fsResponseMaxArrayLen = 0;
|
size_t fsResponseMaxArrayLen = 0;
|
||||||
EntityIdTlv* faultLocation = nullptr;
|
EntityIdTlv* faultLocation = nullptr;
|
||||||
cfdp::TlvTypes nextTlv = cfdp::TlvTypes::INVALID_TLV;
|
cfdp::TlvType nextTlv = cfdp::TlvType::INVALID_TLV;
|
||||||
while (remLen > 0) {
|
while (remLen > 0) {
|
||||||
// Simply forward parse the TLV type. Every TLV type except the last one must be a Filestore
|
// Simply forward parse the TLV type. Every TLV type except the last one must be a Filestore
|
||||||
// Response TLV, and even the last one can be a Filestore Response TLV if the fault
|
// Response TLV, and even the last one can be a Filestore Response TLV if the fault
|
||||||
@ -46,8 +46,8 @@ ReturnValue_t FinishPduReader::parseTlvs(size_t remLen, size_t currentIdx, const
|
|||||||
if (currentIdx + 2 > maxSize) {
|
if (currentIdx + 2 > maxSize) {
|
||||||
return SerializeIF::STREAM_TOO_SHORT;
|
return SerializeIF::STREAM_TOO_SHORT;
|
||||||
}
|
}
|
||||||
nextTlv = static_cast<cfdp::TlvTypes>(*buf);
|
nextTlv = static_cast<cfdp::TlvType>(*buf);
|
||||||
if (nextTlv == cfdp::TlvTypes::FILESTORE_RESPONSE) {
|
if (nextTlv == cfdp::TlvType::FILESTORE_RESPONSE) {
|
||||||
if (fsResponseArray == nullptr) {
|
if (fsResponseArray == nullptr) {
|
||||||
if (not finishedInfo.canHoldFsResponses()) {
|
if (not finishedInfo.canHoldFsResponses()) {
|
||||||
return cfdp::FINISHED_CANT_PARSE_FS_RESPONSES;
|
return cfdp::FINISHED_CANT_PARSE_FS_RESPONSES;
|
||||||
@ -63,11 +63,11 @@ ReturnValue_t FinishPduReader::parseTlvs(size_t remLen, size_t currentIdx, const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
fsResponsesIdx += 1;
|
fsResponsesIdx += 1;
|
||||||
} else if (nextTlv == cfdp::TlvTypes::ENTITY_ID) {
|
} else if (nextTlv == cfdp::TlvType::ENTITY_ID) {
|
||||||
// This needs to be the last TLV and it should not be here if the condition code
|
// This needs to be the last TLV and it should not be here if the condition code
|
||||||
// is "No Error" or "Unsupported Checksum Type"
|
// is "No Error" or "Unsupported Checksum Type"
|
||||||
if (conditionCode == cfdp::ConditionCodes::NO_ERROR or
|
if (conditionCode == cfdp::ConditionCode::NO_ERROR or
|
||||||
conditionCode == cfdp::ConditionCodes::UNSUPPORTED_CHECKSUM_TYPE) {
|
conditionCode == cfdp::ConditionCode::UNSUPPORTED_CHECKSUM_TYPE) {
|
||||||
return cfdp::INVALID_TLV_TYPE;
|
return cfdp::INVALID_TLV_TYPE;
|
||||||
}
|
}
|
||||||
result = finishedInfo.getFaultLocation(&faultLocation);
|
result = finishedInfo.getFaultLocation(&faultLocation);
|
||||||
|
@ -16,7 +16,7 @@ class FinishPduReader : public FileDirectiveReader {
|
|||||||
FinishedInfo& finishedInfo;
|
FinishedInfo& finishedInfo;
|
||||||
|
|
||||||
ReturnValue_t parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf,
|
ReturnValue_t parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf,
|
||||||
cfdp::ConditionCodes conditionCode);
|
cfdp::ConditionCode conditionCode);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_CFDP_PDU_FINISHEDPDUDESERIALIZER_H_ */
|
#endif /* FSFW_CFDP_PDU_FINISHEDPDUDESERIALIZER_H_ */
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "HeaderCreator.h"
|
#include "HeaderCreator.h"
|
||||||
|
|
||||||
HeaderCreator::HeaderCreator(PduConfig &pduConf, cfdp::PduTypes pduType, size_t initPduDataFieldLen,
|
HeaderCreator::HeaderCreator(PduConfig &pduConf, cfdp::PduType pduType, size_t initPduDataFieldLen,
|
||||||
cfdp::SegmentMetadataFlag segmentMetadataFlag,
|
cfdp::SegmentMetadataFlag segmentMetadataFlag,
|
||||||
cfdp::SegmentationControl segCtrl)
|
cfdp::SegmentationControl segCtrl)
|
||||||
: pduType(pduType),
|
: pduType(pduType),
|
||||||
@ -65,17 +65,17 @@ void HeaderCreator::setPduDataFieldLen(size_t pduDataFieldLen_) {
|
|||||||
pduDataFieldLen = pduDataFieldLen_;
|
pduDataFieldLen = pduDataFieldLen_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeaderCreator::setPduType(cfdp::PduTypes pduType_) { pduType = pduType_; }
|
void HeaderCreator::setPduType(cfdp::PduType pduType_) { pduType = pduType_; }
|
||||||
|
|
||||||
void HeaderCreator::setSegmentMetadataFlag(cfdp::SegmentMetadataFlag segmentMetadataFlag_) {
|
void HeaderCreator::setSegmentMetadataFlag(cfdp::SegmentMetadataFlag segmentMetadataFlag_) {
|
||||||
segmentMetadataFlag = segmentMetadataFlag_;
|
segmentMetadataFlag = segmentMetadataFlag_;
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdp::PduTypes HeaderCreator::getPduType() const { return pduType; }
|
cfdp::PduType HeaderCreator::getPduType() const { return pduType; }
|
||||||
|
|
||||||
cfdp::Direction HeaderCreator::getDirection() const { return pduConf.direction; }
|
cfdp::Direction HeaderCreator::getDirection() const { return pduConf.direction; }
|
||||||
|
|
||||||
cfdp::TransmissionModes HeaderCreator::getTransmissionMode() const { return pduConf.mode; }
|
cfdp::TransmissionMode HeaderCreator::getTransmissionMode() const { return pduConf.mode; }
|
||||||
|
|
||||||
bool HeaderCreator::getCrcFlag() const { return pduConf.crcFlag; }
|
bool HeaderCreator::getCrcFlag() const { return pduConf.crcFlag; }
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
class HeaderCreator : public SerializeIF, public PduHeaderIF {
|
class HeaderCreator : public SerializeIF, public PduHeaderIF {
|
||||||
public:
|
public:
|
||||||
HeaderCreator(
|
HeaderCreator(
|
||||||
PduConfig& pduConf, cfdp::PduTypes pduType, size_t initPduDataFieldLen,
|
PduConfig& pduConf, cfdp::PduType pduType, size_t initPduDataFieldLen,
|
||||||
cfdp::SegmentMetadataFlag segmentMetadataFlag = cfdp::SegmentMetadataFlag::NOT_PRESENT,
|
cfdp::SegmentMetadataFlag segmentMetadataFlag = cfdp::SegmentMetadataFlag::NOT_PRESENT,
|
||||||
cfdp::SegmentationControl segCtrl =
|
cfdp::SegmentationControl segCtrl =
|
||||||
cfdp::SegmentationControl::NO_RECORD_BOUNDARIES_PRESERVATION);
|
cfdp::SegmentationControl::NO_RECORD_BOUNDARIES_PRESERVATION);
|
||||||
@ -29,15 +29,15 @@ class HeaderCreator : public SerializeIF, public PduHeaderIF {
|
|||||||
Endianness streamEndianness) override;
|
Endianness streamEndianness) override;
|
||||||
|
|
||||||
void setPduDataFieldLen(size_t pduDataFieldLen);
|
void setPduDataFieldLen(size_t pduDataFieldLen);
|
||||||
void setPduType(cfdp::PduTypes pduType);
|
void setPduType(cfdp::PduType pduType);
|
||||||
void setSegmentMetadataFlag(cfdp::SegmentMetadataFlag);
|
void setSegmentMetadataFlag(cfdp::SegmentMetadataFlag);
|
||||||
|
|
||||||
[[nodiscard]] size_t getPduDataFieldLen() const override;
|
[[nodiscard]] size_t getPduDataFieldLen() const override;
|
||||||
[[nodiscard]] size_t getWholePduSize() const override;
|
[[nodiscard]] size_t getWholePduSize() const override;
|
||||||
|
|
||||||
[[nodiscard]] cfdp::PduTypes getPduType() const override;
|
[[nodiscard]] cfdp::PduType getPduType() const override;
|
||||||
[[nodiscard]] cfdp::Direction getDirection() const override;
|
[[nodiscard]] cfdp::Direction getDirection() const override;
|
||||||
[[nodiscard]] cfdp::TransmissionModes getTransmissionMode() const override;
|
[[nodiscard]] cfdp::TransmissionMode getTransmissionMode() const override;
|
||||||
[[nodiscard]] bool getCrcFlag() const override;
|
[[nodiscard]] bool getCrcFlag() const override;
|
||||||
[[nodiscard]] bool getLargeFileFlag() const override;
|
[[nodiscard]] bool getLargeFileFlag() const override;
|
||||||
[[nodiscard]] cfdp::SegmentationControl getSegmentationControl() const override;
|
[[nodiscard]] cfdp::SegmentationControl getSegmentationControl() const override;
|
||||||
@ -52,7 +52,7 @@ class HeaderCreator : public SerializeIF, public PduHeaderIF {
|
|||||||
void getTransactionSeqNum(cfdp::TransactionSeqNum& seqNum) const override;
|
void getTransactionSeqNum(cfdp::TransactionSeqNum& seqNum) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cfdp::PduTypes pduType;
|
cfdp::PduType pduType;
|
||||||
cfdp::SegmentMetadataFlag segmentMetadataFlag;
|
cfdp::SegmentMetadataFlag segmentMetadataFlag;
|
||||||
cfdp::SegmentationControl segmentationCtrl;
|
cfdp::SegmentationControl segmentationCtrl;
|
||||||
size_t pduDataFieldLen;
|
size_t pduDataFieldLen;
|
||||||
|
@ -57,16 +57,16 @@ size_t PduHeaderReader::getWholePduSize() const {
|
|||||||
return getPduDataFieldLen() + PduHeaderReader::getHeaderSize();
|
return getPduDataFieldLen() + PduHeaderReader::getHeaderSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdp::PduTypes PduHeaderReader::getPduType() const {
|
cfdp::PduType PduHeaderReader::getPduType() const {
|
||||||
return static_cast<cfdp::PduTypes>((pointers.fixedHeader->firstByte >> 4) & 0x01);
|
return static_cast<cfdp::PduType>((pointers.fixedHeader->firstByte >> 4) & 0x01);
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdp::Direction PduHeaderReader::getDirection() const {
|
cfdp::Direction PduHeaderReader::getDirection() const {
|
||||||
return static_cast<cfdp::Direction>((pointers.fixedHeader->firstByte >> 3) & 0x01);
|
return static_cast<cfdp::Direction>((pointers.fixedHeader->firstByte >> 3) & 0x01);
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdp::TransmissionModes PduHeaderReader::getTransmissionMode() const {
|
cfdp::TransmissionMode PduHeaderReader::getTransmissionMode() const {
|
||||||
return static_cast<cfdp::TransmissionModes>((pointers.fixedHeader->firstByte >> 2) & 0x01);
|
return static_cast<cfdp::TransmissionMode>((pointers.fixedHeader->firstByte >> 2) & 0x01);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PduHeaderReader::getCrcFlag() const { return (pointers.fixedHeader->firstByte >> 1) & 0x01; }
|
bool PduHeaderReader::getCrcFlag() const { return (pointers.fixedHeader->firstByte >> 1) & 0x01; }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "KeepAlivePduCreator.h"
|
#include "KeepAlivePduCreator.h"
|
||||||
|
|
||||||
KeepAlivePduCreator::KeepAlivePduCreator(PduConfig &conf, cfdp::FileSize &progress)
|
KeepAlivePduCreator::KeepAlivePduCreator(PduConfig &conf, cfdp::FileSize &progress)
|
||||||
: FileDirectiveCreator(conf, cfdp::FileDirectives::KEEP_ALIVE, 4), progress(progress) {
|
: FileDirectiveCreator(conf, cfdp::FileDirective::KEEP_ALIVE, 4), progress(progress) {
|
||||||
updateDirectiveFieldLen();
|
updateDirectiveFieldLen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "MetadataInfo.h"
|
#include "MetadataInfo.h"
|
||||||
|
|
||||||
MetadataInfo::MetadataInfo(bool closureRequested, cfdp::ChecksumTypes checksumType,
|
MetadataInfo::MetadataInfo(bool closureRequested, cfdp::ChecksumType checksumType,
|
||||||
cfdp::FileSize& fileSize, cfdp::StringLv& sourceFileName,
|
cfdp::FileSize& fileSize, cfdp::StringLv& sourceFileName,
|
||||||
cfdp::StringLv& destFileName)
|
cfdp::StringLv& destFileName)
|
||||||
: MetadataInfo(fileSize, sourceFileName, destFileName) {
|
: MetadataInfo(fileSize, sourceFileName, destFileName) {
|
||||||
@ -23,9 +23,9 @@ void MetadataInfo::setOptionsArray(cfdp::Tlv** optionsArray_, std::optional<size
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdp::ChecksumTypes MetadataInfo::getChecksumType() const { return checksumType; }
|
cfdp::ChecksumType MetadataInfo::getChecksumType() const { return checksumType; }
|
||||||
|
|
||||||
void MetadataInfo::setChecksumType(cfdp::ChecksumTypes checksumType_) {
|
void MetadataInfo::setChecksumType(cfdp::ChecksumType checksumType_) {
|
||||||
checksumType = checksumType_;
|
checksumType = checksumType_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,15 +13,15 @@ class MetadataInfo {
|
|||||||
public:
|
public:
|
||||||
MetadataInfo(cfdp::FileSize& fileSize, cfdp::StringLv& sourceFileName,
|
MetadataInfo(cfdp::FileSize& fileSize, cfdp::StringLv& sourceFileName,
|
||||||
cfdp::StringLv& destFileName);
|
cfdp::StringLv& destFileName);
|
||||||
MetadataInfo(bool closureRequested, cfdp::ChecksumTypes checksumType, cfdp::FileSize& fileSize,
|
MetadataInfo(bool closureRequested, cfdp::ChecksumType checksumType, cfdp::FileSize& fileSize,
|
||||||
cfdp::StringLv& sourceFileName, cfdp::StringLv& destFileName);
|
cfdp::StringLv& sourceFileName, cfdp::StringLv& destFileName);
|
||||||
|
|
||||||
size_t getSerializedSize(bool fssLarge = false);
|
size_t getSerializedSize(bool fssLarge = false);
|
||||||
|
|
||||||
void setOptionsArray(cfdp::Tlv** optionsArray, std::optional<size_t> optionsLen,
|
void setOptionsArray(cfdp::Tlv** optionsArray, std::optional<size_t> optionsLen,
|
||||||
std::optional<size_t> maxOptionsLen);
|
std::optional<size_t> maxOptionsLen);
|
||||||
[[nodiscard]] cfdp::ChecksumTypes getChecksumType() const;
|
[[nodiscard]] cfdp::ChecksumType getChecksumType() const;
|
||||||
void setChecksumType(cfdp::ChecksumTypes checksumType);
|
void setChecksumType(cfdp::ChecksumType checksumType);
|
||||||
[[nodiscard]] bool isClosureRequested() const;
|
[[nodiscard]] bool isClosureRequested() const;
|
||||||
void setClosureRequested(bool closureRequested = false);
|
void setClosureRequested(bool closureRequested = false);
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class MetadataInfo {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool closureRequested = false;
|
bool closureRequested = false;
|
||||||
cfdp::ChecksumTypes checksumType = cfdp::ChecksumTypes::NULL_CHECKSUM;
|
cfdp::ChecksumType checksumType = cfdp::ChecksumType::NULL_CHECKSUM;
|
||||||
cfdp::FileSize& fileSize;
|
cfdp::FileSize& fileSize;
|
||||||
cfdp::StringLv& sourceFileName;
|
cfdp::StringLv& sourceFileName;
|
||||||
cfdp::StringLv& destFileName;
|
cfdp::StringLv& destFileName;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "MetadataPduCreator.h"
|
#include "MetadataPduCreator.h"
|
||||||
|
|
||||||
MetadataPduCreator::MetadataPduCreator(PduConfig &conf, MetadataInfo &info)
|
MetadataPduCreator::MetadataPduCreator(PduConfig &conf, MetadataInfo &info)
|
||||||
: FileDirectiveCreator(conf, cfdp::FileDirectives::METADATA, 5), info(info) {
|
: FileDirectiveCreator(conf, cfdp::FileDirective::METADATA, 5), info(info) {
|
||||||
updateDirectiveFieldLen();
|
updateDirectiveFieldLen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ ReturnValue_t MetadataPduReader::parseData() {
|
|||||||
return SerializeIF::STREAM_TOO_SHORT;
|
return SerializeIF::STREAM_TOO_SHORT;
|
||||||
}
|
}
|
||||||
info.setClosureRequested((*buf >> 6) & 0x01);
|
info.setClosureRequested((*buf >> 6) & 0x01);
|
||||||
info.setChecksumType(static_cast<cfdp::ChecksumTypes>(*buf & 0x0f));
|
info.setChecksumType(static_cast<cfdp::ChecksumType>(*buf & 0x0f));
|
||||||
remSize -= 1;
|
remSize -= 1;
|
||||||
buf += 1;
|
buf += 1;
|
||||||
auto endianness = getEndianness();
|
auto endianness = getEndianness();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "NakPduCreator.h"
|
#include "NakPduCreator.h"
|
||||||
|
|
||||||
NakPduCreator::NakPduCreator(PduConfig &pduConf, NakInfo &nakInfo)
|
NakPduCreator::NakPduCreator(PduConfig &pduConf, NakInfo &nakInfo)
|
||||||
: FileDirectiveCreator(pduConf, cfdp::FileDirectives::NAK, 0), nakInfo(nakInfo) {
|
: FileDirectiveCreator(pduConf, cfdp::FileDirective::NAK, 0), nakInfo(nakInfo) {
|
||||||
updateDirectiveFieldLen();
|
updateDirectiveFieldLen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
PduConfig::PduConfig(cfdp::EntityId sourceId, cfdp::EntityId destId, cfdp::TransmissionModes mode,
|
PduConfig::PduConfig(cfdp::EntityId sourceId, cfdp::EntityId destId, cfdp::TransmissionMode mode,
|
||||||
cfdp::TransactionSeqNum seqNum, bool crcFlag, bool largeFile,
|
cfdp::TransactionSeqNum seqNum, bool crcFlag, bool largeFile,
|
||||||
cfdp::Direction direction)
|
cfdp::Direction direction)
|
||||||
: mode(mode),
|
: mode(mode),
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
class PduConfig {
|
class PduConfig {
|
||||||
public:
|
public:
|
||||||
PduConfig() = default;
|
PduConfig() = default;
|
||||||
PduConfig(cfdp::EntityId sourceId, cfdp::EntityId destId, cfdp::TransmissionModes mode,
|
PduConfig(cfdp::EntityId sourceId, cfdp::EntityId destId, cfdp::TransmissionMode mode,
|
||||||
cfdp::TransactionSeqNum seqNum, bool crcFlag = false, bool largeFile = false,
|
cfdp::TransactionSeqNum seqNum, bool crcFlag = false, bool largeFile = false,
|
||||||
cfdp::Direction direction = cfdp::Direction::TOWARDS_RECEIVER);
|
cfdp::Direction direction = cfdp::Direction::TOWARDS_RECEIVER);
|
||||||
|
|
||||||
cfdp::TransmissionModes mode = cfdp::TransmissionModes::ACKNOWLEDGED;
|
cfdp::TransmissionMode mode = cfdp::TransmissionMode::ACKNOWLEDGED;
|
||||||
cfdp::TransactionSeqNum seqNum;
|
cfdp::TransactionSeqNum seqNum;
|
||||||
cfdp::EntityId sourceId;
|
cfdp::EntityId sourceId;
|
||||||
cfdp::EntityId destId;
|
cfdp::EntityId destId;
|
||||||
|
@ -17,9 +17,9 @@ class PduHeaderIF {
|
|||||||
|
|
||||||
[[nodiscard]] virtual size_t getWholePduSize() const = 0;
|
[[nodiscard]] virtual size_t getWholePduSize() const = 0;
|
||||||
[[nodiscard]] virtual size_t getPduDataFieldLen() const = 0;
|
[[nodiscard]] virtual size_t getPduDataFieldLen() const = 0;
|
||||||
[[nodiscard]] virtual cfdp::PduTypes getPduType() const = 0;
|
[[nodiscard]] virtual cfdp::PduType getPduType() const = 0;
|
||||||
[[nodiscard]] virtual cfdp::Direction getDirection() const = 0;
|
[[nodiscard]] virtual cfdp::Direction getDirection() const = 0;
|
||||||
[[nodiscard]] virtual cfdp::TransmissionModes getTransmissionMode() const = 0;
|
[[nodiscard]] virtual cfdp::TransmissionMode getTransmissionMode() const = 0;
|
||||||
[[nodiscard]] virtual bool getCrcFlag() const = 0;
|
[[nodiscard]] virtual bool getCrcFlag() const = 0;
|
||||||
[[nodiscard]] virtual bool getLargeFileFlag() const = 0;
|
[[nodiscard]] virtual bool getLargeFileFlag() const = 0;
|
||||||
[[nodiscard]] virtual cfdp::SegmentationControl getSegmentationControl() const = 0;
|
[[nodiscard]] virtual cfdp::SegmentationControl getSegmentationControl() const = 0;
|
||||||
|
@ -56,9 +56,9 @@ class PduHeaderReader : public RedirectableDataPointerIF, public PduHeaderIF {
|
|||||||
[[nodiscard]] size_t getPduDataFieldLen() const override;
|
[[nodiscard]] size_t getPduDataFieldLen() const override;
|
||||||
[[nodiscard]] size_t getWholePduSize() const override;
|
[[nodiscard]] size_t getWholePduSize() const override;
|
||||||
|
|
||||||
[[nodiscard]] cfdp::PduTypes getPduType() const override;
|
[[nodiscard]] cfdp::PduType getPduType() const override;
|
||||||
[[nodiscard]] cfdp::Direction getDirection() const override;
|
[[nodiscard]] cfdp::Direction getDirection() const override;
|
||||||
[[nodiscard]] cfdp::TransmissionModes getTransmissionMode() const override;
|
[[nodiscard]] cfdp::TransmissionMode getTransmissionMode() const override;
|
||||||
[[nodiscard]] bool getCrcFlag() const override;
|
[[nodiscard]] bool getCrcFlag() const override;
|
||||||
[[nodiscard]] bool getLargeFileFlag() const override;
|
[[nodiscard]] bool getLargeFileFlag() const override;
|
||||||
[[nodiscard]] cfdp::SegmentationControl getSegmentationControl() const override;
|
[[nodiscard]] cfdp::SegmentationControl getSegmentationControl() const override;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "PromptPduCreator.h"
|
#include "PromptPduCreator.h"
|
||||||
|
|
||||||
PromptPduCreator::PromptPduCreator(PduConfig &conf, cfdp::PromptResponseRequired responseRequired)
|
PromptPduCreator::PromptPduCreator(PduConfig &conf, cfdp::PromptResponseRequired responseRequired)
|
||||||
: FileDirectiveCreator(conf, cfdp::FileDirectives::PROMPT, 1),
|
: FileDirectiveCreator(conf, cfdp::FileDirective::PROMPT, 1),
|
||||||
responseRequired(responseRequired) {}
|
responseRequired(responseRequired) {}
|
||||||
|
|
||||||
size_t PromptPduCreator::getSerializedSize() const {
|
size_t PromptPduCreator::getSerializedSize() const {
|
||||||
|
@ -11,7 +11,7 @@ ReturnValue_t EntityIdTlv::serialize(uint8_t **buffer, size_t *size, size_t maxS
|
|||||||
if (maxSize < this->getSerializedSize()) {
|
if (maxSize < this->getSerializedSize()) {
|
||||||
return BUFFER_TOO_SHORT;
|
return BUFFER_TOO_SHORT;
|
||||||
}
|
}
|
||||||
**buffer = cfdp::TlvTypes::ENTITY_ID;
|
**buffer = cfdp::TlvType::ENTITY_ID;
|
||||||
*size += 1;
|
*size += 1;
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
size_t serLen = entityId.getSerializedSize();
|
size_t serLen = entityId.getSerializedSize();
|
||||||
@ -28,8 +28,8 @@ ReturnValue_t EntityIdTlv::deSerialize(const uint8_t **buffer, size_t *size,
|
|||||||
if (*size < 3) {
|
if (*size < 3) {
|
||||||
return STREAM_TOO_SHORT;
|
return STREAM_TOO_SHORT;
|
||||||
}
|
}
|
||||||
cfdp::TlvTypes type = static_cast<cfdp::TlvTypes>(**buffer);
|
cfdp::TlvType type = static_cast<cfdp::TlvType>(**buffer);
|
||||||
if (type != cfdp::TlvTypes::ENTITY_ID) {
|
if (type != cfdp::TlvType::ENTITY_ID) {
|
||||||
return cfdp::INVALID_TLV_TYPE;
|
return cfdp::INVALID_TLV_TYPE;
|
||||||
}
|
}
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
@ -54,6 +54,6 @@ ReturnValue_t EntityIdTlv::deSerialize(cfdp::Tlv &tlv, Endianness endianness) {
|
|||||||
|
|
||||||
uint8_t EntityIdTlv::getLengthField() const { return 1 + entityId.getSerializedSize(); }
|
uint8_t EntityIdTlv::getLengthField() const { return 1 + entityId.getSerializedSize(); }
|
||||||
|
|
||||||
cfdp::TlvTypes EntityIdTlv::getType() const { return cfdp::TlvTypes::ENTITY_ID; }
|
cfdp::TlvType EntityIdTlv::getType() const { return cfdp::TlvType::ENTITY_ID; }
|
||||||
|
|
||||||
cfdp::EntityId &EntityIdTlv::getEntityId() { return entityId; }
|
cfdp::EntityId &EntityIdTlv::getEntityId() { return entityId; }
|
||||||
|
@ -27,7 +27,7 @@ class EntityIdTlv : public TlvIF {
|
|||||||
Endianness streamEndianness) override;
|
Endianness streamEndianness) override;
|
||||||
|
|
||||||
uint8_t getLengthField() const override;
|
uint8_t getLengthField() const override;
|
||||||
cfdp::TlvTypes getType() const override;
|
cfdp::TlvType getType() const override;
|
||||||
|
|
||||||
cfdp::EntityId& getEntityId();
|
cfdp::EntityId& getEntityId();
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "FaultHandlerOverrideTlv.h"
|
#include "FaultHandlerOverrideTlv.h"
|
||||||
|
|
||||||
FaultHandlerOverrideTlv::FaultHandlerOverrideTlv(cfdp::ConditionCodes conditionCode,
|
FaultHandlerOverrideTlv::FaultHandlerOverrideTlv(cfdp::ConditionCode conditionCode,
|
||||||
cfdp::FaultHandlerCodes handlerCode)
|
cfdp::FaultHandlerCode handlerCode)
|
||||||
: conditionCode(conditionCode), handlerCode(handlerCode) {}
|
: conditionCode(conditionCode), handlerCode(handlerCode) {}
|
||||||
|
|
||||||
FaultHandlerOverrideTlv::FaultHandlerOverrideTlv() = default;
|
FaultHandlerOverrideTlv::FaultHandlerOverrideTlv() = default;
|
||||||
@ -32,8 +32,8 @@ ReturnValue_t FaultHandlerOverrideTlv::deSerialize(const uint8_t **buffer, size_
|
|||||||
if (*size < 3) {
|
if (*size < 3) {
|
||||||
return SerializeIF::STREAM_TOO_SHORT;
|
return SerializeIF::STREAM_TOO_SHORT;
|
||||||
}
|
}
|
||||||
auto detectedType = static_cast<cfdp::TlvTypes>(**buffer);
|
auto detectedType = static_cast<cfdp::TlvType>(**buffer);
|
||||||
if (detectedType != cfdp::TlvTypes::FAULT_HANDLER) {
|
if (detectedType != cfdp::TlvType::FAULT_HANDLER) {
|
||||||
return cfdp::INVALID_TLV_TYPE;
|
return cfdp::INVALID_TLV_TYPE;
|
||||||
}
|
}
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
@ -44,11 +44,11 @@ ReturnValue_t FaultHandlerOverrideTlv::deSerialize(const uint8_t **buffer, size_
|
|||||||
}
|
}
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size += 1;
|
*size += 1;
|
||||||
this->conditionCode = static_cast<cfdp::ConditionCodes>((**buffer >> 4) & 0x0f);
|
this->conditionCode = static_cast<cfdp::ConditionCode>((**buffer >> 4) & 0x0f);
|
||||||
this->handlerCode = static_cast<cfdp::FaultHandlerCodes>(**buffer & 0x0f);
|
this->handlerCode = static_cast<cfdp::FaultHandlerCode>(**buffer & 0x0f);
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size += 1;
|
*size += 1;
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdp::TlvTypes FaultHandlerOverrideTlv::getType() const { return cfdp::TlvTypes::FAULT_HANDLER; }
|
cfdp::TlvType FaultHandlerOverrideTlv::getType() const { return cfdp::TlvType::FAULT_HANDLER; }
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
class FaultHandlerOverrideTlv : public TlvIF {
|
class FaultHandlerOverrideTlv : public TlvIF {
|
||||||
public:
|
public:
|
||||||
FaultHandlerOverrideTlv();
|
FaultHandlerOverrideTlv();
|
||||||
FaultHandlerOverrideTlv(cfdp::ConditionCodes conditionCode, cfdp::FaultHandlerCodes handlerCode);
|
FaultHandlerOverrideTlv(cfdp::ConditionCode conditionCode, cfdp::FaultHandlerCode handlerCode);
|
||||||
|
|
||||||
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
Endianness streamEndianness) const override;
|
Endianness streamEndianness) const override;
|
||||||
@ -16,11 +16,11 @@ class FaultHandlerOverrideTlv : public TlvIF {
|
|||||||
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;
|
||||||
[[nodiscard]] uint8_t getLengthField() const override;
|
[[nodiscard]] uint8_t getLengthField() const override;
|
||||||
[[nodiscard]] cfdp::TlvTypes getType() const override;
|
[[nodiscard]] cfdp::TlvType getType() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cfdp::ConditionCodes conditionCode = cfdp::ConditionCodes::NO_CONDITION_FIELD;
|
cfdp::ConditionCode conditionCode = cfdp::ConditionCode::NO_CONDITION_FIELD;
|
||||||
cfdp::FaultHandlerCodes handlerCode = cfdp::FaultHandlerCodes::RESERVED;
|
cfdp::FaultHandlerCode handlerCode = cfdp::FaultHandlerCode::RESERVED;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_SRC_FSFW_CFDP_TLV_FAULTHANDLEROVERRIDETLV_H_ */
|
#endif /* FSFW_SRC_FSFW_CFDP_TLV_FAULTHANDLEROVERRIDETLV_H_ */
|
||||||
|
@ -76,4 +76,4 @@ ReturnValue_t FilestoreRequestTlv::deSerializeFromValue(const uint8_t **buffer,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdp::TlvTypes FilestoreRequestTlv::getType() const { return cfdp::TlvTypes::FILESTORE_REQUEST; }
|
cfdp::TlvType FilestoreRequestTlv::getType() const { return cfdp::TlvType::FILESTORE_REQUEST; }
|
||||||
|
@ -30,7 +30,7 @@ class FilestoreRequestTlv : public cfdp::FilestoreTlvBase {
|
|||||||
Endianness streamEndianness) override;
|
Endianness streamEndianness) override;
|
||||||
|
|
||||||
[[nodiscard]] uint8_t getLengthField() const override;
|
[[nodiscard]] uint8_t getLengthField() const override;
|
||||||
[[nodiscard]] cfdp::TlvTypes getType() const override;
|
[[nodiscard]] cfdp::TlvType getType() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cfdp::Lv *secondFileName = nullptr;
|
cfdp::Lv *secondFileName = nullptr;
|
||||||
|
@ -112,4 +112,4 @@ ReturnValue_t FilestoreResponseTlv::deSerialize(const cfdp::Tlv &tlv, Endianness
|
|||||||
|
|
||||||
uint8_t FilestoreResponseTlv::getStatusCode() const { return statusCode; }
|
uint8_t FilestoreResponseTlv::getStatusCode() const { return statusCode; }
|
||||||
|
|
||||||
cfdp::TlvTypes FilestoreResponseTlv::getType() const { return cfdp::TlvTypes::FILESTORE_RESPONSE; }
|
cfdp::TlvType FilestoreResponseTlv::getType() const { return cfdp::TlvType::FILESTORE_RESPONSE; }
|
||||||
|
@ -33,7 +33,7 @@ class FilestoreResponseTlv : public cfdp::FilestoreTlvBase {
|
|||||||
Endianness streamEndianness) override;
|
Endianness streamEndianness) override;
|
||||||
|
|
||||||
[[nodiscard]] uint8_t getLengthField() const override;
|
[[nodiscard]] uint8_t getLengthField() const override;
|
||||||
[[nodiscard]] cfdp::TlvTypes getType() const override;
|
[[nodiscard]] cfdp::TlvType getType() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t statusCode;
|
uint8_t statusCode;
|
||||||
|
@ -102,7 +102,7 @@ class FilestoreTlvBase : public TlvIF {
|
|||||||
if (*size < 3) {
|
if (*size < 3) {
|
||||||
return SerializeIF::STREAM_TOO_SHORT;
|
return SerializeIF::STREAM_TOO_SHORT;
|
||||||
}
|
}
|
||||||
auto type = static_cast<cfdp::TlvTypes>(**buffer);
|
auto type = static_cast<cfdp::TlvType>(**buffer);
|
||||||
if (type != getType()) {
|
if (type != getType()) {
|
||||||
return cfdp::INVALID_TLV_TYPE;
|
return cfdp::INVALID_TLV_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "FlowLabelTlv.h"
|
#include "FlowLabelTlv.h"
|
||||||
|
|
||||||
FlowLabelTlv::FlowLabelTlv(uint8_t* value, size_t size)
|
FlowLabelTlv::FlowLabelTlv(uint8_t* value, size_t size)
|
||||||
: Tlv(cfdp::TlvTypes::FLOW_LABEL, value, size) {}
|
: Tlv(cfdp::TlvType::FLOW_LABEL, value, size) {}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "MessageToUserTlv.h"
|
#include "MessageToUserTlv.h"
|
||||||
|
|
||||||
MessageToUserTlv::MessageToUserTlv(uint8_t* value, size_t size)
|
MessageToUserTlv::MessageToUserTlv(uint8_t* value, size_t size)
|
||||||
: Tlv(cfdp::TlvTypes::MSG_TO_USER, value, size) {}
|
: Tlv(cfdp::TlvType::MSG_TO_USER, value, size) {}
|
||||||
|
|
||||||
MessageToUserTlv::MessageToUserTlv() : Tlv() {}
|
MessageToUserTlv::MessageToUserTlv() : Tlv() {}
|
||||||
|
|
||||||
MessageToUserTlv::MessageToUserTlv(const std::vector<uint8_t>& data)
|
MessageToUserTlv::MessageToUserTlv(const std::vector<uint8_t>& data)
|
||||||
: Tlv(cfdp::TlvTypes::MSG_TO_USER, data.data(), data.size()) {}
|
: Tlv(cfdp::TlvType::MSG_TO_USER, data.data(), data.size()) {}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "Tlv.h"
|
#include "Tlv.h"
|
||||||
|
|
||||||
cfdp::Tlv::Tlv(TlvTypes type, const uint8_t *value, size_t size)
|
cfdp::Tlv::Tlv(TlvType type, const uint8_t *value, size_t size)
|
||||||
: type(type), value(value, size, true) {
|
: type(type), value(value, size, true) {
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
zeroLen = false;
|
zeroLen = false;
|
||||||
@ -17,7 +17,7 @@ ReturnValue_t cfdp::Tlv::serialize(uint8_t **buffer, size_t *size, size_t maxSiz
|
|||||||
if (*size + 2 > maxSize) {
|
if (*size + 2 > maxSize) {
|
||||||
return BUFFER_TOO_SHORT;
|
return BUFFER_TOO_SHORT;
|
||||||
}
|
}
|
||||||
if (type == TlvTypes::INVALID_TLV) {
|
if (type == TlvType::INVALID_TLV) {
|
||||||
return INVALID_TLV_TYPE;
|
return INVALID_TLV_TYPE;
|
||||||
}
|
}
|
||||||
**buffer = type;
|
**buffer = type;
|
||||||
@ -59,7 +59,7 @@ ReturnValue_t cfdp::Tlv::deSerialize(const uint8_t **buffer, size_t *size,
|
|||||||
return INVALID_TLV_TYPE;
|
return INVALID_TLV_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = static_cast<TlvTypes>(rawType);
|
type = static_cast<TlvType>(rawType);
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size -= 1;
|
*size -= 1;
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ ReturnValue_t cfdp::Tlv::deSerialize(const uint8_t **buffer, size_t *size,
|
|||||||
|
|
||||||
const uint8_t *cfdp::Tlv::getValue() const { return value.getConstBuffer(); }
|
const uint8_t *cfdp::Tlv::getValue() const { return value.getConstBuffer(); }
|
||||||
|
|
||||||
cfdp::TlvTypes cfdp::Tlv::getType() const { return type; }
|
cfdp::TlvType cfdp::Tlv::getType() const { return type; }
|
||||||
|
|
||||||
bool cfdp::Tlv::checkType(uint8_t rawType) {
|
bool cfdp::Tlv::checkType(uint8_t rawType) {
|
||||||
if (rawType != 0x03 and rawType <= 6) {
|
if (rawType != 0x03 and rawType <= 6) {
|
||||||
@ -101,4 +101,4 @@ void cfdp::Tlv::setValue(uint8_t *value, size_t len) {
|
|||||||
|
|
||||||
uint8_t cfdp::Tlv::getLengthField() const { return this->value.getSerializedSize() - 1; }
|
uint8_t cfdp::Tlv::getLengthField() const { return this->value.getSerializedSize() - 1; }
|
||||||
|
|
||||||
void cfdp::Tlv::setType(TlvTypes type) { this->type = type; }
|
void cfdp::Tlv::setType(TlvType type) { this->type = type; }
|
||||||
|
@ -13,7 +13,7 @@ namespace cfdp {
|
|||||||
*/
|
*/
|
||||||
class Tlv : public TlvIF {
|
class Tlv : public TlvIF {
|
||||||
public:
|
public:
|
||||||
Tlv(TlvTypes type, const uint8_t *value, size_t size);
|
Tlv(TlvType type, const uint8_t *value, size_t size);
|
||||||
Tlv();
|
Tlv();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,15 +47,15 @@ class Tlv : public TlvIF {
|
|||||||
void setValue(uint8_t *value, size_t len);
|
void setValue(uint8_t *value, size_t len);
|
||||||
|
|
||||||
[[nodiscard]] const uint8_t *getValue() const;
|
[[nodiscard]] const uint8_t *getValue() const;
|
||||||
void setType(TlvTypes type);
|
void setType(TlvType type);
|
||||||
[[nodiscard]] TlvTypes getType() const override;
|
[[nodiscard]] TlvType getType() const override;
|
||||||
[[nodiscard]] uint8_t getLengthField() const override;
|
[[nodiscard]] uint8_t getLengthField() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool checkType(uint8_t rawType);
|
bool checkType(uint8_t rawType);
|
||||||
|
|
||||||
bool zeroLen = true;
|
bool zeroLen = true;
|
||||||
TlvTypes type = TlvTypes::INVALID_TLV;
|
TlvType type = TlvType::INVALID_TLV;
|
||||||
SerialBufferAdapter<uint8_t> value;
|
SerialBufferAdapter<uint8_t> value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ class TlvIF : public SerializeIF {
|
|||||||
virtual ~TlvIF(){};
|
virtual ~TlvIF(){};
|
||||||
|
|
||||||
virtual uint8_t getLengthField() const = 0;
|
virtual uint8_t getLengthField() const = 0;
|
||||||
virtual cfdp::TlvTypes getType() const = 0;
|
virtual cfdp::TlvType getType() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_SRC_FSFW_CFDP_TLVIF_H_ */
|
#endif /* FSFW_SRC_FSFW_CFDP_TLVIF_H_ */
|
||||||
|
@ -25,12 +25,12 @@ TEST_CASE("CFDP Distributor", "[cfdp][distributor]") {
|
|||||||
const cfdp::EntityId& sourceId(groundEntityId);
|
const cfdp::EntityId& sourceId(groundEntityId);
|
||||||
const cfdp::EntityId& destId(obswEntityId);
|
const cfdp::EntityId& destId(obswEntityId);
|
||||||
cfdp::TransactionSeqNum seqNum(UnsignedByteField<uint16_t>(12));
|
cfdp::TransactionSeqNum seqNum(UnsignedByteField<uint16_t>(12));
|
||||||
auto pduConf = PduConfig(sourceId, destId, cfdp::TransmissionModes::UNACKNOWLEDGED, seqNum);
|
auto pduConf = PduConfig(sourceId, destId, cfdp::TransmissionMode::UNACKNOWLEDGED, seqNum);
|
||||||
std::string sourceFileString = "hello.txt";
|
std::string sourceFileString = "hello.txt";
|
||||||
cfdp::StringLv sourceFileName(sourceFileString);
|
cfdp::StringLv sourceFileName(sourceFileString);
|
||||||
std::string destFileString = "hello2.txt";
|
std::string destFileString = "hello2.txt";
|
||||||
cfdp::StringLv destFileName(destFileString);
|
cfdp::StringLv destFileName(destFileString);
|
||||||
MetadataInfo metadataInfo(false, cfdp::ChecksumTypes::CRC_32, fileSize, sourceFileName,
|
MetadataInfo metadataInfo(false, cfdp::ChecksumType::CRC_32, fileSize, sourceFileName,
|
||||||
destFileName);
|
destFileName);
|
||||||
MetadataPduCreator creator(pduConf, metadataInfo);
|
MetadataPduCreator creator(pduConf, metadataInfo);
|
||||||
uint8_t* dataPtr = nullptr;
|
uint8_t* dataPtr = nullptr;
|
||||||
|
@ -5,80 +5,81 @@
|
|||||||
TEST_CASE("CFDP Fault Handler", "[cfdp]") {
|
TEST_CASE("CFDP Fault Handler", "[cfdp]") {
|
||||||
using namespace cfdp;
|
using namespace cfdp;
|
||||||
auto fhMock = FaultHandlerMock();
|
auto fhMock = FaultHandlerMock();
|
||||||
cfdp::FaultHandlerCodes fhCode;
|
cfdp::FaultHandlerCode fhCode;
|
||||||
|
cfdp::TransactionId id;
|
||||||
|
|
||||||
SECTION("State") {
|
SECTION("State") {
|
||||||
// Verify initial condition
|
// Verify initial condition
|
||||||
CHECK(fhMock.getFaultHandler(ConditionCode::UNSUPPORTED_CHECKSUM_TYPE, fhCode));
|
CHECK(fhMock.getFaultHandler(ConditionCode::UNSUPPORTED_CHECKSUM_TYPE, fhCode));
|
||||||
CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR);
|
CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR);
|
||||||
CHECK(fhMock.getFaultHandler(ConditionCode::POSITIVE_ACK_LIMIT_REACHED, fhCode));
|
CHECK(fhMock.getFaultHandler(ConditionCode::POSITIVE_ACK_LIMIT_REACHED, fhCode));
|
||||||
CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR);
|
CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR);
|
||||||
CHECK(fhMock.getFaultHandler(ConditionCode::KEEP_ALIVE_LIMIT_REACHED, fhCode));
|
CHECK(fhMock.getFaultHandler(ConditionCode::KEEP_ALIVE_LIMIT_REACHED, fhCode));
|
||||||
CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR);
|
CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR);
|
||||||
CHECK(fhMock.getFaultHandler(ConditionCode::INVALID_TRANSMISSION_MODE, fhCode));
|
CHECK(fhMock.getFaultHandler(ConditionCode::INVALID_TRANSMISSION_MODE, fhCode));
|
||||||
CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR);
|
CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR);
|
||||||
CHECK(fhMock.getFaultHandler(ConditionCode::FILESTORE_REJECTION, fhCode));
|
CHECK(fhMock.getFaultHandler(ConditionCode::FILESTORE_REJECTION, fhCode));
|
||||||
CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR);
|
CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR);
|
||||||
CHECK(fhMock.getFaultHandler(ConditionCode::FILE_CHECKSUM_FAILURE, fhCode));
|
CHECK(fhMock.getFaultHandler(ConditionCode::FILE_CHECKSUM_FAILURE, fhCode));
|
||||||
CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR);
|
CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR);
|
||||||
CHECK(fhMock.getFaultHandler(ConditionCode::FILE_SIZE_ERROR, fhCode));
|
CHECK(fhMock.getFaultHandler(ConditionCode::FILE_SIZE_ERROR, fhCode));
|
||||||
CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR);
|
CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR);
|
||||||
CHECK(fhMock.getFaultHandler(ConditionCode::NAK_LIMIT_REACHED, fhCode));
|
CHECK(fhMock.getFaultHandler(ConditionCode::NAK_LIMIT_REACHED, fhCode));
|
||||||
CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR);
|
CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR);
|
||||||
CHECK(fhMock.getFaultHandler(ConditionCode::INACTIVITY_DETECTED, fhCode));
|
CHECK(fhMock.getFaultHandler(ConditionCode::INACTIVITY_DETECTED, fhCode));
|
||||||
CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR);
|
CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR);
|
||||||
CHECK(fhMock.getFaultHandler(ConditionCode::CHECK_LIMIT_REACHED, fhCode));
|
CHECK(fhMock.getFaultHandler(ConditionCode::CHECK_LIMIT_REACHED, fhCode));
|
||||||
CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR);
|
CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Call Handler, Ignore Fault") {
|
SECTION("Call Handler, Ignore Fault") {
|
||||||
auto& info = fhMock.getFhInfo(FaultHandlerCodes::IGNORE_ERROR);
|
auto& info = fhMock.getFhInfo(FaultHandlerCode::IGNORE_ERROR);
|
||||||
CHECK(fhMock.reportFault(ConditionCode::CHECK_LIMIT_REACHED));
|
CHECK(fhMock.reportFault(id, ConditionCode::CHECK_LIMIT_REACHED));
|
||||||
CHECK(info.callCount == 1);
|
CHECK(info.callCount == 1);
|
||||||
CHECK(info.condCodes.back() == ConditionCode::CHECK_LIMIT_REACHED);
|
CHECK(info.condCodes.back() == ConditionCode::CHECK_LIMIT_REACHED);
|
||||||
fhMock.reportFault(ConditionCode::FILE_CHECKSUM_FAILURE);
|
fhMock.reportFault(id, ConditionCode::FILE_CHECKSUM_FAILURE);
|
||||||
CHECK(info.callCount == 2);
|
CHECK(info.callCount == 2);
|
||||||
CHECK(info.condCodes.back() == ConditionCode::FILE_CHECKSUM_FAILURE);
|
CHECK(info.condCodes.back() == ConditionCode::FILE_CHECKSUM_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Invalid Reported Code") { CHECK(not fhMock.reportFault(ConditionCode::NO_ERROR)); }
|
SECTION("Invalid Reported Code") { CHECK(not fhMock.reportFault(id, ConditionCode::NO_ERROR)); }
|
||||||
|
|
||||||
SECTION("Invalid FH code") {
|
SECTION("Invalid FH code") {
|
||||||
CHECK(not fhMock.setFaultHandler(ConditionCode::KEEP_ALIVE_LIMIT_REACHED,
|
CHECK(not fhMock.setFaultHandler(ConditionCode::KEEP_ALIVE_LIMIT_REACHED,
|
||||||
FaultHandlerCodes::RESERVED));
|
FaultHandlerCode::RESERVED));
|
||||||
CHECK(fhMock.getFaultHandler(ConditionCode::KEEP_ALIVE_LIMIT_REACHED, fhCode));
|
CHECK(fhMock.getFaultHandler(ConditionCode::KEEP_ALIVE_LIMIT_REACHED, fhCode));
|
||||||
CHECK(fhCode == FaultHandlerCodes::IGNORE_ERROR);
|
CHECK(fhCode == FaultHandlerCode::IGNORE_ERROR);
|
||||||
CHECK(not fhMock.setFaultHandler(ConditionCode::NO_ERROR, FaultHandlerCodes::IGNORE_ERROR));
|
CHECK(not fhMock.setFaultHandler(ConditionCode::NO_ERROR, FaultHandlerCode::IGNORE_ERROR));
|
||||||
CHECK(not fhMock.getFaultHandler(ConditionCode::NO_ERROR, fhCode));
|
CHECK(not fhMock.getFaultHandler(ConditionCode::NO_ERROR, fhCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Set Other Fault Handler") {
|
SECTION("Set Other Fault Handler") {
|
||||||
CHECK(fhMock.setFaultHandler(ConditionCode::FILE_CHECKSUM_FAILURE,
|
CHECK(fhMock.setFaultHandler(ConditionCode::FILE_CHECKSUM_FAILURE,
|
||||||
FaultHandlerCodes::NOTICE_OF_CANCELLATION));
|
FaultHandlerCode::NOTICE_OF_CANCELLATION));
|
||||||
CHECK(fhMock.setFaultHandler(ConditionCode::INACTIVITY_DETECTED,
|
CHECK(fhMock.setFaultHandler(ConditionCode::INACTIVITY_DETECTED,
|
||||||
FaultHandlerCodes::ABANDON_TRANSACTION));
|
FaultHandlerCode::ABANDON_TRANSACTION));
|
||||||
CHECK(fhMock.setFaultHandler(ConditionCode::KEEP_ALIVE_LIMIT_REACHED,
|
CHECK(fhMock.setFaultHandler(ConditionCode::KEEP_ALIVE_LIMIT_REACHED,
|
||||||
FaultHandlerCodes::NOTICE_OF_SUSPENSION));
|
FaultHandlerCode::NOTICE_OF_SUSPENSION));
|
||||||
auto& ignoreInfo = fhMock.getFhInfo(FaultHandlerCodes::IGNORE_ERROR);
|
auto& ignoreInfo = fhMock.getFhInfo(FaultHandlerCode::IGNORE_ERROR);
|
||||||
auto& cancellationInfo = fhMock.getFhInfo(FaultHandlerCodes::NOTICE_OF_CANCELLATION);
|
auto& cancellationInfo = fhMock.getFhInfo(FaultHandlerCode::NOTICE_OF_CANCELLATION);
|
||||||
auto& suspensionInfo = fhMock.getFhInfo(FaultHandlerCodes::NOTICE_OF_SUSPENSION);
|
auto& suspensionInfo = fhMock.getFhInfo(FaultHandlerCode::NOTICE_OF_SUSPENSION);
|
||||||
auto& abandonInfo = fhMock.getFhInfo(FaultHandlerCodes::ABANDON_TRANSACTION);
|
auto& abandonInfo = fhMock.getFhInfo(FaultHandlerCode::ABANDON_TRANSACTION);
|
||||||
|
|
||||||
CHECK(fhMock.reportFault(ConditionCode::FILE_CHECKSUM_FAILURE));
|
CHECK(fhMock.reportFault(id, ConditionCode::FILE_CHECKSUM_FAILURE));
|
||||||
CHECK(cancellationInfo.callCount == 1);
|
CHECK(cancellationInfo.callCount == 1);
|
||||||
CHECK(cancellationInfo.condCodes.back() == ConditionCode::FILE_CHECKSUM_FAILURE);
|
CHECK(cancellationInfo.condCodes.back() == ConditionCode::FILE_CHECKSUM_FAILURE);
|
||||||
CHECK(ignoreInfo.callCount == 0);
|
CHECK(ignoreInfo.callCount == 0);
|
||||||
CHECK(suspensionInfo.callCount == 0);
|
CHECK(suspensionInfo.callCount == 0);
|
||||||
CHECK(abandonInfo.callCount == 0);
|
CHECK(abandonInfo.callCount == 0);
|
||||||
|
|
||||||
CHECK(fhMock.reportFault(ConditionCode::INACTIVITY_DETECTED));
|
CHECK(fhMock.reportFault(id, ConditionCode::INACTIVITY_DETECTED));
|
||||||
CHECK(cancellationInfo.callCount == 1);
|
CHECK(cancellationInfo.callCount == 1);
|
||||||
CHECK(ignoreInfo.callCount == 0);
|
CHECK(ignoreInfo.callCount == 0);
|
||||||
CHECK(suspensionInfo.callCount == 0);
|
CHECK(suspensionInfo.callCount == 0);
|
||||||
CHECK(abandonInfo.callCount == 1);
|
CHECK(abandonInfo.callCount == 1);
|
||||||
CHECK(abandonInfo.condCodes.back() == ConditionCode::INACTIVITY_DETECTED);
|
CHECK(abandonInfo.condCodes.back() == ConditionCode::INACTIVITY_DETECTED);
|
||||||
|
|
||||||
CHECK(fhMock.reportFault(ConditionCode::KEEP_ALIVE_LIMIT_REACHED));
|
CHECK(fhMock.reportFault(id, ConditionCode::KEEP_ALIVE_LIMIT_REACHED));
|
||||||
CHECK(cancellationInfo.callCount == 1);
|
CHECK(cancellationInfo.callCount == 1);
|
||||||
CHECK(ignoreInfo.callCount == 0);
|
CHECK(ignoreInfo.callCount == 0);
|
||||||
CHECK(suspensionInfo.callCount == 1);
|
CHECK(suspensionInfo.callCount == 1);
|
||||||
|
@ -15,19 +15,19 @@ TEST_CASE("ACK PDU", "[cfdp][pdu]") {
|
|||||||
auto seqNum = TransactionSeqNum(WidthInBytes::TWO_BYTES, 15);
|
auto seqNum = TransactionSeqNum(WidthInBytes::TWO_BYTES, 15);
|
||||||
auto sourceId = EntityId(WidthInBytes::TWO_BYTES, 1);
|
auto sourceId = EntityId(WidthInBytes::TWO_BYTES, 1);
|
||||||
auto destId = EntityId(WidthInBytes::TWO_BYTES, 2);
|
auto destId = EntityId(WidthInBytes::TWO_BYTES, 2);
|
||||||
auto pduConf = PduConfig(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
|
auto pduConf = PduConfig(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum);
|
||||||
AckInfo ackInfo(FileDirectives::EOF_DIRECTIVE, ConditionCode::NO_ERROR,
|
AckInfo ackInfo(FileDirective::EOF_DIRECTIVE, ConditionCode::NO_ERROR,
|
||||||
AckTransactionStatus::ACTIVE);
|
AckTransactionStatus::ACTIVE);
|
||||||
auto ackSerializer = AckPduCreator(ackInfo, pduConf);
|
auto ackSerializer = AckPduCreator(ackInfo, pduConf);
|
||||||
result = ackSerializer.serialize(&bufptr, &sz, maxsz, SerializeIF::Endianness::NETWORK);
|
result = ackSerializer.serialize(&bufptr, &sz, maxsz, SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
|
|
||||||
SECTION("Serialize") {
|
SECTION("Serialize") {
|
||||||
REQUIRE(buf[sz - 3] == cfdp::FileDirectives::ACK);
|
REQUIRE(buf[sz - 3] == cfdp::FileDirective::ACK);
|
||||||
REQUIRE((buf[sz - 2] >> 4) == FileDirectives::EOF_DIRECTIVE);
|
REQUIRE((buf[sz - 2] >> 4) == FileDirective::EOF_DIRECTIVE);
|
||||||
REQUIRE((buf[sz - 2] & 0x0f) == 0);
|
REQUIRE((buf[sz - 2] & 0x0f) == 0);
|
||||||
REQUIRE(buf[sz - 1] == AckTransactionStatus::ACTIVE);
|
REQUIRE(buf[sz - 1] == AckTransactionStatus::ACTIVE);
|
||||||
ackInfo.setAckedDirective(FileDirectives::FINISH);
|
ackInfo.setAckedDirective(FileDirective::FINISH);
|
||||||
ackInfo.setAckedConditionCode(ConditionCode::FILESTORE_REJECTION);
|
ackInfo.setAckedConditionCode(ConditionCode::FILESTORE_REJECTION);
|
||||||
ackInfo.setTransactionStatus(AckTransactionStatus::TERMINATED);
|
ackInfo.setTransactionStatus(AckTransactionStatus::TERMINATED);
|
||||||
auto ackSerializer2 = AckPduCreator(ackInfo, pduConf);
|
auto ackSerializer2 = AckPduCreator(ackInfo, pduConf);
|
||||||
@ -35,21 +35,21 @@ TEST_CASE("ACK PDU", "[cfdp][pdu]") {
|
|||||||
sz = 0;
|
sz = 0;
|
||||||
result = ackSerializer2.serialize(&bufptr, &sz, maxsz, SerializeIF::Endianness::NETWORK);
|
result = ackSerializer2.serialize(&bufptr, &sz, maxsz, SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(buf[sz - 3] == cfdp::FileDirectives::ACK);
|
REQUIRE(buf[sz - 3] == cfdp::FileDirective::ACK);
|
||||||
REQUIRE((buf[sz - 2] >> 4) == FileDirectives::FINISH);
|
REQUIRE((buf[sz - 2] >> 4) == FileDirective::FINISH);
|
||||||
REQUIRE((buf[sz - 2] & 0x0f) == 0b0001);
|
REQUIRE((buf[sz - 2] & 0x0f) == 0b0001);
|
||||||
REQUIRE((buf[sz - 1] >> 4) == ConditionCode::FILESTORE_REJECTION);
|
REQUIRE((buf[sz - 1] >> 4) == ConditionCode::FILESTORE_REJECTION);
|
||||||
REQUIRE((buf[sz - 1] & 0b11) == AckTransactionStatus::TERMINATED);
|
REQUIRE((buf[sz - 1] & 0b11) == AckTransactionStatus::TERMINATED);
|
||||||
|
|
||||||
bufptr = buf.data();
|
bufptr = buf.data();
|
||||||
sz = 0;
|
sz = 0;
|
||||||
ackInfo.setAckedDirective(FileDirectives::KEEP_ALIVE);
|
ackInfo.setAckedDirective(FileDirective::KEEP_ALIVE);
|
||||||
auto ackSerializer3 = AckPduCreator(ackInfo, pduConf);
|
auto ackSerializer3 = AckPduCreator(ackInfo, pduConf);
|
||||||
result = ackSerializer3.serialize(&bufptr, &sz, maxsz, SerializeIF::Endianness::NETWORK);
|
result = ackSerializer3.serialize(&bufptr, &sz, maxsz, SerializeIF::Endianness::NETWORK);
|
||||||
// Invalid file directive
|
// Invalid file directive
|
||||||
REQUIRE(result != returnvalue::OK);
|
REQUIRE(result != returnvalue::OK);
|
||||||
|
|
||||||
ackInfo.setAckedDirective(FileDirectives::FINISH);
|
ackInfo.setAckedDirective(FileDirective::FINISH);
|
||||||
// buffer too small
|
// buffer too small
|
||||||
result = ackSerializer.serialize(&bufptr, &sz, 8, SerializeIF::Endianness::NETWORK);
|
result = ackSerializer.serialize(&bufptr, &sz, 8, SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == SerializeIF::BUFFER_TOO_SHORT);
|
REQUIRE(result == SerializeIF::BUFFER_TOO_SHORT);
|
||||||
@ -60,12 +60,12 @@ TEST_CASE("ACK PDU", "[cfdp][pdu]") {
|
|||||||
auto reader = AckPduReader(buf.data(), sz, ackInfo2);
|
auto reader = AckPduReader(buf.data(), sz, ackInfo2);
|
||||||
result = reader.parseData();
|
result = reader.parseData();
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(ackInfo2.getAckedDirective() == FileDirectives::EOF_DIRECTIVE);
|
REQUIRE(ackInfo2.getAckedDirective() == FileDirective::EOF_DIRECTIVE);
|
||||||
REQUIRE(ackInfo2.getAckedConditionCode() == ConditionCode::NO_ERROR);
|
REQUIRE(ackInfo2.getAckedConditionCode() == ConditionCode::NO_ERROR);
|
||||||
REQUIRE(ackInfo2.getDirectiveSubtypeCode() == 0);
|
REQUIRE(ackInfo2.getDirectiveSubtypeCode() == 0);
|
||||||
REQUIRE(ackInfo2.getTransactionStatus() == AckTransactionStatus::ACTIVE);
|
REQUIRE(ackInfo2.getTransactionStatus() == AckTransactionStatus::ACTIVE);
|
||||||
|
|
||||||
AckInfo newInfo = AckInfo(FileDirectives::FINISH, ConditionCode::FILESTORE_REJECTION,
|
AckInfo newInfo = AckInfo(FileDirective::FINISH, ConditionCode::FILESTORE_REJECTION,
|
||||||
AckTransactionStatus::TERMINATED);
|
AckTransactionStatus::TERMINATED);
|
||||||
auto ackSerializer2 = AckPduCreator(newInfo, pduConf);
|
auto ackSerializer2 = AckPduCreator(newInfo, pduConf);
|
||||||
bufptr = buf.data();
|
bufptr = buf.data();
|
||||||
@ -76,23 +76,23 @@ TEST_CASE("ACK PDU", "[cfdp][pdu]") {
|
|||||||
auto reader2 = AckPduReader(buf.data(), sz, ackInfo2);
|
auto reader2 = AckPduReader(buf.data(), sz, ackInfo2);
|
||||||
result = reader2.parseData();
|
result = reader2.parseData();
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(ackInfo2.getAckedDirective() == FileDirectives::FINISH);
|
REQUIRE(ackInfo2.getAckedDirective() == FileDirective::FINISH);
|
||||||
REQUIRE(ackInfo2.getAckedConditionCode() == ConditionCode::FILESTORE_REJECTION);
|
REQUIRE(ackInfo2.getAckedConditionCode() == ConditionCode::FILESTORE_REJECTION);
|
||||||
REQUIRE(ackInfo2.getDirectiveSubtypeCode() == 0b0001);
|
REQUIRE(ackInfo2.getDirectiveSubtypeCode() == 0b0001);
|
||||||
REQUIRE(ackInfo2.getTransactionStatus() == AckTransactionStatus::TERMINATED);
|
REQUIRE(ackInfo2.getTransactionStatus() == AckTransactionStatus::TERMINATED);
|
||||||
|
|
||||||
uint8_t prevVal = buf[sz - 2];
|
uint8_t prevVal = buf[sz - 2];
|
||||||
buf[sz - 2] = FileDirectives::INVALID_DIRECTIVE << 4;
|
buf[sz - 2] = FileDirective::INVALID_DIRECTIVE << 4;
|
||||||
result = reader2.parseData();
|
result = reader2.parseData();
|
||||||
REQUIRE(result == cfdp::INVALID_ACK_DIRECTIVE_FIELDS);
|
REQUIRE(result == cfdp::INVALID_ACK_DIRECTIVE_FIELDS);
|
||||||
buf[sz - 2] = FileDirectives::FINISH << 4 | 0b1111;
|
buf[sz - 2] = FileDirective::FINISH << 4 | 0b1111;
|
||||||
result = reader2.parseData();
|
result = reader2.parseData();
|
||||||
REQUIRE(result == cfdp::INVALID_ACK_DIRECTIVE_FIELDS);
|
REQUIRE(result == cfdp::INVALID_ACK_DIRECTIVE_FIELDS);
|
||||||
buf[sz - 2] = prevVal;
|
buf[sz - 2] = prevVal;
|
||||||
buf[sz - 3] = cfdp::FileDirectives::INVALID_DIRECTIVE;
|
buf[sz - 3] = cfdp::FileDirective::INVALID_DIRECTIVE;
|
||||||
result = reader2.parseData();
|
result = reader2.parseData();
|
||||||
REQUIRE(result == cfdp::INVALID_DIRECTIVE_FIELD);
|
REQUIRE(result == cfdp::INVALID_DIRECTIVE_FIELD);
|
||||||
buf[sz - 3] = cfdp::FileDirectives::ACK;
|
buf[sz - 3] = cfdp::FileDirective::ACK;
|
||||||
auto maxSizeTooSmall = AckPduReader(buf.data(), sz - 2, ackInfo2);
|
auto maxSizeTooSmall = AckPduReader(buf.data(), sz - 2, ackInfo2);
|
||||||
result = maxSizeTooSmall.parseData();
|
result = maxSizeTooSmall.parseData();
|
||||||
REQUIRE(result == SerializeIF::STREAM_TOO_SHORT);
|
REQUIRE(result == SerializeIF::STREAM_TOO_SHORT);
|
||||||
|
@ -17,11 +17,11 @@ TEST_CASE("CFDP Header", "[cfdp]") {
|
|||||||
cfdp::EntityId sourceId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 0);
|
cfdp::EntityId sourceId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 0);
|
||||||
cfdp::EntityId destId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 1);
|
cfdp::EntityId destId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 1);
|
||||||
PduConfig pduConf =
|
PduConfig pduConf =
|
||||||
PduConfig(sourceId, destId, cfdp::TransmissionModes::ACKNOWLEDGED, seqNum, false);
|
PduConfig(sourceId, destId, cfdp::TransmissionMode::ACKNOWLEDGED, seqNum, false);
|
||||||
uint8_t* serTarget = serBuf.data();
|
uint8_t* serTarget = serBuf.data();
|
||||||
const uint8_t* deserTarget = serTarget;
|
const uint8_t* deserTarget = serTarget;
|
||||||
size_t serSize = 0;
|
size_t serSize = 0;
|
||||||
auto creator = HeaderCreator(pduConf, cfdp::PduTypes::FILE_DIRECTIVE, 0);
|
auto creator = HeaderCreator(pduConf, cfdp::PduType::FILE_DIRECTIVE, 0);
|
||||||
|
|
||||||
SECTION("Header State") {
|
SECTION("Header State") {
|
||||||
REQUIRE(seqNum.getSerializedSize() == 1);
|
REQUIRE(seqNum.getSerializedSize() == 1);
|
||||||
@ -33,10 +33,10 @@ TEST_CASE("CFDP Header", "[cfdp]") {
|
|||||||
REQUIRE(creator.getLargeFileFlag() == false);
|
REQUIRE(creator.getLargeFileFlag() == false);
|
||||||
REQUIRE(creator.getLenEntityIds() == 1);
|
REQUIRE(creator.getLenEntityIds() == 1);
|
||||||
REQUIRE(creator.getLenSeqNum() == 1);
|
REQUIRE(creator.getLenSeqNum() == 1);
|
||||||
REQUIRE(creator.getPduType() == cfdp::PduTypes::FILE_DIRECTIVE);
|
REQUIRE(creator.getPduType() == cfdp::PduType::FILE_DIRECTIVE);
|
||||||
REQUIRE(creator.getSegmentMetadataFlag() == cfdp::SegmentMetadataFlag::NOT_PRESENT);
|
REQUIRE(creator.getSegmentMetadataFlag() == cfdp::SegmentMetadataFlag::NOT_PRESENT);
|
||||||
REQUIRE(creator.getSegmentationControl() == false);
|
REQUIRE(creator.getSegmentationControl() == false);
|
||||||
REQUIRE(creator.getTransmissionMode() == cfdp::TransmissionModes::ACKNOWLEDGED);
|
REQUIRE(creator.getTransmissionMode() == cfdp::TransmissionMode::ACKNOWLEDGED);
|
||||||
cfdp::TransactionSeqNum seqNumLocal;
|
cfdp::TransactionSeqNum seqNumLocal;
|
||||||
creator.getTransactionSeqNum(seqNumLocal);
|
creator.getTransactionSeqNum(seqNumLocal);
|
||||||
REQUIRE(seqNumLocal.getWidth() == cfdp::WidthInBytes::ONE_BYTE);
|
REQUIRE(seqNumLocal.getWidth() == cfdp::WidthInBytes::ONE_BYTE);
|
||||||
@ -85,9 +85,9 @@ TEST_CASE("CFDP Header", "[cfdp]") {
|
|||||||
pduConf.crcFlag = true;
|
pduConf.crcFlag = true;
|
||||||
pduConf.largeFile = true;
|
pduConf.largeFile = true;
|
||||||
pduConf.direction = cfdp::Direction::TOWARDS_SENDER;
|
pduConf.direction = cfdp::Direction::TOWARDS_SENDER;
|
||||||
pduConf.mode = cfdp::TransmissionModes::UNACKNOWLEDGED;
|
pduConf.mode = cfdp::TransmissionMode::UNACKNOWLEDGED;
|
||||||
creator.setSegmentationControl(cfdp::SegmentationControl::RECORD_BOUNDARIES_PRESERVATION);
|
creator.setSegmentationControl(cfdp::SegmentationControl::RECORD_BOUNDARIES_PRESERVATION);
|
||||||
creator.setPduType(cfdp::PduTypes::FILE_DATA);
|
creator.setPduType(cfdp::PduType::FILE_DATA);
|
||||||
creator.setSegmentMetadataFlag(cfdp::SegmentMetadataFlag::PRESENT);
|
creator.setSegmentMetadataFlag(cfdp::SegmentMetadataFlag::PRESENT);
|
||||||
serTarget = serBuf.data();
|
serTarget = serBuf.data();
|
||||||
serSize = 0;
|
serSize = 0;
|
||||||
@ -103,9 +103,9 @@ TEST_CASE("CFDP Header", "[cfdp]") {
|
|||||||
REQUIRE(creator.getLargeFileFlag() == true);
|
REQUIRE(creator.getLargeFileFlag() == true);
|
||||||
REQUIRE(creator.getLenEntityIds() == 1);
|
REQUIRE(creator.getLenEntityIds() == 1);
|
||||||
REQUIRE(creator.getLenSeqNum() == 1);
|
REQUIRE(creator.getLenSeqNum() == 1);
|
||||||
REQUIRE(creator.getPduType() == cfdp::PduTypes::FILE_DATA);
|
REQUIRE(creator.getPduType() == cfdp::PduType::FILE_DATA);
|
||||||
REQUIRE(creator.getSegmentMetadataFlag() == cfdp::SegmentMetadataFlag::PRESENT);
|
REQUIRE(creator.getSegmentMetadataFlag() == cfdp::SegmentMetadataFlag::PRESENT);
|
||||||
REQUIRE(creator.getTransmissionMode() == cfdp::TransmissionModes::UNACKNOWLEDGED);
|
REQUIRE(creator.getTransmissionMode() == cfdp::TransmissionMode::UNACKNOWLEDGED);
|
||||||
REQUIRE(creator.getSegmentationControl() == true);
|
REQUIRE(creator.getSegmentationControl() == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,9 +122,9 @@ TEST_CASE("CFDP Header", "[cfdp]") {
|
|||||||
REQUIRE(creator.getLargeFileFlag() == true);
|
REQUIRE(creator.getLargeFileFlag() == true);
|
||||||
REQUIRE(creator.getLenEntityIds() == 4);
|
REQUIRE(creator.getLenEntityIds() == 4);
|
||||||
REQUIRE(creator.getLenSeqNum() == 2);
|
REQUIRE(creator.getLenSeqNum() == 2);
|
||||||
REQUIRE(creator.getPduType() == cfdp::PduTypes::FILE_DATA);
|
REQUIRE(creator.getPduType() == cfdp::PduType::FILE_DATA);
|
||||||
REQUIRE(creator.getSegmentMetadataFlag() == cfdp::SegmentMetadataFlag::PRESENT);
|
REQUIRE(creator.getSegmentMetadataFlag() == cfdp::SegmentMetadataFlag::PRESENT);
|
||||||
REQUIRE(creator.getTransmissionMode() == cfdp::TransmissionModes::UNACKNOWLEDGED);
|
REQUIRE(creator.getTransmissionMode() == cfdp::TransmissionMode::UNACKNOWLEDGED);
|
||||||
REQUIRE(creator.getSegmentationControl() == true);
|
REQUIRE(creator.getSegmentationControl() == true);
|
||||||
// Last three bits are 2 now (length of seq number) and bit 1 to bit 3 is 4 (len entity IDs)
|
// Last three bits are 2 now (length of seq number) and bit 1 to bit 3 is 4 (len entity IDs)
|
||||||
REQUIRE(serBuf[3] == 0b11001010);
|
REQUIRE(serBuf[3] == 0b11001010);
|
||||||
@ -235,10 +235,10 @@ TEST_CASE("CFDP Header", "[cfdp]") {
|
|||||||
REQUIRE(reader.getLargeFileFlag() == false);
|
REQUIRE(reader.getLargeFileFlag() == false);
|
||||||
REQUIRE(reader.getLenEntityIds() == 1);
|
REQUIRE(reader.getLenEntityIds() == 1);
|
||||||
REQUIRE(reader.getLenSeqNum() == 1);
|
REQUIRE(reader.getLenSeqNum() == 1);
|
||||||
REQUIRE(reader.getPduType() == cfdp::PduTypes::FILE_DIRECTIVE);
|
REQUIRE(reader.getPduType() == cfdp::PduType::FILE_DIRECTIVE);
|
||||||
REQUIRE(reader.getSegmentMetadataFlag() == cfdp::SegmentMetadataFlag::NOT_PRESENT);
|
REQUIRE(reader.getSegmentMetadataFlag() == cfdp::SegmentMetadataFlag::NOT_PRESENT);
|
||||||
REQUIRE(reader.getSegmentationControl() == false);
|
REQUIRE(reader.getSegmentationControl() == false);
|
||||||
REQUIRE(reader.getTransmissionMode() == cfdp::TransmissionModes::ACKNOWLEDGED);
|
REQUIRE(reader.getTransmissionMode() == cfdp::TransmissionMode::ACKNOWLEDGED);
|
||||||
// No PDU data contained, so the PDU data field is empty
|
// No PDU data contained, so the PDU data field is empty
|
||||||
REQUIRE(reader.getPduDataField() == nullptr);
|
REQUIRE(reader.getPduDataField() == nullptr);
|
||||||
|
|
||||||
@ -253,9 +253,9 @@ TEST_CASE("CFDP Header", "[cfdp]") {
|
|||||||
pduConf.crcFlag = true;
|
pduConf.crcFlag = true;
|
||||||
pduConf.largeFile = true;
|
pduConf.largeFile = true;
|
||||||
pduConf.direction = cfdp::Direction::TOWARDS_SENDER;
|
pduConf.direction = cfdp::Direction::TOWARDS_SENDER;
|
||||||
pduConf.mode = cfdp::TransmissionModes::UNACKNOWLEDGED;
|
pduConf.mode = cfdp::TransmissionMode::UNACKNOWLEDGED;
|
||||||
creator.setSegmentationControl(cfdp::SegmentationControl::RECORD_BOUNDARIES_PRESERVATION);
|
creator.setSegmentationControl(cfdp::SegmentationControl::RECORD_BOUNDARIES_PRESERVATION);
|
||||||
creator.setPduType(cfdp::PduTypes::FILE_DATA);
|
creator.setPduType(cfdp::PduType::FILE_DATA);
|
||||||
creator.setSegmentMetadataFlag(cfdp::SegmentMetadataFlag::PRESENT);
|
creator.setSegmentMetadataFlag(cfdp::SegmentMetadataFlag::PRESENT);
|
||||||
result = pduConf.seqNum.setValue(cfdp::WidthInBytes::TWO_BYTES, 0x0fff);
|
result = pduConf.seqNum.setValue(cfdp::WidthInBytes::TWO_BYTES, 0x0fff);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
@ -278,10 +278,10 @@ TEST_CASE("CFDP Header", "[cfdp]") {
|
|||||||
REQUIRE(reader.getLargeFileFlag() == true);
|
REQUIRE(reader.getLargeFileFlag() == true);
|
||||||
REQUIRE(reader.getLenEntityIds() == 4);
|
REQUIRE(reader.getLenEntityIds() == 4);
|
||||||
REQUIRE(reader.getLenSeqNum() == 2);
|
REQUIRE(reader.getLenSeqNum() == 2);
|
||||||
REQUIRE(reader.getPduType() == cfdp::PduTypes::FILE_DATA);
|
REQUIRE(reader.getPduType() == cfdp::PduType::FILE_DATA);
|
||||||
REQUIRE(reader.getSegmentMetadataFlag() == cfdp::SegmentMetadataFlag::PRESENT);
|
REQUIRE(reader.getSegmentMetadataFlag() == cfdp::SegmentMetadataFlag::PRESENT);
|
||||||
REQUIRE(reader.getSegmentationControl() == true);
|
REQUIRE(reader.getSegmentationControl() == true);
|
||||||
REQUIRE(reader.getTransmissionMode() == cfdp::TransmissionModes::UNACKNOWLEDGED);
|
REQUIRE(reader.getTransmissionMode() == cfdp::TransmissionMode::UNACKNOWLEDGED);
|
||||||
// Again, no data field set because this is a header only
|
// Again, no data field set because this is a header only
|
||||||
REQUIRE(reader.getPduDataField() == nullptr);
|
REQUIRE(reader.getPduDataField() == nullptr);
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ TEST_CASE("EOF PDU", "[cfdp][pdu]") {
|
|||||||
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
||||||
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
||||||
|
|
||||||
PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
|
PduConfig pduConf(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum);
|
||||||
|
|
||||||
auto eofSerializer = EofPduCreator(pduConf, eofInfo);
|
auto eofSerializer = EofPduCreator(pduConf, eofInfo);
|
||||||
SECTION("Serialize") {
|
SECTION("Serialize") {
|
||||||
@ -37,7 +37,7 @@ TEST_CASE("EOF PDU", "[cfdp][pdu]") {
|
|||||||
SerializeIF::Endianness::NETWORK);
|
SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(fileSizeVal == 12);
|
REQUIRE(fileSizeVal == 12);
|
||||||
REQUIRE(buf[sz - 10] == cfdp::FileDirectives::EOF_DIRECTIVE);
|
REQUIRE(buf[sz - 10] == cfdp::FileDirective::EOF_DIRECTIVE);
|
||||||
REQUIRE(buf[sz - 9] == 0x00);
|
REQUIRE(buf[sz - 9] == 0x00);
|
||||||
REQUIRE(sz == 20);
|
REQUIRE(sz == 20);
|
||||||
|
|
||||||
@ -52,13 +52,13 @@ TEST_CASE("EOF PDU", "[cfdp][pdu]") {
|
|||||||
SerializeIF::Endianness::NETWORK);
|
SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(sz == 28);
|
REQUIRE(sz == 28);
|
||||||
REQUIRE(buf[10] == cfdp::FileDirectives::EOF_DIRECTIVE);
|
REQUIRE(buf[10] == cfdp::FileDirective::EOF_DIRECTIVE);
|
||||||
REQUIRE(buf[11] >> 4 == cfdp::ConditionCode::FILESTORE_REJECTION);
|
REQUIRE(buf[11] >> 4 == cfdp::ConditionCode::FILESTORE_REJECTION);
|
||||||
uint64_t fileSizeLarge = 0;
|
uint64_t fileSizeLarge = 0;
|
||||||
result = SerializeAdapter::deSerialize(&fileSizeLarge, buf.data() + 16, nullptr,
|
result = SerializeAdapter::deSerialize(&fileSizeLarge, buf.data() + 16, nullptr,
|
||||||
SerializeIF::Endianness::NETWORK);
|
SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(fileSizeLarge == 0x10ffffff10);
|
REQUIRE(fileSizeLarge == 0x10ffffff10);
|
||||||
REQUIRE(buf[sz - 4] == cfdp::TlvTypes::ENTITY_ID);
|
REQUIRE(buf[sz - 4] == cfdp::TlvType::ENTITY_ID);
|
||||||
// width of entity ID is 2
|
// width of entity ID is 2
|
||||||
REQUIRE(buf[sz - 3] == 2);
|
REQUIRE(buf[sz - 3] == 2);
|
||||||
uint16_t entityIdRaw = 0;
|
uint16_t entityIdRaw = 0;
|
||||||
@ -105,7 +105,7 @@ TEST_CASE("EOF PDU", "[cfdp][pdu]") {
|
|||||||
REQUIRE(emptyInfo.getConditionCode() == cfdp::ConditionCode::FILESTORE_REJECTION);
|
REQUIRE(emptyInfo.getConditionCode() == cfdp::ConditionCode::FILESTORE_REJECTION);
|
||||||
REQUIRE(emptyInfo.getChecksum() == 5);
|
REQUIRE(emptyInfo.getChecksum() == 5);
|
||||||
REQUIRE(emptyInfo.getFileSize().getSize() == 0x10ffffff10);
|
REQUIRE(emptyInfo.getFileSize().getSize() == 0x10ffffff10);
|
||||||
REQUIRE(emptyInfo.getFaultLoc()->getType() == cfdp::TlvTypes::ENTITY_ID);
|
REQUIRE(emptyInfo.getFaultLoc()->getType() == cfdp::TlvType::ENTITY_ID);
|
||||||
REQUIRE(emptyInfo.getFaultLoc()->getSerializedSize() == 4);
|
REQUIRE(emptyInfo.getFaultLoc()->getSerializedSize() == 4);
|
||||||
uint16_t destId = emptyInfo.getFaultLoc()->getEntityId().getValue();
|
uint16_t destId = emptyInfo.getFaultLoc()->getEntityId().getValue();
|
||||||
REQUIRE(destId == 2);
|
REQUIRE(destId == 2);
|
||||||
|
@ -17,7 +17,7 @@ TEST_CASE("File Data PDU", "[cfdp][pdu]") {
|
|||||||
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
||||||
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
||||||
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
||||||
PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
|
PduConfig pduConf(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum);
|
||||||
|
|
||||||
for (uint8_t idx = 0; idx < 10; idx++) {
|
for (uint8_t idx = 0; idx < 10; idx++) {
|
||||||
fileBuffer[idx] = idx;
|
fileBuffer[idx] = idx;
|
||||||
|
@ -12,11 +12,11 @@ TEST_CASE("CFDP File Directive", "[cfdp][pdu]") {
|
|||||||
cfdp::EntityId sourceId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 0);
|
cfdp::EntityId sourceId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 0);
|
||||||
cfdp::EntityId destId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 1);
|
cfdp::EntityId destId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 1);
|
||||||
PduConfig pduConf =
|
PduConfig pduConf =
|
||||||
PduConfig(sourceId, destId, cfdp::TransmissionModes::ACKNOWLEDGED, seqNum, false);
|
PduConfig(sourceId, destId, cfdp::TransmissionMode::ACKNOWLEDGED, seqNum, false);
|
||||||
uint8_t* serTarget = serBuf.data();
|
uint8_t* serTarget = serBuf.data();
|
||||||
const uint8_t* deserTarget = serTarget;
|
const uint8_t* deserTarget = serTarget;
|
||||||
size_t serSize = 0;
|
size_t serSize = 0;
|
||||||
auto fdSer = FileDirectiveCreator(pduConf, FileDirectives::ACK, 4);
|
auto fdSer = FileDirectiveCreator(pduConf, FileDirective::ACK, 4);
|
||||||
|
|
||||||
SECTION("Serialization") {
|
SECTION("Serialization") {
|
||||||
REQUIRE(fdSer.getSerializedSize() == 8);
|
REQUIRE(fdSer.getSerializedSize() == 8);
|
||||||
@ -37,7 +37,7 @@ TEST_CASE("CFDP File Directive", "[cfdp][pdu]") {
|
|||||||
REQUIRE(serBuf[5] == 2);
|
REQUIRE(serBuf[5] == 2);
|
||||||
// Dest ID
|
// Dest ID
|
||||||
REQUIRE(serBuf[6] == 1);
|
REQUIRE(serBuf[6] == 1);
|
||||||
REQUIRE(serBuf[7] == FileDirectives::ACK);
|
REQUIRE(serBuf[7] == FileDirective::ACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Serialization fails") {
|
SECTION("Serialization fails") {
|
||||||
@ -73,10 +73,10 @@ TEST_CASE("CFDP File Directive", "[cfdp][pdu]") {
|
|||||||
REQUIRE(fdDeser.parseData() == returnvalue::OK);
|
REQUIRE(fdDeser.parseData() == returnvalue::OK);
|
||||||
REQUIRE(not fdDeser.isNull());
|
REQUIRE(not fdDeser.isNull());
|
||||||
REQUIRE(fdDeser);
|
REQUIRE(fdDeser);
|
||||||
REQUIRE(fdDeser.getFileDirective() == FileDirectives::ACK);
|
REQUIRE(fdDeser.getFileDirective() == FileDirective::ACK);
|
||||||
REQUIRE(fdDeser.getPduDataFieldLen() == 5);
|
REQUIRE(fdDeser.getPduDataFieldLen() == 5);
|
||||||
REQUIRE(fdDeser.getHeaderSize() == 8);
|
REQUIRE(fdDeser.getHeaderSize() == 8);
|
||||||
REQUIRE(fdDeser.getPduType() == cfdp::PduTypes::FILE_DIRECTIVE);
|
REQUIRE(fdDeser.getPduType() == cfdp::PduType::FILE_DIRECTIVE);
|
||||||
|
|
||||||
serBuf[7] = 0xff;
|
serBuf[7] = 0xff;
|
||||||
// Invalid file directive
|
// Invalid file directive
|
||||||
|
@ -14,7 +14,7 @@ TEST_CASE("Finished PDU", "[cfdp][pdu]") {
|
|||||||
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
||||||
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
||||||
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
||||||
PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
|
PduConfig pduConf(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum);
|
||||||
|
|
||||||
cfdp::Lv emptyFsMsg;
|
cfdp::Lv emptyFsMsg;
|
||||||
FinishedInfo info(cfdp::ConditionCode::INACTIVITY_DETECTED,
|
FinishedInfo info(cfdp::ConditionCode::INACTIVITY_DETECTED,
|
||||||
@ -27,7 +27,7 @@ TEST_CASE("Finished PDU", "[cfdp][pdu]") {
|
|||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(serializer.getSerializedSize() == 12);
|
REQUIRE(serializer.getSerializedSize() == 12);
|
||||||
REQUIRE(((fnBuffer[1] << 8) | fnBuffer[2]) == 2);
|
REQUIRE(((fnBuffer[1] << 8) | fnBuffer[2]) == 2);
|
||||||
REQUIRE(fnBuffer[10] == cfdp::FileDirectives::FINISH);
|
REQUIRE(fnBuffer[10] == cfdp::FileDirective::FINISH);
|
||||||
REQUIRE(((fnBuffer[sz - 1] >> 4) & 0x0f) == cfdp::ConditionCode::INACTIVITY_DETECTED);
|
REQUIRE(((fnBuffer[sz - 1] >> 4) & 0x0f) == cfdp::ConditionCode::INACTIVITY_DETECTED);
|
||||||
REQUIRE(((fnBuffer[sz - 1] >> 2) & 0x01) == cfdp::FileDeliveryCode::DATA_INCOMPLETE);
|
REQUIRE(((fnBuffer[sz - 1] >> 2) & 0x01) == cfdp::FileDeliveryCode::DATA_INCOMPLETE);
|
||||||
REQUIRE((fnBuffer[sz - 1] & 0b11) == cfdp::FileDeliveryStatus::DISCARDED_DELIBERATELY);
|
REQUIRE((fnBuffer[sz - 1] & 0b11) == cfdp::FileDeliveryStatus::DISCARDED_DELIBERATELY);
|
||||||
@ -176,7 +176,7 @@ TEST_CASE("Finished PDU", "[cfdp][pdu]") {
|
|||||||
|
|
||||||
fnBuffer[11] = tmp;
|
fnBuffer[11] = tmp;
|
||||||
// Invalid TLV type, should be entity ID
|
// Invalid TLV type, should be entity ID
|
||||||
fnBuffer[sz - 4] = cfdp::TlvTypes::FILESTORE_REQUEST;
|
fnBuffer[sz - 4] = cfdp::TlvType::FILESTORE_REQUEST;
|
||||||
result = deserializer3.parseData();
|
result = deserializer3.parseData();
|
||||||
REQUIRE(result == cfdp::INVALID_TLV_TYPE);
|
REQUIRE(result == cfdp::INVALID_TLV_TYPE);
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ TEST_CASE("Keep Alive PDU", "[cfdp][pdu]") {
|
|||||||
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
||||||
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
||||||
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
||||||
PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
|
PduConfig pduConf(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum);
|
||||||
|
|
||||||
FileSize progress(0x50);
|
FileSize progress(0x50);
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ TEST_CASE("Keep Alive PDU", "[cfdp][pdu]") {
|
|||||||
KeepAlivePduCreator serializer(pduConf, progress);
|
KeepAlivePduCreator serializer(pduConf, progress);
|
||||||
result = serializer.serialize(&buffer, &sz, kaBuffer.size(), SerializeIF::Endianness::NETWORK);
|
result = serializer.serialize(&buffer, &sz, kaBuffer.size(), SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(kaBuffer[10] == cfdp::FileDirectives::KEEP_ALIVE);
|
REQUIRE(kaBuffer[10] == cfdp::FileDirective::KEEP_ALIVE);
|
||||||
uint32_t fsRaw = 0;
|
uint32_t fsRaw = 0;
|
||||||
result = SerializeAdapter::deSerialize(&fsRaw, kaBuffer.data() + 11, nullptr,
|
result = SerializeAdapter::deSerialize(&fsRaw, kaBuffer.data() + 11, nullptr,
|
||||||
SerializeIF::Endianness::NETWORK);
|
SerializeIF::Endianness::NETWORK);
|
||||||
|
@ -17,13 +17,13 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") {
|
|||||||
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
||||||
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
||||||
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
||||||
PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
|
PduConfig pduConf(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum);
|
||||||
|
|
||||||
std::string firstFileName = "hello.txt";
|
std::string firstFileName = "hello.txt";
|
||||||
cfdp::StringLv sourceFileName(firstFileName);
|
cfdp::StringLv sourceFileName(firstFileName);
|
||||||
cfdp::StringLv destFileName;
|
cfdp::StringLv destFileName;
|
||||||
FileSize fileSize(35);
|
FileSize fileSize(35);
|
||||||
MetadataInfo info(false, ChecksumTypes::MODULAR, fileSize, sourceFileName, destFileName);
|
MetadataInfo info(false, ChecksumType::MODULAR, fileSize, sourceFileName, destFileName);
|
||||||
|
|
||||||
FilestoreResponseTlv response(FilestoreActionCode::CREATE_DIRECTORY, FSR_CREATE_NOT_ALLOWED,
|
FilestoreResponseTlv response(FilestoreActionCode::CREATE_DIRECTORY, FSR_CREATE_NOT_ALLOWED,
|
||||||
sourceFileName, nullptr);
|
sourceFileName, nullptr);
|
||||||
@ -46,7 +46,7 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") {
|
|||||||
REQUIRE(info.getDestFileName().getSerializedSize() == 1);
|
REQUIRE(info.getDestFileName().getSerializedSize() == 1);
|
||||||
REQUIRE(info.getSerializedSize() == 16);
|
REQUIRE(info.getSerializedSize() == 16);
|
||||||
REQUIRE((mdBuffer[1] << 8 | mdBuffer[2]) == 17);
|
REQUIRE((mdBuffer[1] << 8 | mdBuffer[2]) == 17);
|
||||||
REQUIRE(mdBuffer[10] == FileDirectives::METADATA);
|
REQUIRE(mdBuffer[10] == FileDirective::METADATA);
|
||||||
// no closure requested and checksum type is modular => 0x00
|
// no closure requested and checksum type is modular => 0x00
|
||||||
REQUIRE(mdBuffer[11] == 0x00);
|
REQUIRE(mdBuffer[11] == 0x00);
|
||||||
uint32_t fileSizeRaw = 0;
|
uint32_t fileSizeRaw = 0;
|
||||||
@ -74,7 +74,7 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") {
|
|||||||
REQUIRE(info.getMaxOptionsLen() == 2);
|
REQUIRE(info.getMaxOptionsLen() == 2);
|
||||||
info.setMaxOptionsLen(3);
|
info.setMaxOptionsLen(3);
|
||||||
REQUIRE(info.getMaxOptionsLen() == 3);
|
REQUIRE(info.getMaxOptionsLen() == 3);
|
||||||
info.setChecksumType(cfdp::ChecksumTypes::CRC_32C);
|
info.setChecksumType(cfdp::ChecksumType::CRC_32C);
|
||||||
info.setClosureRequested(true);
|
info.setClosureRequested(true);
|
||||||
uint8_t* buffer = mdBuffer.data();
|
uint8_t* buffer = mdBuffer.data();
|
||||||
size_t sz = 0;
|
size_t sz = 0;
|
||||||
@ -83,8 +83,8 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") {
|
|||||||
result = serializer.serialize(&buffer, &sz, mdBuffer.size(), SerializeIF::Endianness::NETWORK);
|
result = serializer.serialize(&buffer, &sz, mdBuffer.size(), SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE((mdBuffer[1] << 8 | mdBuffer[2]) == 37);
|
REQUIRE((mdBuffer[1] << 8 | mdBuffer[2]) == 37);
|
||||||
auto checksumType = static_cast<cfdp::ChecksumTypes>(mdBuffer[11] & 0x0f);
|
auto checksumType = static_cast<cfdp::ChecksumType>(mdBuffer[11] & 0x0f);
|
||||||
REQUIRE(checksumType == cfdp::ChecksumTypes::CRC_32C);
|
REQUIRE(checksumType == cfdp::ChecksumType::CRC_32C);
|
||||||
bool closureRequested = mdBuffer[11] >> 6 & 0x01;
|
bool closureRequested = mdBuffer[11] >> 6 & 0x01;
|
||||||
REQUIRE(closureRequested == true);
|
REQUIRE(closureRequested == true);
|
||||||
// The size of the two options is 19. Summing up:
|
// The size of the two options is 19. Summing up:
|
||||||
@ -130,7 +130,7 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") {
|
|||||||
size_t maxSize = 4;
|
size_t maxSize = 4;
|
||||||
info.setOptionsArray(options.data(), sizeOfOptions, maxSize);
|
info.setOptionsArray(options.data(), sizeOfOptions, maxSize);
|
||||||
REQUIRE(info.getOptionsLen() == 2);
|
REQUIRE(info.getOptionsLen() == 2);
|
||||||
info.setChecksumType(cfdp::ChecksumTypes::CRC_32C);
|
info.setChecksumType(cfdp::ChecksumType::CRC_32C);
|
||||||
info.setClosureRequested(true);
|
info.setClosureRequested(true);
|
||||||
uint8_t* buffer = mdBuffer.data();
|
uint8_t* buffer = mdBuffer.data();
|
||||||
size_t sz = 0;
|
size_t sz = 0;
|
||||||
@ -143,9 +143,9 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") {
|
|||||||
MetadataPduReader deserializer2(mdBuffer.data(), mdBuffer.size(), info);
|
MetadataPduReader deserializer2(mdBuffer.data(), mdBuffer.size(), info);
|
||||||
result = deserializer2.parseData();
|
result = deserializer2.parseData();
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(options[0]->getType() == cfdp::TlvTypes::FILESTORE_RESPONSE);
|
REQUIRE(options[0]->getType() == cfdp::TlvType::FILESTORE_RESPONSE);
|
||||||
REQUIRE(options[0]->getSerializedSize() == 14);
|
REQUIRE(options[0]->getSerializedSize() == 14);
|
||||||
REQUIRE(options[1]->getType() == cfdp::TlvTypes::MSG_TO_USER);
|
REQUIRE(options[1]->getType() == cfdp::TlvType::MSG_TO_USER);
|
||||||
REQUIRE(options[1]->getSerializedSize() == 5);
|
REQUIRE(options[1]->getSerializedSize() == 5);
|
||||||
|
|
||||||
for (size_t invalidFieldLen = 0; invalidFieldLen < 36; invalidFieldLen++) {
|
for (size_t invalidFieldLen = 0; invalidFieldLen < 36; invalidFieldLen++) {
|
||||||
|
@ -15,7 +15,7 @@ TEST_CASE("NAK PDU", "[cfdp][pdu]") {
|
|||||||
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
||||||
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
||||||
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
||||||
PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
|
PduConfig pduConf(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum);
|
||||||
|
|
||||||
FileSize startOfScope(50);
|
FileSize startOfScope(50);
|
||||||
FileSize endOfScope(1050);
|
FileSize endOfScope(1050);
|
||||||
@ -29,7 +29,7 @@ TEST_CASE("NAK PDU", "[cfdp][pdu]") {
|
|||||||
REQUIRE(sz == 19);
|
REQUIRE(sz == 19);
|
||||||
REQUIRE(serializer.getPduDataFieldLen() == 9);
|
REQUIRE(serializer.getPduDataFieldLen() == 9);
|
||||||
REQUIRE(((nakBuffer[1] << 8) | nakBuffer[2]) == 0x09);
|
REQUIRE(((nakBuffer[1] << 8) | nakBuffer[2]) == 0x09);
|
||||||
REQUIRE(nakBuffer[10] == cfdp::FileDirectives::NAK);
|
REQUIRE(nakBuffer[10] == cfdp::FileDirective::NAK);
|
||||||
uint32_t scope = 0;
|
uint32_t scope = 0;
|
||||||
result = SerializeAdapter::deSerialize(&scope, nakBuffer.data() + 11, nullptr,
|
result = SerializeAdapter::deSerialize(&scope, nakBuffer.data() + 11, nullptr,
|
||||||
SerializeIF::Endianness::NETWORK);
|
SerializeIF::Endianness::NETWORK);
|
||||||
|
@ -14,7 +14,7 @@ TEST_CASE("Prompt PDU", "[cfdp][pdu]") {
|
|||||||
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
||||||
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
||||||
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
||||||
PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
|
PduConfig pduConf(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum);
|
||||||
|
|
||||||
SECTION("Serialize") {
|
SECTION("Serialize") {
|
||||||
PromptPduCreator serializer(pduConf, cfdp::PromptResponseRequired::PROMPT_KEEP_ALIVE);
|
PromptPduCreator serializer(pduConf, cfdp::PromptResponseRequired::PROMPT_KEEP_ALIVE);
|
||||||
@ -23,7 +23,7 @@ TEST_CASE("Prompt PDU", "[cfdp][pdu]") {
|
|||||||
REQUIRE(serializer.getWholePduSize() == 12);
|
REQUIRE(serializer.getWholePduSize() == 12);
|
||||||
REQUIRE(sz == 12);
|
REQUIRE(sz == 12);
|
||||||
REQUIRE(serializer.getPduDataFieldLen() == 2);
|
REQUIRE(serializer.getPduDataFieldLen() == 2);
|
||||||
REQUIRE(rawBuf[10] == FileDirectives::PROMPT);
|
REQUIRE(rawBuf[10] == FileDirective::PROMPT);
|
||||||
REQUIRE(((rawBuf[sz - 1] >> 7) & 0x01) == cfdp::PromptResponseRequired::PROMPT_KEEP_ALIVE);
|
REQUIRE(((rawBuf[sz - 1] >> 7) & 0x01) == cfdp::PromptResponseRequired::PROMPT_KEEP_ALIVE);
|
||||||
|
|
||||||
for (size_t invalidMaxSz = 0; invalidMaxSz < sz; invalidMaxSz++) {
|
for (size_t invalidMaxSz = 0; invalidMaxSz < sz; invalidMaxSz++) {
|
||||||
|
@ -16,13 +16,13 @@ TEST_CASE("CFDP Base", "[cfdp]") {
|
|||||||
cfdp::EntityId sourceId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 0);
|
cfdp::EntityId sourceId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 0);
|
||||||
cfdp::EntityId destId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 1);
|
cfdp::EntityId destId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 1);
|
||||||
PduConfig pduConf =
|
PduConfig pduConf =
|
||||||
PduConfig(sourceId, destId, cfdp::TransmissionModes::ACKNOWLEDGED, seqNum, false);
|
PduConfig(sourceId, destId, cfdp::TransmissionMode::ACKNOWLEDGED, seqNum, false);
|
||||||
uint8_t* serTarget = serBuf.data();
|
uint8_t* serTarget = serBuf.data();
|
||||||
const uint8_t* deserTarget = serTarget;
|
const uint8_t* deserTarget = serTarget;
|
||||||
size_t serSize = 0;
|
size_t serSize = 0;
|
||||||
|
|
||||||
SECTION("File Directive") {
|
SECTION("File Directive") {
|
||||||
auto fdSer = FileDirectiveCreator(pduConf, FileDirectives::ACK, 4);
|
auto fdSer = FileDirectiveCreator(pduConf, FileDirective::ACK, 4);
|
||||||
REQUIRE(fdSer.getSerializedSize() == 8);
|
REQUIRE(fdSer.getSerializedSize() == 8);
|
||||||
serTarget = serBuf.data();
|
serTarget = serBuf.data();
|
||||||
serSize = 0;
|
serSize = 0;
|
||||||
@ -41,7 +41,7 @@ TEST_CASE("CFDP Base", "[cfdp]") {
|
|||||||
REQUIRE(serBuf[5] == 2);
|
REQUIRE(serBuf[5] == 2);
|
||||||
// Dest ID
|
// Dest ID
|
||||||
REQUIRE(serBuf[6] == 1);
|
REQUIRE(serBuf[6] == 1);
|
||||||
REQUIRE(serBuf[7] == FileDirectives::ACK);
|
REQUIRE(serBuf[7] == FileDirective::ACK);
|
||||||
|
|
||||||
serTarget = serBuf.data();
|
serTarget = serBuf.data();
|
||||||
size_t deserSize = 20;
|
size_t deserSize = 20;
|
||||||
@ -65,10 +65,10 @@ TEST_CASE("CFDP Base", "[cfdp]") {
|
|||||||
REQUIRE(fdDeser.getEndianness() == SerializeIF::Endianness::MACHINE);
|
REQUIRE(fdDeser.getEndianness() == SerializeIF::Endianness::MACHINE);
|
||||||
fdDeser.setEndianness(SerializeIF::Endianness::NETWORK);
|
fdDeser.setEndianness(SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(fdDeser.parseData() == returnvalue::OK);
|
REQUIRE(fdDeser.parseData() == returnvalue::OK);
|
||||||
REQUIRE(fdDeser.getFileDirective() == FileDirectives::ACK);
|
REQUIRE(fdDeser.getFileDirective() == FileDirective::ACK);
|
||||||
REQUIRE(fdDeser.getPduDataFieldLen() == 5);
|
REQUIRE(fdDeser.getPduDataFieldLen() == 5);
|
||||||
REQUIRE(fdDeser.getHeaderSize() == 8);
|
REQUIRE(fdDeser.getHeaderSize() == 8);
|
||||||
REQUIRE(fdDeser.getPduType() == cfdp::PduTypes::FILE_DIRECTIVE);
|
REQUIRE(fdDeser.getPduType() == cfdp::PduType::FILE_DIRECTIVE);
|
||||||
|
|
||||||
serBuf[7] = 0xff;
|
serBuf[7] = 0xff;
|
||||||
// Invalid file directive
|
// Invalid file directive
|
||||||
|
@ -41,7 +41,7 @@ TEST_CASE("CFDP Other TLVs", "[cfdp][tlv]") {
|
|||||||
result = response.convertToTlv(rawResponse, serBuf.data(), serBuf.size(),
|
result = response.convertToTlv(rawResponse, serBuf.data(), serBuf.size(),
|
||||||
SerializeIF::Endianness::NETWORK);
|
SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(rawResponse.getType() == cfdp::TlvTypes::FILESTORE_RESPONSE);
|
REQUIRE(rawResponse.getType() == cfdp::TlvType::FILESTORE_RESPONSE);
|
||||||
cfdp::StringLv emptyMsg;
|
cfdp::StringLv emptyMsg;
|
||||||
cfdp::StringLv emptySecondName;
|
cfdp::StringLv emptySecondName;
|
||||||
FilestoreResponseTlv emptyTlv(firstName, &emptyMsg);
|
FilestoreResponseTlv emptyTlv(firstName, &emptyMsg);
|
||||||
@ -96,12 +96,12 @@ TEST_CASE("CFDP Other TLVs", "[cfdp][tlv]") {
|
|||||||
result = request.convertToTlv(rawRequest, serBuf.data(), serBuf.size(),
|
result = request.convertToTlv(rawRequest, serBuf.data(), serBuf.size(),
|
||||||
SerializeIF::Endianness::NETWORK);
|
SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(rawRequest.getType() == cfdp::TlvTypes::FILESTORE_REQUEST);
|
REQUIRE(rawRequest.getType() == cfdp::TlvType::FILESTORE_REQUEST);
|
||||||
|
|
||||||
emptyRequest.setActionCode(cfdp::FilestoreActionCode::DELETE_FILE);
|
emptyRequest.setActionCode(cfdp::FilestoreActionCode::DELETE_FILE);
|
||||||
result = emptyRequest.deSerialize(rawRequest, SerializeIF::Endianness::NETWORK);
|
result = emptyRequest.deSerialize(rawRequest, SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(emptyRequest.getType() == cfdp::TlvTypes::FILESTORE_REQUEST);
|
REQUIRE(emptyRequest.getType() == cfdp::TlvType::FILESTORE_REQUEST);
|
||||||
REQUIRE(emptyRequest.getActionCode() == cfdp::FilestoreActionCode::APPEND_FILE);
|
REQUIRE(emptyRequest.getActionCode() == cfdp::FilestoreActionCode::APPEND_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ TEST_CASE("CFDP Other TLVs", "[cfdp][tlv]") {
|
|||||||
FlowLabelTlv flowLabelTlv(&flowLabel, 1);
|
FlowLabelTlv flowLabelTlv(&flowLabel, 1);
|
||||||
|
|
||||||
FaultHandlerOverrideTlv faultOverrideTlv(cfdp::ConditionCode::FILESTORE_REJECTION,
|
FaultHandlerOverrideTlv faultOverrideTlv(cfdp::ConditionCode::FILESTORE_REJECTION,
|
||||||
cfdp::FaultHandlerCodes::NOTICE_OF_CANCELLATION);
|
cfdp::FaultHandlerCode::NOTICE_OF_CANCELLATION);
|
||||||
size_t sz = 0;
|
size_t sz = 0;
|
||||||
result =
|
result =
|
||||||
faultOverrideTlv.serialize(&serPtr, &sz, rawBuf.size(), SerializeIF::Endianness::NETWORK);
|
faultOverrideTlv.serialize(&serPtr, &sz, rawBuf.size(), SerializeIF::Endianness::NETWORK);
|
||||||
@ -128,7 +128,7 @@ TEST_CASE("CFDP Other TLVs", "[cfdp][tlv]") {
|
|||||||
EntityIdTlv idTlv(emptyId);
|
EntityIdTlv idTlv(emptyId);
|
||||||
serPtr = rawBuf.data();
|
serPtr = rawBuf.data();
|
||||||
result = idTlv.serialize(&serPtr, &deserSize, rawBuf.size(), SerializeIF::Endianness::NETWORK);
|
result = idTlv.serialize(&serPtr, &deserSize, rawBuf.size(), SerializeIF::Endianness::NETWORK);
|
||||||
cfdp::Tlv rawTlv(cfdp::TlvTypes::ENTITY_ID, rawBuf.data() + 2, 2);
|
cfdp::Tlv rawTlv(cfdp::TlvType::ENTITY_ID, rawBuf.data() + 2, 2);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
deserPtr = rawBuf.data();
|
deserPtr = rawBuf.data();
|
||||||
result = idTlv.deSerialize(rawTlv, SerializeIF::Endianness::NETWORK);
|
result = idTlv.deSerialize(rawTlv, SerializeIF::Endianness::NETWORK);
|
||||||
|
@ -22,14 +22,14 @@ TEST_CASE("CFDP TLV", "[cfdp][tlv]") {
|
|||||||
SECTION("TLV Serialization") {
|
SECTION("TLV Serialization") {
|
||||||
std::array<uint8_t, 8> tlvBuf{};
|
std::array<uint8_t, 8> tlvBuf{};
|
||||||
REQUIRE(sourceId.serializeBe(tlvBuf.data(), deserSize, tlvBuf.size()) == returnvalue::OK);
|
REQUIRE(sourceId.serializeBe(tlvBuf.data(), deserSize, tlvBuf.size()) == returnvalue::OK);
|
||||||
auto tlv = Tlv(TlvTypes::ENTITY_ID, tlvBuf.data(), deserSize);
|
auto tlv = Tlv(TlvType::ENTITY_ID, tlvBuf.data(), deserSize);
|
||||||
REQUIRE(tlv.getSerializedSize() == 4);
|
REQUIRE(tlv.getSerializedSize() == 4);
|
||||||
REQUIRE(tlv.getLengthField() == 2);
|
REQUIRE(tlv.getLengthField() == 2);
|
||||||
deserSize = 0;
|
deserSize = 0;
|
||||||
REQUIRE(tlv.serialize(&serPtr, &deserSize, rawBuf.size(), SerializeIF::Endianness::NETWORK) ==
|
REQUIRE(tlv.serialize(&serPtr, &deserSize, rawBuf.size(), SerializeIF::Endianness::NETWORK) ==
|
||||||
returnvalue::OK);
|
returnvalue::OK);
|
||||||
REQUIRE(deserSize == 4);
|
REQUIRE(deserSize == 4);
|
||||||
REQUIRE(rawBuf[0] == TlvTypes::ENTITY_ID);
|
REQUIRE(rawBuf[0] == TlvType::ENTITY_ID);
|
||||||
REQUIRE(rawBuf[1] == 2);
|
REQUIRE(rawBuf[1] == 2);
|
||||||
uint16_t entityId = 0;
|
uint16_t entityId = 0;
|
||||||
REQUIRE(SerializeAdapter::deSerialize(&entityId, rawBuf.data() + 2, &deserSize,
|
REQUIRE(SerializeAdapter::deSerialize(&entityId, rawBuf.data() + 2, &deserSize,
|
||||||
@ -38,7 +38,7 @@ TEST_CASE("CFDP TLV", "[cfdp][tlv]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SECTION("TLV Other Value") {
|
SECTION("TLV Other Value") {
|
||||||
auto tlv = Tlv(TlvTypes::ENTITY_ID, rawBuf.data(), deserSize);
|
auto tlv = Tlv(TlvType::ENTITY_ID, rawBuf.data(), deserSize);
|
||||||
// Set new value
|
// Set new value
|
||||||
sourceId.setValue(cfdp::WidthInBytes::FOUR_BYTES, 12);
|
sourceId.setValue(cfdp::WidthInBytes::FOUR_BYTES, 12);
|
||||||
REQUIRE(sourceId.serialize(&serPtr, &deserSize, rawBuf.size(),
|
REQUIRE(sourceId.serialize(&serPtr, &deserSize, rawBuf.size(),
|
||||||
@ -48,17 +48,17 @@ TEST_CASE("CFDP TLV", "[cfdp][tlv]") {
|
|||||||
deserSize = 0;
|
deserSize = 0;
|
||||||
result = tlv.serialize(&serPtr, &deserSize, rawBuf.size(), SerializeIF::Endianness::NETWORK);
|
result = tlv.serialize(&serPtr, &deserSize, rawBuf.size(), SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(rawBuf[0] == TlvTypes::ENTITY_ID);
|
REQUIRE(rawBuf[0] == TlvType::ENTITY_ID);
|
||||||
REQUIRE(rawBuf[1] == 4);
|
REQUIRE(rawBuf[1] == 4);
|
||||||
|
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("TLV Invalid") {
|
SECTION("TLV Invalid") {
|
||||||
auto tlvInvalid = Tlv(cfdp::TlvTypes::INVALID_TLV, rawBuf.data(), 0);
|
auto tlvInvalid = Tlv(cfdp::TlvType::INVALID_TLV, rawBuf.data(), 0);
|
||||||
REQUIRE(tlvInvalid.serialize(&serPtr, &deserSize, rawBuf.size(),
|
REQUIRE(tlvInvalid.serialize(&serPtr, &deserSize, rawBuf.size(),
|
||||||
SerializeIF::Endianness::NETWORK) != returnvalue::OK);
|
SerializeIF::Endianness::NETWORK) != returnvalue::OK);
|
||||||
tlvInvalid = Tlv(cfdp::TlvTypes::ENTITY_ID, nullptr, 3);
|
tlvInvalid = Tlv(cfdp::TlvType::ENTITY_ID, nullptr, 3);
|
||||||
REQUIRE(tlvInvalid.serialize(&serPtr, &deserSize, rawBuf.size(),
|
REQUIRE(tlvInvalid.serialize(&serPtr, &deserSize, rawBuf.size(),
|
||||||
SerializeIF::Endianness::NETWORK) != returnvalue::OK);
|
SerializeIF::Endianness::NETWORK) != returnvalue::OK);
|
||||||
REQUIRE(tlvInvalid.serialize(&serPtr, &deserSize, 0, SerializeIF::Endianness::NETWORK) !=
|
REQUIRE(tlvInvalid.serialize(&serPtr, &deserSize, 0, SerializeIF::Endianness::NETWORK) !=
|
||||||
@ -69,13 +69,13 @@ TEST_CASE("CFDP TLV", "[cfdp][tlv]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SECTION("TLV Zero Length Field") {
|
SECTION("TLV Zero Length Field") {
|
||||||
Tlv zeroLenField(TlvTypes::FAULT_HANDLER, nullptr, 0);
|
Tlv zeroLenField(TlvType::FAULT_HANDLER, nullptr, 0);
|
||||||
REQUIRE(zeroLenField.getSerializedSize() == 2);
|
REQUIRE(zeroLenField.getSerializedSize() == 2);
|
||||||
serPtr = rawBuf.data();
|
serPtr = rawBuf.data();
|
||||||
deserSize = 0;
|
deserSize = 0;
|
||||||
REQUIRE(zeroLenField.serialize(&serPtr, &deserSize, rawBuf.size(),
|
REQUIRE(zeroLenField.serialize(&serPtr, &deserSize, rawBuf.size(),
|
||||||
SerializeIF::Endianness::NETWORK) == returnvalue::OK);
|
SerializeIF::Endianness::NETWORK) == returnvalue::OK);
|
||||||
REQUIRE(rawBuf[0] == TlvTypes::FAULT_HANDLER);
|
REQUIRE(rawBuf[0] == TlvType::FAULT_HANDLER);
|
||||||
REQUIRE(rawBuf[1] == 0);
|
REQUIRE(rawBuf[1] == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ TEST_CASE("CFDP TLV", "[cfdp][tlv]") {
|
|||||||
serPtr = tlvRawBuf.data();
|
serPtr = tlvRawBuf.data();
|
||||||
result =
|
result =
|
||||||
sourceId.serialize(&serPtr, &deserSize, tlvRawBuf.size(), SerializeIF::Endianness::NETWORK);
|
sourceId.serialize(&serPtr, &deserSize, tlvRawBuf.size(), SerializeIF::Endianness::NETWORK);
|
||||||
auto tlvSerialization = Tlv(TlvTypes::ENTITY_ID, tlvRawBuf.data(), deserSize);
|
auto tlvSerialization = Tlv(TlvType::ENTITY_ID, tlvRawBuf.data(), deserSize);
|
||||||
serPtr = rawBuf.data();
|
serPtr = rawBuf.data();
|
||||||
deserSize = 0;
|
deserSize = 0;
|
||||||
result = tlvSerialization.serialize(&serPtr, &deserSize, rawBuf.size(),
|
result = tlvSerialization.serialize(&serPtr, &deserSize, rawBuf.size(),
|
||||||
@ -95,7 +95,7 @@ TEST_CASE("CFDP TLV", "[cfdp][tlv]") {
|
|||||||
result = tlv.deSerialize(&deserPtr, &deserSize, SerializeIF::Endianness::NETWORK);
|
result = tlv.deSerialize(&deserPtr, &deserSize, SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(result == returnvalue::OK);
|
REQUIRE(result == returnvalue::OK);
|
||||||
REQUIRE(tlv.getSerializedSize() == 4);
|
REQUIRE(tlv.getSerializedSize() == 4);
|
||||||
REQUIRE(tlv.getType() == TlvTypes::ENTITY_ID);
|
REQUIRE(tlv.getType() == TlvType::ENTITY_ID);
|
||||||
deserPtr = tlv.getValue();
|
deserPtr = tlv.getValue();
|
||||||
uint16_t entityId = 0;
|
uint16_t entityId = 0;
|
||||||
deserSize = 0;
|
deserSize = 0;
|
||||||
@ -109,12 +109,12 @@ TEST_CASE("CFDP TLV", "[cfdp][tlv]") {
|
|||||||
REQUIRE(tlv.deSerialize(&deserPtr, &deserSize, SerializeIF::Endianness::NETWORK) ==
|
REQUIRE(tlv.deSerialize(&deserPtr, &deserSize, SerializeIF::Endianness::NETWORK) ==
|
||||||
SerializeIF::STREAM_TOO_SHORT);
|
SerializeIF::STREAM_TOO_SHORT);
|
||||||
// Set invalid TLV
|
// Set invalid TLV
|
||||||
rawBuf[0] = TlvTypes::INVALID_TLV;
|
rawBuf[0] = TlvType::INVALID_TLV;
|
||||||
deserSize = 4;
|
deserSize = 4;
|
||||||
REQUIRE(tlv.deSerialize(&deserPtr, &deserSize, SerializeIF::Endianness::NETWORK) !=
|
REQUIRE(tlv.deSerialize(&deserPtr, &deserSize, SerializeIF::Endianness::NETWORK) !=
|
||||||
returnvalue::OK);
|
returnvalue::OK);
|
||||||
|
|
||||||
Tlv zeroLenField(TlvTypes::FAULT_HANDLER, nullptr, 0);
|
Tlv zeroLenField(TlvType::FAULT_HANDLER, nullptr, 0);
|
||||||
serPtr = rawBuf.data();
|
serPtr = rawBuf.data();
|
||||||
deserSize = 0;
|
deserSize = 0;
|
||||||
REQUIRE(zeroLenField.serialize(&serPtr, &deserSize, rawBuf.size(),
|
REQUIRE(zeroLenField.serialize(&serPtr, &deserSize, rawBuf.size(),
|
||||||
|
@ -2,31 +2,31 @@
|
|||||||
|
|
||||||
namespace cfdp {
|
namespace cfdp {
|
||||||
|
|
||||||
void FaultHandlerMock::noticeOfSuspensionCb(cfdp::ConditionCode code) {
|
void FaultHandlerMock::noticeOfSuspensionCb(TransactionId& id, cfdp::ConditionCode code) {
|
||||||
auto& info = fhInfoMap.at(cfdp::FaultHandlerCodes::NOTICE_OF_SUSPENSION);
|
auto& info = fhInfoMap.at(cfdp::FaultHandlerCode::NOTICE_OF_SUSPENSION);
|
||||||
info.callCount++;
|
info.callCount++;
|
||||||
info.condCodes.push(code);
|
info.condCodes.push(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FaultHandlerMock::noticeOfCancellationCb(cfdp::ConditionCode code) {
|
void FaultHandlerMock::noticeOfCancellationCb(TransactionId& id, cfdp::ConditionCode code) {
|
||||||
auto& info = fhInfoMap.at(cfdp::FaultHandlerCodes::NOTICE_OF_CANCELLATION);
|
auto& info = fhInfoMap.at(cfdp::FaultHandlerCode::NOTICE_OF_CANCELLATION);
|
||||||
info.callCount++;
|
info.callCount++;
|
||||||
info.condCodes.push(code);
|
info.condCodes.push(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FaultHandlerMock::abandonCb(cfdp::ConditionCode code) {
|
void FaultHandlerMock::abandonCb(TransactionId& id, cfdp::ConditionCode code) {
|
||||||
auto& info = fhInfoMap.at(cfdp::FaultHandlerCodes::ABANDON_TRANSACTION);
|
auto& info = fhInfoMap.at(cfdp::FaultHandlerCode::ABANDON_TRANSACTION);
|
||||||
info.callCount++;
|
info.callCount++;
|
||||||
info.condCodes.push(code);
|
info.condCodes.push(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FaultHandlerMock::ignoreCb(cfdp::ConditionCode code) {
|
void FaultHandlerMock::ignoreCb(TransactionId& id, cfdp::ConditionCode code) {
|
||||||
auto& info = fhInfoMap.at(cfdp::FaultHandlerCodes::IGNORE_ERROR);
|
auto& info = fhInfoMap.at(cfdp::FaultHandlerCode::IGNORE_ERROR);
|
||||||
info.callCount++;
|
info.callCount++;
|
||||||
info.condCodes.push(code);
|
info.condCodes.push(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
FaultHandlerMock::FaultInfo& FaultHandlerMock::getFhInfo(cfdp::FaultHandlerCodes fhCode) {
|
FaultHandlerMock::FaultInfo& FaultHandlerMock::getFhInfo(cfdp::FaultHandlerCode fhCode) {
|
||||||
return fhInfoMap.at(fhCode);
|
return fhInfoMap.at(fhCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ void FaultHandlerMock::reset() { fhInfoMap.clear(); }
|
|||||||
|
|
||||||
bool FaultHandlerMock::faultCbWasCalled() const {
|
bool FaultHandlerMock::faultCbWasCalled() const {
|
||||||
return std::any_of(fhInfoMap.begin(), fhInfoMap.end(),
|
return std::any_of(fhInfoMap.begin(), fhInfoMap.end(),
|
||||||
[](const std::pair<cfdp::FaultHandlerCodes, FaultInfo>& pair) {
|
[](const std::pair<cfdp::FaultHandlerCode, FaultInfo>& pair) {
|
||||||
return pair.second.callCount > 0;
|
return pair.second.callCount > 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -15,21 +15,21 @@ class FaultHandlerMock : public FaultHandlerBase {
|
|||||||
std::queue<cfdp::ConditionCode> condCodes;
|
std::queue<cfdp::ConditionCode> condCodes;
|
||||||
};
|
};
|
||||||
|
|
||||||
void noticeOfSuspensionCb(ConditionCode code) override;
|
void noticeOfSuspensionCb(TransactionId& id, ConditionCode code) override;
|
||||||
void noticeOfCancellationCb(ConditionCode code) override;
|
void noticeOfCancellationCb(TransactionId& id, ConditionCode code) override;
|
||||||
void abandonCb(ConditionCode code) override;
|
void abandonCb(TransactionId& id,ConditionCode code) override;
|
||||||
void ignoreCb(ConditionCode code) override;
|
void ignoreCb(TransactionId& id, ConditionCode code) override;
|
||||||
|
|
||||||
FaultInfo& getFhInfo(FaultHandlerCodes fhCode);
|
FaultInfo& getFhInfo(FaultHandlerCode fhCode);
|
||||||
[[nodiscard]] bool faultCbWasCalled() const;
|
[[nodiscard]] bool faultCbWasCalled() const;
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<cfdp::FaultHandlerCodes, FaultInfo> fhInfoMap = {
|
std::map<cfdp::FaultHandlerCode, FaultInfo> fhInfoMap = {
|
||||||
std::pair{cfdp::FaultHandlerCodes::IGNORE_ERROR, FaultInfo()},
|
std::pair{cfdp::FaultHandlerCode::IGNORE_ERROR, FaultInfo()},
|
||||||
std::pair{cfdp::FaultHandlerCodes::NOTICE_OF_CANCELLATION, FaultInfo()},
|
std::pair{cfdp::FaultHandlerCode::NOTICE_OF_CANCELLATION, FaultInfo()},
|
||||||
std::pair{cfdp::FaultHandlerCodes::NOTICE_OF_SUSPENSION, FaultInfo()},
|
std::pair{cfdp::FaultHandlerCode::NOTICE_OF_SUSPENSION, FaultInfo()},
|
||||||
std::pair{cfdp::FaultHandlerCodes::ABANDON_TRANSACTION, FaultInfo()}};
|
std::pair{cfdp::FaultHandlerCode::ABANDON_TRANSACTION, FaultInfo()}};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cfdp
|
} // namespace cfdp
|
||||||
|
Loading…
Reference in New Issue
Block a user