26 #ifndef NFD_DAEMON_FW_UNSOLICITED_DATA_POLICY_HPP
27 #define NFD_DAEMON_FW_UNSOLICITED_DATA_POLICY_HPP
69 BOOST_ASSERT(!policyName.empty());
70 auto r = getRegistry().insert_or_assign(std::string(policyName), [] {
return make_unique<P>(); });
71 BOOST_VERIFY(r.second);
77 static unique_ptr<UnsolicitedDataPolicy>
78 create(
const std::string& policyName);
82 static std::set<std::string>
86 using CreateFunc = std::function<unique_ptr<UnsolicitedDataPolicy>()>;
87 using Registry = std::map<std::string, CreateFunc>;
100 decide(
const Face& inFace,
const Data& data)
const final;
113 decide(
const Face& inFace,
const Data& data)
const final;
126 decide(
const Face& inFace,
const Data& data)
const final;
139 decide(
const Face& inFace,
const Data& data)
const final;
157 #define NFD_REGISTER_UNSOLICITED_DATA_POLICY(P) \
158 static class NfdAuto ## P ## UnsolicitedDataPolicyRegistrationClass \
161 NfdAuto ## P ## UnsolicitedDataPolicyRegistrationClass() \
163 ::nfd::fw::UnsolicitedDataPolicy::registerPolicy<P>(); \
165 } g_nfdAuto ## P ## UnsolicitedDataPolicyRegistrationVariable
Generalization of a network interface.
Admits all unsolicited Data.
UnsolicitedDataDecision decide(const Face &inFace, const Data &data) const final
static constexpr std::string_view POLICY_NAME
Admits unsolicited Data from local faces.
UnsolicitedDataDecision decide(const Face &inFace, const Data &data) const final
static constexpr std::string_view POLICY_NAME
Admits unsolicited Data from non-local faces.
UnsolicitedDataDecision decide(const Face &inFace, const Data &data) const final
static constexpr std::string_view POLICY_NAME
Drops all unsolicited Data.
static constexpr std::string_view POLICY_NAME
UnsolicitedDataDecision decide(const Face &inFace, const Data &data) const final
Determines how to process an unsolicited Data packet.
virtual UnsolicitedDataDecision decide(const Face &inFace, const Data &data) const =0
static unique_ptr< UnsolicitedDataPolicy > create(const std::string &policyName)
static std::set< std::string > getPolicyNames()
virtual ~UnsolicitedDataPolicy()=default
static void registerPolicy(std::string_view policyName=P::POLICY_NAME)
UnsolicitedDataDecision
Decision made by UnsolicitedDataPolicy.
@ CACHE
the Data should be cached in the ContentStore
@ DROP
the Data should be dropped
std::ostream & operator<<(std::ostream &os, UnsolicitedDataDecision d)