Enabling app-layer tracing

Network-layer tracing is not working yet (needs a couple of attributes
to be implemented)
diff --git a/apps/ccnx-app.cc b/apps/ccnx-app.cc
index 40c1168..780eb9f 100644
--- a/apps/ccnx-app.cc
+++ b/apps/ccnx-app.cc
@@ -42,6 +42,15 @@
   static TypeId tid = TypeId ("ns3::CcnxApp")
     .SetParent<Application> ()
     .AddConstructor<CcnxApp> ()
+
+    .AddTraceSource ("ReceivedInterests", "ReceivedInterests",
+                    MakeTraceSourceAccessor (&CcnxApp::m_receivedInterests))
+    
+    .AddTraceSource ("ReceivedNacks", "ReceivedNacks",
+                    MakeTraceSourceAccessor (&CcnxApp::m_receivedNacks))
+    
+    .AddTraceSource ("ReceivedContentObjects", "ReceivedContentObjects",
+                    MakeTraceSourceAccessor (&CcnxApp::m_receivedContentObjects))
     ;
   return tid;
 }
@@ -78,12 +87,14 @@
 CcnxApp::OnInterest (const Ptr<const CcnxInterestHeader> &interest)
 {
   NS_LOG_FUNCTION (this << interest);
+  m_receivedInterests (interest, this, m_face);
 }
 
 void
 CcnxApp::OnNack (const Ptr<const CcnxInterestHeader> &interest)
 {
   NS_LOG_FUNCTION (this << interest);
+  m_receivedNacks (interest, this, m_face);
 }
 
 void
@@ -91,6 +102,7 @@
                           const Ptr<const Packet> &payload)
 {
   NS_LOG_FUNCTION (this << contentObject << payload);
+  m_receivedContentObjects (contentObject, payload, this, m_face);
 }
 
 // Application Methods
diff --git a/apps/ccnx-app.h b/apps/ccnx-app.h
index f94018f..457172e 100644
--- a/apps/ccnx-app.h
+++ b/apps/ccnx-app.h
@@ -24,6 +24,7 @@
 #include "ns3/application.h"
 #include "ns3/ptr.h"
 #include "ns3/callback.h"
+#include "ns3/traced-callback.h"
 
 namespace ns3 
 {
@@ -96,6 +97,15 @@
   ProtocolHandler m_protocolHandler;
   bool m_active; 
   Ptr<CcnxFace> m_face; // local face that is created 
+
+  TracedCallback<Ptr<const CcnxInterestHeader>,
+                 Ptr<CcnxApp>, Ptr<CcnxFace> > m_receivedInterests;
+
+  TracedCallback<Ptr<const CcnxInterestHeader>,
+                 Ptr<CcnxApp>, Ptr<CcnxFace> > m_receivedNacks;
+
+  TracedCallback<Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>,
+                 Ptr<CcnxApp>, Ptr<CcnxFace> > m_receivedContentObjects;
 };
 
 } // namespace ns3
