rib: Merge source code of NRD
Change-Id: I44dce9db7ad079661d509349bef07b1acb389b58
Refs: #1486
diff --git a/rib/.gitignore b/rib/.gitignore
new file mode 100644
index 0000000..d26fa7d
--- /dev/null
+++ b/rib/.gitignore
@@ -0,0 +1,5 @@
+.DS*
+.waf-1*
+.lock*
+**/*.pyc
+build/
diff --git a/rib/.waf-tools/boost.py b/rib/.waf-tools/boost.py
new file mode 100644
index 0000000..ffcfbae
--- /dev/null
+++ b/rib/.waf-tools/boost.py
@@ -0,0 +1,376 @@
+#!/usr/bin/env python
+# encoding: utf-8
+#
+# partially based on boost.py written by Gernot Vormayr
+# written by Ruediger Sonderfeld <ruediger@c-plusplus.de>, 2008
+# modified by Bjoern Michaelsen, 2008
+# modified by Luca Fossati, 2008
+# rewritten for waf 1.5.1, Thomas Nagy, 2008
+# rewritten for waf 1.6.2, Sylvain Rouquette, 2011
+
+'''
+
+This is an extra tool, not bundled with the default waf binary.
+To add the boost tool to the waf file:
+$ ./waf-light --tools=compat15,boost
+ or, if you have waf >= 1.6.2
+$ ./waf update --files=boost
+
+When using this tool, the wscript will look like:
+
+ def options(opt):
+ opt.load('compiler_cxx boost')
+
+ def configure(conf):
+ conf.load('compiler_cxx boost')
+ conf.check_boost(lib='system filesystem')
+
+ def build(bld):
+ bld(source='main.cpp', target='app', use='BOOST')
+
+Options are generated, in order to specify the location of boost includes/libraries.
+The `check_boost` configuration function allows to specify the used boost libraries.
+It can also provide default arguments to the --boost-static and --boost-mt command-line arguments.
+Everything will be packaged together in a BOOST component that you can use.
+
+When using MSVC, a lot of compilation flags need to match your BOOST build configuration:
+ - you may have to add /EHsc to your CXXFLAGS or define boost::throw_exception if BOOST_NO_EXCEPTIONS is defined.
+ Errors: C4530
+ - boost libraries will try to be smart and use the (pretty but often not useful) auto-linking feature of MSVC
+ So before calling `conf.check_boost` you might want to disabling by adding:
+ conf.env.DEFINES_BOOST += ['BOOST_ALL_NO_LIB']
+ Errors:
+ - boost might also be compiled with /MT, which links the runtime statically.
+ If you have problems with redefined symbols,
+ self.env['DEFINES_%s' % var] += ['BOOST_ALL_NO_LIB']
+ self.env['CXXFLAGS_%s' % var] += ['/MD', '/EHsc']
+Passing `--boost-linkage_autodetect` might help ensuring having a correct linkage in some basic cases.
+
+'''
+
+import sys
+import re
+from waflib import Utils, Logs, Errors
+from waflib.Configure import conf
+
+BOOST_LIBS = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib', '/usr/lib/x86_64-linux-gnu', '/usr/lib/i386-linux-gnu', '/usr/local/ndn/lib']
+BOOST_INCLUDES = ['/usr/include', '/usr/local/include', '/opt/local/include', '/sw/include', '/usr/local/ndn/include']
+BOOST_VERSION_FILE = 'boost/version.hpp'
+BOOST_VERSION_CODE = '''
+#include <iostream>
+#include <boost/version.hpp>
+int main() { std::cout << BOOST_LIB_VERSION << ":" << BOOST_VERSION << std::endl; }
+'''
+
+# toolsets from {boost_dir}/tools/build/v2/tools/common.jam
+PLATFORM = Utils.unversioned_sys_platform()
+detect_intel = lambda env: (PLATFORM == 'win32') and 'iw' or 'il'
+detect_clang = lambda env: (PLATFORM == 'darwin') and 'clang-darwin' or 'clang'
+detect_mingw = lambda env: (re.search('MinGW', env.CXX[0])) and 'mgw' or 'gcc'
+BOOST_TOOLSETS = {
+ 'borland': 'bcb',
+ 'clang': detect_clang,
+ 'como': 'como',
+ 'cw': 'cw',
+ 'darwin': 'xgcc',
+ 'edg': 'edg',
+ 'g++': detect_mingw,
+ 'gcc': detect_mingw,
+ 'icpc': detect_intel,
+ 'intel': detect_intel,
+ 'kcc': 'kcc',
+ 'kylix': 'bck',
+ 'mipspro': 'mp',
+ 'mingw': 'mgw',
+ 'msvc': 'vc',
+ 'qcc': 'qcc',
+ 'sun': 'sw',
+ 'sunc++': 'sw',
+ 'tru64cxx': 'tru',
+ 'vacpp': 'xlc'
+}
+
+
+def options(opt):
+ opt = opt.add_option_group('Boost Options')
+
+ opt.add_option('--boost-includes', type='string',
+ default='', dest='boost_includes',
+ help='''path to the directory where the boost includes are, e.g., /path/to/boost_1_47_0/stage/include''')
+ opt.add_option('--boost-libs', type='string',
+ default='', dest='boost_libs',
+ help='''path to the directory where the boost libs are, e.g., /path/to/boost_1_47_0/stage/lib''')
+ opt.add_option('--boost-static', action='store_true',
+ default=False, dest='boost_static',
+ help='link with static boost libraries (.lib/.a)')
+ opt.add_option('--boost-mt', action='store_true',
+ default=False, dest='boost_mt',
+ help='select multi-threaded libraries')
+ opt.add_option('--boost-abi', type='string', default='', dest='boost_abi',
+ help='''select libraries with tags (dgsyp, d for debug), see doc Boost, Getting Started, chapter 6.1''')
+ opt.add_option('--boost-linkage_autodetect', action="store_true", dest='boost_linkage_autodetect',
+ help="auto-detect boost linkage options (don't get used to it / might break other stuff)")
+ opt.add_option('--boost-toolset', type='string',
+ default='', dest='boost_toolset',
+ help='force a toolset e.g. msvc, vc90, gcc, mingw, mgw45 (default: auto)')
+ py_version = '%d%d' % (sys.version_info[0], sys.version_info[1])
+ opt.add_option('--boost-python', type='string',
+ default=py_version, dest='boost_python',
+ help='select the lib python with this version (default: %s)' % py_version)
+
+
+@conf
+def __boost_get_version_file(self, d):
+ dnode = self.root.find_dir(d)
+ if dnode:
+ return dnode.find_node(BOOST_VERSION_FILE)
+ return None
+
+@conf
+def boost_get_version(self, d):
+ """silently retrieve the boost version number"""
+ node = self.__boost_get_version_file(d)
+ if node:
+ try:
+ txt = node.read()
+ except (OSError, IOError):
+ Logs.error("Could not read the file %r" % node.abspath())
+ else:
+ re_but1 = re.compile('^#define\\s+BOOST_LIB_VERSION\\s+"(.*)"', re.M)
+ m1 = re_but1.search(txt)
+
+ re_but2 = re.compile('^#define\\s+BOOST_VERSION\\s+"(.*)"', re.M)
+ m2 = re_but2.search(txt)
+
+ if m1 and m2:
+ return (m1.group(1), m2.group(1))
+
+ return self.check_cxx(fragment=BOOST_VERSION_CODE, includes=[d], execute=True, define_ret=True).split(":")
+
+@conf
+def boost_get_includes(self, *k, **kw):
+ includes = k and k[0] or kw.get('includes', None)
+ if includes and self.__boost_get_version_file(includes):
+ return includes
+ for d in Utils.to_list(self.environ.get('INCLUDE', '')) + BOOST_INCLUDES:
+ if self.__boost_get_version_file(d):
+ return d
+ if includes:
+ self.end_msg('headers not found in %s' % includes)
+ self.fatal('The configuration failed')
+ else:
+ self.end_msg('headers not found, please provide a --boost-includes argument (see help)')
+ self.fatal('The configuration failed')
+
+
+@conf
+def boost_get_toolset(self, cc):
+ toolset = cc
+ if not cc:
+ build_platform = Utils.unversioned_sys_platform()
+ if build_platform in BOOST_TOOLSETS:
+ cc = build_platform
+ else:
+ cc = self.env.CXX_NAME
+ if cc in BOOST_TOOLSETS:
+ toolset = BOOST_TOOLSETS[cc]
+ return isinstance(toolset, str) and toolset or toolset(self.env)
+
+
+@conf
+def __boost_get_libs_path(self, *k, **kw):
+ ''' return the lib path and all the files in it '''
+ if 'files' in kw:
+ return self.root.find_dir('.'), Utils.to_list(kw['files'])
+ libs = k and k[0] or kw.get('libs', None)
+ if libs:
+ path = self.root.find_dir(libs)
+ files = path.ant_glob('*boost_*')
+ if not libs or not files:
+ for d in Utils.to_list(self.environ.get('LIB', [])) + BOOST_LIBS:
+ path = self.root.find_dir(d)
+ if path:
+ files = path.ant_glob('*boost_*')
+ if files:
+ break
+ path = self.root.find_dir(d + '64')
+ if path:
+ files = path.ant_glob('*boost_*')
+ if files:
+ break
+ if not path:
+ if libs:
+ self.end_msg('libs not found in %s' % libs)
+ self.fatal('The configuration failed')
+ else:
+ self.end_msg('libs not found, please provide a --boost-libs argument (see help)')
+ self.fatal('The configuration failed')
+
+ self.to_log('Found the boost path in %r with the libraries:' % path)
+ for x in files:
+ self.to_log(' %r' % x)
+ return path, files
+
+@conf
+def boost_get_libs(self, *k, **kw):
+ '''
+ return the lib path and the required libs
+ according to the parameters
+ '''
+ path, files = self.__boost_get_libs_path(**kw)
+ t = []
+ if kw.get('mt', False):
+ t.append('mt')
+ if kw.get('abi', None):
+ t.append(kw['abi'])
+ tags = t and '(-%s)+' % '-'.join(t) or ''
+ toolset = self.boost_get_toolset(kw.get('toolset', ''))
+ toolset_pat = '(-%s[0-9]{0,3})+' % toolset
+ version = '(-%s)+' % self.env.BOOST_VERSION
+
+ def find_lib(re_lib, files):
+ for file in files:
+ if re_lib.search(file.name):
+ self.to_log('Found boost lib %s' % file)
+ return file
+ return None
+
+ def format_lib_name(name):
+ if name.startswith('lib') and self.env.CC_NAME != 'msvc':
+ name = name[3:]
+ return name[:name.rfind('.')]
+
+ libs = []
+ for lib in Utils.to_list(k and k[0] or kw.get('lib', None)):
+ py = (lib == 'python') and '(-py%s)+' % kw['python'] or ''
+ # Trying libraries, from most strict match to least one
+ for pattern in ['boost_%s%s%s%s%s' % (lib, toolset_pat, tags, py, version),
+ 'boost_%s%s%s%s' % (lib, tags, py, version),
+ 'boost_%s%s%s' % (lib, tags, version),
+ # Give up trying to find the right version
+ 'boost_%s%s%s%s' % (lib, toolset_pat, tags, py),
+ 'boost_%s%s%s' % (lib, tags, py),
+ 'boost_%s%s' % (lib, tags)]:
+ self.to_log('Trying pattern %s' % pattern)
+ file = find_lib(re.compile(pattern), files)
+ if file:
+ libs.append(format_lib_name(file.name))
+ break
+ else:
+ self.end_msg('lib %s not found in %s' % (lib, path.abspath()))
+ self.fatal('The configuration failed')
+
+ return path.abspath(), libs
+
+
+@conf
+def check_boost(self, *k, **kw):
+ """
+ Initialize boost libraries to be used.
+
+ Keywords: you can pass the same parameters as with the command line (without "--boost-").
+ Note that the command line has the priority, and should preferably be used.
+ """
+ if not self.env['CXX']:
+ self.fatal('load a c++ compiler first, conf.load("compiler_cxx")')
+
+ params = {'lib': k and k[0] or kw.get('lib', None)}
+ for key, value in self.options.__dict__.items():
+ if not key.startswith('boost_'):
+ continue
+ key = key[len('boost_'):]
+ params[key] = value and value or kw.get(key, '')
+
+ var = kw.get('uselib_store', 'BOOST')
+
+ self.start_msg('Checking boost includes')
+ self.env['INCLUDES_%s' % var] = inc = self.boost_get_includes(**params)
+ versions = self.boost_get_version(inc)
+ self.env.BOOST_VERSION = versions[0]
+ self.env.BOOST_VERSION_NUMBER = int(versions[1])
+ self.end_msg("%d.%d.%d" % (int(versions[1]) / 100000,
+ int(versions[1]) / 100 % 1000,
+ int(versions[1]) % 100))
+ if Logs.verbose:
+ Logs.pprint('CYAN', ' path : %s' % self.env['INCLUDES_%s' % var])
+
+ if not params['lib']:
+ return
+ self.start_msg('Checking boost libs')
+ suffix = params.get('static', None) and 'ST' or ''
+ path, libs = self.boost_get_libs(**params)
+ self.env['%sLIBPATH_%s' % (suffix, var)] = [path]
+ self.env['%sLIB_%s' % (suffix, var)] = libs
+ self.end_msg('ok')
+ if Logs.verbose:
+ Logs.pprint('CYAN', ' path : %s' % path)
+ Logs.pprint('CYAN', ' libs : %s' % libs)
+
+
+ def try_link():
+ if 'system' in params['lib']:
+ self.check_cxx(
+ fragment="\n".join([
+ '#include <boost/system/error_code.hpp>',
+ 'int main() { boost::system::error_code c; }',
+ ]),
+ use=var,
+ execute=False,
+ )
+ if 'thread' in params['lib']:
+ self.check_cxx(
+ fragment="\n".join([
+ '#include <boost/thread.hpp>',
+ 'int main() { boost::thread t; }',
+ ]),
+ use=var,
+ execute=False,
+ )
+
+ if params.get('linkage_autodetect', False):
+ self.start_msg("Attempting to detect boost linkage flags")
+ toolset = self.boost_get_toolset(kw.get('toolset', ''))
+ if toolset in ['vc']:
+ # disable auto-linking feature, causing error LNK1181
+ # because the code wants to be linked against
+ self.env['DEFINES_%s' % var] += ['BOOST_ALL_NO_LIB']
+
+ # if no dlls are present, we guess the .lib files are not stubs
+ has_dlls = False
+ for x in Utils.listdir(path):
+ if x.endswith(self.env.cxxshlib_PATTERN % ''):
+ has_dlls = True
+ break
+ if not has_dlls:
+ self.env['STLIBPATH_%s' % var] = [path]
+ self.env['STLIB_%s' % var] = libs
+ del self.env['LIB_%s' % var]
+ del self.env['LIBPATH_%s' % var]
+
+ # we attempt to play with some known-to-work CXXFLAGS combinations
+ for cxxflags in (['/MD', '/EHsc'], []):
+ self.env.stash()
+ self.env["CXXFLAGS_%s" % var] += cxxflags
+ try:
+ try_link()
+ self.end_msg("ok: winning cxxflags combination: %s" % (self.env["CXXFLAGS_%s" % var]))
+ e = None
+ break
+ except Errors.ConfigurationError as exc:
+ self.env.revert()
+ e = exc
+
+ if e is not None:
+ self.end_msg("Could not auto-detect boost linking flags combination, you may report it to boost.py author", ex=e)
+ self.fatal('The configuration failed')
+ else:
+ self.end_msg("Boost linkage flags auto-detection not implemented (needed ?) for this toolchain")
+ self.fatal('The configuration failed')
+ else:
+ self.start_msg('Checking for boost linkage')
+ try:
+ try_link()
+ except Errors.ConfigurationError as e:
+ self.end_msg("Could not link against boost libraries using supplied options")
+ self.fatal('The configuration failed')
+ self.end_msg('ok')
diff --git a/rib/.waf-tools/coverage.py b/rib/.waf-tools/coverage.py
new file mode 100644
index 0000000..eac7608
--- /dev/null
+++ b/rib/.waf-tools/coverage.py
@@ -0,0 +1,20 @@
+# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+from waflib import TaskGen
+
+def options(opt):
+ opt.add_option('--with-coverage',action='store_true',default=False,dest='with_coverage',
+ help='''Set compiler flags for gcc to enable code coverage information''')
+
+def configure(conf):
+ if conf.options.with_coverage:
+ conf.check_cxx(cxxflags=['-fprofile-arcs', '-ftest-coverage', '-fPIC'],
+ linkflags=['-fprofile-arcs'], uselib_store='GCOV', mandatory=True)
+
+@TaskGen.feature('cxx','cc')
+@TaskGen.after('process_source')
+def add_coverage(self):
+ if getattr(self, 'use', ''):
+ self.use += ' GCOV'
+ else:
+ self.use = 'GCOV'
diff --git a/rib/.waf-tools/doxygen.py b/rib/.waf-tools/doxygen.py
new file mode 100644
index 0000000..aebb511
--- /dev/null
+++ b/rib/.waf-tools/doxygen.py
@@ -0,0 +1,204 @@
+#! /usr/bin/env python
+# encoding: UTF-8
+# Thomas Nagy 2008-2010 (ita)
+
+"""
+
+Doxygen support
+
+Variables passed to bld():
+* doxyfile -- the Doxyfile to use
+
+When using this tool, the wscript will look like:
+
+ def options(opt):
+ opt.load('doxygen')
+
+ def configure(conf):
+ conf.load('doxygen')
+ # check conf.env.DOXYGEN, if it is mandatory
+
+ def build(bld):
+ if bld.env.DOXYGEN:
+ bld(features="doxygen", doxyfile='Doxyfile', ...)
+"""
+
+from fnmatch import fnmatchcase
+import os, os.path, re, stat
+from waflib import Task, Utils, Node, Logs, Errors
+from waflib.TaskGen import feature
+
+DOXY_STR = '"${DOXYGEN}" - '
+DOXY_FMTS = 'html latex man rft xml'.split()
+DOXY_FILE_PATTERNS = '*.' + ' *.'.join('''
+c cc cxx cpp c++ java ii ixx ipp i++ inl h hh hxx hpp h++ idl odl cs php php3
+inc m mm py f90c cc cxx cpp c++ java ii ixx ipp i++ inl h hh hxx
+'''.split())
+
+re_rl = re.compile('\\\\\r*\n', re.MULTILINE)
+re_nl = re.compile('\r*\n', re.M)
+def parse_doxy(txt):
+ tbl = {}
+ txt = re_rl.sub('', txt)
+ lines = re_nl.split(txt)
+ for x in lines:
+ x = x.strip()
+ if not x or x.startswith('#') or x.find('=') < 0:
+ continue
+ if x.find('+=') >= 0:
+ tmp = x.split('+=')
+ key = tmp[0].strip()
+ if key in tbl:
+ tbl[key] += ' ' + '+='.join(tmp[1:]).strip()
+ else:
+ tbl[key] = '+='.join(tmp[1:]).strip()
+ else:
+ tmp = x.split('=')
+ tbl[tmp[0].strip()] = '='.join(tmp[1:]).strip()
+ return tbl
+
+class doxygen(Task.Task):
+ vars = ['DOXYGEN', 'DOXYFLAGS']
+ color = 'BLUE'
+
+ def runnable_status(self):
+ '''
+ self.pars are populated in runnable_status - because this function is being
+ run *before* both self.pars "consumers" - scan() and run()
+
+ set output_dir (node) for the output
+ '''
+
+ for x in self.run_after:
+ if not x.hasrun:
+ return Task.ASK_LATER
+
+ if not getattr(self, 'pars', None):
+ txt = self.inputs[0].read()
+ self.pars = parse_doxy(txt)
+ if not self.pars.get('OUTPUT_DIRECTORY'):
+ self.pars['OUTPUT_DIRECTORY'] = self.inputs[0].parent.get_bld().abspath()
+
+ # Override with any parameters passed to the task generator
+ if getattr(self.generator, 'pars', None):
+ for k, v in self.generator.pars.iteritems():
+ self.pars[k] = v
+
+ self.doxy_inputs = getattr(self, 'doxy_inputs', [])
+ if not self.pars.get('INPUT'):
+ self.doxy_inputs.append(self.inputs[0].parent)
+ else:
+ for i in self.pars.get('INPUT').split():
+ if os.path.isabs(i):
+ node = self.generator.bld.root.find_node(i)
+ else:
+ node = self.generator.path.find_node(i)
+ if not node:
+ self.generator.bld.fatal('Could not find the doxygen input %r' % i)
+ self.doxy_inputs.append(node)
+
+ if not getattr(self, 'output_dir', None):
+ bld = self.generator.bld
+ # First try to find an absolute path, then find or declare a relative path
+ self.output_dir = bld.root.find_dir(self.pars['OUTPUT_DIRECTORY'])
+ if not self.output_dir:
+ self.output_dir = bld.path.find_or_declare(self.pars['OUTPUT_DIRECTORY'])
+
+ self.signature()
+ return Task.Task.runnable_status(self)
+
+ def scan(self):
+ exclude_patterns = self.pars.get('EXCLUDE_PATTERNS','').split()
+ file_patterns = self.pars.get('FILE_PATTERNS','').split()
+ if not file_patterns:
+ file_patterns = DOXY_FILE_PATTERNS
+ if self.pars.get('RECURSIVE') == 'YES':
+ file_patterns = ["**/%s" % pattern for pattern in file_patterns]
+ nodes = []
+ names = []
+ for node in self.doxy_inputs:
+ if os.path.isdir(node.abspath()):
+ for m in node.ant_glob(incl=file_patterns, excl=exclude_patterns):
+ nodes.append(m)
+ else:
+ nodes.append(node)
+ return (nodes, names)
+
+ def run(self):
+ dct = self.pars.copy()
+ dct['INPUT'] = ' '.join(['"%s"' % x.abspath() for x in self.doxy_inputs])
+ code = '\n'.join(['%s = %s' % (x, dct[x]) for x in self.pars])
+ code = code.encode() # for python 3
+ #fmt = DOXY_STR % (self.inputs[0].parent.abspath())
+ cmd = Utils.subst_vars(DOXY_STR, self.env)
+ env = self.env.env or None
+ proc = Utils.subprocess.Popen(cmd, shell=True, stdin=Utils.subprocess.PIPE, env=env, cwd=self.generator.bld.path.get_bld().abspath())
+ proc.communicate(code)
+ return proc.returncode
+
+ def post_run(self):
+ nodes = self.output_dir.ant_glob('**/*', quiet=True)
+ for x in nodes:
+ x.sig = Utils.h_file(x.abspath())
+ self.outputs += nodes
+ return Task.Task.post_run(self)
+
+class tar(Task.Task):
+ "quick tar creation"
+ run_str = '${TAR} ${TAROPTS} ${TGT} ${SRC}'
+ color = 'RED'
+ after = ['doxygen']
+ def runnable_status(self):
+ for x in getattr(self, 'input_tasks', []):
+ if not x.hasrun:
+ return Task.ASK_LATER
+
+ if not getattr(self, 'tar_done_adding', None):
+ # execute this only once
+ self.tar_done_adding = True
+ for x in getattr(self, 'input_tasks', []):
+ self.set_inputs(x.outputs)
+ if not self.inputs:
+ return Task.SKIP_ME
+ return Task.Task.runnable_status(self)
+
+ def __str__(self):
+ tgt_str = ' '.join([a.nice_path(self.env) for a in self.outputs])
+ return '%s: %s\n' % (self.__class__.__name__, tgt_str)
+
+@feature('doxygen')
+def process_doxy(self):
+ if not getattr(self, 'doxyfile', None):
+ self.generator.bld.fatal('no doxyfile??')
+
+ node = self.doxyfile
+ if not isinstance(node, Node.Node):
+ node = self.path.find_resource(node)
+ if not node:
+ raise ValueError('doxygen file not found')
+
+ # the task instance
+ dsk = self.create_task('doxygen', node)
+
+ if getattr(self, 'doxy_tar', None):
+ tsk = self.create_task('tar')
+ tsk.input_tasks = [dsk]
+ tsk.set_outputs(self.path.find_or_declare(self.doxy_tar))
+ if self.doxy_tar.endswith('bz2'):
+ tsk.env['TAROPTS'] = ['cjf']
+ elif self.doxy_tar.endswith('gz'):
+ tsk.env['TAROPTS'] = ['czf']
+ else:
+ tsk.env['TAROPTS'] = ['cf']
+
+def configure(conf):
+ '''
+ Check if doxygen and tar commands are present in the system
+
+ If the commands are present, then conf.env.DOXYGEN and conf.env.TAR
+ variables will be set. Detection can be controlled by setting DOXYGEN and
+ TAR environmental variables.
+ '''
+
+ conf.find_program('doxygen', var='DOXYGEN', mandatory=False)
+ conf.find_program('tar', var='TAR', mandatory=False)
diff --git a/rib/.waf-tools/flags.py b/rib/.waf-tools/flags.py
new file mode 100644
index 0000000..dea80b8
--- /dev/null
+++ b/rib/.waf-tools/flags.py
@@ -0,0 +1,52 @@
+# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+from waflib import Logs, Configure
+
+def configure(conf):
+ areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
+ if conf.options.debug:
+ conf.define('_DEBUG', 1)
+ defaultFlags = ['-O0', '-g3',
+ '-Werror',
+ '-Wall',
+ '-fcolor-diagnostics', # only clang supports
+
+ # # to disable known warnings
+ # '-Wno-unused-variable', # cryptopp
+ # '-Wno-unused-function',
+ # '-Wno-deprecated-declarations',
+ ]
+
+ if areCustomCxxflagsPresent:
+ missingFlags = [x for x in defaultFlags if x not in conf.env.CXXFLAGS]
+ if len(missingFlags) > 0:
+ Logs.warn("Selected debug mode, but CXXFLAGS is set to a custom value '%s'"
+ % " ".join(conf.env.CXXFLAGS))
+ Logs.warn("Default flags '%s' are not activated" % " ".join(missingFlags))
+ else:
+ conf.add_supported_cxxflags(cxxflags=defaultFlags)
+ else:
+ defaultFlags = ['-O2', '-g', '-Wall',
+
+ # # to disable known warnings
+ # '-Wno-unused-variable', # cryptopp
+ # '-Wno-unused-function',
+ # '-Wno-deprecated-declarations',
+ ]
+ if not areCustomCxxflagsPresent:
+ conf.add_supported_cxxflags(cxxflags=defaultFlags)
+
+@Configure.conf
+def add_supported_cxxflags(self, cxxflags):
+ """
+ Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable
+ """
+ self.start_msg('Checking allowed flags for c++ compiler')
+
+ supportedFlags = []
+ for flag in cxxflags:
+ if self.check_cxx (cxxflags=[flag], mandatory=False):
+ supportedFlags += [flag]
+
+ self.end_msg (' '.join (supportedFlags))
+ self.env.CXXFLAGS += supportedFlags
diff --git a/rib/INSTALL.md b/rib/INSTALL.md
new file mode 100644
index 0000000..868a8d1
--- /dev/null
+++ b/rib/INSTALL.md
@@ -0,0 +1,16 @@
+## Prerequisites
+
+* Boost libraries >= 1.48
+* [NDN-CPP-dev library](https://github.com/named-data/ndn-cpp-dev)
+* `pkg-config`
+
+## Build
+
+The following commands should be used to build NRD:
+
+ ./waf configure
+ ./waf
+
+If NRD needs to be installed
+
+ sudo ./waf install
diff --git a/rib/README.md b/rib/README.md
new file mode 100644
index 0000000..fbbe11a
--- /dev/null
+++ b/rib/README.md
@@ -0,0 +1,67 @@
+NRD (NDN Routing Daemon)
+========================
+NRD works in parallel with NFD and provides services for prefix registration.
+
+For installation details please see INSTALL.md.
+
+## Default Paths
+
+This README uses `SYSCONFDIR` when referring to the default locations of
+various configuration files. By default, `SYSCONFDIR` is set to
+`/usr/local/etc`. If you override just `PREFIX`, then `SYSCONFDIR` will
+default to `PREFIX/etc`.
+
+You may override `SYSCONFDIR` and/or `PREFIX` by specifying their
+corresponding options during configuration:
+
+ ./waf configure --prefix <path/for/prefix> --sysconfdir <some/other/path>
+
+## Running and Configuring NRD
+
+NRD's runtime settings may be modified via configuration file. After
+installation, a working sample configuration is provided at
+`SYSCONFDIR/ndn/nrd.conf.sample`. At startup, NRD will attempt to
+read the default configuration file from following location:
+`SYSCONFDIR/ndn/nrd.conf`.
+
+You may also specify an alternative configuration file location
+by running NRD with:
+
+ nrd --config </path/to/nrd.conf>
+
+Currently, nrd.conf contains only a security section, which is well documented
+in the sample configuration file.
+
+## Starting experiments
+
+1. Build, install and setup NFD by following the directions provided in
+README.md in NFD root folder.
+
+2. Create certificates by following the instructions in NFD's README.md
+
+3. Build and install NRD by following the directions in INSTALL.md
+
+4. Create nrd.conf file. You can simply copy the provided sample file in
+`SYSCONFDIR/ndn/nrd.conf`.
+
+5. Setup the trust-anchors in nrd.conf. Ideally, the prefix registration
+Interest should be signed by application/user key, and this application/user
+key should be used as trust-anchor. However, currently the default certificate
+is used to sign the registration Interests. Therefore, for initial testing the
+default certificate should be set as the trust-anchor. For doing so, the default
+certificate should be copied in the same folder where the nrd.conf is.
+Secondly, the trust-anchor should point to the copied certificate in nrd.conf.
+To know the id of default certificate you can use:
+
+ ~$ ndnsec-get-default
+
+6. Start NFD (assuming the NFD's conf file exist in `SYSCONFDIR/ndn/nfd.conf`):
+
+ ~$ nfd
+
+7. Start NRD (assuming the conf file exist in `SYSCONFDIR/ndn/nrd.conf`):
+
+ ~$ nrd
+
+8. Try to connect any application to NFD. For example, producer application that is provided
+ndn-cpp-dev examples.
diff --git a/rib/nrd.conf.sample b/rib/nrd.conf.sample
new file mode 100644
index 0000000..35b162f
--- /dev/null
+++ b/rib/nrd.conf.sample
@@ -0,0 +1,70 @@
+security
+{
+ ; Security section defines the trust model that NRD should use. It consists of rules and
+ ; trust-anchors, which are briefly defined in this file. For more details please see the
+ ; following wiki:
+ ; http://redmine.named-data.net/projects/ndn-cpp-dev/wiki/CommandValidatorConf
+ ;
+ ; A trust-anchor is a pre-trusted certificate. It is usually stored in a file in the
+ ; same directory as this config file. You can download the NDN testbed root certificate as the
+ ; trust anchor, or you can dump an existing certificate from your system as a trust anchor:
+ ; $ ndnsec cert-dump /example/certificate/name > trust-anchor.cert
+ ; or you can generate a self-signed certificate as a trust anchor:
+ ; $ ndnsec key-gen /example/identity/name > trust-anchor.cert
+ ; See comments in trust-anchor section for configuration details.
+ ;
+ ; A rule defines conditions a valid packet MUST have. A packet must satisfy one of the rules defined
+ ; here. A rule can be broken into two parts: matching & checking. A packet will be matched against
+ ; rules from the first to the last until a matched rule is encountered. The matched rule will be
+ ; used to check the packet. If a packet does not match any rule, it will be treated as invalid.
+ ; The matching part of a rule consists of `for` and `filter` sections. They collectively define
+ ; which packets can be checked with this rule. `for` defines packet type (data or interest),
+ ; while `filter` defines conditions on other properties of a packet. Right now, you can only
+ ; define conditions on packet name, and you can only specify ONLY ONE filter for packet name.
+ ; The checking part of a rule consists of `checker`, which defines the conditions that a VALID
+ ; packet MUST have. See comments in checker section for more details.
+
+ rule
+ {
+ id "NRD Prefix Registration Command Rule" ; rule id
+ for interest ; this rule is used to validate interests
+ filter
+ {
+ type name ; condition on interest name (w/o signature)
+ regex ^[<localhop><localhost>]<nrd>[<register><unregister>]<>{3}$
+ }
+ checker
+ {
+ type customized
+ sig-type rsa-sha256 ; interest must have a rsa-sha256 signature
+ key-locator
+ {
+ type name ; key locator must be the certificate name of
+ ; the signing key
+ regex ^[^<KEY>]*<KEY><>*<ksk-.*><ID-CERT>$
+ }
+ }
+ }
+ rule
+ {
+ id "Testbed Hierarchy Rule" ; rule id
+ for data ; this rule is used to validate data
+ filter
+ {
+ type name ; condition on data name
+ regex ^[^<KEY>]*<KEY><>*<ksk-.*><ID-CERT><>$
+ }
+ checker
+ {
+ type hierarchical ; the certificate name of the signing key and
+ ; the data name must follow the hierarchical model
+ sig-type rsa-sha256 ; data must have a rsa-sha256 signature
+ }
+ }
+ trust-anchor
+ {
+ type file ; trust anchor is stored in a file
+ file-name "trust-anchor.cert" ; the file name, by default this file should be placed in the
+ ; same folder as this config file.
+ }
+}
diff --git a/rib/src/common.hpp b/rib/src/common.hpp
new file mode 100644
index 0000000..f520828
--- /dev/null
+++ b/rib/src/common.hpp
@@ -0,0 +1,45 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NRD_COMMON_HPP
+#define NRD_COMMON_HPP
+
+#include <iostream>
+#include <list>
+
+#include <ndn-cpp-dev/face.hpp>
+#include <ndn-cpp-dev/security/key-chain.hpp>
+#include <ndn-cpp-dev/security/validator-config.hpp>
+#include <ndn-cpp-dev/util/scheduler.hpp>
+
+#include <ndn-cpp-dev/management/nfd-controller.hpp>
+#include <ndn-cpp-dev/management/nfd-control-response.hpp>
+#include <ndn-cpp-dev/management/nrd-prefix-reg-options.hpp>
+
+#include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/regex_find_format.hpp>
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/info_parser.hpp>
+
+#include "../build/src/config.hpp"
+
+namespace ndn {
+namespace nrd {
+
+class Error : public std::runtime_error
+{
+public:
+ explicit
+ Error(const std::string& what)
+ : std::runtime_error(what)
+ {
+ }
+};
+
+} //namespace nrd
+} //namespace ndn
+#endif // NRD_COMMON_HPP
diff --git a/rib/src/face-monitor.cpp b/rib/src/face-monitor.cpp
new file mode 100644
index 0000000..f434523
--- /dev/null
+++ b/rib/src/face-monitor.cpp
@@ -0,0 +1,149 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2014 Regents of the University of California.
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "common.hpp"
+#include "face-monitor.hpp"
+#include <ndn-cpp-dev/management/nfd-face-event-notification.hpp>
+
+
+namespace ndn {
+
+using namespace nfd;
+
+FaceMonitor::FaceMonitor(Face& face)
+ : m_face(face)
+ , m_isStopped(true)
+{
+}
+
+FaceMonitor::~FaceMonitor()
+{
+}
+
+void
+FaceMonitor::removeAllSubscribers()
+{
+ m_notificationCallbacks.clear();
+ m_timeoutCallbacks.clear();
+ stopNotifications();
+}
+
+void
+FaceMonitor::stopNotifications()
+{
+ if (static_cast<bool>(m_lastInterestId))
+ m_face.removePendingInterest(m_lastInterestId);
+ m_isStopped = true;
+}
+
+void
+FaceMonitor::startNotifications()
+{
+ if (m_isStopped == false)
+ return; // Notifications cycle has been started.
+ m_isStopped = false;
+
+ Interest interest("/localhost/nfd/faces/events");
+ interest
+ .setMustBeFresh(true)
+ .setChildSelector(1)
+ .setInterestLifetime(time::seconds(60))
+ ;
+
+ //todo: add logging support.
+ std::cout << "startNotification: Interest Sent: " << interest << std::endl;
+
+ m_lastInterestId = m_face.expressInterest(interest,
+ bind(&FaceMonitor::onNotification, this, _2),
+ bind(&FaceMonitor::onTimeout, this));
+}
+
+void
+FaceMonitor::addSubscriber(const NotificationCallback& notificationCallback)
+{
+ addSubscriber(notificationCallback, TimeoutCallback());
+}
+
+void
+FaceMonitor::addSubscriber(const NotificationCallback& notificationCallback,
+ const TimeoutCallback& timeoutCallback)
+{
+ if (static_cast<bool>(notificationCallback))
+ m_notificationCallbacks.push_back(notificationCallback);
+
+ if (static_cast<bool>(timeoutCallback))
+ m_timeoutCallbacks.push_back(timeoutCallback);
+}
+
+void
+FaceMonitor::onTimeout()
+{
+ if (m_isStopped)
+ return;
+
+ std::vector<TimeoutCallback>::iterator it;
+ for (it = m_timeoutCallbacks.begin();
+ it != m_timeoutCallbacks.end(); ++it) {
+ (*it)();
+ //One of the registered callbacks has cleared the vector,
+ //return now as the iterator has been invalidated and
+ //the vector is empty.
+ if (m_timeoutCallbacks.empty()) {
+ return;
+ }
+ }
+
+ Interest newInterest("/localhost/nfd/faces/events");
+ newInterest
+ .setMustBeFresh(true)
+ .setChildSelector(1)
+ .setInterestLifetime(time::seconds(60))
+ ;
+
+ //todo: add logging support.
+ std::cout << "In onTimeout, sending interest: " << newInterest << std::endl;
+
+ m_lastInterestId = m_face.expressInterest(newInterest,
+ bind(&FaceMonitor::onNotification, this, _2),
+ bind(&FaceMonitor::onTimeout, this));
+}
+
+void
+FaceMonitor::onNotification(const Data& data)
+{
+ if (m_isStopped)
+ return;
+
+ m_lastSequence = data.getName().get(-1).toSegment();
+ ndn::nfd::FaceEventNotification notification(data.getContent().blockFromValue());
+
+ std::vector<NotificationCallback>::iterator it;
+ for (it = m_notificationCallbacks.begin();
+ it != m_notificationCallbacks.end(); ++it) {
+ (*it)(notification);
+ if (m_notificationCallbacks.empty()) {
+ //One of the registered callbacks has cleared the vector.
+ //return back, as no one is interested in notifications anymore.
+ return;
+ }
+ }
+
+ //Setting up next notification
+ Name nextNotification("/localhost/nfd/faces/events");
+ nextNotification.appendSegment(m_lastSequence + 1);
+
+ Interest interest(nextNotification);
+ interest.setInterestLifetime(time::seconds(60));
+
+ //todo: add logging support.
+ std::cout << "onNotification: Interest sent: " << interest << std::endl;
+
+ m_lastInterestId = m_face.expressInterest(interest,
+ bind(&FaceMonitor::onNotification, this, _2),
+ bind(&FaceMonitor::onTimeout, this));
+}
+
+}//namespace ndn
diff --git a/rib/src/face-monitor.hpp b/rib/src/face-monitor.hpp
new file mode 100644
index 0000000..e0eeaa6
--- /dev/null
+++ b/rib/src/face-monitor.hpp
@@ -0,0 +1,72 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2014 Regents of the University of California.
+ * See COPYING for copyright and distribution information.
+ */
+#ifndef FACE_MONITOR_HPP
+#define FACE_MONITOR_HPP
+
+#include "common.hpp"
+#include <ndn-cpp-dev/management/nfd-face-event-notification.hpp>
+#include <ndn-cpp-dev/management/nrd-controller.hpp>
+
+namespace ndn {
+
+class FaceMonitor
+{
+public:
+ typedef function<void(const nfd::FaceEventNotification&)> NotificationCallback;
+ typedef function<void()> TimeoutCallback;
+
+ typedef std::vector<NotificationCallback> NotificationCallbacks;
+ typedef std::vector<TimeoutCallback> TimeoutCallbacks;
+
+ explicit
+ FaceMonitor(Face& face);
+
+ ~FaceMonitor();
+
+ /** \brief Stops all notifications. This method doesn't remove registered callbacks.
+ */
+ void
+ stopNotifications();
+
+ /** \brief Resumes notifications for added subscribers.
+ */
+ void
+ startNotifications();
+
+ /** \brief Removes all notification subscribers.
+ */
+ void
+ removeAllSubscribers();
+
+ /** \brief Adds a notification subscriber. This method doesn't return on timeouts.
+ */
+ void
+ addSubscriber(const NotificationCallback& notificationCallback);
+
+ /** \brief Adds a notification subscriber.
+ */
+ void
+ addSubscriber(const NotificationCallback& notificationCallback,
+ const TimeoutCallback& timeoutCallback);
+
+private:
+ void
+ onTimeout();
+
+ void
+ onNotification(const Data& data);
+
+private:
+ Face& m_face;
+ uint64_t m_lastSequence;
+ bool m_isStopped;
+ NotificationCallbacks m_notificationCallbacks;
+ TimeoutCallbacks m_timeoutCallbacks;
+ const PendingInterestId* m_lastInterestId;
+};
+
+}//namespace ndn
+#endif //FACE_MONITOR_HPP
diff --git a/rib/src/main.cpp b/rib/src/main.cpp
new file mode 100644
index 0000000..5d0e5ed
--- /dev/null
+++ b/rib/src/main.cpp
@@ -0,0 +1,100 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "common.hpp"
+#include "nrd.hpp"
+#include "nrd-config.hpp"
+#include <getopt.h>
+
+struct ProgramOptions
+{
+ bool showUsage;
+ std::string config;
+};
+
+static void
+printUsage(std::ostream& os, const std::string& programName)
+{
+ os << "Usage: \n"
+ << " " << programName << " [options]\n"
+ << "\n"
+ << "Run NRD daemon\n"
+ << "\n"
+ << "Options:\n"
+ << " [--help] - print this help message\n"
+ << " [--config /path/to/nrd.conf] - path to configuration file "
+ << "(default: " << DEFAULT_CONFIG_FILE << ")\n"
+ ;
+}
+
+static bool
+parseCommandLine(int argc, char** argv, ProgramOptions& options)
+{
+ options.showUsage = false;
+ options.config = DEFAULT_CONFIG_FILE;
+
+ while (true) {
+ int optionIndex = 0;
+ static ::option longOptions[] = {
+ { "help" , no_argument , 0, 0 },
+ { "config" , required_argument, 0, 0 },
+ { 0 , 0 , 0, 0 }
+ };
+ int c = getopt_long_only(argc, argv, "", longOptions, &optionIndex);
+ if (c == -1)
+ break;
+
+ switch (c) {
+ case 0:
+ switch (optionIndex) {
+ case 0: // help
+ options.showUsage = true;
+ break;
+ case 1: // config
+ options.config = ::optarg;
+ break;
+ default:
+ return false;
+ }
+ break;
+ }
+ }
+ return true;
+}
+
+int
+main(int argc, char** argv)
+{
+ //processing command line arguments, if available
+ ProgramOptions options;
+ bool isCommandLineValid = parseCommandLine(argc, argv, options);
+ if (!isCommandLineValid) {
+ printUsage(std::cerr, argv[0]);
+ return 1;
+ }
+ if (options.showUsage) {
+ printUsage(std::cout, argv[0]);
+ return 0;
+ }
+
+ //Now read the config file and pass the security section to validator
+ try {
+ std::string configFilename(options.config);
+
+ ndn::nrd::NrdConfig config;
+ config.load(configFilename);
+ ndn::nrd::ConfigSection securitySection = config.getSecuritySection();
+
+ ndn::nrd::Nrd nrd(securitySection, configFilename);
+ nrd.enableLocalControlHeader();
+ nrd.listen();
+ }
+ catch (std::exception& e) {
+ std::cerr << "ERROR: " << e.what() << std::endl;
+ }
+
+ return 0;
+}
diff --git a/rib/src/nrd-config.cpp b/rib/src/nrd-config.cpp
new file mode 100644
index 0000000..c6181f9
--- /dev/null
+++ b/rib/src/nrd-config.cpp
@@ -0,0 +1,116 @@
+#include "nrd-config.hpp"
+
+namespace ndn {
+namespace nrd {
+
+NrdConfig::NrdConfig()
+ : m_isSecuritySectionDefined(false)
+{
+}
+
+void
+NrdConfig::load(const std::string& filename)
+{
+ std::ifstream inputFile;
+ inputFile.open(filename.c_str());
+ if (!inputFile.good() || !inputFile.is_open())
+ {
+ std::string msg = "Failed to read configuration file: ";
+ msg += filename;
+ std::cerr << filename << std::endl;
+ throw Error(msg);
+ }
+ load(inputFile, filename);
+ inputFile.close();
+}
+
+void
+NrdConfig::load(const std::string& input, const std::string& filename)
+{
+ std::istringstream inputStream(input);
+ load(inputStream, filename);
+}
+
+void
+NrdConfig::load(std::istream& input, const std::string& filename)
+{
+ BOOST_ASSERT(!filename.empty());
+
+ ConfigSection ptree;
+ try
+ {
+ boost::property_tree::read_info(input, ptree);
+ }
+ catch (const boost::property_tree::info_parser_error& error)
+ {
+ std::stringstream msg;
+ msg << "Failed to parse configuration file";
+ msg << " " << filename;
+ msg << " " << error.message() << " line " << error.line();
+ throw Error(msg.str());
+ }
+ process(ptree, filename);
+}
+
+void
+NrdConfig::process(const ConfigSection& configSection,
+ const std::string& filename)
+{
+ BOOST_ASSERT(!filename.empty());
+
+ if (configSection.begin() == configSection.end())
+ {
+ std::string msg = "Error processing configuration file";
+ msg += ": ";
+ msg += filename;
+ msg += " no data";
+ throw Error(msg);
+ }
+
+ for (ConfigSection::const_iterator i = configSection.begin();
+ i != configSection.end(); ++i)
+ {
+ const std::string& sectionName = i->first;
+ const ConfigSection& section = i->second;
+
+ if (boost::iequals(sectionName, "security"))
+ {
+ onSectionSecurity(section, filename);
+ }
+ //Add more sections here as needed
+ //else if (boost::iequals(sectionName, "another-section"))
+ //{
+ //onSectionAnotherSection(section, filename);
+ //}
+ else
+ {
+ std::string msg = "Error processing configuration file";
+ msg += " ";
+ msg += filename;
+ msg += " unrecognized section: " + sectionName;
+ throw Error(msg);
+ }
+ }
+}
+
+void
+NrdConfig::onSectionSecurity(const ConfigSection& section,
+ const std::string& filename)
+{
+ if (!m_isSecuritySectionDefined) {
+ //setSecturitySection(section);
+ m_securitySection = section;
+ m_filename = filename;
+ m_isSecuritySectionDefined = true;
+ }
+ else {
+ std::string msg = "Error processing configuration file";
+ msg += " ";
+ msg += filename;
+ msg += " security section can appear only once";
+ throw Error(msg);
+ }
+}
+
+} //namespace nrd
+} //namespace ndn
diff --git a/rib/src/nrd-config.hpp b/rib/src/nrd-config.hpp
new file mode 100644
index 0000000..ee119f6
--- /dev/null
+++ b/rib/src/nrd-config.hpp
@@ -0,0 +1,61 @@
+#ifndef NRD_CONFIG_HPP
+#define NRD_CONFIG_HPP
+
+#include "common.hpp"
+
+namespace ndn {
+namespace nrd {
+
+typedef boost::property_tree::ptree ConfigSection;
+
+class NrdConfig
+{
+
+public:
+ NrdConfig();
+
+ virtual
+ ~NrdConfig()
+ {
+ }
+
+ void
+ load(const std::string& filename);
+
+ void
+ load(const std::string& input, const std::string& filename);
+
+ void
+ load(std::istream& input, const std::string& filename);
+
+ const ConfigSection&
+ getSecuritySection() const
+ {
+ return m_securitySection;
+ }
+
+private:
+ void
+ process(const ConfigSection& configSection,
+ const std::string& filename);
+
+ void
+ onSectionSecurity(const ConfigSection& section,
+ const std::string& filename);
+
+ const void
+ setSecturitySection(const ConfigSection& securitySection)
+ {
+ m_securitySection = securitySection;
+ }
+
+private:
+ bool m_isSecuritySectionDefined;
+ ConfigSection m_securitySection;
+ std::string m_filename;
+};
+
+}//namespace nrd
+}//namespace ndn
+
+#endif // NRD_CONFIG_HPP
diff --git a/rib/src/nrd.cpp b/rib/src/nrd.cpp
new file mode 100644
index 0000000..492f9c2
--- /dev/null
+++ b/rib/src/nrd.cpp
@@ -0,0 +1,304 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "nrd.hpp"
+
+namespace ndn {
+namespace nrd {
+
+const Name Nrd::COMMAND_PREFIX = "/localhost/nrd";
+const Name Nrd::REMOTE_COMMAND_PREFIX = "/localhop/nrd";
+
+const size_t Nrd::COMMAND_UNSIGNED_NCOMPS =
+ Nrd::COMMAND_PREFIX.size() +
+ 1 + // verb
+ 1; // verb options
+
+const size_t Nrd::COMMAND_SIGNED_NCOMPS =
+ Nrd::COMMAND_UNSIGNED_NCOMPS +
+ 4; // (timestamp, nonce, signed info tlv, signature tlv)
+
+const Nrd::VerbAndProcessor Nrd::COMMAND_VERBS[] =
+ {
+ VerbAndProcessor(
+ Name::Component("register"),
+ &Nrd::insertEntry
+ ),
+
+ VerbAndProcessor(
+ Name::Component("unregister"),
+ &Nrd::deleteEntry
+ ),
+ };
+
+Nrd::Nrd(const ndn::nrd::ConfigSection& securitySection,
+ const std::string& validatorConfig)
+ : m_face(new Face())
+ , m_nfdController(new nfd::Controller(*m_face))
+ , m_validator(m_face)
+ , m_faceMonitor(*m_face)
+ , m_verbDispatch(COMMAND_VERBS,
+ COMMAND_VERBS + (sizeof(COMMAND_VERBS) / sizeof(VerbAndProcessor)))
+{
+ //check whether the components of localhop and localhost prefixes are same
+ BOOST_ASSERT(COMMAND_PREFIX.size() == REMOTE_COMMAND_PREFIX.size());
+
+ //m_validator.load(validatorConfig);
+ m_validator.load(securitySection, validatorConfig);
+
+ std::cerr << "Setting interest filter on: " << COMMAND_PREFIX.toUri() << std::endl;
+ m_face->setController(m_nfdController);
+ m_face->setInterestFilter(COMMAND_PREFIX.toUri(),
+ bind(&Nrd::onRibRequest, this, _2),
+ bind(&Nrd::setInterestFilterFailed, this, _1, _2));
+
+ std::cerr << "Setting interest filter on: " << REMOTE_COMMAND_PREFIX.toUri() << std::endl;
+ m_face->setInterestFilter(REMOTE_COMMAND_PREFIX.toUri(),
+ bind(&Nrd::onRibRequest, this, _2),
+ bind(&Nrd::setInterestFilterFailed, this, _1, _2));
+
+ std::cerr << "Monitoring faces" << std::endl;
+ m_faceMonitor.addSubscriber(boost::bind(&Nrd::onNotification, this, _1));
+ m_faceMonitor.startNotifications();
+}
+
+void
+Nrd::setInterestFilterFailed(const Name& name, const std::string& msg)
+{
+ std::cerr << "Error in setting interest filter (" << name << "): " << msg << std::endl;
+ m_face->shutdown();
+}
+
+void
+Nrd::sendResponse(const Name& name,
+ const nfd::ControlResponse& response)
+{
+ const Block& encodedControl = response.wireEncode();
+
+ Data responseData(name);
+ responseData.setContent(encodedControl);
+
+ m_keyChain.sign(responseData);
+ m_face->put(responseData);
+}
+
+void
+Nrd::sendResponse(const Name& name,
+ uint32_t code,
+ const std::string& text)
+{
+ nfd::ControlResponse response(code, text);
+ sendResponse(name, response);
+}
+
+void
+Nrd::onRibRequest(const Interest& request)
+{
+ m_validator.validate(request,
+ bind(&Nrd::onRibRequestValidated, this, _1),
+ bind(&Nrd::onRibRequestValidationFailed, this, _1, _2));
+}
+
+void
+Nrd::onRibRequestValidated(const shared_ptr<const Interest>& request)
+{
+ const Name& command = request->getName();
+
+ //REMOTE_COMMAND_PREFIX number of componenets are same as
+ // NRD_COMMAND_PREFIX's so no extra checks are required.
+ const Name::Component& verb = command.get(COMMAND_PREFIX.size());
+ VerbDispatchTable::const_iterator verbProcessor = m_verbDispatch.find(verb);
+
+ if (verbProcessor != m_verbDispatch.end())
+ {
+ PrefixRegOptions options;
+ if (!extractOptions(*request, options))
+ {
+ sendResponse(command, 400, "Malformed command");
+ return;
+ }
+
+ /// \todo authorize command
+ if (false)
+ {
+ sendResponse(request->getName(), 403, "Unauthorized command");
+ return;
+ }
+
+ // \todo add proper log support
+ std::cout << "Received options (name, faceid, cost): " << options.getName() <<
+ ", " << options.getFaceId() << ", " << options.getCost() << std::endl;
+
+ nfd::ControlResponse response;
+ (verbProcessor->second)(this, *request, options);
+ }
+ else
+ {
+ sendResponse(request->getName(), 501, "Unsupported command");
+ }
+}
+
+void
+Nrd::onRibRequestValidationFailed(const shared_ptr<const Interest>& request,
+ const std::string& failureInfo)
+{
+ sendResponse(request->getName(), 403, failureInfo);
+}
+
+bool
+Nrd::extractOptions(const Interest& request,
+ PrefixRegOptions& extractedOptions)
+{
+ // const Name& command = request.getName();
+ //REMOTE_COMMAND_PREFIX is same in size of NRD_COMMAND_PREFIX
+ //so no extra processing is required.
+ const size_t optionCompIndex = COMMAND_PREFIX.size() + 1;
+
+ try
+ {
+ Block rawOptions = request.getName()[optionCompIndex].blockFromValue();
+ extractedOptions.wireDecode(rawOptions);
+ }
+ catch (const ndn::Tlv::Error& e)
+ {
+ return false;
+ }
+
+ if (extractedOptions.getFaceId() == 0)
+ {
+ std::cout <<"IncomingFaceId: " << request.getIncomingFaceId() << std::endl;
+ extractedOptions.setFaceId(request.getIncomingFaceId());
+ }
+ return true;
+}
+
+void
+Nrd::onCommandError(uint32_t code, const std::string& error,
+ const Interest& request,
+ const PrefixRegOptions& options)
+{
+ std::cout << "NFD Error: " << error << " (code: " << code << ")" << std::endl;
+
+ nfd::ControlResponse response;
+
+ if (code == 404)
+ {
+ response.setCode(code);
+ response.setText(error);
+ }
+ else
+ {
+ response.setCode(533);
+ std::ostringstream os;
+ os << "Failure to update NFD " << "(NFD Error: " << code << " " << error << ")";
+ response.setText(os.str());
+ }
+
+ sendResponse(request.getName(), response);
+ m_managedRib.erase(options);
+}
+
+void
+Nrd::onUnRegSuccess(const Interest& request, const PrefixRegOptions& options)
+{
+ nfd::ControlResponse response;
+
+ response.setCode(200);
+ response.setText("Success");
+ response.setBody(options.wireEncode());
+
+ std::cout << "Success: Name unregistered (" <<
+ options.getName() << ", " <<
+ options.getFaceId() << ")" << std::endl;
+ sendResponse(request.getName(), response);
+ m_managedRib.erase(options);
+}
+
+void
+Nrd::onRegSuccess(const Interest& request, const PrefixRegOptions& options)
+{
+ nfd::ControlResponse response;
+
+ response.setCode(200);
+ response.setText("Success");
+ response.setBody(options.wireEncode());
+
+ std::cout << "Success: Name registered (" << options.getName() << ", " <<
+ options.getFaceId() << ")" << std::endl;
+ sendResponse(request.getName(), response);
+}
+
+void
+Nrd::insertEntry(const Interest& request, const PrefixRegOptions& options)
+{
+ // For right now, just pass the options to fib as it is,
+ // without processing flags. Later options will be first added to
+ // Rib tree, then nrd will generate fib updates based on flags and then
+ // will add next hops one by one..
+ m_managedRib.insert(options);
+ m_nfdController->start<nfd::FibAddNextHopCommand>(
+ nfd::ControlParameters()
+ .setName(options.getName())
+ .setFaceId(options.getFaceId())
+ .setCost(options.getCost()),
+ bind(&Nrd::onRegSuccess, this, request, options),
+ bind(&Nrd::onCommandError, this, _1, _2, request, options));
+}
+
+void
+Nrd::deleteEntry(const Interest& request, const PrefixRegOptions& options)
+{
+ m_nfdController->start<nfd::FibRemoveNextHopCommand>(
+ nfd::ControlParameters()
+ .setName(options.getName())
+ .setFaceId(options.getFaceId()),
+ bind(&Nrd::onUnRegSuccess, this, request, options),
+ bind(&Nrd::onCommandError, this, _1, _2, request, options));
+}
+
+void
+Nrd::listen()
+{
+ std::cout << "NRD started: listening for incoming interests" << std::endl;
+ m_face->processEvents();
+}
+
+void
+Nrd::onControlHeaderSuccess()
+{
+ std::cout << "Local control header enabled" << std::endl;
+}
+
+void
+Nrd::onControlHeaderError(uint32_t code, const std::string& reason)
+{
+ std::cout << "Error: couldn't enable local control header "
+ << "(code: " << code << ", info: " << reason << ")" << std::endl;
+ m_face->shutdown();
+}
+
+void
+Nrd::enableLocalControlHeader()
+{
+ m_nfdController->start<nfd::FaceEnableLocalControlCommand>(
+ nfd::ControlParameters()
+ .setLocalControlFeature(nfd::LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID),
+ bind(&Nrd::onControlHeaderSuccess, this),
+ bind(&Nrd::onControlHeaderError, this, _1, _2));
+}
+
+void
+Nrd::onNotification(const nfd::FaceEventNotification& notification)
+{
+ /// \todo A notification can be missed, in this case check Facelist
+ std::cerr << "Notification Rcvd: " << notification << std::endl;
+ if (notification.getKind() == ndn::nfd::FACE_EVENT_DESTROYED) { //face destroyed
+ m_managedRib.erase(notification.getFaceId());
+ }
+}
+
+} // namespace nrd
+} // namespace ndn
diff --git a/rib/src/nrd.hpp b/rib/src/nrd.hpp
new file mode 100644
index 0000000..d6007d7
--- /dev/null
+++ b/rib/src/nrd.hpp
@@ -0,0 +1,118 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NRD_HPP
+#define NRD_HPP
+
+#include "rib.hpp"
+#include "face-monitor.hpp"
+#include "nrd-config.hpp"
+
+namespace ndn {
+namespace nrd {
+
+class Nrd : noncopyable
+{
+public:
+ Nrd(const ndn::nrd::ConfigSection& securitySection,
+ const std::string& validatorConfig);
+
+ void
+ onRibRequest(const Interest& request);
+
+ void
+ enableLocalControlHeader();
+
+ void
+ listen();
+
+private:
+ void
+ sendResponse(const Name& name,
+ const nfd::ControlResponse& response);
+
+ void
+ sendResponse(const Name& name,
+ uint32_t code,
+ const std::string& text);
+
+ void
+ onRibRequestValidated(const shared_ptr<const Interest>& request);
+
+ void
+ onRibRequestValidationFailed(const shared_ptr<const Interest>& request,
+ const std::string& failureInfo);
+
+ void
+ onCommandError(uint32_t code, const std::string& error,
+ const ndn::Interest& interest,
+ const PrefixRegOptions& options);
+
+ void
+ onRegSuccess(const ndn::Interest& interest, const PrefixRegOptions& options);
+
+ void
+ onUnRegSuccess(const ndn::Interest& interest, const PrefixRegOptions& options);
+
+ void
+ onControlHeaderSuccess();
+
+ void
+ onControlHeaderError(uint32_t code, const std::string& reason);
+
+ void
+ setInterestFilterFailed(const Name& name, const std::string& msg);
+
+ void
+ insertEntry(const Interest& request, const PrefixRegOptions& options);
+
+ void
+ deleteEntry(const Interest& request, const PrefixRegOptions& options);
+
+ bool
+ extractOptions(const Interest& request,
+ PrefixRegOptions& extractedOptions);
+
+ void
+ onNotification(const nfd::FaceEventNotification& notification);
+
+private:
+ Rib m_managedRib;
+ ndn::shared_ptr<ndn::Face> m_face;
+ ndn::shared_ptr<nfd::Controller> m_nfdController;
+ ndn::KeyChain m_keyChain;
+ ndn::ValidatorConfig m_validator;
+ ndn::FaceMonitor m_faceMonitor;
+
+ typedef boost::function<void(Nrd*,
+ const Interest&,
+ const PrefixRegOptions&)> VerbProcessor;
+
+ typedef std::map<Name::Component, VerbProcessor> VerbDispatchTable;
+
+ typedef std::pair<Name::Component, VerbProcessor> VerbAndProcessor;
+
+
+ const VerbDispatchTable m_verbDispatch;
+
+ static const Name COMMAND_PREFIX; // /localhost/nrd
+ static const Name REMOTE_COMMAND_PREFIX; // /localhop/nrd
+
+ // number of components in an invalid, but not malformed, unsigned command.
+ // (/localhost/nrd + verb + options) = 4
+ static const size_t COMMAND_UNSIGNED_NCOMPS;
+
+ // number of components in a valid signed Interest.
+ // 5 in mock (see UNSIGNED_NCOMPS), 8 with signed Interest support.
+ static const size_t COMMAND_SIGNED_NCOMPS;
+
+ static const VerbAndProcessor COMMAND_VERBS[];
+};
+
+} // namespace nrd
+} // namespace ndn
+
+#endif // NRD_HPP
diff --git a/rib/src/rib.cpp b/rib/src/rib.cpp
new file mode 100644
index 0000000..4f1387b
--- /dev/null
+++ b/rib/src/rib.cpp
@@ -0,0 +1,90 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "rib.hpp"
+
+namespace ndn {
+namespace nrd {
+
+Rib::Rib()
+{
+}
+
+
+Rib::~Rib()
+{
+}
+
+static inline bool
+compareNameFaceProtocol(const PrefixRegOptions& opt1, const PrefixRegOptions& opt2)
+{
+ return (opt1.getName() == opt2.getName() &&
+ opt1.getFaceId() == opt2.getFaceId() &&
+ opt1.getProtocol() == opt2.getProtocol());
+}
+
+
+Rib::const_iterator
+Rib::find(const PrefixRegOptions& options) const
+{
+ RibTable::const_iterator it = std::find_if(m_rib.begin(), m_rib.end(),
+ bind(&compareNameFaceProtocol, _1, options));
+ if (it == m_rib.end())
+ {
+ return end();
+ }
+ else
+ return it;
+}
+
+
+void
+Rib::insert(const PrefixRegOptions& options)
+{
+ RibTable::iterator it = std::find_if(m_rib.begin(), m_rib.end(),
+ bind(&compareNameFaceProtocol, _1, options));
+ if (it == m_rib.end())
+ {
+ m_rib.push_front(options);
+ }
+ else
+ {
+ //entry exist, update other fields
+ it->setFlags(options.getFlags());
+ it->setCost(options.getCost());
+ it->setExpirationPeriod(options.getExpirationPeriod());
+ it->setProtocol(options.getProtocol());
+ }
+}
+
+
+void
+Rib::erase(const PrefixRegOptions& options)
+{
+ RibTable::iterator it = std::find_if(m_rib.begin(), m_rib.end(),
+ bind(&compareNameFaceProtocol, _1, options));
+ if (it != m_rib.end())
+ {
+ m_rib.erase(it);
+ }
+}
+
+void
+Rib::erase(uint64_t faceId)
+{
+ //Keep it simple for now, with Trie this will be changed.
+ RibTable::iterator it = m_rib.begin();
+ while (it != m_rib.end())
+ {
+ if (it->getFaceId() == faceId)
+ it = m_rib.erase(it);
+ else
+ ++it;
+ }
+}
+
+} // namespace nrd
+} // namespace ndn
diff --git a/rib/src/rib.hpp b/rib/src/rib.hpp
new file mode 100644
index 0000000..3196817
--- /dev/null
+++ b/rib/src/rib.hpp
@@ -0,0 +1,84 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NRD_RIB_HPP
+#define NRD_RIB_HPP
+
+#include "common.hpp"
+
+namespace ndn {
+namespace nrd {
+
+/** \brief represents the RIB
+ */
+class Rib
+{
+public:
+ typedef std::list<PrefixRegOptions> RibTable;
+ typedef RibTable::const_iterator const_iterator;
+
+ Rib();
+
+ ~Rib();
+
+ const_iterator
+ find(const PrefixRegOptions& options) const;
+
+ void
+ insert(const PrefixRegOptions& options);
+
+ void
+ erase(const PrefixRegOptions& options);
+
+ void
+ erase(uint64_t faceId);
+
+ const_iterator
+ begin() const;
+
+ const_iterator
+ end() const;
+
+ size_t
+ size() const;
+
+ size_t
+ empty() const;
+
+private:
+ // Note: Taking a list right now. A Trie will be used later to store
+ // prefixes
+ RibTable m_rib;
+};
+
+inline Rib::const_iterator
+Rib::begin() const
+{
+ return m_rib.begin();
+}
+
+inline Rib::const_iterator
+Rib::end() const
+{
+ return m_rib.end();
+}
+
+inline size_t
+Rib::size() const
+{
+ return m_rib.size();
+}
+
+inline size_t
+Rib::empty() const
+{
+ return m_rib.empty();
+}
+
+} // namespace nrd
+} // namespace ndn
+
+#endif // NRD_RIB_HPP
diff --git a/rib/tests/main.cpp b/rib/tests/main.cpp
new file mode 100644
index 0000000..a7e827d
--- /dev/null
+++ b/rib/tests/main.cpp
@@ -0,0 +1,10 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#define BOOST_TEST_MAIN 1
+#define BOOST_TEST_DYN_LINK 1
+
+#include <boost/test/unit_test.hpp>
diff --git a/rib/tests/test-rib.cpp b/rib/tests/test-rib.cpp
new file mode 100644
index 0000000..920c606
--- /dev/null
+++ b/rib/tests/test-rib.cpp
@@ -0,0 +1,67 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "rib.hpp"
+
+#include <boost/test/unit_test.hpp>
+
+namespace ndn {
+namespace nrd {
+namespace tests {
+
+BOOST_AUTO_TEST_SUITE(TestRib)
+
+BOOST_AUTO_TEST_CASE(Basic)
+{
+ Rib rib;
+
+ PrefixRegOptions options1;
+ options1.setName("/hello/world");
+ options1.setFlags(tlv::nrd::NDN_FORW_CHILD_INHERIT | tlv::nrd::NDN_FORW_CAPTURE);
+ options1.setCost(10);
+ options1.setExpirationPeriod(time::milliseconds(1500));
+ options1.setFaceId(1);
+
+ rib.insert(options1);
+ BOOST_CHECK_EQUAL(rib.size(), 1);
+
+ PrefixRegOptions options2;
+ options2.setName("/hello/world");
+ options2.setFlags(tlv::nrd::NDN_FORW_CHILD_INHERIT);
+ options2.setExpirationPeriod(time::seconds(0));
+ options2.setFaceId(1);
+ options2.setCost(100);
+
+ rib.insert(options2);
+ BOOST_CHECK_EQUAL(rib.size(), 1);
+
+ options2.setFaceId(2);
+ rib.insert(options2);
+ BOOST_CHECK_EQUAL(rib.size(), 2);
+
+ options2.setName("/foo/bar");
+ rib.insert(options2);
+ BOOST_CHECK_EQUAL(rib.size(), 3);
+
+ rib.erase(options2);
+ BOOST_CHECK_EQUAL(rib.size(), 2);
+
+ options2.setName("/hello/world");
+ rib.erase(options2);
+ BOOST_CHECK_EQUAL(rib.size(), 1);
+
+ BOOST_CHECK(rib.find(options2) == rib.end());
+ BOOST_CHECK(rib.find(options1) != rib.end());
+
+ rib.erase(options1);
+ BOOST_CHECK(rib.empty());
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace nrd
+} // namespace ndn
diff --git a/rib/waf b/rib/waf
new file mode 100755
index 0000000..78a44f3
--- /dev/null
+++ b/rib/waf
Binary files differ
diff --git a/rib/wscript b/rib/wscript
new file mode 100644
index 0000000..1a7f82a
--- /dev/null
+++ b/rib/wscript
@@ -0,0 +1,71 @@
+# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+from waflib import Logs
+
+def options(opt):
+ opt.load('compiler_cxx gnu_dirs')
+ opt.load('flags boost doxygen coverage', tooldir=['.waf-tools'])
+
+ nrdopt = opt.add_option_group('NRD Options')
+ nrdopt.add_option('--debug', action='store_true', default=False,
+ dest='debug',
+ help='''Compile library debugging mode without all optimizations (-O0)''')
+ nrdopt.add_option('--with-tests', action='store_true',
+ default=False, dest='with_tests', help='''Build unit tests''')
+
+def configure(conf):
+ conf.load("compiler_cxx gnu_dirs boost flags")
+
+ conf.check_cfg(package='libndn-cpp-dev', args=['--cflags', '--libs'],
+ uselib_store='NDN_CPP', mandatory=True)
+
+ boost_libs = 'system'
+ if conf.options.with_tests:
+ conf.env['WITH_TESTS'] = 1
+ conf.define('WITH_TESTS', 1);
+ boost_libs += ' unit_test_framework'
+
+ conf.check_boost(lib=boost_libs)
+ if conf.env.BOOST_VERSION_NUMBER < 104800:
+ Logs.error("Minimum required boost version is 1.48")
+ Logs.error("Please upgrade your distribution or install custom boost libraries" +
+ " (http://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)")
+ return
+
+ # conf.load('coverage')
+
+ # try:
+ # conf.load('doxygen')
+ # except:
+ # pass
+
+ conf.define('DEFAULT_CONFIG_FILE', '%s/ndn/nrd.conf' % conf.env['SYSCONFDIR'])
+ conf.write_config_header('src/config.hpp')
+
+def build (bld):
+ bld(
+ features='cxx',
+ name='nrd-objects',
+ source=bld.path.ant_glob('src/*.cpp',
+ excl='src/main.cpp'),
+ use='NDN_CPP BOOST',
+ )
+
+ bld.program(
+ target='nrd',
+ source='src/main.cpp',
+ use='nrd-objects'
+ )
+
+ # Unit tests
+ if bld.env['WITH_TESTS']:
+ unit_tests = bld.program(
+ target='unit-tests',
+ features='cxx cxxprogram',
+ source=bld.path.ant_glob(['tests/**/*.cpp']),
+ use='nrd-objects',
+ includes=['.', 'src'],
+ install_prefix=None,
+ )
+
+ bld.install_files('${SYSCONFDIR}/ndn', 'nrd.conf.sample')