build: Updated build scripts
diff --git a/examples/wscript b/examples/wscript
index 5162d3f..e2386ee 100644
--- a/examples/wscript
+++ b/examples/wscript
@@ -1,108 +1,14 @@
 ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-# 
-# Copyright (c) 2011-2013, Regents of the University of California
-#                          Alexander Afanasyev
-# 
-# GNU 3.0 license, See the LICENSE file for more information
-# 
-# Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
-# 
+
+from waflib import Utils, Logs
 
 def build(bld):
     # This may be necessary for visualizer to work
     all_modules = [mod[len("ns3-"):] for mod in bld.env['NS3_ENABLED_MODULES']]
 
-    obj = bld.create_ns3_program('ndn-simple', all_modules)
-    obj.source = 'ndn-simple.cc'
+    for i in bld.path.ant_glob(['*.cpp']):
+        name = str(i)[:-len(".cpp")]
+        obj = bld.create_ns3_program(name, all_modules)
+        obj.source = [i] + bld.path.ant_glob(['%s/**/*.cpp' % name])
+        obj.includes += " .. ../NFD"
 
-    obj = bld.create_ns3_program('ndn-csma', all_modules)
-    obj.source = 'ndn-csma.cc'
-
-    obj = bld.create_ns3_program('ndn-grid', all_modules)
-    obj.source = 'ndn-grid.cc'
-
-    obj = bld.create_ns3_program('ndn-zipf-mandelbrot', all_modules)
-    obj.source = 'ndn-zipf-mandelbrot.cc'
-
-
-    obj = bld.create_ns3_program('ndn-simple-with-content-freshness', all_modules)
-    obj.source = ['ndn-simple-with-content-freshness.cc',
-                  'custom-apps/dumb-requester.cc']
-
-    obj = bld.create_ns3_program('ndn-simple-with-custom-app', all_modules)
-    obj.source = ['ndn-simple-with-custom-app.cc',
-                  'custom-apps/custom-app.cc',
-                  'custom-apps/hijacker.cc']
-
-    if 'topology' in bld.env['NDN_plugins']:
-        obj = bld.create_ns3_program('ndn-grid-topo-plugin', all_modules)
-        obj.source = 'ndn-grid-topo-plugin.cc'
-
-        obj = bld.create_ns3_program('ndn-grid-topo-plugin-loss', all_modules)
-        obj.source = 'ndn-grid-topo-plugin-loss.cc'
-
-        obj = bld.create_ns3_program('ndn-grid-topo-plugin-red-queues', all_modules)
-        obj.source = 'ndn-grid-topo-plugin-red-queues.cc'
-
-        obj = bld.create_ns3_program('ndn-congestion-topo-plugin', all_modules)
-        obj.source = 'ndn-congestion-topo-plugin.cc'
-
-        obj = bld.create_ns3_program('ndn-congestion-alt-topo-plugin', all_modules)
-        obj.source = [
-            'custom-strategies/custom-strategy.cc',
-            'ndn-congestion-alt-topo-plugin.cc'
-            ]
-
-        obj = bld.create_ns3_program('ndn-tree-tracers', all_modules)
-        obj.source = 'ndn-tree-tracers.cc'
-
-        obj = bld.create_ns3_program('ndn-tree-cs-tracers', all_modules)
-        obj.source = 'ndn-tree-cs-tracers.cc'
-
-        obj = bld.create_ns3_program('ndn-tree-app-delay-tracer', all_modules)
-        obj.source = 'ndn-tree-app-delay-tracer.cc'
-
-        obj = bld.create_ns3_program('ndn-tree-with-l2tracer', all_modules)
-        obj.source = 'ndn-tree-with-l2tracer.cc'
-
-        obj = bld.create_ns3_program('ndn-triangle-calculate-routes', all_modules)
-        obj.source = 'ndn-triangle-calculate-routes.cc'
-
-    obj = bld.create_ns3_program('ndn-simple-pit-policies', all_modules)
-    obj.source = 'ndn-simple-pit-policies.cc'
-
-    obj = bld.create_ns3_program('ndn-simple-with-different-sizes-content-store', all_modules)
-    obj.source = 'ndn-simple-with-different-sizes-content-store.cc'
-
-    obj = bld.create_ns3_program('ndn-simple-with-cs-lfu', all_modules)
-    obj.source = 'ndn-simple-with-cs-lfu.cc'
-
-    obj = bld.create_ns3_program('ndn-simple-with-pcap', all_modules)
-    obj.source = 'ndn-simple-with-pcap.cc'
-
-    obj = bld.create_ns3_program('ndn-simple-with-pit-operation-stats', all_modules)
-    obj.source = 'ndn-simple-with-pit-operation-stats.cc'
-
-    obj = bld.create_ns3_program('ndn-simple-with-pit-count-stats', all_modules)
-    obj.source = 'ndn-simple-with-pit-count-stats.cc'
-
-    obj = bld.create_ns3_program('ndn-simple-api', all_modules)
-    obj.source = [
-        'ndn-simple-api.cc',
-        'custom-apps/ndn-api-app.cc'
-        ]
-
-    obj = bld.create_ns3_program('ndn-simple-with-link-failure', all_modules)
-    obj.source = 'ndn-simple-with-link-failure.cc'
-
-    if 'ip-faces' in bld.env['NDN_plugins']:
-        obj = bld.create_ns3_program('ndn-simple-tcp', all_modules)
-        obj.source = 'ndn-simple-tcp.cc'
-
-        obj = bld.create_ns3_program('ndn-simple-udp', all_modules)
-        obj.source = 'ndn-simple-udp.cc'
-
-
-    if 'ns3-wifi' in bld.env['NS3_ENABLED_MODULES']:
-        obj = bld.create_ns3_program('ndn-simple-wifi', all_modules)
-        obj.source = 'ndn-simple-wifi.cc'
diff --git a/ndn-all.hpp b/ndn-all.hpp
new file mode 100644
index 0000000..294e30b
--- /dev/null
+++ b/ndn-all.hpp
@@ -0,0 +1,61 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2011-2014  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/>.
+ **/
+
+#ifndef NDNSIM_NDN_ALL_HPP
+#define NDNSIM_NDN_ALL_HPP
+
+// #include "ns3/ndnSIM/helper/ndn-app-helper.hpp"
+// #include "ns3/ndnSIM/helper/ndn-face-container.hpp"
+// #include "ns3/ndnSIM/helper/ndn-fib-helper.hpp"
+// #include "ns3/ndnSIM/helper/ndn-global-routing-helper.hpp"
+// #include "ns3/ndnSIM/helper/ndn-ip-faces-helper.hpp"
+// #include "ns3/ndnSIM/helper/ndn-link-control-helper.hpp"
+// #include "ns3/ndnSIM/helper/ndn-stack-helper.hpp"
+// #include "ns3/ndnSIM/helper/ndn-strategy-choice-helper.hpp"
+
+// #include "ns3/ndnSIM/utils/batches.hpp"
+// #include "ns3/ndnSIM/utils/topology/annotated-topology-reader.hpp"
+// #include "ns3/ndnSIM/utils/topology/rocketfuel-map-reader.hpp"
+// #include "ns3/ndnSIM/utils/topology/rocketfuel-weights-reader.hpp"
+// #include "ns3/ndnSIM/utils/tracers/l2-rate-tracer.hpp"
+// #include "ns3/ndnSIM/utils/tracers/l2-tracer.hpp"
+// #include "ns3/ndnSIM/utils/tracers/ndn-app-delay-tracer.hpp"
+// #include "ns3/ndnSIM/utils/tracers/ndn-cs-tracer.hpp"
+// #include "ns3/ndnSIM/utils/tracers/ndn-l3-aggregate-tracer.hpp"
+// #include "ns3/ndnSIM/utils/tracers/ndn-l3-rate-tracer.hpp"
+// #include "ns3/ndnSIM/utils/tracers/ndn-l3-tracer.hpp"
+
+// #include "ns3/ndnSIM/model/ndn-app-face.hpp"
+// #include "ns3/ndnSIM/model/ndn-common.hpp"
+// #include "ns3/ndnSIM/model/ndn-global-router.hpp"
+// #include "ns3/ndnSIM/model/ndn-header.hpp"
+// #include "ns3/ndnSIM/model/ndn-l3-protocol.hpp"
+// #include "ns3/ndnSIM/model/ndn-net-device-face.hpp"
+// #include "ns3/ndnSIM/model/ndn-ns3.hpp"
+
+// #include "ns3/ndnSIM/apps/callback-based-app.hpp"
+// #include "ns3/ndnSIM/apps/ndn-app.hpp"
+// #include "ns3/ndnSIM/apps/ndn-consumer-batches.hpp"
+// #include "ns3/ndnSIM/apps/ndn-consumer-cbr.hpp"
+// #include "ns3/ndnSIM/apps/ndn-consumer-window.hpp"
+// #include "ns3/ndnSIM/apps/ndn-consumer-zipf-mandelbrot.hpp"
+// #include "ns3/ndnSIM/apps/ndn-consumer.hpp"
+// #include "ns3/ndnSIM/apps/ndn-producer.hpp"
+
+#endif // NDNSIM_NDN_ALL_HPP
diff --git a/wscript b/wscript
index 72a7d3e..11b2d97 100644
--- a/wscript
+++ b/wscript
@@ -1,12 +1,4 @@
 ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-#
