2022-08-09 18:51:44 +02:00
|
|
|
#ifndef FSFW_CFDP_HANDLER_REMOTECONFIGTABLEIF_H
|
|
|
|
#define FSFW_CFDP_HANDLER_REMOTECONFIGTABLEIF_H
|
|
|
|
|
|
|
|
#include "fsfw/cfdp/handler/mib.h"
|
|
|
|
|
|
|
|
namespace cfdp {
|
|
|
|
|
|
|
|
class RemoteConfigTableIF {
|
2022-08-09 19:00:47 +02:00
|
|
|
public:
|
2022-08-09 18:51:44 +02:00
|
|
|
virtual ~RemoteConfigTableIF() = default;
|
2022-08-17 17:09:39 +02:00
|
|
|
virtual bool getRemoteCfg(const cfdp::EntityId& remoteId, cfdp::RemoteEntityCfg** cfg) = 0;
|
2022-08-09 18:51:44 +02:00
|
|
|
};
|
|
|
|
|
2022-09-08 16:25:19 +02:00
|
|
|
/**
|
|
|
|
* Helper class for the common case that there is exactly one remote entity
|
|
|
|
*/
|
|
|
|
class OneRemoteConfigProvider : public RemoteConfigTableIF {
|
|
|
|
public:
|
|
|
|
explicit OneRemoteConfigProvider(RemoteEntityCfg cfg) : cfg(std::move(cfg)) {}
|
|
|
|
|
|
|
|
bool getRemoteCfg(const EntityId& remoteId, cfdp::RemoteEntityCfg** cfg_) override {
|
|
|
|
if (remoteId != cfg.remoteId) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
*cfg_ = &cfg;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
RemoteEntityCfg cfg;
|
|
|
|
};
|
|
|
|
|
2022-08-09 18:51:44 +02:00
|
|
|
} // namespace cfdp
|
|
|
|
|
|
|
|
#endif // FSFW_CFDP_HANDLER_REMOTECONFIGTABLEIF_H
|