fw: additional unsolicited Data policies
refs #2181
Change-Id: I439a77f8f48ad194459dc2391cd0ad8d0860b83e
diff --git a/daemon/fw/unsolicited-data-policy.cpp b/daemon/fw/unsolicited-data-policy.cpp
index 894cc86..79c6d77 100644
--- a/daemon/fw/unsolicited-data-policy.cpp
+++ b/daemon/fw/unsolicited-data-policy.cpp
@@ -41,6 +41,12 @@
}
UnsolicitedDataDecision
+DropAllUnsolicitedDataPolicy::decide(const Face& inFace, const Data& data) const
+{
+ return UnsolicitedDataDecision::DROP;
+}
+
+UnsolicitedDataDecision
AdmitLocalUnsolicitedDataPolicy::decide(const Face& inFace, const Data& data) const
{
if (inFace.getScope() == ndn::nfd::FACE_SCOPE_LOCAL) {
@@ -49,5 +55,20 @@
return UnsolicitedDataDecision::DROP;
}
+UnsolicitedDataDecision
+AdmitNetworkUnsolicitedDataPolicy::decide(const Face& inFace, const Data& data) const
+{
+ if (inFace.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL) {
+ return UnsolicitedDataDecision::CACHE;
+ }
+ return UnsolicitedDataDecision::DROP;
+}
+
+UnsolicitedDataDecision
+AdmitAllUnsolicitedDataPolicy::decide(const Face& inFace, const Data& data) const
+{
+ return UnsolicitedDataDecision::CACHE;
+}
+
} // namespace fw
} // namespace nfd
diff --git a/daemon/fw/unsolicited-data-policy.hpp b/daemon/fw/unsolicited-data-policy.hpp
index 54112ec..2cbad2a 100644
--- a/daemon/fw/unsolicited-data-policy.hpp
+++ b/daemon/fw/unsolicited-data-policy.hpp
@@ -56,6 +56,15 @@
decide(const Face& inFace, const Data& data) const = 0;
};
+/** \brief drops all unsolicited Data
+ */
+class DropAllUnsolicitedDataPolicy : public UnsolicitedDataPolicy
+{
+public:
+ virtual UnsolicitedDataDecision
+ decide(const Face& inFace, const Data& data) const final;
+};
+
/** \brief admits unsolicited Data from local faces
*/
class AdmitLocalUnsolicitedDataPolicy : public UnsolicitedDataPolicy
@@ -65,6 +74,24 @@
decide(const Face& inFace, const Data& data) const final;
};
+/** \brief admits unsolicited Data from non-local faces
+ */
+class AdmitNetworkUnsolicitedDataPolicy : public UnsolicitedDataPolicy
+{
+public:
+ virtual UnsolicitedDataDecision
+ decide(const Face& inFace, const Data& data) const final;
+};
+
+/** \brief admits all unsolicited Data
+ */
+class AdmitAllUnsolicitedDataPolicy : public UnsolicitedDataPolicy
+{
+public:
+ virtual UnsolicitedDataDecision
+ decide(const Face& inFace, const Data& data) const final;
+};
+
} // namespace fw
} // namespace nfd