-# Copyright (c) 2011-2013, Regents of the University of California
-#                          Alexander Afanasyev
-#
-# GNU 3.0 license, See the LICENSE file for more information
-#
-# Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
-#
 
 import os
 from waflib import Logs, Utils, Options, TaskGen, Task
@@ -14,19 +6,6 @@
 
 import wutils
 
-def options(opt):
-    opt = opt.add_option_group ('ndnSIM Options')
-    opt.add_option('--enable-ndn-plugins',
-                   help="""Enable NDN plugins (may require patching).  topology plugin enabled by default""",
-                   dest='enable_ndn_plugins')
-
-    opt.add_option('--disable-ndn-plugins',
-                   help="""Enable NDN plugins (may require patching).  topology plugin enabled by default""",
-                   dest='disable_ndn_plugins')
-
-    opt.add_option('--pyndn-install-path', dest='pyndn_install_path',
-                   help="""Installation path for PyNDN (by default: into standard location under PyNDN folder""")
-
 REQUIRED_BOOST_LIBS = ['graph']
 
 def required_boost_libs(conf):
@@ -35,6 +14,9 @@
 def configure(conf):
     conf.env['ENABLE_NDNSIM']=False;
 
+    conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
+                   uselib_store='NDN_CXX', mandatory=True)
+
     if not conf.env['LIB_BOOST']:
         conf.report_optional_feature("ndnSIM", "ndnSIM", False,
                                      "Required boost libraries not found")
