ccnx-grid example corrections
diff --git a/apps/ccnx-consumer.cc b/apps/ccnx-consumer.cc
index b25d11c..8352212 100644
--- a/apps/ccnx-consumer.cc
+++ b/apps/ccnx-consumer.cc
@@ -39,7 +39,7 @@
.SetParent<Application> ()
.AddConstructor<CcnxConsumer> ()
.AddAttribute ("OffTime", "Time interval between packets",
- TimeValue (Seconds (0.1)),
+ TimeValue (Seconds (0.001)),
MakeTimeAccessor (&CcnxConsumer::m_offTime),
MakeTimeChecker ())
.AddAttribute ("InterestName","CcnxName of the Interest (use CcnxNameComponents)",
@@ -80,6 +80,7 @@
}
CcnxConsumer::CcnxConsumer ()
+ : m_seq (0)
{
NS_LOG_FUNCTION_NOARGS ();
}
@@ -161,7 +162,12 @@
CcnxInterestHeader interestHeader;
interestHeader.SetNonce(randomNonce);
- interestHeader.SetName(Create<CcnxNameComponents> (m_interestName));
+ Ptr<CcnxNameComponents> name = Create<CcnxNameComponents> (m_interestName);
+ std::ostringstream os;
+ os << m_seq++;
+ (*name) (os.str ());
+
+ interestHeader.SetName (name);
interestHeader.SetInterestLifetime(m_interestLifeTime);
interestHeader.SetChildSelector(m_childSelector);
interestHeader.SetExclude(Create<CcnxNameComponents> (m_exclude));
diff --git a/apps/ccnx-consumer.h b/apps/ccnx-consumer.h
index 1b1971f..16dbaf7 100644
--- a/apps/ccnx-consumer.h
+++ b/apps/ccnx-consumer.h
@@ -89,6 +89,8 @@
EventId m_sendEvent; // Eventid of pending "send packet" event
TypeId m_tid;
Ptr<CcnxLocalFace> m_face;
+
+ uint32_t m_seq;
};
} // namespace ns3
diff --git a/examples/ccnx-grid.cc b/examples/ccnx-grid.cc
index 239654e..d9fbe76 100644
--- a/examples/ccnx-grid.cc
+++ b/examples/ccnx-grid.cc
@@ -28,6 +28,9 @@
#include <iostream>
#include <sstream>
+#include "ns3/visualizer-module.h"
+#include "ns3/ccnx.h"
+
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("CcnxGrid");
@@ -35,9 +38,12 @@
int
main (int argc, char *argv[])
{
+ GlobalValue::Bind ("SimulatorImplementationType", StringValue
+ ("ns3::VisualSimulatorImpl"));
+
uint32_t n = 3;
- Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("10Mbps"));
+ Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("1Mbps"));
Config::SetDefault ("ns3::PointToPointChannel::Delay", StringValue ("1ms"));
Packet::EnableChecking();
@@ -53,6 +59,7 @@
stack.SetRoutingHelper (ipv4RoutingHelper);
PointToPointGridHelper grid (n, n, p2p);
+ grid.BoundingBox(100,100,200,200);
grid.InstallStack (stack);
// // Create router nodes, initialize routing database and set up the routing
@@ -81,19 +88,19 @@
NS_LOG_INFO("Eventual name is " << ss.str());
}
}
- CcnxStackHelper ccnx;
+ CcnxStackHelper ccnx(Ccnx::NDN_BESTROUTE);
Ptr<CcnxFaceContainer> cf = ccnx.Install (c);
NS_LOG_INFO ("Installing Applications");
CcnxConsumerHelper helper ("/3");
- ApplicationContainer app = helper.Install ("1");
+ ApplicationContainer app = helper.Install (grid.GetNode (0,0));
app.Start (Seconds (1.0));
- app.Stop (Seconds (10.05));
+ app.Stop (Seconds (1000.05));
CcnxProducerHelper helper2 ("/3",120);
- ApplicationContainer app2 = helper2.Install("9");
+ ApplicationContainer app2 = helper2.Install(grid.GetNode (2,2));
app2.Start(Seconds(0.0));
- app2.Stop(Seconds(15.0));
+ app2.Stop(Seconds(1500.0));
/**
* \brief Add forwarding entry in FIB
@@ -135,7 +142,7 @@
- Simulator::Stop (Seconds (20));
+ Simulator::Stop (Seconds (2000));
NS_LOG_INFO ("Run Simulation.");
Simulator::Run ();
diff --git a/helper/ccnx-forwarding-helper.cc b/helper/ccnx-forwarding-helper.cc
index dfc7905..6a8d3fb 100644
--- a/helper/ccnx-forwarding-helper.cc
+++ b/helper/ccnx-forwarding-helper.cc
@@ -22,6 +22,7 @@
#include "ns3/node-list.h"
#include "ns3/simulator.h"
#include "ns3/ccnx-forwarding-strategy.h"
+#include "ns3/ccnx-bestroute-strategy.h"
#include "ccnx-forwarding-helper.h"
namespace ns3 {
@@ -52,7 +53,12 @@
ccnx->SetForwardingStrategy (ccnxForwarding);
}
else if(m_strategy == Ccnx::NDN_BESTROUTE)
- {}
+ {
+ Ptr<CcnxBestRouteStrategy> ccnxForwarding = CreateObject<CcnxBestRouteStrategy> ();
+ //ccnxForwarding->SetCcnx(ccnx);
+ ccnxForwarding->SetPit(pit);
+ ccnx->SetForwardingStrategy (ccnxForwarding);
+ }
else if (m_strategy == Ccnx::NDN_RANKING)
{}
}
diff --git a/model/ccnx-pit.cc b/model/ccnx-pit.cc
index 8fd21e0..7c3681b 100644
--- a/model/ccnx-pit.cc
+++ b/model/ccnx-pit.cc
@@ -137,13 +137,13 @@
{
NS_LOG_INFO ("Face has " << m_bucketsPerFace[face->GetId()] << " packets with max allowance " << maxBucketsPerFace[face->GetId()]);
- if((face->IsLocal() == false)
+ /*if((face->IsLocal() == false)
&& (m_bucketsPerFace[face->GetId()]+1.0 >= maxBucketsPerFace[face->GetId()] ))
{
return false;
- }
+ }*/
- m_bucketsPerFace[face->GetId()] = m_bucketsPerFace[face->GetId()] + 1.0;
+ //m_bucketsPerFace[face->GetId()] = m_bucketsPerFace[face->GetId()] + 1.0;
NS_LOG_INFO(this->size());
NS_LOG_INFO("before modify");