Repair bug in ccnb parsing.  First steps in adding correct documentation tags

diff --git a/examples/ccnx-test.cc b/examples/ccnx-test.cc
index 4f4205c..626a2f5 100644
--- a/examples/ccnx-test.cc
+++ b/examples/ccnx-test.cc
@@ -14,6 +14,8 @@
 int 
 main (int argc, char *argv[])
 {
+  LogComponentEnable ("CcnxTest", LOG_ALL);
+  
   Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210));
   Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue ("448kb/s"));
   
@@ -31,24 +33,27 @@
   // Ipv4ListRoutingHelper list;
   // list.Add (staticRouting, 1);
 
+  NS_LOG_INFO ("Create channels.");
+  PointToPointHelper p2p;
+  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
+  p2p.SetChannelAttribute ("Delay", StringValue ("1ms"));
+  NetDeviceContainer nd = p2p.Install (n);
+
+  NS_LOG_INFO ("Installing NDN stack");
   CcnxStackHelper ccnx;
-  ccnx.Install (c);
+
+  // ? set up forwarding
+  
+  //  ccnx.Install (c);
   
   //Add static routing
   // InternetStackHelper internet;
   // internet.SetRoutingHelper (list); // has effect on the next Install ()
   // internet.Install (c);
   
-  // We create the channels first without any IP addressing information
-  // NS_LOG_INFO ("Create channels.");
-  // PointToPointHelper p2p;
-  // p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
-  // p2p.SetChannelAttribute ("Delay", StringValue ("1ms"));
-  // NetDeviceContainer nd = p2p.Install (n);
-  
   // Create the OnOff application to send UDP datagrams of size
   // 210 bytes at a rate of 448 Kb/s from n0 to n4
-  NS_LOG_INFO ("Create Applications.");
+  // NS_LOG_INFO ("Create Applications.");
   
   // std::string sendsizeattr = "SendSize";
   // //flow2 7-->2
@@ -70,5 +75,5 @@
   Simulator::Destroy ();
   NS_LOG_INFO ("Done.");
   
-	return 0;
+  return 0;
 }
diff --git a/helper/ccnx-decoding-helper.cc b/helper/ccnx-decoding-helper.cc
index e853c7d..0dabb66 100644
--- a/helper/ccnx-decoding-helper.cc
+++ b/helper/ccnx-decoding-helper.cc
@@ -115,7 +115,7 @@
   // this is actually the way Read method is implemented in network/src/buffer.cc
   for (uint32_t i = 0; i < length; i++)
     {
-      m_udata.append (reinterpret_cast<const char*>(start.ReadU8 ()));
+      m_udata.push_back (start.ReadU8 ());
     }
 }
 
@@ -125,7 +125,7 @@
   m_tag.reserve (length+2); // extra byte for potential \0 at the end
   for (uint32_t i = 0; i < (length+1); i++)
     {
-      m_tag.append (reinterpret_cast<const char*>(start.ReadU8 ()));
+      m_tag.push_back (start.ReadU8 ());
     }
   
   while (!start.IsEnd () && start.PeekU8 ()!=Ccnx::CCN_CLOSE)
@@ -144,7 +144,7 @@
   m_attr.reserve (length+2); // extra byte for potential \0 at the end
   for (uint32_t i = 0; i < (length+1); i++)
     {
-      m_attr.append (reinterpret_cast<const char*>(start.ReadU8 ()));
+      m_attr.push_back (start.ReadU8 ());
     }
   m_value = DynamicCast<Udata> (Block::ParseBlock (start));
   if (m_value == 0)
diff --git a/helper/ccnx-face-container.cc b/helper/ccnx-face-container.cc
index f25ea5e..956614d 100644
--- a/helper/ccnx-face-container.cc
+++ b/helper/ccnx-face-container.cc
@@ -1,8 +1,29 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
 
 #include "ccnx-face-container.h"
-#include "ns3/node-list.h"
-#include "ns3/names.h"
+// #include "ns3/node-list.h"
+// #include "ns3/names.h"
+#include <algorithm>
+
+#include "ns3/ccnx-face.h"
 
 namespace ns3 {
 
@@ -10,13 +31,26 @@
 {
 }
 
-void
-CcnxFaceContainer::Add (CcnxFaceContainer other)
+CcnxFaceContainer::CcnxFaceContainer (const CcnxFaceContainer &other)
 {
-  for (FaceVector::const_iterator i = other.m_faces.begin (); i != other.m_faces.end (); i++)
-    {
-      m_faces.push_back (*i);
-    }
+  AddAll (other);
+}
+
+CcnxFaceContainer&
+CcnxFaceContainer::operator= (const CcnxFaceContainer &other)
+{
+  m_faces.clear ();
+  AddAll (other);
+
+  return *this;
+}
+
+  
+void
+CcnxFaceContainer::AddAll (const CcnxFaceContainer &other)
+{
+  m_faces.insert (m_faces.end (),
+                  other.m_faces.begin (), other.m_faces.end ());
 }
 
 CcnxFaceContainer::Iterator
@@ -37,44 +71,27 @@
   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)
