Adding more statistics collection (number of transmitted/received bytes
per "pit entry" and per face)
diff --git a/model/forwarding-strategy/best-route.cc b/model/forwarding-strategy/best-route.cc
index f109568..867527f 100644
--- a/model/forwarding-strategy/best-route.cc
+++ b/model/forwarding-strategy/best-route.cc
@@ -93,7 +93,7 @@
Ptr<Packet> packetToSend = packet->Copy ();
metricFace.m_face->Send (packetToSend);
- DidSendOutInterest (metricFace.m_face, header, pitEntry);
+ DidSendOutInterest (metricFace.m_face, header, packet, pitEntry);
propagatedCount++;
break; // do only once
diff --git a/model/forwarding-strategy/ccnx-forwarding-strategy.cc b/model/forwarding-strategy/ccnx-forwarding-strategy.cc
index 93afbeb..88451e6 100644
--- a/model/forwarding-strategy/ccnx-forwarding-strategy.cc
+++ b/model/forwarding-strategy/ccnx-forwarding-strategy.cc
@@ -300,9 +300,19 @@
//satisfy all pending incoming Interests
BOOST_FOREACH (const CcnxPitEntryIncomingFace &incoming, pitEntry->GetIncoming ())
{
- incoming.m_face->Send (packet->Copy ());
- m_outData (header, payload, false, incoming.m_face);
- NS_LOG_DEBUG ("Satisfy " << *incoming.m_face);
+ bool ok = incoming.m_face->Send (packet->Copy ());
+ if (ok)
+ {
+ m_outData (header, payload, incomingFace == 0, incoming.m_face);
+ DidSendOutData (incoming.m_face, header, payload, packet);
+
+ NS_LOG_DEBUG ("Satisfy " << *incoming.m_face);
+ }
+ else
+ {
+ m_dropData (header, payload, incoming.m_face);
+ NS_LOG_DEBUG ("Cannot satisfy data to " << *incoming.m_face);
+ }
// successfull forwarded data trace
}
@@ -443,12 +453,21 @@
void
CcnxForwardingStrategy::DidSendOutInterest (const Ptr<CcnxFace> &outgoingFace,
Ptr<CcnxInterestHeader> header,
+ const Ptr<const Packet> &packet,
Ptr<CcnxPitEntry> pitEntry)
{
m_outInterests (header, outgoingFace);
}
void
+CcnxForwardingStrategy::DidSendOutData (const Ptr<CcnxFace> &face,
+ Ptr<const CcnxContentObjectHeader> header,
+ Ptr<const Packet> payload,
+ const Ptr<const Packet> &packet)
+{
+}
+
+void
CcnxForwardingStrategy::WillErasePendingInterest (Ptr<CcnxPitEntry> pitEntry)
{
// do nothing for now. may be need to do some logging
diff --git a/model/forwarding-strategy/ccnx-forwarding-strategy.h b/model/forwarding-strategy/ccnx-forwarding-strategy.h
index c46c70f..20ef1b5 100644
--- a/model/forwarding-strategy/ccnx-forwarding-strategy.h
+++ b/model/forwarding-strategy/ccnx-forwarding-strategy.h
@@ -128,6 +128,12 @@
Ptr<CcnxPitEntry> pitEntry);
virtual void
+ DidSendOutData (const Ptr<CcnxFace> &face,
+ Ptr<const CcnxContentObjectHeader> header,
+ Ptr<const Packet> payload,
+ const Ptr<const Packet> &packet);
+
+ virtual void
DidReceiveUnsolicitedData (const Ptr<CcnxFace> &incomingFace,
Ptr<const CcnxContentObjectHeader> header,
Ptr<const Packet> payload);
@@ -151,9 +157,9 @@
*/
virtual void
DidSendOutInterest (const Ptr<CcnxFace> &outgoingFace,
- Ptr<CcnxInterestHeader> header,
- Ptr<CcnxPitEntry> pitEntry);
-
+ Ptr<CcnxInterestHeader> header,
+ const Ptr<const Packet> &packet,
+ Ptr<CcnxPitEntry> pitEntry);
virtual void
PropagateInterest (const Ptr<CcnxFace> &incomingFace,
diff --git a/model/forwarding-strategy/flooding.cc b/model/forwarding-strategy/flooding.cc
index 545d1fb..176122d 100644
--- a/model/forwarding-strategy/flooding.cc
+++ b/model/forwarding-strategy/flooding.cc
@@ -90,7 +90,7 @@
Ptr<Packet> packetToSend = packet->Copy ();
metricFace.m_face->Send (packetToSend);
- DidSendOutInterest (metricFace.m_face, header, pitEntry);
+ DidSendOutInterest (metricFace.m_face, header, packet, pitEntry);
propagatedCount++;
}
diff --git a/model/forwarding-strategy/fw-stats.cc b/model/forwarding-strategy/fw-stats.cc
index 76638e2..9d15152 100644
--- a/model/forwarding-strategy/fw-stats.cc
+++ b/model/forwarding-strategy/fw-stats.cc
@@ -69,6 +69,32 @@
}
void
+FwStats::OnInterest (const Ptr<CcnxFace> &face,
+ Ptr<CcnxInterestHeader> &header,
+ const Ptr<const Packet> &packet)
+{
+ super::OnInterest (face, header, packet);
+
+ m_stats.Rx (header->GetName (), face, packet->GetSize ());
+
+ ScheduleRefreshingIfNecessary ();
+}
+
+void
+FwStats::OnData (const Ptr<CcnxFace> &face,
+ Ptr<CcnxContentObjectHeader> &header,
+ Ptr<Packet> &payload,
+ const Ptr<const Packet> &packet)
+{
+ super::OnData (face, header, payload, packet);
+
+ m_stats.Rx (header->GetName (), face, packet->GetSize ());
+
+ ScheduleRefreshingIfNecessary ();
+}
+
+
+void
FwStats::FailedToCreatePitEntry (const Ptr<CcnxFace> &incomingFace,
Ptr<CcnxInterestHeader> header,
const Ptr<const Packet> &packet)
@@ -77,7 +103,10 @@
// Kind of cheating... But at least this way we will have some statistics
m_stats.NewPitEntry (header->GetName ());
+ m_stats.Incoming (header->GetName (), incomingFace);
m_stats.Timeout (header->GetName ());
+
+ ScheduleRefreshingIfNecessary ();
}
void
@@ -108,16 +137,32 @@
void
FwStats::DidSendOutInterest (const Ptr<CcnxFace> &outgoingFace,
Ptr<CcnxInterestHeader> header,
+ const Ptr<const Packet> &packet,
Ptr<CcnxPitEntry> pitEntry)
{
- super::DidSendOutInterest (outgoingFace, header, pitEntry);
+ super::DidSendOutInterest (outgoingFace, header, packet, pitEntry);
m_stats.Outgoing (header->GetName (), outgoingFace);
+ m_stats.Tx (header->GetName (), outgoingFace, packet->GetSize ());
ScheduleRefreshingIfNecessary ();
}
void
+FwStats::DidSendOutData (const Ptr<CcnxFace> &face,
+ Ptr<const CcnxContentObjectHeader> header,
+ Ptr<const Packet> payload,
+ const Ptr<const Packet> &packet)
+{
+ super::DidSendOutData (face, header, payload, packet);
+
+ m_stats.Tx (header->GetName (), face, packet->GetSize ());
+
+ ScheduleRefreshingIfNecessary ();
+}
+
+
+void
FwStats::WillErasePendingInterest (Ptr<CcnxPitEntry> pitEntry)
{
super::WillErasePendingInterest (pitEntry);
diff --git a/model/forwarding-strategy/fw-stats.h b/model/forwarding-strategy/fw-stats.h
index a422ccc..1849fb2 100644
--- a/model/forwarding-strategy/fw-stats.h
+++ b/model/forwarding-strategy/fw-stats.h
@@ -46,6 +46,17 @@
*/
FwStats ();
+ virtual void
+ OnInterest (const Ptr<CcnxFace> &face,
+ Ptr<CcnxInterestHeader> &header,
+ const Ptr<const Packet> &p);
+
+ virtual void
+ OnData (const Ptr<CcnxFace> &face,
+ Ptr<CcnxContentObjectHeader> &header,
+ Ptr<Packet> &payload,
+ const Ptr<const Packet> &packet);
+
protected:
virtual void
DidCreatePitEntry (const Ptr<CcnxFace> &incomingFace,
@@ -65,9 +76,16 @@
virtual void
DidSendOutInterest (const Ptr<CcnxFace> &outgoingFace,
Ptr<CcnxInterestHeader> header,
+ const Ptr<const Packet> &packet,
Ptr<CcnxPitEntry> pitEntry);
virtual void
+ DidSendOutData (const Ptr<CcnxFace> &face,
+ Ptr<const CcnxContentObjectHeader> header,
+ Ptr<const Packet> payload,
+ const Ptr<const Packet> &packet);
+
+ virtual void
WillErasePendingInterest (Ptr<CcnxPitEntry> pitEntry);
// from Object
diff --git a/model/forwarding-strategy/green-yellow-red.cc b/model/forwarding-strategy/green-yellow-red.cc
index d881b00..c00e6d8 100644
--- a/model/forwarding-strategy/green-yellow-red.cc
+++ b/model/forwarding-strategy/green-yellow-red.cc
@@ -93,7 +93,7 @@
Ptr<Packet> packetToSend = packet->Copy ();
metricFace.m_face->Send (packetToSend);
- DidSendOutInterest (metricFace.m_face, header, pitEntry);
+ DidSendOutInterest (metricFace.m_face, header, packet, pitEntry);
propagatedCount++;
break; // propagate only one interest
diff --git a/model/forwarding-strategy/smart-flooding.cc b/model/forwarding-strategy/smart-flooding.cc
index 6cc05e3..a7d0167 100644
--- a/model/forwarding-strategy/smart-flooding.cc
+++ b/model/forwarding-strategy/smart-flooding.cc
@@ -96,7 +96,7 @@
Ptr<Packet> packetToSend = packet->Copy ();
metricFace.m_face->Send (packetToSend);
- DidSendOutInterest (metricFace.m_face, header, pitEntry);
+ DidSendOutInterest (metricFace.m_face, header, packet, pitEntry);
propagatedCount++;
}