apps+helper+utils: Fixes of consumer and producer apps to work with the new codebase
This commit also replaces boost::tuple with std::tuple in Batches class
Credits for the commit also to Spyros Mastorakis and Alex Afanasyev
diff --git a/apps/ndn-app.cpp b/apps/ndn-app.cpp
index 4202111..f086a7a 100644
--- a/apps/ndn-app.cpp
+++ b/apps/ndn-app.cpp
@@ -23,8 +23,8 @@
#include "ns3/assert.h"
#include "ns3/packet.h"
-#include "ns3/ndn-l3-protocol.hpp"
-#include "ns3/ndn-app-face.hpp"
+#include "model/ndn-l3-protocol.hpp"
+#include "model/ndn-app-face.hpp"
NS_LOG_COMPONENT_DEFINE("ndn.App");
@@ -82,7 +82,7 @@
if (m_face == 0)
return (uint32_t)-1;
else
- return m_face->GetId();
+ return m_face->getId();
}
void
@@ -112,13 +112,10 @@
"Ndn stack should be installed on the node " << GetNode());
// step 1. Create a face
- m_face = CreateObject<AppFace>(/*Ptr<App> (this)*/ this);
+ m_face = std::make_shared<AppFace>(this);
// step 2. Add face to the Ndn stack
- GetNode()->GetObject<L3Protocol>()->AddFace(m_face);
-
- // step 3. Enable face
- m_face->SetUp(true);
+ GetNode()->GetObject<L3Protocol>()->addFace(m_face);
}
void
@@ -129,26 +126,9 @@
if (!m_active)
return; // don't assert here, just return
- NS_ASSERT(GetNode()->GetObject<L3Protocol>() != 0);
-
m_active = false;
- // step 1. Disable face
- m_face->SetUp(false);
-
- // step 2. Remove face from Ndn stack
- GetNode()->GetObject<L3Protocol>()->RemoveFace(m_face);
-
- // step 3. Destroy face
- if (m_face->GetReferenceCount() != 1) {
- NS_LOG_ERROR("Please a bug report on https://github.com/NDN-Routing/ndnSIM/issues");
- NS_LOG_ERROR("At this point, nobody else should have referenced this face, but we have "
- << m_face->GetReferenceCount() << " references");
- }
- // NS_ASSERT_MSG (m_face->GetReferenceCount ()==2,
- // "At this point, nobody else should have referenced this face, but we have "
- // << m_face->GetReferenceCount () << " references");
- m_face = 0;
+ m_face->close();
}
} // namespace ndn
diff --git a/apps/ndn-app.hpp b/apps/ndn-app.hpp
index 7a3cfd7..15ecb19 100644
--- a/apps/ndn-app.hpp
+++ b/apps/ndn-app.hpp
@@ -98,14 +98,15 @@
protected:
bool m_active; ///< @brief Flag to indicate that application is active (set by StartApplication
/// and StopApplication)
- shared_ptr<Face> m_face; ///< @brief automatically created application face through which application
+ shared_ptr<Face>
+ m_face; ///< @brief automatically created application face through which application
/// communicates
TracedCallback<shared_ptr<const Interest>, Ptr<App>, shared_ptr<Face>>
m_receivedInterests; ///< @brief App-level trace of received Interests
- TracedCallback<shared_ptr<const Data>, Ptr<App>,
- shared_ptr<Face>> m_receivedDatas; ///< @brief App-level trace of received Data
+ TracedCallback<shared_ptr<const Data>, Ptr<App>, shared_ptr<Face>>
+ m_receivedDatas; ///< @brief App-level trace of received Data
TracedCallback<shared_ptr<const Interest>, Ptr<App>, shared_ptr<Face>>
m_transmittedInterests; ///< @brief App-level trace of transmitted Interests
diff --git a/apps/ndn-consumer-batches.cpp b/apps/ndn-consumer-batches.cpp
index b7406ae..5f82a4b 100644
--- a/apps/ndn-consumer-batches.cpp
+++ b/apps/ndn-consumer-batches.cpp
@@ -28,7 +28,7 @@
#include "ns3/uinteger.h"
#include "ns3/double.h"
-#include "../utils/batches.hpp"
+#include "utils/batches.hpp"
NS_LOG_COMPONENT_DEFINE("ndn.ConsumerBatches");
@@ -67,8 +67,8 @@
// std::cout << "Batches: " << batches << "\n";
for (Batches::const_iterator i = m_batches.begin(); i != m_batches.end(); i++) {
- Simulator::ScheduleWithContext(GetNode()->GetId(), i->get<0>(), &ConsumerBatches::AddBatch,
- this, i->get<1>());
+ Simulator::ScheduleWithContext(GetNode()->GetId(), std::get<0>(*i), &ConsumerBatches::AddBatch,
+ this, std::get<1>(*i));
}
}
@@ -96,9 +96,5 @@
}
}
-///////////////////////////////////////////////////
-// Process incoming packets //
-///////////////////////////////////////////////////
-
} // namespace ndn
} // namespace ns3
diff --git a/apps/ndn-consumer-batches.hpp b/apps/ndn-consumer-batches.hpp
index 79b5d2b..a30cc09 100644
--- a/apps/ndn-consumer-batches.hpp
+++ b/apps/ndn-consumer-batches.hpp
@@ -25,7 +25,7 @@
#include "ndn-consumer.hpp"
#include "ns3/traced-value.h"
-#include "../utils/batches.hpp"
+#include "ns3/ndnSIM/utils/batches.hpp"
namespace ns3 {
namespace ndn {
@@ -44,20 +44,6 @@
*/
ConsumerBatches();
- // From App
- // virtual void
- // OnInterest (const shared_ptr<const Interest> &interest);
-
- // virtual void
- // OnNack (const shared_ptr<const Interest> &interest);
-
- // virtual void
- // OnData (const shared_ptr<const Data> &contentObject,
- // const Ptr<const Packet> &payload);
-
- // virtual void
- // OnTimeout (uint32_t sequenceNumber);
-
private:
virtual void
StartApplication(); ///< @brief Called at time specified by Start
diff --git a/apps/ndn-consumer-cbr.cpp b/apps/ndn-consumer-cbr.cpp
index f64ae22..743cb26 100644
--- a/apps/ndn-consumer-cbr.cpp
+++ b/apps/ndn-consumer-cbr.cpp
@@ -30,7 +30,7 @@
#include "ns3/integer.h"
#include "ns3/double.h"
-#include "ns3/ndn-app-face.hpp"
+#include "model/ndn-app-face.hpp"
NS_LOG_COMPONENT_DEFINE("ndn.ConsumerCbr");
@@ -121,22 +121,5 @@
return m_randomType;
}
-///////////////////////////////////////////////////
-// Process incoming packets //
-///////////////////////////////////////////////////
-
-// void
-// Consumer::OnData (const shared_ptr<const Data> &contentObject,
-// const Ptr<const Packet> &payload)
-// {
-// Consumer::OnData (contentObject, payload); // tracing inside
-// }
-
-// void
-// Consumer::OnNack (const shared_ptr<const Interest> &interest)
-// {
-// Consumer::OnNack (interest); // tracing inside
-// }
-
} // namespace ndn
} // namespace ns3
diff --git a/apps/ndn-consumer-cbr.hpp b/apps/ndn-consumer-cbr.hpp
index 126560b..e5f2996 100644
--- a/apps/ndn-consumer-cbr.hpp
+++ b/apps/ndn-consumer-cbr.hpp
@@ -45,17 +45,6 @@
ConsumerCbr();
virtual ~ConsumerCbr();
- // From NdnApp
- // virtual void
- // OnInterest (const shared_ptr<const Interest> &interest);
-
- // virtual void
- // OnNack (const shared_ptr<const Interest> &interest);
-
- // virtual void
- // OnData (const shared_ptr<const Data> &contentObject,
- // const Ptr<const Packet> &payload);
-
protected:
/**
* \brief Constructs the Interest packet and sends it using a callback to the underlying NDN
@@ -78,19 +67,6 @@
std::string
GetRandomize() const;
-private:
- // void
- // UpdateMean ();
-
- // virtual void
- // SetPayloadSize (uint32_t payload);
-
- // void
- // SetDesiredRate (DataRate rate);
-
- // DataRate
- // GetDesiredRate () const;
-
protected:
double m_frequency; // Frequency of interest packets (in hertz)
bool m_firstTime;
diff --git a/apps/ndn-consumer-window.cpp b/apps/ndn-consumer-window.cpp
index d1531bd..f4727f3 100644
--- a/apps/ndn-consumer-window.cpp
+++ b/apps/ndn-consumer-window.cpp
@@ -195,24 +195,6 @@
}
void
-ConsumerWindow::OnNack(shared_ptr<const Interest> interest)
-{
- Consumer::OnNack(interest);
-
- if (m_inFlight > static_cast<uint32_t>(0))
- m_inFlight--;
-
- if (m_window > static_cast<uint32_t>(0)) {
- // m_window = 0.5 * m_window;//m_window - 1;
- m_window = std::max<uint32_t>(0, m_window - 1);
- }
-
- NS_LOG_DEBUG("Window: " << m_window << ", InFlight: " << m_inFlight);
-
- ScheduleNextPacket();
-}
-
-void
ConsumerWindow::OnTimeout(uint32_t sequenceNumber)
{
if (m_inFlight > static_cast<uint32_t>(0))
diff --git a/apps/ndn-consumer-window.hpp b/apps/ndn-consumer-window.hpp
index 0d0536f..b9933f8 100644
--- a/apps/ndn-consumer-window.hpp
+++ b/apps/ndn-consumer-window.hpp
@@ -49,12 +49,6 @@
ConsumerWindow();
// From App
- // virtual void
- // OnInterest (const shared_ptr<const Interest> &interest);
-
- virtual void
- OnNack(shared_ptr<const Interest> interest);
-
virtual void
OnData(shared_ptr<const Data> contentObject);
diff --git a/apps/ndn-consumer-zipf-mandelbrot.cpp b/apps/ndn-consumer-zipf-mandelbrot.cpp
index f6037e3..b5b27ee 100644
--- a/apps/ndn-consumer-zipf-mandelbrot.cpp
+++ b/apps/ndn-consumer-zipf-mandelbrot.cpp
@@ -20,9 +20,8 @@
#include "ndn-consumer-zipf-mandelbrot.hpp"
-#include "ns3/ndn-app-face.hpp"
-
-#include "ns3/ndnSIM/utils/ndn-fw-hop-count-tag.hpp"
+#include "model/ndn-app-face.hpp"
+#include "utils/ndn-fw-hop-count-tag.hpp"
#include <math.h>
@@ -170,15 +169,15 @@
//
shared_ptr<Name> nameWithSequence = make_shared<Name>(m_interestName);
- nameWithSequence->appendSeqNum(seq);
+ nameWithSequence->appendSequenceNumber(seq);
//
shared_ptr<Interest> interest = make_shared<Interest>();
- interest->SetNonce(m_rand.GetValue());
- interest->SetName(nameWithSequence);
+ interest->setNonce(m_rand.GetValue());
+ interest->setName(*nameWithSequence);
// NS_LOG_INFO ("Requesting Interest: \n" << *interest);
- NS_LOG_INFO("> Interest for " << seq << ", Total: " << m_seq << ", face: " << m_face->GetId());
+ NS_LOG_INFO("> Interest for " << seq << ", Total: " << m_seq << ", face: " << m_face->getId());
NS_LOG_DEBUG("Trying to add " << seq << " with " << Simulator::Now() << ". already "
<< m_seqTimeouts.size() << " items");
@@ -192,11 +191,8 @@
m_rtt->SentSeq(SequenceNumber32(seq), 1);
- FwHopCountTag hopCountTag;
- interest->GetPayload()->AddPacketTag(hopCountTag);
-
m_transmittedInterests(interest, this, m_face);
- m_face->ReceiveInterest(interest);
+ m_face->onReceiveInterest(*interest);
ConsumerZipfMandelbrot::ScheduleNextPacket();
}
diff --git a/apps/ndn-consumer-zipf-mandelbrot.hpp b/apps/ndn-consumer-zipf-mandelbrot.hpp
index dd03563..89be9d1 100644
--- a/apps/ndn-consumer-zipf-mandelbrot.hpp
+++ b/apps/ndn-consumer-zipf-mandelbrot.hpp
@@ -24,6 +24,8 @@
#include "ns3/ndnSIM/model/ndn-common.hpp"
#include "ndn-consumer.hpp"
+#include "ndn-consumer-cbr.hpp"
+
#include "ns3/ptr.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
@@ -32,7 +34,6 @@
#include "ns3/string.h"
#include "ns3/uinteger.h"
#include "ns3/double.h"
-#include "ndn-consumer-cbr.hpp"
#include "ns3/random-variable.h"
namespace ns3 {
diff --git a/apps/ndn-consumer.cpp b/apps/ndn-consumer.cpp
index c64bb7e..51c3c68 100644
--- a/apps/ndn-consumer.cpp
+++ b/apps/ndn-consumer.cpp
@@ -30,10 +30,11 @@
#include "ns3/integer.h"
#include "ns3/double.h"
-#include "ns3/ndn-app-face.hpp"
-#include "ns3/ndnSIM/utils/ndn-fw-hop-count-tag.hpp"
-#include "ns3/ndnSIM/utils/ndn-rtt-mean-deviation.hpp"
+#include "utils/ndn-ns3-packet-tag.hpp"
+#include "model/ndn-app-face.hpp"
+#include "utils/ndn-rtt-mean-deviation.hpp"
+#include <boost/lexical_cast.hpp>
#include <boost/ref.hpp>
NS_LOG_COMPONENT_DEFINE("ndn.Consumer");
@@ -180,24 +181,23 @@
//
shared_ptr<Name> nameWithSequence = make_shared<Name>(m_interestName);
- nameWithSequence->appendSeqNum(seq);
+ nameWithSequence->appendSequenceNumber(seq);
//
+ // shared_ptr<Interest> interest = make_shared<Interest> ();
shared_ptr<Interest> interest = make_shared<Interest>();
- interest->SetNonce(m_rand.GetValue());
- interest->SetName(nameWithSequence);
- interest->SetInterestLifetime(m_interestLifeTime);
+ interest->setNonce(m_rand.GetValue());
+ interest->setName(*nameWithSequence);
+ time::milliseconds interestLifeTime(m_interestLifeTime.GetMilliSeconds());
+ interest->setInterestLifetime(interestLifeTime);
// NS_LOG_INFO ("Requesting Interest: \n" << *interest);
NS_LOG_INFO("> Interest for " << seq);
WillSendOutInterest(seq);
- FwHopCountTag hopCountTag;
- interest->GetPayload()->AddPacketTag(hopCountTag);
-
m_transmittedInterests(interest, this, m_face);
- m_face->ReceiveInterest(interest);
+ m_face->onReceiveInterest(*interest);
ScheduleNextPacket();
}
@@ -218,13 +218,18 @@
// NS_LOG_INFO ("Received content object: " << boost::cref(*data));
- uint32_t seq = data->GetName().get(-1).toSeqNum();
+ // This could be a problem......
+ uint32_t seq = data->getName().at(-1).toSequenceNumber();
NS_LOG_INFO("< DATA for " << seq);
int hopCount = -1;
- FwHopCountTag hopCountTag;
- if (data->GetPayload()->PeekPacketTag(hopCountTag)) {
- hopCount = hopCountTag.Get();
+ auto ns3PacketTag = data->getTag<Ns3PacketTag>();
+ if (ns3PacketTag != nullptr) {
+ FwHopCountTag hopCountTag;
+ if (ns3PacketTag->getPacket()->PeekPacketTag(hopCountTag)) {
+ hopCount = hopCountTag.Get();
+ NS_LOG_DEBUG("Hop count: " << hopCount);
+ }
}
SeqTimeoutsContainer::iterator entry = m_seqLastDelay.find(seq);
@@ -234,8 +239,7 @@
entry = m_seqFullDelay.find(seq);
if (entry != m_seqFullDelay.end()) {
- m_firstInterestDataDelay(this, seq, Simulator::Now() - entry->time, m_seqRetxCounts[seq],
- hopCount);
+ m_firstInterestDataDelay(this, seq, Simulator::Now() - entry->time, m_seqRetxCounts[seq], hopCount);
}
m_seqRetxCounts.erase(seq);
@@ -249,34 +253,6 @@
}
void
-Consumer::OnNack(shared_ptr<const Interest> interest)
-{
- if (!m_active)
- return;
-
- App::OnNack(interest); // tracing inside
-
- // NS_LOG_DEBUG ("Nack type: " << interest->GetNack ());
-
- // NS_LOG_FUNCTION (interest->GetName ());
-
- // NS_LOG_INFO ("Received NACK: " << boost::cref(*interest));
- uint32_t seq = interest->GetName().get(-1).toSeqNum();
- NS_LOG_INFO("< NACK for " << seq);
- // std::cout << Simulator::Now ().ToDouble (Time::S) << "s -> " << "NACK for " << seq << "\n";
-
- // put in the queue of interests to be retransmitted
- // NS_LOG_INFO ("Before: " << m_retxSeqs.size ());
- m_retxSeqs.insert(seq);
- // NS_LOG_INFO ("After: " << m_retxSeqs.size ());
-
- m_seqTimeouts.erase(seq);
-
- m_rtt->IncreaseMultiplier(); // Double the next RTO ??
- ScheduleNextPacket();
-}
-
-void
Consumer::OnTimeout(uint32_t sequenceNumber)
{
NS_LOG_FUNCTION(sequenceNumber);
diff --git a/apps/ndn-consumer.hpp b/apps/ndn-consumer.hpp
index 25de4cd..30ccc7c 100644
--- a/apps/ndn-consumer.hpp
+++ b/apps/ndn-consumer.hpp
@@ -25,10 +25,14 @@
#include "ns3/ndnSIM/model/ndn-common.hpp"
#include "ndn-app.hpp"
+
#include "ns3/random-variable.h"
#include "ns3/nstime.h"
#include "ns3/data-rate.h"
-#include "ns3/ndn-rtt-estimator.hpp"
+
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+#include "ns3/ndnSIM/utils/ndn-rtt-estimator.hpp"
+#include "ns3/ndnSIM/utils/ndn-fw-hop-count-tag.hpp"
#include <set>
#include <map>
@@ -58,12 +62,6 @@
virtual ~Consumer(){};
// From App
- // virtual void
- // OnInterest (const shared_ptr<const Interest> &interest);
-
- virtual void
- OnNack(shared_ptr<const Interest> interest);
-
virtual void
OnData(shared_ptr<const Data> contentObject);
diff --git a/apps/ndn-producer.cpp b/apps/ndn-producer.cpp
index 60bc1dc..2d2ad9e 100644
--- a/apps/ndn-producer.cpp
+++ b/apps/ndn-producer.cpp
@@ -26,15 +26,12 @@
#include "ns3/packet.h"
#include "ns3/simulator.h"
-#include "ns3/ndn-app-face.hpp"
-#include "ns3/ndn-fib.hpp"
+#include "model/ndn-app-face.hpp"
+#include "model/ndn-ns3.hpp"
+#include "model/ndn-l3-protocol.hpp"
+#include "helper/ndn-fib-helper.hpp"
-#include "ns3/ndnSIM/utils/ndn-fw-hop-count-tag.hpp"
-
-#include <boost/ref.hpp>
-#include <boost/lambda/lambda.hpp>
-#include <boost/lambda/bind.hpp>
-namespace ll = boost::lambda;
+#include <memory>
NS_LOG_COMPONENT_DEFINE("ndn.Producer");
@@ -76,7 +73,7 @@
Producer::Producer()
{
- // NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION_NOARGS();
}
// inherited from Application base class.
@@ -84,30 +81,15 @@
Producer::StartApplication()
{
NS_LOG_FUNCTION_NOARGS();
- NS_ASSERT(GetNode()->GetObject<Fib>() != 0);
-
App::StartApplication();
- NS_LOG_DEBUG("NodeID: " << GetNode()->GetId());
-
- Ptr<Fib> fib = GetNode()->GetObject<Fib>();
-
- Ptr<fib::Entry> fibEntry = fib->Add(m_prefix, m_face, 0);
-
- fibEntry->UpdateStatus(m_face, fib::FaceMetric::NDN_FIB_GREEN);
-
- // // make face green, so it will be used primarily
- // StaticCast<fib::FibImpl> (fib)->modify (fibEntry,
- // ll::bind (&fib::Entry::UpdateStatus,
- // ll::_1, m_face,
- // fib::FaceMetric::NDN_FIB_GREEN));
+ FibHelper::AddRoute(GetNode(), m_prefix, m_face, 0);
}
void
Producer::StopApplication()
{
NS_LOG_FUNCTION_NOARGS();
- NS_ASSERT(GetNode()->GetObject<Fib>() != 0);
App::StopApplication();
}
@@ -122,28 +104,35 @@
if (!m_active)
return;
- shared_ptr<Data> data = make_shared<Data>(Create<Packet>(m_virtualPayloadSize));
- shared_ptr<Name> dataName = make_shared<Name>(interest->GetName());
- dataName->append(m_postfix);
- data->SetName(dataName);
- data->SetFreshness(m_freshness);
- data->SetTimestamp(Simulator::Now());
+ Name dataName(interest->getName());
+ // dataName.append(m_postfix);
+ // dataName.appendVersion();
- data->SetSignature(m_signature);
+ auto data = make_shared<Data>();
+ data->setName(dataName);
+ data->setFreshnessPeriod(::ndn::time::milliseconds(m_freshness.GetMilliSeconds()));
+
+ data->setContent(make_shared<::ndn::Buffer>(m_virtualPayloadSize));
+
+ Signature signature;
+ SignatureInfo signatureInfo(static_cast<::ndn::tlv::SignatureTypeValue>(255));
+
if (m_keyLocator.size() > 0) {
- data->SetKeyLocator(make_shared<Name>(m_keyLocator));
+ signatureInfo.setKeyLocator(m_keyLocator);
}
- NS_LOG_INFO("node(" << GetNode()->GetId() << ") respodning with Data: " << data->GetName());
+ signature.setInfo(signatureInfo);
+ signature.setValue(Block(&m_signature, sizeof(m_signature)));
- // Echo back FwHopCountTag if exists
- FwHopCountTag hopCountTag;
- if (interest->GetPayload()->PeekPacketTag(hopCountTag)) {
- data->GetPayload()->AddPacketTag(hopCountTag);
- }
+ data->setSignature(signature);
- m_face->ReceiveData(data);
+ NS_LOG_INFO("node(" << GetNode()->GetId() << ") respodning with Data: " << data->getName());
+
+ // to create real wire encoding
+ data->wireEncode();
+
m_transmittedDatas(data, this, m_face);
+ m_face->onReceiveData(*data);
}
} // namespace ndn
diff --git a/apps/ndn-producer.hpp b/apps/ndn-producer.hpp
index e414f4e..eb471a8 100644
--- a/apps/ndn-producer.hpp
+++ b/apps/ndn-producer.hpp
@@ -25,10 +25,10 @@
#include "ns3/ndnSIM/model/ndn-common.hpp"
#include "ndn-app.hpp"
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+#include "ns3/nstime.h"
#include "ns3/ptr.h"
-#include "ns3/ndn-name.hpp"
-#include "ns3/ndn-data.hpp"
namespace ns3 {
namespace ndn {
@@ -50,7 +50,7 @@
Producer();
// inherited from NdnApp
- void
+ virtual void
OnInterest(shared_ptr<const Interest> interest);
protected:
diff --git a/helper/ndn-app-helper.cpp b/helper/ndn-app-helper.cpp
index f1f4381..845ea96 100644
--- a/helper/ndn-app-helper.cpp
+++ b/helper/ndn-app-helper.cpp
@@ -22,7 +22,8 @@
#include "ns3/log.h"
#include "ns3/string.h"
#include "ns3/names.h"
-#include "ns3/ndn-app.hpp"
+
+#include "apps/ndn-app.hpp"
#ifdef NS3_MPI
#include "ns3/mpi-interface.h"
diff --git a/model/ndn-app-face.cpp b/model/ndn-app-face.cpp
index 9759771..fc301cb 100644
--- a/model/ndn-app-face.cpp
+++ b/model/ndn-app-face.cpp
@@ -53,6 +53,7 @@
void
AppFace::close()
{
+ this->fail("Close connection");
}
void
diff --git a/model/ndn-net-device-face.cpp b/model/ndn-net-device-face.cpp
index 03d95db..19266b5 100644
--- a/model/ndn-net-device-face.cpp
+++ b/model/ndn-net-device-face.cpp
@@ -60,13 +60,14 @@
NetDeviceFace::~NetDeviceFace()
{
NS_LOG_FUNCTION_NOARGS();
-
- m_node->UnregisterProtocolHandler(MakeCallback(&NetDeviceFace::receiveFromNetDevice, this));
+ close();
}
void
NetDeviceFace::close()
{
+ m_node->UnregisterProtocolHandler(MakeCallback(&NetDeviceFace::receiveFromNetDevice, this));
+ this->fail("Close connection");
}
Ptr<NetDevice>
diff --git a/utils/batches.cpp b/utils/batches.cpp
index 6f593e3..bce3d96 100644
--- a/utils/batches.cpp
+++ b/utils/batches.cpp
@@ -28,7 +28,7 @@
operator<<(std::ostream& os, const Batches& batch)
{
for (Batches::const_iterator i = batch.begin(); i != batch.end(); i++)
- os << i->get<0>() << " " << i->get<1>() << " ";
+ os << std::get<0>(*i) << " " << std::get<1>(*i) << " ";
return os;
}
diff --git a/utils/batches.hpp b/utils/batches.hpp
index 457210f..bd04d9a 100644
--- a/utils/batches.hpp
+++ b/utils/batches.hpp
@@ -25,7 +25,7 @@
#include "ns3/attribute-helper.h"
#include "ns3/nstime.h"
#include <list>
-#include <boost/tuple/tuple.hpp>
+#include <tuple>
namespace ns3 {
@@ -34,7 +34,7 @@
* @brief Class representing sets of (time, number) tuples with support of reading writing to
* streams
*/
-class Batches : public std::list<boost::tuple<Time, uint32_t>> {
+class Batches : public std::list<std::tuple<Time, uint32_t>> {
public:
/**
* @brief Default constructor
@@ -49,7 +49,7 @@
void
Add(const Time& when, uint32_t amount)
{
- push_back(boost::make_tuple<Time, uint32_t>(when, amount));
+ push_back(std::make_tuple(when, amount));
}
};
diff --git a/wscript b/wscript
index ea08d11..9e378fe 100644
--- a/wscript
+++ b/wscript
@@ -85,15 +85,7 @@
module.source = bld.path.ant_glob(['%s/**/*.cpp' % dir for dir in module_dirs],
excl=['model/ip-faces/*',
- 'apps/*',
- 'helper/*',
'utils/*/*'])
- module.source += bld.path.ant_glob(['helper/ndn-face-container.cpp',
- 'helper/ndn-stack-helper.cpp',
- 'helper/ndn-fib-helper.cpp',
- 'helper/ndn-strategy-choice-helper.cpp',
- 'helper/ndn-global-routing-helper.cpp',
- 'helper/ndn-link-control-helper.cpp'])
module.full_headers = [p.path_from(bld.path) for p in bld.path.ant_glob(
['%s/**/*.hpp' % dir for dir in module_dirs])]