First step of refactoring code (ccnx prefix => ndn prefix)
diff --git a/test/ndnSIM-pit.cc b/test/ndnSIM-pit.cc
index f039c79..8593baf 100644
--- a/test/ndnSIM-pit.cc
+++ b/test/ndnSIM-pit.cc
@@ -24,22 +24,22 @@
#include <boost/lexical_cast.hpp>
-NS_LOG_COMPONENT_DEFINE ("CcnxPitTest");
+NS_LOG_COMPONENT_DEFINE ("NdnPitTest");
namespace ns3
{
-class Client : public CcnxApp
+class Client : public NdnApp
{
protected:
void
StartApplication ()
{
- CcnxApp::StartApplication ();
+ NdnApp::StartApplication ();
// add default route
- Ptr<CcnxFibEntry> fibEntry = GetNode ()->GetObject<CcnxFib> ()->Add (CcnxNameComponents ("/"), m_face, 0);
- fibEntry->UpdateStatus (m_face, CcnxFibFaceMetric::NDN_FIB_GREEN);
+ Ptr<NdnFibEntry> fibEntry = GetNode ()->GetObject<NdnFib> ()->Add (NdnNameComponents ("/"), m_face, 0);
+ fibEntry->UpdateStatus (m_face, NdnFibFaceMetric::NDN_FIB_GREEN);
Simulator::Schedule (Seconds (0.1), &Client::SendPacket, this, std::string("/1"), 1);
Simulator::Schedule (Seconds (0.2), &Client::SendPacket, this, std::string("/2"), 1);
@@ -50,7 +50,7 @@
void
StopApplication ()
{
- CcnxApp::StopApplication ();
+ NdnApp::StopApplication ();
}
private:
@@ -58,8 +58,8 @@
SendPacket (const std::string &prefix, uint32_t nonce)
{
Ptr<Packet> pkt = Create<Packet> (0);
- CcnxInterestHeader i;
- i.SetName (Create<CcnxNameComponents> (prefix));
+ NdnInterestHeader i;
+ i.SetName (Create<NdnNameComponents> (prefix));
i.SetNonce (nonce);
i.SetInterestLifetime (Seconds (0.5));
@@ -69,38 +69,38 @@
};
void
-PitTest::Test (Ptr<CcnxFib> fib)
+PitTest::Test (Ptr<NdnFib> fib)
{
NS_TEST_ASSERT_MSG_EQ (fib->GetSize (), 1, "There should be only one entry");
- Ptr<const CcnxFibEntry> fibEntry = fib->Begin ();
- NS_TEST_ASSERT_MSG_EQ (fibEntry->GetPrefix (), CcnxNameComponents ("/"), "prefix should be /");
+ Ptr<const NdnFibEntry> fibEntry = fib->Begin ();
+ NS_TEST_ASSERT_MSG_EQ (fibEntry->GetPrefix (), NdnNameComponents ("/"), "prefix should be /");
}
void
-PitTest::Check0 (Ptr<CcnxPit> pit)
+PitTest::Check0 (Ptr<NdnPit> pit)
{
- // NS_LOG_DEBUG (*GetNode ()->GetObject<CcnxPit> ());
+ // NS_LOG_DEBUG (*GetNode ()->GetObject<NdnPit> ());
NS_TEST_ASSERT_MSG_EQ (pit->GetSize (), 0, "There should 0 entries in PIT");
}
void
-PitTest::Check1 (Ptr<CcnxPit> pit)
+PitTest::Check1 (Ptr<NdnPit> pit)
{
NS_TEST_ASSERT_MSG_EQ (pit->GetSize (), 1, "There should 1 entry in PIT");
}
void
-PitTest::Check2 (Ptr<CcnxPit> pit)
+PitTest::Check2 (Ptr<NdnPit> pit)
{
- // NS_LOG_DEBUG (*GetNode ()->GetObject<CcnxPit> ());
+ // NS_LOG_DEBUG (*GetNode ()->GetObject<NdnPit> ());
NS_TEST_ASSERT_MSG_EQ (pit->GetSize (), 2, "There should 2 entries in PIT");
}
void
-PitTest::Check3 (Ptr<CcnxPit> pit)
+PitTest::Check3 (Ptr<NdnPit> pit)
{
- // NS_LOG_DEBUG (*GetNode ()->GetObject<CcnxPit> ());
+ // NS_LOG_DEBUG (*GetNode ()->GetObject<NdnPit> ());
NS_TEST_ASSERT_MSG_EQ (pit->GetSize (), 3, "There should 3 entries in PIT");
}
@@ -109,25 +109,25 @@
PitTest::DoRun ()
{
Ptr<Node> node = CreateObject<Node> ();
- CcnxStackHelper ccnx;
- ccnx.Install (node);
+ NdnStackHelper ndn;
+ ndn.Install (node);
Ptr<Client> app1 = CreateObject<Client> ();
node->AddApplication (app1);
- Simulator::Schedule (Seconds (0.0001), &PitTest::Test, this, node->GetObject<CcnxFib> ());
+ Simulator::Schedule (Seconds (0.0001), &PitTest::Test, this, node->GetObject<NdnFib> ());
- Simulator::Schedule (Seconds (0.01), &PitTest::Check0, this, node->GetObject<CcnxPit> ());
+ Simulator::Schedule (Seconds (0.01), &PitTest::Check0, this, node->GetObject<NdnPit> ());
- Simulator::Schedule (Seconds (0.11), &PitTest::Check1, this, node->GetObject<CcnxPit> ());
- Simulator::Schedule (Seconds (0.21), &PitTest::Check2, this, node->GetObject<CcnxPit> ());
- Simulator::Schedule (Seconds (0.31), &PitTest::Check3, this, node->GetObject<CcnxPit> ());
+ Simulator::Schedule (Seconds (0.11), &PitTest::Check1, this, node->GetObject<NdnPit> ());
+ Simulator::Schedule (Seconds (0.21), &PitTest::Check2, this, node->GetObject<NdnPit> ());
+ Simulator::Schedule (Seconds (0.31), &PitTest::Check3, this, node->GetObject<NdnPit> ());
- Simulator::Schedule (Seconds (0.61), &PitTest::Check3, this, node->GetObject<CcnxPit> ());
- Simulator::Schedule (Seconds (0.71), &PitTest::Check2, this, node->GetObject<CcnxPit> ());
- Simulator::Schedule (Seconds (0.81), &PitTest::Check1, this, node->GetObject<CcnxPit> ());
+ Simulator::Schedule (Seconds (0.61), &PitTest::Check3, this, node->GetObject<NdnPit> ());
+ Simulator::Schedule (Seconds (0.71), &PitTest::Check2, this, node->GetObject<NdnPit> ());
+ Simulator::Schedule (Seconds (0.81), &PitTest::Check1, this, node->GetObject<NdnPit> ());
- Simulator::Schedule (Seconds (0.91), &PitTest::Check0, this, node->GetObject<CcnxPit> ());
+ Simulator::Schedule (Seconds (0.91), &PitTest::Check0, this, node->GetObject<NdnPit> ());
Simulator::Stop (Seconds (1.0));
Simulator::Run ();
diff --git a/test/ndnSIM-pit.h b/test/ndnSIM-pit.h
index 3bc1705..0e5a26e 100644
--- a/test/ndnSIM-pit.h
+++ b/test/ndnSIM-pit.h
@@ -27,8 +27,8 @@
namespace ns3
{
-class CcnxFib;
-class CcnxPit;
+class NdnFib;
+class NdnPit;
class PitTest : public TestCase
{
@@ -41,11 +41,11 @@
private:
virtual void DoRun ();
- void Test (Ptr<CcnxFib> fib);
- void Check0 (Ptr<CcnxPit> pit);
- void Check1 (Ptr<CcnxPit> pit);
- void Check2 (Ptr<CcnxPit> pit);
- void Check3 (Ptr<CcnxPit> pit);
+ void Test (Ptr<NdnFib> fib);
+ void Check0 (Ptr<NdnPit> pit);
+ void Check1 (Ptr<NdnPit> pit);
+ void Check2 (Ptr<NdnPit> pit);
+ void Check3 (Ptr<NdnPit> pit);
};
}
diff --git a/test/ndnSIM-serialization.cc b/test/ndnSIM-serialization.cc
index 6c3d722..244aae8 100644
--- a/test/ndnSIM-serialization.cc
+++ b/test/ndnSIM-serialization.cc
@@ -34,9 +34,9 @@
void
InterestSerializationTest::DoRun ()
{
- CcnxInterestHeader source;
- source.SetName (Create<CcnxNameComponents> (boost::lexical_cast<CcnxNameComponents> ("/test/test2")));
- NS_TEST_ASSERT_MSG_EQ (source.GetName (), boost::lexical_cast<CcnxNameComponents> ("/test/test2"), "set/get name failed");
+ NdnInterestHeader source;
+ source.SetName (Create<NdnNameComponents> (boost::lexical_cast<NdnNameComponents> ("/test/test2")));
+ NS_TEST_ASSERT_MSG_EQ (source.GetName (), boost::lexical_cast<NdnNameComponents> ("/test/test2"), "set/get name failed");
source.SetMinSuffixComponents (20);
NS_TEST_ASSERT_MSG_EQ (source.GetMinSuffixComponents (), 20, "set/get minSuffixComponents failed");
@@ -44,8 +44,8 @@
source.SetMaxSuffixComponents (40);
NS_TEST_ASSERT_MSG_EQ (source.GetMaxSuffixComponents (), 40, "set/get maxSuffixComponents failed");
- source.SetExclude (Create<CcnxNameComponents> (boost::lexical_cast<CcnxNameComponents> ("/exclude/exclude2")));
- NS_TEST_ASSERT_MSG_EQ (source.GetExclude (), boost::lexical_cast<CcnxNameComponents> ("/exclude/exclude2"), "set/get exclude failed");
+ source.SetExclude (Create<NdnNameComponents> (boost::lexical_cast<NdnNameComponents> ("/exclude/exclude2")));
+ NS_TEST_ASSERT_MSG_EQ (source.GetExclude (), boost::lexical_cast<NdnNameComponents> ("/exclude/exclude2"), "set/get exclude failed");
source.SetChildSelector (false);
NS_TEST_ASSERT_MSG_EQ (source.IsEnabledChildSelector (), false, "set/get child selector failed");
@@ -74,7 +74,7 @@
packet.AddHeader (source);
//deserialization
- CcnxInterestHeader target;
+ NdnInterestHeader target;
packet.RemoveHeader (target);
NS_TEST_ASSERT_MSG_EQ (source.GetName () , target.GetName () , "source/target name failed");
diff --git a/test/ndnSIM-stats-tree.cc b/test/ndnSIM-stats-tree.cc
index 58b9c4b..b87dad9 100644
--- a/test/ndnSIM-stats-tree.cc
+++ b/test/ndnSIM-stats-tree.cc
@@ -23,11 +23,11 @@
#include "ns3/point-to-point-module.h"
#include "ns3/ndnSIM-module.h"
#include "../utils/stats-tree.h"
-#include "../apps/ccnx-producer.h"
+#include "../apps/ndn-producer.h"
#include <boost/lexical_cast.hpp>
-NS_LOG_COMPONENT_DEFINE ("CcnxStatsTreeTest");
+NS_LOG_COMPONENT_DEFINE ("NdnStatsTreeTest");
using namespace ndnSIM;
@@ -45,20 +45,20 @@
void
StatsTreeTest::BasicTests ()
{
- CcnxStackHelper ccnx;
+ NdnStackHelper ndn;
Ptr<Node> node1 = CreateObject<Node> ();
- Ptr<CcnxApp> app1 = CreateObject<CcnxProducer> ();
+ Ptr<NdnApp> app1 = CreateObject<NdnProducer> ();
node1->AddApplication (app1);
- ccnx.Install (node1);
+ ndn.Install (node1);
- Ptr<CcnxFace> face1 = CreateObject<CcnxAppFace> (app1);
- Ptr<CcnxFace> face2 = CreateObject<CcnxAppFace> (app1);
- Ptr<CcnxFace> face3 = CreateObject<CcnxAppFace> (app1);
+ Ptr<NdnFace> face1 = CreateObject<NdnAppFace> (app1);
+ Ptr<NdnFace> face2 = CreateObject<NdnAppFace> (app1);
+ Ptr<NdnFace> face3 = CreateObject<NdnAppFace> (app1);
- node1->GetObject<Ccnx> ()->AddFace (face1);
- node1->GetObject<Ccnx> ()->AddFace (face2);
- node1->GetObject<Ccnx> ()->AddFace (face3);
+ node1->GetObject<Ndn> ()->AddFace (face1);
+ node1->GetObject<Ndn> ()->AddFace (face2);
+ node1->GetObject<Ndn> ()->AddFace (face3);
// NS_LOG_DEBUG (*face1 << ", " << *face2 << ", " << *face3);