diff --git a/apps/ccnx-consumer.cc b/apps/ccnx-consumer.cc
index 7e541ec..28211e4 100644
--- a/apps/ccnx-consumer.cc
+++ b/apps/ccnx-consumer.cc
@@ -51,7 +51,7 @@
 CcnxConsumer::GetTypeId (void)
 {
   static TypeId tid = TypeId ("ns3::CcnxConsumer")
-    .SetParent<Application> ()
+    .SetParent<CcnxApp> ()
     .AddConstructor<CcnxConsumer> ()
     .AddAttribute ("StartSeq", "Initial sequence number",
                    IntegerValue(0),
@@ -98,12 +98,8 @@
                    MakeTimeAccessor (&CcnxConsumer::GetRetxTimer, &CcnxConsumer::SetRetxTimer),
                    MakeTimeChecker ())
 
-    // .AddTraceSource ("InterestTrace", "Interests that were sent",
-    //                  MakeTraceSourceAccessor (&CcnxConsumer::m_interestsTrace))
-    // .AddTraceSource ("NackTrace", "NACKs received",
-    //                  MakeTraceSourceAccessor (&CcnxConsumer::m_nackTrace))
-    // .AddTraceSource ("ContentObjectTrace", "ContentObjects received",
-    //                  MakeTraceSourceAccessor (&CcnxConsumer::m_contentObjectsTrace))
+    .AddTraceSource ("TransmittedInterests", "TransmittedInterests",
+                    MakeTraceSourceAccessor (&CcnxConsumer::m_transmittedInterests))
     ;
 
   return tid;
@@ -139,6 +135,8 @@
 {
   Time now = Simulator::Now ();
 
+  boost::mutex::scoped_lock (m_seqTimeoutsGuard);
+
   while (!m_seqTimeouts.empty ())
     {
       SeqTimeoutsContainer::index<i_timestamp>::type::iterator entry =
@@ -187,6 +185,8 @@
 {
   NS_LOG_FUNCTION_NOARGS ();
 
+  boost::mutex::scoped_lock (m_seqTimeoutsGuard);
+
   uint32_t seq;
   
   if (m_retxSeqs.size () != 0)
@@ -209,7 +209,7 @@
   interestHeader.SetChildSelector       (m_childSelector);
   if (m_exclude.size ()>0)
     {
-      interestHeader.SetExclude             (Create<CcnxNameComponents> (m_exclude));
+      interestHeader.SetExclude (Create<CcnxNameComponents> (m_exclude));
     }
   interestHeader.SetMaxSuffixComponents (m_maxSuffixComponents);
   interestHeader.SetMinSuffixComponents (m_minSuffixComponents);
@@ -222,21 +222,26 @@
 
   m_protocolHandler (packet);
 
+  NS_LOG_DEBUG ("Trying to add " << seq << " with " << Simulator::Now () << ". already " << m_seqTimeouts.size () << " items");  
+  
   std::pair<SeqTimeoutsContainer::iterator, bool>
     res = m_seqTimeouts.insert (SeqTimeout (seq, Simulator::Now ()));
-  if (!res.second)
-    m_seqTimeouts.modify (res.first,
-                          ll::bind(&SeqTimeout::time, ll::_1) = Simulator::Now ());
+  
+  // if (!res.second)
+  //   m_seqTimeouts.modify (res.first,
+  //                         ll::bind(&SeqTimeout::time, ll::_1) = Simulator::Now ());
   
   m_sendEvent = Simulator::Schedule (m_offTime, &CcnxConsumer::SendPacket, this);
 
-  // \todo Trace
+  m_transmittedInterests (&interestHeader, this, m_face);
 }
 
 void
 CcnxConsumer::OnContentObject (const Ptr<const CcnxContentObjectHeader> &contentObject,
                                const Ptr<const Packet> &payload)
 {
+  CcnxApp::OnContentObject (contentObject, payload); // tracing inside
+  
   NS_LOG_FUNCTION (this << contentObject << payload);
 
   // NS_LOG_INFO ("Received content object: " << boost::cref(*contentObject));
@@ -244,6 +249,8 @@
   uint32_t seq = boost::lexical_cast<uint32_t> (contentObject->GetName ().GetComponents ().back ());
   NS_LOG_INFO ("< DATA for " << seq);
 
+  boost::mutex::scoped_lock (m_seqTimeoutsGuard);
+  
   SeqTimeoutsContainer::iterator entry = m_seqTimeouts.find (seq);
 
   NS_ASSERT_MSG (entry != m_seqTimeouts.end (),
@@ -251,13 +258,13 @@
 
   if (entry != m_seqTimeouts.end ())
     m_seqTimeouts.erase (entry);
-
-  // \todo Trace
 }
 
 void
 CcnxConsumer::OnNack (const Ptr<const CcnxInterestHeader> &interest)
 {
+  CcnxApp::OnNack (interest); // tracing inside
+  
   NS_LOG_FUNCTION (this << interest);
 
   // NS_LOG_INFO ("Received NACK: " << boost::cref(*interest));
@@ -266,8 +273,6 @@
 
   // put in the queue of interests to be retransmitted
   m_retxSeqs.insert (seq);
-
-  // \todo Trace?
 }
 
 } // namespace ns3
diff --git a/apps/ccnx-consumer.h b/apps/ccnx-consumer.h
index ce0a20c..7cfb739 100644
--- a/apps/ccnx-consumer.h
+++ b/apps/ccnx-consumer.h
@@ -33,6 +33,8 @@
 #include <boost/multi_index/ordered_index.hpp>
 #include <boost/multi_index/member.hpp>
 
+#include <boost/thread/mutex.hpp>
+
 namespace ns3 
 {
 
@@ -106,8 +108,6 @@
     
     uint32_t seq;
     Time time;
-
-    bool operator < (const SeqTimeout &st) { return time < st.time || (time == st.time && seq < st.seq); }
   };
 
   class i_seq { };
@@ -129,6 +129,10 @@
     > { } ;
 
   SeqTimeoutsContainer m_seqTimeouts;
+  boost::mutex m_seqTimeoutsGuard;
+
+  TracedCallback<Ptr<const CcnxInterestHeader>,
+                 Ptr<CcnxApp>, Ptr<CcnxFace> > m_transmittedInterests;
 };
 
 } // namespace ns3
diff --git a/apps/ccnx-producer.cc b/apps/ccnx-producer.cc
index ba2918d..3a37efd 100644
--- a/apps/ccnx-producer.cc
+++ b/apps/ccnx-producer.cc
@@ -53,10 +53,9 @@
                    UintegerValue (1024),
                    MakeUintegerAccessor(&CcnxProducer::m_virtualPayloadSize),
                    MakeUintegerChecker<uint32_t>())
