Content Store extension.  Now it supports the same enumeration interface available for PIT and FIB
diff --git a/model/cs/content-store-impl.cc b/model/cs/content-store-impl.cc
index fe6346b..1b929c5 100644
--- a/model/cs/content-store-impl.cc
+++ b/model/cs/content-store-impl.cc
@@ -138,11 +138,27 @@
 {
   // NS_LOG_FUNCTION (this << header->GetName ());
 
-  return
-    this->insert (header->GetName (), Create<Entry> (header, packet))
-    .second;
+  Ptr< entry > newEntry = Create< entry > (header, packet);
+  std::pair< typename 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 false;
+        }
+    }
+  else
+    return false; // cannot insert entry
 }
-    
+
 template<class Policy>
 void 
 ContentStoreImpl<Policy>::Print (std::ostream &os) const
@@ -170,6 +186,60 @@
   return this->getPolicy ().get_max_size ();
 }
 
+template<class Policy>
+uint32_t
+ContentStoreImpl<Policy>::GetSize () const
+{
+  return this->getPolicy ().size ();
+}
+
+template<class Policy>
+Ptr<Entry>
+ContentStoreImpl<Policy>::Begin ()
+{
+  typename 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 ();
+}
+
+template<class Policy>
+Ptr<Entry>
+ContentStoreImpl<Policy>::End ()
+{
+  return 0;
+}
+
+template<class Policy>
+Ptr<Entry>
+ContentStoreImpl<Policy>::Next (Ptr<Entry> from)
+{
+  if (from == 0) return 0;
+  
+  typename 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 ();
+}
+
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 
diff --git a/model/cs/content-store-impl.h b/model/cs/content-store-impl.h
index 9ba1af5..4b047ee 100644
--- a/model/cs/content-store-impl.h
+++ b/model/cs/content-store-impl.h
@@ -33,19 +33,44 @@
 namespace ndn {
 namespace cs {
 
+template<class CS>
+class EntryImpl : public Entry
+{
+public:
+  EntryImpl (Ptr<const ContentObjectHeader> header, Ptr<const Packet> packet)
+    : Entry (header, packet)
+    , item_ (0)
+  {
+  }
+
+  void
+  SetTrie (typename CS::super::iterator item)
+  {
+    item_ = item;
+  }
+
+  typename CS::super::iterator to_iterator () { return item_; }
+  typename CS::super::const_iterator to_iterator () const { return item_; }
+  
+private:
+  typename CS::super::iterator item_;
+};
+
+
 
 template<class Policy>
 class ContentStoreImpl : public ContentStore,
                          protected ndnSIM::trie_with_policy< NameComponents,
-                                                             ndnSIM::smart_pointer_payload_traits< Entry >,
+                                                             ndnSIM::smart_pointer_payload_traits< EntryImpl< ContentStoreImpl< Policy > > >,
                                                              Policy >
 {
-private:
+public:
   typedef ndnSIM::trie_with_policy< NameComponents,
-                                    ndnSIM::smart_pointer_payload_traits< Entry >,
+                                    ndnSIM::smart_pointer_payload_traits< EntryImpl< ContentStoreImpl< Policy > > >,
                                     Policy > super;
   
-public:
+  typedef EntryImpl< ContentStoreImpl< Policy > > entry;
+  
   static TypeId
   GetTypeId ();
   
@@ -66,6 +91,18 @@
   virtual inline void
   Print (std::ostream &os) const;  
 
+  virtual uint32_t
+  GetSize () const;
+
+  virtual Ptr<Entry>
+  Begin ();
+
+  virtual Ptr<Entry>
+  End ();
+
+  virtual Ptr<Entry>
+  Next (Ptr<Entry>);
+
 private:
   void
   SetMaxSize (uint32_t maxSize);
diff --git a/model/cs/ndn-content-store.h b/model/cs/ndn-content-store.h
index 963c7bc..047fd81 100644
--- a/model/cs/ndn-content-store.h
+++ b/model/cs/ndn-content-store.h
@@ -162,6 +162,41 @@
   virtual void
   Print (std::ostream &os) const = 0;
 
+
+  /**
+   * @brief Get number of entries in content store
+   */
+  virtual uint32_t
+  GetSize () const = 0;
+
+  /**
+   * @brief Return first element of content store (no order guaranteed)
+   */
+  virtual Ptr<cs::Entry>
+  Begin () = 0;
+
+  /**
+   * @brief Return item next after last (no order guaranteed)
+   */
+  virtual Ptr<cs::Entry>
+  End () = 0;
+
+  /**
+   * @brief Advance the iterator
+   */
+  virtual Ptr<cs::Entry>
+  Next (Ptr<cs::Entry>) = 0;
+
+  ////////////////////////////////////////////////////////////////////////////
+  ////////////////////////////////////////////////////////////////////////////
+  ////////////////////////////////////////////////////////////////////////////
+  
+  /**
+   * @brief Static call to cheat python bindings
+   */
+  static inline Ptr<ContentStore>
+  GetContentStore (Ptr<Object> node);
+  
 protected:
   TracedCallback<Ptr<const InterestHeader>,
                  Ptr<const ContentObjectHeader> > m_cacheHitsTrace; ///< @brief trace of cache hits
@@ -176,6 +211,13 @@
   return os;
 }
 
+inline Ptr<ContentStore>
+ContentStore::GetContentStore (Ptr<Object> node)
+{
+  return node->GetObject<ContentStore> ();
+}
+
+
 } // namespace ndn
 } // namespace ns3