add first fault handler base class
This commit is contained in:
parent
0d26a0f54b
commit
7fb906a0ac
@ -1,6 +1,7 @@
|
|||||||
target_sources(
|
target_sources(
|
||||||
${LIB_FSFW_NAME} PRIVATE CfdpMessage.cpp CfdpDistributor.cpp
|
${LIB_FSFW_NAME}
|
||||||
CfdpSourceHandler.cpp CfdpDestHandler.cpp)
|
PRIVATE CfdpMessage.cpp CfdpDistributor.cpp CfdpSourceHandler.cpp
|
||||||
|
CfdpDestHandler.cpp FaultHandlerBase.cpp)
|
||||||
|
|
||||||
# CfdpDistributor.cpp CfdpHandler.cpp
|
# CfdpDistributor.cpp CfdpHandler.cpp
|
||||||
add_subdirectory(pdu)
|
add_subdirectory(pdu)
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
#ifndef FSFW_CFDP_CFDPDESTHANDLER_H
|
#ifndef FSFW_CFDP_CFDPDESTHANDLER_H
|
||||||
#define FSFW_CFDP_CFDPDESTHANDLER_H
|
#define FSFW_CFDP_CFDPDESTHANDLER_H
|
||||||
|
|
||||||
class CfdpDestHandler {};
|
#include <etl/flat_map.h>
|
||||||
|
|
||||||
|
#include "fsfw/cfdp/pdu/PduConfig.h"
|
||||||
|
|
||||||
|
class CfdpDestHandler {
|
||||||
|
public:
|
||||||
|
CfdpDestHandler();
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
#endif // FSFW_CFDP_CFDPDESTHANDLER_H
|
#endif // FSFW_CFDP_CFDPDESTHANDLER_H
|
||||||
|
5
src/fsfw/cfdp/FaultHandlerBase.cpp
Normal file
5
src/fsfw/cfdp/FaultHandlerBase.cpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include "FaultHandlerBase.h"
|
||||||
|
|
||||||
|
CfdpFaultHandlerBase::CfdpFaultHandlerBase() {}
|
||||||
|
|
||||||
|
CfdpFaultHandlerBase::~CfdpFaultHandlerBase() = default;
|
29
src/fsfw/cfdp/FaultHandlerBase.h
Normal file
29
src/fsfw/cfdp/FaultHandlerBase.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#ifndef FSFW_CFDP_FAULTHANDLERBASE_H
|
||||||
|
#define FSFW_CFDP_FAULTHANDLERBASE_H
|
||||||
|
|
||||||
|
#include <etl/flat_map.h>
|
||||||
|
|
||||||
|
#include "definitions.h"
|
||||||
|
|
||||||
|
class CfdpFaultHandlerBase {
|
||||||
|
public:
|
||||||
|
virtual ~CfdpFaultHandlerBase();
|
||||||
|
CfdpFaultHandlerBase();
|
||||||
|
|
||||||
|
private:
|
||||||
|
etl::flat_map<cfdp::ConditionCode, cfdp::FaultHandlerCodes, 9> handleMap = {
|
||||||
|
etl::pair{cfdp::ConditionCode::POSITIVE_ACK_LIMIT_REACHED,
|
||||||
|
cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||||
|
etl::pair{cfdp::ConditionCode::KEEP_ALIVE_LIMIT_REACHED,
|
||||||
|
cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||||
|
etl::pair{cfdp::ConditionCode::INVALID_TRANSMISSION_MODE,
|
||||||
|
cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||||
|
etl::pair{cfdp::ConditionCode::FILE_CHECKSUM_FAILURE, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||||
|
etl::pair{cfdp::ConditionCode::FILE_SIZE_ERROR, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||||
|
etl::pair{cfdp::ConditionCode::NAK_LIMIT_REACHED, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||||
|
etl::pair{cfdp::ConditionCode::INACTIVITY_DETECTED, cfdp::FaultHandlerCodes::IGNORE_ERROR},
|
||||||
|
etl::pair{cfdp::ConditionCode::UNSUPPORTED_CHECKSUM_TYPE,
|
||||||
|
cfdp::FaultHandlerCodes::IGNORE_ERROR}};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FSFW_CFDP_FAULTHANDLERBASE_H
|
@ -6,6 +6,7 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include "fsfw/cfdp/pdu/PduHeaderIF.h"
|
||||||
#include "fsfw/returnvalues/FwClassIds.h"
|
#include "fsfw/returnvalues/FwClassIds.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
|
||||||
@ -90,6 +91,14 @@ enum ConditionCode : uint8_t {
|
|||||||
CANCEL_REQUEST_RECEIVED = 0b1111
|
CANCEL_REQUEST_RECEIVED = 0b1111
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum FaultHandlerCodes {
|
||||||
|
RESERVED = 0b0000,
|
||||||
|
NOTICE_OF_CANCELLATION = 0b0001,
|
||||||
|
NOTICE_OF_SUSPENSION = 0b0010,
|
||||||
|
IGNORE_ERROR = 0b0011,
|
||||||
|
ABANDON_TRANSACTION = 0b0100
|
||||||
|
};
|
||||||
|
|
||||||
enum AckTransactionStatus {
|
enum AckTransactionStatus {
|
||||||
UNDEFINED = 0b00,
|
UNDEFINED = 0b00,
|
||||||
ACTIVE = 0b01,
|
ACTIVE = 0b01,
|
||||||
@ -125,6 +134,20 @@ enum RecordContinuationState {
|
|||||||
CONTAINS_START_AND_END = 0b11
|
CONTAINS_START_AND_END = 0b11
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct IndicationCfg {
|
||||||
|
bool eofSentIndicRequired = true;
|
||||||
|
bool eofRecvIndicRequired = true;
|
||||||
|
bool fileSegmentRecvIndicRequired = true;
|
||||||
|
bool transactionFinishedIndicRequired = true;
|
||||||
|
bool suspendedIndicRequired = true;
|
||||||
|
bool resumedIndicRequired = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LocalEntityCfg {
|
||||||
|
EntityId localId;
|
||||||
|
IndicationCfg indicCfg;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace cfdp
|
} // namespace cfdp
|
||||||
|
|
||||||
#endif /* FSFW_SRC_FSFW_CFDP_PDU_DEFINITIONS_H_ */
|
#endif /* FSFW_SRC_FSFW_CFDP_PDU_DEFINITIONS_H_ */
|
||||||
|
@ -11,10 +11,10 @@ class FinishedInfo {
|
|||||||
FinishedInfo(cfdp::ConditionCode conditionCode, cfdp::FinishedDeliveryCode deliveryCode,
|
FinishedInfo(cfdp::ConditionCode conditionCode, cfdp::FinishedDeliveryCode deliveryCode,
|
||||||
cfdp::FinishedFileStatus fileStatus);
|
cfdp::FinishedFileStatus fileStatus);
|
||||||
|
|
||||||
size_t getSerializedSize() const;
|
[[nodiscard]] size_t getSerializedSize() const;
|
||||||
|
|
||||||
bool hasFsResponses() const;
|
[[nodiscard]] bool hasFsResponses() const;
|
||||||
bool canHoldFsResponses() const;
|
[[nodiscard]] bool canHoldFsResponses() const;
|
||||||
|
|
||||||
ReturnValue_t setFilestoreResponsesArray(FilestoreResponseTlv** fsResponses,
|
ReturnValue_t setFilestoreResponsesArray(FilestoreResponseTlv** fsResponses,
|
||||||
size_t* fsResponsesLen, const size_t* maxFsResponseLen);
|
size_t* fsResponsesLen, const size_t* maxFsResponseLen);
|
||||||
@ -22,14 +22,14 @@ class FinishedInfo {
|
|||||||
|
|
||||||
ReturnValue_t getFilestoreResonses(FilestoreResponseTlv*** fsResponses, size_t* fsResponsesLen,
|
ReturnValue_t getFilestoreResonses(FilestoreResponseTlv*** fsResponses, size_t* fsResponsesLen,
|
||||||
size_t* fsResponsesMaxLen);
|
size_t* fsResponsesMaxLen);
|
||||||
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);
|
||||||
cfdp::ConditionCode getConditionCode() const;
|
[[nodiscard]] cfdp::ConditionCode getConditionCode() const;
|
||||||
void setConditionCode(cfdp::ConditionCode conditionCode);
|
void setConditionCode(cfdp::ConditionCode conditionCode);
|
||||||
cfdp::FinishedDeliveryCode getDeliveryCode() const;
|
[[nodiscard]] cfdp::FinishedDeliveryCode getDeliveryCode() const;
|
||||||
void setDeliveryCode(cfdp::FinishedDeliveryCode deliveryCode);
|
void setDeliveryCode(cfdp::FinishedDeliveryCode deliveryCode);
|
||||||
cfdp::FinishedFileStatus getFileStatus() const;
|
[[nodiscard]] cfdp::FinishedFileStatus getFileStatus() const;
|
||||||
void setFileStatus(cfdp::FinishedFileStatus fileStatus);
|
void setFileStatus(cfdp::FinishedFileStatus fileStatus);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#include "FaultHandlerOverrideTlv.h"
|
#include "FaultHandlerOverrideTlv.h"
|
||||||
|
|
||||||
FaultHandlerOverrideTlv::FaultHandlerOverrideTlv(cfdp::ConditionCode conditionCode,
|
FaultHandlerOverrideTlv::FaultHandlerOverrideTlv(cfdp::ConditionCode conditionCode,
|
||||||
cfdp::FaultHandlerCode handlerCode)
|
cfdp::FaultHandlerCodes handlerCode)
|
||||||
: conditionCode(conditionCode), handlerCode(handlerCode) {}
|
: conditionCode(conditionCode), handlerCode(handlerCode) {}
|
||||||
|
|
||||||
FaultHandlerOverrideTlv::FaultHandlerOverrideTlv() {}
|
FaultHandlerOverrideTlv::FaultHandlerOverrideTlv() = default;
|
||||||
|
|
||||||
uint8_t FaultHandlerOverrideTlv::getLengthField() const { return 1; }
|
uint8_t FaultHandlerOverrideTlv::getLengthField() const { return 1; }
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ ReturnValue_t FaultHandlerOverrideTlv::deSerialize(const uint8_t **buffer, size_
|
|||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size += 1;
|
*size += 1;
|
||||||
this->conditionCode = static_cast<cfdp::ConditionCode>((**buffer >> 4) & 0x0f);
|
this->conditionCode = static_cast<cfdp::ConditionCode>((**buffer >> 4) & 0x0f);
|
||||||
this->handlerCode = static_cast<cfdp::FaultHandlerCode>(**buffer & 0x0f);
|
this->handlerCode = static_cast<cfdp::FaultHandlerCodes>(**buffer & 0x0f);
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size += 1;
|
*size += 1;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
@ -3,36 +3,24 @@
|
|||||||
|
|
||||||
#include "TlvIF.h"
|
#include "TlvIF.h"
|
||||||
|
|
||||||
namespace cfdp {
|
|
||||||
|
|
||||||
enum FaultHandlerCode {
|
|
||||||
RESERVED = 0b0000,
|
|
||||||
NOTICE_OF_CANCELLATION = 0b0001,
|
|
||||||
NOTICE_OF_SUSPENSION = 0b0010,
|
|
||||||
IGNORE_ERROR = 0b0011,
|
|
||||||
ABANDON_TRANSACTION = 0b0100
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class FaultHandlerOverrideTlv : public TlvIF {
|
class FaultHandlerOverrideTlv : public TlvIF {
|
||||||
public:
|
public:
|
||||||
FaultHandlerOverrideTlv();
|
FaultHandlerOverrideTlv();
|
||||||
FaultHandlerOverrideTlv(cfdp::ConditionCode conditionCode, cfdp::FaultHandlerCode handlerCode);
|
FaultHandlerOverrideTlv(cfdp::ConditionCode conditionCode, cfdp::FaultHandlerCodes 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;
|
||||||
|
|
||||||
size_t getSerializedSize() const override;
|
[[nodiscard]] size_t getSerializedSize() const override;
|
||||||
|
|
||||||
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;
|
||||||
uint8_t getLengthField() const override;
|
[[nodiscard]] uint8_t getLengthField() const override;
|
||||||
cfdp::TlvTypes getType() const override;
|
[[nodiscard]] cfdp::TlvTypes getType() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cfdp::ConditionCode conditionCode = cfdp::ConditionCode::NO_CONDITION_FIELD;
|
cfdp::ConditionCode conditionCode = cfdp::ConditionCode::NO_CONDITION_FIELD;
|
||||||
cfdp::FaultHandlerCode handlerCode = cfdp::FaultHandlerCode::RESERVED;
|
cfdp::FaultHandlerCodes handlerCode = cfdp::FaultHandlerCodes::RESERVED;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_SRC_FSFW_CFDP_TLV_FAULTHANDLEROVERRIDETLV_H_ */
|
#endif /* FSFW_SRC_FSFW_CFDP_TLV_FAULTHANDLEROVERRIDETLV_H_ */
|
||||||
|
@ -304,7 +304,7 @@ TEST_CASE("CFDP TLV LV", "[cfdp]") {
|
|||||||
FlowLabelTlv flowLabelTlv(&flowLabel, 1);
|
FlowLabelTlv flowLabelTlv(&flowLabel, 1);
|
||||||
|
|
||||||
FaultHandlerOverrideTlv faultOverrideTlv(cfdp::ConditionCode::FILESTORE_REJECTION,
|
FaultHandlerOverrideTlv faultOverrideTlv(cfdp::ConditionCode::FILESTORE_REJECTION,
|
||||||
cfdp::FaultHandlerCode::NOTICE_OF_CANCELLATION);
|
cfdp::FaultHandlerCodes::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);
|
||||||
|
Loading…
Reference in New Issue
Block a user