ndnSIM-v2: Initial implementation

- Name, name::Components, Interest, Data now use ndn-cxx
- Ptr is replaced with shared_ptr for ndn-cxx structures

Credits for the change also to Mickey Sweat, Wentao Shang, and Alex Afanasyev
diff --git a/apps/ndn-app.cpp b/apps/ndn-app.cpp
index f353e62..b5d3e35 100644
--- a/apps/ndn-app.cpp
+++ b/apps/ndn-app.cpp
@@ -23,8 +23,6 @@
 #include "ns3/assert.h"
 #include "ns3/packet.h"
 
-#include "ns3/ndn-interest.hpp"
-#include "ns3/ndn-data.hpp"
 #include "ns3/ndn-l3-protocol.hpp"
 #include "ns3/ndn-fib.hpp"
 #include "ns3/ndn-app-face.hpp"
@@ -48,9 +46,6 @@
                         .AddTraceSource("ReceivedInterests", "ReceivedInterests",
                                         MakeTraceSourceAccessor(&App::m_receivedInterests))
 
-                        .AddTraceSource("ReceivedNacks", "ReceivedNacks",
-                                        MakeTraceSourceAccessor(&App::m_receivedNacks))
-
                         .AddTraceSource("ReceivedDatas", "ReceivedDatas",
                                         MakeTraceSourceAccessor(&App::m_receivedDatas))
 
@@ -93,24 +88,17 @@
 }
 
 void
-App::OnInterest(Ptr<const Interest> interest)
+App::OnInterest(shared_ptr<const Interest> interest)
 {
   NS_LOG_FUNCTION(this << interest);
   m_receivedInterests(interest, this, m_face);
 }
 
 void
-App::OnNack(Ptr<const Interest> interest)
+App::OnData(shared_ptr<const Data> data)
 {
-  NS_LOG_FUNCTION(this << interest);
-  m_receivedNacks(interest, this, m_face);
-}
-
-void
-App::OnData(Ptr<const Data> contentObject)
-{
-  NS_LOG_FUNCTION(this << contentObject);
-  m_receivedDatas(contentObject, this, m_face);
+  NS_LOG_FUNCTION(this << data);
+  m_receivedDatas(data, this, m_face);
 }
 
 // Application Methods
diff --git a/apps/ndn-app.hpp b/apps/ndn-app.hpp
index edede34..f0ac19b 100644
--- a/apps/ndn-app.hpp
+++ b/apps/ndn-app.hpp
@@ -21,6 +21,9 @@
 #ifndef NDN_APP_H
 #define NDN_APP_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+#include "ns3/ndnSIM/model/ndn-app-face.hpp"
+
 #include "ns3/application.h"
 #include "ns3/ptr.h"
 #include "ns3/callback.h"
