src: Updating code style to conform (more or less) to ndn-cxx style
Also, adding .clang-format that describes the applied style. Note that
this style requires a slightly customized version of clang-format.
diff --git a/examples/custom-apps/custom-app.cpp b/examples/custom-apps/custom-app.cpp
index 71ca87e..001c440 100644
--- a/examples/custom-apps/custom-app.cpp
+++ b/examples/custom-apps/custom-app.cpp
@@ -33,112 +33,110 @@
#include "ns3/ndn-fib.hpp"
#include "ns3/random-variable.h"
-NS_LOG_COMPONENT_DEFINE ("CustomApp");
+NS_LOG_COMPONENT_DEFINE("CustomApp");
namespace ns3 {
-NS_OBJECT_ENSURE_REGISTERED (CustomApp);
+NS_OBJECT_ENSURE_REGISTERED(CustomApp);
// register NS-3 type
TypeId
-CustomApp::GetTypeId ()
+CustomApp::GetTypeId()
{
- static TypeId tid = TypeId ("CustomApp")
- .SetParent<ndn::App> ()
- .AddConstructor<CustomApp> ()
- ;
+ static TypeId tid = TypeId("CustomApp").SetParent<ndn::App>().AddConstructor<CustomApp>();
return tid;
}
// Processing upon start of the application
void
-CustomApp::StartApplication ()
+CustomApp::StartApplication()
{
// initialize ndn::App
- ndn::App::StartApplication ();
+ ndn::App::StartApplication();
// Create a name components object for name ``/prefix/sub``
- Ptr<ndn::Name> prefix = Create<ndn::Name> (); // now prefix contains ``/``
- prefix->append ("prefix"); // now prefix contains ``/prefix``
- prefix->append ("sub"); // now prefix contains ``/prefix/sub``
+ Ptr<ndn::Name> prefix = Create<ndn::Name>(); // now prefix contains ``/``
+ prefix->append("prefix"); // now prefix contains ``/prefix``
+ prefix->append("sub"); // now prefix contains ``/prefix/sub``
/////////////////////////////////////////////////////////////////////////////
// Creating FIB entry that ensures that we will receive incoming Interests //
/////////////////////////////////////////////////////////////////////////////
// Get FIB object
- Ptr<ndn::Fib> fib = GetNode ()->GetObject<ndn::Fib> ();
+ Ptr<ndn::Fib> fib = GetNode()->GetObject<ndn::Fib>();
// Add entry to FIB
// Note that ``m_face`` is cretaed by ndn::App
- Ptr<ndn::fib::Entry> fibEntry = fib->Add (*prefix, m_face, 0);
+ Ptr<ndn::fib::Entry> fibEntry = fib->Add(*prefix, m_face, 0);
- Simulator::Schedule (Seconds (1.0), &CustomApp::SendInterest, this);
+ Simulator::Schedule(Seconds(1.0), &CustomApp::SendInterest, this);
}
// Processing when application is stopped
void
-CustomApp::StopApplication ()
+CustomApp::StopApplication()
{
// cleanup ndn::App
- ndn::App::StopApplication ();
+ ndn::App::StopApplication();
}
void
-CustomApp::SendInterest ()
+CustomApp::SendInterest()
{
/////////////////////////////////////
// Sending one Interest packet out //
/////////////////////////////////////
-
- Ptr<ndn::Name> prefix = Create<ndn::Name> ("/prefix/sub"); // another way to create name
+
+ Ptr<ndn::Name> prefix = Create<ndn::Name>("/prefix/sub"); // another way to create name
// Create and configure ndn::Interest
- Ptr<ndn::Interest> interest = Create<ndn::Interest> ();
- UniformVariable rand (0,std::numeric_limits<uint32_t>::max ());
- interest->SetNonce (rand.GetValue ());
- interest->SetName (prefix);
- interest->SetInterestLifetime (Seconds (1.0));
+ Ptr<ndn::Interest> interest = Create<ndn::Interest>();
+ UniformVariable rand(0, std::numeric_limits<uint32_t>::max());
+ interest->SetNonce(rand.GetValue());
+ interest->SetName(prefix);
+ interest->SetInterestLifetime(Seconds(1.0));
- NS_LOG_DEBUG ("Sending Interest packet for " << *prefix);
-
+ NS_LOG_DEBUG("Sending Interest packet for " << *prefix);
+
// Call trace (for logging purposes)
- m_transmittedInterests (interest, this, m_face);
+ m_transmittedInterests(interest, this, m_face);
- m_face->ReceiveInterest (interest);
+ m_face->ReceiveInterest(interest);
}
// Callback that will be called when Interest arrives
void
-CustomApp::OnInterest (Ptr<const ndn::Interest> interest)
+CustomApp::OnInterest(Ptr<const ndn::Interest> interest)
{
- ndn::App::OnInterest (interest);
-
- NS_LOG_DEBUG ("Received Interest packet for " << interest->GetName ());
+ ndn::App::OnInterest(interest);
+
+ NS_LOG_DEBUG("Received Interest packet for " << interest->GetName());
// Create and configure ndn::Data and ndn::DataTail
// (header is added in front of the packet, tail is added at the end of the packet)
// Note that Interests send out by the app will not be sent back to the app !
-
- Ptr<ndn::Data> data = Create<ndn::Data> (Create<Packet> (1024));
- data->SetName (Create<ndn::Name> (interest->GetName ())); // data will have the same name as Interests
- NS_LOG_DEBUG ("Sending Data packet for " << data->GetName ());
+ Ptr<ndn::Data> data = Create<ndn::Data>(Create<Packet>(1024));
+ data->SetName(
+ Create<ndn::Name>(interest->GetName())); // data will have the same name as Interests
+
+ NS_LOG_DEBUG("Sending Data packet for " << data->GetName());
// Call trace (for logging purposes)
- m_transmittedDatas (data, this, m_face);
+ m_transmittedDatas(data, this, m_face);
- m_face->ReceiveData (data);
+ m_face->ReceiveData(data);
}
// Callback that will be called when Data arrives
void
-CustomApp::OnData (Ptr<const ndn::Data> contentObject)
+CustomApp::OnData(Ptr<const ndn::Data> contentObject)
{
- NS_LOG_DEBUG ("Receiving Data packet for " << contentObject->GetName ());
+ NS_LOG_DEBUG("Receiving Data packet for " << contentObject->GetName());
- std::cout << "DATA received for name " << contentObject->GetName () << std::endl;
+ std::cout << "DATA received for name " << contentObject->GetName() << std::endl;
}
} // namespace ns3
diff --git a/examples/custom-apps/custom-app.hpp b/examples/custom-apps/custom-app.hpp
index 86f7bb4..5d05e99 100644
--- a/examples/custom-apps/custom-app.hpp
+++ b/examples/custom-apps/custom-app.hpp
@@ -37,32 +37,31 @@
*
* When an Interest is received, it is replied with a Data with 1024-byte fake payload
*/
-class CustomApp : public ndn::App
-{
+class CustomApp : public ndn::App {
public:
// register NS-3 type "CustomApp"
static TypeId
- GetTypeId ();
-
+ GetTypeId();
+
// (overridden from ndn::App) Processing upon start of the application
virtual void
- StartApplication ();
+ StartApplication();
// (overridden from ndn::App) Processing when application is stopped
virtual void
- StopApplication ();
+ StopApplication();
// (overridden from ndn::App) Callback that will be called when Interest arrives
virtual void
- OnInterest (Ptr<const ndn::Interest> interest);
+ OnInterest(Ptr<const ndn::Interest> interest);
// (overridden from ndn::App) Callback that will be called when Data arrives
virtual void
- OnData (Ptr<const ndn::Data> contentObject);
+ OnData(Ptr<const ndn::Data> contentObject);
private:
void
- SendInterest ();
+ SendInterest();
};
} // namespace ns3
diff --git a/examples/custom-apps/dumb-requester.cpp b/examples/custom-apps/dumb-requester.cpp
index eca1cf2..f81548f 100644
--- a/examples/custom-apps/dumb-requester.cpp
+++ b/examples/custom-apps/dumb-requester.cpp
@@ -32,88 +32,85 @@
#include "ns3/ndn-interest.hpp"
#include "ns3/ndn-data.hpp"
-NS_LOG_COMPONENT_DEFINE ("DumbRequester");
+NS_LOG_COMPONENT_DEFINE("DumbRequester");
namespace ns3 {
-NS_OBJECT_ENSURE_REGISTERED (DumbRequester);
+NS_OBJECT_ENSURE_REGISTERED(DumbRequester);
// register NS-3 type
TypeId
-DumbRequester::GetTypeId ()
+DumbRequester::GetTypeId()
{
- static TypeId tid = TypeId ("DumbRequester")
- .SetParent<ndn::App> ()
- .AddConstructor<DumbRequester> ()
+ static TypeId tid =
+ TypeId("DumbRequester")
+ .SetParent<ndn::App>()
+ .AddConstructor<DumbRequester>()
- .AddAttribute ("Prefix", "Requested name",
- StringValue ("/dumb-interest"),
- ndn::MakeNameAccessor (&DumbRequester::m_name),
- ndn::MakeNameChecker ())
- ;
+ .AddAttribute("Prefix", "Requested name", StringValue("/dumb-interest"),
+ ndn::MakeNameAccessor(&DumbRequester::m_name), ndn::MakeNameChecker());
return tid;
}
-DumbRequester::DumbRequester ()
- : m_isRunning (false)
+DumbRequester::DumbRequester()
+ : m_isRunning(false)
{
}
// Processing upon start of the application
void
-DumbRequester::StartApplication ()
+DumbRequester::StartApplication()
{
// initialize ndn::App
- ndn::App::StartApplication ();
+ ndn::App::StartApplication();
m_isRunning = true;
- Simulator::ScheduleNow (&DumbRequester::SendInterest, this);
+ Simulator::ScheduleNow(&DumbRequester::SendInterest, this);
}
// Processing when application is stopped
void
-DumbRequester::StopApplication ()
+DumbRequester::StopApplication()
{
m_isRunning = false;
// cleanup ndn::App
- ndn::App::StopApplication ();
+ ndn::App::StopApplication();
}
void
-DumbRequester::SendInterest ()
+DumbRequester::SendInterest()
{
- if (!m_isRunning) return;
-
+ if (!m_isRunning)
+ return;
+
/////////////////////////////////////
// Sending one Interest packet out //
/////////////////////////////////////
-
- Ptr<ndn::Name> prefix = Create<ndn::Name> (m_name); // another way to create name
+
+ Ptr<ndn::Name> prefix = Create<ndn::Name>(m_name); // another way to create name
// Create and configure ndn::Interest
- Ptr<ndn::Interest> interest = Create<ndn::Interest> ();
- UniformVariable rand (0,std::numeric_limits<uint32_t>::max ());
- interest->SetNonce (rand.GetValue ());
- interest->SetName (prefix);
- interest->SetInterestLifetime (Seconds (1.0));
+ Ptr<ndn::Interest> interest = Create<ndn::Interest>();
+ UniformVariable rand(0, std::numeric_limits<uint32_t>::max());
+ interest->SetNonce(rand.GetValue());
+ interest->SetName(prefix);
+ interest->SetInterestLifetime(Seconds(1.0));
- NS_LOG_DEBUG ("Sending Interest packet for " << *prefix);
-
+ NS_LOG_DEBUG("Sending Interest packet for " << *prefix);
// Call trace (for logging purposes)
- m_transmittedInterests (interest, this, m_face);
+ m_transmittedInterests(interest, this, m_face);
// Forward packet to lower (network) layer
- m_face->ReceiveInterest (interest);
+ m_face->ReceiveInterest(interest);
- Simulator::Schedule (Seconds (1.0), &DumbRequester::SendInterest, this);
+ Simulator::Schedule(Seconds(1.0), &DumbRequester::SendInterest, this);
}
void
-DumbRequester::OnData (Ptr<const ndn::Data> contentObject)
+DumbRequester::OnData(Ptr<const ndn::Data> contentObject)
{
- NS_LOG_DEBUG ("Receiving Data packet for " << contentObject->GetName ());
+ NS_LOG_DEBUG("Receiving Data packet for " << contentObject->GetName());
}
-
} // namespace ns3
diff --git a/examples/custom-apps/dumb-requester.hpp b/examples/custom-apps/dumb-requester.hpp
index 7a1272d..55bdace 100644
--- a/examples/custom-apps/dumb-requester.hpp
+++ b/examples/custom-apps/dumb-requester.hpp
@@ -31,32 +31,31 @@
/**
* @brief A dumb requester application
*
- * This app keeps requesting every second the same content object
+ * This app keeps requesting every second the same content object
*/
-class DumbRequester : public ndn::App
-{
+class DumbRequester : public ndn::App {
public:
// register NS-3 type "DumbRequester"
static TypeId
- GetTypeId ();
+ GetTypeId();
- DumbRequester ();
-
+ DumbRequester();
+
// (overridden from ndn::App) Processing upon start of the application
virtual void
- StartApplication ();
+ StartApplication();
// (overridden from ndn::App) Processing when application is stopped
virtual void
- StopApplication ();
+ StopApplication();
// (overridden from ndn::App) Callback that will be called when Data arrives
virtual void
- OnData (Ptr<const ndn::Data> contentObject);
-
+ OnData(Ptr<const ndn::Data> contentObject);
+
private:
void
- SendInterest ();
+ SendInterest();
private:
bool m_isRunning;
diff --git a/examples/custom-apps/hijacker.cpp b/examples/custom-apps/hijacker.cpp
index f1852d4..bcff26a 100644
--- a/examples/custom-apps/hijacker.cpp
+++ b/examples/custom-apps/hijacker.cpp
@@ -23,53 +23,49 @@
#include "hijacker.hpp"
#include "ns3/ndn-name.hpp"
-NS_LOG_COMPONENT_DEFINE ("Hijacker");
+NS_LOG_COMPONENT_DEFINE("Hijacker");
namespace ns3 {
// Necessary if you are planning to use ndn::AppHelper
-NS_OBJECT_ENSURE_REGISTERED (Hijacker);
+NS_OBJECT_ENSURE_REGISTERED(Hijacker);
TypeId
-Hijacker::GetTypeId ()
+Hijacker::GetTypeId()
{
- static TypeId tid = TypeId ("Hijacker")
- .SetParent<ndn::App> ()
- .AddConstructor<Hijacker> ()
- ;
+ static TypeId tid = TypeId("Hijacker").SetParent<ndn::App>().AddConstructor<Hijacker>();
return tid;
}
-Hijacker::Hijacker ()
+Hijacker::Hijacker()
{
}
void
-Hijacker::OnInterest (Ptr<const ndn::Interest> interest)
+Hijacker::OnInterest(Ptr<const ndn::Interest> interest)
{
- ndn::App::OnInterest (interest); // forward call to perform app-level tracing
+ ndn::App::OnInterest(interest); // forward call to perform app-level tracing
// do nothing else (hijack interest)
- NS_LOG_DEBUG ("Do nothing for incoming interest for" << interest->GetName ());
+ NS_LOG_DEBUG("Do nothing for incoming interest for" << interest->GetName());
}
void
-Hijacker::StartApplication ()
+Hijacker::StartApplication()
{
- App::StartApplication ();
+ App::StartApplication();
// equivalent to setting interest filter for "/" prefix
- Ptr<ndn::Fib> fib = GetNode ()->GetObject<ndn::Fib> ();
- Ptr<ndn::fib::Entry> fibEntry = fib->Add (ndn::Name ("/"), m_face, 0);
- fibEntry->UpdateStatus (m_face, ndn::fib::FaceMetric::NDN_FIB_GREEN);
+ Ptr<ndn::Fib> fib = GetNode()->GetObject<ndn::Fib>();
+ Ptr<ndn::fib::Entry> fibEntry = fib->Add(ndn::Name("/"), m_face, 0);
+ fibEntry->UpdateStatus(m_face, ndn::fib::FaceMetric::NDN_FIB_GREEN);
}
void
-Hijacker::StopApplication ()
+Hijacker::StopApplication()
{
- App::StopApplication ();
+ App::StopApplication();
}
} // namespace ns3
-
diff --git a/examples/custom-apps/hijacker.hpp b/examples/custom-apps/hijacker.hpp
index a90166d..a794f12 100644
--- a/examples/custom-apps/hijacker.hpp
+++ b/examples/custom-apps/hijacker.hpp
@@ -29,25 +29,24 @@
namespace ns3 {
-class Hijacker : public ndn::App
-{
+class Hijacker : public ndn::App {
public:
static TypeId
- GetTypeId ();
+ GetTypeId();
- Hijacker ();
+ Hijacker();
// Receive all Interests but do nothing in response
void
- OnInterest (Ptr<const ndn::Interest> interest);
+ OnInterest(Ptr<const ndn::Interest> interest);
protected:
// inherited from Application base class.
virtual void
- StartApplication ();
+ StartApplication();
virtual void
- StopApplication ();
+ StopApplication();
};
} // namespace ns3
diff --git a/examples/ndn-congestion-alt-topo-plugin.cpp b/examples/ndn-congestion-alt-topo-plugin.cpp
index b591250..9491be4 100644
--- a/examples/ndn-congestion-alt-topo-plugin.cpp
+++ b/examples/ndn-congestion-alt-topo-plugin.cpp
@@ -31,25 +31,25 @@
* /------\ 0 0 /------\
* | c1 |<-----+ +----->| p1 |
* \------/ \ / \------/
- * \ /-----\ /
+ * \ /-----\ /
* /------\ 0 \ +==>| r12 |<==+ / 0 /------\
* | c2 |<--+ \ / \-----/ \ / +-->| p2 |
* \------/ \ \ | | / / \------/
- * \ | | 1Mbps links | | /
- * \ 1 v0 v5 1v 2v 3 /
- * +->/------\ /------\<-+
- * 2| r1 |<===============>| r2 |4
- * +->\------/4 0\------/<-+
- * / 3^ ^5 \
- * / | | \
+ * \ | | 1Mbps links | | /
+ * \ 1 v0 v5 1v 2v 3 /
+ * +->/------\ /------\<-+
+ * 2| r1 |<===============>| r2 |4
+ * +->\------/4 0\------/<-+
+ * / 3^ ^5 \
+ * / | | \
* /------\ 0 / / \ \ 0 /------\
* | c3 |<--+ / \ +-->| p3 |
* \------/ / \ \------/
- * / "All consumer-router and" \
+ * / "All consumer-router and" \
* /------\ 0 / "router-producer links are" \ 0 /------\
* | c4 |<-----+ "10Mbps" +---->| p4 |
* \------/ \------/
- *
+ *
* "Numbers near nodes denote face IDs. Face ID is assigned based on the order of link"
* "definitions in the topology file"
*
@@ -59,81 +59,81 @@
*/
int
-main (int argc, char *argv[])
+main(int argc, char* argv[])
{
CommandLine cmd;
- cmd.Parse (argc, argv);
+ cmd.Parse(argc, argv);
- AnnotatedTopologyReader topologyReader ("", 1);
- topologyReader.SetFileName ("src/ndnSIM/examples/topologies/topo-11-node-two-bottlenecks.txt");
- topologyReader.Read ();
+ AnnotatedTopologyReader topologyReader("", 1);
+ topologyReader.SetFileName("src/ndnSIM/examples/topologies/topo-11-node-two-bottlenecks.txt");
+ topologyReader.Read();
// Install NDN stack on all nodes
ndn::StackHelper ndnHelper;
- ndnHelper.SetForwardingStrategy ("ns3::ndn::fw::CustomStrategy");
- ndnHelper.SetContentStore ("ns3::ndn::cs::Lru",
- "MaxSize", "1"); // ! Attention ! If set to 0, then MaxSize is infinite
- ndnHelper.InstallAll ();
+ ndnHelper.SetForwardingStrategy("ns3::ndn::fw::CustomStrategy");
+ ndnHelper.SetContentStore("ns3::ndn::cs::Lru", "MaxSize",
+ "1"); // ! Attention ! If set to 0, then MaxSize is infinite
+ ndnHelper.InstallAll();
// Getting containers for the consumer/producer
- Ptr<Node> consumers[4] = { Names::Find<Node> ("c1"), Names::Find<Node> ("c2"), Names::Find<Node> ("c3"), Names::Find<Node> ("c4") };
- Ptr<Node> producers[4] = { Names::Find<Node> ("p1"), Names::Find<Node> ("p2"), Names::Find<Node> ("p3"), Names::Find<Node> ("p4") };
+ Ptr<Node> consumers[4] = {Names::Find<Node>("c1"), Names::Find<Node>("c2"),
+ Names::Find<Node>("c3"), Names::Find<Node>("c4")};
+ Ptr<Node> producers[4] = {Names::Find<Node>("p1"), Names::Find<Node>("p2"),
+ Names::Find<Node>("p3"), Names::Find<Node>("p4")};
- if (consumers[0] == 0 || consumers[1] == 0 || consumers[2] == 0 || consumers[3] == 0 ||
- producers[0] == 0 || producers[1] == 0 || producers[2] == 0 || producers[3] == 0)
- {
- NS_FATAL_ERROR ("Error in topology: one nodes c1, c2, c3, c4, p1, p2, p3, or p4 is missing");
- }
+ if (consumers[0] == 0 || consumers[1] == 0 || consumers[2] == 0 || consumers[3] == 0
+ || producers[0] == 0 || producers[1] == 0 || producers[2] == 0 || producers[3] == 0) {
+ NS_FATAL_ERROR("Error in topology: one nodes c1, c2, c3, c4, p1, p2, p3, or p4 is missing");
+ }
- for (int i = 0; i < 4; i++)
- {
- std::string prefix = "/data/"+Names::FindName (producers[i]);
-
- /////////////////////////////////////////////////////////////////////////////////
- // install consumer app on consumer node c_i to request data from producer p_i //
- /////////////////////////////////////////////////////////////////////////////////
+ for (int i = 0; i < 4; i++) {
+ std::string prefix = "/data/" + Names::FindName(producers[i]);
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
- consumerHelper.SetAttribute ("Frequency", StringValue ("10")); // 100 interests a second
-
- consumerHelper.SetPrefix (prefix);
- ApplicationContainer consumer = consumerHelper.Install (consumers[i]);
- consumer.Start (Seconds (i)); // start consumers at 0s, 1s, 2s, 3s
- consumer.Stop (Seconds (19-i)); // stop consumers at 19s, 18s, 17s, 16s
-
- ///////////////////////////////////////////////
- // install producer app on producer node p_i //
- ///////////////////////////////////////////////
-
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
- producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
+ /////////////////////////////////////////////////////////////////////////////////
+ // install consumer app on consumer node c_i to request data from producer p_i //
+ /////////////////////////////////////////////////////////////////////////////////
- // install producer that will satisfy Interests in /dst1 namespace
- producerHelper.SetPrefix (prefix);
- ApplicationContainer producer = producerHelper.Install (producers[i]);
- // when Start/Stop time is not specified, the application is running throughout the simulation
- }
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
+ consumerHelper.SetAttribute("Frequency", StringValue("10")); // 100 interests a second
+
+ consumerHelper.SetPrefix(prefix);
+ ApplicationContainer consumer = consumerHelper.Install(consumers[i]);
+ consumer.Start(Seconds(i)); // start consumers at 0s, 1s, 2s, 3s
+ consumer.Stop(Seconds(19 - i)); // stop consumers at 19s, 18s, 17s, 16s
+
+ ///////////////////////////////////////////////
+ // install producer app on producer node p_i //
+ ///////////////////////////////////////////////
+
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
+ producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
+
+ // install producer that will satisfy Interests in /dst1 namespace
+ producerHelper.SetPrefix(prefix);
+ ApplicationContainer producer = producerHelper.Install(producers[i]);
+ // when Start/Stop time is not specified, the application is running throughout the simulation
+ }
// Manually configure FIB routes
- ndn::StackHelper::AddRoute ("c1", "/data", "n1", 1); // link to n1
- ndn::StackHelper::AddRoute ("c2", "/data", "n1", 1); // link to n1
- ndn::StackHelper::AddRoute ("c3", "/data", "n1", 1); // link to n1
- ndn::StackHelper::AddRoute ("c4", "/data", "n1", 1); // link to n1
+ ndn::StackHelper::AddRoute("c1", "/data", "n1", 1); // link to n1
+ ndn::StackHelper::AddRoute("c2", "/data", "n1", 1); // link to n1
+ ndn::StackHelper::AddRoute("c3", "/data", "n1", 1); // link to n1
+ ndn::StackHelper::AddRoute("c4", "/data", "n1", 1); // link to n1
- ndn::StackHelper::AddRoute ("n1", "/data", "n2", 1); // link to n2
- ndn::StackHelper::AddRoute ("n1", "/data", "n12", 2); // link to n12
+ ndn::StackHelper::AddRoute("n1", "/data", "n2", 1); // link to n2
+ ndn::StackHelper::AddRoute("n1", "/data", "n12", 2); // link to n12
- ndn::StackHelper::AddRoute ("n12", "/data", "n2", 1); // link to n2
+ ndn::StackHelper::AddRoute("n12", "/data", "n2", 1); // link to n2
- ndn::StackHelper::AddRoute ("n2", "/data/p1", "p1", 1); // link to p1
- ndn::StackHelper::AddRoute ("n2", "/data/p2", "p2", 1); // link to p2
- ndn::StackHelper::AddRoute ("n2", "/data/p3", "p3", 1); // link to p3
- ndn::StackHelper::AddRoute ("n2", "/data/p4", "p4", 1); // link to p4
+ ndn::StackHelper::AddRoute("n2", "/data/p1", "p1", 1); // link to p1
+ ndn::StackHelper::AddRoute("n2", "/data/p2", "p2", 1); // link to p2
+ ndn::StackHelper::AddRoute("n2", "/data/p3", "p3", 1); // link to p3
+ ndn::StackHelper::AddRoute("n2", "/data/p4", "p4", 1); // link to p4
// Schedule simulation time and run the simulation
- Simulator::Stop (Seconds (20.0));
- Simulator::Run ();
- Simulator::Destroy ();
+ Simulator::Stop(Seconds(20.0));
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}
diff --git a/examples/ndn-congestion-topo-plugin.cpp b/examples/ndn-congestion-topo-plugin.cpp
index 77069ee..0a6a58b 100644
--- a/examples/ndn-congestion-topo-plugin.cpp
+++ b/examples/ndn-congestion-topo-plugin.cpp
@@ -30,10 +30,10 @@
* /------\ /------\
* | Src1 |<--+ +-->| Dst1 |
* \------/ \ / \------/
- * \ /
- * +-->/------\ "bottleneck" /------\<-+
- * | Rtr1 |<===============>| Rtr2 |
- * +-->\------/ \------/<-+
+ * \ /
+ * +-->/------\ "bottleneck" /------\<-+
+ * | Rtr1 |<===============>| Rtr2 |
+ * +-->\------/ \------/<-+
* / \
* /------\ / \ /------\
* | Src2 |<--+ +-->| Dst2 |
@@ -45,68 +45,67 @@
*/
int
-main (int argc, char *argv[])
+main(int argc, char* argv[])
{
CommandLine cmd;
- cmd.Parse (argc, argv);
+ cmd.Parse(argc, argv);
- AnnotatedTopologyReader topologyReader ("", 25);
- topologyReader.SetFileName ("src/ndnSIM/examples/topologies/topo-6-node.txt");
- topologyReader.Read ();
+ AnnotatedTopologyReader topologyReader("", 25);
+ topologyReader.SetFileName("src/ndnSIM/examples/topologies/topo-6-node.txt");
+ topologyReader.Read();
// Install NDN stack on all nodes
ndn::StackHelper ndnHelper;
- ndnHelper.SetForwardingStrategy ("ns3::ndn::fw::BestRoute");
- ndnHelper.SetContentStore ("ns3::ndn::cs::Lru",
- "MaxSize", "10000");
- ndnHelper.InstallAll ();
+ ndnHelper.SetForwardingStrategy("ns3::ndn::fw::BestRoute");
+ ndnHelper.SetContentStore("ns3::ndn::cs::Lru", "MaxSize", "10000");
+ ndnHelper.InstallAll();
// Installing global routing interface on all nodes
ndn::GlobalRoutingHelper ndnGlobalRoutingHelper;
- ndnGlobalRoutingHelper.InstallAll ();
+ ndnGlobalRoutingHelper.InstallAll();
// Getting containers for the consumer/producer
- Ptr<Node> consumer1 = Names::Find<Node> ("Src1");
- Ptr<Node> consumer2 = Names::Find<Node> ("Src2");
+ Ptr<Node> consumer1 = Names::Find<Node>("Src1");
+ Ptr<Node> consumer2 = Names::Find<Node>("Src2");
- Ptr<Node> producer1 = Names::Find<Node> ("Dst1");
- Ptr<Node> producer2 = Names::Find<Node> ("Dst2");
+ Ptr<Node> producer1 = Names::Find<Node>("Dst1");
+ Ptr<Node> producer2 = Names::Find<Node>("Dst2");
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
- consumerHelper.SetAttribute ("Frequency", StringValue ("100")); // 100 interests a second
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
+ consumerHelper.SetAttribute("Frequency", StringValue("100")); // 100 interests a second
// on the first consumer node install a Consumer application
// that will express interests in /dst1 namespace
- consumerHelper.SetPrefix ("/dst1");
- consumerHelper.Install (consumer1);
+ consumerHelper.SetPrefix("/dst1");
+ consumerHelper.Install(consumer1);
// on the second consumer node install a Consumer application
// that will express interests in /dst2 namespace
- consumerHelper.SetPrefix ("/dst2");
- consumerHelper.Install (consumer2);
-
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
- producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
+ consumerHelper.SetPrefix("/dst2");
+ consumerHelper.Install(consumer2);
+
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
+ producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
// Register /dst1 prefix with global routing controller and
// install producer that will satisfy Interests in /dst1 namespace
- ndnGlobalRoutingHelper.AddOrigins ("/dst1", producer1);
- producerHelper.SetPrefix ("/dst1");
- producerHelper.Install (producer1);
+ ndnGlobalRoutingHelper.AddOrigins("/dst1", producer1);
+ producerHelper.SetPrefix("/dst1");
+ producerHelper.Install(producer1);
// Register /dst2 prefix with global routing controller and
// install producer that will satisfy Interests in /dst2 namespace
- ndnGlobalRoutingHelper.AddOrigins ("/dst2", producer2);
- producerHelper.SetPrefix ("/dst2");
- producerHelper.Install (producer2);
+ ndnGlobalRoutingHelper.AddOrigins("/dst2", producer2);
+ producerHelper.SetPrefix("/dst2");
+ producerHelper.Install(producer2);
// Calculate and install FIBs
- ndn::GlobalRoutingHelper::CalculateRoutes ();
+ ndn::GlobalRoutingHelper::CalculateRoutes();
- Simulator::Stop (Seconds (20.0));
+ Simulator::Stop(Seconds(20.0));
- Simulator::Run ();
- Simulator::Destroy ();
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}
diff --git a/examples/ndn-csma.cpp b/examples/ndn-csma.cpp
index cafddd5..71d1cfb 100644
--- a/examples/ndn-csma.cpp
+++ b/examples/ndn-csma.cpp
@@ -48,51 +48,51 @@
* NS_LOG=ndn.Consumer:ndn.Producer ./waf --run=ndn-csma
*/
-int
-main (int argc, char *argv[])
+int
+main(int argc, char* argv[])
{
// setting default parameters for PointToPoint links and channels
- Config::SetDefault ("ns3::CsmaChannel::DataRate", StringValue ("1Mbps"));
- Config::SetDefault ("ns3::CsmaChannel::Delay", StringValue ("10ms"));
- Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("20"));
+ Config::SetDefault("ns3::CsmaChannel::DataRate", StringValue("1Mbps"));
+ Config::SetDefault("ns3::CsmaChannel::Delay", StringValue("10ms"));
+ Config::SetDefault("ns3::DropTailQueue::MaxPackets", StringValue("20"));
// Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
CommandLine cmd;
- cmd.Parse (argc, argv);
+ cmd.Parse(argc, argv);
// Creating nodes
NodeContainer nodes;
- nodes.Create (3);
+ nodes.Create(3);
// Connecting nodes using two links
CsmaHelper csma;
- csma.Install (nodes);
+ csma.Install(nodes);
// Install NDN stack on all nodes
ndn::StackHelper ndnHelper;
- ndnHelper.SetDefaultRoutes (true);
- ndnHelper.InstallAll ();
+ ndnHelper.SetDefaultRoutes(true);
+ ndnHelper.InstallAll();
// Installing applications
// Consumer
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
// 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
+ consumerHelper.SetPrefix("/prefix");
+ consumerHelper.SetAttribute("Frequency", StringValue("10")); // 10 interests a second
+ consumerHelper.Install(nodes.Get(0)); // first node
// Producer
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
// Producer will reply to all requests starting with /prefix
- producerHelper.SetPrefix ("/prefix");
- producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
- producerHelper.Install (nodes.Get (2)); // last node
+ producerHelper.SetPrefix("/prefix");
+ producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
+ producerHelper.Install(nodes.Get(2)); // last node
- Simulator::Stop (Seconds (20.0));
+ Simulator::Stop(Seconds(20.0));
- Simulator::Run ();
- Simulator::Destroy ();
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}
diff --git a/examples/ndn-grid-topo-plugin.cpp b/examples/ndn-grid-topo-plugin.cpp
index bbb8e86..84f5f17 100644
--- a/examples/ndn-grid-topo-plugin.cpp
+++ b/examples/ndn-grid-topo-plugin.cpp
@@ -33,7 +33,7 @@
* | | |
* ( ) ------ ( ) -- (producer)
*
- * All links are 1Mbps with propagation 10ms delay.
+ * All links are 1Mbps with propagation 10ms delay.
*
* FIB is populated using NdnGlobalRoutingHelper.
*
@@ -49,52 +49,52 @@
*/
int
-main (int argc, char *argv[])
+main(int argc, char* argv[])
{
CommandLine cmd;
- cmd.Parse (argc, argv);
+ cmd.Parse(argc, argv);
- AnnotatedTopologyReader topologyReader ("", 25);
- topologyReader.SetFileName ("src/ndnSIM/examples/topologies/topo-grid-3x3.txt");
- topologyReader.Read ();
+ AnnotatedTopologyReader topologyReader("", 25);
+ topologyReader.SetFileName("src/ndnSIM/examples/topologies/topo-grid-3x3.txt");
+ topologyReader.Read();
// Install NDN stack on all nodes
ndn::StackHelper ndnHelper;
- ndnHelper.SetForwardingStrategy ("ns3::ndn::fw::BestRoute");
- ndnHelper.InstallAll ();
+ ndnHelper.SetForwardingStrategy("ns3::ndn::fw::BestRoute");
+ ndnHelper.InstallAll();
// Installing global routing interface on all nodes
ndn::GlobalRoutingHelper ndnGlobalRoutingHelper;
- ndnGlobalRoutingHelper.InstallAll ();
+ ndnGlobalRoutingHelper.InstallAll();
// Getting containers for the consumer/producer
- Ptr<Node> producer = Names::Find<Node> ("Node8");
+ Ptr<Node> producer = Names::Find<Node>("Node8");
NodeContainer consumerNodes;
- consumerNodes.Add (Names::Find<Node> ("Node0"));
+ consumerNodes.Add(Names::Find<Node>("Node0"));
// Install NDN applications
std::string prefix = "/prefix";
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
- consumerHelper.SetPrefix (prefix);
- consumerHelper.SetAttribute ("Frequency", StringValue ("100")); // 100 interests a second
- consumerHelper.Install (consumerNodes);
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
+ consumerHelper.SetPrefix(prefix);
+ consumerHelper.SetAttribute("Frequency", StringValue("100")); // 100 interests a second
+ consumerHelper.Install(consumerNodes);
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
- producerHelper.SetPrefix (prefix);
- producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
- producerHelper.Install (producer);
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
+ producerHelper.SetPrefix(prefix);
+ producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
+ producerHelper.Install(producer);
// Add /prefix origins to ndn::GlobalRouter
- ndnGlobalRoutingHelper.AddOrigins (prefix, producer);
+ ndnGlobalRoutingHelper.AddOrigins(prefix, producer);
// Calculate and install FIBs
- ndn::GlobalRoutingHelper::CalculateRoutes ();
+ ndn::GlobalRoutingHelper::CalculateRoutes();
- Simulator::Stop (Seconds (20.0));
+ Simulator::Stop(Seconds(20.0));
- Simulator::Run ();
- Simulator::Destroy ();
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}
diff --git a/examples/ndn-grid.cpp b/examples/ndn-grid.cpp
index 8b75165..d475dfd 100644
--- a/examples/ndn-grid.cpp
+++ b/examples/ndn-grid.cpp
@@ -35,7 +35,7 @@
* | | |
* ( ) ------ ( ) -- (producer)
*
- * All links are 1Mbps with propagation 10ms delay.
+ * All links are 1Mbps with propagation 10ms delay.
*
* FIB is populated using NdnGlobalRoutingHelper.
*
@@ -51,59 +51,59 @@
*/
int
-main (int argc, char *argv[])
+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 ("10"));
+ Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
+ Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
+ Config::SetDefault("ns3::DropTailQueue::MaxPackets", StringValue("10"));
// Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
CommandLine cmd;
- cmd.Parse (argc, argv);
+ cmd.Parse(argc, argv);
// Creating 3x3 topology
PointToPointHelper p2p;
- PointToPointGridHelper grid (3, 3, p2p);
- grid.BoundingBox(100,100,200,200);
+ PointToPointGridHelper grid(3, 3, p2p);
+ grid.BoundingBox(100, 100, 200, 200);
// Install NDN stack on all nodes
ndn::StackHelper ndnHelper;
- ndnHelper.SetForwardingStrategy ("ns3::ndn::fw::BestRoute");
- ndnHelper.InstallAll ();
+ ndnHelper.SetForwardingStrategy("ns3::ndn::fw::BestRoute");
+ ndnHelper.InstallAll();
// Installing global routing interface on all nodes
ndn::GlobalRoutingHelper ndnGlobalRoutingHelper;
- ndnGlobalRoutingHelper.InstallAll ();
+ ndnGlobalRoutingHelper.InstallAll();
// Getting containers for the consumer/producer
- Ptr<Node> producer = grid.GetNode (2, 2);
+ Ptr<Node> producer = grid.GetNode(2, 2);
NodeContainer consumerNodes;
- consumerNodes.Add (grid.GetNode (0,0));
+ consumerNodes.Add(grid.GetNode(0, 0));
// Install NDN applications
std::string prefix = "/prefix";
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
- consumerHelper.SetPrefix (prefix);
- consumerHelper.SetAttribute ("Frequency", StringValue ("100")); // 100 interests a second
- consumerHelper.Install (consumerNodes);
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
+ consumerHelper.SetPrefix(prefix);
+ consumerHelper.SetAttribute("Frequency", StringValue("100")); // 100 interests a second
+ consumerHelper.Install(consumerNodes);
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
- producerHelper.SetPrefix (prefix);
- producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
- producerHelper.Install (producer);
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
+ producerHelper.SetPrefix(prefix);
+ producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
+ producerHelper.Install(producer);
// Add /prefix origins to ndn::GlobalRouter
- ndnGlobalRoutingHelper.AddOrigins (prefix, producer);
+ ndnGlobalRoutingHelper.AddOrigins(prefix, producer);
// Calculate and install FIBs
- ndn::GlobalRoutingHelper::CalculateRoutes ();
+ ndn::GlobalRoutingHelper::CalculateRoutes();
- Simulator::Stop (Seconds (20.0));
+ Simulator::Stop(Seconds(20.0));
- Simulator::Run ();
- Simulator::Destroy ();
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}
diff --git a/examples/ndn-simple-wifi.cpp b/examples/ndn-simple-wifi.cpp
index db54c93..a2b083f 100644
--- a/examples/ndn-simple-wifi.cpp
+++ b/examples/ndn-simple-wifi.cpp
@@ -30,10 +30,11 @@
using namespace std;
using namespace ns3;
-NS_LOG_COMPONENT_DEFINE ("ndn.WifiExample");
+NS_LOG_COMPONENT_DEFINE("ndn.WifiExample");
//
-// DISCLAIMER: Note that this is an extremely simple example, containing just 2 wifi nodes communicating
+// DISCLAIMER: Note that this is an extremely simple example, containing just 2 wifi nodes
+// communicating
// directly over AdHoc channel.
//
@@ -47,90 +48,89 @@
// }
int
-main (int argc, char *argv[])
+main(int argc, char* argv[])
{
// disable fragmentation
- Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));
- Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("2200"));
- Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode", StringValue ("OfdmRate24Mbps"));
+ Config::SetDefault("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue("2200"));
+ Config::SetDefault("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue("2200"));
+ Config::SetDefault("ns3::WifiRemoteStationManager::NonUnicastMode",
+ StringValue("OfdmRate24Mbps"));
CommandLine cmd;
- cmd.Parse (argc,argv);
+ cmd.Parse(argc, argv);
//////////////////////
//////////////////////
//////////////////////
- WifiHelper wifi = WifiHelper::Default ();
+ WifiHelper wifi = WifiHelper::Default();
// wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
- wifi.SetStandard (WIFI_PHY_STANDARD_80211a);
- wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
- "DataMode", StringValue ("OfdmRate24Mbps"));
+ wifi.SetStandard(WIFI_PHY_STANDARD_80211a);
+ wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", "DataMode",
+ StringValue("OfdmRate24Mbps"));
- YansWifiChannelHelper wifiChannel;// = YansWifiChannelHelper::Default ();
- wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
- wifiChannel.AddPropagationLoss ("ns3::ThreeLogDistancePropagationLossModel");
- wifiChannel.AddPropagationLoss ("ns3::NakagamiPropagationLossModel");
+ YansWifiChannelHelper wifiChannel; // = YansWifiChannelHelper::Default ();
+ wifiChannel.SetPropagationDelay("ns3::ConstantSpeedPropagationDelayModel");
+ wifiChannel.AddPropagationLoss("ns3::ThreeLogDistancePropagationLossModel");
+ wifiChannel.AddPropagationLoss("ns3::NakagamiPropagationLossModel");
- //YansWifiPhy wifiPhy = YansWifiPhy::Default();
- YansWifiPhyHelper wifiPhyHelper = YansWifiPhyHelper::Default ();
- wifiPhyHelper.SetChannel (wifiChannel.Create ());
+ // YansWifiPhy wifiPhy = YansWifiPhy::Default();
+ YansWifiPhyHelper wifiPhyHelper = YansWifiPhyHelper::Default();
+ wifiPhyHelper.SetChannel(wifiChannel.Create());
wifiPhyHelper.Set("TxPowerStart", DoubleValue(5));
wifiPhyHelper.Set("TxPowerEnd", DoubleValue(5));
-
- NqosWifiMacHelper wifiMacHelper = NqosWifiMacHelper::Default ();
+ NqosWifiMacHelper wifiMacHelper = NqosWifiMacHelper::Default();
wifiMacHelper.SetType("ns3::AdhocWifiMac");
- Ptr<UniformRandomVariable> randomizer = CreateObject<UniformRandomVariable> ();
- randomizer->SetAttribute ("Min", DoubleValue (10));
- randomizer->SetAttribute ("Max", DoubleValue (100));
+ Ptr<UniformRandomVariable> randomizer = CreateObject<UniformRandomVariable>();
+ randomizer->SetAttribute("Min", DoubleValue(10));
+ randomizer->SetAttribute("Max", DoubleValue(100));
MobilityHelper mobility;
- mobility.SetPositionAllocator ("ns3::RandomBoxPositionAllocator",
- "X", PointerValue (randomizer),
- "Y", PointerValue (randomizer),
- "Z", PointerValue (randomizer));
+ mobility.SetPositionAllocator("ns3::RandomBoxPositionAllocator", "X", PointerValue(randomizer),
+ "Y", PointerValue(randomizer), "Z", PointerValue(randomizer));
- mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
+ mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
NodeContainer nodes;
- nodes.Create (2);
+ nodes.Create(2);
////////////////
// 1. Install Wifi
- NetDeviceContainer wifiNetDevices = wifi.Install (wifiPhyHelper, wifiMacHelper, nodes);
+ NetDeviceContainer wifiNetDevices = wifi.Install(wifiPhyHelper, wifiMacHelper, nodes);
// 2. Install Mobility model
- mobility.Install (nodes);
+ mobility.Install(nodes);
// 3. Install NDN stack
- NS_LOG_INFO ("Installing NDN stack");
+ NS_LOG_INFO("Installing NDN stack");
ndn::StackHelper ndnHelper;
- // ndnHelper.AddNetDeviceFaceCreateCallback (WifiNetDevice::GetTypeId (), MakeCallback (MyNetDeviceFaceCallback));
- ndnHelper.SetForwardingStrategy ("ns3::ndn::fw::BestRoute");
- ndnHelper.SetContentStore ("ns3::ndn::cs::Lru", "MaxSize", "1000");
- ndnHelper.SetDefaultRoutes (true);
- ndnHelper.Install (nodes);
+ // ndnHelper.AddNetDeviceFaceCreateCallback (WifiNetDevice::GetTypeId (), MakeCallback
+ // (MyNetDeviceFaceCallback));
+ ndnHelper.SetForwardingStrategy("ns3::ndn::fw::BestRoute");
+ ndnHelper.SetContentStore("ns3::ndn::cs::Lru", "MaxSize", "1000");
+ ndnHelper.SetDefaultRoutes(true);
+ ndnHelper.Install(nodes);
// 4. Set up applications
- NS_LOG_INFO ("Installing Applications");
+ NS_LOG_INFO("Installing Applications");
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
- consumerHelper.SetPrefix ("/test/prefix");
- consumerHelper.SetAttribute ("Frequency", DoubleValue (10.0));
- consumerHelper.Install (nodes.Get (0));
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
+ consumerHelper.SetPrefix("/test/prefix");
+ consumerHelper.SetAttribute("Frequency", DoubleValue(10.0));
+ consumerHelper.Install(nodes.Get(0));
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
- producerHelper.SetPrefix ("/");
- producerHelper.SetAttribute ("PayloadSize", StringValue("1200"));
- producerHelper.Install (nodes.Get (1));
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
+ producerHelper.SetPrefix("/");
+ producerHelper.SetAttribute("PayloadSize", StringValue("1200"));
+ producerHelper.Install(nodes.Get(1));
////////////////
- Simulator::Stop (Seconds (30.0));
+ Simulator::Stop(Seconds(30.0));
- Simulator::Run ();
- Simulator::Destroy ();
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}
diff --git a/examples/ndn-simple-with-cs-lfu.cpp b/examples/ndn-simple-with-cs-lfu.cpp
index 4025763..d22a549 100644
--- a/examples/ndn-simple-with-cs-lfu.cpp
+++ b/examples/ndn-simple-with-cs-lfu.cpp
@@ -36,32 +36,40 @@
* | consumer | <------------> | router | <------------> | producer |
* +----------+ 10ms +--------+ 10ms +----------+
*
- * This scenario demonstrates how to use content store that responds to Freshness parameter set in Datas.
- * That is, if producer set Freshness field to 2 seconds, the corresponding content object will not be cached
+ * This scenario demonstrates how to use content store that responds to Freshness parameter set in
+ *Datas.
+ * That is, if producer set Freshness field to 2 seconds, the corresponding content object will not
+ *be cached
* more than 2 seconds (can be cached for a shorter time, if entry is evicted earlier)
*
* NS_LOG=ndn.Consumer ./waf --run ndn-simple-with-cs-lfu
*/
-void PrintCsMemStatsHeader (std::ostream &os)
+void
+PrintCsMemStatsHeader(std::ostream& os)
{
- os << "SimulationTime" << "\t"
- << "RealTime" << "\t"
+ os << "SimulationTime"
+ << "\t"
+ << "RealTime"
+ << "\t"
// << "NumberOfProcessedData" << "\t"
// << "NumberOfProcessedInterests" << "\t"
- << "NumberPitEntries" << "\t"
- << "NumberCsEntries" << "\t"
- << "MemUsage" << "\n";
+ << "NumberPitEntries"
+ << "\t"
+ << "NumberCsEntries"
+ << "\t"
+ << "MemUsage"
+ << "\n";
}
void
-PrintCsMemStats (std::ostream &os, Time nextPrintTime, double beginRealTime)
+PrintCsMemStats(std::ostream& os, Time nextPrintTime, double beginRealTime)
{
::timeval t;
gettimeofday(&t, NULL);
double realTime = t.tv_sec + (0.000001 * (unsigned)t.tv_usec) - beginRealTime;
- os << Simulator::Now ().ToDouble (Time::S) << "\t";
+ os << Simulator::Now().ToDouble(Time::S) << "\t";
os << realTime << "\t";
// os << ndn::L3Protocol::GetDataCounter () << "\t";
@@ -69,91 +77,90 @@
uint64_t pitCount = 0;
uint64_t csCount = 0;
- for (NodeList::Iterator node = NodeList::Begin ();
- node != NodeList::End ();
- node ++)
- {
- Ptr<ndn::Pit> pit = (*node)->GetObject<ndn::Pit> ();
- Ptr<ndn::ContentStore> cs = (*node)->GetObject<ndn::ContentStore> ();
+ for (NodeList::Iterator node = NodeList::Begin(); node != NodeList::End(); node++) {
+ Ptr<ndn::Pit> pit = (*node)->GetObject<ndn::Pit>();
+ Ptr<ndn::ContentStore> cs = (*node)->GetObject<ndn::ContentStore>();
- if (pit != 0)
- pitCount += pit->GetSize ();
+ if (pit != 0)
+ pitCount += pit->GetSize();
- if (cs != 0)
- csCount += cs->GetSize ();
- }
+ if (cs != 0)
+ csCount += cs->GetSize();
+ }
os << pitCount << "\t";
os << csCount << "\t";
- os << MemUsage::Get () / 1024.0 / 1024.0 << "\n";
+ os << MemUsage::Get() / 1024.0 / 1024.0 << "\n";
- Simulator::Schedule (nextPrintTime, PrintCsMemStats, boost::ref (os), nextPrintTime, beginRealTime);
+ Simulator::Schedule(nextPrintTime, PrintCsMemStats, boost::ref(os), nextPrintTime, beginRealTime);
}
int
-main (int argc, char *argv[])
+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::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
+ Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
+ Config::SetDefault("ns3::DropTailQueue::MaxPackets", StringValue("20"));
// Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
CommandLine cmd;
- cmd.Parse (argc, argv);
+ cmd.Parse(argc, argv);
// Creating nodes
NodeContainer nodes;
- nodes.Create (3);
+ 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));
+ p2p.Install(nodes.Get(0), nodes.Get(1));
+ p2p.Install(nodes.Get(1), nodes.Get(2));
// Install CCNx stack on all nodes
ndn::StackHelper ccnxHelper;
- ccnxHelper.SetDefaultRoutes (true);
+ ccnxHelper.SetDefaultRoutes(true);
// node 0: disable cache completely
- ccnxHelper.SetContentStore ("ns3::ndn::cs::Nocache"); // disable cache
- ccnxHelper.Install (nodes.Get (0));
+ ccnxHelper.SetContentStore("ns3::ndn::cs::Nocache"); // disable cache
+ ccnxHelper.Install(nodes.Get(0));
// node 1 and 2: set cache with Lfu policy
- ccnxHelper.SetContentStore ("ns3::ndn::cs::Freshness::Lfu", "MaxSize", "2"); // can set cache size this way
- ccnxHelper.Install (nodes.Get (1));
- ccnxHelper.Install (nodes.Get (2));
+ ccnxHelper.SetContentStore("ns3::ndn::cs::Freshness::Lfu", "MaxSize",
+ "2"); // can set cache size this way
+ ccnxHelper.Install(nodes.Get(1));
+ ccnxHelper.Install(nodes.Get(2));
// alternative way to configure cache size
// [number after nodeList is global ID of the node (= node->GetId ())]
- Config::Set ("/NodeList/2/$ns3::ndn::ContentStore/MaxSize", UintegerValue (100000));
+ Config::Set("/NodeList/2/$ns3::ndn::ContentStore/MaxSize", UintegerValue(100000));
// Installing applications
// Consumer
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
// 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
+ consumerHelper.SetPrefix("/prefix");
+ consumerHelper.SetAttribute("Frequency", StringValue("10")); // 10 interests a second
+ consumerHelper.Install(nodes.Get(0)); // first node
// Producer
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
// Producer will reply to all requests starting with /prefix
- producerHelper.SetPrefix ("/prefix");
- producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
- producerHelper.Install (nodes.Get (2)); // last node
+ producerHelper.SetPrefix("/prefix");
+ producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
+ producerHelper.Install(nodes.Get(2)); // last node
- Simulator::Stop (Seconds (200000.0));
+ Simulator::Stop(Seconds(200000.0));
struct ::timeval t;
gettimeofday(&t, NULL);
double beginRealTime = t.tv_sec + (0.000001 * (unsigned)t.tv_usec);
- Simulator::Schedule (Seconds (0), PrintCsMemStatsHeader, boost::ref (std::cout));
- Simulator::Schedule (Seconds (100), PrintCsMemStats, boost::ref (std::cout), Seconds (100), beginRealTime);
+ Simulator::Schedule(Seconds(0), PrintCsMemStatsHeader, boost::ref(std::cout));
+ Simulator::Schedule(Seconds(100), PrintCsMemStats, boost::ref(std::cout), Seconds(100),
+ beginRealTime);
- Simulator::Run ();
- Simulator::Destroy ();
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}
diff --git a/examples/ndn-simple-with-custom-app.cpp b/examples/ndn-simple-with-custom-app.cpp
index 2c9d1b9..c10ceaa 100644
--- a/examples/ndn-simple-with-custom-app.cpp
+++ b/examples/ndn-simple-with-custom-app.cpp
@@ -29,41 +29,43 @@
/**
* This scenario simulates a one-node two-app scenario:
*
- * +------+ <-----> (CustomApp1)
- * | Node |
+ * +------+ <-----> (CustomApp1)
+ * | Node |
* +------+ <-----> (CustomApp2)
*
* NS_LOG=CustomApp ./waf --run=ndn-simple-with-custom-app
*/
-int
-main (int argc, char *argv[])
+int
+main(int argc, char* argv[])
{
// Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
CommandLine cmd;
- cmd.Parse (argc, argv);
+ cmd.Parse(argc, argv);
// Creating nodes
- Ptr<Node> node = CreateObject<Node> ();
+ Ptr<Node> node = CreateObject<Node>();
// Install CCNx stack on all nodes
ndn::StackHelper ccnxHelper;
- ccnxHelper.InstallAll ();
+ ccnxHelper.InstallAll();
// Installing applications
// Consumer
- ndn::AppHelper consumerHelper ("CustomApp");
- ApplicationContainer app1 = consumerHelper.Install (node);
- ApplicationContainer app2 = consumerHelper.Install (node);
+ ndn::AppHelper consumerHelper("CustomApp");
+ ApplicationContainer app1 = consumerHelper.Install(node);
+ ApplicationContainer app2 = consumerHelper.Install(node);
- app1.Start (Seconds (1.0)); // will send out Interest, which nobody will receive (Interests generated by an app will not got back to the app)
- app2.Start (Seconds (2.0)); // will send out an Interests, which will be received and satisfied by app1
-
- Simulator::Stop (Seconds (3.0));
+ app1.Start(Seconds(1.0)); // will send out Interest, which nobody will receive (Interests
+ // generated by an app will not got back to the app)
+ app2.Start(
+ Seconds(2.0)); // will send out an Interests, which will be received and satisfied by app1
- Simulator::Run ();
- Simulator::Destroy ();
+ Simulator::Stop(Seconds(3.0));
+
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}
diff --git a/examples/ndn-simple-with-link-failure.cpp b/examples/ndn-simple-with-link-failure.cpp
index c96103d..c020a36 100644
--- a/examples/ndn-simple-with-link-failure.cpp
+++ b/examples/ndn-simple-with-link-failure.cpp
@@ -49,56 +49,56 @@
* NS_LOG=ndn.Consumer:ndn.Producer ./waf --run=ndn-simple
*/
-int
-main (int argc, char *argv[])
+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::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
+ Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
+ Config::SetDefault("ns3::DropTailQueue::MaxPackets", StringValue("20"));
// Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
CommandLine cmd;
- cmd.Parse (argc, argv);
+ cmd.Parse(argc, argv);
// Creating nodes
NodeContainer nodes;
- nodes.Create (3);
+ 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));
+ p2p.Install(nodes.Get(0), nodes.Get(1));
+ p2p.Install(nodes.Get(1), nodes.Get(2));
// Install NDN stack on all nodes
ndn::StackHelper ndnHelper;
- ndnHelper.SetDefaultRoutes (true);
- ndnHelper.InstallAll ();
+ ndnHelper.SetDefaultRoutes(true);
+ ndnHelper.InstallAll();
// Installing applications
// Consumer
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
// 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
+ consumerHelper.SetPrefix("/prefix");
+ consumerHelper.SetAttribute("Frequency", StringValue("10")); // 10 interests a second
+ consumerHelper.Install(nodes.Get(0)); // first node
// Producer
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
// Producer will reply to all requests starting with /prefix
- producerHelper.SetPrefix ("/prefix");
- producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
- producerHelper.Install (nodes.Get (2)); // last node
+ producerHelper.SetPrefix("/prefix");
+ producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
+ producerHelper.Install(nodes.Get(2)); // last node
// The failure of the link connecting consumer and router will start from seconds 10.0 to 15.0
- Simulator::Schedule (Seconds (10.0), ndn::LinkControlHelper::FailLink, nodes.Get (0), nodes.Get (1));
- Simulator::Schedule (Seconds (15.0), ndn::LinkControlHelper::UpLink, nodes.Get (0), nodes.Get (1));
-
- Simulator::Stop (Seconds (20.0));
+ Simulator::Schedule(Seconds(10.0), ndn::LinkControlHelper::FailLink, nodes.Get(0), nodes.Get(1));
+ Simulator::Schedule(Seconds(15.0), ndn::LinkControlHelper::UpLink, nodes.Get(0), nodes.Get(1));
- Simulator::Run ();
- Simulator::Destroy ();
+ Simulator::Stop(Seconds(20.0));
+
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}
diff --git a/examples/ndn-simple-with-pcap.cpp b/examples/ndn-simple-with-pcap.cpp
index 1e35fb0..ecbc8eb 100644
--- a/examples/ndn-simple-with-pcap.cpp
+++ b/examples/ndn-simple-with-pcap.cpp
@@ -25,84 +25,81 @@
using namespace ns3;
-class PcapWriter
-{
+class PcapWriter {
public:
- PcapWriter (const std::string &file)
+ PcapWriter(const std::string& file)
{
PcapHelper helper;
- m_pcap = helper.CreateFile (file, std::ios::out, PcapHelper::DLT_PPP);
+ m_pcap = helper.CreateFile(file, std::ios::out, PcapHelper::DLT_PPP);
}
void
- TracePacket (Ptr<const Packet> packet)
+ TracePacket(Ptr<const Packet> packet)
{
static PppHeader pppHeader;
- pppHeader.SetProtocol (0x0077);
+ pppHeader.SetProtocol(0x0077);
- m_pcap->Write (Simulator::Now (), pppHeader, packet);
+ m_pcap->Write(Simulator::Now(), pppHeader, packet);
}
private:
Ptr<PcapFileWrapper> m_pcap;
};
-
int
-main (int argc, char *argv[])
+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::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
+ Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
+ Config::SetDefault("ns3::DropTailQueue::MaxPackets", StringValue("20"));
- Config::SetGlobal ("ndn::WireFormat", StringValue ("1"));
+ Config::SetGlobal("ndn::WireFormat", StringValue("1"));
// Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
CommandLine cmd;
- cmd.Parse (argc, argv);
-
+ cmd.Parse(argc, argv);
+
// Creating nodes
NodeContainer nodes;
- nodes.Create (3);
+ 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));
+ p2p.Install(nodes.Get(0), nodes.Get(1));
+ p2p.Install(nodes.Get(1), nodes.Get(2));
// Install NDN stack on all nodes
ndn::StackHelper ndnHelper;
- ndnHelper.SetDefaultRoutes (true);
- ndnHelper.InstallAll ();
+ ndnHelper.SetDefaultRoutes(true);
+ ndnHelper.InstallAll();
// Installing applications
// Consumer
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
// 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
+ consumerHelper.SetPrefix("/prefix");
+ consumerHelper.SetAttribute("Frequency", StringValue("10")); // 10 interests a second
+ consumerHelper.Install(nodes.Get(0)); // first node
// Producer
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
// Producer will reply to all requests starting with /prefix
- producerHelper.SetPrefix ("/prefix");
- producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
- producerHelper.SetAttribute ("Signature", UintegerValue (100));
- producerHelper.SetAttribute ("KeyLocator", StringValue ("/unique/key/locator"));
- producerHelper.Install (nodes.Get (2)); // last node
+ producerHelper.SetPrefix("/prefix");
+ producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
+ producerHelper.SetAttribute("Signature", UintegerValue(100));
+ producerHelper.SetAttribute("KeyLocator", StringValue("/unique/key/locator"));
+ producerHelper.Install(nodes.Get(2)); // last node
- PcapWriter trace ("ndn-simple-trace.pcap");
- Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/MacTx",
- MakeCallback (&PcapWriter::TracePacket, &trace));
+ PcapWriter trace("ndn-simple-trace.pcap");
+ Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/MacTx",
+ MakeCallback(&PcapWriter::TracePacket, &trace));
- Simulator::Stop (Seconds (20.0));
+ Simulator::Stop(Seconds(20.0));
- Simulator::Run ();
- Simulator::Destroy ();
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}
-
diff --git a/examples/ndn-simple.cpp b/examples/ndn-simple.cpp
index dea70a0..b7755e8 100644
--- a/examples/ndn-simple.cpp
+++ b/examples/ndn-simple.cpp
@@ -45,52 +45,52 @@
* NS_LOG=ndn.Consumer:ndn.Producer ./waf --run=ndn-simple
*/
-int
-main (int argc, char *argv[])
+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::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
+ Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
+ Config::SetDefault("ns3::DropTailQueue::MaxPackets", StringValue("20"));
// Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
CommandLine cmd;
- cmd.Parse (argc, argv);
+ cmd.Parse(argc, argv);
// Creating nodes
NodeContainer nodes;
- nodes.Create (3);
+ 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));
+ p2p.Install(nodes.Get(0), nodes.Get(1));
+ p2p.Install(nodes.Get(1), nodes.Get(2));
// Install NDN stack on all nodes
ndn::StackHelper ndnHelper;
- ndnHelper.SetDefaultRoutes (true);
- ndnHelper.InstallAll ();
+ ndnHelper.SetDefaultRoutes(true);
+ ndnHelper.InstallAll();
// Installing applications
// Consumer
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
// 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
+ consumerHelper.SetPrefix("/prefix");
+ consumerHelper.SetAttribute("Frequency", StringValue("10")); // 10 interests a second
+ consumerHelper.Install(nodes.Get(0)); // first node
// Producer
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
// Producer will reply to all requests starting with /prefix
- producerHelper.SetPrefix ("/prefix");
- producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
- producerHelper.Install (nodes.Get (2)); // last node
+ producerHelper.SetPrefix("/prefix");
+ producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
+ producerHelper.Install(nodes.Get(2)); // last node
- Simulator::Stop (Seconds (20.0));
+ Simulator::Stop(Seconds(20.0));
- Simulator::Run ();
- Simulator::Destroy ();
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}
diff --git a/examples/ndn-tree-app-delay-tracer.cpp b/examples/ndn-tree-app-delay-tracer.cpp
index b4563a9..b503843 100644
--- a/examples/ndn-tree-app-delay-tracer.cpp
+++ b/examples/ndn-tree-app-delay-tracer.cpp
@@ -32,21 +32,21 @@
* /------\ /------\ /------\ /------\
* |leaf-1| |leaf-2| |leaf-3| |leaf-4|
* \------/ \------/ \------/ \------/
- * ^ ^ ^ ^
+ * ^ ^ ^ ^
* | | | |
- * \ / \ /
+ * \ / \ /
* \ / \ / 10Mbps / 1ms
* \ / \ /
- * | | | |
- * v v v v
+ * | | | |
+ * v v v v
* /-------\ /-------\
* | rtr-1 | | rtr-2 |
* \-------/ \-------/
- * ^ ^
+ * ^ ^
* | |
- * \ / 10 Mpbs / 1ms
- * +--------+ +--------+
- * | |
+ * \ / 10 Mpbs / 1ms
+ * +--------+ +--------+
+ * | |
* v v
* /--------\
* | root |
@@ -59,59 +59,58 @@
*/
int
-main (int argc, char *argv[])
+main(int argc, char* argv[])
{
CommandLine cmd;
- cmd.Parse (argc, argv);
+ cmd.Parse(argc, argv);
- AnnotatedTopologyReader topologyReader ("", 1);
- topologyReader.SetFileName ("src/ndnSIM/examples/topologies/topo-tree.txt");
- topologyReader.Read ();
+ AnnotatedTopologyReader topologyReader("", 1);
+ topologyReader.SetFileName("src/ndnSIM/examples/topologies/topo-tree.txt");
+ topologyReader.Read();
// Install CCNx stack on all nodes
ndn::StackHelper ndnHelper;
- ndnHelper.SetForwardingStrategy ("ns3::ndn::fw::BestRoute");
- ndnHelper.InstallAll ();
+ ndnHelper.SetForwardingStrategy("ns3::ndn::fw::BestRoute");
+ ndnHelper.InstallAll();
// Installing global routing interface on all nodes
ndn::GlobalRoutingHelper ccnxGlobalRoutingHelper;
- ccnxGlobalRoutingHelper.InstallAll ();
+ ccnxGlobalRoutingHelper.InstallAll();
// Getting containers for the consumer/producer
- Ptr<Node> consumers[4] = { Names::Find<Node> ("leaf-1"), Names::Find<Node> ("leaf-2"),
- Names::Find<Node> ("leaf-3"), Names::Find<Node> ("leaf-4") };
- Ptr<Node> producer = Names::Find<Node> ("root");
-
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerBatches");
- consumerHelper.SetPrefix ("/root");
- consumerHelper.SetAttribute ("Batches", StringValue ("1s 1 10s 1"));
- consumerHelper.Install (consumers[0]);
+ Ptr<Node> consumers[4] = {Names::Find<Node>("leaf-1"), Names::Find<Node>("leaf-2"),
+ Names::Find<Node>("leaf-3"), Names::Find<Node>("leaf-4")};
+ Ptr<Node> producer = Names::Find<Node>("root");
- consumerHelper.SetAttribute ("Batches", StringValue ("11s 1"));
- consumerHelper.Install (consumers[1]);
-
- consumerHelper.SetAttribute ("Batches", StringValue ("11s 1"));
- consumerHelper.Install (consumers[2]);
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerBatches");
+ consumerHelper.SetPrefix("/root");
+ consumerHelper.SetAttribute("Batches", StringValue("1s 1 10s 1"));
+ consumerHelper.Install(consumers[0]);
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
- producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
+ consumerHelper.SetAttribute("Batches", StringValue("11s 1"));
+ consumerHelper.Install(consumers[1]);
+
+ consumerHelper.SetAttribute("Batches", StringValue("11s 1"));
+ consumerHelper.Install(consumers[2]);
+
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
+ producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
// Register /root prefix with global routing controller and
// install producer that will satisfy Interests in /root namespace
- ccnxGlobalRoutingHelper.AddOrigins ("/root", producer);
- producerHelper.SetPrefix ("/root");
- producerHelper.Install (producer)
- .Start (Seconds (9));
+ ccnxGlobalRoutingHelper.AddOrigins("/root", producer);
+ producerHelper.SetPrefix("/root");
+ producerHelper.Install(producer).Start(Seconds(9));
// Calculate and install FIBs
- ccnxGlobalRoutingHelper.CalculateRoutes ();
+ ccnxGlobalRoutingHelper.CalculateRoutes();
- Simulator::Stop (Seconds (20.0));
+ Simulator::Stop(Seconds(20.0));
- ndn::AppDelayTracer::InstallAll ("app-delays-trace.txt");
-
- Simulator::Run ();
- Simulator::Destroy ();
+ ndn::AppDelayTracer::InstallAll("app-delays-trace.txt");
+
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}
diff --git a/examples/ndn-tree-cs-tracers.cpp b/examples/ndn-tree-cs-tracers.cpp
index eaa5bf9..ce27888 100644
--- a/examples/ndn-tree-cs-tracers.cpp
+++ b/examples/ndn-tree-cs-tracers.cpp
@@ -32,21 +32,21 @@
* /------\ /------\ /------\ /------\
* |leaf-1| |leaf-2| |leaf-3| |leaf-4|
* \------/ \------/ \------/ \------/
- * ^ ^ ^ ^
+ * ^ ^ ^ ^
* | | | |
- * \ / \ /
+ * \ / \ /
* \ / \ / 10Mbps / 1ms
* \ / \ /
- * | | | |
- * v v v v
+ * | | | |
+ * v v v v
* /-------\ /-------\
* | rtr-1 | | rtr-2 |
* \-------/ \-------/
- * ^ ^
+ * ^ ^
* | |
- * \ / 10 Mpbs / 1ms
- * +--------+ +--------+
- * | |
+ * \ / 10 Mpbs / 1ms
+ * +--------+ +--------+
+ * | |
* v v
* /--------\
* | root |
@@ -59,59 +59,59 @@
*/
int
-main (int argc, char *argv[])
+main(int argc, char* argv[])
{
CommandLine cmd;
- cmd.Parse (argc, argv);
+ cmd.Parse(argc, argv);
- AnnotatedTopologyReader topologyReader ("", 1);
- topologyReader.SetFileName ("src/ndnSIM/examples/topologies/topo-tree.txt");
- topologyReader.Read ();
+ AnnotatedTopologyReader topologyReader("", 1);
+ topologyReader.SetFileName("src/ndnSIM/examples/topologies/topo-tree.txt");
+ topologyReader.Read();
// Install CCNx stack on all nodes
ndn::StackHelper ndnHelper;
- ndnHelper.SetForwardingStrategy ("ns3::ndn::fw::BestRoute");
- ndnHelper.SetContentStore ("ns3::ndn::cs::Lru", "MaxSize", "100"); // default ContentStore parameters
- ndnHelper.InstallAll ();
+ ndnHelper.SetForwardingStrategy("ns3::ndn::fw::BestRoute");
+ ndnHelper.SetContentStore("ns3::ndn::cs::Lru", "MaxSize",
+ "100"); // default ContentStore parameters
+ ndnHelper.InstallAll();
// Installing global routing interface on all nodes
ndn::GlobalRoutingHelper ccnxGlobalRoutingHelper;
- ccnxGlobalRoutingHelper.InstallAll ();
+ ccnxGlobalRoutingHelper.InstallAll();
// Getting containers for the consumer/producer
- Ptr<Node> consumers[4] = { Names::Find<Node> ("leaf-1"), Names::Find<Node> ("leaf-2"),
- Names::Find<Node> ("leaf-3"), Names::Find<Node> ("leaf-4") };
- Ptr<Node> producer = Names::Find<Node> ("root");
+ Ptr<Node> consumers[4] = {Names::Find<Node>("leaf-1"), Names::Find<Node>("leaf-2"),
+ Names::Find<Node>("leaf-3"), Names::Find<Node>("leaf-4")};
+ Ptr<Node> producer = Names::Find<Node>("root");
- for (int i = 0; i < 4; i++)
- {
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
- consumerHelper.SetAttribute ("Frequency", StringValue ("10")); // 100 interests a second
+ for (int i = 0; i < 4; i++) {
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
+ consumerHelper.SetAttribute("Frequency", StringValue("10")); // 100 interests a second
- // Each consumer will express the same data /root/<seq-no>
- consumerHelper.SetPrefix ("/root");
- ApplicationContainer app = consumerHelper.Install (consumers[i]);
- app.Start (Seconds (0.01 * i));
- }
-
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
- producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
+ // Each consumer will express the same data /root/<seq-no>
+ consumerHelper.SetPrefix("/root");
+ ApplicationContainer app = consumerHelper.Install(consumers[i]);
+ app.Start(Seconds(0.01 * i));
+ }
+
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
+ producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
// Register /root prefix with global routing controller and
// install producer that will satisfy Interests in /root namespace
- ccnxGlobalRoutingHelper.AddOrigins ("/root", producer);
- producerHelper.SetPrefix ("/root");
- producerHelper.Install (producer);
+ ccnxGlobalRoutingHelper.AddOrigins("/root", producer);
+ producerHelper.SetPrefix("/root");
+ producerHelper.Install(producer);
// Calculate and install FIBs
- ccnxGlobalRoutingHelper.CalculateRoutes ();
+ ccnxGlobalRoutingHelper.CalculateRoutes();
- Simulator::Stop (Seconds (20.0));
+ Simulator::Stop(Seconds(20.0));
- ndn::CsTracer::InstallAll ("cs-trace.txt", Seconds (1));
-
- Simulator::Run ();
- Simulator::Destroy ();
+ ndn::CsTracer::InstallAll("cs-trace.txt", Seconds(1));
+
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}
diff --git a/examples/ndn-tree-tracers.cpp b/examples/ndn-tree-tracers.cpp
index aeb65f9..29772f7 100644
--- a/examples/ndn-tree-tracers.cpp
+++ b/examples/ndn-tree-tracers.cpp
@@ -32,21 +32,21 @@
* /------\ /------\ /------\ /------\
* |leaf-1| |leaf-2| |leaf-3| |leaf-4|
* \------/ \------/ \------/ \------/
- * ^ ^ ^ ^
+ * ^ ^ ^ ^
* | | | |
- * \ / \ /
+ * \ / \ /
* \ / \ / 10Mbps / 1ms
* \ / \ /
- * | | | |
- * v v v v
+ * | | | |
+ * v v v v
* /-------\ /-------\
* | rtr-1 | | rtr-2 |
* \-------/ \-------/
- * ^ ^
+ * ^ ^
* | |
- * \ / 10 Mpbs / 1ms
- * +--------+ +--------+
- * | |
+ * \ / 10 Mpbs / 1ms
+ * +--------+ +--------+
+ * | |
* v v
* /--------\
* | root |
@@ -59,58 +59,57 @@
*/
int
-main (int argc, char *argv[])
+main(int argc, char* argv[])
{
CommandLine cmd;
- cmd.Parse (argc, argv);
+ cmd.Parse(argc, argv);
- AnnotatedTopologyReader topologyReader ("", 1);
- topologyReader.SetFileName ("src/ndnSIM/examples/topologies/topo-tree.txt");
- topologyReader.Read ();
+ AnnotatedTopologyReader topologyReader("", 1);
+ topologyReader.SetFileName("src/ndnSIM/examples/topologies/topo-tree.txt");
+ topologyReader.Read();
// Install CCNx stack on all nodes
ndn::StackHelper ccnxHelper;
- ccnxHelper.SetForwardingStrategy ("ns3::ndn::fw::BestRoute");
- ccnxHelper.InstallAll ();
+ ccnxHelper.SetForwardingStrategy("ns3::ndn::fw::BestRoute");
+ ccnxHelper.InstallAll();
// Installing global routing interface on all nodes
ndn::GlobalRoutingHelper ccnxGlobalRoutingHelper;
- ccnxGlobalRoutingHelper.InstallAll ();
+ ccnxGlobalRoutingHelper.InstallAll();
// Getting containers for the consumer/producer
- Ptr<Node> consumers[4] = { Names::Find<Node> ("leaf-1"), Names::Find<Node> ("leaf-2"),
- Names::Find<Node> ("leaf-3"), Names::Find<Node> ("leaf-4") };
- Ptr<Node> producer = Names::Find<Node> ("root");
+ Ptr<Node> consumers[4] = {Names::Find<Node>("leaf-1"), Names::Find<Node>("leaf-2"),
+ Names::Find<Node>("leaf-3"), Names::Find<Node>("leaf-4")};
+ Ptr<Node> producer = Names::Find<Node>("root");
- for (int i = 0; i < 4; i++)
- {
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
- consumerHelper.SetAttribute ("Frequency", StringValue ("100")); // 100 interests a second
+ for (int i = 0; i < 4; i++) {
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
+ consumerHelper.SetAttribute("Frequency", StringValue("100")); // 100 interests a second
- // Each consumer will express unique interests /root/<leaf-name>/<seq-no>
- consumerHelper.SetPrefix ("/root/" + Names::FindName (consumers[i]));
- consumerHelper.Install (consumers[i]);
- }
-
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
- producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
+ // Each consumer will express unique interests /root/<leaf-name>/<seq-no>
+ consumerHelper.SetPrefix("/root/" + Names::FindName(consumers[i]));
+ consumerHelper.Install(consumers[i]);
+ }
+
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
+ producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
// Register /root prefix with global routing controller and
// install producer that will satisfy Interests in /root namespace
- ccnxGlobalRoutingHelper.AddOrigins ("/root", producer);
- producerHelper.SetPrefix ("/root");
- producerHelper.Install (producer);
+ ccnxGlobalRoutingHelper.AddOrigins("/root", producer);
+ producerHelper.SetPrefix("/root");
+ producerHelper.Install(producer);
// Calculate and install FIBs
- ccnxGlobalRoutingHelper.CalculateRoutes ();
+ ccnxGlobalRoutingHelper.CalculateRoutes();
- Simulator::Stop (Seconds (20.0));
+ Simulator::Stop(Seconds(20.0));
- ndn::L3AggregateTracer::InstallAll ("aggregate-trace.txt", Seconds (0.5));
- ndn::L3RateTracer::InstallAll ("rate-trace.txt", Seconds (0.5));
-
- Simulator::Run ();
- Simulator::Destroy ();
+ ndn::L3AggregateTracer::InstallAll("aggregate-trace.txt", Seconds(0.5));
+ ndn::L3RateTracer::InstallAll("rate-trace.txt", Seconds(0.5));
+
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}
diff --git a/examples/ndn-tree-with-l2tracer.cpp b/examples/ndn-tree-with-l2tracer.cpp
index 19ba3a2..8d5e3e0 100644
--- a/examples/ndn-tree-with-l2tracer.cpp
+++ b/examples/ndn-tree-with-l2tracer.cpp
@@ -7,135 +7,135 @@
using namespace ns3;
int
-main (int argc, char *argv[])
+main(int argc, char* argv[])
{
CommandLine cmd;
- cmd.Parse (argc, argv);
+ cmd.Parse(argc, argv);
- AnnotatedTopologyReader topologyReader ("", 10);
- topologyReader.SetFileName ("src/ndnSIM/examples/topologies/topo-tree-25-node.txt");
- topologyReader.Read ();
-
+ AnnotatedTopologyReader topologyReader("", 10);
+ topologyReader.SetFileName("src/ndnSIM/examples/topologies/topo-tree-25-node.txt");
+ topologyReader.Read();
+
/****************************************************************************/
// Install CCNx stack on all nodes
ndn::StackHelper ccnxHelper;
- ccnxHelper.SetContentStore ("ns3::ndn::cs::Lru", "MaxSize", "1000");
- ccnxHelper.SetForwardingStrategy ("ns3::ndn::fw::BestRoute");
- ccnxHelper.InstallAll ();
+ ccnxHelper.SetContentStore("ns3::ndn::cs::Lru", "MaxSize", "1000");
+ ccnxHelper.SetForwardingStrategy("ns3::ndn::fw::BestRoute");
+ ccnxHelper.InstallAll();
/****************************************************************************/
// Installing global routing interface on all nodes
ndn::GlobalRoutingHelper ccnxGlobalRoutingHelper;
- ccnxGlobalRoutingHelper.InstallAll ();
+ ccnxGlobalRoutingHelper.InstallAll();
/****************************************************************************/
// Getting containers for the consumer/producer
- Ptr<Node> consumer1 = Names::Find<Node> ("Src1");
- Ptr<Node> consumer2 = Names::Find<Node> ("Src2");
- Ptr<Node> consumer3 = Names::Find<Node> ("Src3");
- Ptr<Node> consumer4 = Names::Find<Node> ("Src4");
- Ptr<Node> consumer5 = Names::Find<Node> ("Src5");
- Ptr<Node> consumer6 = Names::Find<Node> ("Src6");
- Ptr<Node> consumer7 = Names::Find<Node> ("Src7");
- Ptr<Node> consumer8 = Names::Find<Node> ("Src8");
- Ptr<Node> consumer9 = Names::Find<Node> ("Src9");
+ Ptr<Node> consumer1 = Names::Find<Node>("Src1");
+ Ptr<Node> consumer2 = Names::Find<Node>("Src2");
+ Ptr<Node> consumer3 = Names::Find<Node>("Src3");
+ Ptr<Node> consumer4 = Names::Find<Node>("Src4");
+ Ptr<Node> consumer5 = Names::Find<Node>("Src5");
+ Ptr<Node> consumer6 = Names::Find<Node>("Src6");
+ Ptr<Node> consumer7 = Names::Find<Node>("Src7");
+ Ptr<Node> consumer8 = Names::Find<Node>("Src8");
+ Ptr<Node> consumer9 = Names::Find<Node>("Src9");
- Ptr<Node> producer1 = Names::Find<Node> ("Dst1");
- Ptr<Node> producer2 = Names::Find<Node> ("Dst2");
- Ptr<Node> producer3 = Names::Find<Node> ("Dst3");
- Ptr<Node> producer4 = Names::Find<Node> ("Dst4");
- Ptr<Node> producer5 = Names::Find<Node> ("Dst5");
- Ptr<Node> producer6 = Names::Find<Node> ("Dst6");
- Ptr<Node> producer7 = Names::Find<Node> ("Dst7");
- Ptr<Node> producer8 = Names::Find<Node> ("Dst8");
- Ptr<Node> producer9 = Names::Find<Node> ("Dst9");
+ Ptr<Node> producer1 = Names::Find<Node>("Dst1");
+ Ptr<Node> producer2 = Names::Find<Node>("Dst2");
+ Ptr<Node> producer3 = Names::Find<Node>("Dst3");
+ Ptr<Node> producer4 = Names::Find<Node>("Dst4");
+ Ptr<Node> producer5 = Names::Find<Node>("Dst5");
+ Ptr<Node> producer6 = Names::Find<Node>("Dst6");
+ Ptr<Node> producer7 = Names::Find<Node>("Dst7");
+ Ptr<Node> producer8 = Names::Find<Node>("Dst8");
+ Ptr<Node> producer9 = Names::Find<Node>("Dst9");
/****************************************************************************/
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
- consumerHelper.SetAttribute ("Frequency", StringValue ("1000"));//interests per Second
- consumerHelper.SetAttribute ("Randomize", StringValue ("uniform"));
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
+ consumerHelper.SetAttribute("Frequency", StringValue("1000")); // interests per Second
+ consumerHelper.SetAttribute("Randomize", StringValue("uniform"));
/****************************************************************************/
// on the first to ninth consumer node install a Consumer application
// that will express interests in /dst1 to /dst9 namespace
- consumerHelper.SetPrefix ("/dst9");
- consumerHelper.Install (consumer1);
+ consumerHelper.SetPrefix("/dst9");
+ consumerHelper.Install(consumer1);
- consumerHelper.SetPrefix ("/dst8");
- consumerHelper.Install (consumer2);
+ consumerHelper.SetPrefix("/dst8");
+ consumerHelper.Install(consumer2);
- consumerHelper.SetPrefix ("/dst7");
- consumerHelper.Install (consumer3);
+ consumerHelper.SetPrefix("/dst7");
+ consumerHelper.Install(consumer3);
- consumerHelper.SetPrefix ("/dst6");
- consumerHelper.Install (consumer4);
+ consumerHelper.SetPrefix("/dst6");
+ consumerHelper.Install(consumer4);
- consumerHelper.SetPrefix ("/dst5");
- consumerHelper.Install (consumer5);
+ consumerHelper.SetPrefix("/dst5");
+ consumerHelper.Install(consumer5);
- consumerHelper.SetPrefix ("/dst4");
- consumerHelper.Install (consumer6);
+ consumerHelper.SetPrefix("/dst4");
+ consumerHelper.Install(consumer6);
- consumerHelper.SetPrefix ("/dst3");
- consumerHelper.Install (consumer7);
+ consumerHelper.SetPrefix("/dst3");
+ consumerHelper.Install(consumer7);
- consumerHelper.SetPrefix ("/dst2");
- consumerHelper.Install (consumer8);
+ consumerHelper.SetPrefix("/dst2");
+ consumerHelper.Install(consumer8);
- consumerHelper.SetPrefix ("/dst1");
- consumerHelper.Install (consumer9);
-
+ consumerHelper.SetPrefix("/dst1");
+ consumerHelper.Install(consumer9);
+
/****************************************************************************/
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
- producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
+ producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
/****************************************************************************/
// Register /dst1 to /dst9 prefix with global routing controller and
// install producer that will satisfy Interests in /dst1 to /dst9 namespace
- ccnxGlobalRoutingHelper.AddOrigins ("/dst1", producer1);
- producerHelper.SetPrefix ("/dst1");
- producerHelper.Install (producer1);
+ ccnxGlobalRoutingHelper.AddOrigins("/dst1", producer1);
+ producerHelper.SetPrefix("/dst1");
+ producerHelper.Install(producer1);
- ccnxGlobalRoutingHelper.AddOrigins ("/dst2", producer2);
- producerHelper.SetPrefix ("/dst2");
- producerHelper.Install (producer2);
+ ccnxGlobalRoutingHelper.AddOrigins("/dst2", producer2);
+ producerHelper.SetPrefix("/dst2");
+ producerHelper.Install(producer2);
- ccnxGlobalRoutingHelper.AddOrigins ("/dst3", producer3);
- producerHelper.SetPrefix ("/dst3");
- producerHelper.Install (producer3);
+ ccnxGlobalRoutingHelper.AddOrigins("/dst3", producer3);
+ producerHelper.SetPrefix("/dst3");
+ producerHelper.Install(producer3);
- ccnxGlobalRoutingHelper.AddOrigins ("/dst4", producer4);
- producerHelper.SetPrefix ("/dst4");
- producerHelper.Install (producer4);
+ ccnxGlobalRoutingHelper.AddOrigins("/dst4", producer4);
+ producerHelper.SetPrefix("/dst4");
+ producerHelper.Install(producer4);
- ccnxGlobalRoutingHelper.AddOrigins ("/dst5", producer5);
- producerHelper.SetPrefix ("/dst5");
- producerHelper.Install (producer5);
+ ccnxGlobalRoutingHelper.AddOrigins("/dst5", producer5);
+ producerHelper.SetPrefix("/dst5");
+ producerHelper.Install(producer5);
- ccnxGlobalRoutingHelper.AddOrigins ("/dst6", producer6);
- producerHelper.SetPrefix ("/dst6");
- producerHelper.Install (producer6);
+ ccnxGlobalRoutingHelper.AddOrigins("/dst6", producer6);
+ producerHelper.SetPrefix("/dst6");
+ producerHelper.Install(producer6);
- ccnxGlobalRoutingHelper.AddOrigins ("/dst7", producer7);
- producerHelper.SetPrefix ("/dst7");
- producerHelper.Install (producer7);
+ ccnxGlobalRoutingHelper.AddOrigins("/dst7", producer7);
+ producerHelper.SetPrefix("/dst7");
+ producerHelper.Install(producer7);
- ccnxGlobalRoutingHelper.AddOrigins ("/dst8", producer8);
- producerHelper.SetPrefix ("/dst8");
- producerHelper.Install (producer8);
+ ccnxGlobalRoutingHelper.AddOrigins("/dst8", producer8);
+ producerHelper.SetPrefix("/dst8");
+ producerHelper.Install(producer8);
- ccnxGlobalRoutingHelper.AddOrigins ("/dst9", producer9);
- producerHelper.SetPrefix ("/dst9");
- producerHelper.Install (producer9);
+ ccnxGlobalRoutingHelper.AddOrigins("/dst9", producer9);
+ producerHelper.SetPrefix("/dst9");
+ producerHelper.Install(producer9);
/*****************************************************************************/
// Calculate and install FIBs
- ccnxGlobalRoutingHelper.CalculateRoutes ();
+ ccnxGlobalRoutingHelper.CalculateRoutes();
- Simulator::Stop (Seconds (10.0));
+ Simulator::Stop(Seconds(10.0));
/****************************************************************************/
- //Tracer:
+ // Tracer:
- L2RateTracer::InstallAll ("drop-trace.txt", Seconds (0.5));
+ L2RateTracer::InstallAll("drop-trace.txt", Seconds(0.5));
- Simulator::Run ();
- Simulator::Destroy ();
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}
diff --git a/examples/ndn-zipf-mandelbrot.cpp b/examples/ndn-zipf-mandelbrot.cpp
index 64e385c..4bec18e 100644
--- a/examples/ndn-zipf-mandelbrot.cpp
+++ b/examples/ndn-zipf-mandelbrot.cpp
@@ -51,63 +51,63 @@
*/
int
-main (int argc, char *argv[])
+main(int argc, char* argv[])
{
- //LogComponentEnable("ndn.CbisGlobalRoutingHelper", LOG_LEVEL_INFO);
+ // LogComponentEnable("ndn.CbisGlobalRoutingHelper", LOG_LEVEL_INFO);
// Setting default parameters for PointToPoint links and channels
- Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("1Mbps"));
- Config::SetDefault ("ns3::PointToPointChannel::Delay", StringValue ("1ms"));
- Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("10"));
+ Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
+ Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("1ms"));
+ Config::SetDefault("ns3::DropTailQueue::MaxPackets", StringValue("10"));
// Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
CommandLine cmd;
- cmd.Parse (argc, argv);
+ cmd.Parse(argc, argv);
// Creating 3x3 topology
PointToPointHelper p2p;
- PointToPointGridHelper grid (3, 3, p2p);
- grid.BoundingBox(100,100,200,200);
+ PointToPointGridHelper grid(3, 3, p2p);
+ grid.BoundingBox(100, 100, 200, 200);
// Install CCNx stack on all nodes
ndn::StackHelper ccnxHelper;
- ccnxHelper.SetForwardingStrategy ("ns3::ndn::fw::SmartFlooding");
- ccnxHelper.SetContentStore ("ns3::ndn::cs::Lru", "MaxSize", "10");
- ccnxHelper.InstallAll ();
+ ccnxHelper.SetForwardingStrategy("ns3::ndn::fw::SmartFlooding");
+ ccnxHelper.SetContentStore("ns3::ndn::cs::Lru", "MaxSize", "10");
+ ccnxHelper.InstallAll();
// Installing global routing interface on all nodes
- //ndn::CbisGlobalRoutingHelper ccnxGlobalRoutingHelper;
+ // ndn::CbisGlobalRoutingHelper ccnxGlobalRoutingHelper;
ndn::GlobalRoutingHelper ccnxGlobalRoutingHelper;
- ccnxGlobalRoutingHelper.InstallAll ();
+ ccnxGlobalRoutingHelper.InstallAll();
// Getting containers for the consumer/producer
- Ptr<Node> producer = grid.GetNode (2, 2);
+ Ptr<Node> producer = grid.GetNode(2, 2);
NodeContainer consumerNodes;
- consumerNodes.Add (grid.GetNode (0,0));
+ consumerNodes.Add(grid.GetNode(0, 0));
// Install CCNx applications
std::string prefix = "/prefix";
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerZipfMandelbrot");
- //ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
- consumerHelper.SetPrefix (prefix);
- consumerHelper.SetAttribute ("Frequency", StringValue ("100")); // 100 interests a second
- consumerHelper.SetAttribute ("NumberOfContents", StringValue ("100")); // 10 different contents
- //consumerHelper.SetAttribute ("Randomize", StringValue ("uniform")); // 100 interests a second
- consumerHelper.Install (consumerNodes);
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerZipfMandelbrot");
+ // ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
+ consumerHelper.SetPrefix(prefix);
+ consumerHelper.SetAttribute("Frequency", StringValue("100")); // 100 interests a second
+ consumerHelper.SetAttribute("NumberOfContents", StringValue("100")); // 10 different contents
+ // consumerHelper.SetAttribute ("Randomize", StringValue ("uniform")); // 100 interests a second
+ consumerHelper.Install(consumerNodes);
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
- producerHelper.SetPrefix (prefix);
- producerHelper.SetAttribute ("PayloadSize", StringValue("100"));
- producerHelper.Install (producer);
- ccnxGlobalRoutingHelper.AddOrigins (prefix, producer);
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
+ producerHelper.SetPrefix(prefix);
+ producerHelper.SetAttribute("PayloadSize", StringValue("100"));
+ producerHelper.Install(producer);
+ ccnxGlobalRoutingHelper.AddOrigins(prefix, producer);
// Calculate and install FIBs
- ccnxGlobalRoutingHelper.CalculateRoutes ();
+ ccnxGlobalRoutingHelper.CalculateRoutes();
- Simulator::Stop (Seconds (10.0));
+ Simulator::Stop(Seconds(10.0));
- Simulator::Run ();
- Simulator::Destroy ();
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}