First step of refactoring code (ccnx prefix => ndn prefix)
diff --git a/examples/ccnx-simple-with-pcap.cc b/examples/ccnx-simple-with-pcap.cc
new file mode 100644
index 0000000..b97565b
--- /dev/null
+++ b/examples/ccnx-simple-with-pcap.cc
@@ -0,0 +1,83 @@
+
+#include "ns3/core-module.h"
+#include "ns3/network-module.h"
+#include "ns3/point-to-point-module.h"
+#include "ns3/ndnSIM-module.h"
+
+using namespace ns3;
+
+class PcapWriter
+{
+public:
+ PcapWriter (const std::string &file)
+ {
+ PcapHelper helper;
+ m_pcap = helper.CreateFile (file, std::ios::out, PcapHelper::DLT_PPP);
+ }
+
+ void
+ TracePacket (Ptr<const Packet> packet)
+ {
+ static PppHeader pppHeader;
+ pppHeader.SetProtocol (0x0077);
+
+ m_pcap->Write (Simulator::Now (), pppHeader, packet);
+ }
+
+private:
+ Ptr<PcapFileWrapper> m_pcap;
+};
+
+
+int
+main (int argc, char *argv[])
+{
+ // setting default parameters for PointToPoint links and channels
+ Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("1Mbps"));
+ Config::SetDefault ("ns3::PointToPointChannel::Delay", StringValue ("10ms"));
+ Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("20"));
+
+ Config::SetDefault ("ns3::NdnProducer::SignatureBits", StringValue ("1"));
+
+ // Creating nodes
+ NodeContainer nodes;
+ nodes.Create (3);
+
+ // Connecting nodes using two links
+ PointToPointHelper p2p;
+ p2p.Install (nodes.Get (0), nodes.Get (1));
+ p2p.Install (nodes.Get (1), nodes.Get (2));
+
+ // Install Ndn stack on all nodes
+ NdnStackHelper ndnHelper;
+ ndnHelper.SetDefaultRoutes (true);
+ ndnHelper.InstallAll ();
+
+ // Installing applications
+
+ // Consumer
+ NdnAppHelper consumerHelper ("ns3::NdnConsumerCbr");
+ // Consumer will request /prefix/0, /prefix/1, ...
+ consumerHelper.SetPrefix ("/prefix");
+ consumerHelper.SetAttribute ("Frequency", StringValue ("10")); // 10 interests a second
+ consumerHelper.Install (nodes.Get (0)); // first node
+
+ // Producer
+ NdnAppHelper producerHelper ("ns3::NdnProducer");
+ // Producer will reply to all requests starting with /prefix
+ producerHelper.SetPrefix ("/prefix");
+ producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
+ producerHelper.Install (nodes.Get (2)); // last node
+
+ PcapWriter trace ("ndn-simple-trace.pcap");
+ Config::ConnectWithoutContext ("/NodeList/*/$ns3::NdnL3Protocol/FaceList/*/NdnTx",
+ MakeCallback (&PcapWriter::TracePacket, &trace));
+
+ Simulator::Stop (Seconds (20.0));
+
+ Simulator::Run ();
+ Simulator::Destroy ();
+
+ return 0;
+}
+
diff --git a/examples/ccnx-grid.cc b/examples/ndn-grid.cc
similarity index 79%
rename from examples/ccnx-grid.cc
rename to examples/ndn-grid.cc
index beb50a9..d037fda 100644
--- a/examples/ccnx-grid.cc
+++ b/examples/ndn-grid.cc
@@ -27,7 +27,7 @@
using namespace ns3;
-NS_LOG_COMPONENT_DEFINE ("CcnxGrid");
+NS_LOG_COMPONENT_DEFINE ("NdnGrid");
/**
* This scenario simulates a grid topology (using PointToPointGrid module)
@@ -42,7 +42,7 @@
*
* All links are 1Mbps with propagation 10ms delay.
*
- * FIB is populated using CcnxGlobalRoutingHelper.
+ * FIB is populated using NdnGlobalRoutingHelper.
*
* Consumer requests data from producer with frequency 10 interests per second
* (interests contain constantly increasing sequence number).
@@ -54,7 +54,7 @@
*
* To run scenario and see what is happening, use the following command:
*
- * NS_LOG=CcnxSimple:CcnxConsumer ./waf --run=ccnx-grid
+ * NS_LOG=NdnSimple:NdnConsumer ./waf --run=ndn-grid
*/
@@ -78,43 +78,43 @@
PointToPointGridHelper grid (nGrid, nGrid, p2p);
grid.BoundingBox(100,100,200,200);
- // Install CCNx stack on all nodes
- NS_LOG_INFO ("Installing CCNx stack on all nodes");
- CcnxStackHelper ccnxHelper;
- ccnxHelper.SetContentStore ("ns3::CcnxContentStoreLru",
+ // Install Ndn stack on all nodes
+ NS_LOG_INFO ("Installing Ndn stack on all nodes");
+ NdnStackHelper ndnHelper;
+ ndnHelper.SetContentStore ("ns3::NdnContentStoreLru",
"Size", "10");
- // ccnxHelper.SetContentStore ("ns3::CcnxContentStoreRandom",
+ // ndnHelper.SetContentStore ("ns3::NdnContentStoreRandom",
// "Size", "10");
- // ccnxHelper.SetForwardingStrategy ("ns3::ndnSIM::BestRoute");
- ccnxHelper.InstallAll ();
+ // ndnHelper.SetForwardingStrategy ("ns3::ndnSIM::BestRoute");
+ ndnHelper.InstallAll ();
- CcnxGlobalRoutingHelper ccnxGlobalRoutingHelper;
- ccnxGlobalRoutingHelper.InstallAll ();
+ NdnGlobalRoutingHelper ndnGlobalRoutingHelper;
+ ndnGlobalRoutingHelper.InstallAll ();
// Getting containers for the consumer/producer
Ptr<Node> producer = grid.GetNode (nGrid-1, nGrid-1);
NodeContainer consumerNodes;
consumerNodes.Add (grid.GetNode (0,0));
- // Install CCNx applications
+ // Install Ndn applications
NS_LOG_INFO ("Installing Applications");
std::string prefix = "/prefix";
- CcnxAppHelper consumerHelper ("ns3::CcnxConsumerCbr");
+ NdnAppHelper consumerHelper ("ns3::NdnConsumerCbr");
consumerHelper.SetPrefix (prefix);
consumerHelper.SetAttribute ("Frequency", StringValue ("100")); // 10 interests a second
ApplicationContainer consumers = consumerHelper.Install (consumerNodes);
- CcnxAppHelper producerHelper ("ns3::CcnxProducer");
+ NdnAppHelper producerHelper ("ns3::NdnProducer");
producerHelper.SetPrefix (prefix);
producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
ApplicationContainer producers = producerHelper.Install (producer);
- // Add /prefix origins to CcnxGlobalRouter
- ccnxGlobalRoutingHelper.AddOrigins (prefix, producer);
+ // Add /prefix origins to NdnGlobalRouter
+ ndnGlobalRoutingHelper.AddOrigins (prefix, producer);
// Calculate and install FIBs
- ccnxGlobalRoutingHelper.CalculateRoutes ();
+ ndnGlobalRoutingHelper.CalculateRoutes ();
Simulator::Stop (finishTime);
@@ -126,7 +126,7 @@
node ++)
{
std::cout << "Node #" << (*node)->GetId () << std::endl;
- (*node)->GetObject<CcnxContentStore> ()->Print (std::cout);
+ (*node)->GetObject<NdnContentStore> ()->Print (std::cout);
std::cout << std::endl;
}
diff --git a/examples/ccnx-simple.cc b/examples/ndn-simple.cc
similarity index 88%
rename from examples/ccnx-simple.cc
rename to examples/ndn-simple.cc
index da8b1f6..84d306b 100644
--- a/examples/ccnx-simple.cc
+++ b/examples/ndn-simple.cc
@@ -44,10 +44,10 @@
*
* To run scenario and see what is happening, use the following command:
*
- * NS_LOG=CcnxSimple:CcnxConsumer ./waf --run=ccnx-simple
+ * NS_LOG=NdnSimple:NdnConsumer ./waf --run=ndn-simple
*/
-NS_LOG_COMPONENT_DEFINE ("CcnxSimple");
+NS_LOG_COMPONENT_DEFINE ("NdnSimple");
int
main (int argc, char *argv[])
@@ -71,14 +71,14 @@
p2p.Install (nodes.Get (0), nodes.Get (1));
p2p.Install (nodes.Get (1), nodes.Get (2));
- // Install CCNx stack on all nodes
- NS_LOG_INFO ("Installing CCNx stack");
- CcnxStackHelper ccnxHelper;
- ccnxHelper.SetDefaultRoutes (true);
- ccnxHelper.InstallAll ();
+ // Install Ndn stack on all nodes
+ NS_LOG_INFO ("Installing Ndn stack");
+ NdnStackHelper ndnHelper;
+ ndnHelper.SetDefaultRoutes (true);
+ ndnHelper.InstallAll ();
- NS_LOG_INFO ("Installing CCNx applications");
- CcnxAppHelper consumerHelper ("ns3::CcnxConsumerCbr");
+ NS_LOG_INFO ("Installing Ndn applications");
+ NdnAppHelper consumerHelper ("ns3::NdnConsumerCbr");
// Consumer will request /prefix/0, /prefix/1, ...
consumerHelper.SetPrefix ("/prefix/0");
consumerHelper.SetAttribute ("Frequency", StringValue ("1")); // 10 interests a second
@@ -90,7 +90,7 @@
consumers.Start (Seconds (1));
consumers.Stop (Seconds (1.3));
- CcnxAppHelper producerHelper ("ns3::CcnxProducer");
+ NdnAppHelper producerHelper ("ns3::NdnProducer");
// Producer will reply to all requests starting with /prefix
producerHelper.SetPrefix ("/prefix");
producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
diff --git a/examples/trie.cc b/examples/trie.cc
index 9c9cc3c..4766229 100644
--- a/examples/trie.cc
+++ b/examples/trie.cc
@@ -59,7 +59,7 @@
args.Parse (argc, argv);
// typedef trie_with_policy<
- // ns3::CcnxNameComponents,
+ // ns3::NdnNameComponents,
// smart_pointer_payload_traits<Integer>,
// multi_policy_traits<
// mpl::vector2<lru_policy_traits,random_policy_traits>
@@ -74,7 +74,7 @@
// // // // x.getTrie ().PrintStat (std::cout);
- // ns3::CcnxNameComponents n1,n2,n3,n4;
+ // ns3::NdnNameComponents n1,n2,n3,n4;
// // // // n1("a")("b")("c");
// // // // n2("a")("b")("d");
// // // // n3("a")("b")("f");
@@ -98,21 +98,21 @@
Ptr<Node> node = CreateObject<Node> ();
Names::Add ("TestNode", node);
- Ptr<CcnxApp> app = CreateObject<CcnxApp> ();
+ Ptr<NdnApp> app = CreateObject<NdnApp> ();
node->AddApplication (app);
- ObjectFactory factory ("ns3::CcnxFib");
+ ObjectFactory factory ("ns3::NdnFib");
- Ptr<CcnxFib> fib = factory.Create<CcnxFib> ();
+ Ptr<NdnFib> fib = factory.Create<NdnFib> ();
node->AggregateObject (fib);
- Ptr<CcnxFace> face = CreateObject<CcnxAppFace> (app);
+ Ptr<NdnFace> face = CreateObject<NdnAppFace> (app);
- fib->Add (lexical_cast<CcnxNameComponents> ("/bla"), face, 1);
- fib->Add (lexical_cast<CcnxNameComponents> ("/bla/1"), face, 1);
- fib->Add (lexical_cast<CcnxNameComponents> ("/bla/2"), face, 1);
- fib->Add (lexical_cast<CcnxNameComponents> ("/bla/3"), face, 1);
- fib->Add (lexical_cast<CcnxNameComponents> ("/bla/1/1"), face, 1);
- fib->Add (lexical_cast<CcnxNameComponents> ("/bla/1/2"), face, 1);
+ fib->Add (lexical_cast<NdnNameComponents> ("/bla"), face, 1);
+ fib->Add (lexical_cast<NdnNameComponents> ("/bla/1"), face, 1);
+ fib->Add (lexical_cast<NdnNameComponents> ("/bla/2"), face, 1);
+ fib->Add (lexical_cast<NdnNameComponents> ("/bla/3"), face, 1);
+ fib->Add (lexical_cast<NdnNameComponents> ("/bla/1/1"), face, 1);
+ fib->Add (lexical_cast<NdnNameComponents> ("/bla/1/2"), face, 1);
cout << *fib << endl;
@@ -124,7 +124,7 @@
// std::cout << *item.payload () << " " << std::endl;
// }
- // ns3::CcnxNameComponents n4;
+ // ns3::NdnNameComponents n4;
// n4("a")("c");
// // std::cout << *x->find (n4).get<0> ();
diff --git a/examples/wscript b/examples/wscript
index 7a49ca3..decba8f 100644
--- a/examples/wscript
+++ b/examples/wscript
@@ -1,11 +1,11 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
def build(bld):
- obj = bld.create_ns3_program('ccnx-simple', ['ndnSIM'])
- obj.source = 'ccnx-simple.cc'
+ obj = bld.create_ns3_program('ndn-simple', ['ndnSIM'])
+ obj.source = 'ndn-simple.cc'
- obj = bld.create_ns3_program('ccnx-grid', ['ndnSIM', 'point-to-point', 'point-to-point-layout'])
- obj.source = 'ccnx-grid.cc'
+ obj = bld.create_ns3_program('ndn-grid', ['ndnSIM', 'point-to-point', 'point-to-point-layout'])
+ obj.source = 'ndn-grid.cc'
obj = bld.create_ns3_program('trie', ['ndnSIM'])
obj.source = 'trie.cc'