helper: Fixing a recently introduced bug related to the per-face Interest limits
diff --git a/bindings/modulegen__gcc_ILP32.py b/bindings/modulegen__gcc_ILP32.py
index c7a3d98..9ca7dea 100644
--- a/bindings/modulegen__gcc_ILP32.py
+++ b/bindings/modulegen__gcc_ILP32.py
@@ -5787,10 +5787,10 @@
cls.add_method('SetFib',
'void',
[param('std::string const &', 'fibClass'), param('std::string const &', 'attr1', default_value='""'), param('std::string const &', 'value1', default_value='""'), param('std::string const &', 'attr2', default_value='""'), param('std::string const &', 'value2', default_value='""'), param('std::string const &', 'attr3', default_value='""'), param('std::string const &', 'value3', default_value='""'), param('std::string const &', 'attr4', default_value='""'), param('std::string const &', 'value4', default_value='""')])
- ## ndn-stack-helper.h (module 'ndnSIM'): void ns3::ndn::StackHelper::AddNetDeviceFaceCreateCallback(ns3::TypeId netDeviceType, ns3::Callback<ns3::Ptr<ns3::ndn::NetDeviceFace>,ns3::Ptr<ns3::Node>,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
+ ## ndn-stack-helper.h (module 'ndnSIM'): void ns3::ndn::StackHelper::AddNetDeviceFaceCreateCallback(ns3::TypeId netDeviceType, ns3::Callback<ns3::Ptr<ns3::ndn::NetDeviceFace>,ns3::Ptr<ns3::Node>,ns3::Ptr<ns3::ndn::L3Protocol>,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
cls.add_method('AddNetDeviceFaceCreateCallback',
'void',
- [param('ns3::TypeId', 'netDeviceType'), param('ns3::Callback< ns3::Ptr< ns3::ndn::NetDeviceFace >, ns3::Ptr< ns3::Node >, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
+ [param('ns3::TypeId', 'netDeviceType'), param('ns3::Callback< ns3::Ptr< ns3::ndn::NetDeviceFace >, ns3::Ptr< ns3::Node >, ns3::Ptr< ns3::ndn::L3Protocol >, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
## ndn-stack-helper.h (module 'ndnSIM'): void ns3::ndn::StackHelper::EnableLimits(bool enable=true, ns3::Time avgRtt=ns3::Seconds( ), uint32_t avgContentObject=1100, uint32_t avgInterest=40) [member function]
cls.add_method('EnableLimits',
'void',
diff --git a/bindings/modulegen__gcc_LP64.py b/bindings/modulegen__gcc_LP64.py
index c7a3d98..9ca7dea 100644
--- a/bindings/modulegen__gcc_LP64.py
+++ b/bindings/modulegen__gcc_LP64.py
@@ -5787,10 +5787,10 @@
cls.add_method('SetFib',
'void',
[param('std::string const &', 'fibClass'), param('std::string const &', 'attr1', default_value='""'), param('std::string const &', 'value1', default_value='""'), param('std::string const &', 'attr2', default_value='""'), param('std::string const &', 'value2', default_value='""'), param('std::string const &', 'attr3', default_value='""'), param('std::string const &', 'value3', default_value='""'), param('std::string const &', 'attr4', default_value='""'), param('std::string const &', 'value4', default_value='""')])
- ## ndn-stack-helper.h (module 'ndnSIM'): void ns3::ndn::StackHelper::AddNetDeviceFaceCreateCallback(ns3::TypeId netDeviceType, ns3::Callback<ns3::Ptr<ns3::ndn::NetDeviceFace>,ns3::Ptr<ns3::Node>,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
+ ## ndn-stack-helper.h (module 'ndnSIM'): void ns3::ndn::StackHelper::AddNetDeviceFaceCreateCallback(ns3::TypeId netDeviceType, ns3::Callback<ns3::Ptr<ns3::ndn::NetDeviceFace>,ns3::Ptr<ns3::Node>,ns3::Ptr<ns3::ndn::L3Protocol>,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
cls.add_method('AddNetDeviceFaceCreateCallback',
'void',
- [param('ns3::TypeId', 'netDeviceType'), param('ns3::Callback< ns3::Ptr< ns3::ndn::NetDeviceFace >, ns3::Ptr< ns3::Node >, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
+ [param('ns3::TypeId', 'netDeviceType'), param('ns3::Callback< ns3::Ptr< ns3::ndn::NetDeviceFace >, ns3::Ptr< ns3::Node >, ns3::Ptr< ns3::ndn::L3Protocol >, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')])
## ndn-stack-helper.h (module 'ndnSIM'): void ns3::ndn::StackHelper::EnableLimits(bool enable=true, ns3::Time avgRtt=ns3::Seconds( ), uint32_t avgContentObject=1100, uint32_t avgInterest=40) [member function]
cls.add_method('EnableLimits',
'void',
diff --git a/helper/ndn-stack-helper.cc b/helper/ndn-stack-helper.cc
index 04ceb46..3f284cf 100644
--- a/helper/ndn-stack-helper.cc
+++ b/helper/ndn-stack-helper.cc
@@ -255,19 +255,16 @@
if (device->GetInstanceTypeId () == item->first ||
device->GetInstanceTypeId ().IsChildOf (item->first))
{
- face = item->second (node, device);
+ face = item->second (node, ndn, device);
if (face != 0)
break;
}
}
if (face == 0)
{
- face = DefaultNetDeviceCallback (node, device);
+ face = DefaultNetDeviceCallback (node, ndn, device);
}
- ndn->AddFace (face);
- NS_LOG_LOGIC ("Node " << node->GetId () << ": added NetDeviceFace as face #" << *face);
-
if (m_needSetDefaultRoutes)
{
// default route with lowest priority possible
@@ -289,20 +286,28 @@
Ptr<NetDeviceFace>
-StackHelper::DefaultNetDeviceCallback (Ptr<Node> node, Ptr<NetDevice> netDevice) const
+StackHelper::DefaultNetDeviceCallback (Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> netDevice) const
{
NS_LOG_DEBUG ("Creating default NetDeviceFace on node " << node->GetId ());
- return CreateObject<NetDeviceFace> (node, netDevice);
+ Ptr<NetDeviceFace> face = CreateObject<NetDeviceFace> (node, netDevice);
+
+ ndn->AddFace (face);
+ NS_LOG_LOGIC ("Node " << node->GetId () << ": added NetDeviceFace as face #" << *face);
+
+ return face;
}
Ptr<NetDeviceFace>
-StackHelper::PointToPointNetDeviceCallback (Ptr<Node> node, Ptr<NetDevice> device) const
+StackHelper::PointToPointNetDeviceCallback (Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> device) const
{
NS_LOG_DEBUG ("Creating point-to-point NetDeviceFace on node " << node->GetId ());
Ptr<NetDeviceFace> face = CreateObject<NetDeviceFace> (node, device);
+ ndn->AddFace (face);
+ NS_LOG_LOGIC ("Node " << node->GetId () << ": added NetDeviceFace as face #" << *face);
+
if (m_limitsEnabled)
{
Ptr<Limits> limits = face->GetObject<Limits> ();
diff --git a/helper/ndn-stack-helper.h b/helper/ndn-stack-helper.h
index 25764d9..4b26040 100644
--- a/helper/ndn-stack-helper.h
+++ b/helper/ndn-stack-helper.h
@@ -35,6 +35,8 @@
class FaceContainer;
class Face;
+class NetDeviceFace;
+class L3Protocol;
/**
* \ingroup ndn
@@ -128,7 +130,7 @@
const std::string &attr3 = "", const std::string &value3 = "",
const std::string &attr4 = "", const std::string &value4 = "");
- typedef Callback< Ptr<NetDeviceFace>, Ptr<Node>, Ptr<NetDevice> > NetDeviceFaceCreateCallback;
+ typedef Callback< Ptr<NetDeviceFace>, Ptr<Node>, Ptr<L3Protocol>, Ptr<NetDevice> > NetDeviceFaceCreateCallback;
/**
* @brief Add callback to create and configure instance of the face, based on supplied Ptr<Node> and Ptr<NetDevice>
@@ -269,10 +271,10 @@
private:
Ptr<NetDeviceFace>
- DefaultNetDeviceCallback (Ptr<Node> node, Ptr<NetDevice> netDevice) const;
+ DefaultNetDeviceCallback (Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> netDevice) const;
Ptr<NetDeviceFace>
- PointToPointNetDeviceCallback (Ptr<Node> node, Ptr<NetDevice> netDevice) const;
+ PointToPointNetDeviceCallback (Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> netDevice) const;
private:
StackHelper (const StackHelper &);