@@ -71,163 +53,46 @@
             Logs.error ("Please upgrade your distribution or install custom boost libraries (http://ndnsim.net/faq.html#boost-libraries)")
             return
 
-    conf.env['NDN_plugins'] = ['topology', 'ip-faces']
-    if Options.options.enable_ndn_plugins:
-        conf.env['NDN_plugins'] = conf.env['NDN_plugins'] + Options.options.enable_ndn_plugins.split(',')
-
-    if Options.options.disable_ndn_plugins:
-        conf.env['NDN_plugins'] = conf.env['NDN_plugins'] - Options.options.disable_ndn_plugins.split(',')
-
-    if Options.options.pyndn_install_path:
-        conf.env['PyNDN_install_path'] = Options.options.pyndn_install_path
-
     conf.env['ENABLE_NDNSIM']=True;
     conf.env['MODULES_BUILT'].append('ndnSIM')
 
     conf.report_optional_feature("ndnSIM", "ndnSIM", True, "")
 
 def build(bld):
-    deps = ['core', 'network', 'point-to-point']
-    deps.append ('internet') # Until RttEstimator is moved to network module
+    deps = ['core', 'network', 'point-to-point', 'topology-read', 'mobility', 'internet']
     if 'ns3-visualizer' in bld.env['NS3_ENABLED_MODULES']:
-        deps.append ('visualizer')
+        deps.append('visualizer')
 
-    if 'topology' in bld.env['NDN_plugins']:
-        deps.append ('topology-read')
-        deps.append ('mobility')
-
-    if 'mobility' in bld.env['NDN_plugins']:
-        deps.append ('mobility')
+    if bld.env.ENABLE_EXAMPLES:
+        deps += ['point-to-point-layout', 'csma', 'applications']
 
     module = bld.create_ns3_module ('ndnSIM', deps)
     module.module = 'ndnSIM'
     module.features += ' ns3fullmoduleheaders'
-    module.uselib = 'BOOST BOOST_IOSTREAMS'
+    module.uselib = 'NDN_CXX BOOST'
+    module.includes = [".", "./NFD", "./NFD/daemon", "./NFD/core"]
+    module.export_includes = [".", "./NFD", "./NFD/daemon", "./NFD/core"]
 
     headers = bld (features='ns3header')
     headers.module = 'ndnSIM'
+    headers.source = ["ndn-all.hpp"]
 
     if not bld.env['ENABLE_NDNSIM']:
         bld.env['MODULES_NOT_BUILT'].append('ndnSIM')
         return
 
-    module.source = bld.path.ant_glob(['model/**/*.cc',
-                                       'apps/*.cc',
-                                       'utils/**/*.cc',
-                                       'helper/**/*.cc',
-                                       'ndn.cxx/**/*.cc',
-                                       ])
-    module.full_headers = [p.path_from(bld.path) for p in bld.path.ant_glob([
-                           'utils/**/*.h',
-                           'model/**/*.h',
-                           'apps/**/*.h',
-                           'helper/**/*.h',
-                           'ndn.cxx/**/*.h',
-                           ])]
+    module_dirs = ['NFD', 'apps', 'helper', 'model', 'utils']
+    
+    module.source = bld.path.ant_glob(['%s/**/*.cpp' % dir for dir in module_dirs])
 