-    // .AddTraceSource ("InterestTrace", "Interests that were received",
-    //                 MakeTraceSourceAccessor (&CcnxProducer::m_interestsTrace))
-    // .AddTraceSource ("ContentObjectTrace", "ContentObjects that were sent",
-    //                 MakeTraceSourceAccessor (&CcnxProducer::m_contentObjectsTrace))
+    
+    .AddTraceSource ("TransmittedContentObjects", "TransmittedContentObjects",
+                    MakeTraceSourceAccessor (&CcnxProducer::m_transmittedContentObjects))
     ;
         
   return tid;
@@ -92,6 +91,8 @@
 void
 CcnxProducer::OnInterest (const Ptr<const CcnxInterestHeader> &interest)
 {
+  CcnxApp::OnInterest (interest); // tracing inside
+
   NS_LOG_FUNCTION (this << interest);
 
   if (!m_active) return;
@@ -103,6 +104,9 @@
   NS_LOG_INFO ("Respodning with ContentObject:\n" << boost::cref(*header));
   
   Ptr<Packet> packet = Create<Packet> (m_virtualPayloadSize);
+
+  m_transmittedContentObjects (header, packet, this, m_face);
+  
   packet->AddHeader (*header);
   packet->AddTrailer (tail);
 
diff --git a/apps/ccnx-producer.h b/apps/ccnx-producer.h
index ac9a492..a239d84 100644
--- a/apps/ccnx-producer.h
+++ b/apps/ccnx-producer.h
@@ -52,6 +52,9 @@
 private:
   CcnxNameComponents m_prefix;
   uint32_t m_virtualPayloadSize;
+
+  TracedCallback<Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>,
+                 Ptr<CcnxApp>, Ptr<CcnxFace> > m_transmittedContentObjects;
 };
 
 }
