pit fib small corrections
diff --git a/model/ccnx-fib.cc b/model/ccnx-fib.cc
index 164b46b..f8c5956 100644
--- a/model/ccnx-fib.cc
+++ b/model/ccnx-fib.cc
@@ -27,6 +27,7 @@
#include "ns3/node.h"
#include "ns3/assert.h"
#include "ns3/names.h"
+#include "ns3/log.h"
#define NDN_RTO_ALPHA 0.125
#define NDN_RTO_BETA 0.25
@@ -95,7 +96,8 @@
}
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
-
+NS_LOG_COMPONENT_DEFINE ("CcnxFib");
+
using namespace __ccnx_private;
TypeId
@@ -147,16 +149,18 @@
void
CcnxFibEntry::AddOrUpdateRoutingMetric::operator () (CcnxFibEntry &entry)
{
+ NS_LOG_FUNCTION(this);
+ NS_ASSERT_MSG (m_face != NULL, "Trying to Add or Update NULL face");
+
CcnxFibFaceMetricByFace::type::iterator record = entry.m_faces.get<i_face> ().find (m_face);
if (record == entry.m_faces.get<i_face> ().end ())
{
entry.m_faces.insert (CcnxFibFaceMetric (m_face, m_metric));
}
else
- {
+ {
entry.m_faces.modify (record, ChangeMetric (m_metric));
}
-
// reordering random access index same way as by metric index
entry.m_faces.get<i_nth> ().rearrange (entry.m_faces.get<i_metric> ().begin ());
}
@@ -221,14 +225,17 @@
CcnxFib::Add (const CcnxNameComponents &prefix, Ptr<CcnxFace> face, int32_t metric)
{
// CcnxFibFaceMetric
+ NS_LOG_FUNCTION(this << prefix << face << metric);
CcnxFibEntryContainer::type::iterator entry = find (prefix);
if (entry == end ())
{
entry = insert (end (), CcnxFibEntry (prefix));
// insert new
}
- modify (entry, CcnxFibEntry::AddOrUpdateRoutingMetric (face, metric));
+ NS_ASSERT_MSG (face != NULL, "Trying to modify NULL face");
+ modify (entry, CcnxFibEntry::AddOrUpdateRoutingMetric (face, metric));
+
return entry;
}
diff --git a/model/ccnx-l3-protocol.cc b/model/ccnx-l3-protocol.cc
index 4b832a4..2f87922 100644
--- a/model/ccnx-l3-protocol.cc
+++ b/model/ccnx-l3-protocol.cc
@@ -570,34 +570,33 @@
header->SetNack(false);
header->SetCongested(false);
- NS_ASSERT_MSG (m_forwardingStrategy != 0, "Need a forwarding protocol object to process packets");
+ NS_ASSERT_MSG (m_forwardingStrategy != 0, "Need a forwarding protocol object to process packets");
- m_pit->modify (pitEntry, CcnxPitEntry::AddIncoming(incomingFace));
+ m_pit->modify (pitEntry, CcnxPitEntry::AddIncoming(incomingFace));
- bool propagated = m_forwardingStrategy->
- PropagateInterest (pitEntry, fibEntry,incomingFace, header, packet,
- MakeCallback (&CcnxL3Protocol::SendInterest, this)
- );
+ bool propagated = m_forwardingStrategy->
+ PropagateInterest (pitEntry, fibEntry,incomingFace, header, packet,
+ MakeCallback (&CcnxL3Protocol::SendInterest, this)
+ );
- // If interest wasn't propagated further (probably, a limit is reached),
- // prune and delete PIT entry if there are no outstanding interests.
- // Stop processing otherwise.
- if( (!propagated) && (pitEntry->m_outgoing.size() == 0))
- {
- BOOST_FOREACH (const CcnxPitEntryIncomingFace face, pitEntry->m_incoming)
- {
+ // If interest wasn't propagated further (probably, a limit is reached),
+ // prune and delete PIT entry if there are no outstanding interests.
+ // Stop processing otherwise.
+ if( (!propagated) && (pitEntry->m_outgoing.size() == 0))
+ {
+ BOOST_FOREACH (const CcnxPitEntryIncomingFace face, pitEntry->m_incoming)
+ {
+ header->SetNack(true);
+ header->SetCongested(true);
+ NS_LOG_INFO("Sending CONGESTION packet");
+ SendInterest (face.m_face, header, packet->Copy());
-
- header->SetNack(true);
- header->SetCongested(true);
- SendInterest (face.m_face, header, packet->Copy());
-
- m_droppedInterestsTrace (header, DROP_CONGESTION,
+ m_droppedInterestsTrace (header, DROP_CONGESTION,
m_node->GetObject<Ccnx> (), incomingFace);
- }
+ }
m_pit->erase (pitEntry);
- }
+ }
/*}
else
{
diff --git a/model/ccnx-pit.cc b/model/ccnx-pit.cc
index 7c3681b..8fd21e0 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");
diff --git a/wscript b/wscript
index bd94d0f..847b0d3 100644
--- a/wscript
+++ b/wscript
@@ -27,7 +27,7 @@
def build(bld):
module = bld.create_ns3_module ('NDNabstraction', ['core', 'network', 'point-to-point',
- 'topology-read','internet','applications'])
+ 'topology-read','internet','applications','visualizer'])
module.uselib = 'BOOST BOOST_IOSTREAMS'
tests = bld.create_ns3_module_test_library('NDNabstraction')
@@ -64,6 +64,12 @@
obj = bld.create_ns3_program('ccnx-grid', ['NDNabstraction', 'point-to-point-layout'])
obj.source = 'examples/ccnx-grid.cc'
+ obj = bld.create_ns3_program('syntactic-topology', ['NDNabstraction', 'point-to-point-layout'])
+ obj.source = 'examples/syntactic-topology-ndnabstraction.cc'
+
+ obj = bld.create_ns3_program('annotated-topology', ['NDNabstraction', 'point-to-point-layout'])
+ obj.source = 'examples/annotated-topology-read-example.cc'
+
# for path in ["examples"]:
# anode = bld.path.find_dir (path)
# if not anode or not anode.is_child_of(bld.srcnode):