+CcnxFaceContainer::SetMetricToAll (uint16_t metric)
 {
-  Ptr<Ccnx> ccnx = m_faces[i].first;
-  uint32_t face = m_faces[i].second;
-  ccnx->SetMetric (face, metric);
+  for (FaceContainer::iterator it=m_faces.begin ();
+       it != m_faces.end ();
+       it++)
+    {
+      (*it)->SetMetric (metric);
+    }
 }
 
 void 
-CcnxFaceContainer::Add (Ptr<Ccnx> ccnx, uint32_t face)
+CcnxFaceContainer::Add (const Ptr<CcnxFace> &face)
 {
-  m_faces.push_back (std::make_pair (ccnx, face));
+  m_faces.push_back (face);
 }
 
-void CcnxFaceContainer::Add (std::pair<Ptr<Ccnx>, uint32_t> a)
+Ptr<CcnxFace>
+CcnxFaceContainer::Get (CcnxFaceContainer::Iterator i) const
 {
-  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];
+  return *i;
 }
 
 
diff --git a/helper/ccnx-face-container.h b/helper/ccnx-face-container.h
index 8bbbbc3..4426449 100644
--- a/helper/ccnx-face-container.h
+++ b/helper/ccnx-face-container.h
@@ -1,4 +1,22 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
 
 #ifndef CCNX_FACE_CONTAINER_H
 #define CCNX_FACE_CONTAINER_H
