28 #include <boost/range/adaptor/map.hpp>
29 #include <boost/range/algorithm/copy.hpp>
42 return os << static_cast<int>(d);
45 UnsolicitedDataPolicy::Registry&
46 UnsolicitedDataPolicy::getRegistry()
48 static Registry registry;
52 unique_ptr<UnsolicitedDataPolicy>
55 Registry& registry = getRegistry();
56 auto i = registry.find(policyName);
57 return i == registry.end() ? nullptr : i->second();
63 std::set<std::string> policyNames;
64 boost::copy(getRegistry() | boost::adaptors::map_keys,
65 std::inserter(policyNames, policyNames.end()));
82 if (inFace.
getScope() == ndn::nfd::FACE_SCOPE_LOCAL) {
93 if (inFace.
getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL) {
Generalization of a network interface.
ndn::nfd::FaceScope getScope() const noexcept
Returns whether the face is local or non-local for scope control purposes.
Admits all unsolicited Data.
UnsolicitedDataDecision decide(const Face &inFace, const Data &data) const final
Admits unsolicited Data from local faces.
UnsolicitedDataDecision decide(const Face &inFace, const Data &data) const final
Admits unsolicited Data from non-local faces.
UnsolicitedDataDecision decide(const Face &inFace, const Data &data) const final
Drops all unsolicited Data.
UnsolicitedDataDecision decide(const Face &inFace, const Data &data) const final
static unique_ptr< UnsolicitedDataPolicy > create(const std::string &policyName)
static std::set< std::string > getPolicyNames()
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)
#define NFD_REGISTER_UNSOLICITED_DATA_POLICY(P)
Registers an unsolicited data policy.