diff --git a/examples/abilene-topology.cc b/examples/abilene-topology.cc
index c0c1f16..8c83930 100644
--- a/examples/abilene-topology.cc
+++ b/examples/abilene-topology.cc
@@ -26,25 +26,27 @@
 #include "ns3/point-to-point-grid.h"
 #include "ns3/ipv4-global-routing-helper.h"
 #include "ns3/animation-interface.h"
-#include "ns3/ccnx-l3-protocol.h"
+// #include "ns3/ccnx-l3-protocol.h"
 
 #include <iostream>
 #include <sstream>
 #include "ns3/annotated-topology-reader.h"
 #include "../utils/spring-mobility-helper.h"
 
+#include "ns3/config-store.h"
+
 using namespace ns3;
 using namespace std;
 
 NS_LOG_COMPONENT_DEFINE ("CcnxAbileneTopology");
 
-int transmittedInterests = 0;
-int receivedInterests = 0;
-int droppedInterests = 0;
+// int transmittedInterests = 0;
+// int receivedInterests = 0;
+// int droppedInterests = 0;
 
-int transmittedData = 0;
-int receivedData = 0;
-int droppedData = 0;
+// int transmittedData = 0;
+// int receivedData = 0;
+// int droppedData = 0;
 
 void PrintTime ()
 {
@@ -69,49 +71,118 @@
     }
 }
 
-static void OnTransmittedInterest (std::string context, Ptr<const CcnxInterestHeader> header, 
-                                   Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face)
+
+struct AggregateTrace
 {
-  transmittedInterests++;
+  AggregateTrace ()
+    : m_transmittedInterests (0)
+    , m_transmittedData (0)
+    , m_receivedInterests (0)
+    , m_receivedNacks (0)
+    , m_receivedData (0)
+  {
+  }
+  
+  void
+  TransmittedInterests (std::string context,
+                        Ptr<const CcnxInterestHeader>, Ptr<CcnxApp>, Ptr<CcnxFace>)
+  {
+    m_transmittedInterests++;
+  }
+
+  void
+  TransmittedData (std::string context,
+                   Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>,
+                   Ptr<CcnxApp>, Ptr<CcnxFace>)
+  {
+    m_transmittedData++;
+  }
+
+  void
+  ReceivedInterests (std::string context,
+                     Ptr<const CcnxInterestHeader>,
+                     Ptr<CcnxApp>, Ptr<CcnxFace>)
+  {
+    m_receivedInterests++;
+  }
+
+  void
+  ReceivedNacks (std::string context,
+                 Ptr<const CcnxInterestHeader>,
+                 Ptr<CcnxApp>, Ptr<CcnxFace>)
+  {
+    m_receivedNacks++;
+  }
+  
+  void
+  ReceivedData (std::string context,
+                Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>,
+                Ptr<CcnxApp>, Ptr<CcnxFace>)
+  {
+    m_receivedData++;
+  }
+
+  uint64_t m_transmittedInterests;
+  uint64_t m_transmittedData;
+  uint64_t m_receivedInterests;
+  uint64_t m_receivedNacks;
+  uint64_t m_receivedData;
+};
+
+ostream&
+operator << (ostream &os, const AggregateTrace &trace)
+{
+  os << ">> (i): " << trace.m_transmittedInterests << "\n";
+  os << ">> (d): " << trace.m_transmittedData << "\n";
+  os << "<< (i): " << trace.m_receivedInterests << "\n";
+  os << "<< (d): " << trace.m_receivedData << "\n";
+  os << "<< (n): " << trace.m_receivedNacks << "\n";
+  return os;
 }
 
-static void OnReceivedInterest (std::string context, Ptr<const CcnxInterestHeader> header, 
-                                Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face)
-{
-  receivedInterests++;
-}
+// static void OnTransmittedInterest (std::string context, Ptr<const CcnxInterestHeader> header, 
+//                                    Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face)
+// {
+//   transmittedInterests++;
+// }
 
