helper+model: Fix helpers to work with NFD/ndn-cxx 0.4+
Change-Id: I7ed2893acbda1458383603c0e3c154d3e841405e
Refs: #3560
diff --git a/helper/boost-graph-ndn-global-routing-helper.hpp b/helper/boost-graph-ndn-global-routing-helper.hpp
index fe160f3..49b724e 100644
--- a/helper/boost-graph-ndn-global-routing-helper.hpp
+++ b/helper/boost-graph-ndn-global-routing-helper.hpp
@@ -28,7 +28,6 @@
#include <boost/graph/properties.hpp>
#include <boost/ref.hpp>
-#include "ns3/ndnSIM/model/ndn-face.hpp"
#include "ns3/ndnSIM/model/ndn-global-router.hpp"
#include "ns3/node-list.h"
diff --git a/helper/ndn-fib-helper.cpp b/helper/ndn-fib-helper.cpp
index 95c0309..a74ddb2 100644
--- a/helper/ndn-fib-helper.cpp
+++ b/helper/ndn-fib-helper.cpp
@@ -42,7 +42,6 @@
#include "ns3/ndnSIM/model/ndn-l3-protocol.hpp"
#include "ns3/ndnSIM/helper/ndn-stack-helper.hpp"
-
namespace ns3 {
namespace ndn {
@@ -62,8 +61,7 @@
StackHelper::getKeyChain().sign(*command);
Ptr<L3Protocol> l3protocol = node->GetObject<L3Protocol>();
- shared_ptr<nfd::FibManager> fibManager = l3protocol->getFibManager();
- fibManager->onFibRequest(*command);
+ l3protocol->injectInterest(*command);
}
void
@@ -79,9 +77,8 @@
shared_ptr<Interest> command(make_shared<Interest>(commandName));
StackHelper::getKeyChain().sign(*command);
- Ptr<L3Protocol> L3protocol = node->GetObject<L3Protocol>();
- shared_ptr<nfd::FibManager> fibManager = L3protocol->getFibManager();
- fibManager->onFibRequest(*command);
+ Ptr<L3Protocol> l3protocol = node->GetObject<L3Protocol>();
+ l3protocol->injectInterest(*command);
}
void
diff --git a/helper/ndn-global-routing-helper.cpp b/helper/ndn-global-routing-helper.cpp
index 8d42633..aca25d5 100644
--- a/helper/ndn-global-routing-helper.cpp
+++ b/helper/ndn-global-routing-helper.cpp
@@ -27,7 +27,7 @@
#include "model/ndn-l3-protocol.hpp"
#include "helper/ndn-fib-helper.hpp"
-#include "model/ndn-net-device-face.hpp"
+#include "model/ndn-net-device-link-service.hpp"
#include "model/ndn-global-router.hpp"
#include "daemon/table/fib.hpp"
@@ -80,14 +80,14 @@
gr = CreateObject<GlobalRouter>();
node->AggregateObject(gr);
- for (auto& i : ndn->getForwarder()->getFaceTable()) {
- shared_ptr<NetDeviceFace> face = std::dynamic_pointer_cast<NetDeviceFace>(i);
- if (face == 0) {
+ for (auto& face : ndn->getForwarder()->getFaceTable()) {
+ auto linkService = dynamic_cast<NetDeviceLinkService*>(face->getLinkService());
+ if (linkService == nullptr) {
NS_LOG_DEBUG("Skipping non-netdevice face");
continue;
}
- Ptr<NetDevice> nd = face->GetNetDevice();
+ Ptr<NetDevice> nd = linkService->GetNetDevice();
if (nd == 0) {
NS_LOG_DEBUG("Not a NetDevice associated with NetDeviceFace");
continue;
@@ -325,9 +325,9 @@
}
for (auto& faceId : faceIds) {
- shared_ptr<Face> k = l3->getForwarder()->getFaceTable().get(faceId);
- shared_ptr<NetDeviceFace> face = std::dynamic_pointer_cast<NetDeviceFace>(k);
- if (face == 0) {
+ shared_ptr<Face> face = l3->getForwarder()->getFaceTable().get(faceId);
+ auto linkService = dynamic_cast<NetDeviceLinkService*>(face->getLinkService());
+ if (linkService == nullptr) {
NS_LOG_DEBUG("Skipping non-netdevice face");
continue;
}
diff --git a/helper/ndn-link-control-helper.cpp b/helper/ndn-link-control-helper.cpp
index 09137bf..70a3171 100644
--- a/helper/ndn-link-control-helper.cpp
+++ b/helper/ndn-link-control-helper.cpp
@@ -32,7 +32,8 @@
#include "ns3/pointer.h"
#include "model/ndn-l3-protocol.hpp"
-#include "model/ndn-net-device-face.hpp"
+#include "model/ndn-net-device-link-service.hpp"
+#include "NFD/daemon/face/face.hpp"
#include "fw/forwarder.hpp"
@@ -56,11 +57,11 @@
// iterate over all faces to find the right one
for (const auto& face : ndn1->getForwarder()->getFaceTable()) {
- shared_ptr<ndn::NetDeviceFace> ndFace = std::dynamic_pointer_cast<NetDeviceFace>(face);
- if (ndFace == nullptr)
+ auto linkService = dynamic_cast<NetDeviceLinkService*>(face->getLinkService());
+ if (linkService == nullptr)
continue;
- Ptr<PointToPointNetDevice> nd1 = ndFace->GetNetDevice()->GetObject<PointToPointNetDevice>();
+ Ptr<PointToPointNetDevice> nd1 = linkService->GetNetDevice()->GetObject<PointToPointNetDevice>();
if (nd1 == nullptr)
continue;
diff --git a/helper/ndn-scenario-helper.cpp b/helper/ndn-scenario-helper.cpp
index 1be86e6..2539af1 100644
--- a/helper/ndn-scenario-helper.cpp
+++ b/helper/ndn-scenario-helper.cpp
@@ -67,11 +67,11 @@
ndnHelper.disableRibManager();
}
-void
-ScenarioHelper::disableFaceManager()
-{
- ndnHelper.disableFaceManager();
-}
+// void
+// ScenarioHelper::disableFaceManager()
+// {
+// ndnHelper.disableFaceManager();
+// }
void
ScenarioHelper::disableStrategyChoiceManager()
@@ -80,9 +80,9 @@
}
void
-ScenarioHelper::disableStatusServer()
+ScenarioHelper::disableForwarderStatusManager()
{
- ndnHelper.disableStatusServer();
+ ndnHelper.disableForwarderStatusManager();
}
void
diff --git a/helper/ndn-scenario-helper.hpp b/helper/ndn-scenario-helper.hpp
index 52d19b7..b939095 100644
--- a/helper/ndn-scenario-helper.hpp
+++ b/helper/ndn-scenario-helper.hpp
@@ -163,11 +163,12 @@
void
disableRibManager();
- /**
- * \brief Disable Face Manager
- */
- void
- disableFaceManager();
+ // Cannot be disabled for now
+ // /**
+ // * \brief Disable Face Manager
+ // */
+ // void
+ // disableFaceManager();
/**
* \brief Disable Strategy Choice Manager
@@ -176,10 +177,10 @@
disableStrategyChoiceManager();
/**
- * \brief Disable Status Server
+ * \brief Disable Forwarder Status Manager
*/
void
- disableStatusServer();
+ disableForwarderStatusManager();
/**
* \brief Get NDN stack helper, e.g., to adjust its parameters
diff --git a/helper/ndn-stack-helper.cpp b/helper/ndn-stack-helper.cpp
index 06dd368..4037cf8 100644
--- a/helper/ndn-stack-helper.cpp
+++ b/helper/ndn-stack-helper.cpp
@@ -330,9 +330,7 @@
if (m_needSetDefaultRoutes) {
// default route with lowest priority possible
-
- // TODO: Restore when FibHelper is available
- // FibHelper::AddRoute(node, "/", face, std::numeric_limits<int32_t>::max());
+ FibHelper::AddRoute(node, "/", face, std::numeric_limits<int32_t>::max());
}
return face;
}
diff --git a/helper/ndn-strategy-choice-helper.cpp b/helper/ndn-strategy-choice-helper.cpp
index 53ba544..6958fce 100644
--- a/helper/ndn-strategy-choice-helper.cpp
+++ b/helper/ndn-strategy-choice-helper.cpp
@@ -40,10 +40,9 @@
shared_ptr<Interest> command(make_shared<Interest>(commandName));
StackHelper::getKeyChain().sign(*command);
- Ptr<L3Protocol> L3protocol = node->GetObject<L3Protocol>();
- auto strategyChoiceManager = L3protocol->getStrategyChoiceManager();
- strategyChoiceManager->onStrategyChoiceRequest(*command);
- NS_LOG_DEBUG("Forwarding strategy installed in node " << node->GetId());
+
+ Ptr<L3Protocol> l3protocol = node->GetObject<L3Protocol>();
+ l3protocol->injectInterest(*command);
}
void