Adding more statistics collection (number of transmitted/received bytes
per "pit entry" and per face)
diff --git a/model/ccnx-app-face.cc b/model/ccnx-app-face.cc
index f032cd7..cec8a1c 100644
--- a/model/ccnx-app-face.cc
+++ b/model/ccnx-app-face.cc
@@ -91,7 +91,7 @@
   m_app->RegisterProtocolHandler (MakeCallback (&CcnxFace::Receive, this));
 }
 
-void
+bool
 CcnxAppFace::SendImpl (Ptr<Packet> p)
 {
   NS_LOG_FUNCTION (this << p);
@@ -124,10 +124,13 @@
             break;
           }
         }
+      
+      return true;
     }
   catch (CcnxUnknownHeaderException)
     {
       NS_LOG_ERROR ("Unknown header type");
+      return false;
     }
 }
 
diff --git a/model/ccnx-app-face.h b/model/ccnx-app-face.h
index 06d9a3f..967ee13 100644
--- a/model/ccnx-app-face.h
+++ b/model/ccnx-app-face.h
@@ -61,7 +61,7 @@
   RegisterProtocolHandler (ProtocolHandler handler);
 
 protected:
-  virtual void
+  virtual bool
   SendImpl (Ptr<Packet> p);
 
 public:
diff --git a/model/ccnx-face.cc b/model/ccnx-face.cc
index 3c18af0..a1dec50 100644
--- a/model/ccnx-face.cc
+++ b/model/ccnx-face.cc
@@ -185,9 +185,17 @@
   //     packet->AddPacketTag (tag);
   //   }
 
-  m_ccnxTxTrace (packet);
-  SendImpl (packet);
-  return true;
+  bool ok = SendImpl (packet);
+  if (ok)
+    {
+      m_ccnxTxTrace (packet);
+      return true;
+    }
+  else
+    {
+      m_ccnxDropTrace (packet);
+      return false;
+    }
 }
 
 bool
diff --git a/model/ccnx-face.h b/model/ccnx-face.h
index 1119ba8..4a0cdf9 100644
--- a/model/ccnx-face.h
+++ b/model/ccnx-face.h
@@ -225,7 +225,7 @@
    *
    * \param p smart pointer to a packet to send
    */
-  virtual void
+  virtual bool
   SendImpl (Ptr<Packet> p) = 0;  
 
 private:
diff --git a/model/ccnx-net-device-face.cc b/model/ccnx-net-device-face.cc
index 23b5e97..95e45c2 100644
--- a/model/ccnx-net-device-face.cc
+++ b/model/ccnx-net-device-face.cc
@@ -88,7 +88,7 @@
                                    CcnxL3Protocol::ETHERNET_FRAME_TYPE, m_netDevice, true/*promiscuous mode*/);
 }
 
-void
+bool
 CcnxNetDeviceFace::SendImpl (Ptr<Packet> packet)
 {
   NS_LOG_FUNCTION (this << packet);
@@ -98,8 +98,9 @@
                  << m_netDevice->GetMtu ()
                  << " for Ccnx; fragmentation not supported");
 
-  m_netDevice->Send (packet, m_netDevice->GetBroadcast (), 
-                     CcnxL3Protocol::ETHERNET_FRAME_TYPE);
+  bool ok = m_netDevice->Send (packet, m_netDevice->GetBroadcast (), 
+                               CcnxL3Protocol::ETHERNET_FRAME_TYPE);
+  return ok;
 }
 
 // callback
diff --git a/model/ccnx-net-device-face.h b/model/ccnx-net-device-face.h
index 0fdefea..2a018bf 100644
--- a/model/ccnx-net-device-face.h
+++ b/model/ccnx-net-device-face.h
@@ -40,7 +40,7 @@
  * object and this object cannot be changed for the lifetime of the
  * face
  *
- * \see CcnxLocalFace, CcnxNetDeviceFace, CcnxIpv4Face, CcnxUdpFace
+ * \see CcnxAppFace, CcnxNetDeviceFace, CcnxIpv4Face, CcnxUdpFace
  */
 class CcnxNetDeviceFace  : public CcnxFace
 {
@@ -51,7 +51,8 @@
   /**
    * \brief Constructor
    *
-   * \param netDevice a smart pointer to NetDevice object to which
+   * @param node Node associated with the face
+   * @param netDevice a smart pointer to NetDevice object to which
    * this face will be associate
    */
   CcnxNetDeviceFace (Ptr<Node> node, const Ptr<NetDevice> &netDevice);
@@ -61,10 +62,10 @@
   // methods overloaded from CcnxFace
   virtual void
   RegisterProtocolHandler (ProtocolHandler handler);
-
+  
 protected:
   // also from CcnxFace
-  virtual void
+  virtual bool
   SendImpl (Ptr<Packet> p);
 
 public:
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++;
     }