-static void OnDroppedInterest (std::string context, Ptr<const CcnxInterestHeader> header, CcnxL3Protocol::DropReason reason,
-                               Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face)
-{
-  droppedInterests++;
-}
+// static void OnReceivedInterest (std::string context, Ptr<const CcnxInterestHeader> header, 
+//                                 Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face)
+// {
+//   receivedInterests++;
+// }
 
-static void OnTransmittedData (std::string context, Ptr<const CcnxContentObjectHeader> header, Ptr<const Packet> packet,
-                               CcnxL3Protocol::ContentObjectSource source, Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face)
-{
-    transmittedData++;    
-}
+// static void OnDroppedInterest (std::string context, Ptr<const CcnxInterestHeader> header, CcnxL3Protocol::DropReason reason,
+//                                Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face)
+// {
+//   droppedInterests++;
+// }
 
-static void OnReceivedData (std::string context, Ptr<const CcnxContentObjectHeader> header, Ptr<const Packet> packet,
-                            Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face)
-{
-    receivedData++;
-}
+// static void OnTransmittedData (std::string context, Ptr<const CcnxContentObjectHeader> header, Ptr<const Packet> packet,
+//                                CcnxL3Protocol::ContentObjectSource source, Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face)
+// {
+//     transmittedData++;    
+// }
 
-static void OnDroppedData (std::string context, Ptr<const CcnxContentObjectHeader> header, Ptr<const Packet> packet,
-                           CcnxL3Protocol::DropReason reason, Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face )
-{
-    droppedData++;
-}
+// static void OnReceivedData (std::string context, Ptr<const CcnxContentObjectHeader> header, Ptr<const Packet> packet,
+//                             Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face)
+// {
+//     receivedData++;
+// }
+
+// static void OnDroppedData (std::string context, Ptr<const CcnxContentObjectHeader> header, Ptr<const Packet> packet,
+//                            CcnxL3Protocol::DropReason reason, Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face )
+// {
+//     droppedData++;
+// }
 
 int 
 main (int argc, char *argv[])
 {
-  Packet::EnableChecking();
-  Packet::EnablePrinting();
+  // Packet::EnableChecking();
+  // Packet::EnablePrinting();
   string input ("./src/NDNabstraction/examples/abilene-topology.txt");
-    
+
   Time finishTime = Seconds (20.0);
   string animationFile;
   string strategy = "ns3::CcnxFloodingStrategy";
@@ -121,6 +192,9 @@
   cmd.AddValue ("strategy", "CCNx forwarding strategy", strategy);
   cmd.Parse (argc, argv);
     
+  ConfigStore config;
+  config.ConfigureDefaults ();
+    
   // ------------------------------------------------------------
   // -- Read topology data.
   // --------------------------------------------
@@ -137,13 +211,6 @@
       return -1;
     }
 
-  int droppedInterests[nodes.GetN()];
-  int congestedInterests[nodes.GetN()];
-  int sentInterests[nodes.GetN()];
-  (void)droppedInterests;
-  (void)sentInterests;
-  (void)congestedInterests;
-    
   SpringMobilityHelper::InstallSprings (reader.LinksBegin (), reader.LinksEnd ());
 
   // InternetStackHelper stack;
@@ -168,8 +235,8 @@
   CcnxConsumerHelper consumerHelper ("/5");
   ApplicationContainer consumers = consumerHelper.Install (Names::Find<Node> ("/abilene", "ATLAng"));
     
-  CcnxProducerHelper producerHelper ("/5",1024);
-  ApplicationContainer producers = producerHelper.Install (Names::Find<Node> ("/abilene", "IPLSng"));
+  // CcnxProducerHelper producerHelper ("/5",1024);
+  // ApplicationContainer producers = producerHelper.Install (Names::Find<Node> ("/abilene", "IPLSng"));
 
   // // Populate FIB based on IPv4 global routing controller
   // ccnxHelper.InstallFakeGlobalRoutes ();