@@ -32,11 +35,6 @@
 
 namespace ndn {
 
-class Interest;
-class Data;
-
-class Face;
-
 /**
  * \ingroup ndn
  * \defgroup ndn-apps NDN applications
@@ -72,14 +70,7 @@
    *                 may be useful to get packet tags
    */
   virtual void
-  OnInterest(Ptr<const Interest> interest);
-
-  /**
-   * @brief Method that will be called every time new NACK arrives
-   * @param interest Interest header
-   */
-  virtual void
-  OnNack(Ptr<const Interest> interest);
+  OnInterest(shared_ptr<const Interest> interest);
 
   /**
    * @brief Method that will be called every time new Data arrives
@@ -88,7 +79,7 @@
    * original packet)
    */
   virtual void
-  OnData(Ptr<const Data> contentObject);
+  OnData(shared_ptr<const Data> data);
 
 protected:
   /**
@@ -110,19 +101,16 @@
   Ptr<Face> m_face; ///< @brief automatically created application face through which application
   /// communicates
 
-  TracedCallback<Ptr<const Interest>, Ptr<App>, Ptr<Face>>
+  TracedCallback<shared_ptr<const Interest>, Ptr<App>, Ptr<Face>>
     m_receivedInterests; ///< @brief App-level trace of received Interests
 
-  TracedCallback<Ptr<const Interest>, Ptr<App>, Ptr<Face>>
-    m_receivedNacks; ///< @brief App-level trace of received NACKs
+  TracedCallbackshared_ptr<const Data>, Ptr<App>,
+    Ptr<Face>> m_receivedDatas; ///< @brief App-level trace of received Data
 
-  TracedCallback<Ptr<const Data>, Ptr<App>, Ptr<Face>>
-    m_receivedDatas; ///< @brief App-level trace of received Data
-
-  TracedCallback<Ptr<const Interest>, Ptr<App>, Ptr<Face>>
+  TracedCallback<shared_ptr<const Interest>, Ptr<App>, Ptr<Face>>
     m_transmittedInterests; ///< @brief App-level trace of transmitted Interests
 
-  TracedCallback<Ptr<const Data>, Ptr<App>, Ptr<Face>>
+  TracedCallback<shared_ptr<const Data>, Ptr<App>, Ptr<Face>>
     m_transmittedDatas; ///< @brief App-level trace of transmitted Data
 };
 
diff --git a/apps/ndn-consumer-batches.hpp b/apps/ndn-consumer-batches.hpp
index 0c7c25d..79b5d2b 100644
--- a/apps/ndn-consumer-batches.hpp
+++ b/apps/ndn-consumer-batches.hpp
@@ -21,6 +21,8 @@
 #ifndef NDN_CONSUMER_BATCHES_H
 #define NDN_CONSUMER_BATCHES_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ndn-consumer.hpp"
 #include "ns3/traced-value.h"
 #include "../utils/batches.hpp"
@@ -44,13 +46,13 @@
 
   // From App
   // virtual void
-  // OnInterest (const Ptr<const Interest> &interest);
+  // OnInterest (const shared_ptr<const Interest> &interest);
 
   // virtual void
-  // OnNack (const Ptr<const Interest> &interest);
+  // OnNack (const shared_ptr<const Interest> &interest);
 
   // virtual void
-  // OnData (const Ptr<const Data> &contentObject,
+  // OnData (const shared_ptr<const Data> &contentObject,
   //                  const Ptr<const Packet> &payload);
 
   // virtual void
diff --git a/apps/ndn-consumer-cbr.cpp b/apps/ndn-consumer-cbr.cpp
index c9c81b9..f64ae22 100644
--- a/apps/ndn-consumer-cbr.cpp
+++ b/apps/ndn-consumer-cbr.cpp
@@ -31,8 +31,6 @@
 #include "ns3/double.h"
 
 #include "ns3/ndn-app-face.hpp"
-#include "ns3/ndn-interest.hpp"
-#include "ns3/ndn-data.hpp"
 
 NS_LOG_COMPONENT_DEFINE("ndn.ConsumerCbr");
 
@@ -128,14 +126,14 @@
 ///////////////////////////////////////////////////
 
 // void
-// Consumer::OnData (const Ptr<const Data> &contentObject,
+// Consumer::OnData (const shared_ptr<const Data> &contentObject,
 //                                const Ptr<const Packet> &payload)
 // {
 //   Consumer::OnData (contentObject, payload); // tracing inside
 // }
 
 // void
-// Consumer::OnNack (const Ptr<const Interest> &interest)
+// Consumer::OnNack (const shared_ptr<const Interest> &interest)
 // {
 //   Consumer::OnNack (interest); // tracing inside
 // }
diff --git a/apps/ndn-consumer-cbr.hpp b/apps/ndn-consumer-cbr.hpp
index 47134b6..126560b 100644
--- a/apps/ndn-consumer-cbr.hpp
+++ b/apps/ndn-consumer-cbr.hpp
@@ -22,6 +22,8 @@
 #ifndef NDN_CONSUMER_CBR_H
 #define NDN_CONSUMER_CBR_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ndn-consumer.hpp"
 
 namespace ns3 {
@@ -45,13 +47,13 @@
 
   // From NdnApp
   // virtual void
-  // OnInterest (const Ptr<const Interest> &interest);
+  // OnInterest (const shared_ptr<const Interest> &interest);
 
   // virtual void
-  // OnNack (const Ptr<const Interest> &interest);
+  // OnNack (const shared_ptr<const Interest> &interest);
 
   // virtual void
-  // OnData (const Ptr<const Data> &contentObject,
+  // OnData (const shared_ptr<const Data> &contentObject,
   //                  const Ptr<const Packet> &payload);
 
 protected:
diff --git a/apps/ndn-consumer-window.cpp b/apps/ndn-consumer-window.cpp
index 595842c..d1531bd 100644
--- a/apps/ndn-consumer-window.cpp
+++ b/apps/ndn-consumer-window.cpp
@@ -27,8 +27,6 @@
 #include "ns3/string.h"
 #include "ns3/uinteger.h"
 #include "ns3/double.h"
-#include "ns3/ndn-data.hpp"
-#include "ns3/ndn-interest.hpp"
 
 NS_LOG_COMPONENT_DEFINE("ndn.ConsumerWindow");
 
@@ -183,7 +181,7 @@
 ///////////////////////////////////////////////////
 
 void
-ConsumerWindow::OnData(Ptr<const Data> contentObject)
+ConsumerWindow::OnData(shared_ptr<const Data> contentObject)
 {
   Consumer::OnData(contentObject);
 
@@ -197,7 +195,7 @@
 }
 
 void
-ConsumerWindow::OnNack(Ptr<const Interest> interest)
+ConsumerWindow::OnNack(shared_ptr<const Interest> interest)
 {
   Consumer::OnNack(interest);
 
diff --git a/apps/ndn-consumer-window.hpp b/apps/ndn-consumer-window.hpp
index 923cae0..0d0536f 100644
--- a/apps/ndn-consumer-window.hpp
+++ b/apps/ndn-consumer-window.hpp
@@ -22,6 +22,8 @@
 #ifndef NDN_CONSUMER_WINDOW_H
 #define NDN_CONSUMER_WINDOW_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ndn-consumer.hpp"
 #include "ns3/traced-value.h"
 
@@ -48,13 +50,13 @@
 
   // From App
   // virtual void
-  // OnInterest (const Ptr<const Interest> &interest);
+  // OnInterest (const shared_ptr<const Interest> &interest);
 
   virtual void
-  OnNack(Ptr<const Interest> interest);
+  OnNack(shared_ptr<const Interest> interest);
 
   virtual void
-  OnData(Ptr<const Data> contentObject);
+  OnData(shared_ptr<const Data> contentObject);
 
   virtual void
   OnTimeout(uint32_t sequenceNumber);
diff --git a/apps/ndn-consumer-zipf-mandelbrot.cpp b/apps/ndn-consumer-zipf-mandelbrot.cpp
index 806b8e3..f6037e3 100644
--- a/apps/ndn-consumer-zipf-mandelbrot.cpp
+++ b/apps/ndn-consumer-zipf-mandelbrot.cpp
@@ -21,8 +21,6 @@
 #include "ndn-consumer-zipf-mandelbrot.hpp"
 
 #include "ns3/ndn-app-face.hpp"
-#include "ns3/ndn-interest.hpp"
-#include "ns3/ndn-data.hpp"
 
 #include "ns3/ndnSIM/utils/ndn-fw-hop-count-tag.hpp"
 
@@ -171,11 +169,11 @@
   // std::cout << Simulator::Now ().ToDouble (Time::S) << "s -> " << seq << "\n";
 
   //
-  Ptr<Name> nameWithSequence = Create<Name>(m_interestName);
+  shared_ptr<Name> nameWithSequence = make_shared<Name>(m_interestName);
   nameWithSequence->appendSeqNum(seq);
   //
 
-  Ptr<Interest> interest = Create<Interest>();
+  shared_ptr<Interest> interest = make_shared<Interest>();
   interest->SetNonce(m_rand.GetValue());
   interest->SetName(nameWithSequence);
 
diff --git a/apps/ndn-consumer-zipf-mandelbrot.hpp b/apps/ndn-consumer-zipf-mandelbrot.hpp
index ee192db..dd03563 100644
--- a/apps/ndn-consumer-zipf-mandelbrot.hpp
+++ b/apps/ndn-consumer-zipf-mandelbrot.hpp
@@ -21,6 +21,8 @@
 #ifndef NDN_CONSUMER_ZIPF_MANDELBROT_H_
 #define NDN_CONSUMER_ZIPF_MANDELBROT_H_
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ndn-consumer.hpp"
 #include "ns3/ptr.h"
 #include "ns3/log.h"
diff --git a/apps/ndn-consumer.cpp b/apps/ndn-consumer.cpp
index fabbe95..c64bb7e 100644
--- a/apps/ndn-consumer.cpp
+++ b/apps/ndn-consumer.cpp
@@ -31,15 +31,11 @@
 #include "ns3/double.h"
 
 #include "ns3/ndn-app-face.hpp"
-#include "ns3/ndn-interest.hpp"
-#include "ns3/ndn-data.hpp"
 #include "ns3/ndnSIM/utils/ndn-fw-hop-count-tag.hpp"
 #include "ns3/ndnSIM/utils/ndn-rtt-mean-deviation.hpp"
 
 #include <boost/ref.hpp>
 
-#include "ns3/names.h"
-
 NS_LOG_COMPONENT_DEFINE("ndn.Consumer");
 
 namespace ns3 {
@@ -183,11 +179,11 @@
   }
 
   //
-  Ptr<Name> nameWithSequence = Create<Name>(m_interestName);
+  shared_ptr<Name> nameWithSequence = make_shared<Name>(m_interestName);
   nameWithSequence->appendSeqNum(seq);
   //
 
-  Ptr<Interest> interest = Create<Interest>();
+  shared_ptr<Interest> interest = make_shared<Interest>();
   interest->SetNonce(m_rand.GetValue());
   interest->SetName(nameWithSequence);
   interest->SetInterestLifetime(m_interestLifeTime);
@@ -211,7 +207,7 @@
 ///////////////////////////////////////////////////
 
 void
-Consumer::OnData(Ptr<const Data> data)
+Consumer::OnData(shared_ptr<const Data> data)
 {
   if (!m_active)
     return;
@@ -253,7 +249,7 @@
 }
 
 void
-Consumer::OnNack(Ptr<const Interest> interest)
+Consumer::OnNack(shared_ptr<const Interest> interest)
 {
   if (!m_active)
     return;
diff --git a/apps/ndn-consumer.hpp b/apps/ndn-consumer.hpp
index 83ece12..25de4cd 100644
--- a/apps/ndn-consumer.hpp
+++ b/apps/ndn-consumer.hpp
@@ -22,9 +22,10 @@
 #ifndef NDN_CONSUMER_H
 #define NDN_CONSUMER_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ndn-app.hpp"
 #include "ns3/random-variable.h"
-#include "ns3/ndn-name.hpp"
 #include "ns3/nstime.h"
 #include "ns3/data-rate.h"
 #include "ns3/ndn-rtt-estimator.hpp"
@@ -58,13 +59,13 @@
 
   // From App
   // virtual void
-  // OnInterest (const Ptr<const Interest> &interest);
+  // OnInterest (const shared_ptr<const Interest> &interest);
 
   virtual void
-  OnNack(Ptr<const Interest> interest);
+  OnNack(shared_ptr<const Interest> interest);
 
   virtual void
-  OnData(Ptr<const Data> contentObject);
+  OnData(shared_ptr<const Data> contentObject);
 
   /**
    * @brief Timeout event
diff --git a/apps/ndn-producer.cpp b/apps/ndn-producer.cpp
index 67a5043..60bc1dc 100644
--- a/apps/ndn-producer.cpp
+++ b/apps/ndn-producer.cpp
@@ -21,8 +21,6 @@
 
 #include "ndn-producer.hpp"
 #include "ns3/log.h"
-#include "ns3/ndn-interest.hpp"
-#include "ns3/ndn-data.hpp"
 #include "ns3/string.h"
 #include "ns3/uinteger.h"
 #include "ns3/packet.h"
@@ -115,7 +113,7 @@
 }
 
 void
-Producer::OnInterest(Ptr<const Interest> interest)
+Producer::OnInterest(shared_ptr<const Interest> interest)
 {
   App::OnInterest(interest); // tracing inside
 
@@ -124,8 +122,8 @@
   if (!m_active)
     return;
 
-  Ptr<Data> data = Create<Data>(Create<Packet>(m_virtualPayloadSize));
-  Ptr<Name> dataName = Create<Name>(interest->GetName());
+  shared_ptr<Data> data = make_shared<Data>(Create<Packet>(m_virtualPayloadSize));
+  shared_ptr<Name> dataName = make_shared<Name>(interest->GetName());
   dataName->append(m_postfix);
   data->SetName(dataName);
   data->SetFreshness(m_freshness);
@@ -133,7 +131,7 @@
 
   data->SetSignature(m_signature);
   if (m_keyLocator.size() > 0) {
-    data->SetKeyLocator(Create<Name>(m_keyLocator));
+    data->SetKeyLocator(make_shared<Name>(m_keyLocator));
   }
 
   NS_LOG_INFO("node(" << GetNode()->GetId() << ") respodning with Data: " << data->GetName());
diff --git a/apps/ndn-producer.hpp b/apps/ndn-producer.hpp
index 11ebc56..e414f4e 100644
--- a/apps/ndn-producer.hpp
+++ b/apps/ndn-producer.hpp
@@ -22,6 +22,8 @@
 #ifndef NDN_PRODUCER_H
 #define NDN_PRODUCER_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ndn-app.hpp"
 
 #include "ns3/ptr.h"
@@ -49,7 +51,7 @@
 
   // inherited from NdnApp
   void
-  OnInterest(Ptr<const Interest> interest);
+  OnInterest(shared_ptr<const Interest> interest);
 
 protected:
   // inherited from Application base class.
diff --git a/examples/custom-apps/custom-app.cpp b/examples/custom-apps/custom-app.cpp
index 001c440..62cacc4 100644
--- a/examples/custom-apps/custom-app.cpp
+++ b/examples/custom-apps/custom-app.cpp
@@ -27,8 +27,6 @@
 #include "ns3/packet.h"
 
 #include "ns3/ndn-app-face.hpp"
-#include "ns3/ndn-interest.hpp"
-#include "ns3/ndn-data.hpp"
 
 #include "ns3/ndn-fib.hpp"
 #include "ns3/random-variable.h"
diff --git a/examples/custom-apps/custom-app.hpp b/examples/custom-apps/custom-app.hpp
index 5d05e99..7dca200 100644
--- a/examples/custom-apps/custom-app.hpp
+++ b/examples/custom-apps/custom-app.hpp
@@ -23,6 +23,8 @@
 #ifndef CUSTOM_APP_H_
 #define CUSTOM_APP_H_
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/ndn-app.hpp"
 
 namespace ns3 {
diff --git a/examples/custom-apps/dumb-requester.cpp b/examples/custom-apps/dumb-requester.cpp
index f81548f..8850e18 100644
--- a/examples/custom-apps/dumb-requester.cpp
+++ b/examples/custom-apps/dumb-requester.cpp
@@ -29,8 +29,6 @@
 #include "ns3/string.h"
 
 #include "ns3/ndn-app-face.hpp"
-#include "ns3/ndn-interest.hpp"
-#include "ns3/ndn-data.hpp"
 
 NS_LOG_COMPONENT_DEFINE("DumbRequester");
 
diff --git a/examples/custom-apps/dumb-requester.hpp b/examples/custom-apps/dumb-requester.hpp
index 55bdace..0091c25 100644
--- a/examples/custom-apps/dumb-requester.hpp
+++ b/examples/custom-apps/dumb-requester.hpp
@@ -23,8 +23,9 @@
 #ifndef DUMB_REQUESTER_H_
 #define DUMB_REQUESTER_H_
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/ndn-app.hpp"
-#include "ns3/ndn-name.hpp"
 
 namespace ns3 {
 
diff --git a/examples/custom-apps/hijacker.cpp b/examples/custom-apps/hijacker.cpp
index bcff26a..70e2d9e 100644
--- a/examples/custom-apps/hijacker.cpp
+++ b/examples/custom-apps/hijacker.cpp
@@ -21,7 +21,6 @@
 // hijacker.cc
 
 #include "hijacker.hpp"
-#include "ns3/ndn-name.hpp"
 
 NS_LOG_COMPONENT_DEFINE("Hijacker");
 
diff --git a/helper/boost-graph-ndn-global-routing-helper.hpp b/helper/boost-graph-ndn-global-routing-helper.hpp
index 85bac72..87d02f5 100644
--- a/helper/boost-graph-ndn-global-routing-helper.hpp
+++ b/helper/boost-graph-ndn-global-routing-helper.hpp
@@ -23,6 +23,8 @@
 
 /// @cond include_hidden
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include <boost/graph/graph_traits.hpp>
 #include <boost/graph/properties.hpp>
 #include <boost/ref.hpp>
diff --git a/helper/ndn-app-helper.hpp b/helper/ndn-app-helper.hpp
index 63fa705..fab41ad 100644
--- a/helper/ndn-app-helper.hpp
+++ b/helper/ndn-app-helper.hpp
@@ -21,6 +21,8 @@
 #ifndef NDN_APP_HELPER_H
 #define NDN_APP_HELPER_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/object-factory.h"
 #include "ns3/attribute.h"
 #include "ns3/node-container.h"
diff --git a/helper/ndn-face-container.hpp b/helper/ndn-face-container.hpp
index 776a5ec..b5dd2c0 100644
--- a/helper/ndn-face-container.hpp
+++ b/helper/ndn-face-container.hpp
@@ -21,6 +21,8 @@
 #ifndef NDN_FACE_CONTAINER_H
 #define NDN_FACE_CONTAINER_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include <stdint.h>
 #include <vector>
 
diff --git a/helper/ndn-global-routing-helper.cpp b/helper/ndn-global-routing-helper.cpp
index 0528be3..972f1d8 100644
--- a/helper/ndn-global-routing-helper.cpp
+++ b/helper/ndn-global-routing-helper.cpp
@@ -29,7 +29,6 @@
 #include "ns3/ndn-l3-protocol.hpp"
 #include "../model/ndn-net-device-face.hpp"
 #include "../model/ndn-global-router.hpp"
-#include "ns3/ndn-name.hpp"
 #include "ns3/ndn-fib.hpp"
 
 #include "ns3/node.h"
@@ -179,7 +178,7 @@
   Ptr<GlobalRouter> gr = node->GetObject<GlobalRouter>();
   NS_ASSERT_MSG(gr != 0, "GlobalRouter is not installed on the node");
 
-  Ptr<Name> name = Create<Name>(boost::lexical_cast<Name>(prefix));
+  auto name = make_shared<Name>(prefix);
   gr->AddLocalPrefix(name);
 }
 
@@ -267,7 +266,7 @@
           // cout << " is unreachable" << endl;
         }
         else {
-          BOOST_FOREACH (const Ptr<const Name>& prefix, i->first->GetLocalPrefixes()) {
+          BOOST_FOREACH (const std::shared_ptr<const Name>& prefix, i->first->GetLocalPrefixes()) {
             NS_LOG_DEBUG(" prefix " << prefix << " reachable via face " << *i->second.get<0>()
                                     << " with distance " << i->second.get<1>() << " with delay "
                                     << i->second.get<2>());
@@ -371,7 +370,8 @@
             // cout << " is unreachable" << endl;
           }
           else {
-            BOOST_FOREACH (const Ptr<const Name>& prefix, i->first->GetLocalPrefixes()) {
+            BOOST_FOREACH (const std::shared_ptr<const Name>& prefix,
+                           i->first->GetLocalPrefixes()) {
               NS_LOG_DEBUG(" prefix " << *prefix << " reachable via face " << *i->second.get<0>()
                                       << " with distance " << i->second.get<1>() << " with delay "
                                       << i->second.get<2>());
diff --git a/helper/ndn-global-routing-helper.hpp b/helper/ndn-global-routing-helper.hpp
index a765ebf..b3dffa4 100644
--- a/helper/ndn-global-routing-helper.hpp
+++ b/helper/ndn-global-routing-helper.hpp
@@ -21,6 +21,8 @@
 #ifndef NDN_GLOBAL_ROUTING_HELPER_H
 #define NDN_GLOBAL_ROUTING_HELPER_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/ptr.h"
 
 namespace ns3 {
diff --git a/helper/ndn-link-control-helper.hpp b/helper/ndn-link-control-helper.hpp
index 6411a39..c210834 100644
--- a/helper/ndn-link-control-helper.hpp
+++ b/helper/ndn-link-control-helper.hpp
@@ -22,6 +22,8 @@
 #ifndef NDN_LINK_CONTROL_HELPER_H
 #define NDN_LINK_CONTROL_HELPER_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/ptr.h"
 #include "ns3/node.h"
 
diff --git a/helper/ndn-stack-helper.cpp b/helper/ndn-stack-helper.cpp
index d1c2577..5559d2e 100644
--- a/helper/ndn-stack-helper.cpp
+++ b/helper/ndn-stack-helper.cpp
@@ -42,11 +42,9 @@
 #include "ns3/ndn-forwarding-strategy.hpp"
 #include "ns3/ndn-fib.hpp"
 #include "ns3/ndn-pit.hpp"
-#include "ns3/ndn-name.hpp"
 #include "ns3/ndn-content-store.hpp"
 
 #include "ns3/node-list.h"
-// #include "ns3/loopback-net-device.h"
 
 #include "ns3/data-rate.h"
 
diff --git a/helper/ndn-stack-helper.hpp b/helper/ndn-stack-helper.hpp
index 155c22d..bad1234 100644
--- a/helper/ndn-stack-helper.hpp
+++ b/helper/ndn-stack-helper.hpp
@@ -22,6 +22,8 @@
 #ifndef NDN_STACK_HELPER_H
 #define NDN_STACK_HELPER_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/packet.h"
 #include "ns3/ptr.h"
 #include "ns3/object-factory.h"
diff --git a/model/cs/content-store-impl.hpp b/model/cs/content-store-impl.hpp
index b35fdb4..4692486 100644
--- a/model/cs/content-store-impl.hpp
+++ b/model/cs/content-store-impl.hpp
@@ -21,11 +21,11 @@
 #ifndef NDN_CONTENT_STORE_IMPL_H_
 #define NDN_CONTENT_STORE_IMPL_H_
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ndn-content-store.hpp"
 
 #include "ns3/packet.h"
-#include "ns3/ndn-interest.h"
-#include "ns3/ndn-data.h"
 #include <boost/foreach.hpp>
 
 #include "ns3/log.h"
@@ -48,7 +48,7 @@
   typedef Entry base_type;
 
 public:
-  EntryImpl(Ptr<ContentStore> cs, Ptr<const Data> data)
+  EntryImpl(Ptr<ContentStore> cs, shared_ptr<const Data> data)
     : Entry(cs, data)
     , item_(0)
   {
@@ -103,14 +103,14 @@
 
   // from ContentStore
 
-  virtual inline Ptr<Data>
-  Lookup(Ptr<const Interest> interest);
+  virtual inline shared_ptr<Data>
+  Lookup(shared_ptr<const Interest> interest);
 
   virtual inline bool
-  Add(Ptr<const Data> data);
+  Add(shared_ptr<const Data> data);
 
   // virtual bool
-  // Remove (Ptr<Interest> header);
+  // Remove (shared_ptr<Interest> header);
 
   virtual inline void
   Print(std::ostream& os) const;
@@ -200,8 +200,8 @@
 };
 
 template<class Policy>
-Ptr<Data>
-ContentStoreImpl<Policy>::Lookup(Ptr<const Interest> interest)
+shared_ptr<Data>
+ContentStoreImpl<Policy>::Lookup(shared_ptr<const Interest> interest)
 {
   NS_LOG_FUNCTION(this << interest->GetName());
 
@@ -217,7 +217,7 @@
   if (node != this->end()) {
     this->m_cacheHitsTrace(interest, node->payload()->GetData());
 
-    Ptr<Data> copy = Create<Data>(*node->payload()->GetData());
+    shared_ptr<Data> copy = make_shared<Data>(*node->payload()->GetData());
     ConstCast<Packet>(copy->GetPayload())->RemoveAllPacketTags();
     return copy;
   }
@@ -229,7 +229,7 @@
 
 template<class Policy>
 bool
-ContentStoreImpl<Policy>::Add(Ptr<const Data> data)
+ContentStoreImpl<Policy>::Add(shared_ptr<const Data> data)
 {
   NS_LOG_FUNCTION(this << data->GetName());
 
diff --git a/model/cs/content-store-nocache.cpp b/model/cs/content-store-nocache.cpp
index 85505d1..9aef87b 100644
--- a/model/cs/content-store-nocache.cpp
+++ b/model/cs/content-store-nocache.cpp
@@ -52,15 +52,15 @@
 {
 }
 
-Ptr<Data>
-Nocache::Lookup(Ptr<const Interest> interest)
+shared_ptr<Data>
+Nocache::Lookup(shared_ptr<const Interest> interest)
 {
   this->m_cacheMissesTrace(interest);
   return 0;
 }
 
 bool
-Nocache::Add(Ptr<const Data> data)
+Nocache::Add(shared_ptr<const Data> data)
 {
   return false;
 }
diff --git a/model/cs/content-store-nocache.hpp b/model/cs/content-store-nocache.hpp
index 5745821..bf271cb 100644
--- a/model/cs/content-store-nocache.hpp
+++ b/model/cs/content-store-nocache.hpp
@@ -22,6 +22,8 @@
 #ifndef NDN_CONTENT_STORE_NOCACHE_H
 #define NDN_CONTENT_STORE_NOCACHE_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/ndnSIM/model/cs/ndn-content-store.hpp"
 
 namespace ns3 {
@@ -52,11 +54,11 @@
    */
   virtual ~Nocache();
 
-  virtual Ptr<Data>
-  Lookup(Ptr<const Interest> interest);
+  virtual shared_ptr<Data>
+  Lookup(shared_ptr<const Interest> interest);
 
   virtual bool
-  Add(Ptr<const Data> data);
+  Add(shared_ptr<const Data> data);
 
   virtual void
   Print(std::ostream& os) const;
diff --git a/model/cs/content-store-with-freshness.hpp b/model/cs/content-store-with-freshness.hpp
index 07aa56f..836a94f 100644
--- a/model/cs/content-store-with-freshness.hpp
+++ b/model/cs/content-store-with-freshness.hpp
@@ -21,7 +21,7 @@
 #ifndef NDN_CONTENT_STORE_WITH_FRESHNESS_H_
 #define NDN_CONTENT_STORE_WITH_FRESHNESS_H_
 
-#include "content-store-impl.h"
+#include "ns3/ndnSIM/model/ndn-common.hpp"
 
 #include "content-store-impl.hpp"
 
@@ -57,7 +57,7 @@
   Print(std::ostream& os) const;
 
   virtual inline bool
-  Add(Ptr<const Data> data);
+  Add(shared_ptr<const Data> data);
 
 private:
   inline void
@@ -98,7 +98,7 @@
 
 template<class Policy>
 inline bool
-ContentStoreWithFreshness<Policy>::Add(Ptr<const Data> data)
+ContentStoreWithFreshness<Policy>::Add(shared_ptr<const Data> data)
 {
   bool ok = super::Add(data);
   if (!ok)
diff --git a/model/cs/content-store-with-probability.hpp b/model/cs/content-store-with-probability.hpp
index cca50c1..b442e4a 100644
--- a/model/cs/content-store-with-probability.hpp
+++ b/model/cs/content-store-with-probability.hpp
@@ -21,7 +21,7 @@
 #ifndef NDN_CONTENT_STORE_WITH_PROBABILITY_H_
 #define NDN_CONTENT_STORE_WITH_PROBABILITY_H_
 
-#include "content-store-impl.h"
+#include "ns3/ndnSIM/model/ndn-common.hpp"
 
 #include "content-store-impl.hpp"
 
diff --git a/model/cs/content-store-with-stats.hpp b/model/cs/content-store-with-stats.hpp
index b5f7540..f1ba5b2 100644
--- a/model/cs/content-store-with-stats.hpp
+++ b/model/cs/content-store-with-stats.hpp
@@ -21,7 +21,7 @@
 #ifndef NDN_CONTENT_STORE_WITH_STATS_H_
 #define NDN_CONTENT_STORE_WITH_STATS_H_
 
-#include "content-store-impl.h"
+#include "ns3/ndnSIM/model/ndn-common.hpp"
 
 #include "content-store-impl.hpp"
 
diff --git a/model/cs/custom-policies/freshness-policy.hpp b/model/cs/custom-policies/freshness-policy.hpp
index 999c61d..9d66c66 100644
--- a/model/cs/custom-policies/freshness-policy.hpp
+++ b/model/cs/custom-policies/freshness-policy.hpp
@@ -21,6 +21,8 @@
 #ifndef FRESHNESS_POLICY_H_
 #define FRESHNESS_POLICY_H_
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include <boost/intrusive/options.hpp>
 #include <boost/intrusive/list.hpp>
 
diff --git a/model/cs/custom-policies/lifetime-stats-policy.hpp b/model/cs/custom-policies/lifetime-stats-policy.hpp
index 1102ef1..1abf39d 100644
--- a/model/cs/custom-policies/lifetime-stats-policy.hpp
+++ b/model/cs/custom-policies/lifetime-stats-policy.hpp
@@ -21,6 +21,8 @@
 #ifndef LIFETIME_STATS_POLICY_H_
 #define LIFETIME_STATS_POLICY_H_
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include <boost/intrusive/options.hpp>
 #include <boost/intrusive/list.hpp>
 
diff --git a/model/cs/custom-policies/probability-policy.hpp b/model/cs/custom-policies/probability-policy.hpp
index 57d6835..8638c0a 100644
--- a/model/cs/custom-policies/probability-policy.hpp
+++ b/model/cs/custom-policies/probability-policy.hpp
@@ -21,6 +21,8 @@
 #ifndef PROBABILITY_POLICY_H_
 #define PROBABILITY_POLICY_H_
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include <boost/intrusive/options.hpp>
 #include <boost/intrusive/list.hpp>
 
diff --git a/model/cs/ndn-content-store.cpp b/model/cs/ndn-content-store.cpp
index 3588eb9..8df04c6 100644
--- a/model/cs/ndn-content-store.cpp
+++ b/model/cs/ndn-content-store.cpp
@@ -57,7 +57,7 @@
 
 //////////////////////////////////////////////////////////////////////
 
-Entry::Entry(Ptr<ContentStore> cs, Ptr<const Data> data)
+Entry::Entry(Ptr<ContentStore> cs, shared_ptr<const Data> data)
   : m_cs(cs)
   , m_data(data)
 {
@@ -69,7 +69,7 @@
   return m_data->GetName();
 }
 
-Ptr<const Data>
+shared_ptr<const Data>
 Entry::GetData() const
 {
   return m_data;
diff --git a/model/cs/ndn-content-store.hpp b/model/cs/ndn-content-store.hpp
index 23266c4..e28eea0 100644
--- a/model/cs/ndn-content-store.hpp
+++ b/model/cs/ndn-content-store.hpp
@@ -22,6 +22,8 @@
 #ifndef NDN_CONTENT_STORE_H
 #define NDN_CONTENT_STORE_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/object.h"
 #include "ns3/ptr.h"
 #include "ns3/traced-callback.h"
@@ -65,7 +67,7 @@
    * The constructor will make a copy of the supplied packet and calls
    * RemoveHeader and RemoveTail on the copy.
    */
-  Entry(Ptr<ContentStore> cs, Ptr<const Data> data);
+  Entry(Ptr<ContentStore> cs, shared_ptr<const Data> data);
 
   /**
    * \brief Get prefix of the stored entry
@@ -78,7 +80,7 @@
    * \brief Get Data of the stored entry
    * \returns Data of the stored entry
    */
-  Ptr<const Data>
+  shared_ptr<const Data>
   GetData() const;
 
   /**
@@ -89,7 +91,7 @@
 
 private:
   Ptr<ContentStore> m_cs; ///< \brief content store to which entry is added
-  Ptr<const Data> m_data; ///< \brief non-modifiable Data
+  shared_ptr<const Data> m_data; ///< \brief non-modifiable Data
 };
 
 } // namespace cs
@@ -124,8 +126,8 @@
    * If an entry is found, it is promoted to the top of most recent
    * used entries index, \see m_contentStore
    */
-  virtual Ptr<Data>
-  Lookup(Ptr<const Interest> interest) = 0;
+  virtual shared_ptr<Data>
+  Lookup(shared_ptr<const Interest> interest) = 0;
 
   /**
    * \brief Add a new content to the content store.
@@ -136,7 +138,7 @@
    * @returns true if an existing entry was updated, false otherwise
    */
   virtual bool
-  Add(Ptr<const Data> data) = 0;
+  Add(shared_ptr<const Data> data) = 0;
 
   // /*
   //  * \brief Add a new content to the content store.
@@ -145,7 +147,7 @@
   //  * @returns true if an existing entry was removed, false otherwise
   //  */
   // virtual bool
-  // Remove (Ptr<Interest> header) = 0;
+  // Remove (shared_ptr<Interest> header) = 0;
 
   /**
    * \brief Print out content store entries
@@ -187,10 +189,10 @@
   GetContentStore(Ptr<Object> node);
 
 protected:
-  TracedCallback<Ptr<const Interest>,
-                 Ptr<const Data>> m_cacheHitsTrace; ///< @brief trace of cache hits
+  TracedCallback<shared_ptr<const Interest>,
+                 shared_ptr<const Data>> m_cacheHitsTrace; ///< @brief trace of cache hits
 
-  TracedCallback<Ptr<const Interest>> m_cacheMissesTrace; ///< @brief trace of cache misses
+  TracedCallback<shared_ptr<const Interest>> m_cacheMissesTrace; ///< @brief trace of cache misses
 };
 
 inline std::ostream&
diff --git a/model/ip-faces/ndn-ip-face-stack.hpp b/model/ip-faces/ndn-ip-face-stack.hpp
index a9322c6..577ad5a 100644
--- a/model/ip-faces/ndn-ip-face-stack.hpp
+++ b/model/ip-faces/ndn-ip-face-stack.hpp
@@ -22,11 +22,12 @@
 #ifndef NDN_IP_FACE_STACK_H
 #define NDN_IP_FACE_STACK_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/application.h"
 #include "ns3/socket.h"
 #include "ns3/inet-socket-address.h"
 #include "ns3/ptr.h"
-#include "ns3/ndn-name.hpp"
 
 #include <map>
 
diff --git a/model/ip-faces/ndn-ip-faces-helper.hpp b/model/ip-faces/ndn-ip-faces-helper.hpp
index 928a766..b167437 100644
--- a/model/ip-faces/ndn-ip-faces-helper.hpp
+++ b/model/ip-faces/ndn-ip-faces-helper.hpp
@@ -22,6 +22,8 @@
 #ifndef NDN_IP_FACES_HELPER_H
 #define NDN_IP_FACES_HELPER_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/ptr.h"
 #include "ns3/nstime.h"
 #include "ns3/ipv4-address.h"
diff --git a/model/ip-faces/ndn-tcp-face.cpp b/model/ip-faces/ndn-tcp-face.cpp
index 701ad64..9f24986 100644
--- a/model/ip-faces/ndn-tcp-face.cpp
+++ b/model/ip-faces/ndn-tcp-face.cpp
@@ -30,8 +30,6 @@
 #include "ns3/pointer.h"
 #include "ns3/tcp-socket-factory.h"
 
-#include "ns3/ndn-name.hpp"
-
 using namespace std;
 
 NS_LOG_COMPONENT_DEFINE("ndn.TcpFace");
diff --git a/model/ip-faces/ndn-tcp-face.hpp b/model/ip-faces/ndn-tcp-face.hpp
index 0543bd5..9f1ad88 100644
--- a/model/ip-faces/ndn-tcp-face.hpp
+++ b/model/ip-faces/ndn-tcp-face.hpp
@@ -21,6 +21,8 @@
 #ifndef NDN_TCP_FACE_H
 #define NDN_TCP_FACE_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/ndn-face.hpp"
 #include "ns3/socket.h"
 #include "ns3/ptr.h"
diff --git a/model/ip-faces/ndn-udp-face.cpp b/model/ip-faces/ndn-udp-face.cpp
index fed972c..414ccd8 100644
--- a/model/ip-faces/ndn-udp-face.cpp
+++ b/model/ip-faces/ndn-udp-face.cpp
@@ -28,8 +28,6 @@
 #include "ns3/pointer.h"
 #include "ns3/udp-socket-factory.h"
 
-#include "ns3/ndn-name.hpp"
-
 using namespace std;
 
 NS_LOG_COMPONENT_DEFINE("ndn.UdpFace");
diff --git a/model/ip-faces/ndn-udp-face.hpp b/model/ip-faces/ndn-udp-face.hpp
index f0c3293..ec97c99 100644
--- a/model/ip-faces/ndn-udp-face.hpp
+++ b/model/ip-faces/ndn-udp-face.hpp
@@ -21,6 +21,8 @@
 #ifndef NDN_UDP_FACE_H
 #define NDN_UDP_FACE_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/ndn-face.hpp"
 #include "ns3/socket.h"
 #include "ns3/ptr.h"
diff --git a/model/ndn-app-face.cpp b/model/ndn-app-face.cpp
index d267f6b..bc788e9 100644
--- a/model/ndn-app-face.cpp
+++ b/model/ndn-app-face.cpp
@@ -31,9 +31,6 @@
 #include "ns3/ndn-header-helper.hpp"
 #include "ns3/ndn-app.hpp"
 
-#include "ndn-interest.hpp"
-#include "ndn-data.hpp"
-
 NS_LOG_COMPONENT_DEFINE("ndn.AppFace");
 
 namespace ns3 {
@@ -80,7 +77,7 @@
 }
 
 bool
-AppFace::SendInterest(Ptr<const Interest> interest)
+AppFace::SendInterest(shared_ptr<const Interest> interest)
 {
   NS_LOG_FUNCTION(this << interest);
 
@@ -88,16 +85,13 @@
     return false;
   }
 
-  if (interest->GetNack() > 0)
-    m_app->OnNack(interest);
-  else
-    m_app->OnInterest(interest);
+  m_app->OnInterest(interest);
 
   return true;
 }
 
 bool
-AppFace::SendData(Ptr<const Data> data)
+AppFace::SendData(shared_ptr<const Data> data)
 {
   NS_LOG_FUNCTION(this << data);
 
diff --git a/model/ndn-app-face.hpp b/model/ndn-app-face.hpp
index 6d8be19..3e06597 100644
--- a/model/ndn-app-face.hpp
+++ b/model/ndn-app-face.hpp
@@ -22,6 +22,8 @@
 #ifndef NDN_APP_FACE_H
 #define NDN_APP_FACE_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ndn-face.hpp"
 #include "ns3/traced-callback.h"
 
@@ -31,12 +33,6 @@
 
 namespace ndn {
 
-class Interest;
-class Data;
-
-typedef Interest InterestHeader;
-typedef Data DataHeader;
-
 class App;
 
 /**
@@ -63,10 +59,10 @@
   ////////////////////////////////////////////////////////////////////
   // methods overloaded from Face
   virtual bool
-  SendInterest(Ptr<const Interest> interest);
+  SendInterest(shared_ptr<const Interest> interest);
 
   virtual bool
-  SendData(Ptr<const Data> data);
+  SendData(shared_ptr<const Data> data);
 
 public:
   virtual std::ostream&
@@ -76,6 +72,7 @@
 private:
   AppFace();
   AppFace(const AppFace&); ///< \brief Disabled copy constructor
+
   AppFace&
   operator=(const AppFace&); ///< \brief Disabled copy operator
 
diff --git a/model/ndn-common.hpp b/model/ndn-common.hpp
index f5da38b..32fd44f 100644
--- a/model/ndn-common.hpp
+++ b/model/ndn-common.hpp
@@ -1,12 +1,21 @@
-/** -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- *                     Alexander Afanasyev
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2011-2014  Regents of the University of California.
  *
- * BSD license, See the doc/LICENSE file for more information
+ * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
+ * contributors.
  *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
+ * ndnSIM is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * ndnSIM 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
+ * ndnSIM, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
 
 #ifndef NDN_COMMON_H
 #define NDN_COMMON_H
@@ -14,40 +23,34 @@
 #include "ns3/nstime.h"
 #include "ns3/simulator.h"
 
-#define NDNSIM_MODE 1
+#include "ndn-ns3.hpp"
 
-#define NDN_NAMESPACE_BEGIN                                                                        \
-  namespace ns3 {                                                                                  \
-  namespace ndn {
-#define NDN_NAMESPACE_END                                                                          \
-  } /*ndn*/                                                                                        \
-  } /*ns3*/
+#include <ndn-cxx/interest.hpp>
+#include <ndn-cxx/encoding/block.hpp>
+#include <ndn-cxx/signature.hpp>
+#include <ndn-cxx/signature-info.hpp>
+#include <ndn-cxx/name.hpp>
+#include <ndn-cxx/data.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
 
-/**
- * @brief NS-3 namespace
- */
 namespace ns3 {
-
-/**
- * @brief ndnSIM namespace
- */
 namespace ndn {
-}
-}
 
-NDN_NAMESPACE_BEGIN
+using ::ndn::Name;
+namespace name = ::ndn::name;
 
-typedef Time TimeInterval;
+using std::shared_ptr;
+using std::make_shared;
 
-namespace time {
+using ::ndn::Interest;
+using ::ndn::Data;
+using ::ndn::KeyLocator;
+using ::ndn::Signature;
+using ::ndn::SignatureInfo;
+using ::ndn::Block;
+using ::ndn::KeyChain;
 
-inline Time
-NowUnixTimestamp()
-{
-  return Simulator::Now();
-}
-}
-
-NDN_NAMESPACE_END
+} // namespace ndn
+} // namespace ns3
 
 #endif // NDN_COMMON_H
