9 Commits
Author SHA1 Message Date
Saurab Dulal 301220346e docs: Prepare version 0.4.3 release notes
Change-Id: I0b3a6166eac489be67ea03ff69a13ffe35616f63
2018-05-21 12:54:11 -05:00
Ashlesh Gawande 8df15986ef tlv: avoid misaligned memory access
They cause unit test crashing on ARM platform.

refs: #4609

Change-Id: Ifdb0401529de48b5c08ebcf6938d80ba87ff883d
2018-05-19 22:21:25 -07:00
Ryan Wickman f3c79a6f87 src: make LSA's isEqualContent methods of type const
refs: #4137
Change-Id: Idb1cdea33d4efbc3af3c07d901a620d3ef253979
2018-05-10 20:15:01 -05:00
Ashlesh Gawande cba0ae2f56 **breaking** Change NLSR to nlsr for various prefixes
src: register router prefix to fix remote requests

refs: #4543

Change-Id: I698484318bf8e641f955ea40e6c51c6865cad8bf
2018-04-19 14:34:29 -05:00
Eric Newberry f1a8ee66de build: find Boost lib architecture automatically
refs #4573

Change-Id: I383f821bc651926ba5d2ed830b20dd3116e8a3fc
2018-04-07 16:38:47 -07:00
Ashlesh Gawande d65786a0ea src/lsa-segment-storage: fix convergence w/o content store
refs: #4430

Change-Id: I5124e9fd49bd9850c904c31d221b42b4249553a3
2018-04-02 22:55:17 -05:00
Ashlesh Gawande e6ba9158e0 Fix build with clang-5.0
refs: #4547

Change-Id: I7fd0411b3dc7c62651875aa035bbfb6ca269bf81
2018-03-30 16:20:27 -05:00
Eric Newberry aa41b04807 docs: disable sphinxcontrib-googleanalytics
refs #4553

Change-Id: I94529272787b0facd9370f9c6fca06435a636093
2018-03-26 15:16:43 -07:00
Alexander Afanasyev 67758b1fba build: update waf to version 2.0.6
Fix discovered build issues

Change-Id: I9a861c955283c1b20cc5065a4baa22bd7c2ab0c1
2018-03-11 12:17:41 -04:00
57 changed files with 568 additions and 406 deletions

No files matched your search