@@ -178,7 +245,7 @@
   // Simulator::Schedule (Seconds (1.0), PrintFIBs);
   // PrintFIBs ();
 
-  Simulator::Schedule (Seconds (10.0), PrintTime);
+  // Simulator::Schedule (Seconds (10.0), PrintTime);
 
   Simulator::Stop (finishTime);
 
@@ -189,38 +256,50 @@
       anim->SetMobilityPollInterval (Seconds (1));
     }
 
-  NS_LOG_INFO ("Configure Tracing.");
-  // first, pcap tracing in non-promiscuous mode
-  //ccnxHelper.EnablePcapAll ("csma-ping", false);
-  // then, print what the packet sink receives.
-  //Config::ConnectWithoutContext ("/NodeList/3/ApplicationList/0/$ns3::PacketSink/Rx", 
-  //                                 MakeCallback (&SinkRx));
-  // finally, print the ping rtts.
-    //Packet::EnablePrinting ();
-  Config::Connect("/NodeList/*/ns3::CcnxL3Protocol/TransmittedInterestTrace",
-                                 MakeCallback (&OnTransmittedInterest));
-  Config::Connect ("/NodeList/*/ns3::CcnxL3Protocol/ReceivedInterestTrace",
-                     MakeCallback (&OnReceivedInterest));
-  Config::Connect ("/NodeList/*/ns3::CcnxL3Protocol/DroppedInterestTrace",
-                     MakeCallback (&OnDroppedInterest));
-    
-  Config::Connect ("/NodeList/*/ns3::CcnxL3Protocol/ReceivedDataTrace",
-                     MakeCallback (&OnReceivedData));
-  Config::Connect ("/NodeList/*/ns3::CcnxL3Protocol/TransmittedDataTrace",
-                     MakeCallback (&OnTransmittedData));
-  Config::Connect ("/NodeList/*/ns3::CcnxL3Protocol/DroppedDataTrace",
-                     MakeCallback (&OnDroppedData));
+  // NS_LOG_INFO ("Configure Tracing.");
+  AggregateTrace trace;
+  Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::CcnxConsumer/TransmittedInterests",
+                   MakeCallback (&AggregateTrace::TransmittedInterests, &trace));
 
+  Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::CcnxConsumer/ReceivedNacks",
+                   MakeCallback (&AggregateTrace::ReceivedNacks, &trace));
+
+  Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::CcnxProducer/ReceivedInterests",
+                   MakeCallback (&AggregateTrace::ReceivedInterests, &trace));
+  
+  Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::CcnxProducer/TransmittedContentObjects",
+                   MakeCallback (&AggregateTrace::TransmittedData, &trace));
+
+  Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::CcnxConsumer/ReceivedContentObjects",
+                   MakeCallback (&AggregateTrace::ReceivedData, &trace));
+
+  // Config::Connect("/NodeList/*/ns3::CcnxL3Protocol/TransmittedInterestTrace",
+  //                                MakeCallback (&OnTransmittedInterest));
+  // Config::Connect ("/NodeList/*/ns3::CcnxL3Protocol/ReceivedInterestTrace",
+  //                    MakeCallback (&OnReceivedInterest));
+  // Config::Connect ("/NodeList/*/ns3::CcnxL3Protocol/DroppedInterestTrace",
+  //                    MakeCallback (&OnDroppedInterest));
+    
+  // Config::Connect ("/NodeList/*/ns3::CcnxL3Protocol/ReceivedDataTrace",
+  //                    MakeCallback (&OnReceivedData));
+  // Config::Connect ("/NodeList/*/ns3::CcnxL3Protocol/TransmittedDataTrace",
+  //                    MakeCallback (&OnTransmittedData));
+  // Config::Connect ("/NodeList/*/ns3::CcnxL3Protocol/DroppedDataTrace",
+  //                    MakeCallback (&OnDroppedData));
+  
+  config.ConfigureAttributes ();  
+  
   NS_LOG_INFO ("Run Simulation.");
   Simulator::Run ();
   Simulator::Destroy ();
   NS_LOG_INFO ("Done.");
 
