Adding several corrections. Most important is fixing regression in ccnb-parser-block.cc
diff --git a/apps/ccnx-consumer.cc b/apps/ccnx-consumer.cc
index 8352212..81d44b8 100644
--- a/apps/ccnx-consumer.cc
+++ b/apps/ccnx-consumer.cc
@@ -39,7 +39,7 @@
.SetParent<Application> ()
.AddConstructor<CcnxConsumer> ()
.AddAttribute ("OffTime", "Time interval between packets",
- TimeValue (Seconds (0.001)),
+ TimeValue (Seconds (0.1)),
MakeTimeAccessor (&CcnxConsumer::m_offTime),
MakeTimeChecker ())
.AddAttribute ("InterestName","CcnxName of the Interest (use CcnxNameComponents)",
@@ -178,7 +178,8 @@
Ptr<Packet> packet = Create<Packet> ();
packet->AddHeader (interestHeader);
-
+
+ NS_LOG_INFO ("Packet: " << packet);
m_face->ReceiveFromApplication (packet);
m_interestsTrace (m_face,packet);
diff --git a/examples/annotated-topology-read-example.cc b/examples/annotated-topology-read-example.cc
index 7aff4fe..000b578 100644
--- a/examples/annotated-topology-read-example.cc
+++ b/examples/annotated-topology-read-example.cc
@@ -30,7 +30,6 @@
#include "ns3/ipv4-list-routing-helper.h"
#include "ns3/annotated-topology-reader.h"
#include <list>
-#include "ns3/visualizer-module.h"
#include "ns3/ccnx.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/NDNabstraction-module.h"
@@ -42,8 +41,6 @@
int main (int argc, char *argv[])
{
- GlobalValue::Bind ("SimulatorImplementationType", StringValue
- ("ns3::VisualSimulatorImpl"));
Packet::EnableChecking();
Packet::EnablePrinting();
string input ("/Users/iliamo/ns3-abstract-ndn/ns-3.11/src/NDNabstraction/examples/simpletopology.txt");
diff --git a/examples/ccnx-grid.cc b/examples/ccnx-grid.cc
index da76a6c..acf4a5f 100644
--- a/examples/ccnx-grid.cc
+++ b/examples/ccnx-grid.cc
@@ -46,6 +46,7 @@
{
Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("1Mbps"));
Config::SetDefault ("ns3::PointToPointChannel::Delay", StringValue ("1ms"));
+ Config::SetDefault ("ns3::CcnxConsumer::OffTime", StringValue ("100ms"));
Packet::EnableChecking();
Packet::EnablePrinting();
@@ -81,8 +82,8 @@
consumerNodes.Add (grid.GetNode (0,0));
// Populate FIB based on IPv4 global routing controller
- ccnxHelper.InstallFakeGlobalRoutes ();
- ccnxHelper.InstallRouteTo (producer);
+ // ccnxHelper.InstallFakeGlobalRoutes ();
+ // ccnxHelper.InstallRouteTo (producer);
NS_LOG_INFO ("Installing Applications");
std::ostringstream prefix;
@@ -91,14 +92,14 @@
CcnxConsumerHelper consumerHelper (prefix.str ());
ApplicationContainer consumers = consumerHelper.Install (consumerNodes);
- consumers.Start (Seconds (0));
- consumers.Stop (Seconds (2000));
+ consumers.Start (Seconds (0.0));
+ consumers.Stop (Seconds (20.0));
CcnxProducerHelper producerHelper (prefix.str (),120);
ApplicationContainer producers = producerHelper.Install (producer);
producers.Start(Seconds(0.0));
- producers.Stop(Seconds(2000.0));
+ producers.Stop(Seconds(20.0));
NS_LOG_INFO ("Outputing FIBs into [fibs.log]");
Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> ("fibs.log", std::ios::out);
@@ -118,7 +119,7 @@
// NS_LOG_INFO ("FIB dump:\n" << *c.Get(0)->GetObject<CcnxFib> ());
// NS_LOG_INFO ("FIB dump:\n" << *c.Get(1)->GetObject<CcnxFib> ());
- Simulator::Stop (Seconds (2000));
+ Simulator::Stop (Seconds (100));
NS_LOG_INFO ("Run Simulation.");
Simulator::Run ();
diff --git a/examples/syntactic-topology-ndnabstraction.cc b/examples/syntactic-topology-ndnabstraction.cc
index 61f5c49..5ca03e1 100644
--- a/examples/syntactic-topology-ndnabstraction.cc
+++ b/examples/syntactic-topology-ndnabstraction.cc
@@ -28,7 +28,6 @@
#include <iostream>
#include <sstream>
-#include "ns3/visualizer-module.h"
#include "ns3/ccnx.h"
@@ -39,9 +38,6 @@
int
main (int argc, char *argv[])
{
- GlobalValue::Bind ("SimulatorImplementationType", StringValue
- ("ns3::VisualSimulatorImpl"));
-
// Set up some default values for the simulation. Use the
Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210));
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-block.cc b/helper/ccnb-parser/syntax-tree/ccnb-parser-block.cc
index d0f795f..74807d3 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-block.cc
+++ b/helper/ccnb-parser/syntax-tree/ccnb-parser-block.cc
@@ -65,19 +65,19 @@
switch (byte & CCN_TT_MASK)
{
case CCN_BLOB:
- return Ptr<Blob> (new Blob(start, value));
+ return Ptr<Blob> (new Blob(start, value), false);
case CCN_UDATA:
- return Ptr<Udata> (new Udata(start, value));
+ return Ptr<Udata> (new Udata(start, value), false);
case CCN_TAG:
- return Ptr<Tag> (new Tag(start, value));
+ return Ptr<Tag> (new Tag(start, value), false);
case CCN_ATTR:
- return Ptr<Attr> (new Attr(start, value));
+ return Ptr<Attr> (new Attr(start, value), false);
case CCN_DTAG:
- return Ptr<Dtag> (new Dtag(start, value));
+ return Ptr<Dtag> (new Dtag(start, value), false);
case CCN_DATTR:
- return Ptr<Dattr> (new Dattr(start, value));
+ return Ptr<Dattr> (new Dattr(start, value), false);
case CCN_EXT:
- return Ptr<Ext> (new Ext(start, value));
+ return Ptr<Ext> (new Ext(start, value), false);
default:
throw CcnbDecodingException ();
}
diff --git a/helper/ccnx-decoding-helper.cc b/helper/ccnx-decoding-helper.cc
index 52061ab..54f636b 100644
--- a/helper/ccnx-decoding-helper.cc
+++ b/helper/ccnx-decoding-helper.cc
@@ -40,6 +40,8 @@
Ptr<CcnbParser::Block> root = CcnbParser::Block::ParseBlock (i);
root->accept (interestVisitor, &interest);
+ root = 0;
+
return i.GetDistanceFrom (start);
}
diff --git a/model/ccnx-l3-protocol.cc b/model/ccnx-l3-protocol.cc
index 6a4fae6..823ddbe 100644
--- a/model/ccnx-l3-protocol.cc
+++ b/model/ccnx-l3-protocol.cc
@@ -131,6 +131,12 @@
}
m_faces.clear ();
m_node = 0;
+
+ // Force delete on objects
+ m_rit = 0;
+ m_pit = 0;
+ m_contentStore = 0;
+
// m_forwardingStrategy = 0;
Object::DoDispose ();
}
@@ -497,14 +503,14 @@
CcnxPitEntryIncomingFaceContainer::type::iterator inFace = pitEntry->m_incoming.find (incomingFace);
CcnxPitEntryOutgoingFaceContainer::type::iterator outFace = pitEntry->m_outgoing.find (incomingFace);
- NS_LOG_INFO("Before (pitEntry != m_pit->end()) && (pitEntry->m_timerExpired == false)");
+ NS_LOG_INFO("Before (pitEntry != m_pit->end()) && (pitEntry->m_timerExpired == false)");
if ((pitEntry != m_pit->end()) && (pitEntry->m_timerExpired == false))
{
NS_LOG_INFO("Entering (pitEntry != m_pit->end()) && (pitEntry->m_timerExpired == false)");
- if(inFace->m_face == NULL)
+ if(inFace->m_face == 0)
NS_LOG_INFO("in face is null");
- if(outFace->m_face == NULL)
+ if(outFace->m_face == 0)
NS_LOG_INFO("outface is null");
if(outFace == pitEntry->m_outgoing.end())
NS_LOG_INFO("OUTFACE = END");
diff --git a/model/ccnx-pit.cc b/model/ccnx-pit.cc
index 7e57b19..86484ef 100644
--- a/model/ccnx-pit.cc
+++ b/model/ccnx-pit.cc
@@ -28,28 +28,10 @@
namespace ns3 {
-// NS_OBJECT_ENSURE_REGISTERED (CcnxPit);
+NS_OBJECT_ENSURE_REGISTERED (CcnxPit);
using namespace __ccnx_private;
-// size_t
-// PitEntry::numberOfPromisingInterests(e_pi ) const
-// {
-// size_t count = 0;
-
-// BOOST_FOREACH (const CcnxPitOutgoingInterest &interest, m_outgoingInterests)
-// {
-// }
-// for( PitOutgoingConstIterator i = outgoingInterests.begin();
-// i!=outgoingInterests.end();
-// i++ )
-// {
-// if( !i->waitingInVain ) count++;
-// }
-
-// return count;
-// }
-
TypeId
CcnxPit::GetTypeId ()
{
@@ -71,6 +53,14 @@
{
}
+CcnxPit::~CcnxPit ()
+{
+ if (m_cleanupEvent.IsRunning ())
+ m_cleanupEvent.Cancel (); // cancel any scheduled cleanup events
+
+ clear ();
+}
+
void
CcnxPit::SetCleanupTimeout (const Time &timeout)
{
diff --git a/model/ccnx-pit.h b/model/ccnx-pit.h
index ed724fe..fb437a9 100644
--- a/model/ccnx-pit.h
+++ b/model/ccnx-pit.h
@@ -117,6 +117,11 @@
*/
CcnxPit ();
+ /**
+ * \brief Destructor
+ */
+ virtual ~CcnxPit ();
+
/*CcnxPitEntryContainer::type::iterator
Add (const CcnxInterestHeader &header, CcnxFibEntryContainer::type::iterator fibEntry, Ptr<CcnxFace> face);*/
@@ -191,7 +196,7 @@
EventId m_cleanupEvent; ///< \brief Cleanup event
Ptr<CcnxFib> m_fib; ///< \brief Link to FIB table
- PitBucket m_bucketsPerFace; ///< \brief pending interface counter per face
+ PitBucket m_bucketsPerFace; ///< \brief pending interface counter per face
};
///////////////////////////////////////////////////////////////////////////////
diff --git a/model/ccnx-rit.cc b/model/ccnx-rit.cc
index 6a7e556..3536ab5 100644
--- a/model/ccnx-rit.cc
+++ b/model/ccnx-rit.cc
@@ -75,7 +75,15 @@
{
}
-CcnxRit::~CcnxRit( ) { }
+CcnxRit::~CcnxRit( )
+{
+ NS_LOG_FUNCTION_NOARGS ();
+
+ if (m_cleanupEvent.IsRunning ())
+ m_cleanupEvent.Cancel (); // cancel any scheduled cleanup events
+
+ clear ();
+}
void
CcnxRit::SetRitTimeout (const Time &timeout)
@@ -111,7 +119,7 @@
CcnxRit::WasRecentlySatisfied (const CcnxInterestHeader &header)
{
NS_LOG_FUNCTION_NOARGS ();
- std::pair<CcnxRitByNonce::type::iterator,CcnxRitByNonce::type::iterator>
+ std::pair<CcnxRitByNonce::type::iterator,CcnxRitByNonce::type::iterator>
entries = get<nonce> ().equal_range (header.GetNonce ());
if (entries.first == end ())