Start of serious reorganization

The whole forwarding logic is (will be) moved to the Forwarding Strategy
class.
diff --git a/model/pit/ccnx-pit-entry-impl.h b/model/pit/ccnx-pit-entry-impl.h
new file mode 100644
index 0000000..c707cd6
--- /dev/null
+++ b/model/pit/ccnx-pit-entry-impl.h
@@ -0,0 +1,91 @@
+/* -*- 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 _CCNX_PIT_ENTRY_IMPL_H_
+#define	_CCNX_PIT_ENTRY_IMPL_H_
+
+namespace ns3 {
+
+class CcnxPit;
+class CcnxInterestHeader;
+class CcnxFibEntry;
+
+template<class Pit>
+class CcnxPitEntryImpl : public CcnxPitEntry
+{
+  typedef CcnxPitEntry super;
+  #define CONTAINER static_cast<Pit&> (m_container)
+  
+public:
+  CcnxPitEntryImpl (CcnxPit &pit,
+                    Ptr<const CcnxInterestHeader> header,
+                    Ptr<CcnxFibEntry> fibEntry)
+  : CcnxPitEntry (pit, header, fibEntry)
+  , item_ (0)
+  {
+    CONTAINER.i_time.insert (*this);
+    CONTAINER.RescheduleCleaning ();
+  }
+  
+  virtual ~CcnxPitEntryImpl ()
+  {
+    CONTAINER.i_time.erase (*this);
+    
+    CONTAINER.RescheduleCleaning ();
+  }
+
+  virtual void
+  UpdateLifetime (const Time &offsetTime)
+  {
+    CONTAINER.i_time.erase (*this);
+    super::UpdateLifetime (offsetTime);
+    CONTAINER.i_time.insert (*this);
+
+    CONTAINER.RescheduleCleaning ();
+  }
+
+  
+  // to make sure policies work
+  void
+  SetTrie (typename Pit::super::iterator item) { item_ = item; }
+
+  typename Pit::super::iterator to_iterator () { return item_; }
+  typename Pit::super::const_iterator to_iterator () const { return item_; }
+
+public:
+  boost::intrusive::set_member_hook<> time_hook_;
+  
+private:
+  typename Pit::super::iterator item_;
+};
+
+template<class T>
+struct TimestampIndex
+{
+  bool
+  operator () (const T &a, const T &b) const
+  {
+    return a.GetExpireTime () < b.GetExpireTime ();
+  }
+};
+
+} // ns3
+
+#endif 
diff --git a/model/pit/ccnx-pit-entry-incoming-face.cc b/model/pit/ccnx-pit-entry-incoming-face.cc
new file mode 100644
index 0000000..23f3c40
--- /dev/null
+++ b/model/pit/ccnx-pit-entry-incoming-face.cc
@@ -0,0 +1,51 @@
+/* -*- 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 "ccnx-pit-entry-incoming-face.h"
+
+#include "ns3/simulator.h"
+
+namespace ns3 {
+
+CcnxPitEntryIncomingFace::CcnxPitEntryIncomingFace (Ptr<CcnxFace> face)
+  : m_face (face)
+  , m_arrivalTime (Simulator::Now ())
+  // , m_nonce (nonce)
+{
+}
+
+CcnxPitEntryIncomingFace::CcnxPitEntryIncomingFace ()
+  : m_face (0)
+  , m_arrivalTime (0)
+{
+}
+
+/**
+ * @brie Copy operator
+ */
+CcnxPitEntryIncomingFace &
+CcnxPitEntryIncomingFace::operator = (CcnxPitEntryIncomingFace &other)
+{
+  m_face = other.m_face;
+  m_arrivalTime = other.m_arrivalTime;
+  return *this;
+}
+
+} // namespace ns3
diff --git a/model/pit/ccnx-pit-entry-incoming-face.h b/model/pit/ccnx-pit-entry-incoming-face.h
new file mode 100644
index 0000000..7c5e17d
--- /dev/null
+++ b/model/pit/ccnx-pit-entry-incoming-face.h
@@ -0,0 +1,79 @@
+/* -*- 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 _CCNX_PIT_ENTRY_INCOMING_FACE_H_
+#define	_CCNX_PIT_ENTRY_INCOMING_FACE_H_
+
+#include "ns3/nstime.h"
+#include "ns3/ptr.h"
+
+#include "ns3/ccnx-face.h"
+// #include <iostream>
+
+namespace ns3 {
+
+/**
+ * \ingroup ccnx
+ * \brief PIT state component for each incoming interest (not including duplicates)
+ */
+struct CcnxPitEntryIncomingFace
+{
+  Ptr<CcnxFace> m_face; ///< \brief face of the incoming Interest
+  Time m_arrivalTime;   ///< \brief arrival time of the incoming Interest
+
+public:
+  /**
+   * \brief Constructor
+   * \param face face of the incoming interest
+   * \param lifetime lifetime of the incoming interest
+   */
+  CcnxPitEntryIncomingFace (Ptr<CcnxFace> face);
+
+  /**
+   * @brief Default constructor, necessary for Python bindings, but should not be used anywhere else.
+   */
+  CcnxPitEntryIncomingFace ();
+  /**
+   * @brie Copy operator
+   */
+  CcnxPitEntryIncomingFace &
+  operator = (CcnxPitEntryIncomingFace &other);
+
+  /**
+   * @brief Compare two CcnxPitEntryIncomingFace
+   */
+  bool operator== (const CcnxPitEntryIncomingFace &dst) { return *m_face==*(dst.m_face); }
+
+  /**
+   * @brief Compare CcnxPitEntryIncomingFace with CcnxFace
+   */
+  bool operator== (Ptr<CcnxFace> face) { return *m_face==*face; }
+
+  /**
+   * \brief Comparison operator used by boost::multi_index::identity<>
+   */
+  bool
+  operator< (const CcnxPitEntryIncomingFace &m) const { return *m_face < *(m.m_face); } // return identity of the face
+};
+
+
+} // namespace ns3
+
+#endif	/* CCNX_PIT_ENTRY_INCOMING_FACE_H */
diff --git a/model/pit/ccnx-pit-entry-outgoing-face.cc b/model/pit/ccnx-pit-entry-outgoing-face.cc
new file mode 100644
index 0000000..8527779
--- /dev/null
+++ b/model/pit/ccnx-pit-entry-outgoing-face.cc
@@ -0,0 +1,43 @@
+/* -*- 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 "ccnx-pit-entry-outgoing-face.h"
+
+#include "ns3/simulator.h"
+
+namespace ns3 {
+
+CcnxPitEntryOutgoingFace::CcnxPitEntryOutgoingFace (Ptr<CcnxFace> face)
+  : m_face (face)
+  , m_sendTime (Simulator::Now ())
+  , m_retxCount (0)
+  , m_waitingInVain (false)
+{
+}
+
+void
+CcnxPitEntryOutgoingFace::UpdateOnRetransmit ()
+{
+  m_sendTime = Simulator::Now ();
+  m_retxCount++;
+  m_waitingInVain = false;
+}
+
+} // namespace ns3
diff --git a/model/pit/ccnx-pit-entry-outgoing-face.h b/model/pit/ccnx-pit-entry-outgoing-face.h
new file mode 100644
index 0000000..b16b4fd
--- /dev/null
+++ b/model/pit/ccnx-pit-entry-outgoing-face.h
@@ -0,0 +1,77 @@
+/* -*- 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 _CCNX_PIT_ENTRY_OUTGOING_FACE_H_
+#define	_CCNX_PIT_ENTRY_OUTGOING_FACE_H_
+
+#include "ns3/nstime.h"
+#include "ns3/ptr.h"
+
+#include "ns3/ccnx-face.h"
+
+namespace ns3 {
+
+/**
+ * \ingroup ccnx
+ * \brief PIT state component for each outgoing interest
+ */
+struct CcnxPitEntryOutgoingFace
+{
+  Ptr<CcnxFace> m_face;     ///< \brief face of the outgoing Interest
+  Time m_sendTime;          ///< \brief time when the first outgoing interest is sent (for RTT measurements)
+                            ///< \todo handle problem of retransmitted interests... Probably, we should include something similar
+                            ///<       to TimeStamp TCP option for retransmitted (i.e., only lost interests will suffer)
+  uint32_t m_retxCount;     ///< \brief number of retransmission
+  bool m_waitingInVain;     ///< \brief when flag is set, we do not expect data for this interest, only a small hope that it will happen
+	
+public:
+  /**
+   * @brief Constructor to create CcnxPitEntryOutgoingFace
+   * \param face face of the outgoing interest
+   */
+  CcnxPitEntryOutgoingFace (Ptr<CcnxFace> face);
+
+  /**
+   * @brief Update outgoing entry upon retransmission
+   */
+  void
+  UpdateOnRetransmit ();
+
+  /**
+   * @brief Compare to CcnxPitEntryOutgoingFace
+   */
+  bool operator== (const CcnxPitEntryOutgoingFace &dst) { return *m_face==*dst.m_face; }
+
+  /**
+   * @brief Compare CcnxPitEntryOutgoingFace with CcnxFace
+   */
+  bool operator== (Ptr<CcnxFace> face) { return *m_face==*face; }
+
+  /**
+   * \brief Comparison operator used by boost::multi_index::identity<>
+   */
+  bool
+  operator< (const CcnxPitEntryOutgoingFace &m) const { return *m_face < *(m.m_face); } // return identity of the face
+};
+
+
+} // namespace ns3
+
+#endif	/* CCNX_PIT_ENTRY_OUTGOING_FACE_H */
diff --git a/model/pit/ccnx-pit-entry.cc b/model/pit/ccnx-pit-entry.cc
new file mode 100644
index 0000000..081b155
--- /dev/null
+++ b/model/pit/ccnx-pit-entry.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 "ccnx-pit-entry.h"
+
+#include "ns3/ccnx-fib.h"
+#include "ns3/ccnx-name-components.h"
+#include "ns3/ccnx-interest-header.h"
+
+#include "ns3/simulator.h"
+#include "ns3/log.h"
+
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+#include <boost/foreach.hpp>
+namespace ll = boost::lambda;
+
+NS_LOG_COMPONENT_DEFINE ("CcnxPitEntry");
+
+namespace ns3
+{
+
+CcnxPitEntry::CcnxPitEntry (CcnxPit &container,
+                            Ptr<const CcnxInterestHeader> header,
+                            Ptr<CcnxFibEntry> fibEntry)
+  : m_container (container)
+  , m_prefix (header->GetNamePtr ())
+  , m_fibEntry (fibEntry)
+  , m_expireTime (Simulator::Now () + (!header->GetInterestLifetime ().IsZero ()?
+                                       header->GetInterestLifetime ():
+                                       Seconds (1.0)))
+  , m_maxRetxCount (0)
+{
+  // note that if interest lifetime is not set, the behavior is undefined
+}
+
+void
+CcnxPitEntry::UpdateLifetime (const Time &offsetTime)
+{
+  NS_LOG_FUNCTION (offsetTime.ToDouble (Time::S));
+  
+  Time newExpireTime = Simulator::Now () + offsetTime;
+  if (newExpireTime > m_expireTime)
+    m_expireTime = newExpireTime;
+  
+  NS_LOG_INFO ("Updated lifetime to " << m_expireTime.ToDouble (Time::S));
+}
+
+CcnxPitEntry::in_iterator
+CcnxPitEntry::AddIncoming (Ptr<CcnxFace> face)
+{
+  std::pair<in_iterator,bool> ret = 
+    m_incoming.insert (CcnxPitEntryIncomingFace (face));
+
+  NS_ASSERT_MSG (ret.second, "Something is wrong");
+
+  return ret.first;
+}
+
+void
+CcnxPitEntry::RemoveIncoming (Ptr<CcnxFace> face)
+{
+  m_incoming.erase (face);
+}
+
+
+CcnxPitEntry::out_iterator
+CcnxPitEntry::AddOutgoing (Ptr<CcnxFace> face)
+{
+  std::pair<out_iterator,bool> ret =
+    m_outgoing.insert (CcnxPitEntryOutgoingFace (face));
+
+  if (!ret.second)
+    { // outgoing face already exists
+      m_outgoing.modify (ret.first,
+                         ll::bind (&CcnxPitEntryOutgoingFace::UpdateOnRetransmit, ll::_1));
+    }
+
+  return ret.first;
+}
+
+void
+CcnxPitEntry::RemoveAllReferencesToFace (Ptr<CcnxFace> face)
+{
+  in_iterator incoming = m_incoming.find (face);
+
+  if (incoming != m_incoming.end ())
+    m_incoming.erase (incoming);
+
+  out_iterator outgoing =
+    m_outgoing.find (face);
+
+  if (outgoing != m_outgoing.end ())
+    m_outgoing.erase (outgoing);
+}
+
+void
+CcnxPitEntry::SetWaitingInVain (CcnxPitEntry::out_iterator face)
+{
+  NS_LOG_DEBUG (boost::cref (*face->m_face));
+
+  m_outgoing.modify (face,
+                     (&ll::_1)->*&CcnxPitEntryOutgoingFace::m_waitingInVain = true);
+}
+
+bool
+CcnxPitEntry::AreAllOutgoingInVain () const
+{
+  NS_LOG_DEBUG (m_outgoing.size ());
+
+  bool inVain = true;
+  std::for_each (m_outgoing.begin (), m_outgoing.end (),
+                 ll::var(inVain) &= (&ll::_1)->*&CcnxPitEntryOutgoingFace::m_waitingInVain);
+
+  NS_LOG_DEBUG ("inVain " << inVain);
+  return inVain;
+}
+
+bool
+CcnxPitEntry::AreTherePromisingOutgoingFacesExcept (Ptr<CcnxFace> face) const
+{
+  bool inVain = true;
+  std::for_each (m_outgoing.begin (), m_outgoing.end (),
+                 ll::var(inVain) &=
+                 ((&ll::_1)->*&CcnxPitEntryOutgoingFace::m_face == face ||
+                  (&ll::_1)->*&CcnxPitEntryOutgoingFace::m_waitingInVain));
+
+  return !inVain;
+}
+
+void
+CcnxPitEntry::IncreaseAllowedRetxCount ()
+{
+  NS_LOG_ERROR (this);
+  if (Simulator::Now () - m_lastRetransmission >= MilliSeconds (100))
+    {
+      // cheat:
+      // don't allow retransmission faster than every 100ms
+      m_maxRetxCount++;
+      m_lastRetransmission = Simulator::Now ();
+    }
+}
+
+std::ostream& operator<< (std::ostream& os, const CcnxPitEntry &entry)
+{
+  os << "Prefix: " << *entry.m_prefix << "\n";
+  os << "In: ";
+  bool first = true;
+  BOOST_FOREACH (const CcnxPitEntryIncomingFace &face, entry.m_incoming)
+    {
+      if (!first)
+        os << ",";
+      else
+        first = false;
+      
+      os << *face.m_face;
+    }
+
+  os << "\nOut: ";
+  first = true;
+  BOOST_FOREACH (const CcnxPitEntryOutgoingFace &face, entry.m_outgoing)
+    {
+      if (!first)
+        os << ",";
+      else
+        first = false;
+      
+      os << *face.m_face;
+    }
+  os << "\nNonces: ";
+  first = true;
+  BOOST_FOREACH (uint32_t nonce, entry.m_seenNonces)
+    {
+      if (!first)
+        os << ",";
+      else
+        first = false;
+      
+      os << nonce;
+    }
+
+  return os;
+}
+
+
+}
diff --git a/model/pit/ccnx-pit-entry.h b/model/pit/ccnx-pit-entry.h
new file mode 100644
index 0000000..37de28e
--- /dev/null
+++ b/model/pit/ccnx-pit-entry.h
@@ -0,0 +1,265 @@
+/* -*- 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 _CCNX_PIT_ENTRY_H_
+#define _CCNX_PIT_ENTRY_H_
+
+#include "ns3/ptr.h"
+#include "ns3/simple-ref-count.h"
+
+#include "ns3/ccnx-fib.h"
+#include "ccnx-pit-entry-incoming-face.h"
+#include "ccnx-pit-entry-outgoing-face.h"
+
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/tag.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+// #include <boost/multi_index/composite_key.hpp>
+// #include <boost/multi_index/hashed_index.hpp>
+#include <boost/multi_index/member.hpp>
+// #include <boost/multi_index/mem_fun.hpp>
+#include <set>
+
+namespace ns3 {
+
+class CcnxFace;
+class CcnxNameComponents;
+class CcnxPit;
+
+/// @cond include_hidden
+namespace __ccnx_private
+{
+class i_retx {};
+}
+/// @endcond
+
+/**
+ * \ingroup ccnx
+ * \brief Typedef for indexed face container of CcnxPitEntryOutgoingFace
+ *
+ * Indexes:
+ * - by face (may be it will be possible to replace with just the std::map)
+ */
+struct CcnxPitEntryOutgoingFaceContainer
+{
+  /// @cond include_hidden
+  typedef boost::multi_index::multi_index_container<
+    CcnxPitEntryOutgoingFace,
+    boost::multi_index::indexed_by<
+      // For fast access to elements using CcnxFace
+      boost::multi_index::ordered_unique<
+        boost::multi_index::tag<__ccnx_private::i_face>,
+        boost::multi_index::member<CcnxPitEntryOutgoingFace, Ptr<CcnxFace>, &CcnxPitEntryOutgoingFace::m_face>
+      >,
+      boost::multi_index::ordered_non_unique<
+        boost::multi_index::tag<__ccnx_private::i_retx>,
+        boost::multi_index::member<CcnxPitEntryOutgoingFace, uint32_t, &CcnxPitEntryOutgoingFace::m_retxCount>
+      >    
+    >
+   > type;
+  /// @endcond
+};
+
+
+/**
+ * \ingroup ccnx
+ * \brief structure for PIT entry
+ *
+ * All set-methods are virtual, in case index rearrangement is necessary in the derived classes
+ */
+class CcnxPitEntry : public SimpleRefCount<CcnxPitEntry>
+{
+public:
+  typedef std::set< CcnxPitEntryIncomingFace > in_container; ///< @brief incoming faces container type
+  typedef in_container::iterator in_iterator;                ///< @brief iterator to incoming faces
+
+  typedef CcnxPitEntryOutgoingFaceContainer::type out_container; ///< @brief outgoing faces container type
+  typedef out_container::iterator out_iterator;              ///< @brief iterator to outgoing faces
+
+  typedef std::set< uint32_t > nonce_container;  ///< @brief nonce container type
+  
+  /**
+   * \brief PIT entry constructor
+   * \param prefix Prefix of the PIT entry
+   * \param offsetTime Relative time to the current moment, representing PIT entry lifetime
+   * \param fibEntry A FIB entry associated with the PIT entry
+   */
+  CcnxPitEntry (CcnxPit &container, Ptr<const CcnxInterestHeader> header, Ptr<CcnxFibEntry> fibEntry);
+
+  /**
+   * @brief Virtual destructor
+   */
+  virtual ~CcnxPitEntry () {}
+  
+  /**
+   * @brief Update lifetime of PIT entry
+   *
+   * This function will update PIT entry lifetime to the maximum of the current lifetime and
+   * the lifetime Simulator::Now () + offsetTime
+   *
+   * @param offsetTime Relative time to the current moment, representing PIT entry lifetime
+   */
+  virtual void
+  UpdateLifetime (const Time &offsetTime);
+
+  /**
+   * @brief Get prefix of the PIT entry
+   */
+  const CcnxNameComponents &
+  GetPrefix () const
+  { return *m_prefix; }
+
+  /**
+   * @brief Get current expiration time of the record
+   *
+   * @returns current expiration time of the record
+   */
+  const Time &
+  GetExpireTime () const
+  { return m_expireTime; }
+
+  /**
+   * @brief Check if nonce `nonce` for the same prefix has already been seen
+   *
+   * @param nonce Nonce to check
+   */
+  bool
+  IsNonceSeen (uint32_t nonce) const
+  { return m_seenNonces.find (nonce) != m_seenNonces.end (); }
+
+  /**
+   * @brief Add `nonce` to the list of seen nonces
+   *
+   * @param nonce nonce to add to the list of seen nonces
+   *
+   * All nonces are stored for the lifetime of the PIT entry
+   */
+  virtual void
+  AddSeenNonce (uint32_t nonce)
+  { m_seenNonces.insert (nonce); }
+
+  /**
+   * @brief Add `face` to the list of incoming faces
+   *
+   * @param face Face to add to the list of incoming faces
+   * @returns iterator to the added entry
+   */
+  virtual in_iterator
+  AddIncoming (Ptr<CcnxFace> face);
+
+  /**
+   * @brief Remove incoming entry for face `face`
+   */
+  virtual void
+  RemoveIncoming (Ptr<CcnxFace> face);
+
+  /**
+   * @brief Clear all incoming faces either after all of them were satisfied or NACKed
+   */
+  virtual void
+  ClearIncoming ()
+  { m_incoming.clear (); }
+
+  /**
+   * @brief Add `face` to the list of outgoing faces
+   *
+   * @param face Face to add to the list of outgoing faces
+   * @returns iterator to the added entry
+   */
+  virtual out_iterator
+  AddOutgoing (Ptr<CcnxFace> face);
+
+  /**
+   * @brief Clear all incoming faces either after all of them were satisfied or NACKed
+   */
+  virtual void
+  ClearOutgoing ()
+  { m_outgoing.clear (); }  
+  
+  /**
+   * @brief Remove all references to face.
+   * 
+   * This method should be called before face is completely removed from the stack.
+   * Face is removed from the lists of incoming and outgoing faces
+   */
+  virtual void
+  RemoveAllReferencesToFace (Ptr<CcnxFace> face);
+
+  /**
+   * @brief Flag outgoing face as hopeless
+   */
+  virtual void
+  SetWaitingInVain (out_iterator face);
+  
+  /**
+   * @brief Check if all outgoing faces are NACKed
+   */
+  bool
+  AreAllOutgoingInVain () const;
+
+  /**
+   * @brief Similar to AreAllOutgoingInVain, but ignores `face`
+   * \see AreAllOutgoingInVain
+   **/
+  bool
+  AreTherePromisingOutgoingFacesExcept (Ptr<CcnxFace> face) const;
+
+  /**
+   * @brief Increase maximum limit of allowed retransmission per outgoing face
+   */
+  virtual void
+  IncreaseAllowedRetxCount ();
+
+  Ptr<CcnxFibEntry>
+  GetFibEntry () { return m_fibEntry; };
+
+  const in_container &
+  GetIncoming () const { return m_incoming; }
+
+  const out_container &
+  GetOutgoing () const { return m_outgoing; }
+
+  uint32_t
+  GetMaxRetxCount () const { return m_maxRetxCount; }
+
+private:
+  friend std::ostream& operator<< (std::ostream& os, const CcnxPitEntry &entry);
+  
+protected:
+  CcnxPit &m_container; ///< @brief Reference to the container (to rearrange indexes, if necessary)
+  
+  Ptr<const CcnxNameComponents> m_prefix; ///< \brief Prefix of the PIT entry
+  Ptr<CcnxFibEntry> m_fibEntry;     ///< \brief FIB entry related to this prefix
+  
+  nonce_container m_seenNonces;  ///< \brief map of nonces that were seen for this prefix  
+  in_container  m_incoming;      ///< \brief container for incoming interests
+  out_container m_outgoing;      ///< \brief container for outgoing interests
+
+  Time m_expireTime;         ///< \brief Time when PIT entry will be removed
+
+  Time m_lastRetransmission; ///< @brief Last time when number of retransmissions were increased
+  uint32_t m_maxRetxCount;   ///< @brief Maximum allowed number of retransmissions via outgoing faces
+};
+
+std::ostream& operator<< (std::ostream& os, const CcnxPitEntry &entry);
+
+} // namespace ns3
+
+#endif // _CCNX_PIT_ENTRY_H_
diff --git a/model/pit/ccnx-pit-impl.cc b/model/pit/ccnx-pit-impl.cc
new file mode 100644
index 0000000..c1867f0
--- /dev/null
+++ b/model/pit/ccnx-pit-impl.cc
@@ -0,0 +1,281 @@
+/* -*- 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 "ccnx-pit-impl.h"
+
+#include "ns3/ccnx-interest-header.h"
+#include "ns3/ccnx-content-object-header.h"
+
+#include "ns3/log.h"
+#include "ns3/string.h"
+#include "ns3/uinteger.h"
+#include "ns3/simulator.h"
+
+#include <boost/lambda/bind.hpp>
+#include <boost/lambda/lambda.hpp>
+
+NS_LOG_COMPONENT_DEFINE ("CcnxPitImpl");
+
+using namespace boost::tuples;
+using namespace boost;
+namespace ll = boost::lambda;
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (CcnxPitImpl);
+
+
+// CcnxPitEntryImpl::CcnxPitEntryImpl (CcnxPit &pit,
+//                                     Ptr<const CcnxInterestHeader> header,
+//                                     Ptr<CcnxFibEntry> fibEntry)
+//   : CcnxPitEntry (pit, header, fibEntry)
+//   , item_ (0)
+// {
+//   static_cast<CcnxPitImpl&> (m_container).i_time.insert (*this);
+// }
+
+// CcnxPitEntryImpl::~CcnxPitEntryImpl ()
+// {
+//   static_cast<CcnxPitImpl&> (m_container).i_time.erase (*this);
+// }
+
+TypeId
+CcnxPitImpl::GetTypeId ()
+{
+  static TypeId tid = TypeId ("ns3::CcnxPit")
+    .SetGroupName ("Ccnx")
+    .SetParent<CcnxPit> ()
+    .AddConstructor<CcnxPitImpl> ()
+    .AddAttribute ("MaxSize",
+                   "Set maximum number of entries in PIT. If 0, limit is not enforced",
+                   StringValue ("0"),
+                   MakeUintegerAccessor (&CcnxPitImpl::GetMaxSize, &CcnxPitImpl::SetMaxSize),
+                   MakeUintegerChecker<uint32_t> ())
+    ;
+
+  return tid;
+}
+
+CcnxPitImpl::CcnxPitImpl ()
+{
+}
+
+CcnxPitImpl::~CcnxPitImpl ()
+{
+}
+
+uint32_t
+CcnxPitImpl::GetMaxSize () const
+{
+  return getPolicy ().get_max_size ();
+}
+
+void
+CcnxPitImpl::SetMaxSize (uint32_t maxSize)
+{
+  getPolicy ().set_max_size (maxSize);
+}
+
+void 
+CcnxPitImpl::NotifyNewAggregate ()
+{
+  if (m_fib == 0)
+    {
+      m_fib = GetObject<CcnxFib> ();
+    }
+}
+
+void 
+CcnxPitImpl::DoDispose ()
+{
+  super::clear ();
+}
+
+void CcnxPitImpl::RescheduleCleaning ()
+{
+  m_cleanEvent.Cancel ();
+  if (i_time.empty ())
+    {
+      NS_LOG_DEBUG ("No items in PIT");
+      return;
+    }
+
+  Time nextEvent = i_time.begin ()->GetExpireTime () - Simulator::Now ();
+  if (nextEvent < 0) nextEvent = Seconds (0);
+  
+  NS_LOG_DEBUG ("Schedule next cleaning in " <<
+                nextEvent.ToDouble (Time::S) << "s (at " <<
+                i_time.begin ()->GetExpireTime () << "s abs time");
+  m_cleanEvent = Simulator::Schedule (nextEvent,
+                                      &CcnxPitImpl::CleanExpired, this);
+}
+
+void
+CcnxPitImpl::CleanExpired ()
+{
+  NS_LOG_LOGIC ("Cleaning PIT. Total: " << i_time.size ());
+  Time now = Simulator::Now ();
+
+  // uint32_t count = 0;
+  while (!i_time.empty ())
+    {
+      time_index::iterator entry = i_time.begin ();
+      if (entry->GetExpireTime () <= now) // is the record stale?
+        {
+          super::erase (entry->to_iterator ());
+      //     // count ++;
+        }
+      else
+        break; // nothing else to do. All later records will not be stale
+    }
+
+  RescheduleCleaning ();
+}
+
+Ptr<CcnxPitEntry>
+CcnxPitImpl::Lookup (const CcnxContentObjectHeader &header)
+{
+  /// @todo use predicate to search with exclude filters  
+  super::iterator item = super::longest_prefix_match (header.GetName ());
+
+  if (item == super::end ())
+    return 0;
+  else
+    return item->payload (); // which could also be 0
+}
+
+Ptr<CcnxPitEntry>
+CcnxPitImpl::Lookup (const CcnxInterestHeader &header)
+{
+  NS_LOG_FUNCTION (header.GetName ());
+  NS_ASSERT_MSG (m_fib != 0, "FIB should be set");
+
+  super::iterator foundItem, lastItem;
+  bool reachLast;
+  boost::tie (foundItem, reachLast, lastItem) = super::getTrie ().find (header.GetName ());
+
+  if (!reachLast || lastItem == super::end ())
+    return 0;
+  else
+    return lastItem->payload (); // which could also be 0
+}
+
+Ptr<CcnxPitEntry>
+CcnxPitImpl::Create (Ptr<const CcnxInterestHeader> header)
+{
+  Ptr<CcnxFibEntry> fibEntry = m_fib->LongestPrefixMatch (*header);
+  NS_ASSERT_MSG (fibEntry != 0,
+                 "There should be at least default route set" <<
+                 " Prefix = "<< header->GetName() << "NodeID == " << m_fib->GetObject<Node>()->GetId() << "\n" << *m_fib);
+
+
+  Ptr< entry > newEntry = ns3::Create< entry > (boost::ref (*this), header, fibEntry);
+  std::pair< super::iterator, bool > result = super::insert (header->GetName (), newEntry);
+  if (result.first != super::end ())
+    {
+      if (result.second)
+        {
+          newEntry->SetTrie (result.first);
+          return newEntry;
+        }
+      else
+        {
+          // should we do anything?
+          // update payload? add new payload?
+          return result.first->payload ();
+        }
+    }
+  else
+    return 0;
+}
+
+
+void
+CcnxPitImpl::MarkErased (Ptr<CcnxPitEntry> item)
+{
+  // entry->SetExpireTime (Simulator::Now () + m_PitEntryPruningTimout);
+  super::erase (StaticCast< entry > (item)->to_iterator ());
+}
+
+
+void
+CcnxPitImpl::Print (std::ostream& os) const
+{
+  // !!! unordered_set imposes "random" order of item in the same level !!!
+  super::parent_trie::const_recursive_iterator item (super::getTrie ()), end (0);
+  for (; item != end; item++)
+    {
+      if (item->payload () == 0) continue;
+
+      os << item->payload ()->GetPrefix () << "\t" << *item->payload () << "\n";
+    }
+}
+
+uint32_t
+CcnxPitImpl::GetSize () const
+{
+  return super::getPolicy ().size ();
+}
+
+Ptr<CcnxPitEntry>
+CcnxPitImpl::Begin ()
+{
+  super::parent_trie::recursive_iterator item (super::getTrie ()), end (0);
+  for (; item != end; item++)
+    {
+      if (item->payload () == 0) continue;
+      break;
+    }
+
+  if (item == end)
+    return End ();
+  else
+    return item->payload ();
+}
+
+Ptr<CcnxPitEntry>
+CcnxPitImpl::End ()
+{
+  return 0;
+}
+
+Ptr<CcnxPitEntry>
+CcnxPitImpl::Next (Ptr<CcnxPitEntry> from)
+{
+  if (from == 0) return 0;
+  
+  super::parent_trie::recursive_iterator
+    item (*StaticCast< entry > (from)->to_iterator ()),
+    end (0);
+  
+  for (item++; item != end; item++)
+    {
+      if (item->payload () == 0) continue;
+      break;
+    }
+
+  if (item == end)
+    return End ();
+  else
+    return item->payload ();
+}
+
+
+} // namespace ns3
diff --git a/model/pit/ccnx-pit-impl.h b/model/pit/ccnx-pit-impl.h
new file mode 100644
index 0000000..692f78b
--- /dev/null
+++ b/model/pit/ccnx-pit-impl.h
@@ -0,0 +1,132 @@
+/* -*- 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 _CCNX_PIT_IMPL_H_
+#define	_CCNX_PIT_IMPL_H_
+
+#include "ccnx-pit.h"
+
+#include "../../utils/trie-with-policy.h"
+#include "../../utils/empty-policy.h"
+#include "../../utils/persistent-policy.h"
+
+#include "ccnx-pit-entry-impl.h"
+
+#include "ns3/ccnx-name-components.h"
+
+namespace ns3 {
+
+/**
+ * \ingroup ccnx
+ * \brief Class implementing Pending Interests Table
+ */
+class CcnxPitImpl : public CcnxPit
+                  , protected ndnSIM::trie_with_policy<CcnxNameComponents,
+                                                       ndnSIM::smart_pointer_payload_traits<CcnxPitEntryImpl< CcnxPitImpl > >,
+                                                       ndnSIM::persistent_policy_traits
+                                                       >
+{
+public:
+  typedef ndnSIM::trie_with_policy<CcnxNameComponents,
+                                   ndnSIM::smart_pointer_payload_traits<CcnxPitEntryImpl< CcnxPitImpl > >,
+                                   ndnSIM::persistent_policy_traits
+                                   > super;
+  typedef CcnxPitEntryImpl< CcnxPitImpl > entry;
+
+  /**
+   * \brief Interface ID
+   *
+   * \return interface ID
+   */
+  static TypeId GetTypeId ();
+
+  /**
+   * \brief PIT constructor
+   */
+  CcnxPitImpl ();
+
+  /**
+   * \brief Destructor
+   */
+  virtual ~CcnxPitImpl ();
+
+  // inherited from CcnxPit  
+  virtual Ptr<CcnxPitEntry>
+  Lookup (const CcnxContentObjectHeader &header);
+
+  virtual Ptr<CcnxPitEntry>
+  Lookup (const CcnxInterestHeader &header);
+
+  virtual Ptr<CcnxPitEntry>
+  Create (Ptr<const CcnxInterestHeader> header);
+  
+  virtual void
+  MarkErased (Ptr<CcnxPitEntry> entry);
+
+  virtual void
+  Print (std::ostream &os) const;
+
+  virtual uint32_t
+  GetSize () const;
+
+  virtual Ptr<CcnxPitEntry>
+  Begin ();
+
+  virtual Ptr<CcnxPitEntry>
+  End ();
+
+  virtual Ptr<CcnxPitEntry>
+  Next (Ptr<CcnxPitEntry>);
+  
+protected:
+  void RescheduleCleaning ();
+  void CleanExpired ();
+  
+  // inherited from Object class                                                                                                                                                        
+  virtual void NotifyNewAggregate (); ///< @brief Even when object is aggregated to another Object
+  virtual void DoDispose (); ///< @brief Do cleanup
+
+private:
+  uint32_t
+  GetMaxSize () const;
+
+  void
+  SetMaxSize (uint32_t maxSize);
+  
+private:
+  EventId m_cleanEvent;
+  Ptr<CcnxFib> m_fib; ///< \brief Link to FIB table
+
+  // indexes
+  typedef
+  boost::intrusive::set<entry,
+                        boost::intrusive::compare < TimestampIndex< entry > >,
+                        boost::intrusive::member_hook< entry,
+                                                       boost::intrusive::set_member_hook<>,
+                                                       &entry::time_hook_>
+                        > time_index;
+  time_index i_time; 
+                        
+  friend class CcnxPitEntryImpl< CcnxPitImpl >;
+};
+
+} // namespace ns3
+
+#endif	/* CCNX_PIT_IMPL_H */
diff --git a/model/pit/ccnx-pit.cc b/model/pit/ccnx-pit.cc
new file mode 100644
index 0000000..00e58c7
--- /dev/null
+++ b/model/pit/ccnx-pit.cc
@@ -0,0 +1,100 @@
+/* -*- 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 "ccnx-pit.h"
+
+#include "ns3/ccnx-interest-header.h"
+#include "ns3/ccnx-content-object-header.h"
+
+#include "ns3/log.h"
+#include "ns3/string.h"
+#include "ns3/uinteger.h"
+#include "ns3/simulator.h"
+
+#include <boost/lambda/bind.hpp>
+#include <boost/lambda/lambda.hpp>
+
+NS_LOG_COMPONENT_DEFINE ("CcnxPit");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (CcnxPit);
+
+using namespace __ccnx_private;
+
+TypeId
+CcnxPit::GetTypeId ()
+{
+  static TypeId tid = TypeId ("ns3::private::CcnxPit")
+    .SetGroupName ("Ccnx")
+    .SetParent<Object> ()
+    // .AddAttribute ("CleanupTimeout",
+    //                "Timeout defining how frequent RIT should be cleaned up",
+    //                StringValue ("1s"),
+    //                MakeTimeAccessor (&CcnxPit::GetCleanupTimeout, &CcnxPit::SetCleanupTimeout),
+    //                MakeTimeChecker ())
+    
+    .AddAttribute ("PitEntryPruningTimout",
+                   "Timeout for PIT entry to live after being satisfied. To make sure recently satisfied interest will not be satisfied again",
+                   StringValue ("100ms"),
+                   MakeTimeAccessor (&CcnxPit::m_PitEntryPruningTimout),
+                   MakeTimeChecker ())
+    ;
+
+  return tid;
+}
+
+CcnxPit::CcnxPit ()
+{
+}
+
+CcnxPit::~CcnxPit ()
+{
+}
+
+// void CcnxPit::CleanExpired ()
+// {
+//   DoCleanExpired ();
+  
+//   // schedule next event  
+//   m_cleanupEvent = Simulator::Schedule (m_cleanupTimeout,
+//                                         &CcnxPit::CleanExpired, this); 
+// }
+
+// void
+// CcnxPit::SetCleanupTimeout (const Time &timeout)
+// {
+//   m_cleanupTimeout = timeout;
+//   if (m_cleanupEvent.IsRunning ())
+//     m_cleanupEvent.Cancel (); // cancel any scheduled cleanup events
+
+//   // schedule even with new timeout
+//   m_cleanupEvent = Simulator::Schedule (m_cleanupTimeout,
+//                                         &CcnxPit::CleanExpired, this); 
+// }
+
+// Time
+// CcnxPit::GetCleanupTimeout () const
+// {
+//   return m_cleanupTimeout;
+// }
+
+
+} // namespace ns3
diff --git a/model/pit/ccnx-pit.h b/model/pit/ccnx-pit.h
new file mode 100644
index 0000000..941b079
--- /dev/null
+++ b/model/pit/ccnx-pit.h
@@ -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>
+ */
+
+#ifndef _CCNX_PIT_H_
+#define	_CCNX_PIT_H_
+
+#include "ns3/object.h"
+#include "ns3/nstime.h"
+#include "ns3/event-id.h"
+
+#include "ccnx-pit-entry.h"
+
+namespace ns3 {
+
+class Ccnx;
+class CcnxFace;
+class CcnxContentObjectHeader;
+class CcnxInterestHeader;
+
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+
+/**
+ * \ingroup ccnx
+ * \brief Class implementing Pending Interests Table
+ */
+class CcnxPit : public Object
+{
+public:
+  /**
+   * \brief Interface ID
+   *
+   * \return interface ID
+   */
+  static TypeId GetTypeId ();
+
+  /**
+   * \brief PIT constructor
+   */
+  CcnxPit ();
+
+  /**
+   * \brief Destructor
+   */
+  virtual ~CcnxPit ();
+
+  /**
+   * \brief Find corresponding PIT entry for the given content name
+   *
+   * Not that this call should be repeated enough times until it return 0.
+   * This way all records with shorter or equal prefix as in content object will be found
+   * and satisfied.
+   *
+   * \param prefix Prefix for which to lookup the entry
+   * \returns smart pointer to PIT entry. If record not found,
+   *          returns 0
+   */
+  virtual Ptr<CcnxPitEntry>
+  Lookup (const CcnxContentObjectHeader &header) = 0;
+
+  /**
+   * \brief Find a PIT entry for the given content interest
+   * \param header parsed interest header
+   * \returns iterator to Pit entry. If record not found,
+   *          return end() iterator
+   */
+  virtual Ptr<CcnxPitEntry>
+  Lookup (const CcnxInterestHeader &header) = 0;
+
+  /**
+   * @brief Creates a PIT entry for the given interest
+   * @param header parsed interest header
+   * @returns iterator to Pit entry. If record could not be created (e.g., limit reached),
+   *          return end() iterator
+   *
+   * Note. This call assumes that the entry does not exist (i.e., there was a Lookup call before)
+   */
+  virtual Ptr<CcnxPitEntry>
+  Create (Ptr<const CcnxInterestHeader> header) = 0;
+  
+  /**
+   * @brief Mark PIT entry deleted
+   * @param entry PIT entry
+   *
+   * Effectively, this method removes all incoming/outgoing faces and set
+   * lifetime +m_PitEntryDefaultLifetime from Now ()
+   */
+  virtual void
+  MarkErased (Ptr<CcnxPitEntry> entry) = 0;
+
+  /**
+   * @brief Print out PIT contents for debugging purposes
+   *
+   * Note that there is no definite order in which entries are printed out
+   */
+  virtual void
+  Print (std::ostream &os) const = 0;
+
+  /**
+   * @brief Get number of entries in PIT
+   */
+  virtual uint32_t
+  GetSize () const = 0;
+
+  /**
+   * @brief Return first element of FIB (no order guaranteed)
+   */
+  virtual Ptr<CcnxPitEntry>
+  Begin () = 0;
+
+  /**
+   * @brief Return item next after last (no order guaranteed)
+   */
+  virtual Ptr<CcnxPitEntry>
+  End () = 0;
+
+  /**
+   * @brief Advance the iterator
+   */
+  virtual Ptr<CcnxPitEntry>
+  Next (Ptr<CcnxPitEntry>) = 0;
+
+  ////////////////////////////////////////////////////////////////////////////
+  ////////////////////////////////////////////////////////////////////////////
+  ////////////////////////////////////////////////////////////////////////////
+  
+  /**
+   * @brief Static call to cheat python bindings
+   */
+  static inline Ptr<CcnxPit>
+  GetCcnxPit (Ptr<Object> node);
+
+  ////////////////////////////////////////////////////////////////////////////
+  ////////////////////////////////////////////////////////////////////////////
+  ////////////////////////////////////////////////////////////////////////////
+
+private:
+  // /**
+  //  * @brief Remove expired records from PIT
+  //  */
+  // void
+  // CleanExpired ();
+  
+  // /**
+  //  * \brief Set cleanup timeout
+  //  *
+  //  * Side effect: current clean up even (if any) will be cancelled and a new event started
+  //  *
+  //  * \param timeout cleanup timeout
+  //  */
+  // void
+  // SetCleanupTimeout (const Time &timeout);
+
+  // /**
+  //  * \brief Get cleanup timeout
+  //  *
+  //  * \returns cleanup timeout
+  //  */
+  // Time
+  // GetCleanupTimeout () const;
+  
+protected:
+  // configuration variables. Check implementation of GetTypeId for more details
+  Time    m_PitEntryPruningTimout;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+inline std::ostream&
+operator<< (std::ostream& os, const CcnxPit &pit)
+{
+  pit.Print (os);
+  return os;
+}
+
+inline Ptr<CcnxPit>
+CcnxPit::GetCcnxPit (Ptr<Object> node)
+{
+  return node->GetObject<CcnxPit> ();
+}
+
+
+} // namespace ns3
+
+#endif	/* CCNX_PIT_H */