Adding necessary patches to run NDN module
diff --git a/patches/0001-point-to-point-Add-support-of-PPP-Ethernet-and-Ether.patch b/patches/0001-point-to-point-Add-support-of-PPP-Ethernet-and-Ether.patch
new file mode 100644
index 0000000..2af712e
--- /dev/null
+++ b/patches/0001-point-to-point-Add-support-of-PPP-Ethernet-and-Ether.patch
@@ -0,0 +1,49 @@
+From 4a928511196fd80e9e9c43646d916e2d6fbc3190 Mon Sep 17 00:00:00 2001
+From: Ilya Moiseenko <iliamo@ucla.edu>
+Date: Thu, 1 Sep 2011 17:41:00 -0700
+Subject: [PATCH] point-to-point: Add support of PPP->Ethernet and
+ Ethernet->PPP frame type conversion for CCNx protocol
+
+point-to-point: Adding support for CCNx payload in PppHeader::Print method
+---
+ src/point-to-point/model/point-to-point-net-device.cc |    2 ++
+ src/point-to-point/model/ppp-header.cc                |    3 +++
+ 2 files changed, 5 insertions(+)
+
+diff --git a/src/point-to-point/model/point-to-point-net-device.cc b/src/point-to-point/model/point-to-point-net-device.cc
+index ca81c53..775ef00 100644
+--- a/src/point-to-point/model/point-to-point-net-device.cc
++++ b/src/point-to-point/model/point-to-point-net-device.cc
+@@ -607,6 +607,7 @@ PointToPointNetDevice::PppToEther (uint16_t proto)
+     {
+     case 0x0021: return 0x0800;   //IPv4
+     case 0x0057: return 0x86DD;   //IPv6
++    case 0x0077: return 0x7777;   //CCNx
+     default: NS_ASSERT_MSG (false, "PPP Protocol number not defined!");
+     }
+   return 0;
+@@ -619,6 +620,7 @@ PointToPointNetDevice::EtherToPpp (uint16_t proto)
+     {
+     case 0x0800: return 0x0021;   //IPv4
+     case 0x86DD: return 0x0057;   //IPv6
++    case 0x7777: return 0x0077;   //CCNx
+     default: NS_ASSERT_MSG (false, "PPP Protocol number not defined!");
+     }
+   return 0;
+diff --git a/src/point-to-point/model/ppp-header.cc b/src/point-to-point/model/ppp-header.cc
+index 4650fb0..7e000bd 100644
+--- a/src/point-to-point/model/ppp-header.cc
++++ b/src/point-to-point/model/ppp-header.cc
+@@ -66,6 +66,9 @@ PppHeader::Print (std::ostream &os) const
+     case 0x0057: /* IPv6 */
+       proto = "IPv6 (0x0057)";
+       break;
++    case 0x0077: /* CCNx */
++      proto = "CCNx (0x0077)";
++      break;
+     default:
+       NS_ASSERT_MSG (false, "PPP Protocol number not defined!");
+     }
+-- 
+1.7.10.2
+
diff --git a/patches/0001-point-to-point-netanim-Adding-ChannelID-to-PointToPo.patch b/patches/0001-point-to-point-netanim-Adding-ChannelID-to-PointToPo.patch
new file mode 100644
index 0000000..f327f6a
--- /dev/null
+++ b/patches/0001-point-to-point-netanim-Adding-ChannelID-to-PointToPo.patch
@@ -0,0 +1,72 @@
+From 9ed23508a72afd3780b041b2fd00a50e1ff91b4c Mon Sep 17 00:00:00 2001
+From: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+Date: Mon, 23 Apr 2012 13:49:37 -0700
+Subject: [PATCH] point-to-point, netanim: Adding ChannelID to
+ PointToPointChannel trace
+
+---
+ src/netanim/model/animation-interface.cc           |    4 +++-
+ src/netanim/model/animation-interface.h            |    3 ++-
+ src/point-to-point/model/point-to-point-channel.cc |    2 +-
+ src/point-to-point/model/point-to-point-channel.h  |    3 ++-
+ 4 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/src/netanim/model/animation-interface.cc b/src/netanim/model/animation-interface.cc
+index d6a3551..9215abf 100644
+--- a/src/netanim/model/animation-interface.cc
++++ b/src/netanim/model/animation-interface.cc
+@@ -676,7 +676,9 @@ void AnimationInterface::WriteDummyPacket ()
+ 
+ 
+ }
+-void AnimationInterface::DevTxTrace (std::string context, Ptr<const Packet> p,
++void AnimationInterface::DevTxTrace (std::string context,
++                                     uint32_t, // channel
++                                     Ptr<const Packet> p,
+                                      Ptr<NetDevice> tx, Ptr<NetDevice> rx,
+                                      Time txTime, Time rxTime)
+ {
+diff --git a/src/netanim/model/animation-interface.h b/src/netanim/model/animation-interface.h
+index 4a3ffb9..db58d89 100644
+--- a/src/netanim/model/animation-interface.h
++++ b/src/netanim/model/animation-interface.h
+@@ -288,7 +288,8 @@ private:
+   bool ServerPortSet;
+ 
+   void DevTxTrace (std::string context,
+-                   Ptr<const Packet> p,
++                   uint32_t,
++		   Ptr<const Packet> p,
+                    Ptr<NetDevice> tx,
+                    Ptr<NetDevice> rx,
+                    Time txTime,
+diff --git a/src/point-to-point/model/point-to-point-channel.cc b/src/point-to-point/model/point-to-point-channel.cc
+index d6a6938..5bc4c9c 100644
+--- a/src/point-to-point/model/point-to-point-channel.cc
++++ b/src/point-to-point/model/point-to-point-channel.cc
+@@ -98,7 +98,7 @@ PointToPointChannel::TransmitStart (
+                                   m_link[wire].m_dst, p);
+ 
+   // Call the tx anim callback on the net device
+-  m_txrxPointToPoint (p, src, m_link[wire].m_dst, txTime, txTime + m_delay);
++  m_txrxPointToPoint (GetId (), p, src, m_link[wire].m_dst, txTime, txTime + m_delay);
+   return true;
+ }
+ 
+diff --git a/src/point-to-point/model/point-to-point-channel.h b/src/point-to-point/model/point-to-point-channel.h
+index 4b0b777..a364ab9 100644
+--- a/src/point-to-point/model/point-to-point-channel.h
++++ b/src/point-to-point/model/point-to-point-channel.h
+@@ -137,7 +137,8 @@ private:
+    *
+    * @see class CallBackTraceSource
+    */
+-  TracedCallback<Ptr<const Packet>, // Packet being transmitted
++  TracedCallback<uint32_t,          // channel ID
++                 Ptr<const Packet>, // Packet being transmitted
+                  Ptr<NetDevice>,    // Transmitting NetDevice
+                  Ptr<NetDevice>,    // Receiving NetDevice
+                  Time,              // Amount of time to transmit the pkt
+-- 
+1.7.10.2
+
diff --git a/patches/0002-core-openflow-Moving-boost-related-configuration-to-.patch b/patches/0002-core-openflow-Moving-boost-related-configuration-to-.patch
new file mode 100644
index 0000000..0e226e3
--- /dev/null
+++ b/patches/0002-core-openflow-Moving-boost-related-configuration-to-.patch
@@ -0,0 +1,73 @@
+From 63e2f7d75601540169f62dea0b8aa17fda34812a Mon Sep 17 00:00:00 2001
+From: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+Date: Wed, 29 Feb 2012 10:07:08 -0800
+Subject: [PATCH] core+openflow: Moving `boost`-related configuration to main
+ wscript.
+
+There is a problem when two different modules require different boost
+libs.  Only requirements of the last module are actually picked up by
+the build system.
+---
+ src/openflow/wscript |   10 +---------
+ wscript              |    9 +++++++++
+ 2 files changed, 10 insertions(+), 9 deletions(-)
+
+diff --git a/src/openflow/wscript b/src/openflow/wscript
+index b18d2c1..21c483a 100644
+--- a/src/openflow/wscript
++++ b/src/openflow/wscript
+@@ -2,23 +2,15 @@
+ 
+ import os
+ import Options
++import Logs
+ from waflib.Errors import WafError
+ 
+ def options(opt):
+     opt.add_option('--with-openflow',
+ 		   help=('Path to OFSID source for NS-3 OpenFlow Integration support'),
+ 		   default='', dest='with_openflow')
+-    opt.tool_options('boost', tooldir=["waf-tools"])
+ 
+ def configure(conf):
+-    try:
+-        conf.check_tool('boost')
+-        conf.check_boost(lib='signals filesystem')
+-        if not conf.env.LIB_BOOST:
+-            conf.check_boost(lib='signals filesystem', libpath="/usr/lib64")
+-    except WafError:
+-        conf.env['LIB_BOOST'] = []
+-
+     if not conf.env.LIB_BOOST:
+ 	conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", False,
+ 				     "Required boost libraries not found")
+diff --git a/wscript b/wscript
+index 05440fa..c60fd18 100644
+--- a/wscript
++++ b/wscript
+@@ -125,6 +125,7 @@ def options(opt):
+     opt.load('compiler_cxx')
+     opt.load('cflags')
+     opt.load('gnu_dirs')
++    opt.tool_options('boost', tooldir=["waf-tools"])
+ 
+     opt.add_option('--cwd',
+                    help=('Set the working directory for a program.'),
+@@ -364,6 +365,14 @@ def configure(conf):
+                 conf.report_optional_feature("static", "Static build", False,
+                                              "Link flag -Wl,--whole-archive,-Bstatic does not work")
+ 
++    try:
++        conf.check_tool('boost')
++        conf.check_boost(lib='signals filesystem iostreams regex')
++        if not conf.env.LIB_BOOST:
++            conf.check_boost(lib='signals filesystem iostreams regex', libpath="/usr/lib64")
++    except WafError:
++        conf.env['LIB_BOOST'] = []
++
+     # Set this so that the lists won't be printed at the end of this
+     # configure command.
+     conf.env['PRINT_BUILT_MODULES_AT_END'] = False
+-- 
+1.7.10.2
+
diff --git a/patches/0003-internet-Making-rtt-estimator.h-of-the-Internet-modu.patch b/patches/0003-internet-Making-rtt-estimator.h-of-the-Internet-modu.patch
new file mode 100644
index 0000000..67072de
--- /dev/null
+++ b/patches/0003-internet-Making-rtt-estimator.h-of-the-Internet-modu.patch
@@ -0,0 +1,25 @@
+From 55b3eea8f073c83e1dfccdf7e43c5746aea0af68 Mon Sep 17 00:00:00 2001
+From: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+Date: Mon, 9 Jan 2012 18:39:26 -0800
+Subject: [PATCH] internet: Making rtt-estimator.h of the Internet module
+ accessible to other modules
+
+---
+ src/internet/wscript |    1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/internet/wscript b/src/internet/wscript
+index e250a1e..0090ae3 100644
+--- a/src/internet/wscript
++++ b/src/internet/wscript
+@@ -279,6 +279,7 @@ def build(bld):
+         'helper/ipv6-interface-container.h',
+         'helper/ipv6-routing-helper.h',
+         'model/ipv6-address-generator.h',
++        'model/rtt-estimator.h',
+        ]
+ 
+     if bld.env['NSC_ENABLED']:
+-- 
+1.7.10.2
+
diff --git a/patches/0004-visualizer-Adding-plugin-to-display-a-CCNx-FIB-state.patch b/patches/0004-visualizer-Adding-plugin-to-display-a-CCNx-FIB-state.patch
new file mode 100644
index 0000000..450c374
--- /dev/null
+++ b/patches/0004-visualizer-Adding-plugin-to-display-a-CCNx-FIB-state.patch
@@ -0,0 +1,108 @@
+From 84d6db685c4ee5cbce89b4424c68f5d40c2b976b Mon Sep 17 00:00:00 2001
+From: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+Date: Wed, 29 Feb 2012 16:59:59 -0800
+Subject: [PATCH] visualizer: Adding plugin to display a CCNx FIB state
+
+---
+ src/visualizer/visualizer/plugins/ccnx_fib.py |   89 +++++++++++++++++++++++++
+ 1 file changed, 89 insertions(+)
+ create mode 100644 src/visualizer/visualizer/plugins/ccnx_fib.py
+
+diff --git a/src/visualizer/visualizer/plugins/ccnx_fib.py b/src/visualizer/visualizer/plugins/ccnx_fib.py
+new file mode 100644
+index 0000000..3f09212
+--- /dev/null
++++ b/src/visualizer/visualizer/plugins/ccnx_fib.py
+@@ -0,0 +1,89 @@
++import gtk
++
++import ns.core
++import ns.network
++import ns.internet
++import ns.NDNabstraction
++
++from visualizer.base import InformationWindow
++
++class ShowCcnxFib(InformationWindow):
++    (
++        COLUMN_PREFIX,
++        COLUMN_FACE
++        ) = range(2)
++
++    def __init__(self, visualizer, node_index):
++        InformationWindow.__init__(self)
++        self.win = gtk.Dialog(parent=visualizer.window,
++                              flags=gtk.DIALOG_DESTROY_WITH_PARENT|gtk.DIALOG_NO_SEPARATOR,
++                              buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
++        self.win.connect("response", self._response_cb)
++
++        self.node = ns.network.NodeList.GetNode (node_index)
++        node_name = ns.core.Names.FindName (self.node)
++
++        title = "CCNx FIB for node %i" % node_index
++        if len(node_name) != 0:
++            title += " (" + str(node_name) + ")"
++
++        self.win.set_title (title) 
++        self.visualizer = visualizer
++        self.node_index = node_index
++
++        self.table_model = gtk.ListStore(str, str, int)
++
++        treeview = gtk.TreeView(self.table_model)
++        treeview.show()
++        sw = gtk.ScrolledWindow()
++        sw.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
++                          vscrollbar_policy=gtk.POLICY_AUTOMATIC)
++        sw.show()
++        sw.add(treeview)
++        self.win.vbox.add(sw)
++        self.win.set_default_size(600, 300)
++        
++        # Dest.
++        column = gtk.TreeViewColumn('Destination', gtk.CellRendererText(),
++                                    text=self.COLUMN_PREFIX)
++        treeview.append_column(column)
++
++        # Interface
++        column = gtk.TreeViewColumn('faceType[nodeId](routingCost,status,metric)', gtk.CellRendererText(),
++                                    text=self.COLUMN_FACE)
++        treeview.append_column(column)
++
++        self.visualizer.add_information_window(self)
++        self.win.show()
++
++    def _response_cb(self, win, response):
++        self.win.destroy()
++        self.visualizer.remove_information_window(self)
++    
++    def update(self):
++        ccnxFib = self.node.GetObject(ns.NDNabstraction.CcnxFib.GetTypeId())
++        
++        if ccnxFib is None:
++            return
++
++        self.table_model.clear()
++        
++        for fibI in range(ccnxFib.GetCcnxFibEntryCount()):
++            entry = ccnxFib.GetCcnxFibEntry(fibI)
++            tree_iter = self.table_model.append()
++            self.table_model.set(tree_iter,
++                                 self.COLUMN_PREFIX, str(entry.GetPrefix()),
++                                 self.COLUMN_FACE, str(entry))
++
++def populate_node_menu(viz, node, menu):
++    menu_item = gtk.MenuItem("Show CCNx FIB")
++    menu_item.show()
++
++    def _show_ccnx_fib(dummy_menu_item):
++        ShowCcnxFib(viz, node.node_index)
++
++    menu_item.connect("activate", _show_ccnx_fib)
++    menu.add(menu_item)
++
++def register(viz):
++    viz.connect("populate-node-menu", populate_node_menu)
+-- 
+1.7.10.2
+
diff --git a/patches/0005-visualizer-temporary-fix-for-the-visualizer-related-.patch b/patches/0005-visualizer-temporary-fix-for-the-visualizer-related-.patch
new file mode 100644
index 0000000..b30ac72
--- /dev/null
+++ b/patches/0005-visualizer-temporary-fix-for-the-visualizer-related-.patch
@@ -0,0 +1,44 @@
+From ebfeccd51ba1259e01a5bef3925719a88c3ac040 Mon Sep 17 00:00:00 2001
+From: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+Date: Mon, 23 Apr 2012 13:45:51 -0700
+Subject: [PATCH] visualizer: temporary fix for the visualizer-related bugs
+ (asserts)
+
+---
+ src/core/model/type-id.cc     |    3 ++-
+ src/visualizer/model/pyviz.cc |    5 +++--
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/core/model/type-id.cc b/src/core/model/type-id.cc
+index e51e1e9..1368b85 100644
+--- a/src/core/model/type-id.cc
++++ b/src/core/model/type-id.cc
+@@ -149,7 +149,8 @@ IidManager::AddConstructor (uint16_t uid, ns3::Callback<ns3::ObjectBase *> callb
+   struct IidInformation *information = LookupInformation (uid);
+   if (information->hasConstructor)
+     {
+-      NS_FATAL_ERROR (information->name<<" already has a constructor.");
++      return;
++      // NS_FATAL_ERROR (information->name<<" already has a constructor.");
+     }
+   information->hasConstructor = true;
+   information->constructor = callback;
+diff --git a/src/visualizer/model/pyviz.cc b/src/visualizer/model/pyviz.cc
+index 1e500b2..739d8c4 100644
+--- a/src/visualizer/model/pyviz.cc
++++ b/src/visualizer/model/pyviz.cc
+@@ -317,8 +317,9 @@ PyViz::SimulatorRunUntil (Time time)
+   // events just appear to "jump" big chunks of time.
+   NS_LOG_LOGIC ("Schedule dummy callback to be called in " << (time - Simulator::Now ()));
+   m_stop = false;
+-  Simulator::Cancel (m_stopCallbackEvent);
+-  m_stopCallbackEvent = Simulator::Schedule (time - Simulator::Now (), &PyViz::CallbackStopSimulation, this);
++  // Simulator::Cancel (m_stopCallbackEvent);
++  // m_stopCallbackEvent =
++  Simulator::ScheduleWithContext (-1, time - Simulator::Now (), &PyViz::CallbackStopSimulation, this);
+ 
+   Ptr<SimulatorImpl> impl = Simulator::GetImplementation ();
+   Ptr<VisualSimulatorImpl> visualImpl = DynamicCast<VisualSimulatorImpl> (impl);
+-- 
+1.7.10.2
+