diff --git a/model/ndn-face.cpp b/model/ndn-face.cpp
deleted file mode 100644
index 505c2b4..0000000
--- a/model/ndn-face.cpp
+++ /dev/null
@@ -1,276 +0,0 @@
-/* -*- 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 "ndn-face.hpp"
-
-#include "ns3/packet.h"
-#include "ns3/log.h"
-#include "ns3/node.h"
-#include "ns3/assert.h"
-#include "ns3/uinteger.h"
-#include "ns3/double.h"
-#include "ns3/boolean.h"
-#include "ns3/simulator.h"
-#include "ns3/random-variable.h"
-#include "ns3/pointer.h"
-
-#include "ns3/ndn-header-helper.hpp"
-#include "ns3/ndnSIM/utils/ndn-fw-hop-count-tag.hpp"
-
-#include "ns3/ndn-wire.h"
-
-#include <boost/ref.hpp>
-
-NS_LOG_COMPONENT_DEFINE("ndn.Face");
-
-namespace ns3 {
-namespace ndn {
-
-NS_OBJECT_ENSURE_REGISTERED(Face);
-
-TypeId
-Face::GetTypeId()
-{
-  static TypeId tid =
-    TypeId("ns3::ndn::Face")
-      .SetParent<Object>()
-      .SetGroupName("Ndn")
-      .AddAttribute("Id", "Face id (unique integer for the Ndn stack on this node)",
-                    TypeId::ATTR_GET, // allow only getting it.
-                    UintegerValue(0), MakeUintegerAccessor(&Face::m_id),
-                    MakeUintegerChecker<uint32_t>());
-  return tid;
-}
-
-/**
- * By default, Ndn face are created in the "down" state
- *  with no IP addresses.  Before becoming useable, the user must
- * invoke SetUp on them once an Ndn address and mask have been set.
- */
-Face::Face(Ptr<Node> node)
-  : m_node(node)
-  , m_upstreamInterestHandler(MakeNullCallback<void, Ptr<Face>, Ptr<Interest>>())
-  , m_upstreamDataHandler(MakeNullCallback<void, Ptr<Face>, Ptr<Data>>())
-  , m_ifup(false)
-  , m_id((uint32_t)-1)
-  , m_metric(0)
-  , m_flags(0)
-{
-  NS_LOG_FUNCTION(this << node);
-
-  NS_ASSERT_MSG(node != 0, "node cannot be NULL. Check the code");
-}
-
-Face::~Face()
-{
-  NS_LOG_FUNCTION_NOARGS();
-}
-
-Face::Face(const Face&)
-{
-}
-
-Face& Face::operator= (const Face &)
-{
-  return *this;
-}
-
-Ptr<Node>
-Face::GetNode() const
-{
-  return m_node;
-}
-
-void
-Face::RegisterProtocolHandlers(const InterestHandler& interestHandler,
-                               const DataHandler& dataHandler)
-{
-  NS_LOG_FUNCTION_NOARGS();
-
-  m_upstreamInterestHandler = interestHandler;
-  m_upstreamDataHandler = dataHandler;
-}
-
-void
-Face::UnRegisterProtocolHandlers()
-{
-  NS_LOG_FUNCTION_NOARGS();
-
-  m_upstreamInterestHandler = MakeNullCallback<void, Ptr<Face>, Ptr<Interest>>();
-  m_upstreamDataHandler = MakeNullCallback<void, Ptr<Face>, Ptr<Data>>();
-}
-
-bool
-Face::SendInterest(Ptr<const Interest> interest)
-{
-  NS_LOG_FUNCTION(this << boost::cref(*this) << interest->GetName());
-
-  if (!IsUp()) {
-    return false;
-  }
-
-  return Send(Wire::FromInterest(interest));
-}
-
-bool
-Face::SendData(Ptr<const Data> data)
-{
-  NS_LOG_FUNCTION(this << data);
-
-  if (!IsUp()) {
-    return false;
-  }
-
-  return Send(Wire::FromData(data));
-}
-
-bool
-Face::Send(Ptr<Packet> packet)
-{
-  FwHopCountTag hopCount;
-  bool tagExists = packet->RemovePacketTag(hopCount);
-  if (tagExists) {
-    hopCount.Increment();
-    packet->AddPacketTag(hopCount);
-  }
-
-  return true;
-}
-
-bool
-Face::Receive(Ptr<const Packet> p)
-{
-  NS_LOG_FUNCTION(this << p << p->GetSize());
-
-  if (!IsUp()) {
-    // no tracing here. If we were off while receiving, we shouldn't even know that something was
-    // there
-    return false;
-  }
-
-  Ptr<Packet> packet = p->Copy(); // give upper layers a rw copy of the packet
-  try {
-    HeaderHelper::Type type = HeaderHelper::GetNdnHeaderType(packet);
-    switch (type) {
-    case HeaderHelper::INTEREST_NDNSIM:
-      return ReceiveInterest(Wire::ToInterest(packet, Wire::WIRE_FORMAT_NDNSIM));
-    case HeaderHelper::INTEREST_CCNB:
-      return ReceiveInterest(Wire::ToInterest(packet, Wire::WIRE_FORMAT_CCNB));
-    case HeaderHelper::CONTENT_OBJECT_NDNSIM:
-      return ReceiveData(Wire::ToData(packet, Wire::WIRE_FORMAT_NDNSIM));
-    case HeaderHelper::CONTENT_OBJECT_CCNB:
-      return ReceiveData(Wire::ToData(packet, Wire::WIRE_FORMAT_CCNB));
-    default:
-      NS_FATAL_ERROR("Not supported NDN header");
-      return false;
-    }
-
-    // exception will be thrown if packet is not recognized
-  }
-  catch (UnknownHeaderException) {
-    NS_FATAL_ERROR("Unknown NDN header. Should not happen");
-    return false;
-  }
-
-  return false;
-}
-
-bool
-Face::ReceiveInterest(Ptr<Interest> interest)
-{
-  if (!IsUp()) {
-    // no tracing here. If we were off while receiving, we shouldn't even know that something was
-    // there
-    return false;
-  }
-
-  m_upstreamInterestHandler(this, interest);
-  return true;
-}
-
-bool
-Face::ReceiveData(Ptr<Data> data)
-{
-  if (!IsUp()) {
-    // no tracing here. If we were off while receiving, we shouldn't even know that something was
-    // there
-    return false;
-  }
-
-  m_upstreamDataHandler(this, data);
-  return true;
-}
-
-void
-Face::SetMetric(uint16_t metric)
-{
-  NS_LOG_FUNCTION(metric);
-  m_metric = metric;
-}
-
-uint16_t
-Face::GetMetric(void) const
-{
-  return m_metric;
-}
-
-void
-Face::SetFlags(uint32_t flags)
-{
-  m_flags = flags;
-}
-
-bool
-Face::operator== (const Face &face) const
-{
-  NS_ASSERT_MSG(m_node->GetId() == face.m_node->GetId(),
-                "Faces of different nodes should not be compared to each other: " << *this << " == "
-                                                                                  << face);
-
-  return (m_id == face.m_id);
-}
-
-bool
-Face::operator< (const Face &face) const
-{
-  NS_ASSERT_MSG(m_node->GetId() == face.m_node->GetId(),
-                "Faces of different nodes should not be compared to each other: " << *this << " == "
-                                                                                  << face);
-
-  return (m_id < face.m_id);
-}
-
-std::ostream&
-Face::Print(std::ostream& os) const
-{
-  os << "id=" << GetId();
-  return os;
-}
-
-std::ostream&
-operator<<(std::ostream& os, const Face& face)
-{
-  face.Print(os);
-  return os;
-}
-
-} // namespace ndn
-} // namespace ns3
diff --git a/model/ndn-face.hpp b/model/ndn-face.hpp
index b8cd098..2eeb969 100644
--- a/model/ndn-face.hpp
+++ b/model/ndn-face.hpp
@@ -1,327 +1,32 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2011-2014  Regents of the University of California.
  *