@@ -10,170 +28,101 @@
 namespace ns3 {
 
 /**
- * \brief holds a vector of std::pair of Ptr<Ccnx> and face index.
+ * \ingroup ccnx
+ * \brief A pool for CCNx faces
+ * 
+ * Provides tools to perform basic manipulation on faces, such as
+ * setting metrics and states on faces
  *
- * 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
+ * \see Ccnx
  */
 class CcnxFaceContainer
 {
+private:
+  typedef std::vector<Ptr<CcnxFace> > FaceContainer;
 public:
-  typedef std::vector<std::pair<Ptr<Ccnx>, uint32_t> >::const_iterator Iterator;
+  typedef FaceContainer::const_iterator Iterator; ///< \brief Iterator over CcnxFaceContainer
 
   /**
-   * Create an empty CcnxFaceContainer.
+   * \brief Create an empty CcnxFaceContainer.
    */
   CcnxFaceContainer ();
 
   /**
-   * Concatenate the entries in the other container with ours.
-   * \param other container
+   * \brief Copy constructor for CcnxFaceContainer. Calls AddAll method
+   *
+   * \see CcnxFaceContainer::AddAll
    */
-  void Add (CcnxFaceContainer other);
+  CcnxFaceContainer (const CcnxFaceContainer &other);
 
   /**
-   * \brief Get an iterator which refers to the first pair in the 
+   * \brief Copy operator for CcnxFaceContainer. Empties vector and calls AddAll method
+   *
+   * All previously obtained iterators (Begin() and End()) will be invalidated
+   *
+   * \see CcnxFaceContainer::AddAll
+   */
+  CcnxFaceContainer& operator= (const CcnxFaceContainer &other);
+  
+  /**
+   * \brief Add all entries from other container
+   *
+   * \param other container
+   */
+  void AddAll (const 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;
+  Iterator Begin () 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;
+  Iterator End () const;
 
   /**
-   * \returns the number of Ptr<Ccnx> and face pairs stored in this 
-   * ccnxFaceContainer.
+   * \brief Get the number of faces stored in this 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 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.
+   * \returns the number of faces stored in this container
    */
-  uint32_t GetN (void) const;
+  uint32_t GetN () 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.
+   * \brief Set a metric for all faces in the container
+   *
+   * \param metric value of metric to assign to all faces in the container
    */
-  // ccnxAddress GetAddress (uint32_t i, uint32_t j = 0) const;
-
-  void SetMetric (uint32_t i, uint16_t metric);
+  void SetMetricToAll (uint16_t metric);
 
   /**
-   * Manually add an entry to the container consisting of the individual parts
-   * of an entry std::pair.
+   * Add an entry to the container
    *
-   * \param ccnx pointer to ccnx object
-   * \param face face index of the ccnxface to add to the container
+   * \param face a smart pointer to a CcnxFace-derived object
    *
-   * @see ccnxfaceContainer
+   * @see CcnxFace
    */
-  void Add (Ptr<Ccnx> ccnx, uint32_t face);
+  void Add (const Ptr<CcnxFace> &face);
 
   /**
-   * Manually add an entry to the container consisting of a previously composed 
-   * entry std::pair.
+   * Get a smart pointer to CcnxFace-derived object stored in the container
    *
-   * \param ipfacePair the pair of a pointer to ccnx object and face index of the ccnxface to add to the container
+   * \param i the iterator corresponding to the requested object
    *
-   * @see ccnxfaceContainer
+   * This method is redundant and simple dereferencing of the iterator should be used instead
+   *
+   * @see CcnxFace
    */
-  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;
+  Ptr<CcnxFace> Get (Iterator i) const;
 
 private:
-
-  typedef std::vector<std::pair<Ptr<Ccnx>,uint32_t> > FaceVector;
-  FaceVector m_faces;
+  FaceContainer m_faces;
 };
 
 } // namespace ns3
diff --git a/model/ccn/README b/in-progress/ccn/README
similarity index 100%
rename from model/ccn/README
rename to in-progress/ccn/README
diff --git a/model/ccn/ccn.h b/in-progress/ccn/ccn.h
similarity index 100%
rename from model/ccn/ccn.h
rename to in-progress/ccn/ccn.h
diff --git a/model/ccn/ccn_buf_decoder.cc b/in-progress/ccn/ccn_buf_decoder.cc
similarity index 100%
rename from model/ccn/ccn_buf_decoder.cc
rename to in-progress/ccn/ccn_buf_decoder.cc
diff --git a/model/ccn/ccn_buf_encoder.cc b/in-progress/ccn/ccn_buf_encoder.cc
similarity index 100%
rename from model/ccn/ccn_buf_encoder.cc
rename to in-progress/ccn/ccn_buf_encoder.cc
diff --git a/model/ccn/ccn_charbuf.cc b/in-progress/ccn/ccn_charbuf.cc
similarity index 100%
rename from model/ccn/ccn_charbuf.cc
rename to in-progress/ccn/ccn_charbuf.cc
diff --git a/model/ccn/ccn_charbuf.h b/in-progress/ccn/ccn_charbuf.h
similarity index 100%
rename from model/ccn/ccn_charbuf.h
rename to in-progress/ccn/ccn_charbuf.h
diff --git a/model/ccn/ccn_indexbuf.cc b/in-progress/ccn/ccn_indexbuf.cc
similarity index 100%
rename from model/ccn/ccn_indexbuf.cc
rename to in-progress/ccn/ccn_indexbuf.cc
diff --git a/model/ccn/ccn_indexbuf.h b/in-progress/ccn/ccn_indexbuf.h
similarity index 100%
rename from model/ccn/ccn_indexbuf.h
rename to in-progress/ccn/ccn_indexbuf.h
diff --git a/model/ccn/ccn_name_util.cc b/in-progress/ccn/ccn_name_util.cc
similarity index 100%
rename from model/ccn/ccn_name_util.cc
rename to in-progress/ccn/ccn_name_util.cc
diff --git a/model/ccn/ccn_name_util.h b/in-progress/ccn/ccn_name_util.h
similarity index 100%
rename from model/ccn/ccn_name_util.h
rename to in-progress/ccn/ccn_name_util.h
diff --git a/model/ccn/ccn_random.cc b/in-progress/ccn/ccn_random.cc
similarity index 100%
rename from model/ccn/ccn_random.cc
rename to in-progress/ccn/ccn_random.cc
diff --git a/model/ccn/ccn_random.h b/in-progress/ccn/ccn_random.h
similarity index 100%
rename from model/ccn/ccn_random.h
rename to in-progress/ccn/ccn_random.h
diff --git a/model/ccnx-face.cc b/model/ccnx-face.cc
index 15ddb84..6ce6b92 100644
--- a/model/ccnx-face.cc
+++ b/model/ccnx-face.cc
@@ -151,7 +151,7 @@
     }
 
   m_device->Send (packet, m_device->GetBroadcast (), 
-                  CcnxL3Protocol::PROT_NUMBER);
+                  CcnxL3Protocol::ETHERNET_FRAME_TYPE);
 }
 
 std::ostream& operator<< (std::ostream& os, CcnxFace const& face)