-    headers.source = [
-        "helper/ndn-stack-helper.h",
-        "helper/ndn-app-helper.h",
-        "helper/ndn-header-helper.h",
-        "helper/ndn-face-container.h",
-        "helper/ndn-global-routing-helper.h",
-        "helper/ndn-link-control-helper.h",
-
-        "apps/ndn-app.h",
-
-        "model/ndn-common.h",
-        "model/ndn-l3-protocol.h",
-        "model/ndn-face.h",
-        "model/ndn-app-face.h",
-        "model/ndn-net-device-face.h",
-        "model/ndn-interest.h",
-        "model/ndn-data.h",
-        "model/ndn-name-components.h",
-        "model/ndn-name.h",
-
-        "ndn.cxx/blob.h",
-        "ndn.cxx/name-component.h",
-        "ndn.cxx/name.h",
-        "ndn.cxx/exclude.h",
-        "ndn.cxx/ndn-api-face.h",
-
-        "model/cs/ndn-content-store.h",
-
-        "model/fib/ndn-fib.h",
-        "model/fib/ndn-fib-entry.h",
-
-        "model/pit/ndn-pit.h",
-        "model/pit/ndn-pit-entry.h",
-        "model/pit/ndn-pit-entry-incoming-face.h",
-        "model/pit/ndn-pit-entry-outgoing-face.h",
-
-        "model/fw/ndn-forwarding-strategy.h",
-        "model/fw/ndn-fw-tag.h",
-
-        "model/wire/ndn-wire.h",
-
-        "utils/ndn-limits.h",
-        "utils/ndn-rtt-estimator.h",
-
-        # "utils/tracers/ipv4-app-tracer.h",
-        # "utils/tracers/ipv4-l3-tracer.h",
-        # "utils/tracers/ipv4-rate-l3-tracer.h",
-        # "utils/tracers/ipv4-seqs-app-tracer.h",
-
-        "utils/tracers/l2-rate-tracer.h",
-        "utils/tracers/l2-tracer.h",
-        "utils/tracers/ndn-app-delay-tracer.h",
-        "utils/tracers/ndn-cs-tracer.h",
-        "utils/tracers/ndn-l3-aggregate-tracer.h",
-        "utils/tracers/ndn-l3-tracer.h",
-        "utils/tracers/ndn-l3-rate-tracer.h",
-
-        "apps/callback-based-app.h",
-        ]
-
-    if 'topology' in bld.env['NDN_plugins']:
-        headers.source.extend ([
-            "plugins/topology/rocketfuel-weights-reader.h",
-            "plugins/topology/annotated-topology-reader.h",
-            ])
-        module.source.extend (bld.path.ant_glob(['plugins/topology/*.cc']))
-        module.full_headers.extend ([p.path_from(bld.path) for p in bld.path.ant_glob(['plugins/topology/**/*.h'])])
-
-    if 'mobility' in bld.env['NDN_plugins']:
-        headers.source.extend ([
-            "plugins/mobility/spring-mobility-model.h",
-            "plugins/mobility/spring-mobility-helper.h",
-            ])
-        module.source.extend (bld.path.ant_glob(['plugins/mobility/*.cc']))
-        module.full_headers.extend ([p.path_from(bld.path) for p in bld.path.ant_glob(['plugins/mobility/**/*.h'])])
-
-    if 'ip-faces' in bld.env['NDN_plugins']:
-        headers.source.extend ([
-            "plugins/ip-faces/ndn-ip-faces-helper.h",
-            ])
-        module.source.extend (bld.path.ant_glob(['plugins/ip-faces/*.cc']))
-        module.full_headers.extend ([p.path_from(bld.path) for p in bld.path.ant_glob(['plugins/ip-faces/**/*.h'])])
-
-    # bld.install_files('${INCLUDEDIR}/%s%s/ns3/ndnSIM' % (wutils.APPNAME, wutils.VERSION), ndnSIM_headers, relative_trick=True)
-    # bld.install_files('$PREFIX/include', ndnSIM_headers)
-
-    tests = bld.create_ns3_module_test_library('ndnSIM')
-    tests.source = bld.path.ant_glob('test/*.cc')
+    module.full_headers = [p.path_from(bld.path) for p in bld.path.ant_glob(
+        ['%s/**/*.hpp' % dir for dir in module_dirs])]
 
     if bld.env.ENABLE_EXAMPLES:
         bld.recurse ('examples')
 
-    bld.recurse ('tools')
-
     bld.ns3_python_bindings()
 
-    if bld.env['ENABLE_PYTHON_BINDINGS']:
-        if bld.env['PyNDN_install_path']:
-            bld (features = "py",
-                 source = bld.path.ant_glob (["PyNDN/**/*.py"]),
-                 install_from = "PyNDN",
-                 install_path = bld.env['PyNDN_install_path'])
-
 @TaskGen.feature('ns3fullmoduleheaders')
 @TaskGen.after_method('process_rule')
 def apply_ns3fullmoduleheaders(self):