- * 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 file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
+ * contributors.
  *
- * 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.
+ * ndnSIM is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
  *
- * 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
+ * ndnSIM 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.
  *
- * Authors: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
+ * You should have received a copy of the GNU General Public License along with
+ * ndnSIM, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
 
-#ifndef NDN_FACE_H
-#define NDN_FACE_H
-
-#include <ostream>
-#include <algorithm>
-
-#include "ns3/ptr.h"
-#include "ns3/object.h"
-#include "ns3/nstime.h"
-#include "ns3/type-id.h"
-#include "ns3/traced-callback.h"
-#include "ns3/ndn-name.hpp"
+#ifndef NDNSIM_NDN_FACE_HPP
+#define NDNSIM_NDN_FACE_HPP
 
 namespace ns3 {
-
-class Packet;
-class Node;
-
 namespace ndn {
 
-class Interest;
-class Data;
-
-/**
- * \ingroup ndn
- * \defgroup ndn-face Faces
- */
-/**
- * \ingroup ndn-face
- * \brief Virtual class defining NDN face
- *
- * This class defines basic functionality of NDN face. Face is core
- * component responsible for actual delivery of data packet to and
- * from NDN stack
- *
- * \see ndn::AppFace, ndn::NetDeviceFace
- */
-class Face : public Object {
-public:
-  static TypeId
-  GetTypeId();
-
-  /**
-   * \brief NDN protocol handlers
-   *
-   * \param face Face from which packet has been received
-   * \param packet Original packet
-   */
-  typedef Callback<void, Ptr<Face>, Ptr<Interest>> InterestHandler;
-  typedef Callback<void, Ptr<Face>, Ptr<Data>> DataHandler;
-
-  /**
-   * \brief Default constructor
-   */
-  Face(Ptr<Node> node);
-  virtual ~Face();
-
-  /**
-   * @brief Get node to which this face is associated
-   */
-  Ptr<Node>
-  GetNode() const;
-
-  ////////////////////////////////////////////////////////////////////
-
-  /**
-   * \brief Register callback to call when new packet arrives on the face
-   *
-   * This method should call protocol-dependent registration function
-   */
-  virtual void
-  RegisterProtocolHandlers(const InterestHandler& interestHandler, const DataHandler& dataHandler);
-
-  /**
-   * \brief Un-Register callback to call when new packet arrives on the face
-   *
-   * This method should call protocol-dependent registration function
-   */
-  virtual void
-  UnRegisterProtocolHandlers();
-
-  /**
-   * @brief Send out interest through the face
-   * @param interest Interest to send out
-   * @param packet "payload" that is attached to the interest (can carry some packet tags)
-   *
-   * @returns true if interest is considered to be send out (enqueued)
-   */
-  virtual bool
-  SendInterest(Ptr<const Interest> interest);
-
-  /**
-   * @brief Send out Dat packet through the face
-   * @param data Data packet to send out
-   * @param packet Data packet payload, can also carry packet tags
-   *
-   * @returns true if Data packet is considered to be send out (enqueued)
-   */
-  virtual bool
-  SendData(Ptr<const Data> data);
-
-  /**
-   * \brief Receive interest from application or another node and forward it up to the NDN stack
-   *
-   * By default it is called from inside Receive method, but can be used directly, if appropriate
-   */
-  virtual bool
-  ReceiveInterest(Ptr<Interest> interest);
-
-  /**
-   * \brief Receive Data packet from application or another node and forward it up to the NDN stack
-   *
-   * By default it is called from inside Receive method, but can be used directly, if appropriate
-   */
-  virtual bool
-  ReceiveData(Ptr<Data> data);
-  ////////////////////////////////////////////////////////////////////
-
-  /**
-   * \brief Assign routing/forwarding metric with face
-   *
-   * \param metric configured routing metric (cost) of this face
-   */
-  virtual void
-  SetMetric(uint16_t metric);
-
-  /**
-   * \brief Get routing/forwarding metric assigned to the face
-   *
-   * \returns configured routing/forwarding metric (cost) of this face
-   */
-  virtual uint16_t
-  GetMetric(void) const;
-
-  /**
-   * These are face states and may be distinct from actual lower-layer
-   * device states, such as found in real implementations (where the
-   * device may be down but ndn face state is still up).
-   */
-
-  /**
-   * \brief Enable or disable this face
-   */
-  inline void
-  SetUp(bool up = true);
-
-  /**
-   * \brief Returns true if this face is enabled, false otherwise.
-   */
-  inline bool
-  IsUp() const;
-
-  /**
-   * @brief Get face flags
-   *
-   * Face flags may indicate various properties of the face.  For example, if the face is an
-   *application face,
-   * than the returned flags have Face::APPLICATION bit set.
-   *
-   * @see ndn::Face::Flags for the list of currently defined face flags
-   */
-  inline uint32_t
-  GetFlags() const;
-
-  /**
-   * @brief List of currently defined face flags
-   */
-  enum Flags {
-    APPLICATION = 1 ///< @brief An application face
-  };
-
-  /**
-   * @brief Print information about the face into the stream
-   * @param os stream to write information to
-   */
-  virtual std::ostream&
-  Print(std::ostream& os) const;
-
-  /**
-   * \brief Set face Id
-   *
-   * Id is purely informative and should not be used for any other purpose
-   *
-   * \param id id to set
-   */
-  inline void
-  SetId(uint32_t id);
-
-  /**
-   * \brief Get face Id
-   *
-   * Id is purely informative and should not be used for any other purpose
-   *
-   * \returns id id to set
-   */
-  inline uint32_t
-  GetId() const;
-
-  /**
-   * \brief Compare two faces. Only two faces on the same node could be compared.
-   *
-   * Internal index is used for comparison.
-   */
-  bool
-  operator==(const Face& face) const;
-
-  /**
-   * \brief Compare two faces. Only two faces on the same node could be compared.
-   *
-   * Internal index is used for comparison.
-   */
-  inline bool
-  operator!=(const Face& face) const;
-
-  /**
-   * \brief Compare two faces. Only two faces on the same node could be compared.
-   *
-   * Internal index is used for comparison.
-   */
-  bool
-  operator<(const Face& face) const;
-
-protected:
-  /**
-   * @brief Send packet down to the stack (towards app or network)
-   */
-  virtual bool
-  Send(Ptr<Packet> packet);
-
-  /**
-   * @brief Send packet up to the stack (towards forwarding strategy)
-   */
-  virtual bool
-  Receive(Ptr<const Packet> p);
-
-  /**
-   * @brief Set face flags
-   */
-  void
-  SetFlags(uint32_t flags);
-
-private:
-  Face(const Face&); ///< \brief Disabled copy constructor
-  Face&
-  operator=(const Face&); ///< \brief Disabled copy operator
-
-protected:
-  Ptr<Node> m_node; ///< \brief Smart pointer to Node
-
-private:
-  InterestHandler m_upstreamInterestHandler;
-  DataHandler m_upstreamDataHandler;
-  bool m_ifup;
-  uint32_t m_id;     ///< \brief id of the interface in NDN stack (per-node uniqueness)
-  uint16_t m_metric; ///< \brief metric of the face
-  uint32_t m_flags;  ///< @brief faces flags (e.g., APPLICATION)
+class Face {
 };
 
-std::ostream&
-operator<<(std::ostream& os, const Face& face);
-
-inline bool
-Face::IsUp(void) const
-{
-  return m_ifup;
-}
-
-inline void
-Face::SetUp(bool up /* = true*/)
-{
-  m_ifup = up;
-}
-
-inline uint32_t
-Face::GetFlags() const
-{
-  return m_flags;
-}
-
-inline bool
-operator<(const Ptr<Face>& lhs, const Ptr<Face>& rhs)
-{
-  return *lhs < *rhs;
-}
-
-void
-Face::SetId(uint32_t id)
-{
-  m_id = id;
-}
-
-uint32_t
-Face::GetId() const
-{
-  return m_id;
-}
-
-inline bool
-Face::operator!= (const Face &face) const
-{
-  return !(*this == face);
-}
-
 } // namespace ndn
 } // namespace ns3
 
-#endif // NDN_FACE_H
+#endif // NDNSIM_NDN_FACE_HPP
diff --git a/model/ndn-global-router.cpp b/model/ndn-global-router.cpp
index f44a088..19d5654 100644
--- a/model/ndn-global-router.cpp
+++ b/model/ndn-global-router.cpp
@@ -22,12 +22,9 @@
 
 #include "ns3/ndn-l3-protocol.hpp"
 #include "ns3/ndn-face.hpp"
-#include "ns3/ndn-name.hpp"
 
 #include "ns3/channel.h"
 
-using namespace boost;
-
 namespace ns3 {
 namespace ndn {
 
@@ -70,7 +67,7 @@
 }
 
 void
-GlobalRouter::AddLocalPrefix(Ptr<Name> prefix)
+GlobalRouter::AddLocalPrefix(shared_ptr<Name> prefix)
 {
   m_localPrefixes.push_back(prefix);
 }
@@ -78,7 +75,7 @@
 void
 GlobalRouter::AddIncidency(Ptr<Face> face, Ptr<GlobalRouter> gr)
 {
-  m_incidencies.push_back(make_tuple(this, face, gr));
+  m_incidencies.push_back(boost::make_tuple(this, face, gr));
 }
 
 GlobalRouter::IncidencyList&
diff --git a/model/ndn-global-router.hpp b/model/ndn-global-router.hpp
index f680db7..f742656 100644
--- a/model/ndn-global-router.hpp
+++ b/model/ndn-global-router.hpp
@@ -21,6 +21,8 @@
 #ifndef NDN_GLOBAL_ROUTER_H
 #define NDN_GLOBAL_ROUTER_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/object.h"
 #include "ns3/ptr.h"
 
@@ -35,9 +37,6 @@
 
 class L3Protocol;
 class Face;
-class Name;
-
-typedef Name NameComponents;
 
 /**
  * @ingroup ndn
@@ -56,7 +55,7 @@
   /**
    * @brief List of locally exported prefixes
    */
-  typedef std::list<Ptr<Name>> LocalPrefixList;
+  typedef std::list<shared_ptr<Name>> LocalPrefixList;
 
   /**
    * \brief Interface ID
@@ -88,7 +87,7 @@
    * @param prefix Prefix
    */
   void
-  AddLocalPrefix(Ptr<Name> prefix);
+  AddLocalPrefix(shared_ptr<Name> prefix);
 
   /**
    * @brief Add edge to the node
diff --git a/model/ndn-l3-protocol.cpp b/model/ndn-l3-protocol.cpp
index d7505e7..07d38f3 100644
--- a/model/ndn-l3-protocol.cpp
+++ b/model/ndn-l3-protocol.cpp
@@ -33,8 +33,6 @@
 #include "ns3/random-variable.h"
 
 #include "ns3/ndn-pit.hpp"
-#include "ns3/ndn-interest.hpp"
-#include "ns3/ndn-data.hpp"
 
 #include "ns3/ndn-face.hpp"
 #include "ns3/ndn-forwarding-strategy.hpp"
diff --git a/model/ndn-l3-protocol.hpp b/model/ndn-l3-protocol.hpp
index 5b71e3a..cf3d19a 100644
--- a/model/ndn-l3-protocol.hpp
+++ b/model/ndn-l3-protocol.hpp
@@ -21,6 +21,8 @@
 #ifndef NDN_L3_PROTOCOL_H
 #define NDN_L3_PROTOCOL_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include <list>
 #include <vector>
 
diff --git a/model/ndn-net-device-face.cpp b/model/ndn-net-device-face.cpp
index 31d57fc..71c23ce 100644
--- a/model/ndn-net-device-face.cpp
+++ b/model/ndn-net-device-face.cpp
@@ -31,7 +31,6 @@
 // #include "ns3/address.h"
 #include "ns3/point-to-point-net-device.h"
 #include "ns3/channel.h"
-#include "ns3/ndn-name.hpp"
 
 NS_LOG_COMPONENT_DEFINE("ndn.NetDeviceFace");
 
diff --git a/model/ndn-net-device-face.hpp b/model/ndn-net-device-face.hpp
index 5bc8e3a..05acb60 100644
--- a/model/ndn-net-device-face.hpp
+++ b/model/ndn-net-device-face.hpp
@@ -21,6 +21,8 @@
 #ifndef NDN_NET_DEVICE_FACE_H
 #define NDN_NET_DEVICE_FACE_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ndn-face.hpp"
 #include "ns3/net-device.h"
 
diff --git a/utils/tracers/l2-tracer.hpp b/utils/tracers/l2-tracer.hpp
index a2cd3a6..814a860 100644
--- a/utils/tracers/l2-tracer.hpp
+++ b/utils/tracers/l2-tracer.hpp
@@ -21,6 +21,8 @@
 #ifndef L2_TRACER_H
 #define L2_TRACER_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/ptr.h"
 #include "ns3/simple-ref-count.h"
 #include "ns3/packet.h"
diff --git a/utils/tracers/ndn-app-delay-tracer.cpp b/utils/tracers/ndn-app-delay-tracer.cpp
index 666f945..fa9ab3a 100644
--- a/utils/tracers/ndn-app-delay-tracer.cpp
+++ b/utils/tracers/ndn-app-delay-tracer.cpp
@@ -26,8 +26,6 @@
 #include "ns3/callback.h"
 
 #include "ns3/ndn-app.hpp"
-#include "ns3/ndn-interest.hpp"
-#include "ns3/ndn-data.hpp"
 #include "ns3/simulator.h"
 #include "ns3/node-list.h"
 #include "ns3/log.h"
diff --git a/utils/tracers/ndn-app-delay-tracer.hpp b/utils/tracers/ndn-app-delay-tracer.hpp
index 64b695a..72cccec 100644
--- a/utils/tracers/ndn-app-delay-tracer.hpp
+++ b/utils/tracers/ndn-app-delay-tracer.hpp
@@ -21,6 +21,8 @@
 #ifndef CCNX_APP_DELAY_TRACER_H
 #define CCNX_APP_DELAY_TRACER_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/ptr.h"
 #include "ns3/simple-ref-count.h"
 #include <ns3/nstime.h>
diff --git a/utils/tracers/ndn-cs-tracer.cpp b/utils/tracers/ndn-cs-tracer.cpp
index bc5d8de..f470aae 100644
--- a/utils/tracers/ndn-cs-tracer.cpp
+++ b/utils/tracers/ndn-cs-tracer.cpp
@@ -27,8 +27,6 @@
 #include "ns3/callback.h"
 
 #include "ns3/ndn-app.hpp"
-#include "ns3/ndn-interest.hpp"
-#include "ns3/ndn-data.hpp"
 #include "ns3/ndn-content-store.hpp"
 #include "ns3/simulator.h"
 #include "ns3/node-list.h"
@@ -271,13 +269,13 @@
 }
 
 void
-CsTracer::CacheHits(Ptr<const Interest>, Ptr<const Data>)
+CsTracer::CacheHits(shared_ptr<const Interest>, shared_ptr<const Data>)
 {
   m_stats.m_cacheHits++;
 }
 
 void
-CsTracer::CacheMisses(Ptr<const Interest>)
+CsTracer::CacheMisses(shared_ptr<const Interest>)
 {
   m_stats.m_cacheMisses++;
 }
diff --git a/utils/tracers/ndn-cs-tracer.hpp b/utils/tracers/ndn-cs-tracer.hpp
index 939df9b..d14d005 100644
--- a/utils/tracers/ndn-cs-tracer.hpp
+++ b/utils/tracers/ndn-cs-tracer.hpp
@@ -22,6 +22,8 @@
 #ifndef CCNX_CS_TRACER_H
 #define CCNX_CS_TRACER_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/ptr.h"
 #include "ns3/simple-ref-count.h"
 #include <ns3/nstime.h>
@@ -40,12 +42,6 @@
 
 namespace ndn {
 
-class Interest;
-class Data;
-
-typedef Interest InterestHeader;
-typedef Data DataHeader;
-
 namespace cs {
 
 /// @cond include_hidden
@@ -180,10 +176,10 @@
   Connect();
 
   void
-  CacheHits(Ptr<const Interest>, Ptr<const Data>);
+  CacheHits(shared_ptr<const Interest>, shared_ptr<const Data>);
 
   void
-  CacheMisses(Ptr<const Interest>);
+  CacheMisses(shared_ptr<const Interest>);
 
 private:
   void
diff --git a/utils/tracers/ndn-l3-aggregate-tracer.cpp b/utils/tracers/ndn-l3-aggregate-tracer.cpp
index d9fc671..708640b 100644
--- a/utils/tracers/ndn-l3-aggregate-tracer.cpp
+++ b/utils/tracers/ndn-l3-aggregate-tracer.cpp
@@ -26,8 +26,6 @@
 #include "ns3/callback.h"
 #include "ns3/ndn-app.hpp"
 #include "ns3/ndn-face.hpp"
-#include "ns3/ndn-interest.hpp"
-#include "ns3/ndn-data.hpp"
 #include "ns3/ndn-pit-entry.hpp"
 
 #include "ns3/simulator.h"
@@ -288,7 +286,7 @@
 }
 
 void
-L3AggregateTracer::OutInterests(Ptr<const Interest> interest, Ptr<const Face> face)
+L3AggregateTracer::OutInterests(shared_ptr<const Interest> interest, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_outInterests++;
   if (interest->GetWire()) {
@@ -297,7 +295,7 @@
 }
 
 void
-L3AggregateTracer::InInterests(Ptr<const Interest> interest, Ptr<const Face> face)
+L3AggregateTracer::InInterests(shared_ptr<const Interest> interest, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_inInterests++;
   if (interest->GetWire()) {
@@ -306,7 +304,7 @@
 }
 
 void
-L3AggregateTracer::DropInterests(Ptr<const Interest> interest, Ptr<const Face> face)
+L3AggregateTracer::DropInterests(shared_ptr<const Interest> interest, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_dropInterests++;
   if (interest->GetWire()) {
@@ -315,7 +313,7 @@
 }
 
 void
-L3AggregateTracer::OutNacks(Ptr<const Interest> nack, Ptr<const Face> face)
+L3AggregateTracer::OutNacks(shared_ptr<const Interest> nack, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_outNacks++;
   if (nack->GetWire()) {
@@ -324,7 +322,7 @@
 }
 
 void
-L3AggregateTracer::InNacks(Ptr<const Interest> nack, Ptr<const Face> face)
+L3AggregateTracer::InNacks(shared_ptr<const Interest> nack, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_inNacks++;
   if (nack->GetWire()) {
@@ -333,7 +331,7 @@
 }
 
 void
-L3AggregateTracer::DropNacks(Ptr<const Interest> nack, Ptr<const Face> face)
+L3AggregateTracer::DropNacks(shared_ptr<const Interest> nack, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_dropNacks++;
   if (nack->GetWire()) {
@@ -342,7 +340,7 @@
 }
 
 void
-L3AggregateTracer::OutData(Ptr<const Data> data, bool fromCache, Ptr<const Face> face)
+L3AggregateTracer::OutData(shared_ptr<const Data> data, bool fromCache, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_outData++;
   if (data->GetWire()) {
@@ -351,7 +349,7 @@
 }
 
 void
-L3AggregateTracer::InData(Ptr<const Data> data, Ptr<const Face> face)
+L3AggregateTracer::InData(shared_ptr<const Data> data, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_inData++;
   if (data->GetWire()) {
@@ -360,7 +358,7 @@
 }
 
 void
-L3AggregateTracer::DropData(Ptr<const Data> data, Ptr<const Face> face)
+L3AggregateTracer::DropData(shared_ptr<const Data> data, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_dropData++;
   if (data->GetWire()) {
diff --git a/utils/tracers/ndn-l3-aggregate-tracer.hpp b/utils/tracers/ndn-l3-aggregate-tracer.hpp
index bedfccc..aa5d82f 100644
--- a/utils/tracers/ndn-l3-aggregate-tracer.hpp
+++ b/utils/tracers/ndn-l3-aggregate-tracer.hpp
@@ -21,6 +21,8 @@
 #ifndef NDN_L3_AGGREGATE_TRACER_H
 #define NDN_L3_AGGREGATE_TRACER_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ndn-l3-tracer.hpp"
 
 #include <ns3/nstime.h>
@@ -141,31 +143,31 @@
   Print(std::ostream& os) const;
 
   virtual void
-  OutInterests(Ptr<const Interest>, Ptr<const Face>);
+  OutInterests(shared_ptr<const Interest>, Ptr<const Face>);
 
   virtual void
-  InInterests(Ptr<const Interest>, Ptr<const Face>);
+  InInterests(shared_ptr<const Interest>, Ptr<const Face>);
 
   virtual void
-  DropInterests(Ptr<const Interest>, Ptr<const Face>);
+  DropInterests(shared_ptr<const Interest>, Ptr<const Face>);
 
   virtual void
-  OutNacks(Ptr<const Interest>, Ptr<const Face>);
+  OutNacks(shared_ptr<const Interest>, Ptr<const Face>);
 
   virtual void
-  InNacks(Ptr<const Interest>, Ptr<const Face>);
+  InNacks(shared_ptr<const Interest>, Ptr<const Face>);
 
   virtual void
-  DropNacks(Ptr<const Interest>, Ptr<const Face>);
+  DropNacks(shared_ptr<const Interest>, Ptr<const Face>);
 
   virtual void
-  OutData(Ptr<const Data>, bool fromCache, Ptr<const Face>);
+  OutData(shared_ptr<const Data>, bool fromCache, Ptr<const Face>);
 
   virtual void
-  InData(Ptr<const Data>, Ptr<const Face>);
+  InData(shared_ptr<const Data>, Ptr<const Face>);
 
   virtual void
-  DropData(Ptr<const Data>, Ptr<const Face>);
+  DropData(shared_ptr<const Data>, Ptr<const Face>);
 
   virtual void
   SatisfiedInterests(Ptr<const pit::Entry>);
diff --git a/utils/tracers/ndn-l3-rate-tracer.cpp b/utils/tracers/ndn-l3-rate-tracer.cpp
index 38170bc..6bba93b 100644
--- a/utils/tracers/ndn-l3-rate-tracer.cpp
+++ b/utils/tracers/ndn-l3-rate-tracer.cpp
@@ -29,8 +29,6 @@
 
 #include "ns3/ndn-app.hpp"
 #include "ns3/ndn-face.hpp"
-#include "ns3/ndn-interest.hpp"
-#include "ns3/ndn-data.hpp"
 #include "ns3/ndn-pit-entry.hpp"
 
 #include <fstream>
@@ -312,7 +310,7 @@
 }
 
 void
-L3RateTracer::OutInterests(Ptr<const Interest> interest, Ptr<const Face> face)
+L3RateTracer::OutInterests(shared_ptr<const Interest> interest, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_outInterests++;
   if (interest->GetWire()) {
@@ -321,7 +319,7 @@
 }
 
 void
-L3RateTracer::InInterests(Ptr<const Interest> interest, Ptr<const Face> face)
+L3RateTracer::InInterests(shared_ptr<const Interest> interest, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_inInterests++;
   if (interest->GetWire()) {
@@ -330,7 +328,7 @@
 }
 
 void
-L3RateTracer::DropInterests(Ptr<const Interest> interest, Ptr<const Face> face)
+L3RateTracer::DropInterests(shared_ptr<const Interest> interest, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_dropInterests++;
   if (interest->GetWire()) {
@@ -339,7 +337,7 @@
 }
 
 void
-L3RateTracer::OutNacks(Ptr<const Interest> interest, Ptr<const Face> face)
+L3RateTracer::OutNacks(shared_ptr<const Interest> interest, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_outNacks++;
   if (interest->GetWire()) {
@@ -348,7 +346,7 @@
 }
 
 void
-L3RateTracer::InNacks(Ptr<const Interest> interest, Ptr<const Face> face)
+L3RateTracer::InNacks(shared_ptr<const Interest> interest, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_inNacks++;
   if (interest->GetWire()) {
@@ -357,7 +355,7 @@
 }
 
 void
-L3RateTracer::DropNacks(Ptr<const Interest> interest, Ptr<const Face> face)
+L3RateTracer::DropNacks(shared_ptr<const Interest> interest, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_dropNacks++;
   if (interest->GetWire()) {
@@ -366,7 +364,7 @@
 }
 
 void
-L3RateTracer::OutData(Ptr<const Data> data, bool fromCache, Ptr<const Face> face)
+L3RateTracer::OutData(shared_ptr<const Data> data, bool fromCache, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_outData++;
   if (data->GetWire()) {
@@ -375,7 +373,7 @@
 }
 
 void
-L3RateTracer::InData(Ptr<const Data> data, Ptr<const Face> face)
+L3RateTracer::InData(shared_ptr<const Data> data, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_inData++;
   if (data->GetWire()) {
@@ -384,7 +382,7 @@
 }
 
 void
-L3RateTracer::DropData(Ptr<const Data> data, Ptr<const Face> face)
+L3RateTracer::DropData(shared_ptr<const Data> data, Ptr<const Face> face)
 {
   m_stats[face].get<0>().m_dropData++;
   if (data->GetWire()) {
diff --git a/utils/tracers/ndn-l3-rate-tracer.hpp b/utils/tracers/ndn-l3-rate-tracer.hpp
index 21bb06c..41adf26 100644
--- a/utils/tracers/ndn-l3-rate-tracer.hpp
+++ b/utils/tracers/ndn-l3-rate-tracer.hpp
@@ -21,6 +21,8 @@
 #ifndef CCNX_RATE_L3_TRACER_H
 #define CCNX_RATE_L3_TRACER_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ndn-l3-tracer.hpp"
 
 #include "ns3/nstime.h"
@@ -128,31 +130,31 @@
 protected:
   // from L3Tracer
   virtual void
-  OutInterests(Ptr<const Interest>, Ptr<const Face>);
+  OutInterests(shared_ptr<const Interest>, Ptr<const Face>);
 
   virtual void
-  InInterests(Ptr<const Interest>, Ptr<const Face>);
+  InInterests(shared_ptr<const Interest>, Ptr<const Face>);
 
   virtual void
-  DropInterests(Ptr<const Interest>, Ptr<const Face>);
+  DropInterests(shared_ptr<const Interest>, Ptr<const Face>);
 
   virtual void
-  OutNacks(Ptr<const Interest>, Ptr<const Face>);
+  OutNacks(shared_ptr<const Interest>, Ptr<const Face>);
 
   virtual void
-  InNacks(Ptr<const Interest>, Ptr<const Face>);
+  InNacks(shared_ptr<const Interest>, Ptr<const Face>);
 
   virtual void
-  DropNacks(Ptr<const Interest>, Ptr<const Face>);
+  DropNacks(shared_ptr<const Interest>, Ptr<const Face>);
 
   virtual void
-  OutData(Ptr<const Data>, bool fromCache, Ptr<const Face>);
+  OutData(shared_ptr<const Data>, bool fromCache, Ptr<const Face>);
 
   virtual void
-  InData(Ptr<const Data>, Ptr<const Face>);
+  InData(shared_ptr<const Data>, Ptr<const Face>);
 
   virtual void
-  DropData(Ptr<const Data>, Ptr<const Face>);
+  DropData(shared_ptr<const Data>, Ptr<const Face>);
 
   virtual void
   SatisfiedInterests(Ptr<const pit::Entry>);
diff --git a/utils/tracers/ndn-l3-tracer.cpp b/utils/tracers/ndn-l3-tracer.cpp
index 8d59eb0..25e9f07 100644
--- a/utils/tracers/ndn-l3-tracer.cpp
+++ b/utils/tracers/ndn-l3-tracer.cpp
@@ -29,8 +29,6 @@
 #include <boost/lexical_cast.hpp>
 
 #include "ns3/ndn-face.hpp"
-#include "ns3/ndn-interest.hpp"
-#include "ns3/ndn-data.hpp"
 #include "ns3/ndn-pit-entry.hpp"
 
 using namespace std;
diff --git a/utils/tracers/ndn-l3-tracer.hpp b/utils/tracers/ndn-l3-tracer.hpp
index d3534fa..f916bd4 100644
--- a/utils/tracers/ndn-l3-tracer.hpp
+++ b/utils/tracers/ndn-l3-tracer.hpp
@@ -21,6 +21,8 @@
 #ifndef NDN_L3_TRACER_H
 #define NDN_L3_TRACER_H
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/ptr.h"
 #include "ns3/simple-ref-count.h"
 
@@ -42,9 +44,6 @@
 
 class Face;
 
-class Interest;
-class Data;
-
 /**
  * @ingroup ndn-tracers
  * @brief Base class for network-layer (incoming/outgoing Interests and Data) tracing of NDN stack
@@ -89,31 +88,31 @@
   Connect();
 
   virtual void
-  OutInterests(Ptr<const Interest>, Ptr<const Face>) = 0;
+  OutInterests(shared_ptr<const Interest>, Ptr<const Face>) = 0;
 
   virtual void
-  InInterests(Ptr<const Interest>, Ptr<const Face>) = 0;
+  InInterests(shared_ptr<const Interest>, Ptr<const Face>) = 0;
 
   virtual void
-  DropInterests(Ptr<const Interest>, Ptr<const Face>) = 0;
+  DropInterests(shared_ptr<const Interest>, Ptr<const Face>) = 0;
 
   virtual void
-  OutNacks(Ptr<const Interest>, Ptr<const Face>) = 0;
+  OutNacks(shared_ptr<const Interest>, Ptr<const Face>) = 0;
 
   virtual void
-  InNacks(Ptr<const Interest>, Ptr<const Face>) = 0;
+  InNacks(shared_ptr<const Interest>, Ptr<const Face>) = 0;
 
   virtual void
-  DropNacks(Ptr<const Interest>, Ptr<const Face>) = 0;
+  DropNacks(shared_ptr<const Interest>, Ptr<const Face>) = 0;
 
   virtual void
-  OutData(Ptr<const Data>, bool fromCache, Ptr<const Face>) = 0;
+  OutData(shared_ptr<const Data>, bool fromCache, Ptr<const Face>) = 0;
 
   virtual void
-  InData(Ptr<const Data>, Ptr<const Face>) = 0;
+  InData(shared_ptr<const Data>, Ptr<const Face>) = 0;
 
   virtual void
-  DropData(Ptr<const Data>, Ptr<const Face>) = 0;
+  DropData(shared_ptr<const Data>, Ptr<const Face>) = 0;
 
   virtual void
   SatisfiedInterests(Ptr<const pit::Entry>) = 0;
diff --git a/utils/trie/trie.hpp b/utils/trie/trie.hpp
index 9afc8d1..bc7ab31 100644
--- a/utils/trie/trie.hpp
+++ b/utils/trie/trie.hpp
@@ -21,6 +21,8 @@
 #ifndef TRIE_H_
 #define TRIE_H_
 
+#include "ns3/ndnSIM/model/ndn-common.hpp"
+
 #include "ns3/ptr.h"
 
 #include <boost/intrusive/unordered_set.hpp>