hijacker application added
diff --git a/apps/ccnx-hijacker.cc b/apps/ccnx-hijacker.cc
new file mode 100644
index 0000000..c0d74d7
--- /dev/null
+++ b/apps/ccnx-hijacker.cc
@@ -0,0 +1,117 @@
+/* -*-  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>
+ */
+
+#include "ccnx-hijacker.h"
+#include "ns3/log.h"
+#include "ns3/ccnx-interest-header.h"
+#include "ns3/ccnx-content-object-header.h"
+#include "ns3/string.h"
+#include "ns3/uinteger.h"
+#include "ns3/packet.h"
+
+#include "../model/ccnx-local-face.h"
+#include "ns3/ccnx-fib.h"
+
+#include <boost/ref.hpp>
+
+NS_LOG_COMPONENT_DEFINE ("CcnxHijacker");
+
+namespace ns3
+{    
+
+NS_OBJECT_ENSURE_REGISTERED (CcnxHijacker);
+    
+TypeId
+CcnxHijacker::GetTypeId (void)
+{
+  static TypeId tid = TypeId ("ns3::CcnxHijacker")
+    .SetParent<CcnxApp> ()
+    .AddConstructor<CcnxHijacker> ()
+    .AddAttribute ("Prefix","Prefix, which hijacker wants to attack",
+                   StringValue ("/"),
+                   MakeCcnxNameComponentsAccessor (&CcnxHijacker::m_prefix),
+                   MakeCcnxNameComponentsChecker ())
+    .AddAttribute ("PayloadSize", "Virtual payload size for Content packets",
+                   UintegerValue (1024),
+                   MakeUintegerAccessor(&CcnxHijacker::m_virtualPayloadSize),
+                   MakeUintegerChecker<uint32_t>())
+    
+    .AddTraceSource ("TransmittedContentObjects", "TransmittedContentObjects",
+                    MakeTraceSourceAccessor (&CcnxHijacker::m_transmittedContentObjects))
+    ;
+        
+  return tid;
+}
+    
+CcnxHijacker::CcnxHijacker ()
+{
+  // NS_LOG_FUNCTION_NOARGS ();
+}
+
+// inherited from Application base class.
+void
+CcnxHijacker::StartApplication ()
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  NS_ASSERT (GetNode ()->GetObject<CcnxFib> () != 0);
+
+  CcnxApp::StartApplication ();
+
+  GetNode ()->GetObject<CcnxFib> ()->Add (m_prefix, m_face, 0);
+}
+
+void
+CcnxHijacker::StopApplication ()
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  NS_ASSERT (GetNode ()->GetObject<CcnxFib> () != 0);
+
+  CcnxApp::StopApplication ();
+}
+
+
+void
+CcnxHijacker::OnInterest (const Ptr<const CcnxInterestHeader> &interest)
+{
+  CcnxApp::OnInterest (interest); // tracing inside
+
+  NS_LOG_FUNCTION (this << interest);
+
+  /*
+  if (!m_active) return;
+    
+  static CcnxContentObjectTail tail;
+  Ptr<CcnxContentObjectHeader> header = Create<CcnxContentObjectHeader> ();
+  header->SetName (Create<CcnxNameComponents> (interest->GetName ()));
+
+  NS_LOG_INFO ("Respodning with ContentObject:\n" << boost::cref(*header));
+  
+  Ptr<Packet> packet = Create<Packet> (m_virtualPayloadSize);
+
+  m_transmittedContentObjects (header, packet, this, m_face);
+  
+  packet->AddHeader (*header);
+  packet->AddTrailer (tail);
+
+  m_protocolHandler (packet);*/
+}
+
+} // namespace ns3
diff --git a/apps/ccnx-hijacker.h b/apps/ccnx-hijacker.h
new file mode 100644
index 0000000..20adf46
--- /dev/null
+++ b/apps/ccnx-hijacker.h
@@ -0,0 +1,62 @@
+/* -*-  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 CCNX_HIJACKER_H
+#define CCNX_HIJACKER_H
+
+#include "ccnx-app.h"
+
+#include "ns3/ptr.h"
+#include "ns3/ccnx-name-components.h"
+
+namespace ns3 
+{
+
+class CcnxHijacker : public CcnxApp
+{
+public: 
+  static TypeId
+  GetTypeId (void);
+        
+  CcnxHijacker ();
+
+  // inherited from CcnxApp
+  void OnInterest (const Ptr<const CcnxInterestHeader> &interest);
+
+protected:
+  // inherited from Application base class.
+  virtual void
+  StartApplication ();    // Called at time specified by Start
+
+  virtual void
+  StopApplication ();     // Called at time specified by Stop
+
+private:
+  CcnxNameComponents m_prefix;
+  uint32_t m_virtualPayloadSize;
+
+  TracedCallback<Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>,
+                 Ptr<CcnxApp>, Ptr<CcnxFace> > m_transmittedContentObjects;
+};
+
+}
+
+#endif // CCNX_HIJACKER_H