fw: handle dropped packets in strategies

refs #5128

Change-Id: Ic7f7e61b2dde66004d0291bb41e008961fc7b252
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index bd4d692..671c536 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -240,7 +240,7 @@
     [&] (fw::Strategy& strategy) { strategy.afterContentStoreHit(pitEntry, ingress, data); });
 }
 
-void
+pit::OutRecord*
 Forwarder::onOutgoingInterest(const shared_ptr<pit::Entry>& pitEntry,
                               Face& egress, const Interest& interest)
 {
@@ -249,17 +249,19 @@
     NFD_LOG_DEBUG("onOutgoingInterest out=" << egress.getId() << " interest=" << pitEntry->getName()
                   << " non-local hop-limit=0");
     ++const_cast<PacketCounter&>(egress.getCounters().nOutHopLimitZero);
-    return;
+    return nullptr;
   }
 
   NFD_LOG_DEBUG("onOutgoingInterest out=" << egress.getId() << " interest=" << pitEntry->getName());
 
   // insert out-record
-  pitEntry->insertOrUpdateOutRecord(egress, interest);
+  auto it = pitEntry->insertOrUpdateOutRecord(egress, interest);
+  BOOST_ASSERT(it != pitEntry->out_end());
 
   // send Interest
   egress.sendInterest(interest);
   ++m_counters.nOutInterests;
+  return &*it;
 }
 
 void
@@ -397,12 +399,12 @@
   ++m_counters.nUnsolicitedData;
 }
 
-void
+bool
 Forwarder::onOutgoingData(const Data& data, Face& egress)
 {
   if (egress.getId() == face::INVALID_FACEID) {
     NFD_LOG_WARN("onOutgoingData out=(invalid) data=" << data.getName());
-    return;
+    return false;
   }
   NFD_LOG_DEBUG("onOutgoingData out=" << egress.getId() << " data=" << data.getName());
 
@@ -413,7 +415,7 @@
     NFD_LOG_DEBUG("onOutgoingData out=" << egress.getId() << " data=" << data.getName()
                   << " violates /localhost");
     // (drop)
-    return;
+    return false;
   }
 
   // TODO traffic manager
@@ -421,6 +423,8 @@
   // send Data
   egress.sendData(data);
   ++m_counters.nOutData;
+
+  return true;
 }
 
 void
@@ -480,14 +484,14 @@
     [&] (fw::Strategy& strategy) { strategy.afterReceiveNack(ingress, nack, pitEntry); });
 }
 
-void
+bool
 Forwarder::onOutgoingNack(const shared_ptr<pit::Entry>& pitEntry,
                           Face& egress, const lp::NackHeader& nack)
 {
   if (egress.getId() == face::INVALID_FACEID) {
     NFD_LOG_WARN("onOutgoingNack out=(invalid)"
                  << " nack=" << pitEntry->getInterest().getName() << "~" << nack.getReason());
-    return;
+    return false;
   }
 
   // has in-record?
@@ -498,7 +502,7 @@
     NFD_LOG_DEBUG("onOutgoingNack out=" << egress.getId()
                   << " nack=" << pitEntry->getInterest().getName()
                   << "~" << nack.getReason() << " no-in-record");
-    return;
+    return false;
   }
 
   // if multi-access or ad hoc face, drop
@@ -506,7 +510,7 @@
     NFD_LOG_DEBUG("onOutgoingNack out=" << egress.getId()
                   << " nack=" << pitEntry->getInterest().getName() << "~" << nack.getReason()
                   << " link-type=" << egress.getLinkType());
-    return;
+    return false;
   }
 
   NFD_LOG_DEBUG("onOutgoingNack out=" << egress.getId()
@@ -523,6 +527,8 @@
   // send Nack on face
   egress.sendNack(nackPkt);
   ++m_counters.nOutNacks;
+
+  return true;
 }
 
 void