-  NS_LOG_INFO("Total received interests = " << receivedInterests);
-  NS_LOG_INFO("Total transmitted interests = " << transmittedInterests);
-  NS_LOG_INFO("Total dropped interests = " << droppedInterests);
-  NS_LOG_INFO("Total received data = " << receivedData);
-  NS_LOG_INFO("Total transmitted data = " << transmittedData);
-  NS_LOG_INFO("Total dropped data = " << droppedData);
+  // NS_LOG_INFO("Total received interests = " << receivedInterests);
+  // NS_LOG_INFO("Total transmitted interests = " << transmittedInterests);
+  // NS_LOG_INFO("Total dropped interests = " << droppedInterests);
+  // NS_LOG_INFO("Total received data = " << receivedData);
+  // NS_LOG_INFO("Total transmitted data = " << transmittedData);
+  // NS_LOG_INFO("Total dropped data = " << droppedData);
+  NS_LOG_INFO (trace);
   return 0;
 }
diff --git a/model/annotated-topology-reader.cc b/model/annotated-topology-reader.cc
index 6553f86..15c0d6b 100644
--- a/model/annotated-topology-reader.cc
+++ b/model/annotated-topology-reader.cc
@@ -59,7 +59,7 @@
 {
   NS_LOG_FUNCTION (this);
 
-  // SetMobilityModel ("ns3::ConstantPositionMobilityModel");
+  SetMobilityModel ("ns3::ConstantPositionMobilityModel");
 }
     
 void
diff --git a/model/ccnx-face.cc b/model/ccnx-face.cc
index 40ac57b..ec35d8b 100644
--- a/model/ccnx-face.cc
+++ b/model/ccnx-face.cc
@@ -32,6 +32,16 @@
 
 namespace ns3 {
 
+TypeId
+CcnxFace::GetTypeId ()
+{
+  static TypeId tid = TypeId ("ns3::CcnxFace")
+    .SetParent<Object> ()
+    .SetGroupName ("Ccnx")
+    ;
+  return tid;
+}
+
 /** 
  * By default, Ccnx face are created in the "down" state
  *  with no IP addresses.  Before becoming useable, the user must 
@@ -79,6 +89,7 @@
   NS_LOG_FUNCTION_NOARGS ();
 
   /// \todo Implement tracing, if requested
+  
   if (!IsUp ())
     return false;
   
diff --git a/model/ccnx-face.h b/model/ccnx-face.h
index 0499abb..b63b1e7 100644
--- a/model/ccnx-face.h
+++ b/model/ccnx-face.h
@@ -47,11 +47,14 @@
  *
  * \see CcnxLocalFace, CcnxNetDeviceFace, CcnxIpv4Face, CcnxUdpFace
  */
-class CcnxFace  : public SimpleRefCount<CcnxFace>
+class CcnxFace  : public Object
 {
 public:
+  static TypeId
+  GetTypeId ();
+  
   /**
-   * \brief Ccnx protocol hanler
+   * \brief Ccnx protocol handler
    *
    * \param face Face from which packet has been received
    * \param packet Original packet
diff --git a/model/ccnx-l3-protocol.cc b/model/ccnx-l3-protocol.cc
index 6b567c8..f05a80f 100644
--- a/model/ccnx-l3-protocol.cc
+++ b/model/ccnx-l3-protocol.cc
@@ -256,48 +256,6 @@
 void 
 CcnxL3Protocol::Receive (const Ptr<CcnxFace> &face, const Ptr<const Packet> &p)
 {
-  if (!face->IsUp ())
-    {
-      NS_LOG_LOGIC ("Dropping received packet -- interface is down");
-        
-      //m_droppedDTrace (p, INTERFACE_DOWN, m_node->GetObject<Ccnx> ()/*this*/, face);
-        
-        Ptr<Packet> packet = p->Copy (); // give upper layers a rw copy of the packet
-        try
-        {
-            CcnxHeaderHelper::Type type = CcnxHeaderHelper::GetCcnxHeaderType (p);
-            switch (type)
-            {
-                case CcnxHeaderHelper::INTEREST:
-                {
-                    Ptr<CcnxInterestHeader> header = Create<CcnxInterestHeader> ();
-                    m_droppedInterestsTrace (header, INTERFACE_DOWN, m_node->GetObject<Ccnx> (), face);
-                    break;
-                }
-                case CcnxHeaderHelper::CONTENT_OBJECT:
-                {
-                    Ptr<CcnxContentObjectHeader> header = Create<CcnxContentObjectHeader> ();
-                    
-                    static CcnxContentObjectTail contentObjectTrailer; //there is no data in this object
-                    
-                    // Deserialization. Exception may be thrown
-                    packet->RemoveHeader (*header);
-                    packet->RemoveTrailer (contentObjectTrailer);
-                    
-                    m_droppedDataTrace (header, packet, INTERFACE_DOWN, m_node->GetObject<Ccnx> (), face);
-                    break;
-                }
-            }
-            
-            // exception will be thrown if packet is not recognized
-        }
-        catch (CcnxUnknownHeaderException)
-        {
-            NS_ASSERT_MSG (false, "Unknown CCNx header. Should not happen");
-        }
-        
-      return;
-    }
   NS_LOG_LOGIC ("Packet from face " << *face << " received on node " <<  m_node->GetId ());
 
   Ptr<Packet> packet = p->Copy (); // give upper layers a rw copy of the packet
