mgmt: tables.cs_unsolicited_policy config option
This commit introduces tests/check-typeid.hpp which provides
unit testing tools to validate runtime type information.
refs #2181
Change-Id: I987c9875517001ea82878cbe2646839a03ad54f3
diff --git a/daemon/fw/unsolicited-data-policy.cpp b/daemon/fw/unsolicited-data-policy.cpp
index 79c6d77..67d4d37 100644
--- a/daemon/fw/unsolicited-data-policy.cpp
+++ b/daemon/fw/unsolicited-data-policy.cpp
@@ -70,5 +70,24 @@
return UnsolicitedDataDecision::CACHE;
}
+unique_ptr<UnsolicitedDataPolicy>
+makeUnsolicitedDataPolicy(const std::string& key)
+{
+ /// \todo register policy with a macro
+ if (key == "drop-all") {
+ return make_unique<DropAllUnsolicitedDataPolicy>();
+ }
+ if (key == "admit-local") {
+ return make_unique<AdmitLocalUnsolicitedDataPolicy>();
+ }
+ if (key == "admit-network") {
+ return make_unique<AdmitNetworkUnsolicitedDataPolicy>();
+ }
+ if (key == "admit-all") {
+ return make_unique<AdmitAllUnsolicitedDataPolicy>();
+ }
+ return nullptr;
+}
+
} // namespace fw
} // namespace nfd