More progress on CCNx stack. Now we have helpers. Everything compiles, but not yet working

diff --git a/helper/ccnx-face-container.cc b/helper/ccnx-face-container.cc
new file mode 100644
index 0000000..f25ea5e
--- /dev/null
+++ b/helper/ccnx-face-container.cc
@@ -0,0 +1,81 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+
+#include "ccnx-face-container.h"
+#include "ns3/node-list.h"
+#include "ns3/names.h"
+
+namespace ns3 {
+
+CcnxFaceContainer::CcnxFaceContainer ()
+{
+}
+
+void
+CcnxFaceContainer::Add (CcnxFaceContainer other)
+{
+  for (FaceVector::const_iterator i = other.m_faces.begin (); i != other.m_faces.end (); i++)
+    {
+      m_faces.push_back (*i);
+    }
+}
+
+CcnxFaceContainer::Iterator
+CcnxFaceContainer::Begin (void) const
+{
+  return m_faces.begin ();
+}
+
+CcnxFaceContainer::Iterator
+CcnxFaceContainer::End (void) const
+{
+  return m_faces.end ();
+}
+
+uint32_t
+CcnxFaceContainer::GetN (void) const
+{
+  return m_faces.size ();
+}
+
+// CcnxAddress
+// CcnxFaceContainer::GetAddress (uint32_t i, uint32_t j) const
+// {
+//   Ptr<Ccnx> ccnx = m_faces[i].first;
+//   uint32_t face = m_faces[i].second;
+//   return ccnx->GetAddress (face, j).GetLocal ();
+// }
+
+void 
+CcnxFaceContainer::SetMetric (uint32_t i, uint16_t metric)
+{
+  Ptr<Ccnx> ccnx = m_faces[i].first;
+  uint32_t face = m_faces[i].second;
+  ccnx->SetMetric (face, metric);
+}
+
+void 
+CcnxFaceContainer::Add (Ptr<Ccnx> ccnx, uint32_t face)
+{
+  m_faces.push_back (std::make_pair (ccnx, face));
+}
+
+void CcnxFaceContainer::Add (std::pair<Ptr<Ccnx>, uint32_t> a)
+{
+  Add (a.first, a.second);
+}
+
+void 
+CcnxFaceContainer::Add (std::string ccnxName, uint32_t face)
+{
+  Ptr<Ccnx> ccnx = Names::Find<Ccnx> (ccnxName);
+  m_faces.push_back (std::make_pair (ccnx, face));
+}
+
+std::pair<Ptr<Ccnx>, uint32_t>
+CcnxFaceContainer::Get (uint32_t i) const
+{
+  return m_faces[i];
+}
+
+
+} // namespace ns3
diff --git a/helper/ccnx-face-container.h b/helper/ccnx-face-container.h
new file mode 100644
index 0000000..8bbbbc3
--- /dev/null
+++ b/helper/ccnx-face-container.h
@@ -0,0 +1,181 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+
+#ifndef CCNX_FACE_CONTAINER_H
+#define CCNX_FACE_CONTAINER_H
+
+#include <stdint.h>
+#include <vector>
+#include "ns3/ccnx.h"
+
+namespace ns3 {
+
+/**
+ * \brief holds a vector of std::pair of Ptr<Ccnx> and face index.
+ *
+ * Typically ns-3 CcnxFaces are installed on devices using an Ccnx address
+ * helper.  The helper's Assign() method takes a NetDeviceContainer which holds 
+ * some number of Ptr<NetDevice>.  For each of the NetDevices in the 
+ * NetDeviceContainer the helper will find the associated Ptr<Node> and
+ * Ptr<Ccnx>.  It makes sure that an face exists on the node for the 
+ * device and then adds an CcnxAddress according to the address helper settings
+ * (incrementing the CcnxAddress somehow as it goes).  The helper then converts
+ * the Ptr<Ccnx> and the face index to a std::pair and adds them to a 
+ * container -- a container of this type.
+ *
+ * The point is then to be able to implicitly associate an index into the 
+ * original NetDeviceContainer (that identifies a particular net device) with
+ * an identical index into the CcnxFaceContainer that has a std::pair with
+ * the Ptr<Ccnx> and face index you need to play with the face.
+ *
+ * @see CcnxAddressHelper
+ * @see Ccnx
+ */
+class CcnxFaceContainer
+{
+public:
+  typedef std::vector<std::pair<Ptr<Ccnx>, uint32_t> >::const_iterator Iterator;
+
+  /**
+   * Create an empty CcnxFaceContainer.
+   */
+  CcnxFaceContainer ();
+
+  /**
+   * Concatenate the entries in the other container with ours.
+   * \param other container
+   */
+  void Add (CcnxFaceContainer other);
+
+  /**
+   * \brief Get an iterator which refers to the first pair in the 
+   * container.
+   *
+   * Pairs can be retrieved from the container in two ways.  First,
+   * directly by an index into the container, and second, using an iterator.
+   * This method is used in the iterator method and is typically used in a 
+   * for-loop to run through the pairs
+   *
+   * \code
+   *   ccnxFaceContainer::Iterator i;
+   *   for (i = container.Begin (); i != container.End (); ++i)
+   *     {
+   *       std::pair<Ptr<Ccnx>, uint32_t> pair = *i;
+   *       method (pair.first, pair.second);  // use the pair
+   *     }
+   * \endcode
+   *
+   * \returns an iterator which refers to the first pair in the container.
+   */
+  Iterator Begin (void) const;
+
+  /**
+   * \brief Get an iterator which indicates past-the-last Node in the 
+   * container.
+   *
+   * Nodes can be retrieved from the container in two ways.  First,
+   * directly by an index into the container, and second, using an iterator.
+   * This method is used in the iterator method and is typically used in a 
+   * for-loop to run through the Nodes
+   *
+   * \code
+   *   NodeContainer::Iterator i;
+   *   for (i = container.Begin (); i != container.End (); ++i)
+   *     {
+   *       std::pair<Ptr<Ccnx>, uint32_t> pair = *i;
+   *       method (pair.first, pair.second);  // use the pair
+   *     }
+   * \endcode
+   *
+   * \returns an iterator which indicates an ending condition for a loop.
+   */
+  Iterator End (void) const;
+
+  /**
+   * \returns the number of Ptr<Ccnx> and face pairs stored in this 
+   * ccnxFaceContainer.
+   *
+   * Pairs can be retrieved from the container in two ways.  First,
+   * directly by an index into the container, and second, using an iterator.
+   * This method is used in the direct method and is typically used to
+   * define an ending condition in a for-loop that runs through the stored
+   * Nodes
+   *
+   * \code
+   *   uint32_t nNodes = container.GetN ();
+   *   for (uint32_t i = 0 i < nNodes; ++i)
+   *     {
+   *       std::pair<Ptr<Ccnx>, uint32_t> pair = container.Get (i);
+   *       method (pair.first, pair.second);  // use the pair
+   *     }
+   * \endcode
+   *
+   * \returns the number of Ptr<Node> stored in this container.
+   */
+  uint32_t GetN (void) const;
+
+  /**
+   * \param i index of ipfacePair in container
+   * \param j face address index (if face has multiple addresses)
+   * \returns the ccnx address of the j'th address of the face
+   *  corresponding to index i.
+   * 
+   * If the second parameter is omitted, the zeroth indexed address of 
+   * the face is returned.  Unless IP aliasing is being used on
+   * the face, the second parameter may typically be omitted.
+   */
+  // ccnxAddress GetAddress (uint32_t i, uint32_t j = 0) const;
+
+  void SetMetric (uint32_t i, uint16_t metric);
+
+  /**
+   * Manually add an entry to the container consisting of the individual parts
+   * of an entry std::pair.
+   *
+   * \param ccnx pointer to ccnx object
+   * \param face face index of the ccnxface to add to the container
+   *
+   * @see ccnxfaceContainer
+   */
+  void Add (Ptr<Ccnx> ccnx, uint32_t face);
+
+  /**
+   * Manually add an entry to the container consisting of a previously composed 
+   * entry std::pair.
+   *
+   * \param ipfacePair the pair of a pointer to ccnx object and face index of the ccnxface to add to the container
+   *
+   * @see ccnxfaceContainer
+   */
+  void Add (std::pair<Ptr<Ccnx>, uint32_t> ipFacePair);
+
+  /**
+   * Manually add an entry to the container consisting of the individual parts
+   * of an entry std::pair.
+   *
+   * \param ccnxName std:string referring to the saved name of an ccnx Object that
+   *        has been previously named using the Object Name Service.
+   * \param face face index of the ccnxface to add to the container
+   *
+   * @see ccnxfaceContainer
+   */
+  void Add (std::string ccnxName, uint32_t face);
+
+  /**
+   * Get the std::pair of an Ptr<Ccnx> and face stored at the location 
+   * specified by the index.
+   *
+   * \param i the index of the entery to retrieve.
+   *
+   * @see ccnxfaceContainer
+   */
+  std::pair<Ptr<Ccnx>, uint32_t> Get (uint32_t i) const;
+
+private:
+
+  typedef std::vector<std::pair<Ptr<Ccnx>,uint32_t> > FaceVector;
+  FaceVector m_faces;
+};
+
+} // namespace ns3
+
+#endif /* CCNX_FACE_CONTAINER_H */
diff --git a/helper/ccnx-forwarding-helper.cc b/helper/ccnx-forwarding-helper.cc
new file mode 100644
index 0000000..ed038cb
--- /dev/null
+++ b/helper/ccnx-forwarding-helper.cc
@@ -0,0 +1,83 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 INRIA
+ *
+ * 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#include "ns3/node.h"
+#include "ns3/node-list.h"
+#include "ns3/simulator.h"
+#include "ns3/ccnx-forwarding-protocol.h"
+#include "ccnx-forwarding-helper.h"
+
+namespace ns3 {
+
+CcnxForwardingHelper::~CcnxForwardingHelper ()
+{
+}
+
+void
+CcnxForwardingHelper::PrintForwardingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream) const
+{
+  for (uint32_t i = 0; i < NodeList::GetNNodes (); i++)
+    {
+      Ptr<Node> node = NodeList::GetNode (i);
+      Simulator::Schedule (printTime, &CcnxForwardingHelper::Print, this, node, stream);
+    }
+}
+
+void
+CcnxForwardingHelper::PrintForwardingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream) const
+{
+  for (uint32_t i = 0; i < NodeList::GetNNodes (); i++)
+    {
+      Ptr<Node> node = NodeList::GetNode (i);
+      Simulator::Schedule (printInterval, &CcnxForwardingHelper::PrintEvery, this, printInterval, node, stream);
+    }
+}
+
+void
+CcnxForwardingHelper::PrintForwardingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
+{
+  Simulator::Schedule (printTime, &CcnxForwardingHelper::Print, this, node, stream);
+}
+
+void
+CcnxForwardingHelper::PrintForwardingTableEvery (Time printInterval,Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
+{
+  Simulator::Schedule (printInterval, &CcnxForwardingHelper::PrintEvery, this, printInterval, node, stream);
+}
+
+void
+CcnxForwardingHelper::Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
+{
+  Ptr<Ccnx> ccnx = node->GetObject<Ccnx> ();
+  Ptr<CcnxForwardingProtocol> rp = ccnx->GetForwardingProtocol ();
+  NS_ASSERT (rp);
+  rp->PrintForwardingTable (stream);
+}
+
+void
+CcnxForwardingHelper::PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
+{
+  Ptr<Ccnx> ccnx = node->GetObject<Ccnx> ();
+  Ptr<CcnxForwardingProtocol> rp = ccnx->GetForwardingProtocol ();
+  NS_ASSERT (rp);
+  rp->PrintForwardingTable (stream);
+  Simulator::Schedule (printInterval, &CcnxForwardingHelper::PrintEvery, this, printInterval, node, stream);
+}
+
+} // namespace ns3
diff --git a/helper/ccnx-forwarding-helper.h b/helper/ccnx-forwarding-helper.h
new file mode 100644
index 0000000..d66584f
--- /dev/null
+++ b/helper/ccnx-forwarding-helper.h
@@ -0,0 +1,118 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 INRIA
+ *
+ * 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef CCNX_FORWARDING_HELPER_H
+#define CCNX_FORWARDING_HELPER_H
+
+#include "ns3/ptr.h"
+#include "ns3/nstime.h"
+#include "ns3/output-stream-wrapper.h"
+
+namespace ns3 {
+
+class CcnxForwardingProtocol;
+class Node;
+
+/**
+ * \brief a factory to create ns3::CcnxForwardingProtocol objects
+ *
+ * For each new forwarding protocol created as a subclass of 
+ * ns3::CcnxForwardingProtocol, you need to create a subclass of 
+ * ns3::CcnxForwardingHelper which can be used by 
+ * ns3::InternetStackHelper::SetForwardingHelper and 
+ * ns3::InternetStackHelper::Install.
+ */
+class CcnxForwardingHelper
+{
+public:
+  /*
+   * Destroy an instance of an CcnxForwardingHelper
+   */
+  virtual ~CcnxForwardingHelper ();
+
+  /**
+   * \brief virtual constructor
+   * \returns pointer to clone of this CcnxForwardingHelper 
+   * 
+   * This method is mainly for internal use by the other helpers;
+   * clients are expected to free the dynamic memory allocated by this method
+   */
+  virtual CcnxForwardingHelper* Copy (void) const = 0;
+
+  /**
+   * \param node the node within which the new forwarding protocol will run
+   * \returns a newly-created forwarding protocol
+   */
+  virtual Ptr<CcnxForwardingProtocol> Create (Ptr<Node> node) const = 0;
+
+  /**
+   * \brief prints the forwarding tables of all nodes at a particular time.
+   * \param printTime the time at which the forwarding table is supposed to be printed.
+   * \param stream The output stream object to use 
+   *
+   * This method calls the PrintForwardingTable() method of the 
+   * CcnxForwardingProtocol stored in the Ccnx object, for all nodes at the
+   * specified time; the output format is forwarding protocol-specific.
+   */
+  void PrintForwardingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream) const;
+
+  /**
+   * \brief prints the forwarding tables of all nodes at regular intervals specified by user.
+   * \param printInterval the time interval for which the forwarding table is supposed to be printed.
+   * \param stream The output stream object to use
+   *
+   * This method calls the PrintForwardingTable() method of the 
+   * CcnxForwardingProtocol stored in the Ccnx object, for all nodes at the
+   * specified time interval; the output format is forwarding protocol-specific.
+   */
+  void PrintForwardingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream) const;
+
+  /**
+   * \brief prints the forwarding tables of a node at a particular time.
+   * \param printTime the time at which the forwarding table is supposed to be printed.
+   * \param node The node ptr for which we need the forwarding table to be printed
+   * \param stream The output stream object to use
+   *
+   * This method calls the PrintForwardingTable() method of the 
+   * CcnxForwardingProtocol stored in the Ccnx object, for the selected node 
+   * at the specified time; the output format is forwarding protocol-specific.
+   */
+  void PrintForwardingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
+
+  /**
+   * \brief prints the forwarding tables of a node at regular intervals specified by user.
+   * \param printInterval the time interval for which the forwarding table is supposed to be printed.
+   * \param node The node ptr for which we need the forwarding table to be printed
+   * \param stream The output stream object to use
+   *
+   * This method calls the PrintForwardingTable() method of the 
+   * CcnxForwardingProtocol stored in the Ccnx object, for the selected node 
+   * at the specified interval; the output format is forwarding protocol-specific.
+   */
+  void PrintForwardingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
+
+private:
+  void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
+  void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
+};
+
+} // namespace ns3
+
+
+#endif /* CCNX_FORWARDING_HELPER_H */
diff --git a/helper/ccnx-stack-helper.cc b/helper/ccnx-stack-helper.cc
new file mode 100644
index 0000000..836c379
--- /dev/null
+++ b/helper/ccnx-stack-helper.cc
@@ -0,0 +1,494 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 UCLA
+ *
+ * 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: 
+ */
+
+/**
+ * \ingroup ccnx
+ * \defgroup CcnxStackModel Ccnx Stack Model
+ *
+ * \section CcnxStackTracingModel Tracing in the Ccnx Stack
+ *
+ * The ccnx stack provides a number of trace sources in its various
+ * protocol implementations.  These trace sources can be hooked using your own 
+ * custom trace code, or you can use our helper functions in some cases to 
+ * arrange for tracing to be enabled.
+ *
+ * \subsection CcnxStackCcnxTracingModel Tracing in Ccnx
+ *
+ * The Ccnx layer three protocol provides three trace hooks.  These are the 
+ * "Tx" (ns3::CcnxL3Protocol::m_txTrace), "Rx" (ns3::CcnxL3Protocol::m_rxTrace) 
+ * and "Drop" (ns3::CcnxL3Protocol::m_dropTrace) trace sources.
+ *
+ * The "Tx" trace is fired in a number of situations, all of which indicate that
+ * a given packet is about to be sent down to a given ns3::CcnxFace.
+ *
+ * - \todo list Tx trace events
+ *
+ * The "Rx" trace is fired when a packet is passed from the device up to the
+ * ns3::CcnxL3Protocol::Receive function.
+ *
+ * - In the receive function, the CcnxFaceList is iterated, and if the
+ *   CcnxFace corresponding to the receiving device is found to be in the
+ *   UP state, the trace is fired.
+ *
+ * The "Drop" trace is fired in any case where the packet is dropped (in both
+ * the transmit and receive paths).
+ *
+ * - \todo list Drop trace events
+ */
+
+#include "ns3/assert.h"
+#include "ns3/log.h"
+#include "ns3/object.h"
+#include "ns3/names.h"
+#include "ns3/ccnx.h"
+#include "ns3/packet-socket-factory.h"
+#include "ns3/config.h"
+#include "ns3/simulator.h"
+#include "ns3/string.h"
+#include "ns3/net-device.h"
+#include "ns3/callback.h"
+#include "ns3/node.h"
+#include "ns3/core-config.h"
+#include "ns3/ccnx-forwarding-protocol.h"
+
+#include "ccnx-stack-helper.h"
+#include "ccnx-forwarding-helper.h"
+
+#include <limits>
+#include <map>
+
+NS_LOG_COMPONENT_DEFINE ("CcnxStackHelper");
+
+namespace ns3 {
+
+// Things are going to work differently here with respect to trace
+// file handling than in most places because the Tx and Rx trace
+// sources we are interested in are going to multiplex receive and
+// transmit callbacks for all Ccnx and face pairs through one
+// callback.  We want packets to or from each distinct pair to go to
+// an individual file, so we have got to demultiplex the Ccnx and face
+// pair into a corresponding Ptr<PcapFileWrapper> at the callback.
+//
+// A complication in this situation is that the trace sources are
+// hooked on a protocol basis.  There is no trace source hooked by an
+// Ccnx and face pair.  This means that if we naively proceed to hook,
+// say, a drop trace for a given Ccnx with face 0, and then hook for
+// Ccnx with face 1 we will hook the drop trace twice and get two
+// callbacks per event.  What we need to do is to hook the event once,
+// and that will result in a single callback per drop event, and the
+// trace source will provide the face which we filter on in the trace
+// sink.
+// 
+// This has got to continue to work properly after the helper has been
+// destroyed; but must be cleaned up at the end of time to avoid
+// leaks.  Global maps of protocol/face pairs to file objects seems to
+// fit the bill.
+//
+typedef std::pair<Ptr<Ccnx>, uint32_t> FacePairCcnx; 
+typedef std::map<FacePairCcnx, Ptr<PcapFileWrapper> > FaceFileMapCcnx;
+typedef std::map<FacePairCcnx, Ptr<OutputStreamWrapper> > FaceStreamMapCcnx;
+
+static FaceFileMapCcnx g_faceFileMapCcnx; /**< A mapping of Ccnx/face pairs to pcap files */
+static FaceStreamMapCcnx g_faceStreamMapCcnx; /**< A mapping of Ccnx/face pairs to ascii streams */
+
+CcnxStackHelper::CcnxStackHelper ()
+  : m_forwarding (0)
+  , m_ccnxEnabled (true)
+{
+  Initialize ();
+}
+
+// private method called by both constructor and Reset ()
+void
+CcnxStackHelper::Initialize ()
+{
+  // CcnxStaticForwardingHelper staticForwarding;
+  // CcnxGlobalForwardingHelper globalForwarding;
+  // CcnxListForwardingHelper listForwarding;
+  // listForwarding.Add (staticForwarding, 0);
+  // listForwarding.Add (globalForwarding, -10);
+  // SetForwardingHelper (listForwarding);
+}
+
+CcnxStackHelper::~CcnxStackHelper ()
+{
+  if (m_forwarding)
+    {
+      delete m_forwarding;
+      m_forwarding = 0;
+    }
+}
+
+CcnxStackHelper::CcnxStackHelper (const CcnxStackHelper &o)
+{
+  m_forwarding = o.m_forwarding->Copy ();
+  m_ccnxEnabled = o.m_ccnxEnabled;
+}
+
+CcnxStackHelper &
+CcnxStackHelper::operator = (const CcnxStackHelper &o)
+{
+  if (this == &o)
+    {
+      return *this;
+    }
+  m_forwarding = o.m_forwarding->Copy ();
+  return *this;
+}
+
+void
+CcnxStackHelper::Reset (void)
+{
+  delete m_forwarding;
+  m_forwarding = 0;
+  m_ccnxEnabled = true;
+  Initialize ();
+}
+
+void 
+CcnxStackHelper::SetForwardingHelper (const CcnxForwardingHelper &forwarding)
+{
+  delete m_forwarding;
+  m_forwarding = forwarding.Copy ();
+}
+
+void
+CcnxStackHelper::SetCcnxStackInstall (bool enable)
+{
+  m_ccnxEnabled = enable;
+}
+
+void 
+CcnxStackHelper::Install (NodeContainer c) const
+{
+  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
+    {
+      Install (*i);
+    }
+}
+
+void 
+CcnxStackHelper::InstallAll (void) const
+{
+  Install (NodeContainer::GetGlobal ());
+}
+
+void
+CcnxStackHelper::CreateAndAggregateObjectFromTypeId (Ptr<Node> node, const std::string typeId)
+{
+  ObjectFactory factory;
+  factory.SetTypeId (typeId);
+  Ptr<Object> protocol = factory.Create <Object> ();
+  node->AggregateObject (protocol);
+}
+
+void
+CcnxStackHelper::Install (Ptr<Node> node) const
+{
+  NS_ASSERT_MSG (m_forwarding, "CcnxForwarding should be set prior calling Install() method");
+  
+  if (m_ccnxEnabled)
+    {
+      if (node->GetObject<Ccnx> () != 0)
+        {
+          NS_FATAL_ERROR ("CcnxStackHelper::Install (): Installing " 
+                          "a CcnxStack to a node with an existing Ccnx object");
+          return;
+        }
+
+      CreateAndAggregateObjectFromTypeId (node, "ns3::CcnxL3Protocol");
+      // Set forwarding
+      Ptr<Ccnx> ccnx = node->GetObject<Ccnx> ();
+      Ptr<CcnxForwardingProtocol> ccnxForwarding = m_forwarding->Create (node);
+      ccnx->SetForwardingProtocol (ccnxForwarding);
+    }
+}
+
+void
+CcnxStackHelper::Install (std::string nodeName) const
+{
+  Ptr<Node> node = Names::Find<Node> (nodeName);
+  Install (node);
+}
+
+static void
+CcnxL3ProtocolRxTxSink (Ptr<const Packet> p, Ptr<Ccnx> ccnx, uint32_t face)
+{
+  NS_LOG_FUNCTION (p << ccnx << face);
+
+  //
+  // Since trace sources are independent of face, if we hook a source
+  // on a particular protocol we will get traces for all of its faces.
+  // We need to filter this to only report faces for which the user 
+  // has expressed interest.
+  //
+  FacePairCcnx pair = std::make_pair (ccnx, face);
+  if (g_faceFileMapCcnx.find (pair) == g_faceFileMapCcnx.end ())
+    {
+      NS_LOG_INFO ("Ignoring packet to/from face " << face);
+      return;
+    }
+
+  Ptr<PcapFileWrapper> file = g_faceFileMapCcnx[pair];
+  file->Write (Simulator::Now (), p);
+}
+
+bool
+CcnxStackHelper::PcapHooked (Ptr<Ccnx> ccnx)
+{
+  for (FaceFileMapCcnx::const_iterator i = g_faceFileMapCcnx.begin (); 
+       i != g_faceFileMapCcnx.end (); 
+       ++i)
+    {
+      if ((*i).first.first == ccnx)
+        {
+          return true;
+        }
+    }
+  return false;
+}
+
+void 
+CcnxStackHelper::EnablePcapCcnxInternal (std::string prefix, Ptr<Ccnx> ccnx, uint32_t face, bool explicitFilename)
+{
+  NS_LOG_FUNCTION (prefix << ccnx << face);
+
+  if (!m_ccnxEnabled)
+    {
+      NS_LOG_INFO ("Call to enable Ccnx pcap tracing but Ccnx not enabled");
+      return;
+    }
+
+  //
+  // We have to create a file and a mapping from protocol/face to file 
+  // irrespective of how many times we want to trace a particular protocol.
+  //
+  PcapHelper pcapHelper;
+
+  std::string filename;
+  if (explicitFilename)
+    {
+      filename = prefix;
+    }
+  else
+    {
+      filename = pcapHelper.GetFilenameFromInterfacePair (prefix, ccnx, face);
+    }
+
+  Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, std::ios::out, PcapHelper::DLT_RAW);
+
+  //
+  // However, we only hook the trace source once to avoid multiple trace sink
+  // calls per event (connect is independent of face).
+  //
+  if (!PcapHooked (ccnx))
+    {
+      //
+      // Ptr<Ccnx> is aggregated to node and CcnxL3Protocol is aggregated to 
+      // node so we can get to CcnxL3Protocol through Ccnx.
+      //
+      Ptr<CcnxL3Protocol> ccnxL3Protocol = ccnx->GetObject<CcnxL3Protocol> ();
+      NS_ASSERT_MSG (ccnxL3Protocol, "CcnxStackHelper::EnablePcapCcnxInternal(): "
+                     "m_ccnxEnabled and ccnxL3Protocol inconsistent");
+
+      bool result = ccnxL3Protocol->TraceConnectWithoutContext ("Tx", MakeCallback (&CcnxL3ProtocolRxTxSink));
+      NS_ASSERT_MSG (result == true, "CcnxStackHelper::EnablePcapCcnxInternal():  "
+                     "Unable to connect ccnxL3Protocol \"Tx\"");
+
+      result = ccnxL3Protocol->TraceConnectWithoutContext ("Rx", MakeCallback (&CcnxL3ProtocolRxTxSink));
+      NS_ASSERT_MSG (result == true, "CcnxStackHelper::EnablePcapCcnxInternal():  "
+                     "Unable to connect ccnxL3Protocol \"Rx\"");
+      // cast result to void, to suppress ‘result’ set but not used compiler-warning
+      // for optimized builds
+      (void) result;
+    }
+
+  g_faceFileMapCcnx[std::make_pair (ccnx, face)] = file;
+}
+
+static void
+CcnxL3ProtocolDropSinkWithoutContext (
+  Ptr<OutputStreamWrapper> stream,
+  Ptr<const Packet> packet,
+  CcnxL3Protocol::DropReason reason, 
+  Ptr<Ccnx> ccnx, 
+  uint32_t face)
+{
+  //
+  // Since trace sources are independent of face, if we hook a source
+  // on a particular protocol we will get traces for all of its faces.
+  // We need to filter this to only report faces for which the user 
+  // has expressed interest.
+  //
+  FacePairCcnx pair = std::make_pair (ccnx, face);
+  if (g_faceStreamMapCcnx.find (pair) == g_faceStreamMapCcnx.end ())
+    {
+      NS_LOG_INFO ("Ignoring packet to/from face " << face);
+      return;
+    }
+
+  *stream->GetStream () << "d " << Simulator::Now ().GetSeconds () << " " << *packet << std::endl;
+}
+
+static void
+CcnxL3ProtocolDropSinkWithContext (
+  Ptr<OutputStreamWrapper> stream,
+  std::string context,
+  Ptr<const Packet> packet,
+  CcnxL3Protocol::DropReason reason, 
+  Ptr<Ccnx> ccnx, 
+  uint32_t face)
+{
+  //
+  // Since trace sources are independent of face, if we hook a source
+  // on a particular protocol we will get traces for all of its faces.
+  // We need to filter this to only report faces for which the user 
+  // has expressed interest.
+  //
+  FacePairCcnx pair = std::make_pair (ccnx, face);
+  if (g_faceStreamMapCcnx.find (pair) == g_faceStreamMapCcnx.end ())
+    {
+      NS_LOG_INFO ("Ignoring packet to/from face " << face);
+      return;
+    }
+
+  *stream->GetStream () << "d " << Simulator::Now ().GetSeconds () << " " << context << "(" << face << ") " 
+                        << *packet << std::endl;
+}
+
+bool
+CcnxStackHelper::AsciiHooked (Ptr<Ccnx> ccnx)
+{
+  for (  FaceStreamMapCcnx::const_iterator i = g_faceStreamMapCcnx.begin (); 
+         i != g_faceStreamMapCcnx.end (); 
+         ++i)
+    {
+      if ((*i).first.first == ccnx)
+        {
+          return true;
+        }
+    }
+  return false;
+}
+
+void 
+CcnxStackHelper::EnableAsciiCcnxInternal (
+  Ptr<OutputStreamWrapper> stream, 
+  std::string prefix, 
+  Ptr<Ccnx> ccnx, 
+  uint32_t face,
+  bool explicitFilename)
+{
+  if (!m_ccnxEnabled)
+    {
+      NS_LOG_INFO ("Call to enable Ccnx ascii tracing but Ccnx not enabled");
+      return;
+    }
+
+  //
+  // Our trace sinks are going to use packet printing, so we have to 
+  // make sure that is turned on.
+  //
+  Packet::EnablePrinting ();
+
+  //
+  // If we are not provided an OutputStreamWrapper, we are expected to create 
+  // one using the usual trace filename conventions and hook WithoutContext
+  // since there will be one file per context and therefore the context would
+  // be redundant.
+  //
+  if (stream == 0)
+    {
+      //
+      // Set up an output stream object to deal with private ofstream copy 
+      // constructor and lifetime issues.  Let the helper decide the actual
+      // name of the file given the prefix.
+      //
+      // We have to create a stream and a mapping from protocol/face to 
+      // stream irrespective of how many times we want to trace a particular 
+      // protocol.
+      //
+      AsciiTraceHelper asciiTraceHelper;
+
+      std::string filename;
+      if (explicitFilename)
+        {
+          filename = prefix;
+        }
+      else
+        {
+          filename = asciiTraceHelper.GetFilenameFromInterfacePair (prefix, ccnx, face);
+        }
+
+      Ptr<OutputStreamWrapper> theStream = asciiTraceHelper.CreateFileStream (filename);
+
+      //
+      // However, we only hook the trace sources once to avoid multiple trace sink
+      // calls per event (connect is independent of face).
+      //
+      if (!AsciiHooked (ccnx))
+        {
+          //
+          // The drop sink for the CcnxL3Protocol uses a different signature than
+          // the default sink, so we have to cook one up for ourselves.  We can get
+          // to the Ptr<CcnxL3Protocol> through our Ptr<Ccnx> since they must both 
+          // be aggregated to the same node.
+          //
+          Ptr<CcnxL3Protocol> ccnxL3Protocol = ccnx->GetObject<CcnxL3Protocol> ();
+          bool __attribute__ ((unused)) result = ccnxL3Protocol->TraceConnectWithoutContext ("Drop", 
+                                                                                             MakeBoundCallback (&CcnxL3ProtocolDropSinkWithoutContext, theStream));
+          NS_ASSERT_MSG (result == true, "CcnxStackHelper::EanableAsciiCcnxInternal():  "
+                         "Unable to connect ccnxL3Protocol \"Drop\"");
+        }
+
+      g_faceStreamMapCcnx[std::make_pair (ccnx, face)] = theStream;
+      return;
+    }
+
+  //
+  // If we are provided an OutputStreamWrapper, we are expected to use it, and
+  // to provide a context.  We are free to come up with our own context if we
+  // want, and use the AsciiTraceHelper Hook*WithContext functions, but for 
+  // compatibility and simplicity, we just use Config::Connect and let it deal
+  // with the context.
+  //
+  // We need to associate the ccnx/face with a stream to express interest
+  // in tracing events on that pair, however, we only hook the trace sources 
+  // once to avoid multiple trace sink calls per event (connect is independent
+  // of face).
+  //
+  if (!AsciiHooked (ccnx))
+    {
+      Ptr<Node> node = ccnx->GetObject<Node> ();
+      std::ostringstream oss;
+
+      //
+      // This has all kinds of parameters coming with, so we have to cook up our
+      // own sink.
+      //
+      oss.str ("");
+      oss << "/NodeList/" << node->GetId () << "/$ns3::CcnxL3Protocol/Drop";
+      Config::Connect (oss.str (), MakeBoundCallback (&CcnxL3ProtocolDropSinkWithContext, stream));
+    }
+
+  g_faceStreamMapCcnx[std::make_pair (ccnx, face)] = stream;
+}
+
+} // namespace ns3
diff --git a/helper/ccnx-stack-helper.h b/helper/ccnx-stack-helper.h
new file mode 100644
index 0000000..d692b05
--- /dev/null
+++ b/helper/ccnx-stack-helper.h
@@ -0,0 +1,191 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 UCLA
+ *
+ * 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: 
+ */
+
+#ifndef CCNX_STACK_HELPER_H
+#define CCNX_STACK_HELPER_H
+
+#include "ns3/node-container.h"
+#include "ns3/net-device-container.h"
+#include "ns3/packet.h"
+#include "ns3/ptr.h"
+#include "ns3/object-factory.h"
+#include "ns3/ccnx-l3-protocol.h"
+
+#include "ccnx-trace-helper.h"
+
+namespace ns3 {
+
+class Node;
+class CcnxForwardingHelper;
+
+/**
+ * \brief Adding CCNx functionality to existing Nodes.
+ *
+ * This helper enables pcap and ascii tracing of events in the ccnx stack
+ * associated with a node.  This is substantially similar to the tracing that
+ * happens in device helpers, but the important difference is that, well, there
+ * is no device.  This means that the creation of output file names will change,
+ * and also the user-visible methods will not reference devices and therefore
+ * the number of trace enable methods is reduced.
+ *
+ * Normally we eschew multiple inheritance, however, the classes
+ * PcapUserHelperForCcnx and AsciiTraceUserHelperForCcnx are treated as
+ * "mixins".  A mixin is a self-contained class that encapsulates a general
+ * attribute or a set of functionality that may be of interest to many other
+ * classes.
+ */
+class CcnxStackHelper : public PcapHelperForCcnx, public AsciiTraceHelperForCcnx
+{
+public:
+  /**
+   * Create a new CcnxStackHelper which <empty> forwarding by default.
+   *
+   * \todo set non-empty default forwarding
+   */
+  CcnxStackHelper ();
+
+  /**
+   * Destroy the CcnxStackHelper
+   */
+  virtual ~CcnxStackHelper ();
+  CcnxStackHelper (const CcnxStackHelper &);
+  CcnxStackHelper &operator = (const CcnxStackHelper &o);
+
+  /**
+   * Return helper internal state to that of a newly constructed one
+   */
+  void Reset ();
+
+  /**
+   * \param forwarding a new forwarding helper
+   *
+   * Set the forwarding helper to use during Install. The forwarding helper is
+   * really an object factory which is used to create an object of type
+   * ns3::CcnxFrProtocol per node. This forwarding object is then associated to
+   * a single ns3::Ccnx object through its ns3::Ccnx::SetforwardingProtocol.
+   */
+  void SetForwardingHelper (const CcnxForwardingHelper &forwarding);
+
+  /**
+   * Install CCNx stack on the node
+   *
+   * This method will assert if called on a node that already has Ccnx object
+   * installed on it
+   * 
+   * \param nodeName The name of the node on which to install the stack.
+   */
+  void Install (std::string nodeName) const;
+
+  /**
+   * Install CCNx stack on the node
+   *
+   * This method will assert if called on a node that already has Ccnx object
+   * installed on it
+   * 
+   * \param node The node on which to install the stack.
+   */
+  void Install (Ptr<Node> node) const;
+
+  /**
+   * Install CCNx stack on each node in the input container
+   *
+   * The program will assert if this method is called on a container with a node
+   * that already has an ccnx object aggregated to it.
+   * 
+   * \param c NodeContainer that holds the set of nodes on which to install the
+   * new stacks.
+   */
+  void Install (NodeContainer c) const;
+
+  /**
+   * Install CCNx stack on all nodes in the simulation
+   */
+  void 
+  InstallAll () const;
+
+  /**
+   * \brief Enable/disable ccnx stack install.
+   * \param enable enable state
+   */
+  void SetCcnxStackInstall (bool enable);
+
+private:
+  /**
+   * @brief Enable pcap output the indicated Ccnx and interface pair.
+   * @internal
+   *
+   * @param prefix Filename prefix to use for pcap files.
+   * @param ccnx Ptr to the Ccnx interface on which you want to enable tracing.
+   * @param interface Interface ID on the Ccnx on which you want to enable tracing.
+   */
+  virtual void EnablePcapCcnxInternal (std::string prefix, 
+                                       Ptr<Ccnx> ccnx, 
+                                       uint32_t interface,
+                                       bool explicitFilename);
+
+  /**
+   * @brief Enable ascii trace output on the indicated Ccnx and interface pair.
+   * @internal
+   *
+   * @param stream An OutputStreamWrapper representing an existing file to use
+   *               when writing trace data.
+   * @param prefix Filename prefix to use for ascii trace files.
+   * @param ccnx Ptr to the Ccnx interface on which you want to enable tracing.
+   * @param interface Interface ID on the Ccnx on which you want to enable tracing.
+   */
+  virtual void EnableAsciiCcnxInternal (Ptr<OutputStreamWrapper> stream, 
+                                        std::string prefix, 
+                                        Ptr<Ccnx> ccnx, 
+                                        uint32_t interface,
+                                        bool explicitFilename);
+
+  void Initialize (void);
+  ObjectFactory m_tcpFactory;
+  const CcnxForwardingHelper *m_forwarding;
+
+  /**
+   * \internal
+   */
+  static void CreateAndAggregateObjectFromTypeId (Ptr<Node> node, const std::string typeId);
+
+  /**
+   * \internal
+   */
+  static void Cleanup (void);
+
+  /**
+   * \internal
+   */
+  bool PcapHooked (Ptr<Ccnx> ccnx);
+
+  /**
+   * \internal
+   */
+  bool AsciiHooked (Ptr<Ccnx> ccnx);
+
+  /**
+   * \brief Ccnx install state (enabled/disabled) ?
+   */
+  bool m_ccnxEnabled;
+};
+
+} // namespace ns3
+
+#endif /* CCNX_STACK_HELPER_H */
diff --git a/helper/ccnx-trace-helper.cc b/helper/ccnx-trace-helper.cc
new file mode 100644
index 0000000..4ee4e2f
--- /dev/null
+++ b/helper/ccnx-trace-helper.cc
@@ -0,0 +1,303 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2010 University of Washington
+ *
+ * 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
+ */
+
+#include <stdint.h>
+#include <string>
+#include <fstream>
+
+#include "ns3/abort.h"
+#include "ns3/assert.h"
+#include "ns3/log.h"
+#include "ns3/ptr.h"
+#include "ns3/node.h"
+#include "ns3/names.h"
+#include "ns3/net-device.h"
+#include "ns3/pcap-file-wrapper.h"
+
+#include "ccnx-trace-helper.h"
+
+NS_LOG_COMPONENT_DEFINE ("CcnxTraceHelper");
+
+namespace ns3 {
+
+void 
+PcapHelperForCcnx::EnablePcapCcnx (std::string prefix, Ptr<Ccnx> ccnx, uint32_t interface, bool explicitFilename)
+{
+  EnablePcapCcnxInternal (prefix, ccnx, interface, explicitFilename);
+}
+
+void 
+PcapHelperForCcnx::EnablePcapCcnx (std::string prefix, std::string ccnxName, uint32_t interface, bool explicitFilename)
+{
+  Ptr<Ccnx> ccnx = Names::Find<Ccnx> (ccnxName);
+  EnablePcapCcnx (prefix, ccnx, interface, explicitFilename);
+}
+
+void 
+PcapHelperForCcnx::EnablePcapCcnx (std::string prefix, CcnxFaceContainer c)
+{
+  for (CcnxFaceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
+    {
+      std::pair<Ptr<Ccnx>, uint32_t> pair = *i;
+      EnablePcapCcnx (prefix, pair.first, pair.second, false);
+    }
+}
+
+void
+PcapHelperForCcnx::EnablePcapCcnx (std::string prefix, NodeContainer n)
+{
+  for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
+    {
+      Ptr<Node> node = *i;
+      Ptr<Ccnx> ccnx = node->GetObject<Ccnx> ();
+      if (ccnx)
+        {
+          for (uint32_t j = 0; j < ccnx->GetNFaces (); ++j)
+            {
+              EnablePcapCcnx (prefix, ccnx, j, false);
+            }
+        }
+    }
+}
+
+void
+PcapHelperForCcnx::EnablePcapCcnxAll (std::string prefix)
+{
+  EnablePcapCcnx (prefix, NodeContainer::GetGlobal ());
+}
+
+void 
+PcapHelperForCcnx::EnablePcapCcnx (std::string prefix, uint32_t nodeid, uint32_t interface, bool explicitFilename)
+{
+  NodeContainer n = NodeContainer::GetGlobal ();
+
+  for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
+    {
+      Ptr<Node> node = *i;
+      if (node->GetId () != nodeid) 
+        {
+          continue;
+        }
+
+      Ptr<Ccnx> ccnx = node->GetObject<Ccnx> ();
+      if (ccnx)
+        {
+          EnablePcapCcnx (prefix, ccnx, interface, explicitFilename);
+        }
+      return;
+    }
+}
+
+//
+// Public API
+//
+void 
+AsciiTraceHelperForCcnx::EnableAsciiCcnx (std::string prefix, Ptr<Ccnx> ccnx, uint32_t interface, bool explicitFilename)
+{
+  EnableAsciiCcnxInternal (Ptr<OutputStreamWrapper> (), prefix, ccnx, interface, explicitFilename);
+}
+
+//
+// Public API
+//
+void 
+AsciiTraceHelperForCcnx::EnableAsciiCcnx (Ptr<OutputStreamWrapper> stream, Ptr<Ccnx> ccnx, uint32_t interface)
+{
+  EnableAsciiCcnxInternal (stream, std::string (), ccnx, interface, false);
+}
+
+//
+// Public API
+//
+void 
+AsciiTraceHelperForCcnx::EnableAsciiCcnx (
+  std::string prefix, 
+  std::string ccnxName, 
+  uint32_t interface,
+  bool explicitFilename)
+{
+  EnableAsciiCcnxImpl (Ptr<OutputStreamWrapper> (), prefix, ccnxName, interface, explicitFilename);
+}
+
+//
+// Public API
+//
+void 
+AsciiTraceHelperForCcnx::EnableAsciiCcnx (Ptr<OutputStreamWrapper> stream, std::string ccnxName, uint32_t interface)
+{
+  EnableAsciiCcnxImpl (stream, std::string (), ccnxName, interface, false);
+}
+
+//
+// Private API
+//
+void 
+AsciiTraceHelperForCcnx::EnableAsciiCcnxImpl (
+  Ptr<OutputStreamWrapper> stream, 
+  std::string prefix, 
+  std::string ccnxName, 
+  uint32_t interface,
+  bool explicitFilename)
+{
+  Ptr<Ccnx> ccnx = Names::Find<Ccnx> (ccnxName);
+  EnableAsciiCcnxInternal (stream, prefix, ccnx, interface, explicitFilename);
+}
+
+//
+// Public API
+//
+void 
+AsciiTraceHelperForCcnx::EnableAsciiCcnx (std::string prefix, CcnxFaceContainer c)
+{
+  EnableAsciiCcnxImpl (Ptr<OutputStreamWrapper> (), prefix, c);
+}
+
+//
+// Public API
+//
+void 
+AsciiTraceHelperForCcnx::EnableAsciiCcnx (Ptr<OutputStreamWrapper> stream, CcnxFaceContainer c)
+{
+  EnableAsciiCcnxImpl (stream, std::string (), c);
+}
+
+//
+// Private API
+//
+void 
+AsciiTraceHelperForCcnx::EnableAsciiCcnxImpl (Ptr<OutputStreamWrapper> stream, std::string prefix, CcnxFaceContainer c)
+{
+  for (CcnxFaceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
+    {
+      std::pair<Ptr<Ccnx>, uint32_t> pair = *i;
+      EnableAsciiCcnxInternal (stream, prefix, pair.first, pair.second, false);
+    }
+}
+
+//
+// Public API
+//
+void
+AsciiTraceHelperForCcnx::EnableAsciiCcnx (std::string prefix, NodeContainer n)
+{
+  EnableAsciiCcnxImpl (Ptr<OutputStreamWrapper> (), prefix, n);
+}
+
+//
+// Public API
+//
+void
+AsciiTraceHelperForCcnx::EnableAsciiCcnx (Ptr<OutputStreamWrapper> stream, NodeContainer n)
+{
+  EnableAsciiCcnxImpl (stream, std::string (), n);
+}
+
+//
+// Private API
+//
+void
+AsciiTraceHelperForCcnx::EnableAsciiCcnxImpl (Ptr<OutputStreamWrapper> stream, std::string prefix, NodeContainer n)
+{
+  for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
+    {
+      Ptr<Node> node = *i;
+      Ptr<Ccnx> ccnx = node->GetObject<Ccnx> ();
+      if (ccnx)
+        {
+          for (uint32_t j = 0; j < ccnx->GetNFaces (); ++j)
+            {
+              EnableAsciiCcnxInternal (stream, prefix, ccnx, j, false);
+            }
+        }
+    }
+}
+
+//
+// Public API
+//
+void
+AsciiTraceHelperForCcnx::EnableAsciiCcnxAll (std::string prefix)
+{
+  EnableAsciiCcnxImpl (Ptr<OutputStreamWrapper> (), prefix, NodeContainer::GetGlobal ());
+}
+
+//
+// Public API
+//
+void
+AsciiTraceHelperForCcnx::EnableAsciiCcnxAll (Ptr<OutputStreamWrapper> stream)
+{
+  EnableAsciiCcnxImpl (stream, std::string (), NodeContainer::GetGlobal ());
+}
+
+//
+// Public API
+//
+void 
+AsciiTraceHelperForCcnx::EnableAsciiCcnx (
+  Ptr<OutputStreamWrapper> stream, 
+  uint32_t nodeid, 
+  uint32_t interface,
+  bool explicitFilename)
+{
+  EnableAsciiCcnxImpl (stream, std::string (), nodeid, interface, explicitFilename);
+}
+
+//
+// Public API
+//
+void 
+AsciiTraceHelperForCcnx::EnableAsciiCcnx (std::string prefix, uint32_t nodeid, uint32_t interface, bool explicitFilename)
+{
+  EnableAsciiCcnxImpl (Ptr<OutputStreamWrapper> (), prefix, nodeid, interface, explicitFilename);
+}
+
+//
+// Private API
+//
+void 
+AsciiTraceHelperForCcnx::EnableAsciiCcnxImpl (
+  Ptr<OutputStreamWrapper> stream, 
+  std::string prefix, 
+  uint32_t nodeid, 
+  uint32_t interface,
+  bool explicitFilename)
+{
+  NodeContainer n = NodeContainer::GetGlobal ();
+
+  for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
+    {
+      Ptr<Node> node = *i;
+      if (node->GetId () != nodeid) 
+        {
+          continue;
+        }
+
+      Ptr<Ccnx> ccnx = node->GetObject<Ccnx> ();
+      if (ccnx)
+        {
+          EnableAsciiCcnxInternal (stream, prefix, ccnx, interface, explicitFilename);
+        }
+
+      return;
+    }
+}
+
+
+} // namespace ns3
+
diff --git a/helper/ccnx-trace-helper.h b/helper/ccnx-trace-helper.h
new file mode 100644
index 0000000..6c4fa7b
--- /dev/null
+++ b/helper/ccnx-trace-helper.h
@@ -0,0 +1,339 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 University of Washington
+ *
+ * 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
+ */
+
+#ifndef CCNX_TRACE_HELPER_H
+#define CCNX_TRACE_HELPER_H
+
+#include "ns3/assert.h"
+#include "ns3/ccnx-face-container.h"
+#include "ns3/ccnx.h"
+#include "ns3/trace-helper.h"
+
+namespace ns3 {
+
+/**
+ * @brief Base class providing common user-level pcap operations for helpers
+ * representing Ccnx protocols .
+ */
+class PcapHelperForCcnx
+{
+public:
+  /**
+   * @brief Construct a PcapHelperForCcnx.
+   */
+  PcapHelperForCcnx () {}
+
+  /**
+   * @brief Destroy a PcapHelperForCcnx.
+   */
+  virtual ~PcapHelperForCcnx () {}
+
+  /**
+   * @brief Enable pcap output the indicated Ccnx and interface pair.
+   * @internal
+   *
+   * @param prefix Filename prefix to use for pcap files.
+   * @param Ccnx Ptr<Ccnx> on which you want to enable tracing.
+   * @param interface Interface on Ccnx on which you want to enable tracing.
+   * @param explicitFilename Treat the prefix as an explicit filename if true
+   */
+  virtual void EnablePcapCcnxInternal (std::string prefix, 
+                                       Ptr<Ccnx> ccnx, 
+                                       uint32_t interface,
+                                       bool explicitFilename) = 0;
+
+  /**
+   * @brief Enable pcap output the indicated Ccnx and interface pair.
+   *
+   * @param prefix Filename prefix to use for pcap files.
+   * @param ccnx Ptr<Ccnx> on which you want to enable tracing.
+   * @param interface Interface on ccnx on which you want to enable tracing.
+   * @param explicitFilename Treat the prefix as an explicit filename if true.
+   */
+  void EnablePcapCcnx (std::string prefix, Ptr<Ccnx> ccnx, uint32_t interface, bool explicitFilename = false);
+
+  /**
+   * @brief Enable pcap output the indicated ccnx and interface pair using a
+   * Ptr<Ccnx> previously named using the ns-3 object name service.
+   *
+   * @param prefix filename prefix to use for pcap files.
+   * @param ccnxName Name of the Ptr<Ccnx> on which you want to enable tracing.
+   * @param interface Interface on ccnx on which you want to enable tracing.
+   * @param explicitFilename Treat the prefix as an explicit filename if true.
+   */
+  void EnablePcapCcnx (std::string prefix, std::string ccnxName, uint32_t interface, bool explicitFilename = false);
+
+  /**
+   * @brief Enable pcap output on each Ccnx and interface pair in the container.
+   *
+   * @param prefix Filename prefix to use for pcap files.
+   * @param c CcnxFaceContainer of Ccnx and interface pairs
+   */
+  void EnablePcapCcnx (std::string prefix, CcnxFaceContainer c);
+
+  /**
+   * @brief Enable pcap output on all Ccnx and interface pairs existing in the
+   * nodes provided in the container.
+   *
+   * \param prefix Filename prefix to use for pcap files.
+   * \param n container of nodes.
+   */
+  void EnablePcapCcnx (std::string prefix, NodeContainer n);
+
+  /**
+   * @brief Enable pcap output on the Ccnx and interface pair specified by a 
+   * global node-id (of a previously created node) and interface.  Since there
+   * can be only one Ccnx aggregated to a node, the node-id unambiguously 
+   * determines the Ccnx.
+   *
+   * @param prefix Filename prefix to use for pcap files.
+   * @param nodeid The node identifier/number of the node on which to enable tracing.
+   * @param interface Interface on ccnx on which you want to enable tracing.
+   * @param explicitFilename Treat the prefix as an explicit filename if true
+   */
+  void EnablePcapCcnx (std::string prefix, uint32_t nodeid, uint32_t interface, bool explicitFilename);
+
+  /**
+   * @brief Enable pcap output on all Ccnx and interface pairs existing in the 
+   * set of all nodes created in the simulation.
+   *
+   * @param prefix Filename prefix to use for pcap files.
+   */
+  void EnablePcapCcnxAll (std::string prefix);
+
+};
+
+/**
+ * @brief Base class providing common user-level ascii trace operations for 
+ * helpers representing Ccnx protocols .
+ */
+class AsciiTraceHelperForCcnx
+{
+public:
+  /**
+   * @brief Construct an AsciiTraceHelperForCcnx.
+   */
+  AsciiTraceHelperForCcnx () {}
+
+  /**
+   * @brief Destroy an AsciiTraceHelperForCcnx
+   */
+  virtual ~AsciiTraceHelperForCcnx () {}
+
+  /**
+   * @brief Enable ascii trace output on the indicated Ccnx and interface pair.
+   * @internal
+   *
+   * The implementation is expected to use a provided Ptr<OutputStreamWrapper>
+   * if it is non-null.  If the OutputStreamWrapper is null, the implementation
+   * is expected to use a provided prefix to construct a new file name for
+   * each net device using the rules described in the class overview.
+   *
+   * If the prefix is provided, there will be one file per Ccnx and interface pair
+   * created.  In this case, adding a trace context to the file would be pointless,
+   * so the helper implementation is expected to TraceConnectWithoutContext.
+   *
+   * If the output stream object is provided, there may be many different Ccnx 
+   * and interface pairs writing to a single file.  In this case, the trace 
+   * context could be important, so the helper implementation is expected to 
+   * TraceConnect.
+   *
+   * @param stream An OutputStreamWrapper representing an existing file to use
+   *               when writing trace data.
+   * @param prefix Filename prefix to use for ascii trace files.
+   * @param ccnx Ptr<Ccnx> on which you want to enable tracing.
+   * @param interface The interface on which you want to enable tracing.
+   * @param explicitFilename Treat the prefix as an explicit filename if true.
+   */
+  virtual void EnableAsciiCcnxInternal (Ptr<OutputStreamWrapper> stream, 
+                                        std::string prefix, 
+                                        Ptr<Ccnx> ccnx, 
+                                        uint32_t interface,
+                                        bool explicitFilename) = 0;
+
+  /**
+   * @brief Enable ascii trace output on the indicated ccnx and interface pair.
+   *
+   * @param prefix Filename prefix to use for ascii files.
+   * @param ccnx Ptr<Ccnx> on which you want to enable tracing.
+   * @param interface The interface on which you want to enable tracing.
+   * @param explicitFilename Treat the prefix as an explicit filename if true.
+   */
+  void EnableAsciiCcnx (std::string prefix, Ptr<Ccnx> ccnx, uint32_t interface, bool explicitFilename = false);
+
+  /**
+   * @brief Enable ascii trace output on the indicated Ccnx and interface pair.
+   *
+   * @param stream An OutputStreamWrapper representing an existing file to use
+   *               when writing trace data.
+   * @param ccnx Ptr<Ccnx> on which you want to enable tracing.
+   * @param interface The interface on which you want to enable tracing.
+   */
+  void EnableAsciiCcnx (Ptr<OutputStreamWrapper> stream, Ptr<Ccnx> ccnx, uint32_t interface);
+
+  /**
+   * @brief Enable ascii trace output the indicated ccnx and interface pair
+   * using an ccnx previously named using the ns-3 object name service.
+   *
+   * @param prefix filename prefix to use for ascii files.
+   * @param ccnxName The name of the ccnx on which you want to enable tracing.
+   * @param interface The interface on which you want to enable tracing.
+   * @param explicitFilename Treat the prefix as an explicit filename if true.
+   */
+  void EnableAsciiCcnx (std::string prefix, std::string ccnxName, uint32_t interface, bool explicitFilename = false);
+
+  /**
+   * @brief Enable ascii trace output the indicated net device using a device 
+   * previously named using the ns-3 object name service.
+   *
+   * @param stream An OutputStreamWrapper representing an existing file to use
+   *               when writing trace data.
+   * @param ccnxName The name of the ccnx on which you want to enable tracing.
+   * @param interface The interface on which you want to enable tracing.
+   */
+  void EnableAsciiCcnx (Ptr<OutputStreamWrapper> stream, std::string ccnxName, uint32_t interface);
+
+  /**
+   * @brief Enable ascii trace output on each Ccnx and interface pair in the 
+   * container
+   *
+   * @param prefix Filename prefix to use for ascii files.
+   * @param c CcnxFaceContainer of Ccnx and interface pairs on which to 
+   *          enable tracing.
+   */
+  void EnableAsciiCcnx (std::string prefix, CcnxFaceContainer c);
+
+  /**
+   * @brief Enable ascii trace output on each device in the container which is
+   * of the appropriate type.
+   *
+   * @param stream An OutputStreamWrapper representing an existing file to use
+   *               when writing trace data.
+   * @param c ccnxInterfaceContainer of ccnx and interface pairs on which to 
+   *          enable tracing.
+   */
+  void EnableAsciiCcnx (Ptr<OutputStreamWrapper> stream, CcnxFaceContainer c);
+
+  /**
+   * @brief Enable ascii trace output on all ccnx and interface pairs existing
+   * in the nodes provided in the container.
+   *
+   * \param prefix Filename prefix to use for ascii files.
+   * \param n container of nodes.
+   */
+  void EnableAsciiCcnx (std::string prefix, NodeContainer n);
+
+  /**
+   * @brief Enable ascii trace output on all ccnx and interface pairs existing
+   * in the nodes provided in the container.
+   *
+   * @param stream An OutputStreamWrapper representing an existing file to use
+   *               when writing trace data.
+   * \param n container of nodes.
+   */
+  void EnableAsciiCcnx (Ptr<OutputStreamWrapper> stream, NodeContainer n);
+
+  /**
+   * @brief Enable ascii trace output on all Ccnx and interface pairs existing
+   * in the set of all nodes created in the simulation.
+   *
+   * @param prefix Filename prefix to use for ascii files.
+   */
+  void EnableAsciiCcnxAll (std::string prefix);
+
+  /**
+   * @brief Enable ascii trace output on each device (which is of the
+   * appropriate type) in the set of all nodes created in the simulation.
+   *
+   * @param stream An OutputStreamWrapper representing an existing file to use
+   *               when writing trace data.
+   */
+  void EnableAsciiCcnxAll (Ptr<OutputStreamWrapper> stream);
+
+  /**
+   * @brief Enable pcap output on the Ccnx and interface pair specified by a 
+   * global node-id (of a previously created node) and interface.  Since there
+   * can be only one Ccnx aggregated to a node, the node-id unambiguously 
+   * determines the Ccnx.
+   *
+   * @param prefix Filename prefix to use when creating ascii trace files
+   * @param nodeid The node identifier/number of the node on which to enable
+   *               ascii tracing
+   * @param deviceid The device identifier/index of the device on which to enable
+   *                 ascii tracing
+   * @param explicitFilename Treat the prefix as an explicit filename if true
+   */
+  void EnableAsciiCcnx (std::string prefix, uint32_t nodeid, uint32_t deviceid, bool explicitFilename);
+
+  /**
+   * @brief Enable pcap output on the ccnx and interface pair specified by a 
+   * global node-id (of a previously created node) and interface.  Since there
+   * can be only one ccnx aggregated to a node, the node-id unambiguously 
+   * determines the ccnx.
+   *
+   * @param stream An OutputStreamWrapper representing an existing file to use
+   *               when writing trace data.
+   * @param nodeid The node identifier/number of the node on which to enable
+   *               ascii tracing
+   * @param interface The interface on which you want to enable tracing.
+   * @param explicitFilename Treat the prefix as an explicit filename if true
+   */
+  void EnableAsciiCcnx (Ptr<OutputStreamWrapper> stream, uint32_t nodeid, uint32_t interface, bool explicitFilename);
+
+private:
+  /**
+   * @internal Avoid code duplication.
+   */
+  void EnableAsciiCcnxImpl (Ptr<OutputStreamWrapper> stream, 
+                            std::string prefix, 
+                            uint32_t nodeid, 
+                            uint32_t interface,
+                            bool explicitFilename);
+
+  /**
+   * @internal Avoid code duplication.
+   */
+  void EnableAsciiCcnxImpl (Ptr<OutputStreamWrapper> stream, std::string prefix, NodeContainer n);
+
+  /**
+   * @internal Avoid code duplication.
+   */
+  void EnableAsciiCcnxImpl (Ptr<OutputStreamWrapper> stream, std::string prefix, CcnxFaceContainer c);
+
+  /**
+   * @internal Avoid code duplication.
+   */
+  void EnableAsciiCcnxImpl (Ptr<OutputStreamWrapper> stream, 
+                            std::string prefix, 
+                            std::string ccnxName, 
+                            uint32_t interface,
+                            bool explicitFilename);
+
+  /**
+   * @internal Avoid code duplication.
+   */
+  void EnableAsciiCcnxImpl (Ptr<OutputStreamWrapper> stream, 
+                            std::string prefix, 
+                            Ptr<Ccnx> ccnx, 
+                            uint32_t interface,
+                            bool explicitFilename);
+};
+
+} // namespace ns3
+
+#endif /* CCNX_TRACE_HELPER_H */
diff --git a/helper/ndn_stupidinterestgenerator_helper.cc b/helper/ndn_stupidinterestgenerator_helper.cc
index 982f283..1699f40 100644
--- a/helper/ndn_stupidinterestgenerator_helper.cc
+++ b/helper/ndn_stupidinterestgenerator_helper.cc
@@ -1,3 +1,4 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; c-set-offset 'innamespace 0; -*- */
 //
 //  ndn_stupidinterestgenerator_helper.cpp
 //  Abstraction
@@ -15,51 +16,51 @@
 
 namespace ns3 {
     
-    StupidInterestGeneratorHelper::StupidInterestGeneratorHelper (std::string protocol, Address address)
-    {
-        m_factory.SetTypeId ("ns3::StupidInterestGenerator");
-        m_factory.Set ("Protocol", StringValue (protocol));
-        m_factory.Set ("Remote", AddressValue (address));
-    }
+StupidInterestGeneratorHelper::StupidInterestGeneratorHelper (std::string protocol, Address address)
+{
+	m_factory.SetTypeId ("ns3::StupidInterestGenerator");
+	m_factory.Set ("Protocol", StringValue (protocol));
+	m_factory.Set ("Remote", AddressValue (address));
+}
     
-    void 
-    StupidInterestGeneratorHelper::SetAttribute (std::string name, const AttributeValue &value)
-    {
-        m_factory.Set (name, value);
-    }
+void 
+StupidInterestGeneratorHelper::SetAttribute (std::string name, const AttributeValue &value)
+{
+	m_factory.Set (name, value);
+}
     
-    ApplicationContainer
-    StupidInterestGeneratorHelper::Install (Ptr<Node> node) const
-    {
-        return ApplicationContainer (InstallPriv (node));
-    }
+ApplicationContainer
+StupidInterestGeneratorHelper::Install (Ptr<Node> node) const
+{
+	return ApplicationContainer (InstallPriv (node));
+}
     
-    ApplicationContainer
-    StupidInterestGeneratorHelper::Install (std::string nodeName) const
-    {
-        Ptr<Node> node = Names::Find<Node> (nodeName);
-        return ApplicationContainer (InstallPriv (node));
-    }
+ApplicationContainer
+StupidInterestGeneratorHelper::Install (std::string nodeName) const
+{
+	Ptr<Node> node = Names::Find<Node> (nodeName);
+	return ApplicationContainer (InstallPriv (node));
+}
     
-    ApplicationContainer
-    StupidInterestGeneratorHelper::Install (NodeContainer c) const
-    {
-        ApplicationContainer apps;
-        for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
-        {
-            apps.Add (InstallPriv (*i));
-        }
+ApplicationContainer
+StupidInterestGeneratorHelper::Install (NodeContainer c) const
+{
+	ApplicationContainer apps;
+	for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
+	{
+		apps.Add (InstallPriv (*i));
+	}
         
-        return apps;
-    }
+	return apps;
+}
     
-    Ptr<Application>
-    StupidInterestGeneratorHelper::InstallPriv (Ptr<Node> node) const
-    {
-        Ptr<Application> app = m_factory.Create<Application> ();
-        node->AddApplication (app);
+Ptr<Application>
+StupidInterestGeneratorHelper::InstallPriv (Ptr<Node> node) const
+{
+	Ptr<Application> app = m_factory.Create<Application> ();
+	node->AddApplication (app);
         
-        return app;
-    }
+	return app;
+}
     
 } // namespace ns3
diff --git a/helper/ndn_stupidinterestgenerator_helper.h b/helper/ndn_stupidinterestgenerator_helper.h
index 4f9f6bb..b8a39ca 100644
--- a/helper/ndn_stupidinterestgenerator_helper.h
+++ b/helper/ndn_stupidinterestgenerator_helper.h
@@ -1,3 +1,4 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; c-set-offset 'innamespace 0; -*- */
 //
 //  ndn_stupidinterestgenerator_helper.h
 //  Abstraction
diff --git a/helper/ndnabstraction-helper.cc b/helper/ndnabstraction-helper.cc
index e02c5eb..d8d5db3 100644
--- a/helper/ndnabstraction-helper.cc
+++ b/helper/ndnabstraction-helper.cc
@@ -1,3 +1,4 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; c-set-offset 'innamespace 0; -*- */
 /*
  *  ndnabstraction-helper.c
  *  XcodeProject
diff --git a/helper/ndnabstraction-helper.h b/helper/ndnabstraction-helper.h
index 52ec0bf..22e64c7 100644
--- a/helper/ndnabstraction-helper.h
+++ b/helper/ndnabstraction-helper.h
@@ -1,3 +1,4 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
  *  ndnabstraction-helper.h
  *  XcodeProject
@@ -7,3 +8,6 @@
  *
  */
 
+namespace ns3 {
+
+}