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
|
||||
//! https://sanaregistry.org/r/checksum_identifiers/
|
||||
enum ChecksumTypes {
|
||||
enum ChecksumType {
|
||||
// Modular legacy checksum
|
||||
MODULAR = 0,
|
||||
CRC_32_PROXIMITY_1 = 1,
|
||||
|
@ -50,9 +50,9 @@ enum ChecksumTypes {
|
|||
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 };
|
||||
|
||||
|
@ -70,7 +70,7 @@ enum WidthInBytes : uint8_t {
|
|||
FOUR_BYTES = 4,
|
||||
};
|
||||
|
||||
enum FileDirectives : uint8_t {
|
||||
enum FileDirective : uint8_t {
|
||||
INVALID_DIRECTIVE = 0x0f,
|
||||
// The _DIRECTIVE suffix is mandatory here because of some nameclash!
|
||||
EOF_DIRECTIVE = 0x04,
|
||||
|
@ -82,7 +82,7 @@ enum FileDirectives : uint8_t {
|
|||
KEEP_ALIVE = 0x0c
|
||||
};
|
||||
|
||||
enum ConditionCodes : uint8_t {
|
||||
enum ConditionCode : uint8_t {
|
||||
NO_CONDITION_FIELD = 0xff,
|
||||
NO_ERROR = 0b0000,
|
||||
POSITIVE_ACK_LIMIT_REACHED = 0b0001,
|
||||
|
@ -99,8 +99,7 @@ enum ConditionCodes : uint8_t {
|
|||
CANCEL_REQUEST_RECEIVED = 0b1111
|
||||
};
|
||||
|
||||
|
||||
enum FaultHandlerCodes {
|
||||
enum FaultHandlerCode {
|
||||
RESERVED = 0b0000,
|
||||
NOTICE_OF_CANCELLATION = 0b0001,
|
||||
NOTICE_OF_SUSPENSION = 0b0010,
|
||||
|
@ -126,7 +125,7 @@ enum FileDeliveryStatus {
|
|||
|
||||
enum PromptResponseRequired : uint8_t { PROMPT_NAK = 0, PROMPT_KEEP_ALIVE = 1 };
|
||||
|
||||
enum TlvTypes : uint8_t {
|
||||
enum TlvType : uint8_t {
|
||||
FILESTORE_REQUEST = 0x00,
|
||||
FILESTORE_RESPONSE = 0x01,
|
||||
MSG_TO_USER = 0x02,
|
||||
|
|
|
@ -5,8 +5,8 @@ namespace cfdp {
|
|||
FaultHandlerBase::FaultHandlerBase() = default;
|
||||
FaultHandlerBase::~FaultHandlerBase() = default;
|
||||
|
||||
bool FaultHandlerBase::getFaultHandler(cfdp::ConditionCodes code,
|
||||
cfdp::FaultHandlerCodes& handler) const {
|
||||
bool FaultHandlerBase::getFaultHandler(cfdp::ConditionCode code,
|
||||
cfdp::FaultHandlerCode& handler) const {
|
||||
auto iter = faultHandlerMap.find(code);
|
||||
if (iter == faultHandlerMap.end()) {
|
||||
return false;
|
||||
|
@ -15,32 +15,32 @@ bool FaultHandlerBase::getFaultHandler(cfdp::ConditionCodes code,
|
|||
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)) {
|
||||
return false;
|
||||
}
|
||||
if (handler != FaultHandlerCodes::NOTICE_OF_SUSPENSION and
|
||||
handler != FaultHandlerCodes::ABANDON_TRANSACTION and
|
||||
handler != FaultHandlerCodes::NOTICE_OF_CANCELLATION and
|
||||
handler != FaultHandlerCodes::IGNORE_ERROR) {
|
||||
if (handler != FaultHandlerCode::NOTICE_OF_SUSPENSION and
|
||||
handler != FaultHandlerCode::ABANDON_TRANSACTION and
|
||||
handler != FaultHandlerCode::NOTICE_OF_CANCELLATION and
|
||||
handler != FaultHandlerCode::IGNORE_ERROR) {
|
||||
return false;
|
||||
}
|
||||
faultHandlerMap[code] = handler;
|
||||
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)) {
|
||||
return false;
|
||||
}
|
||||
cfdp::FaultHandlerCodes fh = faultHandlerMap[code];
|
||||
if (fh == cfdp::FaultHandlerCodes::IGNORE_ERROR) {
|
||||
cfdp::FaultHandlerCode fh = faultHandlerMap[code];
|
||||
if (fh == cfdp::FaultHandlerCode::IGNORE_ERROR) {
|
||||
ignoreCb(id, code);
|
||||
} else if (fh == cfdp::FaultHandlerCodes::ABANDON_TRANSACTION) {
|
||||
} else if (fh == cfdp::FaultHandlerCode::ABANDON_TRANSACTION) {
|
||||
abandonCb(id, code);
|
||||
} else if (fh == cfdp::FaultHandlerCodes::NOTICE_OF_CANCELLATION) {
|
||||
} else if (fh == cfdp::FaultHandlerCode::NOTICE_OF_CANCELLATION) {
|
||||
noticeOfCancellationCb(id, code);
|
||||
} else if (fh == cfdp::FaultHandlerCodes::NOTICE_OF_SUSPENSION) {
|
||||
} else if (fh == cfdp::FaultHandlerCode::NOTICE_OF_SUSPENSION) {
|
||||
noticeOfSuspensionCb(id, code);
|
||||
} else {
|
||||
// Should never happen, but use defensive programming
|
||||
|
|
|
@ -43,33 +43,33 @@ class FaultHandlerBase {
|
|||
* - true if the condition code is valid
|
||||
* - 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 noticeOfCancellationCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0;
|
||||
virtual void abandonCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0;
|
||||
virtual void ignoreCb(cfdp::TransactionId& id, cfdp::ConditionCodes code) = 0;
|
||||
virtual void noticeOfSuspensionCb(cfdp::TransactionId& id, cfdp::ConditionCode code) = 0;
|
||||
virtual void noticeOfCancellationCb(cfdp::TransactionId& id, cfdp::ConditionCode code) = 0;
|
||||
virtual void abandonCb(cfdp::TransactionId& id, cfdp::ConditionCode code) = 0;
|
||||
virtual void ignoreCb(cfdp::TransactionId& id, cfdp::ConditionCode code) = 0;
|
||||
|
||||
private:
|
||||
etl::flat_map<cfdp::ConditionCodes, cfdp::FaultHandlerCodes, 10> faultHandlerMap = {
|
||||
etl::pair{cfdp::ConditionCodes::POSITIVE_ACK_LIMIT_REACHED,
|
||||
cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCodes::KEEP_ALIVE_LIMIT_REACHED,
|
||||
cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCodes::INVALID_TRANSMISSION_MODE,
|
||||
cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCodes::FILE_CHECKSUM_FAILURE, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCodes::FILE_SIZE_ERROR, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCodes::NAK_LIMIT_REACHED, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCodes::INACTIVITY_DETECTED, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCodes::UNSUPPORTED_CHECKSUM_TYPE,
|
||||
cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCodes::FILESTORE_REJECTION, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCodes::CHECK_LIMIT_REACHED, cfdp::FaultHandlerCodes::IGNORE_ERROR}};
|
||||
etl::flat_map<cfdp::ConditionCode, cfdp::FaultHandlerCode, 10> faultHandlerMap = {
|
||||
etl::pair{cfdp::ConditionCode::POSITIVE_ACK_LIMIT_REACHED,
|
||||
cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::KEEP_ALIVE_LIMIT_REACHED,
|
||||
cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::INVALID_TRANSMISSION_MODE,
|
||||
cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::FILE_CHECKSUM_FAILURE, cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::FILE_SIZE_ERROR, cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::NAK_LIMIT_REACHED, cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::INACTIVITY_DETECTED, cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::UNSUPPORTED_CHECKSUM_TYPE,
|
||||
cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::FILESTORE_REJECTION, cfdp::FaultHandlerCode::IGNORE_ERROR},
|
||||
etl::pair{cfdp::ConditionCode::CHECK_LIMIT_REACHED, cfdp::FaultHandlerCode::IGNORE_ERROR}};
|
||||
};
|
||||
|
||||
} // namespace cfdp
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
namespace cfdp {
|
||||
|
||||
struct TransactionFinishedParams {
|
||||
TransactionFinishedParams(const TransactionId& id, ConditionCodes code, FileDeliveryCode delivCode,
|
||||
TransactionFinishedParams(const TransactionId& id, ConditionCode code, FileDeliveryCode delivCode,
|
||||
FileDeliveryStatus status)
|
||||
: id(id), condCode(code), status(status), deliveryCode(delivCode) {}
|
||||
|
||||
const TransactionId& id;
|
||||
ConditionCodes condCode;
|
||||
ConditionCode condCode;
|
||||
FileDeliveryStatus status;
|
||||
FileDeliveryCode deliveryCode;
|
||||
std::vector<FilestoreResponseTlv*> fsResponses;
|
||||
|
@ -85,10 +85,10 @@ class UserBase {
|
|||
virtual void metadataRecvdIndication(const MetadataRecvdParams& params) = 0;
|
||||
virtual void fileSegmentRecvdIndication(const FileSegmentRecvdParams& params) = 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 faultIndication(const TransactionId& id, ConditionCodes code, size_t progress) = 0;
|
||||
virtual void abandonedIndication(const TransactionId& id, ConditionCodes code,
|
||||
virtual void faultIndication(const TransactionId& id, ConditionCode code, size_t progress) = 0;
|
||||
virtual void abandonedIndication(const TransactionId& id, ConditionCode code,
|
||||
size_t progress) = 0;
|
||||
virtual void eofRecvIndication(const TransactionId& id) = 0;
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ struct RemoteEntityCfg {
|
|||
size_t maxFileSegmentLen = 2048;
|
||||
bool closureRequested = false;
|
||||
bool crcOnTransmission = false;
|
||||
TransmissionModes defaultTransmissionMode = TransmissionModes::UNACKNOWLEDGED;
|
||||
ChecksumTypes defaultChecksum = ChecksumTypes::NULL_CHECKSUM;
|
||||
TransmissionMode defaultTransmissionMode = TransmissionMode::UNACKNOWLEDGED;
|
||||
ChecksumType defaultChecksum = ChecksumType::NULL_CHECKSUM;
|
||||
const uint8_t version = CFDP_VERSION_2;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
#include "helpers.h"
|
||||
|
||||
const char* COND_CODE_STRINGS[14] = {
|
||||
"Unknown",
|
||||
"No Error",
|
||||
"Positive ACK Limit Reached",
|
||||
"Keep Alive Limit Reached",
|
||||
"Invalid Transmission Mode",
|
||||
"Filestore Rejection",
|
||||
"File Checksum Failure",
|
||||
"File Size Error",
|
||||
"NAK limit reached",
|
||||
"Inactivity Detected",
|
||||
"Check Limit Reached",
|
||||
"Unsupported Checksum Type",
|
||||
"Suspend Request Received",
|
||||
"Cancel Request Received"
|
||||
};
|
||||
const char* COND_CODE_STRINGS[14] = {"Unknown",
|
||||
"No Error",
|
||||
"Positive ACK Limit Reached",
|
||||
"Keep Alive Limit Reached",
|
||||
"Invalid Transmission Mode",
|
||||
"Filestore Rejection",
|
||||
"File Checksum Failure",
|
||||
"File Size Error",
|
||||
"NAK limit reached",
|
||||
"Inactivity Detected",
|
||||
"Check Limit Reached",
|
||||
"Unsupported Checksum Type",
|
||||
"Suspend Request Received",
|
||||
"Cancel Request Received"};
|
||||
|
||||
const char* cfdp::getConditionCodeString(cfdp::ConditionCodes code) {
|
||||
const char* cfdp::getConditionCodeString(cfdp::ConditionCode code) {
|
||||
switch (code) {
|
||||
case NO_CONDITION_FIELD:
|
||||
return COND_CODE_STRINGS[0];
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
namespace cfdp {
|
||||
|
||||
const char* getConditionCodeString(cfdp::ConditionCodes code);
|
||||
const char* getConditionCodeString(cfdp::ConditionCode code);
|
||||
|
||||
}
|
||||
#endif // FSFW_EXAMPLE_HOSTED_HELPER_H
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
#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)
|
||||
: ackedDirective(ackedDirective),
|
||||
ackedConditionCode(ackedConditionCode),
|
||||
transactionStatus(transactionStatus),
|
||||
directiveSubtypeCode(directiveSubtypeCode) {
|
||||
if (ackedDirective == cfdp::FileDirectives::FINISH) {
|
||||
if (ackedDirective == cfdp::FileDirective::FINISH) {
|
||||
this->directiveSubtypeCode = 0b0001;
|
||||
} else {
|
||||
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;
|
||||
if (ackedDirective == cfdp::FileDirectives::FINISH) {
|
||||
if (ackedDirective == cfdp::FileDirective::FINISH) {
|
||||
this->directiveSubtypeCode = 0b0001;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
class AckInfo {
|
||||
public:
|
||||
AckInfo();
|
||||
AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCodes ackedConditionCode,
|
||||
AckInfo(cfdp::FileDirective ackedDirective, cfdp::ConditionCode ackedConditionCode,
|
||||
cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode = 0);
|
||||
|
||||
cfdp::ConditionCodes getAckedConditionCode() const;
|
||||
void setAckedConditionCode(cfdp::ConditionCodes ackedConditionCode);
|
||||
cfdp::ConditionCode getAckedConditionCode() const;
|
||||
void setAckedConditionCode(cfdp::ConditionCode ackedConditionCode);
|
||||
|
||||
cfdp::FileDirectives getAckedDirective() const;
|
||||
void setAckedDirective(cfdp::FileDirectives ackedDirective);
|
||||
cfdp::FileDirective getAckedDirective() const;
|
||||
void setAckedDirective(cfdp::FileDirective ackedDirective);
|
||||
|
||||
uint8_t getDirectiveSubtypeCode() const;
|
||||
void setDirectiveSubtypeCode(uint8_t directiveSubtypeCode);
|
||||
|
@ -22,8 +22,8 @@ class AckInfo {
|
|||
void setTransactionStatus(cfdp::AckTransactionStatus transactionStatus);
|
||||
|
||||
private:
|
||||
cfdp::FileDirectives ackedDirective = cfdp::FileDirectives::INVALID_DIRECTIVE;
|
||||
cfdp::ConditionCodes ackedConditionCode = cfdp::ConditionCodes::NO_CONDITION_FIELD;
|
||||
cfdp::FileDirective ackedDirective = cfdp::FileDirective::INVALID_DIRECTIVE;
|
||||
cfdp::ConditionCode ackedConditionCode = cfdp::ConditionCode::NO_CONDITION_FIELD;
|
||||
cfdp::AckTransactionStatus transactionStatus = cfdp::AckTransactionStatus::UNDEFINED;
|
||||
uint8_t directiveSubtypeCode = 0;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "AckPduCreator.h"
|
||||
|
||||
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(); }
|
||||
|
||||
|
@ -11,12 +11,12 @@ ReturnValue_t AckPduCreator::serialize(uint8_t **buffer, size_t *size, size_t ma
|
|||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
cfdp::FileDirectives ackedDirective = ackInfo.getAckedDirective();
|
||||
cfdp::FileDirective ackedDirective = ackInfo.getAckedDirective();
|
||||
uint8_t directiveSubtypeCode = ackInfo.getDirectiveSubtypeCode();
|
||||
cfdp::ConditionCodes ackedConditionCode = ackInfo.getAckedConditionCode();
|
||||
cfdp::ConditionCode ackedConditionCode = ackInfo.getAckedConditionCode();
|
||||
cfdp::AckTransactionStatus transactionStatus = ackInfo.getTransactionStatus();
|
||||
if (ackedDirective != cfdp::FileDirectives::FINISH and
|
||||
ackedDirective != cfdp::FileDirectives::EOF_DIRECTIVE) {
|
||||
if (ackedDirective != cfdp::FileDirective::FINISH and
|
||||
ackedDirective != cfdp::FileDirective::EOF_DIRECTIVE) {
|
||||
// TODO: better returncode
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ ReturnValue_t AckPduReader::parseData() {
|
|||
}
|
||||
|
||||
bool AckPduReader::checkAndSetCodes(uint8_t firstByte, uint8_t secondByte) {
|
||||
cfdp::FileDirectives directive;
|
||||
cfdp::FileDirective directive;
|
||||
if (not checkAckedDirectiveField(firstByte, directive)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -29,17 +29,17 @@ bool AckPduReader::checkAndSetCodes(uint8_t firstByte, uint8_t secondByte) {
|
|||
return false;
|
||||
}
|
||||
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));
|
||||
return true;
|
||||
}
|
||||
bool AckPduReader::checkAckedDirectiveField(uint8_t firstPduDataByte,
|
||||
cfdp::FileDirectives& ackedDirective) {
|
||||
uint8_t ackedDirectiveRaw = static_cast<cfdp::FileDirectives>(firstPduDataByte >> 4);
|
||||
if (ackedDirectiveRaw != cfdp::FileDirectives::EOF_DIRECTIVE and
|
||||
ackedDirectiveRaw != cfdp::FileDirectives::FINISH) {
|
||||
cfdp::FileDirective& ackedDirective) {
|
||||
uint8_t ackedDirectiveRaw = static_cast<cfdp::FileDirective>(firstPduDataByte >> 4);
|
||||
if (ackedDirectiveRaw != cfdp::FileDirective::EOF_DIRECTIVE and
|
||||
ackedDirectiveRaw != cfdp::FileDirective::FINISH) {
|
||||
return false;
|
||||
}
|
||||
ackedDirective = (static_cast<cfdp::FileDirectives>(ackedDirectiveRaw));
|
||||
ackedDirective = (static_cast<cfdp::FileDirective>(ackedDirectiveRaw));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class AckPduReader : public FileDirectiveReader {
|
|||
ReturnValue_t parseData() override;
|
||||
|
||||
static bool checkAckedDirectiveField(uint8_t firstPduDataByte,
|
||||
cfdp::FileDirectives& ackedDirective);
|
||||
cfdp::FileDirective& ackedDirective);
|
||||
|
||||
private:
|
||||
bool checkAndSetCodes(uint8_t rawAckedByte, uint8_t rawAckedConditionCode);
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
#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)
|
||||
: conditionCode(conditionCode), checksum(checksum), fileSize(fileSize), faultLoc(faultLoc) {}
|
||||
|
||||
EofInfo::EofInfo(EntityIdTlv* faultLoc)
|
||||
: conditionCode(cfdp::ConditionCodes::NO_CONDITION_FIELD),
|
||||
: conditionCode(cfdp::ConditionCode::NO_CONDITION_FIELD),
|
||||
checksum(0),
|
||||
fileSize(0),
|
||||
faultLoc(faultLoc) {}
|
||||
|
||||
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; }
|
||||
|
||||
|
@ -20,7 +20,7 @@ cfdp::FileSize& EofInfo::getFileSize() { return fileSize; }
|
|||
|
||||
void EofInfo::setChecksum(uint32_t checksum) { this->checksum = checksum; }
|
||||
|
||||
void EofInfo::setConditionCode(cfdp::ConditionCodes conditionCode) {
|
||||
void EofInfo::setConditionCode(cfdp::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
|
||||
// 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();
|
||||
}
|
||||
return size;
|
||||
|
|
|
@ -8,23 +8,23 @@
|
|||
struct EofInfo {
|
||||
public:
|
||||
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);
|
||||
|
||||
size_t getSerializedSize(bool fssLarge = false);
|
||||
|
||||
[[nodiscard]] uint32_t getChecksum() const;
|
||||
[[nodiscard]] cfdp::ConditionCodes getConditionCode() const;
|
||||
[[nodiscard]] cfdp::ConditionCode getConditionCode() const;
|
||||
|
||||
[[nodiscard]] EntityIdTlv* getFaultLoc() const;
|
||||
cfdp::FileSize& getFileSize();
|
||||
void setChecksum(uint32_t checksum);
|
||||
void setConditionCode(cfdp::ConditionCodes conditionCode);
|
||||
void setConditionCode(cfdp::ConditionCode conditionCode);
|
||||
void setFaultLoc(EntityIdTlv* faultLoc);
|
||||
ReturnValue_t setFileSize(size_t size, bool isLarge);
|
||||
|
||||
private:
|
||||
cfdp::ConditionCodes conditionCode;
|
||||
cfdp::ConditionCode conditionCode;
|
||||
uint32_t checksum;
|
||||
cfdp::FileSize fileSize;
|
||||
EntityIdTlv* faultLoc = nullptr;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "fsfw/FSFW.h"
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ ReturnValue_t EofPduCreator::serialize(uint8_t **buffer, size_t *size, size_t ma
|
|||
uint32_t fileSizeValue = info.getFileSize().getSize();
|
||||
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);
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -25,7 +25,7 @@ ReturnValue_t EofPduReader::parseData() {
|
|||
|
||||
bufPtr += currentIdx;
|
||||
deserLen -= currentIdx;
|
||||
info.setConditionCode(static_cast<cfdp::ConditionCodes>(*bufPtr >> 4));
|
||||
info.setConditionCode(static_cast<cfdp::ConditionCode>(*bufPtr >> 4));
|
||||
bufPtr += 1;
|
||||
deserLen -= 1;
|
||||
uint32_t checksum = 0;
|
||||
|
@ -47,7 +47,7 @@ ReturnValue_t EofPduReader::parseData() {
|
|||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
if (info.getConditionCode() != cfdp::ConditionCodes::NO_ERROR) {
|
||||
if (info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) {
|
||||
EntityIdTlv* tlvPtr = info.getFaultLoc();
|
||||
if (tlvPtr == nullptr) {
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <cstring>
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "FileDirectiveCreator.h"
|
||||
|
||||
FileDirectiveCreator::FileDirectiveCreator(PduConfig &pduConf, cfdp::FileDirectives directiveCode,
|
||||
FileDirectiveCreator::FileDirectiveCreator(PduConfig &pduConf, cfdp::FileDirective directiveCode,
|
||||
size_t directiveParamFieldLen)
|
||||
: HeaderCreator(pduConf, cfdp::PduTypes::FILE_DIRECTIVE, directiveParamFieldLen + 1),
|
||||
: HeaderCreator(pduConf, cfdp::PduType::FILE_DIRECTIVE, directiveParamFieldLen + 1),
|
||||
directiveCode(directiveCode) {}
|
||||
|
||||
size_t FileDirectiveCreator::getSerializedSize() const {
|
||||
|
@ -36,4 +36,4 @@ void FileDirectiveCreator::setDirectiveDataFieldLen(size_t len) {
|
|||
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 {
|
||||
public:
|
||||
FileDirectiveCreator(PduConfig& pduConf, cfdp::FileDirectives directiveCode,
|
||||
FileDirectiveCreator(PduConfig& pduConf, cfdp::FileDirective directiveCode,
|
||||
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.
|
||||
|
@ -28,7 +28,7 @@ class FileDirectiveCreator : public HeaderCreator {
|
|||
void setDirectiveDataFieldLen(size_t len);
|
||||
|
||||
private:
|
||||
cfdp::FileDirectives directiveCode = cfdp::FileDirectives::INVALID_DIRECTIVE;
|
||||
cfdp::FileDirective directiveCode = cfdp::FileDirective::INVALID_DIRECTIVE;
|
||||
};
|
||||
|
||||
#endif /* FSFW_SRC_FSFW_CFDP_PDU_FILEDIRECTIVESERIALIZER_H_ */
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
FileDirectiveReader::FileDirectiveReader(const uint8_t *pduBuf, size_t maxSize)
|
||||
: PduHeaderReader(pduBuf, maxSize) {}
|
||||
|
||||
cfdp::FileDirectives FileDirectiveReader::getFileDirective() const { return fileDirective; }
|
||||
cfdp::FileDirective FileDirectiveReader::getFileDirective() const { return fileDirective; }
|
||||
|
||||
ReturnValue_t FileDirectiveReader::parseData() {
|
||||
ReturnValue_t result = PduHeaderReader::parseData();
|
||||
|
@ -20,7 +20,7 @@ ReturnValue_t FileDirectiveReader::parseData() {
|
|||
if (not checkFileDirective(pointers.rawPtr[currentIdx])) {
|
||||
return cfdp::INVALID_DIRECTIVE_FIELD;
|
||||
}
|
||||
setFileDirective(static_cast<cfdp::FileDirectives>(pointers.rawPtr[currentIdx]));
|
||||
setFileDirective(static_cast<cfdp::FileDirective>(pointers.rawPtr[currentIdx]));
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
|
@ -30,15 +30,15 @@ size_t FileDirectiveReader::getHeaderSize() const {
|
|||
}
|
||||
|
||||
bool FileDirectiveReader::checkFileDirective(uint8_t rawByte) {
|
||||
if (rawByte < cfdp::FileDirectives::EOF_DIRECTIVE or
|
||||
(rawByte > cfdp::FileDirectives::PROMPT and rawByte != cfdp::FileDirectives::KEEP_ALIVE)) {
|
||||
if (rawByte < cfdp::FileDirective::EOF_DIRECTIVE or
|
||||
(rawByte > cfdp::FileDirective::PROMPT and rawByte != cfdp::FileDirective::KEEP_ALIVE)) {
|
||||
// Invalid directive field
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void FileDirectiveReader::setFileDirective(cfdp::FileDirectives fileDirective_) {
|
||||
void FileDirectiveReader::setFileDirective(cfdp::FileDirective fileDirective_) {
|
||||
fileDirective = fileDirective_;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ class FileDirectiveReader : public PduHeaderReader {
|
|||
ReturnValue_t parseData() override;
|
||||
[[nodiscard]] size_t getHeaderSize() const override;
|
||||
|
||||
[[nodiscard]] cfdp::FileDirectives getFileDirective() const;
|
||||
[[nodiscard]] cfdp::FileDirective getFileDirective() const;
|
||||
|
||||
void setEndianness(SerializeIF::Endianness endianness);
|
||||
[[nodiscard]] SerializeIF::Endianness getEndianness() const;
|
||||
|
@ -30,8 +30,8 @@ class FileDirectiveReader : public PduHeaderReader {
|
|||
|
||||
protected:
|
||||
private:
|
||||
void setFileDirective(cfdp::FileDirectives fileDirective);
|
||||
cfdp::FileDirectives fileDirective = cfdp::FileDirectives::INVALID_DIRECTIVE;
|
||||
void setFileDirective(cfdp::FileDirective fileDirective);
|
||||
cfdp::FileDirective fileDirective = cfdp::FileDirective::INVALID_DIRECTIVE;
|
||||
SerializeIF::Endianness endianness = SerializeIF::Endianness::NETWORK;
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
FinishedInfo::FinishedInfo() {}
|
||||
|
||||
FinishedInfo::FinishedInfo(cfdp::ConditionCodes conditionCode, cfdp::FileDeliveryCode deliveryCode,
|
||||
FinishedInfo::FinishedInfo(cfdp::ConditionCode conditionCode, cfdp::FileDeliveryCode deliveryCode,
|
||||
cfdp::FileDeliveryStatus fileStatus)
|
||||
: conditionCode(conditionCode), deliveryCode(deliveryCode), fileStatus(fileStatus) {}
|
||||
|
||||
|
@ -76,9 +76,9 @@ ReturnValue_t FinishedInfo::getFaultLocation(EntityIdTlv** faultLocation) {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
class FinishedInfo {
|
||||
public:
|
||||
FinishedInfo();
|
||||
FinishedInfo(cfdp::ConditionCodes conditionCode, cfdp::FileDeliveryCode deliveryCode,
|
||||
FinishedInfo(cfdp::ConditionCode conditionCode, cfdp::FileDeliveryCode deliveryCode,
|
||||
cfdp::FileDeliveryStatus fileStatus);
|
||||
|
||||
[[nodiscard]] size_t getSerializedSize() const;
|
||||
|
@ -25,15 +25,15 @@ class FinishedInfo {
|
|||
[[nodiscard]] size_t getFsResponsesLen() const;
|
||||
void setFilestoreResponsesArrayLen(size_t fsResponsesLen);
|
||||
ReturnValue_t getFaultLocation(EntityIdTlv** entityId);
|
||||
[[nodiscard]] cfdp::ConditionCodes getConditionCode() const;
|
||||
void setConditionCode(cfdp::ConditionCodes conditionCode);
|
||||
[[nodiscard]] cfdp::ConditionCode getConditionCode() const;
|
||||
void setConditionCode(cfdp::ConditionCode conditionCode);
|
||||
[[nodiscard]] cfdp::FileDeliveryCode getDeliveryCode() const;
|
||||
void setDeliveryCode(cfdp::FileDeliveryCode deliveryCode);
|
||||
[[nodiscard]] cfdp::FileDeliveryStatus getFileStatus() const;
|
||||
void setFileStatus(cfdp::FileDeliveryStatus fileStatus);
|
||||
|
||||
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::FileDeliveryStatus fileStatus = cfdp::FileDeliveryStatus::DISCARDED_DELIBERATELY;
|
||||
FilestoreResponseTlv** fsResponses = nullptr;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "FinishedPduCreator.h"
|
||||
|
||||
FinishPduCreator::FinishPduCreator(PduConfig &conf, FinishedInfo &finishInfo)
|
||||
: FileDirectiveCreator(conf, cfdp::FileDirectives::FINISH, 0), finishInfo(finishInfo) {
|
||||
: FileDirectiveCreator(conf, cfdp::FileDirective::FINISH, 0), finishInfo(finishInfo) {
|
||||
updateDirectiveFieldLen();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ ReturnValue_t FinishPduReader::parseData() {
|
|||
return SerializeIF::STREAM_TOO_SHORT;
|
||||
}
|
||||
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.setDeliveryCode(static_cast<cfdp::FileDeliveryCode>(firstByte >> 2 & 0b1));
|
||||
finishedInfo.setFileStatus(static_cast<cfdp::FileDeliveryStatus>(firstByte & 0b11));
|
||||
|
@ -31,14 +31,14 @@ ReturnValue_t FinishPduReader::parseData() {
|
|||
FinishedInfo& FinishPduReader::getInfo() { return finishedInfo; }
|
||||
|
||||
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;
|
||||
size_t fsResponsesIdx = 0;
|
||||
auto endianness = getEndianness();
|
||||
FilestoreResponseTlv** fsResponseArray = nullptr;
|
||||
size_t fsResponseMaxArrayLen = 0;
|
||||
EntityIdTlv* faultLocation = nullptr;
|
||||
cfdp::TlvTypes nextTlv = cfdp::TlvTypes::INVALID_TLV;
|
||||
cfdp::TlvType nextTlv = cfdp::TlvType::INVALID_TLV;
|
||||
while (remLen > 0) {
|
||||
// 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
|
||||
|
@ -46,8 +46,8 @@ ReturnValue_t FinishPduReader::parseTlvs(size_t remLen, size_t currentIdx, const
|
|||
if (currentIdx + 2 > maxSize) {
|
||||
return SerializeIF::STREAM_TOO_SHORT;
|
||||
}
|
||||
nextTlv = static_cast<cfdp::TlvTypes>(*buf);
|
||||
if (nextTlv == cfdp::TlvTypes::FILESTORE_RESPONSE) {
|
||||
nextTlv = static_cast<cfdp::TlvType>(*buf);
|
||||
if (nextTlv == cfdp::TlvType::FILESTORE_RESPONSE) {
|
||||
if (fsResponseArray == nullptr) {
|
||||
if (not finishedInfo.canHoldFsResponses()) {
|
||||
return cfdp::FINISHED_CANT_PARSE_FS_RESPONSES;
|
||||
|
@ -63,11 +63,11 @@ ReturnValue_t FinishPduReader::parseTlvs(size_t remLen, size_t currentIdx, const
|
|||
return result;
|
||||
}
|
||||
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
|
||||
// is "No Error" or "Unsupported Checksum Type"
|
||||
if (conditionCode == cfdp::ConditionCodes::NO_ERROR or
|
||||
conditionCode == cfdp::ConditionCodes::UNSUPPORTED_CHECKSUM_TYPE) {
|
||||
if (conditionCode == cfdp::ConditionCode::NO_ERROR or
|
||||
conditionCode == cfdp::ConditionCode::UNSUPPORTED_CHECKSUM_TYPE) {
|
||||
return cfdp::INVALID_TLV_TYPE;
|
||||
}
|
||||
result = finishedInfo.getFaultLocation(&faultLocation);
|
||||
|
|
|
@ -16,7 +16,7 @@ class FinishPduReader : public FileDirectiveReader {
|
|||
FinishedInfo& finishedInfo;
|
||||
|
||||
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_ */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#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::SegmentationControl segCtrl)
|
||||
: pduType(pduType),
|
||||
|
@ -65,17 +65,17 @@ void HeaderCreator::setPduDataFieldLen(size_t 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_) {
|
||||
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::TransmissionModes HeaderCreator::getTransmissionMode() const { return pduConf.mode; }
|
||||
cfdp::TransmissionMode HeaderCreator::getTransmissionMode() const { return pduConf.mode; }
|
||||
|
||||
bool HeaderCreator::getCrcFlag() const { return pduConf.crcFlag; }
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
class HeaderCreator : public SerializeIF, public PduHeaderIF {
|
||||
public:
|
||||
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::SegmentationControl segCtrl =
|
||||
cfdp::SegmentationControl::NO_RECORD_BOUNDARIES_PRESERVATION);
|
||||
|
@ -29,15 +29,15 @@ class HeaderCreator : public SerializeIF, public PduHeaderIF {
|
|||
Endianness streamEndianness) override;
|
||||
|
||||
void setPduDataFieldLen(size_t pduDataFieldLen);
|
||||
void setPduType(cfdp::PduTypes pduType);
|
||||
void setPduType(cfdp::PduType pduType);
|
||||
void setSegmentMetadataFlag(cfdp::SegmentMetadataFlag);
|
||||
|
||||
[[nodiscard]] size_t getPduDataFieldLen() 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::TransmissionModes getTransmissionMode() const override;
|
||||
[[nodiscard]] cfdp::TransmissionMode getTransmissionMode() const override;
|
||||
[[nodiscard]] bool getCrcFlag() const override;
|
||||
[[nodiscard]] bool getLargeFileFlag() 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;
|
||||
|
||||
private:
|
||||
cfdp::PduTypes pduType;
|
||||
cfdp::PduType pduType;
|
||||
cfdp::SegmentMetadataFlag segmentMetadataFlag;
|
||||
cfdp::SegmentationControl segmentationCtrl;
|
||||
size_t pduDataFieldLen;
|
||||
|
|
|
@ -57,16 +57,16 @@ size_t PduHeaderReader::getWholePduSize() const {
|
|||
return getPduDataFieldLen() + PduHeaderReader::getHeaderSize();
|
||||
}
|
||||
|
||||
cfdp::PduTypes PduHeaderReader::getPduType() const {
|
||||
return static_cast<cfdp::PduTypes>((pointers.fixedHeader->firstByte >> 4) & 0x01);
|
||||
cfdp::PduType PduHeaderReader::getPduType() const {
|
||||
return static_cast<cfdp::PduType>((pointers.fixedHeader->firstByte >> 4) & 0x01);
|
||||
}
|
||||
|
||||
cfdp::Direction PduHeaderReader::getDirection() const {
|
||||
return static_cast<cfdp::Direction>((pointers.fixedHeader->firstByte >> 3) & 0x01);
|
||||
}
|
||||
|
||||
cfdp::TransmissionModes PduHeaderReader::getTransmissionMode() const {
|
||||
return static_cast<cfdp::TransmissionModes>((pointers.fixedHeader->firstByte >> 2) & 0x01);
|
||||
cfdp::TransmissionMode PduHeaderReader::getTransmissionMode() const {
|
||||
return static_cast<cfdp::TransmissionMode>((pointers.fixedHeader->firstByte >> 2) & 0x01);
|
||||
}
|
||||
|
||||
bool PduHeaderReader::getCrcFlag() const { return (pointers.fixedHeader->firstByte >> 1) & 0x01; }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "KeepAlivePduCreator.h"
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "MetadataInfo.h"
|
||||
|
||||
MetadataInfo::MetadataInfo(bool closureRequested, cfdp::ChecksumTypes checksumType,
|
||||
MetadataInfo::MetadataInfo(bool closureRequested, cfdp::ChecksumType checksumType,
|
||||
cfdp::FileSize& fileSize, cfdp::StringLv& sourceFileName,
|
||||
cfdp::StringLv& 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_;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,15 +13,15 @@ class MetadataInfo {
|
|||
public:
|
||||
MetadataInfo(cfdp::FileSize& fileSize, cfdp::StringLv& sourceFileName,
|
||||
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);
|
||||
|
||||
size_t getSerializedSize(bool fssLarge = false);
|
||||
|
||||
void setOptionsArray(cfdp::Tlv** optionsArray, std::optional<size_t> optionsLen,
|
||||
std::optional<size_t> maxOptionsLen);
|
||||
[[nodiscard]] cfdp::ChecksumTypes getChecksumType() const;
|
||||
void setChecksumType(cfdp::ChecksumTypes checksumType);
|
||||
[[nodiscard]] cfdp::ChecksumType getChecksumType() const;
|
||||
void setChecksumType(cfdp::ChecksumType checksumType);
|
||||
[[nodiscard]] bool isClosureRequested() const;
|
||||
void setClosureRequested(bool closureRequested = false);
|
||||
|
||||
|
@ -42,7 +42,7 @@ class MetadataInfo {
|
|||
|
||||
private:
|
||||
bool closureRequested = false;
|
||||
cfdp::ChecksumTypes checksumType = cfdp::ChecksumTypes::NULL_CHECKSUM;
|
||||
cfdp::ChecksumType checksumType = cfdp::ChecksumType::NULL_CHECKSUM;
|
||||
cfdp::FileSize& fileSize;
|
||||
cfdp::StringLv& sourceFileName;
|
||||
cfdp::StringLv& destFileName;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "MetadataPduCreator.h"
|
||||
|
||||
MetadataPduCreator::MetadataPduCreator(PduConfig &conf, MetadataInfo &info)
|
||||
: FileDirectiveCreator(conf, cfdp::FileDirectives::METADATA, 5), info(info) {
|
||||
: FileDirectiveCreator(conf, cfdp::FileDirective::METADATA, 5), info(info) {
|
||||
updateDirectiveFieldLen();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ ReturnValue_t MetadataPduReader::parseData() {
|
|||
return SerializeIF::STREAM_TOO_SHORT;
|
||||
}
|
||||
info.setClosureRequested((*buf >> 6) & 0x01);
|
||||
info.setChecksumType(static_cast<cfdp::ChecksumTypes>(*buf & 0x0f));
|
||||
info.setChecksumType(static_cast<cfdp::ChecksumType>(*buf & 0x0f));
|
||||
remSize -= 1;
|
||||
buf += 1;
|
||||
auto endianness = getEndianness();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "NakPduCreator.h"
|
||||
|
||||
NakPduCreator::NakPduCreator(PduConfig &pduConf, NakInfo &nakInfo)
|
||||
: FileDirectiveCreator(pduConf, cfdp::FileDirectives::NAK, 0), nakInfo(nakInfo) {
|
||||
: FileDirectiveCreator(pduConf, cfdp::FileDirective::NAK, 0), nakInfo(nakInfo) {
|
||||
updateDirectiveFieldLen();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#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::Direction direction)
|
||||
: mode(mode),
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
class PduConfig {
|
||||
public:
|
||||
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::Direction direction = cfdp::Direction::TOWARDS_RECEIVER);
|
||||
|
||||
cfdp::TransmissionModes mode = cfdp::TransmissionModes::ACKNOWLEDGED;
|
||||
cfdp::TransmissionMode mode = cfdp::TransmissionMode::ACKNOWLEDGED;
|
||||
cfdp::TransactionSeqNum seqNum;
|
||||
cfdp::EntityId sourceId;
|
||||
cfdp::EntityId destId;
|
||||
|
|
|
@ -17,9 +17,9 @@ class PduHeaderIF {
|
|||
|
||||
[[nodiscard]] virtual size_t getWholePduSize() 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::TransmissionModes getTransmissionMode() const = 0;
|
||||
[[nodiscard]] virtual cfdp::TransmissionMode getTransmissionMode() const = 0;
|
||||
[[nodiscard]] virtual bool getCrcFlag() const = 0;
|
||||
[[nodiscard]] virtual bool getLargeFileFlag() 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 getWholePduSize() const override;
|
||||
|
||||
[[nodiscard]] cfdp::PduTypes getPduType() const override;
|
||||
[[nodiscard]] cfdp::PduType getPduType() 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 getLargeFileFlag() const override;
|
||||
[[nodiscard]] cfdp::SegmentationControl getSegmentationControl() const override;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "PromptPduCreator.h"
|
||||
|
||||
PromptPduCreator::PromptPduCreator(PduConfig &conf, cfdp::PromptResponseRequired responseRequired)
|
||||
: FileDirectiveCreator(conf, cfdp::FileDirectives::PROMPT, 1),
|
||||
: FileDirectiveCreator(conf, cfdp::FileDirective::PROMPT, 1),
|
||||
responseRequired(responseRequired) {}
|
||||
|
||||
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()) {
|
||||
return BUFFER_TOO_SHORT;
|
||||
}
|
||||
**buffer = cfdp::TlvTypes::ENTITY_ID;
|
||||
**buffer = cfdp::TlvType::ENTITY_ID;
|
||||
*size += 1;
|
||||
*buffer += 1;
|
||||
size_t serLen = entityId.getSerializedSize();
|
||||
|
@ -28,8 +28,8 @@ ReturnValue_t EntityIdTlv::deSerialize(const uint8_t **buffer, size_t *size,
|
|||
if (*size < 3) {
|
||||
return STREAM_TOO_SHORT;
|
||||
}
|
||||
cfdp::TlvTypes type = static_cast<cfdp::TlvTypes>(**buffer);
|
||||
if (type != cfdp::TlvTypes::ENTITY_ID) {
|
||||
cfdp::TlvType type = static_cast<cfdp::TlvType>(**buffer);
|
||||
if (type != cfdp::TlvType::ENTITY_ID) {
|
||||
return cfdp::INVALID_TLV_TYPE;
|
||||
}
|
||||
*buffer += 1;
|
||||
|
@ -54,6 +54,6 @@ ReturnValue_t EntityIdTlv::deSerialize(cfdp::Tlv &tlv, Endianness endianness) {
|
|||
|
||||
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; }
|
||||
|
|
|
@ -27,7 +27,7 @@ class EntityIdTlv : public TlvIF {
|
|||
Endianness streamEndianness) override;
|
||||
|
||||
uint8_t getLengthField() const override;
|
||||
cfdp::TlvTypes getType() const override;
|
||||
cfdp::TlvType getType() const override;
|
||||
|
||||
cfdp::EntityId& getEntityId();
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "FaultHandlerOverrideTlv.h"
|
||||
|
||||
FaultHandlerOverrideTlv::FaultHandlerOverrideTlv(cfdp::ConditionCodes conditionCode,
|
||||
cfdp::FaultHandlerCodes handlerCode)
|
||||
FaultHandlerOverrideTlv::FaultHandlerOverrideTlv(cfdp::ConditionCode conditionCode,
|
||||
cfdp::FaultHandlerCode handlerCode)
|
||||
: conditionCode(conditionCode), handlerCode(handlerCode) {}
|
||||
|
||||
FaultHandlerOverrideTlv::FaultHandlerOverrideTlv() = default;
|
||||
|
@ -32,8 +32,8 @@ ReturnValue_t FaultHandlerOverrideTlv::deSerialize(const uint8_t **buffer, size_
|
|||