add remote config table provider class
All checks were successful
fsfw/fsfw/pipeline/pr-development This commit looks good
All checks were successful
fsfw/fsfw/pipeline/pr-development This commit looks good
This commit is contained in:
parent
8c059f8f32
commit
d45108e3c2
@ -1,4 +1,5 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE CfdpMessage.cpp CfdpDistributor.cpp)
|
target_sources(${LIB_FSFW_NAME} PRIVATE CfdpMessage.cpp CfdpDistributor.cpp
|
||||||
|
VarLenFields.cpp)
|
||||||
|
|
||||||
add_subdirectory(pdu)
|
add_subdirectory(pdu)
|
||||||
add_subdirectory(tlv)
|
add_subdirectory(tlv)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "VarLenField.h"
|
#include "VarLenFields.h"
|
||||||
|
|
||||||
#include "fsfw/serialize/SerializeAdapter.h"
|
#include "fsfw/serialize/SerializeAdapter.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface.h"
|
||||||
@ -119,9 +119,15 @@ ReturnValue_t cfdp::VarLenField::deSerialize(const uint8_t **buffer, size_t *siz
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool cfdp::VarLenField::operator<(const cfdp::VarLenField &other) const {
|
bool cfdp::VarLenField::operator<(const cfdp::VarLenField &other) const {
|
||||||
return getValue() < other.getValue();
|
if (getWidth() < other.getWidth()) {
|
||||||
|
return true;
|
||||||
|
} else if (getWidth() == other.getWidth()) {
|
||||||
|
return getValue() < other.getValue();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cfdp::VarLenField::operator==(const cfdp::VarLenField &other) const {
|
bool cfdp::VarLenField::operator==(const cfdp::VarLenField &other) const {
|
||||||
return getValue() == other.getValue();
|
return getWidth() == other.getWidth() and getValue() == other.getValue();
|
||||||
}
|
}
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "fsfw/cfdp/definitions.h"
|
#include "fsfw/cfdp/definitions.h"
|
||||||
#include "fsfw/serialize/SerializeIF.h"
|
#include "fsfw/serialize/SerializeIF.h"
|
||||||
@ -56,6 +57,34 @@ cfdp::VarLenField::VarLenField(UnsignedByteField<T> byteField)
|
|||||||
setValue(width, byteField.getValue());
|
setValue(width, byteField.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct EntityId : public VarLenField {
|
||||||
|
public:
|
||||||
|
EntityId() : VarLenField() {}
|
||||||
|
template <typename T>
|
||||||
|
explicit EntityId(UnsignedByteField<T> byteField) : VarLenField(byteField) {}
|
||||||
|
EntityId(cfdp::WidthInBytes width, size_t entityId) : VarLenField(width, entityId) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TransactionSeqNum : public VarLenField {
|
||||||
|
public:
|
||||||
|
TransactionSeqNum() : VarLenField() {}
|
||||||
|
template <typename T>
|
||||||
|
explicit TransactionSeqNum(UnsignedByteField<T> byteField) : VarLenField(byteField) {}
|
||||||
|
TransactionSeqNum(cfdp::WidthInBytes width, size_t seqNum) : VarLenField(width, seqNum) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TransactionId {
|
||||||
|
TransactionId(EntityId entityId, TransactionSeqNum seqNum)
|
||||||
|
: entityId(std::move(entityId)), seqNum(std::move(seqNum)) {}
|
||||||
|
|
||||||
|
bool operator==(const TransactionId &other) {
|
||||||
|
return entityId == other.entityId and seqNum == other.seqNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityId entityId;
|
||||||
|
TransactionSeqNum seqNum;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace cfdp
|
} // namespace cfdp
|
||||||
|
|
||||||
#endif /* FSFW_CFDP_PDU_VARLENFIELD_H_ */
|
#endif /* FSFW_CFDP_PDU_VARLENFIELD_H_ */
|
@ -11,7 +11,11 @@
|
|||||||
|
|
||||||
namespace cfdp {
|
namespace cfdp {
|
||||||
|
|
||||||
static constexpr uint8_t VERSION_BITS = 0b00100000;
|
static constexpr char CFDP_VERSION_2_NAME[] = "CCSDS 727.0-B-5";
|
||||||
|
|
||||||
|
// Second version of the protocol, only this one is supported here
|
||||||
|
static constexpr uint8_t CFDP_VERSION_2 = 0b001;
|
||||||
|
static constexpr uint8_t VERSION_BITS = CFDP_VERSION_2 << 5;
|
||||||
|
|
||||||
static constexpr uint8_t CFDP_CLASS_ID = CLASS_ID::CFDP;
|
static constexpr uint8_t CFDP_CLASS_ID = CLASS_ID::CFDP;
|
||||||
|
|
||||||
|
@ -2,5 +2,6 @@
|
|||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
cfdp::DestHandler::DestHandler(LocalEntityCfg cfg, UserBase& user)
|
cfdp::DestHandler::DestHandler(LocalEntityCfg cfg, UserBase& user,
|
||||||
: cfg(std::move(cfg)), user(user) {}
|
RemoteConfigTableIF& remoteCfgTable)
|
||||||
|
: cfg(std::move(cfg)), user(user), remoteCfgTable(remoteCfgTable) {}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef FSFW_CFDP_CFDPDESTHANDLER_H
|
#ifndef FSFW_CFDP_CFDPDESTHANDLER_H
|
||||||
#define FSFW_CFDP_CFDPDESTHANDLER_H
|
#define FSFW_CFDP_CFDPDESTHANDLER_H
|
||||||
|
|
||||||
|
#include "RemoteConfigTableIF.h"
|
||||||
#include "UserBase.h"
|
#include "UserBase.h"
|
||||||
#include "fsfw/cfdp/handler/mib.h"
|
#include "fsfw/cfdp/handler/mib.h"
|
||||||
#include "fsfw/cfdp/pdu/PduConfig.h"
|
#include "fsfw/cfdp/pdu/PduConfig.h"
|
||||||
@ -9,11 +10,12 @@ namespace cfdp {
|
|||||||
|
|
||||||
class DestHandler {
|
class DestHandler {
|
||||||
public:
|
public:
|
||||||
DestHandler(LocalEntityCfg cfg, UserBase& user /*, RemoteConfigTableIF& remoteConfigTable*/);
|
DestHandler(LocalEntityCfg cfg, UserBase& user, RemoteConfigTableIF& remoteCfgTable);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LocalEntityCfg cfg;
|
LocalEntityCfg cfg;
|
||||||
UserBase& user;
|
UserBase& user;
|
||||||
|
RemoteConfigTableIF& remoteCfgTable;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cfdp
|
} // namespace cfdp
|
||||||
|
15
src/fsfw/cfdp/handler/RemoteConfigTableIF.h
Normal file
15
src/fsfw/cfdp/handler/RemoteConfigTableIF.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef FSFW_CFDP_HANDLER_REMOTECONFIGTABLEIF_H
|
||||||
|
#define FSFW_CFDP_HANDLER_REMOTECONFIGTABLEIF_H
|
||||||
|
|
||||||
|
#include "fsfw/cfdp/handler/mib.h"
|
||||||
|
|
||||||
|
namespace cfdp {
|
||||||
|
|
||||||
|
class RemoteConfigTableIF {
|
||||||
|
virtual ~RemoteConfigTableIF() = default;
|
||||||
|
virtual bool getRemoteCfg(EntityId remoteId, RemoteEntityCfg* cfg) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace cfdp
|
||||||
|
|
||||||
|
#endif // FSFW_CFDP_HANDLER_REMOTECONFIGTABLEIF_H
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef FSFW_CFDP_USERBASE_H
|
#ifndef FSFW_CFDP_USERBASE_H
|
||||||
#define FSFW_CFDP_USERBASE_H
|
#define FSFW_CFDP_USERBASE_H
|
||||||
|
|
||||||
|
#include "fsfw/cfdp/VarLenFields.h"
|
||||||
#include "fsfw/filesystem/HasFileSystemIF.h"
|
#include "fsfw/filesystem/HasFileSystemIF.h"
|
||||||
|
|
||||||
namespace cfdp {
|
namespace cfdp {
|
||||||
@ -22,6 +23,20 @@ class UserBase {
|
|||||||
*/
|
*/
|
||||||
explicit UserBase(HasFileSystemIF& vfs);
|
explicit UserBase(HasFileSystemIF& vfs);
|
||||||
|
|
||||||
|
virtual void transactionIndication(TransactionId id) = 0;
|
||||||
|
virtual void eofSentIndication(TransactionId id) = 0;
|
||||||
|
|
||||||
|
virtual void abandonedIndication(TransactionId id, ConditionCode code, uint64_t progress) = 0;
|
||||||
|
virtual void eofRecvIndication(TransactionId id) = 0;
|
||||||
|
|
||||||
|
// TODO: Parameters
|
||||||
|
virtual void transactionFinishedIndication() = 0;
|
||||||
|
virtual void metadataRecvdIndication() = 0;
|
||||||
|
virtual void fileSegmentRecvdIndication() = 0;
|
||||||
|
virtual void reportIndication() = 0;
|
||||||
|
virtual void suspendedIndication() = 0;
|
||||||
|
virtual void resumedIndication() = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HasFileSystemIF& vfs;
|
HasFileSystemIF& vfs;
|
||||||
};
|
};
|
||||||
|
@ -26,6 +26,16 @@ struct LocalEntityCfg {
|
|||||||
FaultHandlerBase& fhBase;
|
FaultHandlerBase& fhBase;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct RemoteEntityCfg {
|
||||||
|
EntityId remoteId;
|
||||||
|
size_t maxFileSegmentLen;
|
||||||
|
bool closureRequested;
|
||||||
|
bool crcOnTransmission;
|
||||||
|
TransmissionModes defaultTransmissionMode;
|
||||||
|
ChecksumType defaultChecksum;
|
||||||
|
const uint8_t version = CFDP_VERSION_2;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace cfdp
|
} // namespace cfdp
|
||||||
|
|
||||||
#endif // FSFW_CFDP_MIB_H
|
#endif // FSFW_CFDP_MIB_H
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
target_sources(
|
target_sources(
|
||||||
${LIB_FSFW_NAME}
|
${LIB_FSFW_NAME}
|
||||||
PRIVATE PduConfig.cpp
|
PRIVATE PduConfig.cpp
|
||||||
VarLenField.cpp
|
|
||||||
HeaderCreator.cpp
|
HeaderCreator.cpp
|
||||||
HeaderReader.cpp
|
HeaderReader.cpp
|
||||||
FileDirectiveReader.cpp
|
FileDirectiveReader.cpp
|
||||||
|
@ -1,29 +1,9 @@
|
|||||||
#ifndef FSFW_SRC_FSFW_CFDP_PDU_PDUCONFIG_H_
|
#ifndef FSFW_SRC_FSFW_CFDP_PDU_PDUCONFIG_H_
|
||||||
#define FSFW_SRC_FSFW_CFDP_PDU_PDUCONFIG_H_
|
#define FSFW_SRC_FSFW_CFDP_PDU_PDUCONFIG_H_
|
||||||
|
|
||||||
#include "VarLenField.h"
|
#include "fsfw/cfdp/VarLenFields.h"
|
||||||
#include "fsfw/cfdp/definitions.h"
|
#include "fsfw/cfdp/definitions.h"
|
||||||
|
|
||||||
namespace cfdp {
|
|
||||||
|
|
||||||
struct EntityId : public VarLenField {
|
|
||||||
public:
|
|
||||||
EntityId() : VarLenField() {}
|
|
||||||
template <typename T>
|
|
||||||
explicit EntityId(UnsignedByteField<T> byteField) : VarLenField(byteField) {}
|
|
||||||
EntityId(cfdp::WidthInBytes width, size_t entityId) : VarLenField(width, entityId) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TransactionSeqNum : public VarLenField {
|
|
||||||
public:
|
|
||||||
TransactionSeqNum() : VarLenField() {}
|
|
||||||
template <typename T>
|
|
||||||
explicit TransactionSeqNum(UnsignedByteField<T> byteField) : VarLenField(byteField) {}
|
|
||||||
TransactionSeqNum(cfdp::WidthInBytes width, size_t seqNum) : VarLenField(width, seqNum) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace cfdp
|
|
||||||
|
|
||||||
class PduConfig {
|
class PduConfig {
|
||||||
public:
|
public:
|
||||||
PduConfig(cfdp::EntityId sourceId, cfdp::EntityId destId, cfdp::TransmissionModes mode,
|
PduConfig(cfdp::EntityId sourceId, cfdp::EntityId destId, cfdp::TransmissionModes mode,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user