+32 -7
View File
@@ -1,7 +1,32 @@
.DS*
.waf-1*
.waf3-*
.lock*
**/*.pyc
build/
VERSION
# Emacs
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
.\#*
# Visual Studio Code
.vscode/
# KDevelop
*.kdev*
# macOS
.DS_Store
.AppleDouble
.LSOverride
._*
# Waf build system
/build/
.waf-*-*/
.waf3-*-*/
.lock-waf*
# Compiled python code
__pycache__/
*.py[cod]
# Other
/VERSION
+6 -2
View File
@@ -54,8 +54,7 @@ from waflib import Utils, Logs, Errors
from waflib.Configure import conf
from waflib.TaskGen import feature, after_method
BOOST_LIBS = ['/usr/lib/x86_64-linux-gnu', '/usr/lib/i386-linux-gnu',
'/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib']
BOOST_LIBS = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib']
BOOST_INCLUDES = ['/usr/include', '/usr/local/include', '/opt/local/include', '/sw/include']
BOOST_VERSION_FILE = 'boost/version.hpp'
BOOST_VERSION_CODE = '''
@@ -404,6 +403,11 @@ def check_boost(self, *k, **kw):
var = kw.get('uselib_store', 'BOOST')
self.find_program('dpkg-architecture', var='DPKG_ARCHITECTURE', mandatory=False)
if self.env.DPKG_ARCHITECTURE:
deb_host_multiarch = self.cmd_and_log([self.env.DPKG_ARCHITECTURE[0], '-qDEB_HOST_MULTIARCH'])
BOOST_LIBS.insert(0, '/usr/lib/%s' % deb_host_multiarch.strip())
self.start_msg('Checking boost includes')
self.env['INCLUDES_%s' % var] = inc = self.boost_get_includes(**params)
versions = self.boost_get_version(inc)
+4 -4
View File
@@ -1,15 +1,15 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
from waflib import TaskGen, Logs
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''')
opt.add_option('--with-coverage', action='store_true', default=False,
help='Add compiler flags to enable code coverage information')
def configure(conf):
if conf.options.with_coverage:
if not conf.options.debug:
conf.fatal("Code coverage flags require debug mode compilation (add --debug)")
conf.fatal('Code coverage flags require debug mode compilation (add --debug)')
conf.check_cxx(cxxflags=['-fprofile-arcs', '-ftest-coverage', '-fPIC'],
linkflags=['-fprofile-arcs'], uselib_store='GCOV', mandatory=True)
+53 -41
View File
@@ -1,64 +1,67 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
from waflib import Logs, Configure, Utils
from waflib import Configure, Logs, Utils
def options(opt):
opt.add_option('--debug', '--with-debug', action='store_true', default=False, dest='debug',
help='''Compile in debugging mode with minimal optimizations (-O0 or -Og)''')
opt.add_option('--debug', '--with-debug', action='store_true', default=False,
help='Compile in debugging mode with minimal optimizations (-O0 or -Og)')
def configure(conf):
conf.start_msg('Checking C++ compiler version')
cxx = conf.env['CXX_NAME'] # CXX_NAME is the generic name of the compiler
ccver = tuple(int(i) for i in conf.env['CC_VERSION'])
cxx = conf.env.CXX_NAME # generic name of the compiler
ccver = tuple(int(i) for i in conf.env.CC_VERSION)
ccverstr = '.'.join(conf.env.CC_VERSION)
errmsg = ''
warnmsg = ''
if cxx == 'gcc':
if ccver < (4, 8, 2):
errmsg = ('The version of gcc you are using is too old.\n'
'The minimum supported gcc version is 4.8.2.')
flags = GccFlags()
conf.flags = GccFlags()
elif cxx == 'clang':
if ccver < (3, 4, 0):
errmsg = ('The version of clang you are using is too old.\n'
'The minimum supported clang version is 3.4.0.')
flags = ClangFlags()
conf.flags = ClangFlags()
else:
warnmsg = 'Note: %s compiler is unsupported' % cxx
flags = CompilerFlags()
conf.flags = CompilerFlags()
if errmsg:
conf.end_msg('.'.join(conf.env['CC_VERSION']), color='RED')
conf.end_msg(ccverstr, color='RED')
conf.fatal(errmsg)
elif warnmsg:
conf.end_msg('.'.join(conf.env['CC_VERSION']), color='YELLOW')
conf.end_msg(ccverstr, color='YELLOW')
Logs.warn(warnmsg)
else:
conf.end_msg('.'.join(conf.env['CC_VERSION']))
conf.end_msg(ccverstr)
areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
conf.areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
# General flags are always applied (e.g., selecting C++11 mode)
generalFlags = flags.getGeneralFlags(conf)
generalFlags = conf.flags.getGeneralFlags(conf)
conf.add_supported_cxxflags(generalFlags['CXXFLAGS'])
conf.add_supported_linkflags(generalFlags['LINKFLAGS'])
conf.env.DEFINES += generalFlags['DEFINES']
@Configure.conf
def check_compiler_flags(conf):
# Debug or optimized CXXFLAGS and LINKFLAGS are applied only if the
# corresponding environment variables are not set.
# DEFINES are always applied.
if conf.options.debug:
extraFlags = flags.getDebugFlags(conf)
if areCustomCxxflagsPresent:
extraFlags = conf.flags.getDebugFlags(conf)
if conf.areCustomCxxflagsPresent:
missingFlags = [x for x in extraFlags['CXXFLAGS'] 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))
if missingFlags:
Logs.warn('Selected debug mode, but CXXFLAGS is set to a custom value "%s"'
% ' '.join(conf.env.CXXFLAGS))
Logs.warn('Default flags "%s" will not be used' % ' '.join(missingFlags))
else:
extraFlags = flags.getOptimizedFlags(conf)
extraFlags = conf.flags.getOptimizedFlags(conf)
if not areCustomCxxflagsPresent:
if not conf.areCustomCxxflagsPresent:
conf.add_supported_cxxflags(extraFlags['CXXFLAGS'])
conf.add_supported_linkflags(extraFlags['LINKFLAGS'])
@@ -75,9 +78,10 @@ def add_supported_cxxflags(self, cxxflags):
self.start_msg('Checking supported CXXFLAGS')
supportedFlags = []
for flag in cxxflags:
if self.check_cxx(cxxflags=['-Werror', flag], mandatory=False):
supportedFlags += [flag]
for flags in cxxflags:
flags = Utils.to_list(flags)
if self.check_cxx(cxxflags=['-Werror'] + flags, mandatory=False):
supportedFlags += flags
self.end_msg(' '.join(supportedFlags))
self.env.prepend_value('CXXFLAGS', supportedFlags)
@@ -93,15 +97,19 @@ def add_supported_linkflags(self, linkflags):
self.start_msg('Checking supported LINKFLAGS')
supportedFlags = []
for flag in linkflags:
if self.check_cxx(linkflags=['-Werror', flag], mandatory=False):
supportedFlags += [flag]
for flags in linkflags:
flags = Utils.to_list(flags)
if self.check_cxx(linkflags=['-Werror'] + flags, mandatory=False):
supportedFlags += flags
self.end_msg(' '.join(supportedFlags))
self.env.prepend_value('LINKFLAGS', supportedFlags)
class CompilerFlags(object):
def getCompilerVersion(self, conf):
return tuple(int(i) for i in conf.env.CC_VERSION)
def getGeneralFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed"""
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []}
@@ -132,6 +140,7 @@ class GccBasicFlags(CompilerFlags):
'-Wall',
'-Wextra',
'-Werror',
'-Wnon-virtual-dtor',
'-Wno-error=deprecated-declarations', # Bug #3795
'-Wno-error=maybe-uninitialized', # Bug #1615
'-Wno-unused-parameter',
@@ -146,6 +155,7 @@ class GccBasicFlags(CompilerFlags):
'-pedantic',
'-Wall',
'-Wextra',
'-Wnon-virtual-dtor',
'-Wno-unused-parameter',
]
flags['LINKFLAGS'] += ['-fuse-ld=gold', '-Wl,-O1']
@@ -154,16 +164,14 @@ class GccBasicFlags(CompilerFlags):
class GccFlags(GccBasicFlags):
def getDebugFlags(self, conf):
flags = super(GccFlags, self).getDebugFlags(conf)
version = tuple(int(i) for i in conf.env['CC_VERSION'])
if version < (5, 1, 0):
if self.getCompilerVersion(conf) < (5, 1, 0):
flags['CXXFLAGS'] += ['-Wno-missing-field-initializers']
flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9
return flags
def getOptimizedFlags(self, conf):
flags = super(GccFlags, self).getOptimizedFlags(conf)
version = tuple(int(i) for i in conf.env['CC_VERSION'])
if version < (5, 1, 0):
if self.getCompilerVersion(conf) < (5, 1, 0):
flags['CXXFLAGS'] += ['-Wno-missing-field-initializers']
flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9
return flags
@@ -171,32 +179,36 @@ class GccFlags(GccBasicFlags):
class ClangFlags(GccBasicFlags):
def getGeneralFlags(self, conf):
flags = super(ClangFlags, self).getGeneralFlags(conf)
if Utils.unversioned_sys_platform() == 'darwin':
flags['CXXFLAGS'] += ['-stdlib=libc++']
flags['LINKFLAGS'] += ['-stdlib=libc++']
if Utils.unversioned_sys_platform() == 'darwin' and self.getCompilerVersion(conf) >= (9, 0, 0):
# Bug #4296
flags['CXXFLAGS'] += [['-isystem', '/usr/local/include'], # for Homebrew
['-isystem', '/opt/local/include']] # for MacPorts
return flags
def getDebugFlags(self, conf):
flags = super(ClangFlags, self).getDebugFlags(conf)
flags['CXXFLAGS'] += ['-fcolor-diagnostics',
'-Wextra-semi',
'-Wundefined-func-template',
'-Wno-error=deprecated-register',
'-Wno-error=ignored-qualifiers',
'-Wno-error=infinite-recursion', # Bug #3358
'-Wno-error=keyword-macro', # Bug #3235
'-Wno-error=unneeded-internal-declaration', # Bug #1588
'-Wno-keyword-macro',
'-Wno-nested-anon-types',
'-Wno-sign-compare',
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
]
version = self.getCompilerVersion(conf)
if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (8, 1, 0)):
flags['CXXFLAGS'] += ['-Wno-unknown-pragmas']
return flags
def getOptimizedFlags(self, conf):
flags = super(ClangFlags, self).getOptimizedFlags(conf)
flags['CXXFLAGS'] += ['-fcolor-diagnostics',
'-Wno-keyword-macro',
'-Wno-nested-anon-types',
'-Wno-sign-compare',
'-Wextra-semi',
'-Wundefined-func-template',
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
]
version = self.getCompilerVersion(conf)
if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (8, 1, 0)):
flags['CXXFLAGS'] += ['-Wno-unknown-pragmas']
return flags
+2 -2
View File
@@ -7,9 +7,9 @@ NLSR Installation Instructions
Prerequisites
-------------
- `NFD <http://named-data.net/doc/NFD/current/>`_ and its requirements:
- `NFD <https://named-data.net/doc/NFD/>`_ and its requirements:
Refer to `Getting started with NFD <http://named-data.net/doc/NFD/current/INSTALL.html>`_
Refer to `Getting started with NFD <https://named-data.net/doc/NFD/current/INSTALL.html>`_
for detailed installation and running instruction.
- ChronoSync library
+3 -2
View File
@@ -44,8 +44,9 @@ def addExtensionIfExists(extension):
sys.stderr.write("To install, use \n"
" sudo pip install %s\n" % extension.replace('.', '-'))
if os.getenv('GOOGLE_ANALYTICS', None):
addExtensionIfExists('sphinxcontrib.googleanalytics')
# sphinxcontrib.googleanalytics is currently not working with the latest version of sphinx
# if os.getenv('GOOGLE_ANALYTICS', None):
# addExtensionIfExists('sphinxcontrib.googleanalytics')
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
+6 -15
View File
@@ -12,7 +12,7 @@
<div class="row">
<div class="three columns">
<div id="logo">
<a href="http://named-data.net" title="A Future Internet Architecture"><img src="http://named-data.net/wp-content/uploads/cropped-20130722_Logo2.png" alt="" /></a>
<a href="https://named-data.net" title="A Future Internet Architecture"><img src="https://named-data.net/wp-content/uploads/cropped-20130722_Logo2.png" alt="" /></a>
</div><!--logo end-->
</div>
@@ -38,12 +38,14 @@
<h3>{{ _('Table Of Contents') }}</h3>
{{ toctree(includehidden=True) }}
<h3>{{ _('Additional documenation') }}</h3>
<h3>{{ _('Developer documentation') }}</h3>
<ul>
<li class="toctree-l1"><a class="reference external" href="http://redmine.named-data.net/projects/nlsr/wiki">NLSR Wiki</a></li>
<li class="toctree-l1"><a class="reference external" href="https://redmine.named-data.net/projects/nlsr/wiki">NLSR Wiki</a></li>
<li class="toctree-l1"><a class="reference internal" href="doxygen/annotated.html">API documentation (doxygen)</a></li>
<li class="toctree-l1"><a class="reference internal" href="code-style.html">ndn-cxx Code Style and Coding Guidelines</a></li>
</ul>
{%- endblock %}
{%- block sidebarsearch %}
<h3 style="margin-top: 1.5em;">{{ _('Search') }}</h3>
<form class="search" action="{{ pathto('search') }}" method="get">
@@ -74,22 +76,11 @@
<div class="row">
<div class="twelve columns">
<div id="copyright">This research is partially supported by NSF (Award <a href="http://www.nsf.gov/awardsearch/showAward?AWD_ID=1040868" target="_blank>">CNS-1040868</a>)<br/><br/><a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US" target="_blank">Creative Commons Attribution 3.0 Unported License</a> except where noted.</div>
<div id="copyright">This research is partially supported by NSF (Award <a href="https://www.nsf.gov/awardsearch/showAward?AWD_ID=1040868" target="_blank>">CNS-1040868</a>)<br/><br/><a rel="license" href="https://creativecommons.org/licenses/by/3.0/deed.en_US" target="_blank">Creative Commons Attribution 3.0 Unported License</a> except where noted.</div>
</div>
</div>
</div><!--footer info end-->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-22320603-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
{% endblock %}
{% block relbar1 %}{% endblock %}
@@ -0,0 +1,32 @@
<!-- start footer part -->
<!--BEGIN GENERATE_TREEVIEW-->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
$navpath
<li class="footer">$generatedby
<a href="https://www.doxygen.org/index.html">
<img class="footer" src="$relpath$doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
</ul>
</div>
<!--END GENERATE_TREEVIEW-->
<!--BEGIN !GENERATE_TREEVIEW-->
<hr class="footer"/>
<address class="footer"><small>
$generatedby &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="$relpath$doxygen.png" alt="doxygen"/>
</a> $doxygenversion
</small></address>
<!--END !GENERATE_TREEVIEW-->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '@GOOGLE_ANALYTICS@', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
+3 -1
View File
@@ -4,7 +4,7 @@
<ul>
$navpath
<li class="footer">$generatedby
<a href="http://www.doxygen.org/index.html">
<a href="https://www.doxygen.org/index.html">
<img class="footer" src="$relpath$doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
</ul>
</div>
@@ -18,5 +18,7 @@ $generatedby &#160;<a href="http://www.doxygen.org/index.html">
</small></address>
<!--END !GENERATE_TREEVIEW-->
<script type="text/javascript">
</script>
</body>
</html>
+4 -4
View File
@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
@@ -26,13 +26,13 @@ $mathjax
<div class="row">
<div class="three columns">
<div id="logo">
<a href="http://named-data.net" title="A Future Internet Architecture"><img src="http://named-data.net/wp-content/uploads/cropped-20130722_Logo2.png" alt="" /></a>
<a href="https://named-data.net" title="A Future Internet Architecture"><img src="https://named-data.net/wp-content/uploads/cropped-20130722_Logo2.png" alt="" /></a>
</div><!--logo end-->
</div>
<!--top menu-->
<div class="nine columns" id="menu_container" >
<h1><a href="http://named-data.net/doc/NLSR/$projectnumber/">$projectname $projectnumber documentation</a></h1>
<h1><a href="https://named-data.net/doc/NLSR/$projectnumber/">$projectname $projectnumber documentation</a></h1>
</div>
</div>
</div><!--header container end-->
+1 -1
View File
@@ -1 +1 @@
release-notes/release-notes-0.4.2.rst
release-notes/release-notes-0.4.3.rst
+1 -1
View File
@@ -4,7 +4,7 @@ NLSR version 0.1.0 (initial release)
Release date: August 25, 2014
The main design goal of NLSR is to provide a routing protocol to populate `NFD's
<http://named-data.net/doc/NFD/current/>`_ RIB. NLSR calculates the routing table using
<https://named-data.net/doc/NFD/>`_ RIB. NLSR calculates the routing table using
link-state or hyperbolic routing and produces multiple faces for each reachable name
prefix in a single authoritative domain.
@@ -0,0 +1,14 @@
NLSR version 0.4.3
++++++++++++++++++
**Changes**:
- **breaking change** Change NLSR to nlsr for various prefixes (:issue:`4543`)
**Bug Fixes**:
- Fix dry-run mode not working (:issue:`4394`)
- Fix convergence w/o content store (:issue:`4430`)
- Register router prefix to fix remote requests (:issue:`4543`)
- Fix build with clang-5.0 (:issue:`4547`)
- Avoid misaligned memory access (:issue:`4609`)
+1
View File
@@ -5,6 +5,7 @@ NLSR Versions
:hidden:
:maxdepth: 1
release-notes/release-notes-0.4.3
release-notes/release-notes-0.4.2
release-notes/release-notes-0.4.1
release-notes/release-notes-0.4.0
+7 -7
View File
@@ -141,7 +141,7 @@ security
filter
{
type name
regex ^[^<NLSR><INFO>]*<NLSR><INFO><><>$
regex ^[^<nlsr><INFO>]*<nlsr><INFO><><>$
}
checker
{
@@ -152,10 +152,10 @@ security
type name
hyper-relation
{
k-regex ^([^<KEY><NLSR>]*)<NLSR><KEY><>$
k-regex ^([^<KEY><nlsr>]*)<nlsr><KEY><>$
k-expand \\1
h-relation equal
p-regex ^([^<NLSR><INFO>]*)<NLSR><INFO><><>$
p-regex ^([^<nlsr><INFO>]*)<nlsr><INFO><><>$
p-expand \\1
}
}
@@ -169,7 +169,7 @@ security
filter
{
type name
regex ^[^<NLSR><LSA>]*<NLSR><LSA>
regex ^[^<nlsr><LSA>]*<nlsr><LSA>
}
checker
{
@@ -180,11 +180,11 @@ security
type name
hyper-relation
{
k-regex ^([^<KEY><NLSR>]*)<NLSR><KEY><>$
k-regex ^([^<KEY><nlsr>]*)<nlsr><KEY><>$
k-expand \\1
h-relation equal
; the last four components in the prefix should be <lsaType><seqNo><version><segmentNo>
p-regex ^<localhop>([^<NLSR><LSA>]*)<NLSR><LSA>(<>*)<><><><>$
p-regex ^<localhop>([^<nlsr><LSA>]*)<nlsr><LSA>(<>*)<><><><>$
p-expand \\1\\2
}
}
@@ -198,7 +198,7 @@ security
filter
{
type name
regex ^[^<KEY><%C1.Router>]*<%C1.Router>[^<KEY><NLSR>]*<KEY><><><>$
regex ^[^<KEY><%C1.Router>]*<%C1.Router>[^<KEY><nlsr>]*<KEY><><><>$
}
checker
{
+1 -1
View File
@@ -30,7 +30,7 @@ namespace nlsr {
INIT_LOGGER(SyncLogicHandler);
const std::string NLSR_COMPONENT = "NLSR";
const std::string NLSR_COMPONENT = "nlsr";
const std::string LSA_COMPONENT = "LSA";
template<class T>
+3 -3
View File
@@ -29,7 +29,7 @@ namespace nlsr {
INIT_LOGGER(ConfParameter);
// To be changed when breaking changes are made to sync
const uint64_t ConfParameter::SYNC_VERSION = 4;
const uint64_t ConfParameter::SYNC_VERSION = 5;
void
ConfParameter::writeLog()
@@ -69,13 +69,13 @@ ConfParameter::setNetwork(const ndn::Name& networkName)
m_chronosyncPrefix.append("localhop");
m_chronosyncPrefix.append(m_network);
m_chronosyncPrefix.append("NLSR");
m_chronosyncPrefix.append("nlsr");
m_chronosyncPrefix.append("sync");
m_chronosyncPrefix.appendVersion(SYNC_VERSION);
m_lsaPrefix.append("localhop");
m_lsaPrefix.append(m_network);
m_lsaPrefix.append("NLSR");
m_lsaPrefix.append("nlsr");
m_lsaPrefix.append("LSA");
}
+1 -1
View File
@@ -30,7 +30,7 @@ namespace nlsr {
INIT_LOGGER(HelloProtocol);
const std::string HelloProtocol::INFO_COMPONENT = "INFO";
const std::string HelloProtocol::NLSR_COMPONENT = "NLSR";
const std::string HelloProtocol::NLSR_COMPONENT = "nlsr";
HelloProtocol::HelloProtocol(Nlsr& nlsr, ndn::Scheduler& scheduler)
: m_nlsr(nlsr)
+1 -1
View File
@@ -107,7 +107,7 @@ LsaSegmentStorage::afterFetcherSignalEmitted(const ndn::Data& lsaSegment)
try {
expirationTime = ndn::time::duration_cast<ndn::time::seconds>
(ndn::time::system_clock::now() - ndn::time::fromIsoString(options.at(3)));
(ndn::time::fromIsoString(options.at(3)) - ndn::time::system_clock::now());
} catch (const std::exception& e) {
NLSR_LOG_ERROR("Cannot extract expiration time from LSA content: " << e.what());
}
+2 -2
View File
@@ -138,7 +138,7 @@ CoordinateLsa::CoordinateLsa(const ndn::Name& origR, uint32_t lsn,
}
bool
CoordinateLsa::isEqualContent(const CoordinateLsa& clsa)
CoordinateLsa::isEqualContent(const CoordinateLsa& clsa) const
{
if (clsa.getCorTheta().size() != m_angles.size()) {
return false;
@@ -213,7 +213,7 @@ AdjLsa::AdjLsa(const ndn::Name& origR, uint32_t lsn,
}
bool
AdjLsa::isEqualContent(AdjLsa& alsa)
AdjLsa::isEqualContent(const AdjLsa& alsa) const
{
return m_adl == alsa.getAdl();
}
+11 -8
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, The University of Memphis,
/*
* Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
*/
#ifndef NLSR_LSA_HPP
#define NLSR_LSA_HPP
@@ -54,6 +54,9 @@ public:
{
}
virtual
~Lsa() = default;
virtual Type
getType() const
{
@@ -155,7 +158,7 @@ protected:
ndn::EventId m_expiringEventId;
};
class NameLsa: public Lsa
class NameLsa : public Lsa
{
public:
NameLsa()
@@ -229,7 +232,7 @@ private:
operator<<(std::ostream& os, const NameLsa& lsa);
};
class AdjLsa: public Lsa
class AdjLsa : public Lsa
{
public:
typedef AdjacencyList::const_iterator const_iterator;
@@ -281,7 +284,7 @@ public:
}
bool
isEqualContent(AdjLsa& alsa);
isEqualContent(const AdjLsa& alsa) const;
/*! \brief Installs this LSA's name prefixes into the NPT.
@@ -327,7 +330,7 @@ private:
operator<<(std::ostream& os, const AdjLsa& lsa);
};
class CoordinateLsa: public Lsa
class CoordinateLsa : public Lsa
{
public:
CoordinateLsa()
@@ -381,7 +384,7 @@ public:
}
bool
isEqualContent(const CoordinateLsa& clsa);
isEqualContent(const CoordinateLsa& clsa) const;
void
writeLog() const override;
+30 -20
View File
@@ -97,18 +97,18 @@ void
Nlsr::setInfoInterestFilter()
{
ndn::Name name(m_confParam.getRouterPrefix());
name.append("NLSR");
name.append("nlsr");
name.append("INFO");
NLSR_LOG_DEBUG("Setting interest filter for Hello interest: " << name);
getNlsrFace().setInterestFilter(name,
std::bind(&HelloProtocol::processInterest,
&m_helloProtocol, _1, _2),
std::bind(&Nlsr::onRegistrationSuccess, this, _1),
std::bind(&Nlsr::registrationFailed, this, _1),
m_signingInfo,
ndn::nfd::ROUTE_FLAG_CAPTURE);
m_nlsrFace.setInterestFilter(name,
std::bind(&HelloProtocol::processInterest,
&m_helloProtocol, _1, _2),
std::bind(&Nlsr::onRegistrationSuccess, this, _1),
std::bind(&Nlsr::registrationFailed, this, _1),
m_signingInfo,
ndn::nfd::ROUTE_FLAG_CAPTURE);
}
void
@@ -118,13 +118,13 @@ Nlsr::setLsaInterestFilter()
NLSR_LOG_DEBUG("Setting interest filter for LsaPrefix: " << name);
getNlsrFace().setInterestFilter(name,
std::bind(&Lsdb::processInterest,
&m_nlsrLsdb, _1, _2),
std::bind(&Nlsr::onRegistrationSuccess, this, _1),
std::bind(&Nlsr::registrationFailed, this, _1),
m_signingInfo,
ndn::nfd::ROUTE_FLAG_CAPTURE);
m_nlsrFace.setInterestFilter(name,
std::bind(&Lsdb::processInterest,
&m_nlsrLsdb, _1, _2),
std::bind(&Nlsr::onRegistrationSuccess, this, _1),
std::bind(&Nlsr::registrationFailed, this, _1),
m_signingInfo,
ndn::nfd::ROUTE_FLAG_CAPTURE);
}
@@ -132,6 +132,7 @@ void
Nlsr::addDispatcherTopPrefix(const ndn::Name& topPrefix)
{
try {
// false since we want to have control over the registration process
m_dispatcher.addTopPrefix(topPrefix, false, m_signingInfo);
}
catch (const std::exception& e) {
@@ -165,13 +166,13 @@ Nlsr::canonizeNeighborUris(std::list<Adjacent>::iterator currentNeighbor,
{
if (currentNeighbor != m_adjacencyList.getAdjList().end()) {
ndn::FaceUri uri(currentNeighbor->getFaceUri());
uri.canonize([this, then, currentNeighbor] (ndn::FaceUri canonicalUri) {
uri.canonize([then, currentNeighbor] (ndn::FaceUri canonicalUri) {
NLSR_LOG_DEBUG("Canonized URI: " << currentNeighbor->getFaceUri()
<< " to: " << canonicalUri);
currentNeighbor->setFaceUri(canonicalUri);
then(std::next(currentNeighbor));
},
[this, then, currentNeighbor] (const std::string& reason) {
[then, currentNeighbor] (const std::string& reason) {
NLSR_LOG_ERROR("Could not canonize URI: " << currentNeighbor->getFaceUri()
<< " because: " << reason);
then(std::next(currentNeighbor));
@@ -277,7 +278,7 @@ Nlsr::initialize()
setLsaInterestFilter();
// add top-level prefixes: router and localhost prefix
addDispatcherTopPrefix(m_confParam.getRouterPrefix());
addDispatcherTopPrefix(ndn::Name(m_confParam.getRouterPrefix()).append("nlsr"));
addDispatcherTopPrefix(LOCALHOST_PREFIX);
initializeFaces(std::bind(&Nlsr::processFaceDataset, this, _1),
@@ -299,6 +300,7 @@ Nlsr::initialize()
registerKeyPrefix();
registerLocalhostPrefix();
registerRouterPrefix();
m_helloProtocol.scheduleInterest(m_firstHelloInterval);
@@ -319,7 +321,7 @@ Nlsr::initializeKey()
NLSR_LOG_DEBUG("Initializing Key ...");
ndn::Name nlsrInstanceName = m_confParam.getRouterPrefix();
nlsrInstanceName.append("NLSR");
nlsrInstanceName.append("nlsr");
try {
m_keyChain.deleteIdentity(m_keyChain.getPib().getIdentity(nlsrInstanceName));
@@ -377,7 +379,7 @@ Nlsr::registerKeyPrefix()
{
// Start listening for the interest of this router's NLSR certificate
ndn::Name nlsrKeyPrefix = getConfParameter().getRouterPrefix();
nlsrKeyPrefix.append("NLSR");
nlsrKeyPrefix.append("nlsr");
nlsrKeyPrefix.append("KEY");
m_nlsrFace.setInterestFilter(nlsrKeyPrefix,
@@ -435,6 +437,14 @@ Nlsr::registerLocalhostPrefix()
std::bind(&Nlsr::registrationFailed, this, _1));
}
void
Nlsr::registerRouterPrefix()
{
m_nlsrFace.registerPrefix(ndn::Name(m_confParam.getRouterPrefix()).append("nlsr"),
std::bind(&Nlsr::onRegistrationSuccess, this, _1),
std::bind(&Nlsr::registrationFailed, this, _1));
}
void
Nlsr::onKeyInterest(const ndn::Name& name, const ndn::Interest& interest)
{
+5
View File
@@ -436,6 +436,11 @@ private:
void
registerLocalhostPrefix();
/*! \brief Registers the <router-prefix>/nlsr so that NLSR can respond to status requests from remote routers.
*/
void
registerRouterPrefix();
/*! \brief Attempts to satisfy an Interest for a certificate, and send it back.
*/
void
+2 -2
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, Regents of the University of California,
* Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -105,7 +105,7 @@ public:
segmentBegin = segmentEnd;
if (segmentBegin >= end) {
data->setFinalBlockId(segmentName[-1]);
data->setFinalBlock(segmentName[-1]);
}
publishSegment(data);
+6 -4
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, The University of Memphis,
/*
* Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,8 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*
**/
*/
#ifndef NLSR_ROUTE_FIB_HPP
#define NLSR_ROUTE_FIB_HPP
@@ -64,6 +63,9 @@ public:
{
}
VIRTUAL_WITH_TESTS
~Fib() = default;
/*! \brief Completely remove a name prefix from the FIB.
*
* If a name prefix is found to no longer be reachable from this
+2 -2
View File
@@ -119,7 +119,7 @@ RoutingTableCalculator::makeAdjMatrix(Nlsr& pnlsr, Map& pMap)
void
RoutingTableCalculator::writeAdjMatrixLog(const Map& map) const
{
if (!getNdnCxxLogger().isLevelEnabled(ndn::util::LogLevel::DEBUG)) {
if (!ndn_cxx_getLogger().isLevelEnabled(ndn::util::LogLevel::DEBUG)) {
return;
}
@@ -133,7 +133,7 @@ RoutingTableCalculator::writeAdjMatrixLog(const Map& map) const
routerIndex += " ";
lengthOfDash += "--";
NLSR_LOG_DEBUG("Router:" + map.getRouterNameByMappingNo(i)->toUri() +
"Index:" + boost::lexical_cast<std::string>(i));
" Index:" + boost::lexical_cast<std::string>(i));
}
NLSR_LOG_DEBUG(" |" + routerIndex);
NLSR_LOG_DEBUG(lengthOfDash);
+10 -18
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, The University of Memphis,
/*
* Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
*/
#include "adjacency-lsa.hpp"
#include "tlv-nlsr.hpp"
@@ -26,7 +26,7 @@
#include <ndn-cxx/encoding/block-helpers.hpp>
namespace nlsr {
namespace tlv {
namespace tlv {
BOOST_CONCEPT_ASSERT((ndn::WireEncodable<AdjacencyLsa>));
BOOST_CONCEPT_ASSERT((ndn::WireDecodable<AdjacencyLsa>));
@@ -62,11 +62,7 @@ AdjacencyLsa::wireEncode(ndn::EncodingImpl<TAG>& block) const
return totalLength;
}
template size_t
AdjacencyLsa::wireEncode<ndn::encoding::EncoderTag>(ndn::EncodingImpl<ndn::encoding::EncoderTag>& encoder) const;
template size_t
AdjacencyLsa::wireEncode<ndn::encoding::EstimatorTag>(ndn::EncodingImpl<ndn::encoding::EstimatorTag>& encoder) const;
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(AdjacencyLsa);
const ndn::Block&
AdjacencyLsa::wireEncode() const
@@ -95,10 +91,8 @@ AdjacencyLsa::wireDecode(const ndn::Block& wire)
m_wire = wire;
if (m_wire.type() != ndn::tlv::nlsr::AdjacencyLsa) {
std::stringstream error;
error << "Expected AdjacencyLsa Block, but Block is of a different type: #"
<< m_wire.type();
throw Error(error.str());
BOOST_THROW_EXCEPTION(Error("Expected AdjacencyLsa Block, but Block is of a different type: #" +
ndn::to_string(m_wire.type())));
}
m_wire.parse();
@@ -110,7 +104,7 @@ AdjacencyLsa::wireDecode(const ndn::Block& wire)
++val;
}
else {
throw Error("Missing required LsaInfo field");
BOOST_THROW_EXCEPTION(Error("Missing required LsaInfo field"));
}
for (; val != m_wire.elements_end(); ++val) {
@@ -119,10 +113,8 @@ AdjacencyLsa::wireDecode(const ndn::Block& wire)
m_hasAdjacencies = true;
}
else {
std::stringstream error;
error << "Expected Adjacency Block, but Block is of a different type: #"
<< m_wire.type();
throw Error(error.str());
BOOST_THROW_EXCEPTION(Error("Expected Adjacency Block, but Block is of a different type: #" +
ndn::to_string(m_wire.type())));
}
}
}
+5 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, The University of Memphis,
/*
* Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
*/
#ifndef NLSR_TLV_ADJACENCY_LSA_HPP
#define NLSR_TLV_ADJACENCY_LSA_HPP
@@ -153,6 +153,8 @@ private:
mutable ndn::Block m_wire;
};
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(AdjacencyLsa);
inline AdjacencyLsa::iterator
AdjacencyLsa::begin() const
{
+10 -16
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, The University of Memphis,
/*
* Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
*/
#include "adjacency.hpp"
#include "tlv-nlsr.hpp"
@@ -26,7 +26,7 @@
#include <ndn-cxx/encoding/block-helpers.hpp>
namespace nlsr {
namespace tlv {
namespace tlv {
BOOST_CONCEPT_ASSERT((ndn::WireEncodable<Adjacency>));
BOOST_CONCEPT_ASSERT((ndn::WireDecodable<Adjacency>));
@@ -62,11 +62,7 @@ Adjacency::wireEncode(ndn::EncodingImpl<TAG>& encoder) const
return totalLength;
}
template size_t
Adjacency::wireEncode<ndn::encoding::EncoderTag>(ndn::EncodingImpl<ndn::encoding::EncoderTag>& block) const;
template size_t
Adjacency::wireEncode<ndn::encoding::EstimatorTag>(ndn::EncodingImpl<ndn::encoding::EstimatorTag>& block) const;
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(Adjacency);
const ndn::Block&
Adjacency::wireEncode() const
@@ -96,10 +92,8 @@ Adjacency::wireDecode(const ndn::Block& wire)
m_wire = wire;
if (m_wire.type() != ndn::tlv::nlsr::Adjacency) {
std::stringstream error;
error << "Expected Adjacency Block, but Block is of a different type: #"
<< m_wire.type();
throw Error(error.str());
BOOST_THROW_EXCEPTION(Error("Expected Adjacency Block, but Block is of a different type: #" +
ndn::to_string(m_wire.type())));
}
m_wire.parse();
@@ -111,7 +105,7 @@ Adjacency::wireDecode(const ndn::Block& wire)
++val;
}
else {
throw Error("Missing required Name field");
BOOST_THROW_EXCEPTION(Error("Missing required Name field"));
}
if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::Uri) {
@@ -119,7 +113,7 @@ Adjacency::wireDecode(const ndn::Block& wire)
++val;
}
else {
throw Error("Missing required Uri field");
BOOST_THROW_EXCEPTION(Error("Missing required Uri field"));
}
if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::Cost) {
@@ -127,7 +121,7 @@ Adjacency::wireDecode(const ndn::Block& wire)
++val;
}
else {
throw Error("Missing required Cost field");
BOOST_THROW_EXCEPTION(Error("Missing required Cost field"));
}
}
+5 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, The University of Memphis,
/*
* Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
*/
#ifndef NLSR_TLV_ADJACENCY_HPP
#define NLSR_TLV_ADJACENCY_HPP
@@ -137,6 +137,8 @@ private:
mutable ndn::Block m_wire;
};
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(Adjacency);
std::ostream&
operator<<(std::ostream& os, const Adjacency& adjacency);
+8 -40
View File
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
/*
* Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
*/
#include "coordinate-lsa.hpp"
#include "tlv-nlsr.hpp"
@@ -50,21 +50,12 @@ size_t
CoordinateLsa::wireEncode(ndn::EncodingImpl<TAG>& block) const
{
size_t totalLength = 0;
size_t doubleLength = 10;
const uint8_t* doubleBytes1;
for (auto it = m_hyperbolicAngle.rbegin(); it != m_hyperbolicAngle.rend(); ++it) {
doubleBytes1 = reinterpret_cast<const uint8_t*>(&*it);
totalLength += block.prependByteArrayBlock(ndn::tlv::nlsr::Double, doubleBytes1, 8);
totalLength += block.prependVarNumber(doubleLength);
totalLength += block.prependVarNumber(ndn::tlv::nlsr::HyperbolicAngle);
totalLength += prependDouble(block, ndn::tlv::nlsr::HyperbolicAngle, *it);
}
const uint8_t* doubleBytes2 = reinterpret_cast<const uint8_t*>(&m_hyperbolicRadius);
totalLength += block.prependByteArrayBlock(ndn::tlv::nlsr::Double, doubleBytes2, 8);
totalLength += block.prependVarNumber(doubleLength);
totalLength += block.prependVarNumber(ndn::tlv::nlsr::HyperbolicRadius);
totalLength += prependDouble(block, ndn::tlv::nlsr::HyperbolicRadius, m_hyperbolicRadius);
totalLength += m_lsaInfo.wireEncode(block);
@@ -74,11 +65,7 @@ CoordinateLsa::wireEncode(ndn::EncodingImpl<TAG>& block) const
return totalLength;
}
template size_t
CoordinateLsa::wireEncode<ndn::encoding::EncoderTag>(ndn::EncodingImpl<ndn::encoding::EncoderTag>& block) const;
template size_t
CoordinateLsa::wireEncode<ndn::encoding::EstimatorTag>(ndn::EncodingImpl<ndn::encoding::EstimatorTag>& block) const;
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(CoordinateLsa);
const ndn::Block&
CoordinateLsa::wireEncode() const
@@ -127,17 +114,8 @@ CoordinateLsa::wireDecode(const ndn::Block& wire)
}
if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::HyperbolicRadius) {
val->parse();
ndn::Block::element_const_iterator it = val->elements_begin();
if (it != val->elements_end() && it->type() == ndn::tlv::nlsr::Double) {
m_hyperbolicRadius = *reinterpret_cast<const double*>(it->value());
++val;
}
else {
std::cout << "HyperbolicRadius: Missing required Double field" << std::endl;
BOOST_THROW_EXCEPTION(Error("HyperbolicRadius: Missing required Double field"));
}
m_hyperbolicRadius = ndn::tlv::nlsr::readDouble(*val);
++val;
}
else {
std::cout << "Missing required HyperbolicRadius field" << std::endl;
@@ -146,17 +124,7 @@ CoordinateLsa::wireDecode(const ndn::Block& wire)
for (; val != m_wire.elements_end(); ++val) {
if (val->type() == ndn::tlv::nlsr::HyperbolicAngle) {
val->parse();
for (auto it = val->elements_begin(); it != val->elements_end(); ++it) {
if (it->type() == ndn::tlv::nlsr::Double) {
m_hyperbolicAngle.push_back(*reinterpret_cast<const double*>(it->value()));
}
else {
std::cout << "HyperbolicAngle: Missing required Double field" << std::endl;
BOOST_THROW_EXCEPTION(Error("HyperbolicAngle: Missing required Double field"));
}
}
m_hyperbolicAngle.push_back(ndn::tlv::nlsr::readDouble(*val));
}
}
}
+5 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, The University of Memphis,
/*
* Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
*/
#ifndef NLSR_TLV_COORDINATE_LSA_HPP
#define NLSR_TLV_COORDINATE_LSA_HPP
@@ -141,6 +141,8 @@ private:
mutable ndn::Block m_wire;
};
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(CoordinateLsa);
std::ostream&
operator<<(std::ostream& os, const CoordinateLsa& coordinateLsa);
+4 -8
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, The University of Memphis,
/*
* Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
*/
#include "lsa-info.hpp"
#include "tlv-nlsr.hpp"
@@ -72,11 +72,7 @@ LsaInfo::wireEncode(ndn::EncodingImpl<TAG>& encoder) const
return totalLength;
}
template size_t
LsaInfo::wireEncode<ndn::encoding::EncoderTag>(ndn::EncodingImpl<ndn::encoding::EncoderTag>& block) const;
template size_t
LsaInfo::wireEncode<ndn::encoding::EstimatorTag>(ndn::EncodingImpl<ndn::encoding::EstimatorTag>& block) const;
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(LsaInfo);
const ndn::Block&
LsaInfo::wireEncode() const
+5 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, The University of Memphis,
/*
* Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
*/
#ifndef NLSR_TLV_LSA_INFO_HPP
#define NLSR_TLV_LSA_INFO_HPP
@@ -154,6 +154,8 @@ private:
mutable ndn::Block m_wire;
};
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(LsaInfo);
std::ostream&
operator<<(std::ostream& os, const LsaInfo& lsaInfo);
+3 -9
View File
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
/*
* Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
*/
#include "lsdb-status.hpp"
#include "tlv-nlsr.hpp"
@@ -123,13 +123,7 @@ LsdbStatus::wireEncode(ndn::EncodingImpl<TAG>& block) const
return totalLength;
}
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(LsdbStatus);
template size_t
LsdbStatus::wireEncode<ndn::encoding::EncoderTag>(ndn::EncodingImpl<ndn::encoding::EncoderTag>& block) const;
template size_t
LsdbStatus::wireEncode<ndn::encoding::EstimatorTag>(ndn::EncodingImpl<ndn::encoding::EstimatorTag>& block) const;
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(LsdbStatus);
const ndn::Block&
LsdbStatus::wireEncode() const
+4 -2
View File
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
/*
* Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
*/
#ifndef NLSR_TLV_LSDB_STATUS_HPP
#define NLSR_TLV_LSDB_STATUS_HPP
@@ -165,6 +165,8 @@ private:
mutable ndn::Block m_wire;
};
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(LsdbStatus);
std::ostream&
operator<<(std::ostream& os, const LsdbStatus& lsdbStatus);
+10 -18
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, The University of Memphis,
/*
* Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
*/
#include "name-lsa.hpp"
#include "tlv-nlsr.hpp"
@@ -26,7 +26,7 @@
#include <ndn-cxx/encoding/block-helpers.hpp>
namespace nlsr {
namespace tlv {
namespace tlv {
BOOST_CONCEPT_ASSERT((ndn::WireEncodable<NameLsa>));
BOOST_CONCEPT_ASSERT((ndn::WireDecodable<NameLsa>));
@@ -62,11 +62,7 @@ NameLsa::wireEncode(ndn::EncodingImpl<TAG>& block) const
return totalLength;
}
template size_t
NameLsa::wireEncode<ndn::encoding::EncoderTag>(ndn::EncodingImpl<ndn::encoding::EncoderTag>& block) const;
template size_t
NameLsa::wireEncode<ndn::encoding::EstimatorTag>(ndn::EncodingImpl<ndn::encoding::EstimatorTag>& block) const;
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(NameLsa);
const ndn::Block&
NameLsa::wireEncode() const
@@ -95,10 +91,8 @@ NameLsa::wireDecode(const ndn::Block& wire)
m_wire = wire;
if (m_wire.type() != ndn::tlv::nlsr::NameLsa) {
std::stringstream error;
error << "Expected NameLsa Block, but Block is of a different type: #"
<< m_wire.type();
throw Error(error.str());
BOOST_THROW_EXCEPTION(Error("Expected NameLsa Block, but Block is of a different type: #" +
ndn::to_string(m_wire.type())));
}
m_wire.parse();
@@ -110,7 +104,7 @@ NameLsa::wireDecode(const ndn::Block& wire)
++val;
}
else {
throw Error("Missing required LsaInfo field");
BOOST_THROW_EXCEPTION(Error("Missing required LsaInfo field"));
}
for (; val != m_wire.elements_end(); ++val) {
@@ -119,10 +113,8 @@ NameLsa::wireDecode(const ndn::Block& wire)
m_hasNames = true;
}
else {
std::stringstream error;
error << "Expected Name Block, but Block is of a different type: #"
<< m_wire.type();
throw Error(error.str());
BOOST_THROW_EXCEPTION(Error("Expected Name Block, but Block is of a different type: #" +
ndn::to_string(m_wire.type())));
}
}
}
+5 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, The University of Memphis,
/*
* Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
*/
#ifndef NLSR_TLV_NAME_LSA_HPP
#define NLSR_TLV_NAME_LSA_HPP
@@ -152,6 +152,8 @@ private:
mutable ndn::Block m_wire;
};
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(NameLsa);
inline NameLsa::iterator
NameLsa::begin() const
{
+3 -9
View File
@@ -21,6 +21,7 @@
#include "nexthop.hpp"
#include "tlv-nlsr.hpp"
#include "coordinate-lsa.hpp"
#include <ndn-cxx/util/concepts.hpp>
#include <ndn-cxx/encoding/block-helpers.hpp>
@@ -49,8 +50,7 @@ NextHop::wireEncode(ndn::EncodingImpl<TAG>& block) const
{
size_t totalLength = 0;
const uint8_t* doubleBytes = reinterpret_cast<const uint8_t*>(&m_cost);
totalLength += block.prependByteArrayBlock(ndn::tlv::nlsr::Double, doubleBytes, 8);
totalLength += prependDouble(block, ndn::tlv::nlsr::Double, m_cost);
totalLength += block.prependByteArrayBlock(
ndn::tlv::nlsr::Uri, reinterpret_cast<const uint8_t*>(m_uri.c_str()), m_uri.size());
@@ -108,13 +108,7 @@ NextHop::wireDecode(const ndn::Block& wire)
BOOST_THROW_EXCEPTION(Error("Missing required Uri field"));
}
if (val != val->elements_end() && val->type() == ndn::tlv::nlsr::Double) {
m_cost = *reinterpret_cast<const double*>(val->value());
++val;
}
else {
BOOST_THROW_EXCEPTION(Error("HyperbolicCost: Missing required Double field"));
}
m_cost = ndn::tlv::nlsr::readDouble(*val);
}
std::ostream&
+40
View File
@@ -23,6 +23,7 @@
#define NLSR_TLV_NLSR_HPP
#include <ndn-cxx/encoding/tlv.hpp>
#include <ndn-cxx/encoding/block-helpers.hpp>
namespace ndn {
namespace tlv {
@@ -54,6 +55,45 @@ enum {
RouteTableEntry = 145
};
/*! \brief Read a double from a TLV element
* \param block the TLV element
* \throw ndn::tlv::Error block does not contain a double
* \sa prependDouble
*/
inline double
readDouble(const ndn::Block& block)
{
block.parse();
auto it = block.elements_begin();
double doubleFromBlock = 0.0;
if (it == it->elements_end() || it->type() != ndn::tlv::nlsr::Double ||
it->value_size() != sizeof(doubleFromBlock)) {
BOOST_THROW_EXCEPTION(ndn::tlv::Error("Block does not contain a double"));
}
memcpy(&doubleFromBlock, it->value(), sizeof(doubleFromBlock));
return doubleFromBlock;
}
/*! \brief Prepend a TLV element containing a double.
* \param encoder an EncodingBuffer or EncodingEstimator
* \param type TLV-TYPE number
* \param value double value
*/
template<ndn::encoding::Tag TAG>
inline size_t
prependDouble(ndn::EncodingImpl<TAG>& encoder, uint32_t type, double value)
{
size_t totalLength = 0;
const uint8_t* doubleBytes = reinterpret_cast<const uint8_t*>(&value);
totalLength = encoder.prependByteArrayBlock(ndn::tlv::nlsr::Double, doubleBytes, 8);
totalLength += encoder.prependVarNumber(totalLength);
totalLength += encoder.prependVarNumber(type);
return totalLength;
}
} // namespace nlsr
} // namespace tlv
} // namespace ndn
+17
View File
@@ -59,6 +59,23 @@ public:
face.processEvents(ndn::time::milliseconds(100));
}
void
checkPrefixRegistered(const Name& prefix)
{
bool registerCommandEmitted = false;
for (const auto& interest : face.sentInterests) {
if (interest.getName().size() > 4 && interest.getName().get(3) == name::Component("register")) {
name::Component test = interest.getName().get(4);
ndn::nfd::ControlParameters params(test.blockFromValue());
if (params.getName() == prefix) {
registerCommandEmitted = true;
break;
}
}
}
BOOST_CHECK(registerCommandEmitted);
}
void
addAdjacency(AdjLsa& lsa, const std::string& name, const std::string& faceUri, double cost)
{
@@ -57,6 +57,8 @@ BOOST_FIXTURE_TEST_SUITE(PublisherTestLsdbDatasetInterestHandler, PublisherFixtu
BOOST_AUTO_TEST_CASE(Localhost)
{
checkPrefixRegistered(Nlsr::LOCALHOST_PREFIX);
// Install adjacency LSA
AdjLsa adjLsa;
adjLsa.setOrigRouter("/RouterA");
@@ -108,6 +110,13 @@ BOOST_AUTO_TEST_CASE(Localhost)
BOOST_AUTO_TEST_CASE(Routername)
{
ndn::Name regRouterPrefix(nlsr.getConfParameter().getRouterPrefix());
regRouterPrefix.append("nlsr");
// Should already be added to dispatcher
BOOST_CHECK_THROW(nlsr.getDispatcher().addTopPrefix(regRouterPrefix), std::out_of_range);
checkPrefixRegistered(regRouterPrefix);
//Install adjacencies LSA
AdjLsa adjLsa;
adjLsa.setOrigRouter("/RouterA");
@@ -129,22 +138,22 @@ BOOST_AUTO_TEST_CASE(Routername)
rt1.addNextHop(DEST_ROUTER, nh);
// Request adjacency LSAs
face.receive(ndn::Interest(ndn::Name("/ndn/This/Router/lsdb").append("adjacencies")));
face.receive(ndn::Interest(ndn::Name("/ndn/This/Router/nlsr/lsdb").append("adjacencies")));
processDatasetInterest(face,
[] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::AdjacencyLsa; });
// Request coordinate LSAs
face.receive(ndn::Interest(ndn::Name("/ndn/This/Router/lsdb").append("coordinates")));
face.receive(ndn::Interest(ndn::Name("/ndn/This/Router/nlsr/lsdb").append("coordinates")));
processDatasetInterest(face,
[] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::CoordinateLsa; });
// Request Name LSAs
face.receive(ndn::Interest(ndn::Name("/ndn/This/Router/lsdb").append("names")));
face.receive(ndn::Interest(ndn::Name("/ndn/This/Router/nlsr/lsdb").append("names")));
processDatasetInterest(face,
[] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::NameLsa; });
// Request Routing Table
face.receive(ndn::Interest(ndn::Name("/ndn/This/Router/routing-table")));
face.receive(ndn::Interest(ndn::Name("/ndn/This/Router/nlsr/routing-table")));
processDatasetInterest(face,
[] (const ndn::Block& block) {
return block.type() == ndn::tlv::nlsr::RoutingTable; });
+3 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, Regents of the University of California,
* Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -110,8 +110,8 @@ public:
m_buffer.appendByteArray(payload.value(), payload.value_size());
// uint64_t segmentNo = data.getName()[-1].toSegment();
if (data.getFinalBlockId() != data.getName()[-1]) {
return;
if (data.getFinalBlock().value_or(ndn::name::Component("")) != data.getName()[-1]) {
return;
}
// wrap data in a single Content TLV for easy parsing
+9 -6
View File
@@ -1,7 +1,8 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, The University of Memphis,
* Regents of the University of California
/*
* Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
* This file is part of NLSR (Named-data Link State Routing).
* See AUTHORS.md for complete list of NLSR authors and contributors.
@@ -16,8 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*
**/
*/
#ifndef NLSR_TEST_COMMON_HPP
#define NLSR_TEST_COMMON_HPP
@@ -92,6 +92,9 @@ class MockNfdMgmtFixture : public UnitTestTimeFixture
public:
MockNfdMgmtFixture();
virtual
~MockNfdMgmtFixture() = default;
/** \brief send one WireEncodable in reply to StatusDataset request
* \param prefix dataset prefix without version and segment
* \param payload payload block
@@ -150,7 +153,7 @@ public:
}
auto data = make_shared<ndn::Data>(name);
data->setFinalBlockId(name[-1]);
data->setFinalBlock(name[-1]);
data->setContent(std::forward<ContentArgs>(contentArgs)...);
this->signDatasetReply(*data);
m_face.receive(*data);
+2 -2
View File
@@ -172,8 +172,8 @@ BOOST_AUTO_TEST_CASE(LinkState)
BOOST_CHECK_EQUAL(conf.getSiteName(), "/memphis.edu/");
BOOST_CHECK_EQUAL(conf.getRouterName(), "/cs/pollux/");
BOOST_CHECK_EQUAL(conf.getRouterPrefix(), "/ndn/memphis.edu/cs/pollux/");
BOOST_CHECK_EQUAL(conf.getChronosyncPrefix(), ndn::Name("/localhop/ndn/NLSR/sync").appendVersion(ConfParameter::SYNC_VERSION));
BOOST_CHECK_EQUAL(conf.getLsaPrefix(), "/localhop/ndn/NLSR/LSA");
BOOST_CHECK_EQUAL(conf.getChronosyncPrefix(), ndn::Name("/localhop/ndn/nlsr/sync").appendVersion(ConfParameter::SYNC_VERSION));
BOOST_CHECK_EQUAL(conf.getLsaPrefix(), "/localhop/ndn/nlsr/LSA");
BOOST_CHECK_EQUAL(conf.getLsaRefreshTime(), 1800);
BOOST_CHECK_EQUAL(conf.getLsaInterestLifetime(), ndn::time::seconds(3));
BOOST_CHECK_EQUAL(conf.getRouterDeadInterval(), 86400);
+2 -2
View File
@@ -308,8 +308,8 @@ BOOST_FIXTURE_TEST_CASE(ScheduleFibEntryRefresh, FibFixture)
int origSeqNo = fe.getSeqNo();
fib->scheduleEntryRefresh(fe,
[&, this] (FibEntry& entry) {
BOOST_CHECK_EQUAL(origSeqNo+1, entry.getSeqNo());
[&] (FibEntry& entry) {
BOOST_CHECK_EQUAL(origSeqNo + 1, entry.getSeqNo());
});
this->advanceClocks(ndn::time::milliseconds(10), 1);
}
+7 -5
View File
@@ -42,7 +42,6 @@ public:
, nlsr(m_ioService, m_scheduler, face, m_keyChain)
, lsdb(nlsr.getLsdb())
, lsaStorage(lsdb.getLsaStorage())
, lsaGeneratedBeforeNow(180)
{
}
@@ -53,7 +52,7 @@ public:
ndn::Name s2{"name2"};
NamePrefixList npl1{s1, s2};
NameLsa nameLsa("/ndn/other-site/%C1.Router/other-router", 12,
ndn::time::system_clock::now() - lsaGeneratedBeforeNow, npl1);
ndn::time::system_clock::now() + ndn::time::seconds(LSA_REFRESH_TIME_DEFAULT), npl1);
return nameLsa.serialize();
}
@@ -66,7 +65,7 @@ public:
std::string content = makeLsaContent();
lsaSegment->setContent(reinterpret_cast<const uint8_t*>(content.c_str()), content.length());
if (isFinal) {
lsaSegment->setFinalBlockId(lsaSegment->getName()[-1]);
lsaSegment->setFinalBlock(lsaSegment->getName()[-1]);
}
return signData(lsaSegment);
@@ -92,7 +91,6 @@ public:
Nlsr nlsr;
Lsdb& lsdb;
LsaSegmentStorage& lsaStorage;
ndn::time::seconds lsaGeneratedBeforeNow;
};
BOOST_FIXTURE_TEST_SUITE(TestLsaSegmentStorage, LsaSegmentStorageFixture)
@@ -174,7 +172,11 @@ BOOST_AUTO_TEST_CASE(ScheduledDeletion)
BOOST_CHECK(lsaStorage.getLsaSegment(ndn::Interest(lsaInterestName)) != nullptr);
advanceClocks(ndn::time::milliseconds(lsaGeneratedBeforeNow), 10);
// Make sure it was not deleted earlier somehow
advanceClocks(ndn::time::seconds(100), 10);
BOOST_CHECK(lsaStorage.getLsaSegment(ndn::Interest(lsaInterestName)) != nullptr);
advanceClocks(ndn::time::seconds(LSA_REFRESH_TIME_DEFAULT), 10);
BOOST_CHECK(lsaStorage.getLsaSegment(ndn::Interest(lsaInterestName)) == nullptr);
}
+1 -2
View File
@@ -452,8 +452,7 @@ BOOST_AUTO_TEST_CASE(CanonizeUris)
nlsr.canonizeNeighborUris(iterator, thenCallback, finallyCallback);
};
nlsr.canonizeNeighborUris(nlsr.getAdjacencyList().getAdjList().begin(),
[&thenCallback, &finallyCallback]
(std::list<Adjacent>::iterator iterator) {
[&] (std::list<Adjacent>::iterator iterator) {
thenCallback(iterator);
},
finallyCallback);
+6 -6
View File
@@ -111,7 +111,7 @@ BOOST_AUTO_TEST_CASE(UpdateForOtherLS)
// Actual testing done here -- signal function callback
ndn::util::signal::ScopedConnection connection = sync.onNewLsa->connect(
[&, this] (const ndn::Name& routerName, const uint64_t& sequenceNumber) {
[&] (const ndn::Name& routerName, const uint64_t& sequenceNumber) {
BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName);
BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo);
});
@@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(UpdateForOtherHR)
+ OTHER_ROUTER_NAME + std::to_string(lsaType);
ndn::util::signal::ScopedConnection connection = sync.onNewLsa->connect(
[& ,this] (const ndn::Name& routerName, const uint64_t& sequenceNumber) {
[&] (const ndn::Name& routerName, const uint64_t& sequenceNumber) {
BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName);
BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo);
});
@@ -166,7 +166,7 @@ BOOST_AUTO_TEST_CASE(UpdateForOtherHRDry)
+ OTHER_ROUTER_NAME + std::to_string(lsaType);
ndn::util::signal::ScopedConnection connection = sync.onNewLsa->connect(
[& ,this] (const ndn::Name& routerName, const uint64_t& sequenceNumber) {
[&] (const ndn::Name& routerName, const uint64_t& sequenceNumber) {
BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName);
BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo);
});
@@ -193,7 +193,7 @@ BOOST_AUTO_TEST_CASE(NoUpdateForSelf)
updateName.append(CONFIG_SITE).append(CONFIG_ROUTER_NAME).append(std::to_string(lsaType));
ndn::util::signal::ScopedConnection connection = sync.onNewLsa->connect(
[& ,this] (const ndn::Name& routerName, const uint64_t& sequenceNumber) {
[&] (const ndn::Name& routerName, const uint64_t& sequenceNumber) {
BOOST_FAIL("Updates for self should not be emitted!");
});
@@ -217,7 +217,7 @@ BOOST_AUTO_TEST_CASE(MalformedUpdate)
updateName.append(CONFIG_ROUTER_NAME).append(std::to_string(lsaType));
ndn::util::signal::ScopedConnection connection = sync.onNewLsa->connect(
[& ,this] (const ndn::Name& routerName, const uint64_t& sequenceNumber) {
[&] (const ndn::Name& routerName, const uint64_t& sequenceNumber) {
BOOST_FAIL("Malformed updates should not be emitted!");
});
@@ -240,7 +240,7 @@ BOOST_AUTO_TEST_CASE(LsaNotNew)
SyncLogicHandler sync{face, testLsaAlwaysFalse, conf};
sync.createSyncSocket(conf.getChronosyncPrefix());
ndn::util::signal::ScopedConnection connection = sync.onNewLsa->connect(
[& ,this] (const ndn::Name& routerName, const uint64_t& sequenceNumber) {
[&] (const ndn::Name& routerName, const uint64_t& sequenceNumber) {
BOOST_FAIL("An update for an LSA with non-new sequence number should not emit!");
});
+2 -2
View File
@@ -32,11 +32,11 @@ BOOST_AUTO_TEST_SUITE(TlvTestNexthops)
const uint8_t NexthopData[] =
{
// Header
0x8f, 0x1d,
0x8f, 0x1f,
// Uri
0x8d, 0x11, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70, 0x2f, 0x74, 0x6c, 0x76,
// Cost
0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f
0x86, 0x0a, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f
};
BOOST_AUTO_TEST_CASE(NexthopEncode)
+57
View File
@@ -0,0 +1,57 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
* This file is part of NLSR (Named-data Link State Routing).
* See AUTHORS.md for complete list of NLSR authors and contributors.
*
* NLSR 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.
*
* NLSR 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
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
#include "tlv/tlv-nlsr.hpp"
#include "../boost-test.hpp"
#include <ndn-cxx/encoding/estimator.hpp>
#include <ndn-cxx/encoding/encoding-buffer.hpp>
#include <ndn-cxx/encoding/block-helpers.hpp>
namespace nlsr {
namespace tlv {
namespace test {
BOOST_AUTO_TEST_SUITE(TlvTestNlsr)
BOOST_AUTO_TEST_CASE(TestDouble)
{
ndn::Block block = ndn::encoding::makeNonNegativeIntegerBlock(0x01, 1);
BOOST_CHECK_THROW(ndn::tlv::nlsr::readDouble(block), ndn::tlv::Error);
double value = 1.65;
uint32_t type = 0x251;
ndn::encoding::EncodingEstimator estimator;
size_t totalLength = ndn::tlv::nlsr::prependDouble(estimator, type, value);
ndn::encoding::EncodingBuffer encoder(totalLength, 0);
ndn::tlv::nlsr::prependDouble(encoder, type, value);
BOOST_CHECK_CLOSE(value, ndn::tlv::nlsr::readDouble(encoder.block()), 0.001);
}
BOOST_AUTO_TEST_SUITE_END()
} // namespace test
} // namespace tlv
} // namespace nlsr
+5 -5
View File
@@ -32,15 +32,15 @@ BOOST_AUTO_TEST_SUITE(TlvTestRoutingTableEntry)
const uint8_t RoutingTableEntryWithNexthopsData[] =
{
// Header
0x91, 0x37,
0x91, 0x3b,
// Destination
0x8e, 0x09, 0x07, 0x07, 0x08, 0x05, 0x64, 0x65, 0x73, 0x74, 0x31,
// Nexthop
0x8f, 0x14, 0x8d, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70,
0x31, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f,
0x8f, 0x16, 0x8d, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70,
0x31, 0x86, 0x0a, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f,
// Nexthop
0x8f, 0x14, 0x8d, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70,
0x32, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f
0x8f, 0x16, 0x8d, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70,
0x32, 0x86, 0x0a, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f
};
const uint8_t RoutingTableEntryWithoutNexthopsData[] =
+4 -3
View File
@@ -32,13 +32,14 @@ BOOST_AUTO_TEST_SUITE(TlvTestRoutingTable)
const uint8_t RoutingTableData1[] =
{
// Header
0x90, 0x22,
0x90, 0x24,
// Routing table entry
0x91, 0x20,
0x91, 0x22,
// Destination
0x8e, 0x09, 0x07, 0x07, 0x08, 0x05, 0x64, 0x65, 0x73, 0x74, 0x31,
// Nexthop
0x8f, 0x13, 0x8d, 0x07, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f
0x8f, 0x15, 0x8d, 0x07, 0x6e, 0x65, 0x78, 0x74, 0x68, 0x6f, 0x70,
0x86, 0x0a, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f
};
const uint8_t RoutingTableData2[] =
@@ -73,7 +73,7 @@ public:
// Need to send an interest now since ChronoSync
// no longer does face->put(*data) in publishData.
// Instead it does it in onInterest
ndn::Name lsaInterestName("/localhop/ndn/NLSR/LSA/This/router");
ndn::Name lsaInterestName("/localhop/ndn/nlsr/LSA/This/router");
lsaInterestName.append(std::to_string(Lsa::Type::NAME));
lsaInterestName.appendNumber(nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
+10 -17
View File
@@ -1,7 +1,7 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
"""
Copyright (c) 2014-2017, The University of Memphis
Copyright (c) 2014-2018, The University of Memphis
Regents of the University of California
This file is part of NLSR (Named-data Link State Routing).
@@ -25,20 +25,13 @@ def build(bld):
if not bld.env['WITH_TESTS']:
return
bld(
features='cxx',
name='unit-tests-main',
target='unit-tests-main',
source='main.cpp',
defines=['BOOST_TEST_MODULE=NLSR Unit Tests'],
use='nlsr-objects'
)
bld.objects(target='unit-test-objects',
source=bld.path.ant_glob('**/*.cpp', excl=['main.cpp']),
use='nlsr-objects')
bld.program(
target='../unit-tests-nlsr',
features='cxx cxxprogram',
source=bld.path.ant_glob(['**/*.cpp'], excl=['main.cpp']),
use='nlsr-objects unit-tests-main',
install_path=None,
# defines='TEST_CONFIG_PATH=\"%s/conf-test\"' %(bld.bldnode)
)
bld.program(target='../unit-tests-nlsr',
name='unit-tests-nlsr',
source='main.cpp',
defines=['BOOST_TEST_MODULE=NLSR Unit Tests'],
use='unit-test-objects',
install_path=None)
Vendored
+11 -10
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# encoding: ISO8859-1
# Thomas Nagy, 2005-2015
# encoding: latin-1
# Thomas Nagy, 2005-2018
#
"""
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -32,13 +32,13 @@ POSSIBILITY OF SUCH DAMAGE.
import os, sys, inspect
VERSION="1.8.9"
REVISION="8a9ccbc1c5d3936b0b08e972e4883a9a"
GIT="2a098b1e9bc626c19cbd47c1f670758c17edf54c"
VERSION="2.0.6"
REVISION="593191f496fe8c66231dfd5df26167ae"
GIT="459ddf50b622573ecfe36c12c076e0fcc610b01e"
INSTALL=''
C1='#-'
C2='#+'
C3='#)'
C1='#2'
C2='#&'
C3='#%'
cwd = os.getcwd()
join = os.path.join
@@ -165,5 +165,6 @@ if __name__ == '__main__':
Scripting.waf_entry_point(cwd, VERSION, wafdir)
#==>
#BZh91AY&SYüÆ 6*Zÿÿ´�AÿÿÿÿÿÿÿÿÿÿÿD #)†Ž"¢D˜ @ ¨8aðœ÷½p€#)#)#)#)#)#)#)#)#)#)#)#)#)#)#)#)#)#)#)ùçÛµ‡­>ÞJí}iÛeHÛCWmk^|ã½dm}šª¥ë×U­jï<÷x]“©¶“+jÝpâ�o}=×Îvºîí°W–$�¢¯g»=fv:z=ë:uë]»v]==(ßvCÛÝÝ›½é÷Þ{é+îûš«ÇAëÓßw}÷ß}žðúêvø_mÛ­—Û}ƒàwc{©Å=åî#)#)#)#)€–Èoµ)ôt<t;}°—0ÓºX,ß@÷™ž�ÆÐwgF†3¾¯oG¡ï5 ÜÂT¡@¢†½A¡ŠP‰A{·Hz4%šJTë#)®Ë ^ºw@éÓÞúízïwnáíZÀî½íç•2Ôwv”ìÜÍ]šqkî÷m•‘XúWs|põ·¾óëØ×Õ½Öóww>æ›{»·Û3<ßw¹ßnöU§váíõßHõŸ%‹=>¼Jîæžö­w6¾ïpÈ*T;(¦Œ†^ë;™Û±žw¦v#)t=]î3¬h¥´H+{½ç¶ávÐ#)¢„ô3Ó@ô={4Ð7¯qZ�¼Ý'œ×nîÝAí¨Þ‹3îù½�€Ð.Í#-úxJ6aά¼{€;¹ç�S¾ÝAÖÏxó½”Snï@9›îÏ­ÞoP¼÷x×v=ªù{°sm:4$ºzû¾ùãì,8÷^WTžµÊž�»ìåÛ¶chúÖûÞÏ×¾÷·¼ªç»;}{Ë=³_wÜ{L|ów®çΰ<׸i=àÏW�vä žG§M9{kExEÙ®ú…¬Ûx·ñ¾ï‰Ý�µ›Îî·]Ï·÷rõ÷Ù[,÷hC7}¼¶òö¯v>÷ ïMòu€ ï,ûϾó×¾÷È/¸}ÑÏ$€*#-:-„…˜�kjNjºÐ/²­ã½+­ì˜äê»[{±v–(åpa넨Žío`ÓXû·×Ýßo¾úú=ð#)öåÚ€�·_a—ÞÞ»ßol÷½´9wÝ�¹ºõéË}‡Ýë§Í >ÙãÕÝÃ�ºÅt#+í}o/¾÷gc=Ýn­†ë±×·¼{kzsï·Šm¾öøm#)hŸ_}ç«kkP/£�UªÑàWo\íÖŽÞÞ'Ý÷Þu6MnûnÔ’âuÚöáðñ³ò>özÛ}öåöÜZÔÐÖÁ­U÷ÝÓ¡}ºx§]wŽø9uÐWÝ„éx_ZÛ¼žºìGϾ^÷wsï@0kD¬ÀÚϼ¶ß[ìz7;Gí¾ööÏ�Ö¶Òë³íËÐ÷Ü Ï½÷¾fû·:Ëç»ÞßwÕwŸTÛÜåÑ W b¶Ð—«op;º·�îŠsƒTwnØtËxduŸ@:(5sC×·#)ôG³ÈÙ¼|_{½î‚@�ô+UAOoOo¾ûîõw@c}}w—K[.×Þx{Ûíç¶ùöݳwW=9t*ŠHÞíq»;[ë”'bõV_w¹î[GÙ[Ó/}gmô4»œ}Þ¯ºõ|CŸ+îÝavù>zn°§°£O¾Î=›k¢ëY[¯¢÷wÛÕ·½0W‹ï{“}™`éÙ+ͯêòð6û¡^>îšA#)#)™#)#)& #)&™�2dÑ“ô‘£ô ¦ž 4z<”ýPJhDL€&§¦ˆõ12i¨<S2!µ#+#+#)#)Ð#)#)#)#) &"`€#LMI´Töž©”óTñ=)êmªhhÚŸ©4Éä€hÐ#)#+#)#)#)Iꔑ4‚hj§á¢žQµOOJzžž¨Ñ£z†�£@4È#)4#)#+#)#+#)#)#)D�„Ð#)F�4È#)™a0#-yÓ&¦�#)#) #)#)j"4ja �MOjjhõOÒf©“õOÕ=ª‡éG¨~¨È€#)ÿï¢ÿRÛjîßì›Rmlº'êÛjîR3GÆÛS�²L’�„F@« „O|QRÑ@B±#)�ÝÇåù~–µd³óÍæö;…ß[Ç3YuŒ™‹qâ±W/V÷iÌ(ÃЦÞáó3ýD7ÌÿC à1)ìH@lðbê¼0ΦV›Ê[Úl’:eª²Jܶ(d•¹qÓ+˜ëß-ð´ãy½n“Wy5xàÖ¶JëÂfä·pø¹Â³êÓT;Ä+›Iêq þ~Žß· ÷ÞmY«6±’¹ºUiZ¤²¨H„‚€B 2(�ÕB©b€<‚ƒ2#-#)^ „† ¨Ø€�ˆ¢�€{ …BÊ‚�A Õ HŒŠ¢�(UI€P`ÌJC3LH„ȆŒfѳ4D”ÔŠXÈ™)E1M´•#+L’X XMR¢²Pa(f‰²…²c%fPE™¢XКaJ H¤Ø‹F(ŠIJ”ÍQ Á,´�T’ ƒ)"E¶“T,–libjF()%Ò$aflZ5¦Õ¦µR’mDÉ’d�E±µ+XÍ0Í™Lµ%“)¶Ä©¶&6j’ML,Š$š‹fF¤f´m!&™ ¦IF‚’ÒAh¥*’±‰‚#-34¦&›Á*S`˜@1 f#-™&D¢$¡dªH)bY42DJB)%%,Rdƒh¦2R“jÔcPÙ X˜QE),J$Ò)DÆ,LT&Sh¤™i ¤‰ Å‘¤Œ’¥S0Ö�¨dQ,1&$$�MˆÔ–ËD�l‚‘%Æ’�¦l`’MIˆ¤ŒˆH™‘¤ 3„d¬Ë04%F"B$„©6�$“M-$É¢ÊSÍ¢4Ò(Њ!JHFh4‰3T²À‹)E%!“K$Ù¦Q 5,RY‘±£+$ÌI"‹@3c,�¨’È*#-Yš1´Y¤l”fSf‰)­¦Á¡ˆL¦1¦Ô™)3#+4”³Q¤²¥FÅ(¤ÔDÄ™IJ#-hÐ $Œ�Ó"„ƒA `Íi´3Ye,‹&aJB›I²Ql‘hÒL’J‹%#+#X#+&QCd“f³5Ä`”¨e3Jb#-™4EK³Sb“(²2bJÙ$…”Tȱ4Á@ÆˆÚ RdÒ’f&É£&B¡�F°“+)0Ú &ÉH$²e¦š ‘”ÊFXŒ’•Mš*6�D&PL‰IZ1¶4“5‘CI�I #*4† %‰hÚ5)3V&ZL‰š)0’ȉB¥�£I�ÆQšCfÕM­´UdÔÐ5’ƒe$mÉL“ÖKEš4�1”Í4Ù)J-LŒlÛ�#-›(ÊFh¡K_­­Ñ¤,­!�–Q’šÆÖŠÅ¢£BfTDÓl–ƒTÅI-SC`ÒÄPÒ”„ÒF³*jÔYÖL†ÆQiQ¤Z&LÆ¥¥˜É"¢Ã3)ªÍd5dlЦØV)²‰,¨ÊUbš´›HVl­f¥)M0ÛLP¦DXÖ�5*$´Ê4FXÚ+fhÛ U™ª5XHÔ”m±´lJ5FhˆU…A¢Ö5FÃ5!µˆMd…¶š!”¢J)ÑF©D¦Ôª5$›F5!b´Éš¶³jÓA,56£e‘2¦²$ÌÍM)“-ªZŠZJf¦›3ZU+%T¡ �´©”¤ÚšV›1i45³Y™’JË3`Ô–ÒÚY ¦”hˆ Ôi(Ò!l„d B‚™&6£jH”›Êm�¥&š*2dÐi)…#-)¥DlR K1¤B#+4S%2cYMš±!(TlY’Å+5%€ÆÙ–M,ÆSHED”¢LX0›16"(ÔlIIFFƒH³(µ31#-JƘLØ4dر0ÆÌµš(K@R!©M£!fm66(Ð�¤´Ð‘I‚°¥–ƒ "LVBi)Mƒ%±#-MJ"I6jQ UU31°Ø©M&ÈÚL¢Í%¬A!�¢J$L›)&„©-&dlÍ1 *[,ØÚ#-ÊlÑDlblRi©&S&Š™mHÉ”´l””fÀ‰& b&4cL£E5–M’”11RBE¢±a6-(ÛZi0É3D”šE¢˜ؤˆÅ‚ÙiI&¤0ɘi)fCL+F�„6�Elš4&XV‚ ’-%±Pca@ÑIªR‰«ÆS3B�’JÌŠ’‰-!¢,²Ö¦,ɨ´c+%¡¥(TiIMT²J’™JQ«b#+REJ4•FFÉcY4•5TÌS(©Kd-b¡¤™²E&ņ�B"Å‹LÉC4`ÚL‰3DŠ©Di„Ê[1¢ÑZ-Ф„*%0c)Q¨Ú6™%  QI„I«J#--)ªSi5±¬Vɬ–³H#-Ñlš’‹Å(#(1³B$„ÆÉL0f¨‚�±±mSm¤¡–ˆ+ šŠ‰#-Ñ3l³j6ŠÅE¬I&Ú”fÍ�ÒÊĪ1h¦Xªš“M¥FŠQ,˜²¥E ’¢ŠÉY-’�²jÅ&Ò™”Y6�#-F¢’�‹m¶kZhÍBÉb$©”mÂ�h4š–ÍY1‘‹´QÑZ5±h¶Ú6¨e“kb-SR³j&Ê@Ø‘´“6VR‹$lÒ¢(&cbH’L¤™ Rm‹2Õ1òþ‹ýWô[î[Ï—_Î`¹z~*di)›ÿÓ¸[5BÓüåÕ¤\2#-Jd]ê¢$LLY”ÿ°‹0áÿWú¨Ö*j-ÁÈŸûó Ê6½õížÊD>{9ÆCp<X«šå�Ü–#-Y�3£XÇ]Ù�©ñTüZ¡�~‡tõê?�æ²Ë¿Æ”“&„lh;•L³¶»Yb"<ŽÂXA"!¢vÍÜ#®¿eìÑûõ9Û‰„g¥‹üHWt㬊ÑÁF‘ãàíi�r7¨£�Û­ìkd˜RTÆÛ®W]§ƒmÅ1Ì”*»!¥¥dª2˜`qi#’¤�y6 ª$¥TbZe f­*¨eÂÿméof ›š�’Ö`–ßM׃ŒC »U„MÙ#)l×v$Ó½›šJ,Fï:ñOgnùöòŸøhþ˘C�Ê�5ªôI³,b"§ºŒ¥Œ‹"¯Ùþ\��µ£0#-�¥ïv†*�6P…¡CO èW÷ç$Æ•ª¤–‰eHb? ã8ð}”N ŽÃËÀË»3*Ò8‡¶Q#+ƒDãÊÆŸé¯‹2B<¸´ #+8]¨"D`Äcy¹j)5Ý΋¸Ñ\Üɤ)5¤Š )‚ø ÌHe€a §Jñ¹ä�²&Z`E=ÔÄ¥:ð²ßKœó‚;a+⤔:0ŠHC¢Ø”‡Š¿šÖ÷ž—»UÔ¶önšv(Ñ‘AðùÞÞ–FDP£GäU£–�Å#+4©XMÈ@n ##Ý×aÝtÑPo’­ç�þåô]äKDkò.öéÖé5ßß9W‹mþ1üa8þy¼÷Çý�Ǧ‡þ‰Ë$�õ1ÒBº»oç®Õʺ›\å»ù3ëÜûóK¨ˆ¦¦q, *´’�¾«^Û—â5Ïé?o�LÍÄV«8;B¿M\ę䡎²5m\¿Â§jjœ+�C»� ²xqÖýé;Q#+èt%Öý]O­,㱌Ÿ+]­ðq P튀€ …?N` g{„3«BŠLÓÙt m éì•,XZ2ékÑcaþëÆ.ì1‰¶“¼°¥‚Á/N·�½øâŒ=P*']h³f ØÒ‚ˆµâ—šÅºº]ý¹Î$PÍ]œóÉßÏî·à2o±Úl’Œ…í„G°�m&žÆ»R O‹<†\ˆïHÔ_ûÍ/yT�6·£\-V)(ºµcÇz.KzíÙõwåÝM¢Œh¯̲oÍr±ªý·”Ôi÷ÜY0Êî ÷6£ÿn§_ñT8™* ’S#+wWlF4X1ˆÂjOJJCÝŽ¹Ä„–4$RÚg^u„ÂEä… ä!BKII¦ÇÙŠ" ³•_�ìòcâã(ß®k�øq¤¶L/n·_òó¼ã±cX²UõOö‹Ý\�¯Æê¯;­ò‡¥àaóÔ4ý#ŠÀŒ8Òãß#)ñçT¦‰Ï%Cˆ.•µ›3É �‚ˆ©#+{öžFæÝMñ.¤h®q,Uõõ &Ã!IµP]e ‚ÁÒ€ö¤±G)QˆÒB„¶¡5uªSf Ð@ïª-¥Q4í»€ßËÏ– ÀÕàÂÓ·­YRL•HÀ^Ö᪒©�¤·hœÜC%¨ú1ÙXm¥§d™j(ø‘³±£FoœÄ8W�Ьñí¨y³#)£É¥òí IžÙõŠû¤<Ù>Û;öß—Ï5îè)ÚÌãÚˆ«ÕF1tÊ� ¨ù\Û 9Ê©EJ‰©,9QFþ~·‡|T°ðIHDä”H¤&h ØÁž�*‡æOfÔÄ0„Œm6¡4‡f+«�û®÷åyaðá½ö²uCaÇêÌ!ýþ•jiÈ�LjN ¡Îê½&òéïƒÖšÍ˜tjɬ!H#-©K”[ï¢åbé–‹v#W*ƒÆ‰’Ù7¯tCefCáPoZïtÅF% ‹�3ü2gP¦þU³|¸ÑsW½P‘Ñz×NÒ˜ûÈqe9/Ó8û/ùxÏ~yŒÅC¾ù$ǶóÆV1^75&}U4E9ùiö˜UˆüÔs[HB 5z¯lX?tB|å/tM Ø¥µ Line truncated
#BZh91AY&SYü¢K°ÿÿ°ÐÿÿÿÿÿÿÿÿÿÿÿÿE ‚„ 0�#%ˆ(b |wzs*#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%úóJ´¶*«ûÜ=JV;ºîË×v›»ª‹­^\¨IÓ$o£=>í_nÓk!Û®ÖëÓ'›ßO¾X6½³gvÝ”qP{»¯Z´kRÛ]/I±Û1Öï6¡z÷ÎÏ1¶*úwšûè÷yã×¹Z>º{ƆAÝž¾vwÇv]ã}½µ[½7 v9­Kmïk€#%#% #%»€À˜gÛ#%<m™vŒ¥Û·#&;›@Ü9Ù£VÀ#%ŽçUÝÓè®’žƒÐP9¬èÔ´ÑT¢µ¯C#%•H*”R‚ÞáÕ E$C £BT¨(hw¼!»ëo=ÖŸfW}'½»«˜›½êÞn­S3®)PîîZdT§Z·×šèûß]è#%¹äó£^}³í‹Ûky½ìõ×yîôgmíË×¼¾÷;|»í}öÏiÙÒ¹9ï¹ïl°Þ³Ÿ½½÷Þ�¼ø\ôÐè¶ëÎÞ@:AH*ƒÐelkÖ¶Ù»u¬Ý»ÞzÇLWZí±£0îÎl¤Š”ş)è#%*"ˆ h<�ch•=î¹y–cníÝÁ¥7Ð;¾îçÌËìh¢€ 2=˜[ \`]æìÍ€ß{Ý�h{r®ûïyÐö½¹ßcÜûž÷ßcÒ󯫺»ƒ{�vz%¾¸qzµöòõ7�uÛ3{nâñ›ç¯¼ßw¯z{œõí»s¨Û{Ín’mã‹»k»»Ý«Ù]ÃŽž¾½êï�+±GÝ�HÖë…×^á wÝÂ_Éè×¼`£§¶¯®¾ÞÎ_n_I/»« DùökÛ»›6Ù«ÝÛ}Ί÷œ˜ûÙ/½ÁÞKë ôs½ïqé4ò݇k­.�9°tçµçzuß{ﻇݰòÛpJ)@*% *UBftI¶p;=†�‹k7·c¾Ê·*ö÷¡í‚Ì÷3vÖt<«©³Ø1n“«ÍãÞj©o]åÔhAÝf÷s®Ìð#%·g8€#%¢÷«—#»ÎëÞgºÍ¶g'LŸlóÅ÷6[¾ìsx¹ÝCeôË£Ó§ßw}>\o»u{d7:"õÁsÖ¶Î-óÙÆîg%@h{{–Ú‹�u½(¹^)èR»ÃM«Ñ³ß^\}ó0ìå­îõÏ+wrñãÜxûÞÝãÞfk³w>-=íÜ»”Æë}î|{FlÁ°l0äÐ;zé<¯§nñ|ÜîƒVÁš«‡ÖôhÙÕÙ{Ùß/«�»Þ´#%ÀU®Ø¸Õ°¹)O­{Í4n Öïwvn.ë…[îÜ·ŽÕÖíÞŸCÐ÷Ìݾ·µ¯»YA}{îuóêû7±ÑÐ ôÂì¶yާužÏíOwváÜ:­0-¶w¼îò{é÷Ø—ˆ4ô#%vböÍ«`î#%(wm{“­ç¶¾øSßs€;°ª#%#2h2{{a]ÝÖí€Fæ{ÆïMÖÔhš±½iuÝÚë�¬·aô÷oUQCºXWNì®—vÝ·KÃwVsvÜmôïL—Œ¯!G3ñ|»¯÷Ÿ|¯ZÂ³Øø'¬Hš“MëîñÛ×]spÈÊãÞå±;­Úu`ÝñÝ÷Îì ¯ƒ›s¨ñVóÒóŽðèï�|}îh€ #%@h44˜†šbh4§å#%š�Hö¨M6 ÐýSzPJh‚@€ ’`!2b“ÔýSôM¤�4H=A h#%#%#%#%‚DAÑ &)± ‘ªze<Ñ©š¤x“Ôyi#&¦ja=@dd44#%#%Iꔑ&§¢m“%=•=’žÕz�z�¡¡ê4z€=A¦G¨#%@#%#%$!#%L€  #&&L@“ÔÆJf˜ši�Fh#HÈ#%#%#%#%j"@&€ MÉ‘ªŸ…Oõ‰éOÊz†£Ñ¢<¦Ò4Ð#& €Ð#%—ÿÙþÕU®¸‘þô–µ9~åV»¦%1’�ñª×tB2UE¦­'¾ÕmsjÚ¢Õ­ó¤Á>ãï?ø~2ßÀuÒjÌR’ÓYŸŽ]¾%é7Š’› wsRÓŸò‹àºÌþÀ%qDH+Bƒ¯U¢Â»`í™'—æDôðÙ§‹‰ªuN�TÛÍñxyÁ‡ˆ"™¼/p+œb#2‚kg þ\¿¬W}ÆÛMT¶™l§uu«KmEµRU¬ÊÖ’¶Ú-´m¬ˆ#%Ü"*5#ÑʉAФŒ#%#%ÄT ¢‚ ƒaµ©+ô5n•o-ki«SWt 2¡ "¦b¢Šd,”fj3M‘&0H¤ØÚˆ™š„K#%–R�(¦ÚM†&h “A(Éjj-�ÑšK&šDhšˆD¨Å"jRŒ€F¥�#%i‹*mH¤Ù-Q%,´¦šÑ²Ò4Q–1Z5Q’TSd!%¦2P&4²Ò1�¥£SM„¶•µšÚÐ͉4fdÌ„ÑdÛMm4ÚÔ”l¤©­Œµ6Ù•2Òd“A°kLMJ()‘FÈ‘hDŠ‹4�¢“¢¢A Å%LÆiQT¦#Ä!#2 &0- ˆÉ#jBB4±ClÍ ˆ˜¦!™%4¬°fbD#&%‘ˆ¥’²llhؘT‹Ée!#E¥)‚lII‘FQ&ŒšdÄ‚¤£H”F’@¬‚›$‹DÌ¥¦"™‚lk$3b$Å436 …ˆÚ’À$²°„X$¤ØÔ&£�– ‘(ÐE"‰‚Á€˜e d”Â1e ”JMF¦Th¬&É©"IˆD%¥6@�‰"Él@I‹,Ê)2J&ÌÈØ‰›")FlŒÁ2©¦$„YJ ,bÈY ÓHXÄF¥d²FŤ&E4“MH•4È4hBI©%”e5LÒ6Цš(•¨C, ÒYÅ’“"h&™H•3 ”)1Pl†R #2@E&c$Œh"Y!–²L©™¶˜ÆÙMbQ2‘LB‘±e#2ÊhÙ"Š ŠI$Ù#ɳHÔÍ,FRB“31K#+6˜JÄFŠfM52i’#2CDRhŠ›Y©R””ÑHY1“"›HQdŒRŒ¤…"(±¶)$Ä’iMFɨÒ$PÒ6ÄcA3Y¤ÄÚ#&ƒ4„Òe‹DÈY‘$¦ÉLŠQ…“!-fÍ‹Y,HM%“¢¨-ËaH“!�Œ‰”jK�0”M-Ji@¢©†„™”˜¦dÙ”Á"–hÓ,!¨(M&Q‘!¢kjVÖŒPš™£)‘³J)&dDVƒR–À¥š,Å&‘”%–TÙ¢-L¬-”bC؈RˆÊF�”µû­®ˆJš¤D†#6Š1Q[X¨Ù2™¦¢•$Ñ¡¥¤6ÆÂ6I¨ÚÈŒ5#&&2Œ‘e0¤�dA˜™še²m£J[QHZ2i„KY�¡cR#2RÓL™2¤ÔU¤h©²„VÉ–ER©Y…6lf3-lX²#[&™Y¦YM¬•e²”¦™Ù%#j,R²Ä–�ÉKQª‚Õ�Z2TUd¬”mQ´TTš±4DÉbÄTEŠÔXe£kÒdÂÁµ@S(¤ÆŒ!i’iZklhÚbV1l‘bÚH+UKjÊ*)šš²h’¤bB&›H¢Éµ*ͱŠSi¶YJ™f›TÒ"5´ªY$ÌÕ*F,BÚS)¬±¡²É¬¬²³LD$2£I(‹Ñ�ˆ‘"A¡1ˆRÚ5BP!*(dÕ’i£dɤ¢ÈËŠl¤#&"+,ŒˆFS1(RQ²™ b#2-2B#6›IŠ#cd)„f™¨ÉF†˜HÌÔ#!4LÔQ¢JdR�šP5BTÀF“a)S,�š‹FBŒËQ”£fRIF@Ñ�¤1e+ÃhØÆ¤£%„h,‘e„(Éh¡ ±Hf$Ѣ̦̤¥”¬Ì•Œ ³E’6!�Hµ£f´fˆ¨h©M&ÃLT±Y”Z�FBL�1�i‰±%IRe l¦˜Ù £-’”¨Ôf4–MŒÒhѳ(iFJÌ­dFš3D ‰P"DB#&–`ˆcFÙ¤lQ¢³I²S±1II ¢Ñl%F£QF+´fk#&&I4(Y261J �Š6´–l–C2ˆ6*2JY¤©�[EBF±ª5Dš(L²´( “Rj�ƒ&…„cT¥#&XÚ#&)¦Y#2(Ñ$U2-F¨±#)kdT¢¨Ö4˜",š"™”-J) ÉD•6%2­Dm`ÑS*,•FÅšQl™+­&)+)¶BÙ66†‰²JdJ‹#&‹%MDb6ÉŠI�A«2`ÐB£Jl͉ˆ¦±ª*edÖHÒÒMEF(šmI´[)%�“�¤Á’V¤F‹K-C-Dš‹TUŒ¥I["UcRQb‘M ‘LŒÈ˜ÓR"ƒS6IšÑ*’Å´jJ–m¤Ö‰›PljB��Œ‘­ŠeSM´mFŶ1mI˜ÊQ eebZŒV,Í�¨ÚT¨¥*”f*”˜Ù@Ñ¢ÁTi5�bÌ©"Ô•±dÛ)2Ôh¬CH´RQ£hÖ¶ËUŠDÊ…LIDb¡€D–4TSI6¦É*ÆØ¶Å¦jÚ1­e¤©¡–¶RÉmMM²Ôi«FQDFŒ�¤”Pl5š“Rfl²¢(¨“I”“"21#2¤¶‹2Û1ü¿ìý›úßèuoöç?'ÃÏ5§#2‹?âÿV•fˆ)¯¶e"ÃvÝ“ùrÃrÐhÒløÞy·õž–ôæþ¯õzô4Á©Œ�ÿÇ{µSgú~ÂÛGžˆ íÿ$ãŒ#&.`Rĸ`¤�jª#2º2‘ìzÿ?ªõ{ký»´ÿ›Ì¼ÿ§ûyÞ¿ò*Æxdç�,$b/›žmíØ¶ç' «I°ö�~lGìêeGëgw«�±9;¼ÈŒSRR(j“ƒ5â䱈þúÙ³j“þíÚ�FL€I¥Û"lÆLhƒcôav4ŒŠˆÕÕ¨ÌÕLÒVS(�rÎw,Ë¿¬Îjä6.•#2b„ÑàÍ*�˜ÒæP)R�¤H¡"F(M®Û©Š�Ò2Ö‰M^<îÔ2ø·,ŒÞ›šMƒ0lË•Ì�éUOMÿç¥ò´îášb#2,íoU%0¡‚Ú§®ŠAE,PGÝÿ~²‡kÁéŠÔL¼ÛE0…6…"ÉßÇ%cýnIÆ“ÚÛAZ°YÞ�Ó¹rüc6Qœ]ж (`Ì]]×�îÿNzîm+©½…³•uM¿^ÐÆ°=¾,ZµYÞ{xòòŠ9Ë¢î)•ͺi#&UͺyÜhبŸzëå5¼Z4E‹~^êùÛöÕâûäS+âäkcs¤OånªñÎnŸµ¨KýólÚyeͳ™\Cm´ØF¾Ï:×»z{µW)6Œî¹GŽ&×iÏ&Y0Þ¥Z�m„hmmÂk®WyÝŽQÒ¹s%uÜ""ÓLEO6Ytä?¼«5J&©LR…",0!M îÛtÉÄe«#2üè¤OUM?[�1µ?'¦$2ðA¿ÙE&Ì9é‚Õ@TqPÿR!ôÄ­ŸÌš¨Ix5%Èó¯uÐÙŠO<VÜñýæ§#"^„’X£ ;•o›#b§‰Q¦½vúìrH È¦oYÂWæcv\~û,ñ>¼)Ä�Z¯oQœ�YÕ4dà&É/�z®¸3,̬^ÞZÞ{¨CÞÊAãU§îéöß©Ï+è`ö§]ÚÝ95ó¨SXÚ@¤‡!dleNÔÝ3£PRhÑ¡J]§D.ªÈ Ö(wÉe³,YL#2NM*m±Gãxû_–*sW)Ÿå˜I£íËPã#M§’+ìe#2ûÃW£¬,‰±Èj[þv&E�6(àÓﺂ±ˆÅåE4P²1ÐøPX†ù­±+W¢#cÁR…Q4iÑ—ŠE¡UŒrÐ"x³7¶•ƒÉ•¯…v&Jh tl…Exܲj7�«›cÿÖ¬A`÷´ d2…xPPÅGí|?’ƒêöëwVæÒ†§ãü>mzm"c”ÔR|;·+½ÝUº]9JNÄîÅ�5NwYJH¸JV#)×5X¼ïŽzÞ2•dØ{ÝËŠýRÝ{»‹®1¶(MÊ�5Ä´*¨Z)‹"�Y“‹ÚËa¨4–û4Yð__žò¾ß]÷ýù¦Kó8²"4£�n"U�ñˆïà@Æ#\Ö¶jϽ$Â!F£éD•¬E„FEÊ 6vº˜W=ì¼5�š5ðxÛήN]1Ë_;Å—mHµ¥80Ë¡ãGƒ�ÒŠe¤º«JEvï«YøÕÏG#2ÊrrËÓºì²EFœ#2(SfˆZjÒAS¬çXƒ%¡GïŠ4wh�-´´Õ¯µ)wQ4ëEO£#2ãÆÂت+±'›-b#Év0€3Û#îþ.ü�#^pƒ>ËÞ�8ج&×÷|K T;aÇãýÎ{'ˆa̪ƒŒ¸cí!ÍÖq&ý±KZ<ZÓFºÒ�Ф¤Ì(Ì�)¿s1û=¡Ô5ƒLOýL߬ÇÒ¾ð#¼Îì0úª©Ù–e(ªe�{@‰Á¥5¯ÅÜýýøƒåLine truncated
#<==
#-----BEGIN PGP SIGNATURE-----\n\niQIcBAABCgAGBQJaias4AAoJEEm0xnwFJ3qqfmcP/j4ITHGXd3U8tRn4hjvpLLkT\nfTMd9x9hBEwwRqU0EYoAp2+yIoUKvb5JERF0YjGUWoiZqxEmGGp5BFSOJOrYhq0V\nsZIE01wrQQTYMn1jfoXhjywyLVdyMpl9hgb2Z7DnF9GgzUsd5bPWmoNaCMkhZjuD\nSaR13Ff0hAOVIt/fNoJiXYJ2ICDRG5LGKFlkxy0ykXOkrKDmdah4DV6MGVB/tS3n\niBhxgqMc9ILSFQoEQmFAXTid8Ej0OBj+csAk8nvbCEiV+k74BozpQ+QVfR+agX+K\nnf/oMed8F1jKa9uydbvcEn4SXXEBqKztiKvuCGmZIO3xKd+46+5Oh51wKxZYNsyk\nlYBAA/fH8fOZqMzTCRGZM3q6EnKf+zwGyf4lFOHuVzeXHlfcZA62V1Tcr9aQfsq0\n2saI9S9JsxEpFvAa4S+x7oQ+VJ0WM5XLb04KKFgAMjK/kW2Nw6rYQ0eNCdBX6NCc\n6LWnmmrB/TauSNsJSYIfICoKuv+hebjbSIQa5n1/zQeWYt8DKZYS9Lkwl34vMMdx\nDzq/l7QL+I5Z5jDSVkzRS31/K6T6RWiYFzHgabwD/DNBC8cfG4RwTZIEO3C8uLFy\nDo0MG8w5NFkMk7t0KQtBPe+7BK6Nv6Xo5mLTJ+01INvmgHavhgH4bSyg0kD8MbGS\nY4cOEMKnUkHXCpvXsOLz\n=9X3b\n-----END PGP SIGNATURE-----\n
+68 -72
View File
@@ -20,14 +20,14 @@ You should have received a copy of the GNU General Public License along with
NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
"""
VERSION = "0.4.2"
VERSION = "0.4.3"
APPNAME = "nlsr"
BUGREPORT = "https://redmine.named-data.net/projects/nlsr"
URL = "https://named-data.net/doc/NLSR/"
GIT_TAG_PREFIX = "NLSR-"
from waflib import Logs, Utils, Context
import os
import os, subprocess
def options(opt):
opt.load(['compiler_cxx', 'gnu_dirs'])
@@ -36,10 +36,7 @@ def options(opt):
tooldir=['.waf-tools'])
nlsropt = opt.add_option_group('NLSR Options')
nlsropt.add_option('--with-tests', action='store_true', default=False, dest='with_tests',
help='''build unit tests''')
nlsropt.add_option('--with-tests', action='store_true', default=False, help='build unit tests')
def configure(conf):
conf.load(['compiler_cxx', 'gnu_dirs',
@@ -54,21 +51,21 @@ def configure(conf):
boost_libs = 'system chrono program_options iostreams thread regex filesystem log log_setup'
if conf.options.with_tests:
conf.env['WITH_TESTS'] = 1
conf.define('WITH_TESTS', 1);
conf.env['WITH_TESTS'] = True
conf.define('WITH_TESTS', 1)
boost_libs += ' unit_test_framework'
conf.check_boost(lib=boost_libs, mt=True)
if conf.env.BOOST_VERSION_NUMBER < 105400:
Logs.error("Minimum required boost version is 1.54.0")
Logs.error("Please upgrade your distribution or install custom boost libraries" +
" (https://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)")
return
conf.fatal('Minimum required Boost version is 1.54.0\n'
'Please upgrade your distribution or manually install a newer version of Boost'
' (https://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)')
conf.check_cfg(package='ChronoSync', args=['--cflags', '--libs'],
uselib_store='SYNC', mandatory=True)
conf.check_compiler_flags()
conf.load('coverage')
conf.load('sanitizers')
@@ -82,7 +79,7 @@ def build(bld):
version(bld)
bld(features="subst",
name='version',
name='version.hpp',
source='src/version.hpp.in',
target='src/version.hpp',
install_path=None,
@@ -95,43 +92,39 @@ def build(bld):
VERSION_MINOR=VERSION_SPLIT[1],
VERSION_PATCH=VERSION_SPLIT[2])
nlsr_objects = bld(
bld.objects(
target='nlsr-objects',
name='nlsr-objects',
features='cxx',
source=bld.path.ant_glob(['src/**/*.cpp'],
excl=['src/main.cpp']),
use='NDN_CXX BOOST SYNC',
includes='. src',
export_includes='. src')
nlsr = bld(
bld.program(
target='bin/nlsr',
features='cxx cxxprogram',
name='nlsr',
source='src/main.cpp',
use='nlsr-objects')
nlsrc = bld(
bld.program(
target='bin/nlsrc',
features='cxx cxxprogram',
name='nlsrc',
source='tools/nlsrc.cpp',
use='nlsr-objects BOOST')
bld(features="subst",
source='nlsr.conf',
target='nlsr.conf.sample',
install_path="${SYSCONFDIR}/ndn")
bld.install_as('${SYSCONFDIR}/ndn/nlsr.conf.sample', 'nlsr.conf')
if bld.env['WITH_TESTS']:
if bld.env.WITH_TESTS:
bld.recurse('tests')
if bld.env['SPHINX_BUILD']:
bld(features="sphinx",
builder="man",
outdir="docs/manpages",
config="docs/conf.py",
if bld.env.SPHINX_BUILD:
bld(features='sphinx',
name='manpages',
builder='man',
outdir='docs/manpages',
config='docs/conf.py',
source=bld.path.ant_glob('docs/manpages/**/*.rst'),
install_path="${MANDIR}/",
install_path='${MANDIR}',
VERSION=VERSION)
def docs(bld):
@@ -142,79 +135,82 @@ def doxygen(bld):
version(bld)
if not bld.env.DOXYGEN:
Logs.error("ERROR: cannot build documentation (`doxygen' not found in $PATH)")
else:
bld(features="subst",
name="doxygen-conf",
source="docs/doxygen.conf.in",
target="docs/doxygen.conf",
VERSION=VERSION_BASE)
bld.fatal('Cannot build documentation ("doxygen" not found in PATH)')
bld(features="doxygen",
doxyfile='docs/doxygen.conf',
use="doxygen-conf")
bld(features='subst',
name='doxygen.conf',
source=['docs/doxygen.conf.in',
'docs/named_data_theme/named_data_footer-with-analytics.html.in'],
target=['docs/doxygen.conf',
'docs/named_data_theme/named_data_footer-with-analytics.html'],
VERSION=VERSION,
HTML_FOOTER='../build/docs/named_data_theme/named_data_footer-with-analytics.html' \
if os.getenv('GOOGLE_ANALYTICS', None) \
else '../docs/named_data_theme/named_data_footer.html',
GOOGLE_ANALYTICS=os.getenv('GOOGLE_ANALYTICS', ''))
bld(features='doxygen',
doxyfile='docs/doxygen.conf',
use='doxygen.conf')
def sphinx(bld):
version(bld)
if not bld.env.SPHINX_BUILD:
bld.fatal("ERROR: cannot build documentation (`sphinx-build' not found in $PATH)")
else:
bld(features="sphinx",
outdir="docs",
source=bld.path.ant_glob('docs/**/*.rst'),
config="docs/conf.py",
VERSION=VERSION_BASE)
bld.fatal('Cannot build documentation ("sphinx-build" not found in PATH)')
bld(features='sphinx',
config='docs/conf.py',
outdir='docs',
source=bld.path.ant_glob('docs/**/*.rst'),
VERSION=VERSION)
def version(ctx):
# don't execute more than once
if getattr(Context.g_module, 'VERSION_BASE', None):
return
Context.g_module.VERSION_BASE = Context.g_module.VERSION
Context.g_module.VERSION_SPLIT = [v for v in VERSION_BASE.split('.')]
Context.g_module.VERSION_SPLIT = VERSION_BASE.split('.')
didGetVersion = False
# first, try to get a version string from git
gotVersionFromGit = False
try:
cmd = ['git', 'describe', '--always', '--match', '%s*' % GIT_TAG_PREFIX]
p = Utils.subprocess.Popen(cmd, stdout=Utils.subprocess.PIPE,
stderr=None, stdin=None)
out = str(p.communicate()[0].strip())
didGetVersion = (p.returncode == 0 and out != "")
if didGetVersion:
out = subprocess.check_output(cmd, universal_newlines=True).strip()
if out:
gotVersionFromGit = True
if out.startswith(GIT_TAG_PREFIX):
Context.g_module.VERSION = out[len(GIT_TAG_PREFIX):]
Context.g_module.VERSION = out.lstrip(GIT_TAG_PREFIX)
else:
Context.g_module.VERSION = "%s-commit-%s" % (Context.g_module.VERSION_BASE, out)
except OSError:
# no tags matched
Context.g_module.VERSION = '%s-commit-%s' % (VERSION_BASE, out)
except subprocess.CalledProcessError:
pass
versionFile = ctx.path.find_node('VERSION')
if not didGetVersion and versionFile is not None:
if not gotVersionFromGit and versionFile is not None:
try:
Context.g_module.VERSION = versionFile.read()
return
except (OSError, IOError):
except EnvironmentError:
pass
# version was obtained from git, update VERSION file if necessary
if versionFile is not None:
try:
version = versionFile.read()
if version == Context.g_module.VERSION:
return # no need to update
except (OSError, IOError):
Logs.warn("VERSION file exists, but not readable")
if versionFile.read() == Context.g_module.VERSION:
# already up-to-date
return
except EnvironmentError as e:
Logs.warn('%s exists but is not readable (%s)' % (versionFile, e.strerror))
else:
versionFile = ctx.path.make_node('VERSION')
if versionFile is None:
return
try:
versionFile.write(Context.g_module.VERSION)
except (OSError, IOError):
Logs.warn("VERSION file is not writeable")
except EnvironmentError as e:
Logs.warn('%s is not writable (%s)' % (versionFile, e.strerror))
def dist(ctx):
version(ctx)