Another set of refactoring
diff --git a/model/fw/best-route.cc b/model/fw/best-route.cc
new file mode 100644
index 0000000..84e74fe
--- /dev/null
+++ b/model/fw/best-route.cc
@@ -0,0 +1,106 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ *         Ilya Moiseenko <iliamo@cs.ucla.edu>
+ */
+
+#include "best-route.h"
+
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-pit-entry.h"
+
+#include "ns3/assert.h"
+#include "ns3/log.h"
+
+#include <boost/foreach.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+namespace ll = boost::lambda;
+
+NS_LOG_COMPONENT_DEFINE ("ndn.fw.BestRoute");
+
+namespace ns3 {
+namespace ndn {
+namespace fw {
+
+NS_OBJECT_ENSURE_REGISTERED (BestRoute);
+  
+TypeId
+BestRoute::GetTypeId (void)
+{
+  static TypeId tid = TypeId ("ns3::ndn::fw::BestRoute")
+    .SetGroupName ("Ndn")
+    .SetParent <GreenYellowRed> ()
+    .AddConstructor <BestRoute> ()
+    ;
+  return tid;
+}
+    
+BestRoute::BestRoute ()
+{
+}
+    
+bool
+BestRoute::DoPropagateInterest (const Ptr<Face> &incomingFace,
+                                Ptr<InterestHeader> header,
+                                const Ptr<const Packet> &packet,
+                                Ptr<pit::Entry> pitEntry)
+{
+  NS_LOG_FUNCTION (this);
+
+
+  // Try to work out with just green faces
+  bool greenOk = super::DoPropagateInterest (incomingFace, header, packet, pitEntry);
+  if (greenOk)
+    return true;
+
+  int propagatedCount = 0;
+  BOOST_FOREACH (const fib::FaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<fib::i_metric> ())
+    {
+      if (metricFace.m_status == fib::FaceMetric::NDN_FIB_RED) // all non-read faces are in front
+        break;
+      
+      if (metricFace.m_face == incomingFace) 
+        continue; // same face as incoming, don't forward
+
+      if (pitEntry->GetIncoming ().find (metricFace.m_face) != pitEntry->GetIncoming ().end ()) 
+        continue; // don't forward to face that we received interest from
+
+      if (!WillSendOutInterest (metricFace.m_face, header, pitEntry))
+        {
+          continue;
+        }
+
+      //transmission
+      Ptr<Packet> packetToSend = packet->Copy ();
+      metricFace.m_face->Send (packetToSend);
+
+      DidSendOutInterest (metricFace.m_face, header, packet, pitEntry);
+
+      propagatedCount++;
+      break; // do only once
+    }
+
+  NS_LOG_INFO ("Propagated to " << propagatedCount << " faces");
+  return propagatedCount > 0;
+}
+
+} // namespace fw
+} // namespace ndn
+} // namespace ns3
diff --git a/model/fw/best-route.h b/model/fw/best-route.h
new file mode 100644
index 0000000..7326b5b
--- /dev/null
+++ b/model/fw/best-route.h
@@ -0,0 +1,63 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ *         Ilya Moiseenko <iliamo@cs.ucla.edu>
+ */
+
+
+#ifndef NDNSIM_BEST_ROUTE_H
+#define NDNSIM_BEST_ROUTE_H
+
+#include "green-yellow-red.h"
+
+namespace ns3 {
+namespace ndn {
+namespace fw {
+
+/**
+ * \ingroup ndn
+ * \brief Best route strategy
+ */
+class BestRoute :
+    public GreenYellowRed
+{
+public:
+  static TypeId
+  GetTypeId ();
+
+  /**
+   * @brief Default constructor
+   */
+  BestRoute ();
+        
+  // inherited from  NdnForwardingStrategy
+  virtual bool
+  DoPropagateInterest (const Ptr<Face> &incomingFace,
+                       Ptr<InterestHeader> header,
+                       const Ptr<const Packet> &packet,
+                       Ptr<pit::Entry> pitEntry);
+
+private:
+  typedef GreenYellowRed super;
+};
+
+} // namespace fw
+} // namespace ndn
+} // namespace ns3
+
+#endif // NDNSIM_BEST_ROUTE_H
diff --git a/model/fw/flooding.cc b/model/fw/flooding.cc
new file mode 100644
index 0000000..be969be
--- /dev/null
+++ b/model/fw/flooding.cc
@@ -0,0 +1,103 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ *         Ilya Moiseenko <iliamo@cs.ucla.edu>
+ */
+
+#include "flooding.h"
+
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-pit-entry.h"
+
+#include "ns3/assert.h"
+#include "ns3/log.h"
+#include "ns3/simulator.h"
+#include "ns3/boolean.h"
+
+#include <boost/ref.hpp>
+#include <boost/foreach.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+namespace ll = boost::lambda;
+
+NS_LOG_COMPONENT_DEFINE ("ndn.fw.Flooding");
+
+namespace ns3 {
+namespace ndn {
+namespace fw {
+
+NS_OBJECT_ENSURE_REGISTERED (Flooding);
+    
+TypeId Flooding::GetTypeId ()
+{
+  static TypeId tid = TypeId ("ns3::ndn::fw::Flooding")
+    .SetGroupName ("Ndn")
+    .SetParent <Nacks> ()
+    .AddConstructor <Flooding> ()
+    ;
+  return tid;
+}
+    
+Flooding::Flooding ()
+{
+}
+
+bool
+Flooding::DoPropagateInterest (const Ptr<Face> &incomingFace,
+                               Ptr<InterestHeader> header,
+                               const Ptr<const Packet> &packet,
+                               Ptr<pit::Entry> pitEntry)
+{
+  NS_LOG_FUNCTION (this);
+
+  int propagatedCount = 0;
+
+  BOOST_FOREACH (const fib::FaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<fib::i_metric> ())
+    {
+      NS_LOG_DEBUG ("Trying " << boost::cref(metricFace));
+      if (metricFace.m_status == fib::FaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list
+        break;
+      
+      if (metricFace.m_face == incomingFace) 
+        {
+          NS_LOG_DEBUG ("continue (same as incoming)");
+          continue; // same face as incoming, don't forward
+        }
+
+      if (!WillSendOutInterest (metricFace.m_face, header, pitEntry))
+        {
+          continue;
+        }
+
+      //transmission
+      Ptr<Packet> packetToSend = packet->Copy ();
+      metricFace.m_face->Send (packetToSend);
+
+      DidSendOutInterest (metricFace.m_face, header, packet, pitEntry);
+      
+      propagatedCount++;
+    }
+
+  NS_LOG_INFO ("Propagated to " << propagatedCount << " faces");
+  return propagatedCount > 0;
+}
+
+} // namespace fw
+} // namespace ndn
+} // namespace ns3
diff --git a/model/fw/flooding.h b/model/fw/flooding.h
new file mode 100644
index 0000000..d6a83e0
--- /dev/null
+++ b/model/fw/flooding.h
@@ -0,0 +1,64 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ *         Ilya Moiseenko <iliamo@cs.ucla.edu>
+ */
+
+#ifndef NDNSIM_FLOODING_H
+#define NDNSIM_FLOODING_H
+
+#include "nacks.h"
+
+namespace ns3 {
+namespace ndn {
+namespace fw {
+
+/**
+ * \ingroup ndn
+ * \brief Flooding strategy
+ *
+ * \todo Describe
+ */
+class Flooding :
+    public Nacks
+{
+public:
+  static TypeId GetTypeId ();
+
+  /**
+   * @brief Default constructor
+   */
+  Flooding ();
+
+protected:
+  // inherited from  Nacks/ForwardingStrategy
+  virtual bool
+  DoPropagateInterest (const Ptr<Face> &incomingFace,
+                       Ptr<InterestHeader> header,
+                       const Ptr<const Packet> &packet,
+                       Ptr<pit::Entry> pitEntry);
+
+private:
+  typedef Nacks super;
+};
+
+} // namespace fw
+} // namespace ndn
+} // namespace ns3
+
+#endif // NDNSIM_FLOODING
diff --git a/model/fw/fw-stats.cc b/model/fw/fw-stats.cc
new file mode 100644
index 0000000..de30473
--- /dev/null
+++ b/model/fw/fw-stats.cc
@@ -0,0 +1,211 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ *         Ilya Moiseenko <iliamo@cs.ucla.edu>
+ */
+
+#include "fw-stats.h"
+
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-pit-entry.h"
+
+#include "ns3/assert.h"
+#include "ns3/log.h"
+#include "ns3/simulator.h"
+
+
+#include <boost/foreach.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+namespace ll = boost::lambda;
+
+NS_LOG_COMPONENT_DEFINE ("ndn.fw.Stats");
+
+namespace ns3 {
+namespace ndn {
+
+using namespace ndnSIM;
+
+namespace fw {
+
+NS_OBJECT_ENSURE_REGISTERED (FwStats);
+  
+TypeId
+FwStats::GetTypeId (void)
+{
+  static TypeId tid = TypeId ("ns3::ndn::fw::Stats")
+    .SetGroupName ("Ndn")
+    .SetParent <BestRoute> ()
+    .AddConstructor <FwStats> ()
+
+    .AddTraceSource ("Stats", "Fired every time stats tree is updated",
+                     MakeTraceSourceAccessor (&FwStats::m_statsTrace))
+    ;
+  return tid;
+}
+    
+FwStats::FwStats ()
+{
+}
+
+void
+FwStats::DoDispose ()
+{
+  BestRoute::DoDispose ();
+  m_statsRefreshEvent.Cancel ();
+}
+
+void
+FwStats::OnInterest (const Ptr<Face> &face,
+                     Ptr<InterestHeader> &header,
+                     const Ptr<const Packet> &packet)
+{
+  super::OnInterest (face, header, packet);
+  
+  m_stats.Rx (header->GetName ().cut (1), face, packet->GetSize ());
+
+  ScheduleRefreshingIfNecessary ();
+}
+
+void
+FwStats::OnData (const Ptr<Face> &face,
+                 Ptr<ContentObjectHeader> &header,
+                 Ptr<Packet> &payload,
+                 const Ptr<const Packet> &packet)
+{
+  super::OnData (face, header, payload, packet);
+  
+  m_stats.Rx (header->GetName ().cut (1), face, packet->GetSize ());
+
+  ScheduleRefreshingIfNecessary ();
+}
+
+
+void
+FwStats::FailedToCreatePitEntry (const Ptr<Face> &incomingFace,
+                                 Ptr<InterestHeader> header,
+                                 const Ptr<const Packet> &packet)
+{
+  super::FailedToCreatePitEntry (incomingFace, header, packet);
+
+  // Kind of cheating... But at least this way we will have some statistics
+  m_stats.NewPitEntry (header->GetName ().cut (1));
+  m_stats.Incoming (header->GetName ().cut (1), incomingFace);
+  m_stats.Timeout (header->GetName ().cut (1));
+
+  ScheduleRefreshingIfNecessary ();
+}
+
+void
+FwStats::DidCreatePitEntry (const Ptr<Face> &incomingFace,
+                            Ptr<InterestHeader> header,
+                            const Ptr<const Packet> &packet,
+                            Ptr<pit::Entry> pitEntry)
+{
+  super::DidCreatePitEntry (incomingFace, header, packet, pitEntry);
+  
+  m_stats.NewPitEntry (header->GetName ().cut (1));
+  m_stats.Incoming (header->GetName ().cut (1), incomingFace);
+  
+  ScheduleRefreshingIfNecessary ();
+}
+
+void
+FwStats::WillSatisfyPendingInterest (const Ptr<Face> &incomingFace,
+                                     Ptr<pit::Entry> pitEntry)
+{
+  super::WillSatisfyPendingInterest (incomingFace, pitEntry);
+  
+  m_stats.Satisfy (pitEntry->GetPrefix ().cut (1));
+  
+  ScheduleRefreshingIfNecessary ();
+}
+
+void
+FwStats::DidSendOutInterest (const Ptr<Face> &outgoingFace,
+                             Ptr<InterestHeader> header,
+                             const Ptr<const Packet> &packet,
+                             Ptr<pit::Entry> pitEntry)
+{
+  super::DidSendOutInterest (outgoingFace, header, packet, pitEntry);
+
+  m_stats.Outgoing (header->GetName ().cut (1), outgoingFace);
+  m_stats.Tx (header->GetName ().cut (1), outgoingFace, packet->GetSize ());
+  
+  ScheduleRefreshingIfNecessary ();
+}
+
+void
+FwStats::DidSendOutData (const Ptr<Face> &face,
+                         Ptr<const ContentObjectHeader> header,
+                         Ptr<const Packet> payload,
+                         const Ptr<const Packet> &packet)
+{
+  super::DidSendOutData (face, header, payload, packet);
+
+  m_stats.Tx (header->GetName ().cut (1), face, packet->GetSize ());
+  
+  ScheduleRefreshingIfNecessary ();
+}
+
+
+void
+FwStats::WillErasePendingInterest (Ptr<pit::Entry> pitEntry)
+{
+  super::WillErasePendingInterest (pitEntry);
+
+  m_stats.Timeout (pitEntry->GetPrefix ().cut (1));
+  
+  ScheduleRefreshingIfNecessary ();
+}
+
+void
+FwStats::ScheduleRefreshingIfNecessary ()
+{
+  if (m_statsRefreshEvent.IsRunning ()) return;
+  m_statsRefreshEvent = Simulator::Schedule (Seconds (1.0), &FwStats::RefreshStats, this);
+}
+
+void
+FwStats::RefreshStats ()
+{
+  m_stats.Step ();
+  m_statsTrace (this, m_stats);
+  
+  NS_LOG_DEBUG (m_stats["/"]);
+
+  if (!m_stats["/"].IsZero ())
+    {
+      m_statsRefreshEvent = Simulator::Schedule (Seconds (1.0), &FwStats::RefreshStats, this);
+    }
+}
+
+void
+FwStats::RemoveFace (Ptr<Face> face)
+{
+  m_stats.RemoveFace (face);
+
+  super::RemoveFace (face);
+}
+
+
+} // namespace fw
+} // namespace ndn
+} // namespace ns3
diff --git a/model/fw/fw-stats.h b/model/fw/fw-stats.h
new file mode 100644
index 0000000..2b8cae9
--- /dev/null
+++ b/model/fw/fw-stats.h
@@ -0,0 +1,130 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+
+#ifndef NDNSIM_FW_STATS_H
+#define NDNSIM_FW_STATS_H
+
+#include "ns3/event-id.h"
+
+#include "best-route.h"
+#include "../../utils/stats-tree.h"
+
+namespace ns3 {
+namespace ndn {
+namespace fw {
+
+/**
+ * \ingroup ndn
+ * \brief Strategy based on best route and adding statistics gathering capabilities
+ */
+class FwStats :
+    public BestRoute
+{
+public:
+  static TypeId
+  GetTypeId ();
+
+  /**
+   * @brief Default constructor
+   */
+  FwStats ();
+
+  inline
+  const ndnSIM::StatsTree &
+  GetStatsTree () const;  
+
+  virtual void
+  OnInterest (const Ptr<Face> &face,
+              Ptr<InterestHeader> &header,
+              const Ptr<const Packet> &p);
+
+  virtual void
+  OnData (const Ptr<Face> &face,
+          Ptr<ContentObjectHeader> &header,
+          Ptr<Packet> &payload,
+          const Ptr<const Packet> &packet);
+
+  virtual void
+  RemoveFace (Ptr<Face> face);
+
+protected:
+  virtual void
+  DidCreatePitEntry (const Ptr<Face> &incomingFace,
+                     Ptr<InterestHeader> header,
+                     const Ptr<const Packet> &packet,
+                     Ptr<pit::Entry> pitEntry);
+
+  virtual void
+  FailedToCreatePitEntry (const Ptr<Face> &incomingFace,
+                          Ptr<InterestHeader> header,
+                          const Ptr<const Packet> &packet);
+
+  virtual void
+  WillSatisfyPendingInterest (const Ptr<Face> &incomingFace,
+                              Ptr<pit::Entry> pitEntry);
+
+  virtual void
+  DidSendOutInterest (const Ptr<Face> &outgoingFace,
+                      Ptr<InterestHeader> header,
+                      const Ptr<const Packet> &packet,
+                      Ptr<pit::Entry> pitEntry);
+
+  virtual void
+  DidSendOutData (const Ptr<Face> &face,
+                  Ptr<const ContentObjectHeader> header,
+                  Ptr<const Packet> payload,
+                  const Ptr<const Packet> &packet);
+
+  virtual void
+  WillErasePendingInterest (Ptr<pit::Entry> pitEntry);
+
+  // from Object
+  void
+  DoDispose ();
+  
+private:
+  void
+  RefreshStats ();
+
+  void
+  ScheduleRefreshingIfNecessary ();
+  
+private:
+  ndnSIM::StatsTree m_stats;
+  EventId m_statsRefreshEvent;
+
+  TracedCallback< Ptr<ForwardingStrategy>,
+                  const ndnSIM::StatsTree & > m_statsTrace;
+  
+  typedef BestRoute super;
+};
+
+const ndnSIM::StatsTree &
+FwStats::GetStatsTree () const
+{
+  return m_stats;
+}
+
+} // namespace fw
+} // namespace ndn
+} // namespace ns3
+
+#endif // NDNSIM_FW_STATS_H
diff --git a/model/fw/green-yellow-red.cc b/model/fw/green-yellow-red.cc
new file mode 100644
index 0000000..3f0653f
--- /dev/null
+++ b/model/fw/green-yellow-red.cc
@@ -0,0 +1,133 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author:  Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ *          Ilya Moiseenko <iliamo@cs.ucla.edu>
+ */
+
+#include "green-yellow-red.h"
+
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-pit-entry.h"
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-fib.h"
+#include "ns3/ndn-content-store.h"
+
+#include "ns3/assert.h"
+#include "ns3/ptr.h"
+#include "ns3/log.h"
+#include "ns3/simulator.h"
+#include "ns3/boolean.h"
+#include "ns3/string.h"
+
+#include <boost/ref.hpp>
+#include <boost/foreach.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+#include <boost/tuple/tuple.hpp>
+namespace ll = boost::lambda;
+
+NS_LOG_COMPONENT_DEFINE ("ndn.fw.GreenYellowRed");
+
+namespace ns3 {
+namespace ndn {
+namespace fw {
+
+NS_OBJECT_ENSURE_REGISTERED (GreenYellowRed);
+
+TypeId
+GreenYellowRed::GetTypeId (void)
+{
+  static TypeId tid = TypeId ("ns3::ndn::fw::GreenYellowRed")
+    .SetGroupName ("Ndn")
+    .SetParent<Nacks> ()
+
+    ;
+  return tid;
+}
+
+bool
+GreenYellowRed::DoPropagateInterest (const Ptr<Face> &incomingFace,
+                                     Ptr<InterestHeader> header,
+                                     const Ptr<const Packet> &packet,
+                                     Ptr<pit::Entry> pitEntry)
+{
+  NS_LOG_FUNCTION (this);
+  NS_ASSERT_MSG (m_pit != 0, "PIT should be aggregated with forwarding strategy");
+
+  int propagatedCount = 0;
+  
+  BOOST_FOREACH (const fib::FaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<fib::i_metric> ())
+    {
+      if (metricFace.m_status == fib::FaceMetric::NDN_FIB_RED ||
+          metricFace.m_status == fib::FaceMetric::NDN_FIB_YELLOW)
+        break; //propagate only to green faces
+
+      if (pitEntry->GetIncoming ().find (metricFace.m_face) != pitEntry->GetIncoming ().end ()) 
+        continue; // don't forward to face that we received interest from
+
+      if (!WillSendOutInterest (metricFace.m_face, header, pitEntry))
+        {
+          continue;
+        }
+
+      //transmission
+      Ptr<Packet> packetToSend = packet->Copy ();
+      metricFace.m_face->Send (packetToSend);
+
+      DidSendOutInterest (metricFace.m_face, header, packet, pitEntry);
+      
+      propagatedCount++;
+      break; // propagate only one interest
+    }
+
+  return propagatedCount > 0;
+}
+
+void
+GreenYellowRed::WillSatisfyPendingInterest (const Ptr<Face> &incomingFace,
+                                            Ptr<pit::Entry> pitEntry)
+{
+  if (incomingFace != 0)
+    {
+      // Update metric status for the incoming interface in the corresponding FIB entry
+      pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, fib::FaceMetric::NDN_FIB_GREEN);
+    }
+
+  super::WillSatisfyPendingInterest (incomingFace, pitEntry);
+}
+
+void
+GreenYellowRed::DidReceiveValidNack (const Ptr<Face> &incomingFace,
+                                     uint32_t nackCode,
+                                     Ptr<pit::Entry> pitEntry)
+{
+  super::DidReceiveValidNack (incomingFace, nackCode, pitEntry);
+
+  if (incomingFace != 0 &&
+      nackCode != InterestHeader::NACK_LOOP)
+    {
+      pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, fib::FaceMetric::NDN_FIB_YELLOW);
+    }
+}
+
+
+} // namespace fw
+} // namespace ndn
+} // namespace ns3
diff --git a/model/fw/green-yellow-red.h b/model/fw/green-yellow-red.h
new file mode 100644
index 0000000..f324376
--- /dev/null
+++ b/model/fw/green-yellow-red.h
@@ -0,0 +1,62 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author:  Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ *          Ilya Moiseenko <iliamo@cs.ucla.edu>
+ */
+#ifndef NDNSIM_GREEN_YELLOW_RED_H
+#define NDNSIM_GREEN_YELLOW_RED_H
+
+#include "nacks.h"
+
+namespace ns3 {
+namespace ndn {
+namespace fw {
+
+/**
+ * \ingroup ndn
+ */
+class GreenYellowRed :
+    public Nacks
+{
+public:
+  static TypeId GetTypeId (void);
+
+protected:
+  virtual void
+  WillSatisfyPendingInterest (const Ptr<Face> &incomingFace,
+                              Ptr<pit::Entry> pitEntry);
+
+  virtual bool
+  DoPropagateInterest (const Ptr<Face> &incomingFace,
+                       Ptr<InterestHeader> header,
+                       const Ptr<const Packet> &packet,
+                       Ptr<pit::Entry> pitEntry);
+  virtual void
+  DidReceiveValidNack (const Ptr<Face> &incomingFace,
+                       uint32_t nackCode,
+                       Ptr<pit::Entry> pitEntry);
+
+private:
+  typedef Nacks super;
+};
+
+} // namespace fw
+} // namespace ndn
+} // namespace ns3
+
+#endif // NDNSIM_GREEN_YELLOW_RED
diff --git a/model/fw/nacks.cc b/model/fw/nacks.cc
new file mode 100644
index 0000000..a148794
--- /dev/null
+++ b/model/fw/nacks.cc
@@ -0,0 +1,203 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author:  Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "nacks.h"
+
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-pit-entry.h"
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-fib.h"
+#include "ns3/ndn-content-store.h"
+
+#include "ns3/assert.h"
+#include "ns3/ptr.h"
+#include "ns3/log.h"
+#include "ns3/simulator.h"
+#include "ns3/boolean.h"
+#include "ns3/string.h"
+
+#include <boost/ref.hpp>
+#include <boost/foreach.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+#include <boost/tuple/tuple.hpp>
+namespace ll = boost::lambda;
+
+NS_LOG_COMPONENT_DEFINE ("ndn.fw.Nacks");
+
+namespace ns3 {
+namespace ndn {
+namespace fw {
+
+NS_OBJECT_ENSURE_REGISTERED (Nacks);
+
+TypeId
+Nacks::GetTypeId (void)
+{
+  static TypeId tid = TypeId ("ns3::ndn::fw::Nacks")
+    .SetGroupName ("Ndn")
+    .SetParent<ForwardingStrategy> ()
+    
+    ////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////
+
+    .AddTraceSource ("OutNacks",  "OutNacks",  MakeTraceSourceAccessor (&Nacks::m_outNacks))
+    .AddTraceSource ("InNacks",   "InNacks",   MakeTraceSourceAccessor (&Nacks::m_inNacks))
+    .AddTraceSource ("DropNacks", "DropNacks", MakeTraceSourceAccessor (&Nacks::m_dropNacks))
+    
+    .AddAttribute ("EnableNACKs", "Enabling support of NACKs",
+                   BooleanValue (false),
+                   MakeBooleanAccessor (&Nacks::m_nacksEnabled),
+                   MakeBooleanChecker ())
+    ;
+  return tid;
+}
+
+void
+Nacks::OnInterest (const Ptr<Face> &incomingFace,
+                   Ptr<InterestHeader> &header,
+                   const Ptr<const Packet> &packet)
+{
+  if (header->GetNack () > 0)
+    OnNack (incomingFace, header, packet/*original packet*/);
+  else
+    super::OnInterest (incomingFace, header, packet/*original packet*/);  
+}
+
+void
+Nacks::OnNack (const Ptr<Face> &incomingFace,
+               Ptr<InterestHeader> &header,
+               const Ptr<const Packet> &packet)
+{
+  NS_ASSERT (m_nacksEnabled);
+
+  // NS_LOG_FUNCTION (incomingFace << header << packet);
+  m_inNacks (header, incomingFace);
+
+  Ptr<pit::Entry> pitEntry = m_pit->Lookup (*header);
+  if (pitEntry == 0)
+    {
+      // somebody is doing something bad
+      m_dropNacks (header, incomingFace);
+      return;
+    }
+  
+  // This was done in error. Never, never do anything, except normal leakage. This way we ensure that we will not have losses,
+  // at least when there is only one client
+  //
+  // incomingFace->LeakBucketByOnePacket ();
+
+  pitEntry->SetWaitingInVain (incomingFace);
+
+  DidReceiveValidNack (incomingFace, header->GetNack (), pitEntry);
+  
+  if (!pitEntry->AreAllOutgoingInVain ()) // not all ougtoing are in vain
+    {
+      NS_LOG_DEBUG ("Not all outgoing are in vain");
+      // suppress
+      // Don't do anything, we are still expecting data from some other face
+      m_dropNacks (header, incomingFace);
+      return;
+    }
+  
+  Ptr<Packet> nonNackInterest = Create<Packet> ();
+  header->SetNack (InterestHeader::NORMAL_INTEREST);
+  nonNackInterest->AddHeader (*header);
+  
+  bool propagated = DoPropagateInterest (incomingFace, header, nonNackInterest, pitEntry);
+  if (!propagated)
+    {
+      DidExhaustForwardingOptions (incomingFace, header, nonNackInterest, pitEntry);
+    }  
+}
+
+void
+Nacks::DidReceiveDuplicateInterest (const Ptr<Face> &incomingFace,
+                                    Ptr<InterestHeader> &header,
+                                    const Ptr<const Packet> &packet,
+                                    Ptr<pit::Entry> pitEntry)
+{
+  super::DidReceiveDuplicateInterest (incomingFace, header, packet, pitEntry);
+
+  if (m_nacksEnabled)
+    {
+      NS_LOG_DEBUG ("Sending NACK_LOOP");
+      header->SetNack (InterestHeader::NACK_LOOP);
+      Ptr<Packet> nack = Create<Packet> ();
+      nack->AddHeader (*header);
+
+      incomingFace->Send (nack);
+      m_outNacks (header, incomingFace);
+    }
+}
+
+void
+Nacks::DidExhaustForwardingOptions (const Ptr<Face> &incomingFace,
+                                    Ptr<InterestHeader> header,
+                                    const Ptr<const Packet> &packet,
+                                    Ptr<pit::Entry> pitEntry)
+{
+  super::DidExhaustForwardingOptions (incomingFace, header, packet, pitEntry);
+
+  if (m_nacksEnabled)
+    {
+      Ptr<Packet> packet = Create<Packet> ();
+      header->SetNack (InterestHeader::NACK_GIVEUP_PIT);
+      packet->AddHeader (*header);
+
+      BOOST_FOREACH (const pit::IncomingFace &incoming, pitEntry->GetIncoming ())
+        {
+          NS_LOG_DEBUG ("Send NACK for " << boost::cref (header->GetName ()) << " to " << boost::cref (*incoming.m_face));
+          incoming.m_face->Send (packet->Copy ());
+
+          m_outNacks (header, incoming.m_face);
+        }
+  
+      // All incoming interests cannot be satisfied. Remove them
+      pitEntry->ClearIncoming ();
+
+      // Remove also outgoing
+      pitEntry->ClearOutgoing ();
+  
+      // Set pruning timout on PIT entry (instead of deleting the record)
+      m_pit->MarkErased (pitEntry);
+    }  
+}
+
+void
+Nacks::DidReceiveValidNack (const Ptr<Face> &incomingFace,
+                            uint32_t nackCode,
+                            Ptr<pit::Entry> pitEntry)
+{
+  // If NACK is NACK_GIVEUP_PIT, then neighbor gave up trying to and removed it's PIT entry.
+  // So, if we had an incoming entry to this neighbor, then we can remove it now
+  if (nackCode == InterestHeader::NACK_GIVEUP_PIT)
+    {
+      pitEntry->RemoveIncoming (incomingFace);
+    }
+
+  pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, fib::FaceMetric::NDN_FIB_YELLOW);
+}
+
+} // namespace fw
+} // namespace ndn
+} // namespace ns3
diff --git a/model/fw/nacks.h b/model/fw/nacks.h
new file mode 100644
index 0000000..e9226ad
--- /dev/null
+++ b/model/fw/nacks.h
@@ -0,0 +1,98 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author:  Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+#ifndef NDNSIM_NACKS_H
+#define NDNSIM_NACKS_H
+
+#include "ns3/ndn-forwarding-strategy.h"
+
+namespace ns3 {
+namespace ndn {
+namespace fw {
+
+/**
+ * \ingroup ndn
+ * \brief Abstract base class for Ndn forwarding strategies
+ */
+class Nacks :
+    public ForwardingStrategy
+{
+public:
+  static TypeId
+  GetTypeId ();
+
+  /**
+   * \brief Actual processing of incoming Ndn interests. Note, interests do not have payload
+   * 
+   * Processing Interest packets
+   * @param face    incoming face
+   * @param header  deserialized Interest header
+   * @param packet  original packet
+   */
+  virtual void
+  OnInterest (const Ptr<Face> &face,
+              Ptr<InterestHeader> &header,
+              const Ptr<const Packet> &p);
+
+protected:
+  // using NdnForwardingStrategy::PropagateInterest; // some strange c++ cheating
+
+  virtual void
+  DidReceiveDuplicateInterest (const Ptr<Face> &face,
+                               Ptr<InterestHeader> &header,
+                               const Ptr<const Packet> &packet,
+                               Ptr<pit::Entry> pitEntry);
+  
+  virtual void
+  DidExhaustForwardingOptions (const Ptr<Face> &incomingFace,
+                               Ptr<InterestHeader> header,
+                               const Ptr<const Packet> &packet,
+                               Ptr<pit::Entry> pitEntry);
+
+  virtual void
+  OnNack (const Ptr<Face> &face,
+          Ptr<InterestHeader> &header,
+          const Ptr<const Packet> &p);
+
+  virtual void
+  DidReceiveValidNack (const Ptr<Face> &incomingFace,
+                       uint32_t nackCode,
+                       Ptr<pit::Entry> pitEntry);
+  
+protected:  
+  bool m_nacksEnabled;
+
+  TracedCallback<Ptr<const InterestHeader>,
+                 Ptr<const Face> > m_outNacks; ///< @brief trace of outgoing NACKs
+
+  TracedCallback<Ptr<const InterestHeader>,
+                 Ptr<const Face> > m_inNacks; ///< @brief trace of incoming NACKs
+
+  TracedCallback<Ptr<const InterestHeader>,
+                 Ptr<const Face> > m_dropNacks; ///< @brief trace of dropped NACKs
+
+private:
+  typedef ForwardingStrategy super;
+};
+
+} // namespace fw
+} // namespace ndn
+} // namespace ns3
+
+#endif // NDNSIM_NACKS
diff --git a/model/fw/ndn-forwarding-strategy.cc b/model/fw/ndn-forwarding-strategy.cc
new file mode 100644
index 0000000..f1c92bd
--- /dev/null
+++ b/model/fw/ndn-forwarding-strategy.cc
@@ -0,0 +1,483 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author:  Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ *          Ilya Moiseenko <iliamo@cs.ucla.edu>
+ */
+
+#include "ndn-forwarding-strategy.h"
+
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-pit-entry.h"
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-fib.h"
+#include "ns3/ndn-content-store.h"
+#include "ns3/ndn-face.h"
+
+#include "ns3/assert.h"
+#include "ns3/ptr.h"
+#include "ns3/log.h"
+#include "ns3/simulator.h"
+#include "ns3/boolean.h"
+#include "ns3/string.h"
+
+#include <boost/ref.hpp>
+#include <boost/foreach.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+#include <boost/tuple/tuple.hpp>
+namespace ll = boost::lambda;
+
+NS_LOG_COMPONENT_DEFINE ("ndn.ForwardingStrategy");
+
+namespace ns3 {
+namespace ndn {
+
+NS_OBJECT_ENSURE_REGISTERED (ForwardingStrategy);
+
+TypeId ForwardingStrategy::GetTypeId (void)
+{
+  static TypeId tid = TypeId ("ns3::ndn::ForwardingStrategy")
+    .SetGroupName ("Ndn")
+    .SetParent<Object> ()
+
+    ////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////
+
+    .AddTraceSource ("OutInterests",  "OutInterests",  MakeTraceSourceAccessor (&ForwardingStrategy::m_outInterests))
+    .AddTraceSource ("InInterests",   "InInterests",   MakeTraceSourceAccessor (&ForwardingStrategy::m_inInterests))
+    .AddTraceSource ("DropInterests", "DropInterests", MakeTraceSourceAccessor (&ForwardingStrategy::m_dropInterests))
+    
+    ////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////
+
+    .AddTraceSource ("OutData",  "OutData",  MakeTraceSourceAccessor (&ForwardingStrategy::m_outData))
+    .AddTraceSource ("InData",   "InData",   MakeTraceSourceAccessor (&ForwardingStrategy::m_inData))
+    .AddTraceSource ("DropData", "DropData", MakeTraceSourceAccessor (&ForwardingStrategy::m_dropData))
+
+    .AddAttribute ("CacheUnsolicitedData", "Cache overheard data that have not been requested",
+                   BooleanValue (false),
+                   MakeBooleanAccessor (&ForwardingStrategy::m_cacheUnsolicitedData),
+                   MakeBooleanChecker ())
+
+    .AddAttribute ("DetectRetransmissions", "If non-duplicate interest is received on the same face more than once, "
+                                            "it is considered a retransmission",
+                   BooleanValue (true),
+                   MakeBooleanAccessor (&ForwardingStrategy::m_detectRetransmissions),
+                   MakeBooleanChecker ())
+    ;
+  return tid;
+}
+
+ForwardingStrategy::ForwardingStrategy ()
+{
+}
+
+ForwardingStrategy::~ForwardingStrategy ()
+{
+}
+
+void
+ForwardingStrategy::NotifyNewAggregate ()
+{
+  if (m_pit == 0)
+    {
+      m_pit = GetObject<Pit> ();
+    }
+  if (m_fib == 0)
+    {
+      m_fib = GetObject<Fib> ();
+    }
+  if (m_contentStore == 0)
+    {
+      m_contentStore = GetObject<ContentStore> ();
+    }
+
+  Object::NotifyNewAggregate ();
+}
+
+void
+ForwardingStrategy::DoDispose ()
+{
+  m_pit = 0;
+  m_contentStore = 0;
+  m_fib = 0;
+
+  Object::DoDispose ();
+}
+
+void
+ForwardingStrategy::OnInterest (const Ptr<Face> &incomingFace,
+                                    Ptr<InterestHeader> &header,
+                                    const Ptr<const Packet> &packet)
+{
+  m_inInterests (header, incomingFace);
+
+  Ptr<pit::Entry> pitEntry = m_pit->Lookup (*header);
+  if (pitEntry == 0)
+    {
+      pitEntry = m_pit->Create (header);
+      if (pitEntry != 0)
+        {
+          DidCreatePitEntry (incomingFace, header, packet, pitEntry);
+        }
+      else
+        {
+          FailedToCreatePitEntry (incomingFace, header, packet);
+          return;
+        }
+    }
+
+  bool isDuplicated = true;
+  if (!pitEntry->IsNonceSeen (header->GetNonce ()))
+    {
+      pitEntry->AddSeenNonce (header->GetNonce ());
+      isDuplicated = false;
+    }
+
+  if (isDuplicated) 
+    {
+      DidReceiveDuplicateInterest (incomingFace, header, packet, pitEntry);
+      return;
+    }
+
+  Ptr<Packet> contentObject;
+  Ptr<const ContentObjectHeader> contentObjectHeader; // used for tracing
+  Ptr<const Packet> payload; // used for tracing
+  boost::tie (contentObject, contentObjectHeader, payload) = m_contentStore->Lookup (header);
+  if (contentObject != 0)
+    {
+      NS_ASSERT (contentObjectHeader != 0);      
+
+      pitEntry->AddIncoming (incomingFace/*, Seconds (1.0)*/);
+
+      // Do data plane performance measurements
+      WillSatisfyPendingInterest (0, pitEntry);
+
+      // Actually satisfy pending interest
+      SatisfyPendingInterest (0, contentObjectHeader, payload, contentObject, pitEntry);
+      return;
+    }
+
+  if (ShouldSuppressIncomingInterest (incomingFace, pitEntry))
+    {
+      pitEntry->AddIncoming (incomingFace/*, header->GetInterestLifetime ()*/);
+      // update PIT entry lifetime
+      pitEntry->UpdateLifetime (header->GetInterestLifetime ());
+
+      // Suppress this interest if we're still expecting data from some other face
+      NS_LOG_DEBUG ("Suppress interests");
+      m_dropInterests (header, incomingFace);
+      return;
+    }
+
+  PropagateInterest (incomingFace, header, packet, pitEntry);
+}
+
+void
+ForwardingStrategy::OnData (const Ptr<Face> &incomingFace,
+                                Ptr<ContentObjectHeader> &header,
+                                Ptr<Packet> &payload,
+                                const Ptr<const Packet> &packet)
+{
+  NS_LOG_FUNCTION (incomingFace << header->GetName () << payload << packet);
+  m_inData (header, payload, incomingFace);
+  
+  // Lookup PIT entry
+  Ptr<pit::Entry> pitEntry = m_pit->Lookup (*header);
+  if (pitEntry == 0)
+    {
+      DidReceiveUnsolicitedData (incomingFace, header, payload);
+      return;
+    }
+  else
+    {
+      // Add or update entry in the content store
+      m_contentStore->Add (header, payload);
+    }
+
+  while (pitEntry != 0)
+    {
+      // Do data plane performance measurements
+      WillSatisfyPendingInterest (incomingFace, pitEntry);
+
+      // Actually satisfy pending interest
+      SatisfyPendingInterest (incomingFace, header, payload, packet, pitEntry);
+
+      // Lookup another PIT entry
+      pitEntry = m_pit->Lookup (*header);
+    }
+}
+
+
+void
+ForwardingStrategy::DidReceiveDuplicateInterest (const Ptr<Face> &incomingFace,
+                                                     Ptr<InterestHeader> &header,
+                                                     const Ptr<const Packet> &packet,
+                                                     Ptr<pit::Entry> pitEntry)
+{
+  NS_LOG_FUNCTION (this << boost::cref (*incomingFace));
+  /////////////////////////////////////////////////////////////////////////////////////////
+  //                                                                                     //
+  // !!!! IMPORTANT CHANGE !!!! Duplicate interests will create incoming face entry !!!! //
+  //                                                                                     //
+  /////////////////////////////////////////////////////////////////////////////////////////
+  pitEntry->AddIncoming (incomingFace);
+  m_dropInterests (header, incomingFace);
+}
+
+void
+ForwardingStrategy::DidExhaustForwardingOptions (const Ptr<Face> &incomingFace,
+                                                     Ptr<InterestHeader> header,
+                                                     const Ptr<const Packet> &packet,
+                                                     Ptr<pit::Entry> pitEntry)
+{
+  NS_LOG_FUNCTION (this << boost::cref (*incomingFace));
+  m_dropInterests (header, incomingFace);
+}
+
+void
+ForwardingStrategy::FailedToCreatePitEntry (const Ptr<Face> &incomingFace,
+                                                Ptr<InterestHeader> header,
+                                                const Ptr<const Packet> &packet)
+{
+  NS_LOG_FUNCTION (this);
+  m_dropInterests (header, incomingFace);
+}
+  
+void
+ForwardingStrategy::DidCreatePitEntry (const Ptr<Face> &incomingFace,
+                                           Ptr<InterestHeader> header,
+                                           const Ptr<const Packet> &packet,
+                                           Ptr<pit::Entry> pitEntrypitEntry)
+{
+}
+
+bool
+ForwardingStrategy::DetectRetransmittedInterest (const Ptr<Face> &incomingFace,
+                                                     Ptr<pit::Entry> pitEntry)
+{
+  pit::Entry::in_iterator inFace = pitEntry->GetIncoming ().find (incomingFace);
+
+  bool isRetransmitted = false;
+  
+  if (inFace != pitEntry->GetIncoming ().end ())
+    {
+      // this is almost definitely a retransmission. But should we trust the user on that?
+      isRetransmitted = true;
+    }
+
+  return isRetransmitted;
+}
+
+void
+ForwardingStrategy::SatisfyPendingInterest (const Ptr<Face> &incomingFace,
+                                                Ptr<const ContentObjectHeader> header,
+                                                Ptr<const Packet> payload,
+                                                const Ptr<const Packet> &packet,
+                                                Ptr<pit::Entry> pitEntry)
+{
+  if (incomingFace != 0)
+    pitEntry->RemoveIncoming (incomingFace);
+
+  //satisfy all pending incoming Interests
+  BOOST_FOREACH (const pit::IncomingFace &incoming, pitEntry->GetIncoming ())
+    {
+      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
+    }
+
+  // All incoming interests are satisfied. Remove them
+  pitEntry->ClearIncoming ();
+
+  // Remove all outgoing faces
+  pitEntry->ClearOutgoing ();
+          
+  // Set pruning timout on PIT entry (instead of deleting the record)
+  m_pit->MarkErased (pitEntry);
+}
+
+void
+ForwardingStrategy::DidReceiveUnsolicitedData (const Ptr<Face> &incomingFace,
+                                                   Ptr<const ContentObjectHeader> header,
+                                                   Ptr<const Packet> payload)
+{
+  if (m_cacheUnsolicitedData)
+    {
+      // Optimistically add or update entry in the content store
+      m_contentStore->Add (header, payload);
+    }
+  else
+    {
+      // Drop data packet if PIT entry is not found
+      // (unsolicited data packets should not "poison" content store)
+      
+      //drop dulicated or not requested data packet
+      m_dropData (header, payload, incomingFace);
+    }
+}
+
+void
+ForwardingStrategy::WillSatisfyPendingInterest (const Ptr<Face> &incomingFace,
+                                                    Ptr<pit::Entry> pitEntry)
+{
+  pit::Entry::out_iterator out = pitEntry->GetOutgoing ().find (incomingFace);
+  
+  // If we have sent interest for this data via this face, then update stats.
+  if (out != pitEntry->GetOutgoing ().end ())
+    {
+      pitEntry->GetFibEntry ()->UpdateFaceRtt (incomingFace, Simulator::Now () - out->m_sendTime);
+    } 
+}
+
+bool
+ForwardingStrategy::ShouldSuppressIncomingInterest (const Ptr<Face> &incomingFace,
+                                                        Ptr<pit::Entry> pitEntry)
+{
+  bool isNew = pitEntry->GetIncoming ().size () == 0 && pitEntry->GetOutgoing ().size () == 0;
+
+  if (isNew) return false; // never suppress new interests
+  
+  bool isRetransmitted = m_detectRetransmissions && // a small guard
+                         DetectRetransmittedInterest (incomingFace, pitEntry);  
+
+  if (pitEntry->GetOutgoing ().find (incomingFace) != pitEntry->GetOutgoing ().end ())
+    {
+      NS_LOG_DEBUG ("Non duplicate interests from the face we have sent interest to. Don't suppress");
+      // got a non-duplicate interest from the face we have sent interest to
+      // Probably, there is no point in waiting data from that face... Not sure yet
+
+      // If we're expecting data from the interface we got the interest from ("producer" asks us for "his own" data)
+      // Mark interface YELLOW, but keep a small hope that data will come eventually.
+
+      // ?? not sure if we need to do that ?? ...
+      
+      // pitEntry->GetFibEntry ()->UpdateStatus (incomingFace, fib::FaceMetric::NDN_FIB_YELLOW);
+    }
+  else
+    if (!isNew && !isRetransmitted)
+      {
+        return true;
+      }
+
+  return false;
+}
+
+void
+ForwardingStrategy::PropagateInterest (const Ptr<Face> &incomingFace,
+                                           Ptr<InterestHeader> header,
+                                           const Ptr<const Packet> &packet,
+                                           Ptr<pit::Entry> pitEntry)
+{
+  bool isRetransmitted = m_detectRetransmissions && // a small guard
+                         DetectRetransmittedInterest (incomingFace, pitEntry);  
+  
+  pitEntry->AddIncoming (incomingFace/*, header->GetInterestLifetime ()*/);
+  /// @todo Make lifetime per incoming interface
+  pitEntry->UpdateLifetime (header->GetInterestLifetime ());
+  
+  bool propagated = DoPropagateInterest (incomingFace, header, packet, pitEntry);
+
+  if (!propagated && isRetransmitted) //give another chance if retransmitted
+    {
+      // increase max number of allowed retransmissions
+      pitEntry->IncreaseAllowedRetxCount ();
+
+      // try again
+      propagated = DoPropagateInterest (incomingFace, header, packet, pitEntry);
+    }
+
+  // ForwardingStrategy will try its best to forward packet to at least one interface.
+  // If no interests was propagated, then there is not other option for forwarding or
+  // ForwardingStrategy failed to find it. 
+  if (!propagated && pitEntry->GetOutgoing ().size () == 0)
+    {
+      DidExhaustForwardingOptions (incomingFace, header, packet, pitEntry);
+    }
+}
+
+bool
+ForwardingStrategy::WillSendOutInterest (const Ptr<Face> &outgoingFace,
+                                             Ptr<InterestHeader> header,
+                                             Ptr<pit::Entry> pitEntry)
+{
+  pit::Entry::out_iterator outgoing =
+    pitEntry->GetOutgoing ().find (outgoingFace);
+      
+  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
+    }
+
+  
+  bool ok = outgoingFace->IsBelowLimit ();
+  if (!ok)
+    return false;
+
+  pitEntry->AddOutgoing (outgoingFace);
+  return true;
+}
+
+void
+ForwardingStrategy::DidSendOutInterest (const Ptr<Face> &outgoingFace,
+                                            Ptr<InterestHeader> header,
+                                            const Ptr<const Packet> &packet,
+                                            Ptr<pit::Entry> pitEntry)
+{
+  m_outInterests (header, outgoingFace);
+}
+
+void
+ForwardingStrategy::DidSendOutData (const Ptr<Face> &face,
+                                        Ptr<const ContentObjectHeader> header,
+                                        Ptr<const Packet> payload,
+                                        const Ptr<const Packet> &packet)
+{
+}
+
+void
+ForwardingStrategy::WillErasePendingInterest (Ptr<pit::Entry> pitEntry)
+{
+  // do nothing for now. may be need to do some logging
+}
+
+
+void
+ForwardingStrategy::RemoveFace (Ptr<Face> face)
+{
+  // do nothing here
+}
+
+} // namespace ndn
+} // namespace ns3
diff --git a/model/fw/ndn-forwarding-strategy.h b/model/fw/ndn-forwarding-strategy.h
new file mode 100644
index 0000000..1d4111e
--- /dev/null
+++ b/model/fw/ndn-forwarding-strategy.h
@@ -0,0 +1,231 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author:  Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ *          Ilya Moiseenko <iliamo@cs.ucla.edu>
+ */
+#ifndef NDN_FORWARDING_STRATEGY_H
+#define NDN_FORWARDING_STRATEGY_H
+
+#include "ns3/packet.h"
+#include "ns3/callback.h"
+#include "ns3/object.h"
+#include "ns3/traced-callback.h"
+
+namespace ns3 {
+namespace ndn {
+
+class Face;
+class InterestHeader;
+class ContentObjectHeader;
+class Pit;
+namespace pit { class Entry; }
+class FibFaceMetric;
+class Fib;
+class ContentStore;
+
+/**
+ * \ingroup ndn
+ * \brief Abstract base class for Ndn forwarding strategies
+ */
+class ForwardingStrategy :
+    public Object
+{
+public:
+  static TypeId GetTypeId (void);
+
+  /**
+   * @brief Default constructor
+   */
+  ForwardingStrategy ();
+  virtual ~ForwardingStrategy ();
+
+  /**
+   * \brief Actual processing of incoming Ndn interests. Note, interests do not have payload
+   * 
+   * Processing Interest packets
+   * @param face    incoming face
+   * @param header  deserialized Interest header
+   * @param packet  original packet
+   */
+  virtual void
+  OnInterest (const Ptr<Face> &face,
+              Ptr<InterestHeader> &header,
+              const Ptr<const Packet> &p);
+
+  /**
+   * \brief Actual processing of incoming Ndn content objects
+   * 
+   * Processing ContentObject packets
+   * @param face    incoming face
+   * @param header  deserialized ContentObject header
+   * @param payload data packet payload
+   * @param packet  original packet
+   */
+  virtual void
+  OnData (const Ptr<Face> &face,
+          Ptr<ContentObjectHeader> &header,
+          Ptr<Packet> &payload,
+          const Ptr<const Packet> &packet);
+
+  virtual void
+  WillErasePendingInterest (Ptr<pit::Entry> pitEntry);
+
+  virtual void
+  RemoveFace (Ptr<Face> face);
+  
+protected:
+  // events
+  virtual void
+  DidReceiveDuplicateInterest (const Ptr<Face> &face,
+                               Ptr<InterestHeader> &header,
+                               const Ptr<const Packet> &packet,
+                               Ptr<pit::Entry> pitEntry);
+
+  virtual void
+  DidExhaustForwardingOptions (const Ptr<Face> &incomingFace,
+                               Ptr<InterestHeader> header,
+                               const Ptr<const Packet> &packet,
+                               Ptr<pit::Entry> pitEntry);
+
+  virtual void
+  FailedToCreatePitEntry (const Ptr<Face> &incomingFace,
+                          Ptr<InterestHeader> header,
+                          const Ptr<const Packet> &packet);
+  
+  virtual void
+  DidCreatePitEntry (const Ptr<Face> &incomingFace,
+                     Ptr<InterestHeader> header,
+                     const Ptr<const Packet> &packet,
+                     Ptr<pit::Entry> pitEntry);
+
+  virtual bool
+  DetectRetransmittedInterest (const Ptr<Face> &incomingFace,
+                               Ptr<pit::Entry> pitEntry);
+
+  // makes sense only for data received from network
+  // When Interest is satisfied from the cache, incoming face is 0
+  virtual void
+  WillSatisfyPendingInterest (const Ptr<Face> &incomingFace,
+                              Ptr<pit::Entry> pitEntry);
+
+  // for data received both from network and cache
+  virtual void
+  SatisfyPendingInterest (const Ptr<Face> &incomingFace, // 0 allowed (from cache)
+                          Ptr<const ContentObjectHeader> header,
+                          Ptr<const Packet> payload,
+                          const Ptr<const Packet> &packet,
+                          Ptr<pit::Entry> pitEntry);
+
+  virtual void
+  DidSendOutData (const Ptr<Face> &face,
+                  Ptr<const ContentObjectHeader> header,
+                  Ptr<const Packet> payload,
+                  const Ptr<const Packet> &packet);
+  
+  virtual void
+  DidReceiveUnsolicitedData (const Ptr<Face> &incomingFace,
+                             Ptr<const ContentObjectHeader> header,
+                             Ptr<const Packet> payload);
+  
+  virtual bool
+  ShouldSuppressIncomingInterest (const Ptr<Face> &incomingFace,
+                                  Ptr<pit::Entry> pitEntry);
+
+  /**
+   * @brief Event fired before actually sending out an interest
+   *
+   * If event returns false, then there is some kind of a problem (e.g., per-face limit reached)
+   */
+  virtual bool
+  WillSendOutInterest (const Ptr<Face> &outgoingFace,
+                       Ptr<InterestHeader> header,
+                       Ptr<pit::Entry> pitEntry);
+
+  /**
+   * @brief Event fired just after sending out an interest
+   */
+  virtual void
+  DidSendOutInterest (const Ptr<Face> &outgoingFace,
+                      Ptr<InterestHeader> header,
+                      const Ptr<const Packet> &packet,
+                      Ptr<pit::Entry> pitEntry);
+
+  virtual void
+  PropagateInterest (const Ptr<Face> &incomingFace,
+                     Ptr<InterestHeader> header,
+                     const Ptr<const Packet> &packet,
+                     Ptr<pit::Entry> pitEntry);
+  
+  /**
+   * @brief Base method to propagate the interest according to the forwarding strategy
+   *
+   * @param pitEntry      Reference to PIT entry (reference to corresponding FIB entry inside)
+   * @param incomingFace  Incoming face
+   * @param header        InterestHeader
+   * @param packet        Original Interest packet
+   * @param sendCallback  Send callback
+   *
+   * @return true if interest was successfully propagated, false if all options have failed
+   */
+  virtual bool
+  DoPropagateInterest (const Ptr<Face> &incomingFace,
+                       Ptr<InterestHeader> header,
+                       const Ptr<const Packet> &packet,
+                       Ptr<pit::Entry> pitEntry) = 0;
+  
+protected:
+  // inherited from Object class                                                                                                                                                        
+  virtual void NotifyNewAggregate (); ///< @brief Even when object is aggregated to another Object
+  virtual void DoDispose (); ///< @brief Do cleanup
+  
+protected:  
+  Ptr<Pit> m_pit; ///< \brief Reference to PIT to which this forwarding strategy is associated
+  Ptr<Fib> m_fib; ///< \brief FIB  
+  Ptr<ContentStore> m_contentStore; ///< \brief Content store (for caching purposes only)
+
+  bool m_cacheUnsolicitedData;
+  bool m_detectRetransmissions;
+  
+  TracedCallback<Ptr<const InterestHeader>,
+                 Ptr<const Face> > m_outInterests; ///< @brief Transmitted interests trace
+
+  TracedCallback<Ptr<const InterestHeader>,
+                 Ptr<const Face> > m_inInterests; ///< @brief trace of incoming Interests
+
+  TracedCallback<Ptr<const InterestHeader>,
+                 Ptr<const Face> > m_dropInterests; ///< @brief trace of dropped Interests
+  
+  ////////////////////////////////////////////////////////////////////
+  ////////////////////////////////////////////////////////////////////
+  ////////////////////////////////////////////////////////////////////
+
+  TracedCallback<Ptr<const ContentObjectHeader>, Ptr<const Packet>,
+                 bool /*from cache*/,
+                 Ptr<const Face> > m_outData; ///< @brief trace of outgoing Data
+
+  TracedCallback<Ptr<const ContentObjectHeader>, Ptr<const Packet>,
+                 Ptr<const Face> > m_inData; ///< @brief trace of incoming Data
+
+  TracedCallback<Ptr<const ContentObjectHeader>, Ptr<const Packet>,
+                  Ptr<const Face> > m_dropData;  ///< @brief trace of dropped Data
+};
+
+} // namespace ndn
+} // namespace ns3
+
+#endif /* NDN_FORWARDING_STRATEGY_H */
diff --git a/model/fw/smart-flooding.cc b/model/fw/smart-flooding.cc
new file mode 100644
index 0000000..53272e9
--- /dev/null
+++ b/model/fw/smart-flooding.cc
@@ -0,0 +1,108 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "smart-flooding.h"
+
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-pit.h"
+#include "ns3/ndn-pit-entry.h"
+
+#include "ns3/assert.h"
+#include "ns3/log.h"
+#include "ns3/simulator.h"
+#include "ns3/boolean.h"
+
+#include <boost/ref.hpp>
+#include <boost/foreach.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+namespace ll = boost::lambda;
+
+NS_LOG_COMPONENT_DEFINE ("ndn.fw.SmartFlooding");
+
+namespace ns3 {
+namespace ndn {
+namespace fw {
+
+NS_OBJECT_ENSURE_REGISTERED (SmartFlooding);
+    
+TypeId
+SmartFlooding::GetTypeId (void)
+{
+  static TypeId tid = TypeId ("ns3::ndn::fw::SmartFlooding")
+    .SetGroupName ("Ndn")
+    .SetParent <GreenYellowRed> ()
+    .AddConstructor <SmartFlooding> ()
+    ;
+  return tid;
+}
+    
+SmartFlooding::SmartFlooding ()
+{
+}
+
+bool
+SmartFlooding::DoPropagateInterest (const Ptr<Face> &incomingFace,
+                                    Ptr<InterestHeader> header,
+                                    const Ptr<const Packet> &packet,
+                                    Ptr<pit::Entry> pitEntry)
+{
+  NS_LOG_FUNCTION (this);
+
+  // Try to work out with just green faces
+  bool greenOk = super::DoPropagateInterest (incomingFace, header, packet, pitEntry);
+  if (greenOk)
+    return true;
+
+  int propagatedCount = 0;
+
+  BOOST_FOREACH (const fib::FaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<fib::i_metric> ())
+    {
+      NS_LOG_DEBUG ("Trying " << boost::cref(metricFace));
+      if (metricFace.m_status == fib::FaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list
+        break;
+      
+      if (metricFace.m_face == incomingFace) 
+        {
+          NS_LOG_DEBUG ("continue (same as incoming)");
+          continue; // same face as incoming, don't forward
+        }
+
+      if (!WillSendOutInterest (metricFace.m_face, header, pitEntry))
+        {
+          continue;
+        }
+
+      //transmission
+      Ptr<Packet> packetToSend = packet->Copy ();
+      metricFace.m_face->Send (packetToSend);
+
+      DidSendOutInterest (metricFace.m_face, header, packet, pitEntry);
+      
+      propagatedCount++;
+    }
+
+  NS_LOG_INFO ("Propagated to " << propagatedCount << " faces");
+  return propagatedCount > 0;
+}
+
+} // namespace fw
+} // namespace ndn
+} // namespace ns3
diff --git a/model/fw/smart-flooding.h b/model/fw/smart-flooding.h
new file mode 100644
index 0000000..a228d3e
--- /dev/null
+++ b/model/fw/smart-flooding.h
@@ -0,0 +1,59 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDNSIM_SMART_FLOODING_H
+#define NDNSIM_SMART_FLOODING_H
+
+#include "green-yellow-red.h"
+
+namespace ns3 {
+namespace ndn {
+namespace fw {
+
+/**
+ * \ingroup ccnx
+ */
+class SmartFlooding :
+    public GreenYellowRed
+{
+public:
+  static TypeId GetTypeId ();
+
+  /**
+   * @brief Default constructor
+   */
+  SmartFlooding ();
+
+  // inherited
+  virtual bool
+  DoPropagateInterest (const Ptr<Face> &incomingFace,
+                       Ptr<InterestHeader> header,
+                       const Ptr<const Packet> &packet,
+                       Ptr<pit::Entry> pitEntry);
+
+private:
+  typedef GreenYellowRed super;
+};
+
+} // namespace fw
+} // namespace ndn
+} // namespace ns3
+
+#endif // NDNSIM_SMART_FLOODING_H