helper+model: Create helper to select the replacement policy of NFD's CS
Change-Id: I10933b5c96fd95bc395a1d08642a1e07e826dc45
Refs: #3837
diff --git a/model/ndn-l3-protocol.cpp b/model/ndn-l3-protocol.cpp
index 33e0113..e8f7ccc 100644
--- a/model/ndn-l3-protocol.cpp
+++ b/model/ndn-l3-protocol.cpp
@@ -179,6 +179,7 @@
nfd::ConfigSection m_config;
Ptr<ContentStore> m_csFromNdnSim;
+ PolicyCreationCallback m_policy;
};
L3Protocol::L3Protocol()
@@ -239,6 +240,12 @@
}
void
+L3Protocol::setCsReplacementPolicy(const PolicyCreationCallback& policy)
+{
+ m_impl->m_policy = policy;
+}
+
+void
L3Protocol::initializeManagement()
{
auto& forwarder = m_impl->m_forwarder;
@@ -280,6 +287,12 @@
ConfigFile config(&ConfigFile::ignoreUnknownSection);
+ // if we use NFD's CS, we have to specify a replacement policy
+ m_impl->m_csFromNdnSim = GetObject<ContentStore>();
+ if (m_impl->m_csFromNdnSim == nullptr) {
+ forwarder->getCs().setPolicy(m_impl->m_policy());
+ }
+
TablesConfigSection tablesConfig(forwarder->getCs(),
forwarder->getPit(),
forwarder->getFib(),