examples+helper+model: Allowing to disable NFD managers
Change-Id: I471023fc23ffabbe14d9668426b4c1b03e4932ab
Refs: #3328
diff --git a/helper/ndn-scenario-helper.cpp b/helper/ndn-scenario-helper.cpp
index 1d441d6..0c661da 100644
--- a/helper/ndn-scenario-helper.cpp
+++ b/helper/ndn-scenario-helper.cpp
@@ -62,6 +62,30 @@
}
void
+ScenarioHelper::disableRibManager()
+{
+ ndnHelper.disableRibManager();
+}
+
+void
+ScenarioHelper::disableFaceManager()
+{
+ ndnHelper.disableFaceManager();
+}
+
+void
+ScenarioHelper::disableStrategyChoiceManager()
+{
+ ndnHelper.disableStrategyChoiceManager();
+}
+
+void
+ScenarioHelper::disableStatusServer()
+{
+ ndnHelper.disableStatusServer();
+}
+
+void
ScenarioHelper::addRoutes(std::initializer_list<ScenarioHelper::RouteInfo> routes)
{
for (auto&& route : routes) {
diff --git a/helper/ndn-scenario-helper.hpp b/helper/ndn-scenario-helper.hpp
index 0085f58..5131daa 100644
--- a/helper/ndn-scenario-helper.hpp
+++ b/helper/ndn-scenario-helper.hpp
@@ -17,6 +17,9 @@
* ndnSIM, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
+#ifndef NDNSIM_HELPER_NDN_SCENARIO_HELPER_HPP
+#define NDNSIM_HELPER_NDN_SCENARIO_HELPER_HPP
+
#include "ndn-stack-helper.hpp"
#include "ns3/net-device.h"
@@ -154,6 +157,30 @@
shared_ptr<Face>
getFace(const std::string& node1, const std::string& node2);
+ /**
+ * \brief Disable RIB Manager
+ */
+ void
+ disableRibManager();
+
+ /**
+ * \brief Disable Face Manager
+ */
+ void
+ disableFaceManager();
+
+ /**
+ * \brief Disable Strategy Choice Manager
+ */
+ void
+ disableStrategyChoiceManager();
+
+ /**
+ * \brief Disable Status Server
+ */
+ void
+ disableStatusServer();
+
private:
Ptr<Node>
getOrCreateNode(const std::string& nodeName);
@@ -167,3 +194,5 @@
} // namespace ndn
} // namespace ns3
+
+#endif // NDNSIM_HELPER_NDN_SCENARIO_HELPER_HPP
diff --git a/helper/ndn-stack-helper.cpp b/helper/ndn-stack-helper.cpp
index b0f138c..7211639 100644
--- a/helper/ndn-stack-helper.cpp
+++ b/helper/ndn-stack-helper.cpp
@@ -42,6 +42,10 @@
StackHelper::StackHelper()
: m_needSetDefaultRoutes(false)
, m_maxCsSize(100)
+ , m_isRibManagerDisabled(false)
+ , m_isFaceManagerDisabled(false)
+ , m_isStatusServerDisabled(false)
+ , m_isStrategyChoiceManagerDisabled(false)
{
setCustomNdnCxxClocks();
@@ -149,6 +153,23 @@
}
Ptr<L3Protocol> ndn = m_ndnFactory.Create<L3Protocol>();
+
+ if (m_isRibManagerDisabled) {
+ ndn->getConfig().put("ndnSIM.disable_rib_manager", true);
+ }
+
+ if (m_isFaceManagerDisabled) {
+ ndn->getConfig().put("ndnSIM.disable_face_manager", true);
+ }
+
+ if (m_isStatusServerDisabled) {
+ ndn->getConfig().put("ndnSIM.disable_status_server", true);
+ }
+
+ if (m_isStrategyChoiceManagerDisabled) {
+ ndn->getConfig().put("ndnSIM.disable_strategy_choice_manager", true);
+ }
+
ndn->getConfig().put("tables.cs_max_packets", (m_maxCsSize == 0) ? 1 : m_maxCsSize);
// Create and aggregate content store if NFD's contest store has been disabled
@@ -303,5 +324,29 @@
return face;
}
+void
+StackHelper::disableRibManager()
+{
+ m_isRibManagerDisabled = true;
+}
+
+void
+StackHelper::disableFaceManager()
+{
+ m_isFaceManagerDisabled = true;
+}
+
+void
+StackHelper::disableStrategyChoiceManager()
+{
+ m_isStrategyChoiceManagerDisabled = true;
+}
+
+void
+StackHelper::disableStatusServer()
+{
+ m_isStatusServerDisabled = true;
+}
+
} // namespace ndn
} // namespace ns3
diff --git a/helper/ndn-stack-helper.hpp b/helper/ndn-stack-helper.hpp
index 472f0ab..4b6f38b 100644
--- a/helper/ndn-stack-helper.hpp
+++ b/helper/ndn-stack-helper.hpp
@@ -212,6 +212,30 @@
void
UpdateAll();
+ /**
+ *\brief Disable the RIB manager of NFD
+ */
+ void
+ disableRibManager();
+
+ /**
+ * \brief Disable Face Manager
+ */
+ void
+ disableFaceManager();
+
+ /**
+ * \brief Disable Strategy Choice Manager
+ */
+ void
+ disableStrategyChoiceManager();
+
+ /**
+ * \brief Disable Status Server
+ */
+ void
+ disableStatusServer();
+
private:
shared_ptr<NetDeviceFace>
DefaultNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> netDevice) const;
@@ -222,6 +246,11 @@
shared_ptr<NetDeviceFace>
createAndRegisterFace(Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> device) const;
+ bool m_isRibManagerDisabled;
+ bool m_isFaceManagerDisabled;
+ bool m_isStatusServerDisabled;
+ bool m_isStrategyChoiceManagerDisabled;
+
public:
void
setCustomNdnCxxClocks();