diff --git a/model/ccnx-l3-protocol.cc b/model/ccnx-l3-protocol.cc
index 2ea1414..2a13f4c 100644
--- a/model/ccnx-l3-protocol.cc
+++ b/model/ccnx-l3-protocol.cc
@@ -43,7 +43,7 @@
 
 namespace ns3 {
 
-const uint16_t CcnxL3Protocol::PROT_NUMBER = 0x7777;
+const uint16_t CcnxL3Protocol::ETHERNET_FRAME_TYPE = 0x7777;
 
 NS_OBJECT_ENSURE_REGISTERED (CcnxL3Protocol);
 
@@ -53,19 +53,19 @@
   static TypeId tid = TypeId ("ns3::CcnxL3Protocol")
     .SetParent<Ccnx> ()
     .AddConstructor<CcnxL3Protocol> ()
-    .AddTraceSource ("Tx", "Send ccnx packet to outgoing interface.",
-                     MakeTraceSourceAccessor (&CcnxL3Protocol::m_txTrace))
-    .AddTraceSource ("Rx", "Receive ccnx packet from incoming interface.",
-                     MakeTraceSourceAccessor (&CcnxL3Protocol::m_rxTrace))
-    .AddTraceSource ("Drop", "Drop ccnx packet",
-                     MakeTraceSourceAccessor (&CcnxL3Protocol::m_dropTrace))
+    // .AddTraceSource ("Tx", "Send ccnx packet to outgoing interface.",
+    //                  MakeTraceSourceAccessor (&CcnxL3Protocol::m_txTrace))
+    // .AddTraceSource ("Rx", "Receive ccnx packet from incoming interface.",
+    //                  MakeTraceSourceAccessor (&CcnxL3Protocol::m_rxTrace))
+    // .AddTraceSource ("Drop", "Drop ccnx packet",
+    //                  MakeTraceSourceAccessor (&CcnxL3Protocol::m_dropTrace))
     .AddAttribute ("InterfaceList", "The set of Ccnx interfaces associated to this Ccnx stack.",
                    ObjectVectorValue (),
                    MakeObjectVectorAccessor (&CcnxL3Protocol::m_faces),
                    MakeObjectVectorChecker<CcnxFace> ())
 
-    .AddTraceSource ("SendOutgoing", "A newly-generated packet by this node is about to be queued for transmission",
-                     MakeTraceSourceAccessor (&CcnxL3Protocol::m_sendOutgoingTrace))
+    // .AddTraceSource ("SendOutgoing", "A newly-generated packet by this node is about to be queued for transmission",
+    //                  MakeTraceSourceAccessor (&CcnxL3Protocol::m_sendOutgoingTrace))
 
   ;
   return tid;
@@ -137,7 +137,7 @@
 }
 
 uint32_t 
-CcnxL3Protocol::AddFace (Ptr<CcnxFace> face)
+CcnxL3Protocol::AddFace (const Ptr<CcnxFace> &face)
 {
   NS_LOG_FUNCTION (this << *face);
 
@@ -147,7 +147,7 @@
   if (face->GetDevice() != 0)
     {
       m_node->RegisterProtocolHandler (MakeCallback (&CcnxL3Protocol::ReceiveFromLower, this), 
-                                       CcnxL3Protocol::PROT_NUMBER, face->GetDevice(), true/*promiscuous mode*/);
+                                       CcnxL3Protocol::ETHERNET_FRAME_TYPE, face->GetDevice(), true/*promiscuous mode*/);
     }
 
   uint32_t index = m_faces.size ();
@@ -218,7 +218,7 @@
   if (incomingFace->IsUp ())
     {
       NS_LOG_LOGIC ("Dropping received packet -- interface is down");
-      m_dropTrace (packet, DROP_INTERFACE_DOWN, m_node->GetObject<Ccnx> (), incomingFace);
+      // m_dropTrace (packet, DROP_INTERFACE_DOWN, m_node->GetObject<Ccnx> (), incomingFace);
       return;
     }
 
@@ -242,7 +242,7 @@
   if (incomingFace->IsUp ())
     {
       NS_LOG_LOGIC ("Dropping received packet -- interface is down");
-      m_dropTrace (packet, DROP_INTERFACE_DOWN, m_node->GetObject<Ccnx> (), incomingFace);
+      // m_dropTrace (packet, DROP_INTERFACE_DOWN, m_node->GetObject<Ccnx> (), incomingFace);
       return;
     }
 
@@ -258,29 +258,29 @@
 
 
 void
-CcnxL3Protocol::Send (Ptr<Packet> packet, Ptr<CcnxRoute> route)
+CcnxL3Protocol::Send (Ptr<Packet> packet, const Ptr<CcnxFace> &face)
 {
-  NS_LOG_FUNCTION (this << "packet: " << packet << ", route: "<< route);
+  // NS_LOG_FUNCTION (this << "packet: " << packet << ", route: "<< route);
   
-  if (route == 0)
-    {
-      NS_LOG_WARN ("No route to host.  Drop.");
-      m_dropTrace (packet, DROP_NO_ROUTE, m_node->GetObject<Ccnx> (), 0);
-      return;
-    }
-  Ptr<CcnxFace> outFace = route->GetOutputFace ();
+  // if (route == 0)
+  //   {
+  //     NS_LOG_WARN ("No route to host.  Drop.");
+  //     // m_dropTrace (packet, DROP_NO_ROUTE, m_node->GetObject<Ccnx> (), 0);
+  //     return;
+  //   }
+  // Ptr<CcnxFace> outFace = route->GetOutputFace ();
 
-  if (outFace->IsUp ())
-    {
-      NS_LOG_LOGIC ("Sending via face " << *outFace);
-      m_txTrace (packet, m_node->GetObject<Ccnx> (), outFace);
-      outFace->Send (packet);
-    }
-  else
-    {
-      NS_LOG_LOGIC ("Dropping -- outgoing interface is down: " << *outFace);
-      m_dropTrace (packet, DROP_INTERFACE_DOWN, m_node->GetObject<Ccnx> (), outFace);
-    }
+  // if (outFace->IsUp ())
+  //   {
+  //     NS_LOG_LOGIC ("Sending via face " << *outFace);
+  //     // m_txTrace (packet, m_node->GetObject<Ccnx> (), outFace);
+  //     outFace->Send (packet);
+  //   }
+  // else
+  //   {
+  //     NS_LOG_LOGIC ("Dropping -- outgoing interface is down: " << *outFace);
+  //     // m_dropTrace (packet, DROP_INTERFACE_DOWN, m_node->GetObject<Ccnx> (), outFace);
+  //   }
 }
 
 