diff --git a/model/ccnx-l3-protocol.h b/model/ccnx-l3-protocol.h
index d55ccd4..29500fc 100644
--- a/model/ccnx-l3-protocol.h
+++ b/model/ccnx-l3-protocol.h
@@ -103,9 +103,7 @@
     NACK_NONDUPLICATE,
 
     DROP_NO_ROUTE,   /**< No route to host */
-  };
-    
-    
+  };    
 
   /**
    * \enum DropReason
@@ -247,16 +245,19 @@
   EventId m_bucketLeakEvent;
   
   TracedCallback<Ptr<const CcnxInterestHeader>,
-                  Ptr<Ccnx>, Ptr<const CcnxFace> > m_receivedInterestsTrace;
+                 Ptr<Ccnx>, Ptr<const CcnxFace> > m_receivedInterestsTrace;
+  
   TracedCallback<Ptr<const CcnxInterestHeader>,
-                  Ptr<Ccnx>, Ptr<const CcnxFace> > m_transmittedInterestsTrace;
+                 Ptr<Ccnx>, Ptr<const CcnxFace> > m_transmittedInterestsTrace;
+  
   TracedCallback<Ptr<const CcnxInterestHeader>,
-                  DropReason,
-                  Ptr<Ccnx>, Ptr<const CcnxFace> > m_droppedInterestsTrace;
+                 DropReason,
+                 Ptr<Ccnx>, Ptr<const CcnxFace> > m_droppedInterestsTrace;
 
   TracedCallback<Ptr<const CcnxContentObjectHeader>,
-                  Ptr<const Packet>,/*payload*/
-                  Ptr<Ccnx>, Ptr<const CcnxFace> > m_receivedDataTrace;
+                 Ptr<const Packet>,/*payload*/
+                 Ptr<Ccnx>, Ptr<const CcnxFace> > m_receivedDataTrace;
+
   TracedCallback<Ptr<const CcnxContentObjectHeader>,
                   Ptr<const Packet>,/*payload*/
                   ContentObjectSource,