examples: Restoring old examples that can be restored and fixing existing ones
diff --git a/examples/ndn-custom-apps/custom-app.cpp b/examples/ndn-custom-apps/custom-app.cpp
new file mode 100644
index 0000000..414efa2
--- /dev/null
+++ b/examples/ndn-custom-apps/custom-app.cpp
@@ -0,0 +1,123 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2011-2015  Regents of the University of California.
+ *
+ * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
+ * contributors.
+ *
+ * ndnSIM is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * ndnSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * ndnSIM, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+// custom-app.cpp
+
+#include "custom-app.hpp"
+
+#include "ns3/ptr.h"
+#include "ns3/log.h"
+#include "ns3/simulator.h"
+#include "ns3/packet.h"
+
+#include "ns3/ndnSIM/helper/ndn-stack-helper.hpp"
+#include "ns3/ndnSIM/helper/ndn-fib-helper.hpp"
+
+#include "ns3/random-variable.h"
+
+NS_LOG_COMPONENT_DEFINE("CustomApp");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED(CustomApp);
+
+// register NS-3 type
+TypeId
+CustomApp::GetTypeId()
+{
+  static TypeId tid = TypeId("CustomApp").SetParent<ndn::App>().AddConstructor<CustomApp>();
+  return tid;
+}
+
+// Processing upon start of the application
+void
+CustomApp::StartApplication()
+{
+  // initialize ndn::App
+  ndn::App::StartApplication();
+
+  // Add entry to FIB for `/prefix/sub`
+  ndn::FibHelper::AddRoute(GetNode(), "/prefix/sub", m_face, 0);
+
+  // Schedule send of first interest
+  Simulator::Schedule(Seconds(1.0), &CustomApp::SendInterest, this);
+}
+
+// Processing when application is stopped
+void
+CustomApp::StopApplication()
+{
+  // cleanup ndn::App
+  ndn::App::StopApplication();
+}
+
+void
+CustomApp::SendInterest()
+{
+  /////////////////////////////////////
+  // Sending one Interest packet out //
+  /////////////////////////////////////
+
+  // Create and configure ndn::Interest
+  auto interest = std::make_shared<ndn::Interest>("/prefix/sub");
+  UniformVariable rand(0, std::numeric_limits<uint32_t>::max());
+  interest->setNonce(rand.GetValue());
+  interest->setInterestLifetime(ndn::time::seconds(1));
+
+  NS_LOG_DEBUG("Sending Interest packet for " << *interest);
+
+  // Call trace (for logging purposes)
+  m_transmittedInterests(interest, this, m_face);
+
+  m_face->onReceiveInterest(*interest);
+}
+
+// Callback that will be called when Interest arrives
+void
+CustomApp::OnInterest(std::shared_ptr<const ndn::Interest> interest)
+{
+  ndn::App::OnInterest(interest);
+
+  NS_LOG_DEBUG("Received Interest packet for " << interest->getName());
+
+  // Note that Interests send out by the app will not be sent back to the app !
+
+  auto data = std::make_shared<ndn::Data>(interest->getName());
+  data->setFreshnessPeriod(ndn::time::milliseconds(1000));
+  data->setContent(std::make_shared<::ndn::Buffer>(1024));
+  ndn::StackHelper::getKeyChain().sign(*data);
+
+  NS_LOG_DEBUG("Sending Data packet for " << data->getName());
+
+  // Call trace (for logging purposes)
+  m_transmittedDatas(data, this, m_face);
+
+  m_face->onReceiveData(*data);
+}
+
+// Callback that will be called when Data arrives
+void
+CustomApp::OnData(std::shared_ptr<const ndn::Data> data)
+{
+  NS_LOG_DEBUG("Receiving Data packet for " << data->getName());
+
+  std::cout << "DATA received for name " << data->getName() << std::endl;
+}
+
+} // namespace ns3
diff --git a/examples/ndn-custom-apps/custom-app.hpp b/examples/ndn-custom-apps/custom-app.hpp
new file mode 100644
index 0000000..7ed6a78
--- /dev/null
+++ b/examples/ndn-custom-apps/custom-app.hpp
@@ -0,0 +1,68 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2011-2015  Regents of the University of California.
+ *
+ * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
+ * contributors.
+ *
+ * ndnSIM is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * ndnSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * ndnSIM, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+// custom-app.hpp
+
+#ifndef CUSTOM_APP_H_
+#define CUSTOM_APP_H_
+
+#include "ns3/ndnSIM/apps/ndn-app.hpp"
+
+namespace ns3 {
+
+/**
+ * @brief A simple custom application
+ *
+ * This applications demonstrates how to send Interests and respond with Datas to incoming interests
+ *
+ * When application starts it "sets interest filter" (install FIB entry) for /prefix/sub, as well as
+ * sends Interest for this prefix
+ *
+ * When an Interest is received, it is replied with a Data with 1024-byte fake payload
+ */
+class CustomApp : public ndn::App {
+public:
+  // register NS-3 type "CustomApp"
+  static TypeId
+  GetTypeId();
+
+  // (overridden from ndn::App) Processing upon start of the application
+  virtual void
+  StartApplication();
+
+  // (overridden from ndn::App) Processing when application is stopped
+  virtual void
+  StopApplication();
+
+  // (overridden from ndn::App) Callback that will be called when Interest arrives
+  virtual void
+  OnInterest(std::shared_ptr<const ndn::Interest> interest);
+
+  // (overridden from ndn::App) Callback that will be called when Data arrives
+  virtual void
+  OnData(std::shared_ptr<const ndn::Data> contentObject);
+
+private:
+  void
+  SendInterest();
+};
+
+} // namespace ns3
+
+#endif // CUSTOM_APP_H_
diff --git a/examples/ndn-custom-apps/hijacker.cpp b/examples/ndn-custom-apps/hijacker.cpp
new file mode 100644
index 0000000..2a13885
--- /dev/null
+++ b/examples/ndn-custom-apps/hijacker.cpp
@@ -0,0 +1,71 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2011-2015  Regents of the University of California.
+ *
+ * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
+ * contributors.
+ *
+ * ndnSIM is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * ndnSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * ndnSIM, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+// hijacker.cpp
+
+#include "hijacker.hpp"
+
+#include "ns3/log.h"
+
+#include "ns3/ndnSIM/helper/ndn-fib-helper.hpp"
+
+NS_LOG_COMPONENT_DEFINE("Hijacker");
+
+namespace ns3 {
+
+// Necessary if you are planning to use ndn::AppHelper
+NS_OBJECT_ENSURE_REGISTERED(Hijacker);
+
+TypeId
+Hijacker::GetTypeId()
+{
+  static TypeId tid = TypeId("Hijacker").SetParent<ndn::App>().AddConstructor<Hijacker>();
+
+  return tid;
+}
+
+Hijacker::Hijacker()
+{
+}
+
+void
+Hijacker::OnInterest(std::shared_ptr<const ndn::Interest> interest)
+{
+  ndn::App::OnInterest(interest); // forward call to perform app-level tracing
+  // do nothing else (hijack interest)
+
+  NS_LOG_DEBUG("Do nothing for incoming interest for" << interest->getName());
+}
+
+void
+Hijacker::StartApplication()
+{
+  App::StartApplication();
+
+  // equivalent to setting interest filter for "/prefix" prefix
+  ndn::FibHelper::AddRoute(GetNode(), "/prefix/sub", m_face, 0);
+}
+
+void
+Hijacker::StopApplication()
+{
+  App::StopApplication();
+}
+
+} // namespace ns3
diff --git a/examples/ndn-custom-apps/hijacker.hpp b/examples/ndn-custom-apps/hijacker.hpp
new file mode 100644
index 0000000..c873f81
--- /dev/null
+++ b/examples/ndn-custom-apps/hijacker.hpp
@@ -0,0 +1,51 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2011-2015  Regents of the University of California.
+ *
+ * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
+ * contributors.
+ *
+ * ndnSIM is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * ndnSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * ndnSIM, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+// hijacker.hpp
+
+#ifndef HIJACKER_H_
+#define HIJACKER_H_
+
+#include "ns3/ndnSIM/apps/ndn-app.hpp"
+
+namespace ns3 {
+
+class Hijacker : public ndn::App {
+public:
+  static TypeId
+  GetTypeId();
+
+  Hijacker();
+
+  // Receive all Interests but do nothing in response
+  void
+  OnInterest(std::shared_ptr<const ndn::Interest> interest);
+
+protected:
+  // inherited from Application base class.
+  virtual void
+  StartApplication();
+
+  virtual void
+  StopApplication();
+};
+
+} // namespace ns3
+
+#endif // HIJACKER_H_