@@ -339,12 +339,4 @@
     }
 }
 
-void
-CcnxL3Protocol::RouteInputError (Ptr<Packet> p)//, Socket::SocketErrno sockErrno)
-{
-  // NS_LOG_FUNCTION (this << p << ipHeader << sockErrno);
-  // NS_LOG_LOGIC ("Route input failure-- dropping packet to " << ipHeader << " with errno " << sockErrno); 
-  m_dropTrace (p, DROP_ROUTE_ERROR, m_node->GetObject<Ccnx> (), 0);
-}
-
 } //namespace ns3
diff --git a/model/ccnx-l3-protocol.h b/model/ccnx-l3-protocol.h
index 32425c4..e8a0d22 100644
--- a/model/ccnx-l3-protocol.h
+++ b/model/ccnx-l3-protocol.h
@@ -1,22 +1,22 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-//
-// Copyright (c) 2006 Georgia Tech Research Corporation
-//
-// 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: 
-//
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
 
 #ifndef CCNX_L3_PROTOCOL_H
 #define CCNX_L3_PROTOCOL_H
@@ -43,10 +43,10 @@
 class CcnxContentObjectHeader;
   
 /**
- * \brief Implement the Ccnx layer.
+ * \ingroup ccnx
+ * \brief Actual implementation of the Ccnx network layer
  * 
- * This is the actual implementation of IP.  It contains APIs to send and
- * receive packets at the IP layer, as well as APIs for IP routing.
+ * \todo This description is incorrect. Should be changed accordingly
  *
  * This class contains two distinct groups of trace sources.  The
  * trace sources 'Rx' and 'Tx' are called, respectively, immediately
@@ -61,9 +61,20 @@
 class CcnxL3Protocol : public Ccnx
 {
 public:
+  /**
+   * \brief Interface ID
+   *
+   * \return interface ID
+   */
   static TypeId GetTypeId (void);
-  static const uint16_t PROT_NUMBER;
 
+  static const uint16_t ETHERNET_FRAME_TYPE; ///< \brief Ethernet Frame Type of CCNx
+  static const uint16_t IP_PROTOCOL_TYPE;    ///< \brief IP protocol type of CCNx
+  static const uint16_t UDP_PORT;            ///< \brief UDP port of CCNx
+
+  /**
+   * \brief Default constructor. Creates an empty stack without forwarding strategy set
+   */
   CcnxL3Protocol();
   virtual ~CcnxL3Protocol ();
 
@@ -78,16 +89,35 @@
     DROP_CONGESTION, /**< Congestion detected */
     DROP_NO_ROUTE,   /**< No route to host */
     DROP_INTERFACE_DOWN,   /**< Interface is down so can not send packet */
-    DROP_ROUTE_ERROR,   /**< Route error */
   };
 
+  /**
+   * \brief Assigns node to the CCNx stack
+   *
+   * \param node Simulation node
+   */
   void SetNode (Ptr<Node> node);
 
+  ////////////////////////////////////////////////////////////////////
   // functions defined in base class Ccnx
   
   void SetForwardingStrategy (Ptr<CcnxForwardingStrategy> forwardingStrategy);
   Ptr<CcnxForwardingStrategy> GetForwardingStrategy (void) const;
 
+  virtual void Send (Ptr<Packet> packet, const Ptr<CcnxFace> &face);
+
+  virtual uint32_t AddFace (const Ptr<CcnxFace> &face);
+  virtual uint32_t GetNFaces (void) const;
+  virtual Ptr<CcnxFace> GetFace (uint32_t face) const;
+
+  virtual void SetMetric (uint32_t i, uint16_t metric);
+  virtual uint16_t GetMetric (uint32_t i) const;
+  virtual uint16_t GetMtu (uint32_t i) const;
+  virtual bool IsUp (uint32_t i) const;
+  virtual void SetUp (uint32_t i);
+  virtual void SetDown (uint32_t i);
+
+protected:
   /**
    * Lower layer calls this method after calling L3Demux::Lookup
    *
@@ -119,29 +149,10 @@
    */
   virtual void
   ReceiveAndProcess (Ptr<CcnxFace> face, Ptr<CcnxContentObjectHeader> header, Ptr<Packet> p);
