Checkpoint. Some changes in forwarding strategy API
Removing WillSendOutInterest and adding TrySendOutInterests, which
should be fully defined in child classes (or fully used from parent, but
not combined).
diff --git a/model/fw/ndn-forwarding-strategy.cc b/model/fw/ndn-forwarding-strategy.cc
index 6348424..4219deb 100644
--- a/model/fw/ndn-forwarding-strategy.cc
+++ b/model/fw/ndn-forwarding-strategy.cc
@@ -443,21 +443,40 @@
}
bool
-ForwardingStrategy::WillSendOutInterest (Ptr<Face> outFace,
- Ptr<const InterestHeader> header,
- Ptr<pit::Entry> pitEntry)
+ForwardingStrategy::TrySendOutInterest (Ptr<Face> inFace,
+ Ptr<Face> outFace,
+ Ptr<const InterestHeader> header,
+ Ptr<const Packet> origPacket,
+ Ptr<pit::Entry> pitEntry)
{
+ if (outFace == inFace)
+ {
+ NS_LOG_DEBUG ("Same as incoming");
+ return false; // same face as incoming, don't forward
+ }
+
pit::Entry::out_iterator outgoing =
pitEntry->GetOutgoing ().find (outFace);
-
- if (outgoing != pitEntry->GetOutgoing ().end () &&
- outgoing->m_retxCount >= pitEntry->GetMaxRetxCount ())
- {
- NS_LOG_ERROR (outgoing->m_retxCount << " >= " << pitEntry->GetMaxRetxCount ());
- return false; // already forwarded before during this retransmission cycle
- }
+ if (outgoing != pitEntry->GetOutgoing ().end ())
+ {
+ if (!m_detectRetransmissions)
+ return false; // suppress
+ else if (outgoing->m_retxCount >= pitEntry->GetMaxRetxCount ())
+ {
+ NS_LOG_ERROR (outgoing->m_retxCount << " >= " << pitEntry->GetMaxRetxCount ());
+ return false; // already forwarded before during this retransmission cycle
+ }
+ }
+
pitEntry->AddOutgoing (outFace);
+
+ //transmission
+ Ptr<Packet> packetToSend = origPacket->Copy ();
+ outFace->Send (packetToSend);
+
+ DidSendOutInterest (outFace, header, origPacket, pitEntry);
+
return true;
}