First step of refactoring code (ccnx prefix => ndn prefix)
diff --git a/apps/ndn-consumer.h b/apps/ndn-consumer.h
new file mode 100644
index 0000000..0bc7f70
--- /dev/null
+++ b/apps/ndn-consumer.h
@@ -0,0 +1,190 @@
+/* -*-  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: Ilya Moiseenko <iliamo@cs.ucla.edu>
+ *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDN_CONSUMER_H
+#define NDN_CONSUMER_H
+
+#include "ndn-app.h"
+#include "ns3/random-variable.h"
+#include "ns3/ndn-name-components.h"
+#include "ns3/nstime.h"
+#include "ns3/data-rate.h"
+#include "../../internet/model/rtt-estimator.h"
+//#include "ns3/internet-module.h"
+
+#include <set>
+
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/tag.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <boost/multi_index/member.hpp>
+
+namespace ns3 
+{
+
+/**
+ * @ingroup ndn
+ * \brief Ndn application for sending out Interest packets
+ */
+class NdnConsumer: public NdnApp
+{
+public: 
+  static TypeId GetTypeId ();
+        
+  /**
+   * \brief Default constructor 
+   * Sets up randomizer function and packet sequence number
+   */
+  NdnConsumer ();
+  virtual ~NdnConsumer () {};
+
+  // From NdnApp
+  // virtual void
+  // OnInterest (const Ptr<const NdnInterestHeader> &interest);
+
+  virtual void
+  OnNack (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> packet);
+
+  virtual void
+  OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
+                   Ptr<Packet> payload);
+
+  /**
+   * @brief Timeout event
+   * @param sequenceNumber time outed sequence number
+   */
+  virtual void
+  OnTimeout (uint32_t sequenceNumber);
+
+  /**
+   * @brief Actually send packet
+   */
+  void
+  SendPacket ();
+  
+protected:
+  // from NdnApp
+  virtual void
+  StartApplication ();
+
+  virtual void
+  StopApplication ();
+  
+  /**
+   * \brief Constructs the Interest packet and sends it using a callback to the underlying Ndn protocol
+   */
+  virtual void
+  ScheduleNextPacket () = 0;
+  
+  /**
+   * \brief Checks if the packet need to be retransmitted becuase of retransmission timer expiration
+   */
+  void
+  CheckRetxTimeout ();
+  
+  /**
+   * \brief Modifies the frequency of checking the retransmission timeouts
+   * \param retxTimer Timeout defining how frequent retransmission timeouts should be checked
+   */
+  void
+  SetRetxTimer (Time retxTimer);
+
+  /**
+   * \brief Returns the frequency of checking the retransmission timeouts
+   * \return Timeout defining how frequent retransmission timeouts should be checked
+   */
+  Time
+  GetRetxTimer () const;
+  
+protected:
+  UniformVariable m_rand; ///< @brief nonce generator
+
+  uint32_t        m_seq;  ///< @brief currently requested sequence number
+  uint32_t        m_seqMax;    ///< @brief maximum number of sequence number
+  EventId         m_sendEvent; ///< @brief EventId of pending "send packet" event
+  Time            m_retxTimer; ///< @brief Currently estimated retransmission timer
+  EventId         m_retxEvent; ///< @brief Event to check whether or not retransmission should be performed
+
+  Ptr<RttEstimator> m_rtt; ///< @brief RTT estimator
+  
+  Time               m_offTime;             ///< \brief Time interval between packets
+  NdnNameComponents m_interestName;        ///< \brief NdnName of the Interest (use NdnNameComponents)
+  Time               m_interestLifeTime;    ///< \brief LifeTime for interest packet
+  int32_t            m_minSuffixComponents; ///< \brief MinSuffixComponents. See NdnInterestHeader for more information
+  int32_t            m_maxSuffixComponents; ///< \brief MaxSuffixComponents. See NdnInterestHeader for more information
+  bool               m_childSelector;       ///< \brief ChildSelector. See NdnInterestHeader for more information
+  NdnNameComponents m_exclude;             ///< \brief Exclude. See NdnInterestHeader for more information
+
+/// @cond include_hidden  
+  /**
+   * \struct This struct contains sequence numbers of packets to be retransmitted
+   */
+  struct RetxSeqsContainer :
+    public std::set<uint32_t> { };
+  
+  RetxSeqsContainer m_retxSeqs;             ///< \brief ordered set of sequence numbers to be retransmitted
+
+  /**
+   * \struct This struct contains a pair of packet sequence number and its timeout
+   */ 
+  struct SeqTimeout
+  {
+    SeqTimeout (uint32_t _seq, Time _time) : seq (_seq), time (_time) { }
+    
+    uint32_t seq;
+    Time time;
+  };
+/// @endcond
+  
+/// @cond include_hidden
+  class i_seq { };
+  class i_timestamp { }; 
+/// @endcond
+  
+/// @cond include_hidden
+  /**
+   * \struct This struct contains a multi-index for the set of SeqTimeout structs
+   */
+  struct SeqTimeoutsContainer :
+    public boost::multi_index::multi_index_container<
+    SeqTimeout,
+    boost::multi_index::indexed_by<
+      boost::multi_index::ordered_unique<
+        boost::multi_index::tag<i_seq>,
+        boost::multi_index::member<SeqTimeout, uint32_t, &SeqTimeout::seq>
+        >,
+      boost::multi_index::ordered_non_unique<
+        boost::multi_index::tag<i_timestamp>,
+        boost::multi_index::member<SeqTimeout, Time, &SeqTimeout::time>
+        >
+      >
+    > { } ;
+
+  SeqTimeoutsContainer m_seqTimeouts;       ///< \brief multi-index for the set of SeqTimeout structs
+  SeqTimeoutsContainer m_seqLifetimes;
+  
+  TracedCallback<Ptr<Node>, Ptr<Node>, uint32_t, uint32_t > m_pathWeightsTrace;
+/// @endcond
+};
+
+} // namespace ns3
+
+#endif