-  
-  /**
-   * \param packet packet to send
-   * \param route route entry
-   *
-   * Higher-level layers call this method to send a packet
-   * down the stack to the MAC and PHY layers.
-   */
-  virtual void Send (Ptr<Packet> packet, Ptr<CcnxRoute> route);
-
-  virtual uint32_t AddFace (Ptr<CcnxFace> face);
-  virtual uint32_t GetNFaces (void) const;
-  virtual Ptr<CcnxFace> GetFace (uint32_t face) const;
-
-  virtual void SetMetric (uint32_t i, uint16_t metric);
-  virtual uint16_t GetMetric (uint32_t i) const;
-  virtual uint16_t GetMtu (uint32_t i) const;
-  virtual bool IsUp (uint32_t i) const;
-  virtual void SetUp (uint32_t i);
-  virtual void SetDown (uint32_t i);
 
 protected:
   virtual void DoDispose (void);
+
   /**
    * This function will notify other components connected to the node that a new stack member is now connected
    * This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
@@ -149,20 +160,16 @@
   virtual void NotifyNewAggregate ();
 
 private:
-  // friend class CcnxL3ProtocolTestCase;
-  CcnxL3Protocol(const CcnxL3Protocol &);
-  CcnxL3Protocol &operator = (const CcnxL3Protocol &);
+  CcnxL3Protocol(const CcnxL3Protocol &); ///< copy constructor is disabled
+  CcnxL3Protocol &operator = (const CcnxL3Protocol &); ///< copy operator is disabled
 
   /**
    * Helper function to get CcnxFace from NetDevice
    */
   Ptr<CcnxFace> GetFaceForDevice (Ptr<const NetDevice> device) const;
-  
-  void RouteInputError (Ptr<Packet> p);
-                        //, Socket::SocketErrno sockErrno);
 
   /**
-   * false function. should never be called. Just to trick C++ to compile
+   * \brief Fake function. should never be called. Just to trick C++ to compile
    */
   virtual void
   ReceiveAndProcess (Ptr<CcnxFace> face, Ptr<Header> header, Ptr<Packet> p);
@@ -174,15 +181,15 @@
   Ptr<Node> m_node;
   Ptr<CcnxForwardingStrategy> m_forwardingStrategy;
 
-  TracedCallback<Ptr<const Packet>, Ptr<const CcnxFace> > m_sendOutgoingTrace;
-  TracedCallback<Ptr<const Packet>, Ptr<const CcnxFace> > m_unicastForwardTrace;
-  TracedCallback<Ptr<const Packet>, Ptr<const CcnxFace> > m_localDeliverTrace;
+  // TracedCallback<Ptr<const Packet>, Ptr<const CcnxFace> > m_sendOutgoingTrace;
+  // TracedCallback<Ptr<const Packet>, Ptr<const CcnxFace> > m_unicastForwardTrace;
+  // TracedCallback<Ptr<const Packet>, Ptr<const CcnxFace> > m_localDeliverTrace;
 
-  // The following two traces pass a packet with an IP header
-  TracedCallback<Ptr<const Packet>, Ptr<Ccnx>, Ptr<const CcnxFace> > m_txTrace;
-  TracedCallback<Ptr<const Packet>, Ptr<Ccnx>, Ptr<const CcnxFace> > m_rxTrace;
-  // <ip-header, payload, reason, ifindex> (ifindex not valid if reason is DROP_NO_ROUTE)
-  TracedCallback<Ptr<const Packet>, DropReason, Ptr<const Ccnx>, Ptr<const CcnxFace> > m_dropTrace;
+  // // The following two traces pass a packet with an IP header
+  // TracedCallback<Ptr<const Packet>, Ptr<Ccnx>, Ptr<const CcnxFace> > m_txTrace;
+  // TracedCallback<Ptr<const Packet>, Ptr<Ccnx>, Ptr<const CcnxFace> > m_rxTrace;
+  // // <ip-header, payload, reason, ifindex> (ifindex not valid if reason is DROP_NO_ROUTE)
+  // TracedCallback<Ptr<const Packet>, DropReason, Ptr<const Ccnx>, Ptr<const CcnxFace> > m_dropTrace;
 };
   
 } // Namespace ns3
diff --git a/model/ccnx.cc b/model/ccnx.cc
index 7716366..a940c36 100644
--- a/model/ccnx.cc
+++ b/model/ccnx.cc
@@ -37,12 +37,4 @@
   return tid;
 }
 
-Ccnx::Ccnx ()
-{
-}
-
-Ccnx::~Ccnx ()
-{
-}
-
 } // namespace ns3
diff --git a/model/ccnx.h b/model/ccnx.h
index 1e1aa0b..c7627ab 100644
--- a/model/ccnx.h
+++ b/model/ccnx.h
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2007 INRIA
+ * 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
@@ -15,17 +15,17 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Author: 
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
  */
-#ifndef CCNX_H
-#define CCNX_H
 
-#include <stdint.h>
+#ifndef _CCNX_H_
+#define _CCNX_H_
+
 #include "ns3/object.h"
 #include "ns3/socket.h"
 #include "ns3/callback.h"
 
-#include "ccnx-route.h"
+#include "ccnx-face.h"
 
 namespace ns3 {
 
@@ -35,76 +35,87 @@
 class CcnxForwardingStrategy;
 
 /**
- * \ingroup internet
- * \defgroup ccnx Ccnx
+ * \defgroup ccnx NDN abstraction
+ *
+ * This is an abstract implementation of NDN protocol
  */
 /**
  * \ingroup ccnx
- * \brief Access to the Ccnx forwarding table, interfaces, and configuration
+ * \brief Interface to manage Ccnx stack
  *
  * This class defines the API to manipulate the following aspects of
- * the Ccnx implementation:
- * -# register a NetDevice for use by the Ccnx layer (basically, to
- * create Ccnx-related state such as addressing and neighbor cache that 
- * is associated with a NetDevice)
- * -# manipulate the status of the NetDevice from the Ccnx perspective, 
- * such as marking it as Up or Down, 
- // * -# adding, deleting, and getting addresses associated to the Ccnx 
- // * interfaces.
- * -# exporting Ccnx configuration attributes
+ * the Ccnx stack implementation:
+ * -# register a face (CcnxFace-derived object) for use by the Ccnx
+ *    layer
+ * -# register forwarding strategy (CcnxForwardingStrategy-derived
+ *    object) to use by Ccnx stack
+ * -# export Ccnx configuration attributes
  * 
- * Each NetDevice has conceptually a single Ccnx interface associated
- * with it.
+ * Each CcnxFace-derived object has conceptually a single Ccnx
+ * interface associated with it.
+ *
+ * In addition, this class defines CCNx packet coding constants
+ *
+ * \see CcnxFace, CcnxForwardingStrategy
  */
 class Ccnx : public Object
 {
 public:
-  static TypeId GetTypeId (void);
-  Ccnx ();
-  virtual ~Ccnx ();
+  /**
+   * \brief Interface ID
+   *
+   * \return interface ID
+   */
+  static TypeId GetTypeId ();
 
   /**
-   * \brief Register a new forwarding protocol to be used by this Ccnx stack
+   * \brief Register a new forwarding strategy to be used by this Ccnx
+   * stack
    *
-   * This call will replace any forwarding protocol that has been previously 
-   * registered.  If you want to add multiple forwarding protocols, you must
-   * add them to a CcnxListForwardingStrategy directly.
+   * This call will replace any forwarding strategy that has been
+   * previously registered.
    * 
-   * \param forwardingStrategy smart pointer to CcnxForwardingStrategy object
+   * \param forwardingStrategy smart pointer to CcnxForwardingStrategy
+   * object
    */
   virtual void SetForwardingStrategy (Ptr<CcnxForwardingStrategy> forwardingStrategy) = 0;
 
   /**
-   * \brief Get the forwarding protocol to be used by this Ccnx stack
+   * \brief Get the forwarding strategy being used by this Ccnx stack
    * 
-   * \returns smart pointer to CcnxForwardingStrategy object, or null pointer if none
+   * \returns smart pointer to CcnxForwardingStrategy object, or null
+   * pointer if none
    */
   virtual Ptr<CcnxForwardingStrategy> GetForwardingStrategy (void) const = 0;
 
   /**
-   * \param device device to add to the list of Ccnx interfaces
-   *        which can be used as output interfaces during packet forwarding.
-   * \returns the index of the Ccnx interface added.
+   * \brief Add face to CCNx stack
    *
-   * Once a device has been added, it can never be removed: if you want
-   * to disable it, you can invoke Ccnx::SetDown which will
-   * make sure that it is never used during packet forwarding.
+   * \param face smart pointer to CcnxFace-derived object
+   * (CcnxLocalFace, CcnxNetDeviceFace, CcnxUdpFace) \returns the
+   * index of the Ccnx interface added.
+   * 
+   * \see CcnxLocalFace, CcnxNetDeviceFace, CcnxUdpFace
    */
-  virtual uint32_t AddFace (Ptr<CcnxFace> face) = 0;
+  virtual uint32_t AddFace (const Ptr<CcnxFace> &face) = 0;
 
   /**
-   * \returns the number of interfaces added by the user.
+   * \brief Get current number of faces added to CCNx stack
+   *
+   * \returns the number of faces
    */
   virtual uint32_t GetNFaces (void) const = 0;
 
   /**
-   * \param packet packet to send
-   * \param route route entry
+   * \brief Send a packet to a specified face
    *
-   * Higher-level layers call this method to send a packet
-   * down the stack to the MAC and PHY layers.
+   * \param packet fully prepared CCNx packet to send
+   * \param face face where to send this packet
+   *
+   * Higher-level layers (forwarding strategy in particular) call this
+   * method to send a packet down the stack to the MAC and PHY layers.
    */
-  // virtual void Send (Ptr<Packet> packet, Ptr<CcnxRoute> route) = 0;
+  virtual void Send (Ptr<Packet> packet, const Ptr<CcnxFace> &face) = 0;
 
   /**
    * \param face The face number of an Ccnx interface.
@@ -112,59 +123,9 @@
    */
   virtual Ptr<CcnxFace> GetFace (uint32_t face) const = 0;
 
-  // /**
-  //  * \param face CcnxFace object pointer 
-  //  * \returns The interface number of an Ccnx face or -1 if not found.
-  //  */
-  // virtual int32_t GetFaceForDevice (Ptr<const CcnxFace> face) const = 0;
-
-  /**
-   * \param face The face number of an Ccnx face
-   * \param metric forwarding metric (cost) associated to the underlying 
-   *          Ccnx interface
-   */
-  virtual void SetMetric (uint32_t face, uint16_t metric) = 0;
-
-  /**
-   * \param face The interface number of an Ccnx interface
-   * \returns forwarding metric (cost) associated to the underlying 
-   *          Ccnx interface
-   */
-  virtual uint16_t GetMetric (uint32_t face) const = 0;
-
-  /**
-   * \param face Interface number of Ccnx interface
-   * \returns the Maximum Transmission Unit (in bytes) associated
-   *          to the underlying Ccnx interface
-   */
-  virtual uint16_t GetMtu (uint32_t face) const = 0;
-
-  /**
-   * \param face Interface number of Ccnx interface
-   * \returns true if the underlying interface is in the "up" state,
-   *          false otherwise.
-   */
-  virtual bool IsUp (uint32_t face) const = 0;
-
-  /**
-   * \param face Interface number of Ccnx interface
-   * 
-   * Set the interface into the "up" state. In this state, it is
-   * considered valid during Ccnx forwarding.
-   */
-  virtual void SetUp (uint32_t face) = 0;
-
-  /**
-   * \param face Interface number of Ccnx interface
-   *
-   * Set the interface into the "down" state. In this state, it is
-   * ignored during Ccnx forwarding.
-   */
-  virtual void SetDown (uint32_t face) = 0;
-
 public:
-    /**
-   * Type tag for a ccnb start marker.
+   /**
+   * \brief Type tag for a ccnb start marker.
    *
    * \see http://www.ccnx.org/releases/latest/doc/technical/DTAG.html
    */
@@ -179,16 +140,11 @@
     CCN_NO_TOKEN    /**< should not occur in encoding */
   };
 
-  /** CCN_CLOSE terminates composites */
+  /** \brief CCN_CLOSE terminates composites */
   enum {CCN_CLOSE = 0};
 
-  // enum ccn_ext_subtype {
-  //   /* skip smallest values for now */
-  //   CCN_PROCESSING_INSTRUCTIONS = 16 /* <?name:U value:U?> */
-  // };
-
   /**
-   * DTAG identifies ccnb-encoded elements.
+   * \brief DTAG identifies ccnb-encoded elements.
    *
    * \see http://www.ccnx.org/releases/latest/doc/technical/DTAG.html
    */
@@ -288,30 +244,8 @@
     CCN_DTAG_SequenceNumber = 256,
     CCN_DTAG_CCNProtocolDataUnit = 17702112
   };
-
-  /**
-   * The decoder state is one of these, possibly with some
-   * additional bits set for internal use.  A complete parse
-   * ends up in state 0 or an error state.  Not all possible
-   * error states are listed here.
-   */
-  enum ccn_decoder_state {
-    CCN_DSTATE_INITIAL = 0,
-    CCN_DSTATE_NEWTOKEN,
-    CCN_DSTATE_NUMVAL,
-    CCN_DSTATE_UDATA,
-    CCN_DSTATE_TAGNAME,
-    CCN_DSTATE_ATTRNAME,
-    CCN_DSTATE_BLOB,
-    /* All error states are negative */
-    CCN_DSTATE_ERR_OVERFLOW = -1,
-    CCN_DSTATE_ERR_ATTR     = -2,       
-    CCN_DSTATE_ERR_CODING   = -3,
-    CCN_DSTATE_ERR_NEST     = -4, 
-    CCN_DSTATE_ERR_BUG      = -5
-  };
 };
 
 } // namespace ns3 
 
-#endif /* CCNX_H */
+#endif /* _CCNX_H_ */