7 Commits
Author SHA1 Message Date
Vince Lehman 0ff5d45ba8 docs: Prepare version 0.2.2 release notes
Change-Id: I72a1847e7c20d9bac3d85b2263b974ddbcee3431
2016-01-04 17:23:06 -06:00
Ashlesh Gawande 5d9c0573c0 security: Remove unused disabled files
Change-Id: Ifbbe284f5e3586e6256ffa30902926c2d751743e
refs: #2960
2015-12-21 15:45:50 -06:00
Muktadir R Chowdhury 4c7caadb72 nlsrc: adapt to ndn-cxx SegmentFetcher API change
Refs: #2734
Change-Id: I76f1f1a6b95d2df18a8deef545be5027ad6bbc7c
2015-12-04 13:25:43 -08:00
Alexander Afanasyev f9f3910dd2 build+nsync+tests+docs: Fix compilation for boost 1.59, doxygen docs, and other fixes
Requires ndn-cxx:commit:e3e2505aa03e0b298e1a8dfc9876f1f8dafcaaba (ndn-cxx-0.4.0-beta2-11-ge3e2505)
or earlier commit.

Change-Id: I6ad359aa368b3346464f2aa74a1ab319fcd3ab7a
2015-12-04 13:25:28 -08:00
Vince Lehman 53c0e3e9ee Use MulticastStrategy instead of deprecated BroadcastStrategy
refs: #3011

Change-Id: I7c32cf13945853fe76008271a77878d2bf6e9215
2015-09-14 14:36:49 -05:00
Vince Lehman c57c64b633 Refactor initialization of NLSR instance
refs: #3091

Change-Id: I07108015dc0704e85f5c37b91b53838d7b0f41d0
2015-08-11 11:55:29 -05:00
Joao Pereira 97473d47fd nlsr: avoid deprecated prefix registration APIs
refs #2932

Change-Id: Id874d40d3b6209bedc6f92a44b5c49eb9ed31efe
2015-07-06 15:38:23 -04:00
40 changed files with 427 additions and 1441 deletions

No files matched your search

+12 -1
View File
@@ -2,12 +2,17 @@
set -x
set -e
JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source "$JDIR"/util.sh
pushd /tmp >/dev/null
INSTALLED_VERSION=$((cd ndn-cxx && git rev-parse HEAD) 2>/dev/null || echo NONE)
sudo rm -Rf ndn-cxx-latest
git clone --depth 1 git://github.com/named-data/ndn-cxx ndn-cxx-latest
LATEST_VERSION=$((cd ndn-cxx-latest && git rev-parse HEAD) 2>/dev/null || echo UNKNOWN)
if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
@@ -23,9 +28,15 @@ sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx*
pushd ndn-cxx >/dev/null
./waf configure -j1 --color=yes --without-osx-keychain
./waf configure -j1 --color=yes --enable-shared --disable-static --without-osx-keychain
./waf -j1 --color=yes
sudo ./waf install -j1 --color=yes
popd >/dev/null
popd >/dev/null
if has Linux $NODE_LABELS; then
sudo ldconfig
elif has FreeBSD $NODE_LABELS; then
sudo ldconfig -a
fi
+146 -28
View File
@@ -1,53 +1,58 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
from waflib import Logs, Configure
from waflib import Logs, Configure, Utils
def options(opt):
opt.add_option('--debug', '--with-debug', action='store_true', default=False, dest='debug',
help='''Compile in debugging mode without optimizations (-O0 or -Og)''')
def configure(conf):
areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
defaultFlags = ['-std=c++0x', '-std=c++11',
'-stdlib=libc++', # clang on OSX < 10.9 by default uses a non
# C++11-compatible STL library
'-Wall', '-Wno-long-long']
cxx = conf.env['CXX_NAME'] # CXX_NAME represents generic name of the compiler
if cxx == 'gcc':
flags = GccFlags()
elif cxx == 'clang':
flags = ClangFlags()
else:
flags = CompilerFlags()
Logs.warn('The code has not yet been tested with %s compiler' % cxx)
areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
# General flags are always applied (e.g., selecting C++11 mode)
generalFlags = flags.getGeneralFlags(conf)
conf.add_supported_cxxflags(generalFlags['CXXFLAGS'])
conf.add_supported_linkflags(generalFlags['LINKFLAGS'])
conf.env.DEFINES += generalFlags['DEFINES']
# 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:
conf.define('_DEBUG', 1)
defaultFlags += ['-O0',
'-Og', # gcc >= 4.8
'-g3',
'-fcolor-diagnostics', # clang
'-fdiagnostics-color', # gcc >= 4.9
'-Werror',
'-Wno-error=deprecated-register',
'-Wno-error=maybe-uninitialized', # Bug #1615
'-Wno-error=unneeded-internal-declaration', # Bug #1588
'-Wno-nested-anon-types',
]
extraFlags = flags.getDebugFlags(conf)
if areCustomCxxflagsPresent:
missingFlags = [x for x in defaultFlags if x not in conf.env.CXXFLAGS]
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))
else:
conf.add_supported_cxxflags(defaultFlags)
else:
defaultFlags += ['-O2', '-g']
if not areCustomCxxflagsPresent:
conf.add_supported_cxxflags(defaultFlags)
extraFlags = flags.getOptimizedFlags(conf)
# clang on OSX < 10.9 by default uses a non C++11-compatible STL library
conf.add_supported_linkflags(['-stdlib=libc++'])
if not areCustomCxxflagsPresent:
conf.add_supported_cxxflags(extraFlags['CXXFLAGS'])
conf.add_supported_linkflags(extraFlags['LINKFLAGS'])
conf.env.DEFINES += extraFlags['DEFINES']
@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 compile-stage flags for c++ compiler')
if len(cxxflags) == 0:
return
self.start_msg('Checking supported CXXFLAGS')
supportedFlags = []
for flag in cxxflags:
@@ -62,7 +67,10 @@ def add_supported_linkflags(self, linkflags):
"""
Check which linkflags are supported by compiler and add them to env.LINKFLAGS variable
"""
self.start_msg('Checking allowed link-stage flags for c++ compiler')
if len(linkflags) == 0:
return
self.start_msg('Checking supported LINKFLAGS')
supportedFlags = []
for flag in linkflags:
@@ -71,3 +79,113 @@ def add_supported_linkflags(self, linkflags):
self.end_msg(' '.join(supportedFlags))
self.env.LINKFLAGS = supportedFlags + self.env.LINKFLAGS
class CompilerFlags(object):
def getGeneralFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed"""
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []}
def getDebugFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in debug mode"""
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': ['_DEBUG']}
def getOptimizedFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in optimized mode"""
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': ['NDEBUG']}
class GccBasicFlags(CompilerFlags):
"""
This class defines basic flags that work for both gcc and clang compilers
"""
def getDebugFlags(self, conf):
flags = super(GccBasicFlags, self).getDebugFlags(conf)
flags['CXXFLAGS'] += ['-O0',
'-g3',
'-pedantic',
'-Wall',
'-Wextra',
'-Werror',
'-Wno-unused-parameter',
'-Wno-error=maybe-uninitialized', # Bug #1615
]
return flags
def getOptimizedFlags(self, conf):
flags = super(GccBasicFlags, self).getOptimizedFlags(conf)
flags['CXXFLAGS'] += ['-O2',
'-g',
'-pedantic',
'-Wall',
'-Wextra',
'-Wno-unused-parameter',
]
return flags
class GccFlags(GccBasicFlags):
def getGeneralFlags(self, conf):
flags = super(GccFlags, self).getGeneralFlags(conf)
version = tuple(int(i) for i in conf.env['CC_VERSION'])
if version < (4, 6, 0):
conf.fatal('The version of gcc you are using (%s) is too old.\n' %
'.'.join(conf.env['CC_VERSION']) +
'The minimum supported gcc version is 4.6.0.')
elif version < (4, 7, 0):
flags['CXXFLAGS'] += ['-std=c++0x']
else:
flags['CXXFLAGS'] += ['-std=c++11']
if version < (4, 8, 0):
flags['DEFINES'] += ['_GLIBCXX_USE_NANOSLEEP'] # Bug #2499
return flags
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):
flags['CXXFLAGS'] += ['-Wno-missing-field-initializers']
flags['CXXFLAGS'] += ['-Og', # gcc >= 4.8
'-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):
flags['CXXFLAGS'] += ['-Wno-missing-field-initializers']
flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9
return flags
class ClangFlags(GccBasicFlags):
def getGeneralFlags(self, conf):
flags = super(ClangFlags, self).getGeneralFlags(conf)
flags['CXXFLAGS'] += ['-std=c++11']
if Utils.unversioned_sys_platform() == 'darwin':
flags['CXXFLAGS'] += ['-stdlib=libc++']
flags['LINKFLAGS'] += ['-stdlib=libc++']
return flags
def getDebugFlags(self, conf):
flags = super(ClangFlags, self).getDebugFlags(conf)
flags['CXXFLAGS'] += ['-fcolor-diagnostics',
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
'-Wno-error=unneeded-internal-declaration', # Bug #1588
'-Wno-error=deprecated-register',
'-Wno-error=keyword-macro', # Bug #3235
'-Wno-nested-anon-types',
'-Wno-sign-compare',
'-Wno-keyword-macro',
'-Wno-error=ignored-qualifiers',
'-Wno-error=infinite-recursion',
]
return flags
def getOptimizedFlags(self, conf):
flags = super(ClangFlags, self).getOptimizedFlags(conf)
flags['CXXFLAGS'] += ['-fcolor-diagnostics',
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
'-Wno-nested-anon-types',
'-Wno-sign-compare',
'-Wno-keyword-macro',
]
return flags
+9
View File
@@ -1,6 +1,15 @@
Release Notes
=============
NLSR version 0.2.2 (changes since version 0.2.1)
++++++++++++++++++++++++++++++++++++++++++++++++
Release date: January 5, 2016
**Code changes**:
- Adapt code to changes in NFD/ndn-cxx version 0.4.0 release
NLSR version 0.2.1 (changes since version 0.2.0)
++++++++++++++++++++++++++++++++++++++++++++++++
+12 -13
View File
@@ -1782,18 +1782,6 @@ GENERATE_XML = NO
XML_OUTPUT = xml
# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
# validating XML parser to check the syntax of the XML files.
# This tag requires that the tag GENERATE_XML is set to YES.
XML_SCHEMA =
# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
# validating XML parser to check the syntax of the XML files.
# This tag requires that the tag GENERATE_XML is set to YES.
XML_DTD =
# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
# listings (including syntax highlighting and cross-referencing information) to
# the XML output. Note that enabling this will significantly increase the size
@@ -1928,7 +1916,18 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED =
PREDEFINED = DOXYGEN=1 \
INIT_LOGGER(x)= \
BOOST_STATIC_ASSERT(x)= \
BOOST_CONCEPT_ASSERT(x)= \
BOOST_CONCEPT_REQUIRES(x)= \
DECL_OVERRIDE=override \
PUBLIC_WITH_TESTS_ELSE_PRIVATE=private \
PUBLIC_WITH_TESTS_ELSE_PROTECTED=protected \
PROTECTED_WITH_TESTS_ELSE_PRIVATE=private \
VIRTUAL_WITH_TESTS \
DECL_CLASS_FINAL=final \
DECL_FINAL=final
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
+1 -1
View File
@@ -28,7 +28,7 @@
#include <log4cxx/logger.h>
#define INIT_LOGGER(name) \
static log4cxx::LoggerPtr staticModuleLogger = log4cxx::Logger::getLogger (name);
static log4cxx::LoggerPtr staticModuleLogger = log4cxx::Logger::getLogger (name)
#define _LOG_DEBUG(x) \
LOG4CXX_DEBUG(staticModuleLogger, x);
+1
View File
@@ -29,6 +29,7 @@
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/thread.hpp>
#include <vector>
using namespace std;
+2
View File
@@ -20,7 +20,9 @@
#include "sync-socket.h"
#include "sync-logging.h"
#include <boost/lexical_cast.hpp>
#include <boost/thread.hpp>
using namespace std;
+18 -57
View File
@@ -19,39 +19,27 @@
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
#include <ndn-cxx/util/scheduler.hpp>
#include "conf-file-processor.hpp"
#include "logger.hpp"
#include "nlsr.hpp"
#include "nlsr-runner.hpp"
#include "version.hpp"
// boost needs to be included after ndn-cxx, otherwise there will be conflict with _1, _2, ...
#include <boost/asio.hpp>
#include <boost/cstdint.hpp>
namespace nlsr {
int
main(int32_t argc, char** argv)
{
boost::asio::io_service ioService;
ndn::Scheduler scheduler(ioService);
ndn::Face face(ioService);
Nlsr nlsr(ioService, scheduler, face);
using namespace nlsr;
std::string programName(argv[0]);
nlsr.setConfFileName("nlsr.conf");
std::string configFileName = "nlsr.conf";
bool isDaemonProcess = false;
int32_t opt;
while ((opt = getopt(argc, argv, "df:hV")) != -1) {
switch (opt)
{
switch (opt) {
case 'f':
nlsr.setConfFileName(optarg);
configFileName = optarg;
break;
case 'd':
nlsr.setIsDaemonProcess(true);
isDaemonProcess = true;
break;
case 'V':
std::cout << NLSR_VERSION_BUILD_STRING << std::endl;
@@ -59,47 +47,20 @@ main(int32_t argc, char** argv)
break;
case 'h':
default:
nlsr.usage(programName);
NlsrRunner::printUsage(programName);
return EXIT_FAILURE;
}
}
}
ConfFileProcessor cfp(nlsr, nlsr.getConfFileName());
if (!cfp.processConfFile()) {
std::cerr << "Error in configuration file processing! Exiting from NLSR" << std::endl;
NlsrRunner runner(configFileName, isDaemonProcess);
try {
runner.run();
}
catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
}
if (nlsr.getConfParameter().isLog4CxxConfAvailable()) {
INIT_LOG4CXX(nlsr.getConfParameter().getLog4CxxConfPath());
}
else {
INIT_LOGGERS(nlsr.getConfParameter().getLogDir(), nlsr.getConfParameter().getLogLevel());
}
INIT_LOGGER("Main");
nlsr.initialize();
if (nlsr.getIsSetDaemonProcess()) {
nlsr.daemonize();
}
try {
nlsr.startEventLoop();
}
catch (std::exception& e) {
_LOG_FATAL("ERROR: " << e.what());
std::cerr << "ERROR: " << e.what() << std::endl;
nlsr.getFib().clean();
nlsr.destroyFaces();
}
return EXIT_SUCCESS;
}
} // namespace nlsr
int
main(int32_t argc, char** argv)
{
return nlsr::main(argc, argv);
}
+85
View File
@@ -0,0 +1,85 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2015, 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 "nlsr-runner.hpp"
#include "conf-file-processor.hpp"
#include "logger.hpp"
namespace nlsr {
INIT_LOGGER("NlsrRunner");
NlsrRunner::NlsrRunner(std::string& configFileName, bool isDaemonProcess)
: m_scheduler(m_ioService)
, m_face(m_ioService)
, m_nlsr(m_ioService, m_scheduler, m_face)
{
m_nlsr.setConfFileName(configFileName);
m_nlsr.setIsDaemonProcess(isDaemonProcess);
}
void
NlsrRunner::run()
{
ConfFileProcessor configProcessor(m_nlsr, m_nlsr.getConfFileName());
if (!configProcessor.processConfFile()) {
throw Error("Error in configuration file processing! Exiting from NLSR");
}
if (m_nlsr.getConfParameter().isLog4CxxConfAvailable()) {
INIT_LOG4CXX(m_nlsr.getConfParameter().getLog4CxxConfPath());
}
else {
INIT_LOGGERS(m_nlsr.getConfParameter().getLogDir(), m_nlsr.getConfParameter().getLogLevel());
}
m_nlsr.initialize();
if (m_nlsr.getIsSetDaemonProcess()) {
m_nlsr.daemonize();
}
try {
m_nlsr.startEventLoop();
}
catch (std::exception& e) {
_LOG_FATAL("ERROR: " << e.what());
std::cerr << "ERROR: " << e.what() << std::endl;
m_nlsr.getFib().clean();
m_nlsr.destroyFaces();
}
}
void
NlsrRunner::printUsage(const std::string& programName)
{
std::cout << "Usage: " << programName << " [OPTIONS...]" << std::endl;
std::cout << " NDN routing...." << std::endl;
std::cout << " -d Run in daemon mode" << std::endl;
std::cout << " -f <FILE> Specify configuration file name" << std::endl;
std::cout << " -V Display version information" << std::endl;
std::cout << " -h Display this help message" << std::endl;
}
} // namespace nlsr
+66
View File
@@ -0,0 +1,66 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2015, 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/>.
**/
#ifndef NLSR_NLSR_RUNNER_HPP
#define NLSR_NLSR_RUNNER_HPP
#include "nlsr.hpp"
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/util/scheduler.hpp>
// boost needs to be included after ndn-cxx, otherwise there will be conflict with _1, _2, ...
#include <boost/asio.hpp>
namespace nlsr {
class NlsrRunner
{
public:
class Error : public std::runtime_error
{
public:
explicit
Error(const std::string& what)
: std::runtime_error(what)
{
}
};
NlsrRunner(std::string& configFileName, bool isDaemonProcess);
void
run();
static void
printUsage(const std::string& programName);
private:
boost::asio::io_service m_ioService;
ndn::Scheduler m_scheduler;
ndn::Face m_face;
Nlsr m_nlsr;
};
} // namespace nlsr
#endif // NLSR_NLSR_RUNNER_HPP
+25 -36
View File
@@ -111,11 +111,11 @@ Nlsr::setInfoInterestFilter()
ndn::Name name(m_confParam.getRouterPrefix());
_LOG_DEBUG("Setting interest filter for name: " << name);
getNlsrFace().setInterestFilter(name,
ndn::bind(&HelloProtocol::processInterest,
std::bind(&HelloProtocol::processInterest,
&m_helloProtocol, _1, _2),
ndn::bind(&Nlsr::onRegistrationSuccess, this, _1),
ndn::bind(&Nlsr::registrationFailed, this, _1),
m_defaultIdentity,
std::bind(&Nlsr::onRegistrationSuccess, this, _1),
std::bind(&Nlsr::registrationFailed, this, _1),
m_signingInfo,
ndn::nfd::ROUTE_FLAG_CAPTURE);
}
@@ -127,20 +127,22 @@ Nlsr::setLsaInterestFilter()
name.append(m_confParam.getRouterName());
_LOG_DEBUG("Setting interest filter for name: " << name);
getNlsrFace().setInterestFilter(name,
ndn::bind(&Lsdb::processInterest,
std::bind(&Lsdb::processInterest,
&m_nlsrLsdb, _1, _2),
ndn::bind(&Nlsr::onRegistrationSuccess, this, _1),
ndn::bind(&Nlsr::registrationFailed, this, _1),
m_defaultIdentity,
std::bind(&Nlsr::onRegistrationSuccess, this, _1),
std::bind(&Nlsr::registrationFailed, this, _1),
m_signingInfo,
ndn::nfd::ROUTE_FLAG_CAPTURE);
}
void
Nlsr::setStrategies()
{
std::string strategy("ndn:/localhost/nfd/strategy/broadcast");
const std::string strategy("ndn:/localhost/nfd/strategy/multicast");
ndn::Name broadcastKeyPrefix = DEFAULT_BROADCAST_PREFIX;
broadcastKeyPrefix.append("KEYS");
m_fib.setStrategy(m_confParam.getLsaPrefix(), strategy, 0);
m_fib.setStrategy(broadcastKeyPrefix, strategy, 0);
m_fib.setStrategy(m_confParam.getChronosyncPrefix(), strategy, 0);
@@ -192,7 +194,7 @@ Nlsr::initialize()
/* Logging end */
initializeKey();
setStrategies();
_LOG_DEBUG("Default NLSR identity: " << m_defaultIdentity);
_LOG_DEBUG("Default NLSR identity: " << m_signingInfo.getSignerName());
setInfoInterestFilter();
setLsaInterestFilter();
@@ -223,18 +225,17 @@ Nlsr::initialize()
void
Nlsr::initializeKey()
{
m_defaultIdentity = m_confParam.getRouterPrefix();
m_defaultIdentity.append("NLSR");
ndn::Name defaultIdentity = m_confParam.getRouterPrefix();
defaultIdentity.append("NLSR");
try
{
m_keyChain.deleteIdentity(m_defaultIdentity);
try {
m_keyChain.deleteIdentity(defaultIdentity);
}
catch (std::exception& e)
{
catch (std::exception& e) {
}
m_signingInfo = ndn::security::SigningInfo(ndn::security::SigningInfo::SIGNER_TYPE_ID, defaultIdentity);
ndn::Name keyName = m_keyChain.generateRsaKeyPairAsDefault(m_defaultIdentity, true);
ndn::Name keyName = m_keyChain.generateRsaKeyPairAsDefault(defaultIdentity, true);
ndn::shared_ptr<ndn::IdentityCertificate> certificate =
ndn::make_shared<ndn::IdentityCertificate>();
@@ -262,11 +263,11 @@ Nlsr::registerKeyPrefix()
ndn::Name keyPrefix = DEFAULT_BROADCAST_PREFIX;
keyPrefix.append("KEYS");
m_nlsrFace.setInterestFilter(keyPrefix,
ndn::bind(&Nlsr::onKeyInterest,
std::bind(&Nlsr::onKeyInterest,
this, _1, _2),
ndn::bind(&Nlsr::onKeyPrefixRegSuccess, this, _1),
ndn::bind(&Nlsr::registrationFailed, this, _1),
m_defaultIdentity,
std::bind(&Nlsr::onKeyPrefixRegSuccess, this, _1),
std::bind(&Nlsr::registrationFailed, this, _1),
m_signingInfo,
ndn::nfd::ROUTE_FLAG_CAPTURE);
}
@@ -332,8 +333,8 @@ Nlsr::destroyFaces()
for (std::list<Adjacent>::iterator it = adjacents.begin();
it != adjacents.end(); it++) {
m_fib.destroyFace((*it).getConnectingFaceUri(),
ndn::bind(&Nlsr::onDestroyFaceSuccess, this, _1),
ndn::bind(&Nlsr::onDestroyFaceFailure, this, _1, _2));
std::bind(&Nlsr::onDestroyFaceSuccess, this, _1),
std::bind(&Nlsr::onDestroyFaceFailure, this, _1, _2));
}
}
@@ -388,16 +389,4 @@ Nlsr::startEventLoop()
m_nlsrFace.processEvents();
}
void
Nlsr::usage(const string& progname)
{
std::cout << "Usage: " << progname << " [OPTIONS...]" << std::endl;
std::cout << " NDN routing...." << std::endl;
std::cout << " -d Run in daemon mode" << std::endl;
std::cout << " -f <FILE> Specify configuration file name" << std::endl;
std::cout << " -V Display version information" << std::endl;
std::cout << " -h Display this help message" << std::endl;
}
} // namespace nlsr
+1 -4
View File
@@ -88,9 +88,6 @@ public:
void
startEventLoop();
void
usage(const std::string& progname);
std::string
getConfFileName() const
{
@@ -377,7 +374,7 @@ private:
security::CertificateStore m_certStore;
Validator m_validator;
ndn::KeyChain m_keyChain;
ndn::Name m_defaultIdentity;
ndn::security::SigningInfo m_signingInfo;
ndn::Name m_defaultCertName;
update::PrefixUpdateProcessor m_prefixUpdateProcessor;
@@ -1,17 +0,0 @@
#include <ndn-cpp-dev/security/signature-sha256-with-rsa.hpp>
#include "certificate-store-entry.hpp"
namespace nlsr {
std::ostream&
operator<<(std::ostream& os, const CertificateStoreEntry& ncse)
{
os << "------Certificate Entry---------------" << std::endl;
os << *(ncse.getCert()) << std::endl;
ndn::SignatureSha256WithRsa sig(ncse.getCert()->getSignature());
ndn::Name keyName = sig.getKeyLocator().getName();
os << "Signee : " << keyName.toUri() << std::endl;
os << "Cert Seq Num: " << ncse.getCertSeqNum() << std::endl;
os << "Is Signer Verified: " << ncse.getIsSignerVerified() << std::endl;
return os;
}
}//namespace nlsr
@@ -1,72 +0,0 @@
#ifndef NLSR_CERT_STORE_ENTRY_HPP
#define NLSR_CERT_STORE_ENTRY_HPP
#include <iostream>
#include <ndn-cpp-dev/face.hpp>
#include <ndn-cpp-dev/security/identity-certificate.hpp>
namespace nlsr {
class CertificateStoreEntry
{
public:
CertificateStoreEntry()
: m_cert(ndn::make_shared<ndn::IdentityCertificate>())
, m_certSeqNum(0)
, m_isSignerVerified(false)
{}
CertificateStoreEntry(ndn::shared_ptr<ndn::IdentityCertificate> pcert
, uint32_t csn, bool isv)
: m_cert(pcert)
, m_certSeqNum(csn)
, m_isSignerVerified(isv)
{}
ndn::shared_ptr<ndn::IdentityCertificate>
getCert() const
{
return m_cert;
}
void
setCert(ndn::shared_ptr<ndn::IdentityCertificate> pcert)
{
m_cert = pcert;
}
uint32_t
getCertSeqNum() const
{
return m_certSeqNum;
}
void
setCertSeqNum(uint32_t csn)
{
m_certSeqNum = csn;
}
bool
getIsSignerVerified() const
{
return m_isSignerVerified;
}
void
setIsSignerVerified(bool isv)
{
m_isSignerVerified = isv;
}
private:
ndn::shared_ptr<ndn::IdentityCertificate> m_cert;
uint32_t m_certSeqNum;
bool m_isSignerVerified;
};
/* Debugging Purpose */
std::ostream&
operator <<(std::ostream& os, const CertificateStoreEntry& ncse);
}//namespace NLSR
#endif //NLSR_CERT_STORE_ENTRY_HPP
-231
View File
@@ -1,231 +0,0 @@
#include <ndn-cpp-dev/security/signature-sha256-with-rsa.hpp>
#include <ndn-cpp-dev/security/key-chain.hpp>
#include "certificate-store.hpp"
#include "waiting-list-entry.hpp"
#include "key-manager.hpp"
namespace nlsr {
static bool
nlsrCertificateStoreEntryCompare(CertificateStoreEntry& ncse1,
CertificateStoreEntry& ncse2)
{
int sizeDiff = ncse1.getCert()->getName().size() -
ncse2.getCert()->getName().size();
return (ncse2.getCert()->getName().isPrefixOf(ncse1.getCert()->getName()) &&
(sizeDiff <= 1 && sizeDiff >= 0));
}
static bool
nlsrCertificateStoreEntryCompareByName(CertificateStoreEntry& ncse1,
std::string compCertName)
{
ndn::Name ccn(compCertName);
int sizeDiff = ncse1.getCert()->getName().size() - ccn.size();
return (ccn.isPrefixOf(ncse1.getCert()->getName()) &&
(sizeDiff <= 1 && sizeDiff >= 0));
}
void
CertificateStore::updateWaitingList(std::string respCertName)
{
ndn::Name tmpName(respCertName);
respCertName = tmpName.getPrefix(-1).toUri();
std::pair<WaitingListEntry, bool> chkWle =
m_waitingList.getWaitingListEntry(respCertName);
if (chkWle.second)
{
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> sc =
getCertificateFromStore(respCertName);
std::list<std::string> waitees = (chkWle.first).getWaitingCerts();
for (std::list<std::string>::iterator it = waitees.begin();
it != waitees.end(); ++it)
{
KeyManager km;
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> wc =
getCertificateFromStore(*(it));
if (wc.second && sc.second)
{
if (km.verifySignature(*(wc.first), sc.first->getPublicKeyInfo()))
{
//1. Update Certificate Store
setCertificateIsVerified(*(it), true);
//2. Call updateWaitingList for waitee ( *(it) )
updateWaitingList(*(it));
}
}
}
}
//remove that entry from waiting list
m_waitingList.remove(respCertName);
}
void
CertificateStore::updateWaitingList(CertificateStoreEntry& ncse)
{
if (ncse.getIsSignerVerified())
{
updateWaitingList(ncse.getCert()->getName().toUri());
}
else
{
ndn::SignatureSha256WithRsa signature(ncse.getCert()->getSignature());
m_waitingList.add(signature.getKeyLocator().getName().toUri(),
ncse.getCert()->getName().toUri());
}
}
bool
CertificateStore::addCertificate(CertificateStoreEntry& ncse)
{
std::list<CertificateStoreEntry>::iterator it =
std::find_if(m_certTable.begin(), m_certTable.end(),
bind(&nlsrCertificateStoreEntryCompare, _1, ncse));
if (it == m_certTable.end())
{
m_certTable.push_back(ncse);
updateWaitingList(ncse);
return true;
}
else if (it != m_certTable.end())
{
if ((*it).getCertSeqNum() < ncse.getCertSeqNum())
{
m_certTable.erase(it);
m_certTable.push_back(ncse);
updateWaitingList(ncse);
return true;
}
}
return false;
}
bool
CertificateStore::addCertificate(
ndn::shared_ptr<ndn::IdentityCertificate> pcert, uint32_t csn, bool isv)
{
CertificateStoreEntry ncse(pcert, csn, isv);
return addCertificate(ncse);
}
std::pair<uint32_t, bool>
CertificateStore::getCertificateSeqNum(std::string certName)
{
std::list<CertificateStoreEntry>::iterator it =
std::find_if(m_certTable.begin(), m_certTable.end(),
bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
if (it == m_certTable.end())
{
return std::make_pair(0, false);
}
return std::make_pair((*it).getCertSeqNum(), true);
}
void
CertificateStore::setCertificateIsVerified(std::string certName,
bool isVerified)
{
std::list<CertificateStoreEntry>::iterator it =
std::find_if(m_certTable.begin(), m_certTable.end(),
bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
if (it != m_certTable.end())
{
it->setIsSignerVerified(true);
}
}
bool
CertificateStore::getCertificateIsVerified(std::string certName)
{
std::list<CertificateStoreEntry>::iterator it =
std::find_if(m_certTable.begin(), m_certTable.end(),
bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
if (it != m_certTable.end())
{
return it->getIsSignerVerified();
}
return false;
}
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
CertificateStore::getCertificateFromStore(const std::string certName)
{
std::list<CertificateStoreEntry>::iterator it =
std::find_if(m_certTable.begin(), m_certTable.end(),
bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
if (it == m_certTable.end())
{
ndn::shared_ptr<ndn::IdentityCertificate> cert =
ndn::make_shared<ndn::IdentityCertificate>();
return std::make_pair(cert, false);
}
return std::make_pair((*it).getCert(), true);
}
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
CertificateStore::getCertificateFromStore(
const std::string certName, uint64_t checkSeqNum)
{
std::list<CertificateStoreEntry>::iterator it =
std::find_if(m_certTable.begin(), m_certTable.end(),
bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
if (it == m_certTable.end())
{
ndn::shared_ptr<ndn::IdentityCertificate> cert =
ndn::make_shared<ndn::IdentityCertificate>();
return std::make_pair(cert, false);
}
else
{
if ((*it).getCertSeqNum() == checkSeqNum)
{
return std::make_pair((*it).getCert(), true);
}
}
return std::make_pair((*it).getCert(), false);
}
bool
CertificateStore::isCertificateNewInStore(const std::string certName,
int checkSeqNo)
{
std::list<CertificateStoreEntry>::iterator it =
std::find_if(m_certTable.begin(), m_certTable.end(),
bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
if (it != m_certTable.end())
{
return (*it).getCertSeqNum() < checkSeqNo ;
}
return true;
}
bool
CertificateStore::removeCertificateFromStroe(const std::string certName)
{
std::list<CertificateStoreEntry>::iterator it =
std::find_if(m_certTable.begin(), m_certTable.end(),
bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
if (it != m_certTable.end())
{
m_certTable.erase(it);
return true;
}
return false;
}
void
CertificateStore::print()
{
std::list<CertificateStoreEntry>::iterator it;
for (it = m_certTable.begin(); it != m_certTable.end(); ++it)
{
std::cout << (*it) << std::endl;
}
std::cout << m_waitingList << std::endl;
}
} //namespace nlsr
@@ -1,63 +0,0 @@
#ifndef NLSR_CERT_STORE_HPP
#define NLSR_CERT_STORE_HPP
#include <list>
#include <ndn-cpp-dev/security/identity-certificate.hpp>
#include "certificate-store-entry.hpp"
#include "waiting-list.hpp"
namespace nlsr {
class CertificateStore
{
public:
CertificateStore()
: m_certTable()
, m_waitingList()
{}
bool
addCertificate(CertificateStoreEntry& ncse);
bool
addCertificate(ndn::shared_ptr<ndn::IdentityCertificate> pcert
, uint32_t csn, bool isv);
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
getCertificateFromStore(const std::string certName);
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
getCertificateFromStore(const std::string certName, uint64_t checkSeqNum);
bool
removeCertificateFromStroe(const std::string certName);
bool
isCertificateNewInStore(const std::string certName, int checkSeqNo);
std::pair<uint32_t, bool>
getCertificateSeqNum(std::string certName);
void
print();
void
setCertificateIsVerified(std::string certName, bool isVerified);
bool
getCertificateIsVerified(std::string certName);
private:
void
updateWaitingList(CertificateStoreEntry& ncse);
void
updateWaitingList(std::string respCertName);
private:
std::list<CertificateStoreEntry> m_certTable;
WaitingList m_waitingList;
};
} //namespace nlsr
#endif // NLSR_CERT_STORE_HPP
-400
View File
@@ -1,400 +0,0 @@
#include <ndn-cpp-dev/security/identity-certificate.hpp>
#include <ndn-cpp-dev/encoding/block.hpp>
#include <ndn-cpp-dev/util/io.hpp>
#include <stdexcept>
#include "sequencing-manager.hpp"
#include "key-manager.hpp"
#include "nlsr.hpp"
namespace nlsr {
bool
KeyManager::initialize(ConfParameter& cp)
{
initCertSeqFromFile(cp.getSeqFileDir());
if (!loadAllCertificates(cp.getCertDir()))
{
return false;
}
m_nlsrRootKeyPrefix = cp.getRootKeyPrefix();
string processIdentityName(cp.getRootKeyPrefix());
processIdentityName += "/";
processIdentityName += cp.getSiteName();
processIdentityName += "/";
processIdentityName += "R.Start";
processIdentityName += "/";
processIdentityName += cp.getRouterName();
ndn::Name ri(processIdentityName);
std::cout << "Router Identity: " << ri.toUri() << std::endl;
m_routerIdentity = ri;
processIdentityName += "/";
processIdentityName += "nlsr";
cout << "Proces Identity Name: " << processIdentityName << endl;
ndn::Name identityName(processIdentityName);
m_processIdentity = identityName;
ndn::KeyChain::deleteIdentity(m_processIdentity);
m_processCertName = ndn::KeyChain::createIdentity(m_processIdentity);
cout << "Certificate Name: " << m_processCertName.toUri() << endl;
m_processKeyName = m_processCertName.getPrefix(-2);
cout << "Key Name: " << m_processKeyName.toUri() << endl;
ndn::shared_ptr<ndn::IdentityCertificate> cert =
getCertificate(m_processCertName);
signByIdentity(*(cert), m_routerIdentity);
m_certStore.addCertificate(cert, m_certSeqNo, true);
m_certStore.print();
return true;
}
bool
KeyManager::loadAllCertificates(std::string certDirPath)
{
std::string filePath = certDirPath;
if (filePath.empty())
{
SequencingManager sm;
filePath = sm.getUserHomeDirectory();
filePath += "/nlsrCertDir";
}
return loadCertificate(filePath + "/root.cert", KEY_TYPE_ROOT)
&& loadCertificate(filePath + "/site.cert", KEY_TYPE_SITE)
&& loadCertificate(filePath + "/operator.cert", KEY_TYPE_OPERATOR)
&& loadCertificate(filePath + "/router.cert", KEY_TYPE_ROUTER) ;
}
bool
KeyManager::loadCertificate(std::string inputFile, nlsrKeyType keyType)
{
try
{
ndn::shared_ptr<ndn::IdentityCertificate> cert =
ndn::io::load<ndn::IdentityCertificate>(inputFile, ndn::io::BASE_64);
ndn::Name certName = cert->getName();
switch (keyType)
{
case KEY_TYPE_ROOT:
m_certStore.addCertificate(cert, 10, true);
m_rootCertName = certName;
std::cout << "Root Cert: " << m_rootCertName << std::endl;
break;
case KEY_TYPE_SITE:
m_certStore.addCertificate(cert, 10, true);
m_siteCertName = certName;
std::cout << "Site Cert: " << m_siteCertName << std::endl;
break;
case KEY_TYPE_OPERATOR:
m_certStore.addCertificate(cert, 10, true);
m_opCertName = certName;
std::cout << "Operator Cert: " << m_opCertName << std::endl;
break;
case KEY_TYPE_ROUTER:
m_certStore.addCertificate(cert, m_certSeqNo, true);
m_routerCertName = certName;
std::cout << "Router Cert: " << m_routerCertName << std::endl;
break;
case KEY_TYPE_PROCESS:
m_certStore.addCertificate(cert, m_certSeqNo, true);
m_processCertName = certName;
std::cout << "Process Cert: " << m_processCertName << std::endl;
break;
default:
break;
}
return true;
}
catch (std::exception& e)
{
return false;
}
return false;
}
ndn::Name
KeyManager::getProcessCertName()
{
return m_processCertName;
}
ndn::Name
KeyManager::getRouterCertName()
{
return m_routerCertName;
}
ndn::Name
KeyManager::getOperatorCertName()
{
return m_opCertName;
}
ndn::Name
KeyManager::getSiteCertName()
{
return m_siteCertName;
}
ndn::Name
KeyManager::getRootCertName()
{
return m_rootCertName;
}
uint32_t
KeyManager::getCertSeqNo()
{
return m_certSeqNo;
}
void
KeyManager::setCerSeqNo(uint32_t csn)
{
m_certSeqNo = csn;
}
void
KeyManager::initCertSeqFromFile(string certSeqFileDir)
{
m_certSeqFileNameWithPath = certSeqFileDir;
if (m_certSeqFileNameWithPath.empty())
{
SequencingManager sm;
m_certSeqFileNameWithPath = sm.getUserHomeDirectory();
}
m_certSeqFileNameWithPath += "/nlsrCertSeqNo.txt";
cout << "Key Seq File Name: " << m_certSeqFileNameWithPath << endl;
std::ifstream inputFile(m_certSeqFileNameWithPath.c_str(), ios::binary);
if (inputFile.good())
{
inputFile >> m_certSeqNo;
m_certSeqNo++;
}
else
{
m_certSeqNo = 1;
}
writeCertSeqToFile();
}
void
KeyManager::writeCertSeqToFile()
{
std::ofstream outputFile(m_certSeqFileNameWithPath.c_str(), ios::binary);
outputFile << m_certSeqNo;
outputFile.close();
}
bool
KeyManager::isNewCertificate(std::string certName, int checkSeqNum)
{
return m_certStore.isCertificateNewInStore(certName, checkSeqNum);
}
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
KeyManager::getCertificateFromStore(const std::string certName, int checkSeqNum)
{
return m_certStore.getCertificateFromStore(certName, checkSeqNum);
}
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
KeyManager::getCertificateFromStore(const std::string certName)
{
return m_certStore.getCertificateFromStore(certName);
}
bool
KeyManager::addCertificate(ndn::shared_ptr<ndn::IdentityCertificate> pcert
, uint32_t csn, bool isv)
{
return m_certStore.addCertificate(pcert, csn, isv);
}
std::pair<uint32_t, bool>
KeyManager::getCertificateSeqNum(std::string certName)
{
return m_certStore.getCertificateSeqNum(certName);
}
nlsrKeyType
KeyManager::getKeyTypeFromName(const std::string keyName)
{
Tokenizer nt(keyName, "/");
std::string KEY("KEY");
std::string opHandle("O.Start");
std::string routerHandle("R.Start");
std::string processHandle("nlsr");
if (nt.getTokenString(0, nt.getTokenPosition(KEY) - 1) == m_nlsrRootKeyPrefix)
{
return KEY_TYPE_ROOT;
}
else if (nt.doesTokenExist(opHandle))
{
return KEY_TYPE_OPERATOR;
}
else if (nt.doesTokenExist(routerHandle) &&
nt.doesTokenExist(processHandle))
{
return KEY_TYPE_PROCESS;
}
else if (nt.doesTokenExist(routerHandle) &&
!nt.doesTokenExist(processHandle))
{
return KEY_TYPE_ROUTER;
}
else
{
return KEY_TYPE_SITE;
}
}
std::string
KeyManager::getRouterName(const std::string name)
{
std::string routerName;
std::string rkp(m_nlsrRootKeyPrefix);
Tokenizer ntRkp(rkp, "/");
Tokenizer nt(name, "/");
std::string KEY("KEY");
std::string opHandle("O.Start");
std::string routerHandle("R.Start");
std::string processHandle("nlsr");
std::string infoHandle("info");
std::string lsaHandle("LSA");
if (nt.doesTokenExist(processHandle) && nt.doesTokenExist(routerHandle))
{
routerName = "/ndn" +
nt.getTokenString(ntRkp.getTokenNumber(),
nt.getTokenPosition(routerHandle) - 1) +
nt.getTokenString(nt.getTokenPosition(routerHandle) + 1,
nt.getTokenPosition(processHandle) - 1);
}
else if (nt.doesTokenExist(routerHandle) && !nt.doesTokenExist(infoHandle)
&& !nt.doesTokenExist(lsaHandle))
{
routerName = "/ndn" +
nt.getTokenString(ntRkp.getTokenNumber(),
nt.getTokenPosition(routerHandle) - 1) +
nt.getTokenString(nt.getTokenPosition(routerHandle) + 1,
nt.getTokenPosition(KEY) - 1);
}
else
{
if (nt.doesTokenExist(infoHandle))
{
routerName = nt.getTokenString(0, nt.getTokenPosition(infoHandle) - 1);
}
else
{
routerName = nt.getTokenString(nt.getTokenPosition(lsaHandle) + 1,
nt.getTokenNumber() - 4);
}
}
return routerName;
}
std::string
KeyManager::getSiteName(const std::string name)
{
std::string siteName;
std::string routerName;
std::string rkp(m_nlsrRootKeyPrefix);
Tokenizer ntRkp(rkp, "/");
Tokenizer nt(name, "/");
std::string KEY("KEY");
std::string opHandle("O.Start");
std::string routerHandle("R.Start");
if (nt.doesTokenExist(routerHandle))
{
siteName = "/ndn" + nt.getTokenString(ntRkp.getTokenNumber(),
nt.getTokenPosition(routerHandle) - 1);
}
else if (nt.doesTokenExist(opHandle))
{
siteName = "/ndn" + nt.getTokenString(ntRkp.getTokenNumber(),
nt.getTokenPosition(opHandle) - 1);
}
else
{
siteName = "/ndn" + nt.getTokenString(ntRkp.getTokenNumber(),
nt.getTokenPosition(KEY) - 1);
}
return siteName;
}
std::string
KeyManager::getRootName(const std::string name)
{
std::string rName;
Tokenizer nt(name, "/");
std::string rkp(m_nlsrRootKeyPrefix);
Tokenizer ntRkp(rkp, "/");
rName = nt.getTokenString(0, ntRkp.getTokenNumber() - 1);
return rName;
}
bool
KeyManager::verifyCertPacket(Nlsr& pnlsr, ndn::IdentityCertificate& packet)
{
std::cout << "KeyManager::verifyCertPacket Called" << std::endl;
ndn::SignatureSha256WithRsa signature(packet.getSignature());
std::string signingCertName = signature.getKeyLocator().getName().toUri();
std::string packetName = packet.getName().toUri();
std::cout << "Packet Name: " << packetName << std::endl;
std::cout << "Signee Name: " << signingCertName << std::endl;
int paketCertType = getKeyTypeFromName(packetName);
int signingCertType = getKeyTypeFromName(signingCertName);
if (signingCertType > paketCertType) //lower level Cert can not sign
{
//upper level Cert
return false;
}
if ((signingCertType == paketCertType) && (paketCertType != KEY_TYPE_ROOT))
{
return false;
}
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> signee =
m_certStore.getCertificateFromStore(signingCertName);
if (signee.second)
{
switch (paketCertType)
{
case KEY_TYPE_ROOT:
return ((getRootName(packetName) == m_nlsrRootKeyPrefix) &&
verifySignature(packet, signee.first->getPublicKeyInfo()));
break;
case KEY_TYPE_SITE:
return ((getRootName(packetName) == getRootName(signingCertName)) &&
verifySignature(packet, signee.first->getPublicKeyInfo()) &&
m_certStore.getCertificateIsVerified(signingCertName));
break;
case KEY_TYPE_OPERATOR:
return ((getSiteName(packetName) == getSiteName(signingCertName)) &&
verifySignature(packet, signee.first->getPublicKeyInfo()) &&
m_certStore.getCertificateIsVerified(signingCertName));
break;
case KEY_TYPE_ROUTER:
return ((getSiteName(packetName) == getSiteName(signingCertName)) &&
verifySignature(packet, signee.first->getPublicKeyInfo()) &&
m_certStore.getCertificateIsVerified(signingCertName));
break;
case KEY_TYPE_PROCESS:
return ((getRouterName(packetName) == getRouterName(signingCertName)) &&
verifySignature(packet, signee.first->getPublicKeyInfo()) &&
m_certStore.getCertificateIsVerified(signingCertName));
break;
}
}
else
{
std::cout << "Certificate Not Found in store. Sending Interest" << std::endl;
pnlsr.getIm().expressInterest(signingCertName, 3,
pnlsr.getConfParameter().getInterestResendTime());
return false;
}
return false;
}
}//namespace nlsr
-273
View File
@@ -1,273 +0,0 @@
#ifndef NLSR_KM_HPP
#define NLSR_KM_HPP
#include <ndn-cpp-dev/face.hpp>
#include <ndn-cpp-dev/data.hpp>
#include <ndn-cpp-dev/security/key-chain.hpp>
#include <ndn-cpp-dev/security/validator.hpp>
#include <ndn-cpp-dev/util/random.hpp>
#include <ndn-cpp-dev/security/identity-certificate.hpp>
#include <list>
#include "conf-parameter.hpp"
#include "certificate-store.hpp"
#include "utility/tokenizer.hpp"
namespace nlsr {
class Nlsr;
enum nlsrKeyType
{
KEY_TYPE_ROOT,
KEY_TYPE_SITE,
KEY_TYPE_OPERATOR,
KEY_TYPE_ROUTER,
KEY_TYPE_PROCESS,
KEY_TYPE_UNKNOWN
};
enum nlsrContentType
{
CONTENT_TYPE_DATA,
CONTENT_TYPE_CERT
};
class KeyManager: public ndn::KeyChain, public ndn::Validator
{
typedef SecPublicInfo::Error InfoError;
typedef SecTpm::Error TpmError;
public:
using ndn::KeyChain::addCertificate;
KeyManager()
: m_certSeqNo(1)
, m_nlsrRootKeyPrefix()
, m_certStore()
{
}
bool
initialize(ConfParameter& cp);
void
checkPolicy(const ndn::Data& data,
int stepCount,
const ndn::OnDataValidated& onValidated,
const ndn::OnDataValidationFailed& onValidationFailed,
std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps)
{}
void
checkPolicy(const ndn::Interest& interest,
int stepCount,
const ndn::OnInterestValidated& onValidated,
const ndn::OnInterestValidationFailed& onValidationFailed,
std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps)
{}
void
signData(ndn::Data& data)
{
ndn::KeyChain::signByIdentity(data, m_processIdentity);
}
template<typename T> void
signByIdentity(T& packet, ndn::Name signeeIdentity)
{
ndn::KeyChain::signByIdentity(packet, signeeIdentity);
}
ndn::Name
createIdentity(const ndn::Name identityName)
{
return ndn::KeyChain::createIdentity(identityName);
}
ndn::Name
createIdentity(const ndn::Name identityName, const ndn::Name signee)
{
ndn::KeyChain::addIdentity(identityName);
ndn::Name keyName;
try
{
keyName = ndn::KeyChain::getDefaultKeyNameForIdentity(identityName);
}
catch (InfoError& e)
{
keyName = ndn::KeyChain::generateRSAKeyPairAsDefault(identityName, true);
}
ndn::shared_ptr<ndn::PublicKey> pubKey;
try
{
pubKey = ndn::KeyChain::getPublicKey(keyName);
}
catch (InfoError& e)
{
return identityName;
}
ndn::Name certName;
try
{
certName = ndn::KeyChain::getDefaultCertificateNameForKey(keyName);
}
catch (InfoError& e)
{
ndn::shared_ptr<ndn::IdentityCertificate> certificate =
ndn::make_shared<ndn::IdentityCertificate>();
ndn::Name certificateName = keyName.getPrefix(-1);
certificateName.append("KEY").append(
keyName.get(-1)).append("ID-CERT").appendVersion();
certificate->setName(certificateName);
certificate->setNotBefore(ndn::time::system_clock::now());
certificate->setNotAfter(ndn::time::system_clock::now() + ndn::time::days(
7300) /* 1 year*/);
certificate->setPublicKeyInfo(*pubKey);
certificate->addSubjectDescription(
ndn::CertificateSubjectDescription("2.5.4.41",
keyName.toUri()));
certificate->encode();
try
{
ndn::KeyChain::signByIdentity(*certificate, signee);
}
catch (InfoError& e)
{
try
{
ndn::KeyChain::deleteIdentity(identityName);
}
catch (InfoError& e)
{
}
return identityName;
}
certName = certificate->getName();
}
return certName;
}
void
printCertStore()
{
m_certStore.print();
}
private:
bool
verifyDataPacket(ndn::Data packet)
{
std::cout << "KeyManager::verifyDataPacket Called" << std::endl;
ndn::SignatureSha256WithRsa signature(packet.getSignature());
std::string signingCertName = signature.getKeyLocator().getName().toUri();
std::string packetName = packet.getName().toUri();
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> signee =
m_certStore.getCertificateFromStore(signingCertName);
if (signee.second)
{
std::string routerNameFromPacketName = getRouterName(packetName);
std::string routerNameFromCertName = getRouterName(signingCertName);
return ((routerNameFromPacketName == routerNameFromCertName) &&
verifySignature(packet, signee.first->getPublicKeyInfo()) &&
m_certStore.getCertificateIsVerified(signingCertName));
}
return false;
}
bool
verifyCertPacket(Nlsr& pnlsr, ndn::IdentityCertificate& packet);
public:
template<typename T> bool
verify(T& packet)
{
std::cout << "KeyManager::verify Called" << std::endl;
return verifyDataPacket(packet);
return false;
}
bool
verify(Nlsr& pnlsr, ndn::IdentityCertificate& packet)
{
return verifyCertPacket(pnlsr, packet);
}
ndn::Name
getProcessCertName();
ndn::Name
getRouterCertName();
ndn::Name
getOperatorCertName();
ndn::Name
getSiteCertName();
ndn::Name
getRootCertName();
uint32_t
getCertSeqNo();
std::pair<uint32_t, bool>
getCertificateSeqNum(std::string certName);
void
setCerSeqNo(uint32_t csn);
void
initCertSeqFromFile(std::string certSeqFileDir);
void
writeCertSeqToFile();
bool
isNewCertificate(std::string certName, int checkSeqNum);
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
getCertificateFromStore(const std::string certName, int checkSeqNum);
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
getCertificateFromStore(const std::string certName);
bool
addCertificate(ndn::shared_ptr<ndn::IdentityCertificate> pcert,
uint32_t csn, bool isv);
private:
bool
loadAllCertificates(std::string certDirPath);
bool
loadCertificate(std::string inputFile, nlsrKeyType keyType);
nlsrKeyType
getKeyTypeFromName(const std::string keyName);
std::string
getRouterName(const std::string name);
std::string
getSiteName(const std::string name);
std::string
getRootName(const std::string name);
private:
ndn::Name m_processIdentity;
ndn::Name m_routerIdentity;
ndn::Name m_processCertName;
ndn::Name m_routerCertName;
ndn::Name m_opCertName;
ndn::Name m_siteCertName;
ndn::Name m_rootCertName;
ndn::Name m_processKeyName;
uint32_t m_certSeqNo;
std::string m_certSeqFileNameWithPath;
std::string m_nlsrRootKeyPrefix;
CertificateStore m_certStore;
};
}//namespace nlsr
#endif //NLSR_KM_HPP
@@ -1,40 +0,0 @@
#include <iostream>
#include <list>
#include <ndn-cpp-dev/face.hpp>
#include "waiting-list-entry.hpp"
namespace nlsr {
static bool
waiteeCompare(std::string& w1, std::string& w2)
{
return w1 == w2 ;
}
bool
WaitingListEntry::addWaitee(std::string waiteeName)
{
std::list<std::string>::iterator it = std::find_if(m_waitingCerts.begin(),
m_waitingCerts.end(), ndn::bind(&waiteeCompare, _1, waiteeName));
if (it == m_waitingCerts.end())
{
m_waitingCerts.push_back(waiteeName);
return true;
}
return false;
}
std::ostream&
operator<<(std::ostream& os, const WaitingListEntry& we)
{
os << "-------------Wiating List Entry-------------" << std::endl;
os << "Responsible Certificate: " << we.getResponsibleCert() << std::endl;
std::list<std::string> waitee = we.getWaitingCerts();
int i = 1;
for (std::list<std::string>::iterator it = waitee.begin();
it != waitee.end(); ++i, ++it)
{
os << "Waite " << i << ": " << *(it) << std::endl;
}
return os;
}
}//namespace nlsr
@@ -1,51 +0,0 @@
#ifndef NLSR_WLE_HPP
#define NLSR_WLE_HPP
#include <list>
#include <iostream>
namespace nlsr {
class WaitingListEntry
{
public:
WaitingListEntry()
: m_responsibleCert()
, m_waitingCerts()
{}
WaitingListEntry(std::string resCert)
: m_responsibleCert(resCert)
, m_waitingCerts()
{}
std::string
getResponsibleCert() const
{
return m_responsibleCert;
}
void
setResponsibleCert(std::string resCert)
{
m_responsibleCert = resCert;
}
std::list<std::string>
getWaitingCerts() const
{
return m_waitingCerts;
}
bool
addWaitee(std::string waiteeName);
private:
std::string m_responsibleCert;
std::list<std::string> m_waitingCerts;
};
std::ostream&
operator<<(std::ostream& os, const WaitingListEntry& we);
} //end name space
#endif //NLSR_WLE_HPP
-72
View File
@@ -1,72 +0,0 @@
#include <ndn-cpp-dev/face.hpp>
#include "waiting-list.hpp"
namespace nlsr {
static bool
waitingListCompare(const WaitingListEntry& w1, const std::string& respCert)
{
return w1.getResponsibleCert() == respCert;
}
std::pair<WaitingListEntry, bool>
WaitingList::getWaitingListEntry(std::string respCert)
{
std::list<WaitingListEntry>::iterator it = std::find_if(m_waitingTable.begin(),
m_waitingTable.end(), ndn::bind(&waitingListCompare, _1, respCert));
if (it != m_waitingTable.end())
{
return std::make_pair(*(it), true);
}
WaitingListEntry wle;
return std::make_pair(wle, false);
}
bool
WaitingList::add(std::string respCert, std::string waitee)
{
std::list<WaitingListEntry>::iterator it = std::find_if(m_waitingTable.begin(),
m_waitingTable.end(), ndn::bind(&waitingListCompare, _1, respCert));
if (it == m_waitingTable.end())
{
WaitingListEntry newWle(respCert);
newWle.addWaitee(waitee);
m_waitingTable.push_back(newWle);
return true;
}
else
{
return it->addWaitee(waitee);
}
return false;
}
bool
WaitingList::remove(std::string respCert)
{
std::list<WaitingListEntry>::iterator it = std::find_if(m_waitingTable.begin(),
m_waitingTable.end(), ndn::bind(&waitingListCompare, _1, respCert));
if (it == m_waitingTable.end())
{
return false;
}
else
{
m_waitingTable.erase(it);
return true;
}
return false;
}
std::ostream&
operator<<(std::ostream& os, WaitingList wl)
{
os << "-------Waiting List--------" << std::endl;
std::list<WaitingListEntry> wles = wl.getWaitingTable();
for (std::list<WaitingListEntry> ::iterator it = wles.begin();
it != wles.end(); ++it)
{
os << *(it) << std::endl;
}
return os;
}
}//namespace nlsr
-38
View File
@@ -1,38 +0,0 @@
#ifndef NLSR_WL_HPP
#define NLSR_WL_HPP
#include "waiting-list-entry.hpp"
namespace nlsr {
class WaitingList
{
public:
WaitingList()
: m_waitingTable()
{}
std::list<WaitingListEntry>&
getWaitingTable()
{
return m_waitingTable;
}
bool
add(std::string respCert, std::string waitee);
std::pair<WaitingListEntry, bool>
getWaitingListEntry(std::string respCert);
bool
remove(std::string respCert);
private:
std::list<WaitingListEntry> m_waitingTable;
};
std::ostream&
operator<<(std::ostream& os, WaitingList wl);
}//namespace nlsr
#endif //NLSR_WL_HPP
+4 -4
View File
@@ -43,9 +43,9 @@ AdjacencyLsa::AdjacencyLsa(const ndn::Block& block)
wireDecode(block);
}
template<bool T>
template<ndn::encoding::Tag TAG>
size_t
AdjacencyLsa::wireEncode(ndn::EncodingImpl<T>& block) const
AdjacencyLsa::wireEncode(ndn::EncodingImpl<TAG>& block) const
{
size_t totalLength = 0;
@@ -63,10 +63,10 @@ AdjacencyLsa::wireEncode(ndn::EncodingImpl<T>& block) const
}
template size_t
AdjacencyLsa::wireEncode<true>(ndn::EncodingImpl<true>& block) const;
AdjacencyLsa::wireEncode<ndn::encoding::EncoderTag>(ndn::EncodingImpl<ndn::encoding::EncoderTag>& encoder) const;
template size_t
AdjacencyLsa::wireEncode<false>(ndn::EncodingImpl<false>& block) const;
AdjacencyLsa::wireEncode<ndn::encoding::EstimatorTag>(ndn::EncodingImpl<ndn::encoding::EstimatorTag>& encoder) const;
const ndn::Block&
AdjacencyLsa::wireEncode() const
+2 -2
View File
@@ -109,9 +109,9 @@ public:
return *this;
}
template<bool T>
template<ndn::encoding::Tag TAG>
size_t
wireEncode(ndn::EncodingImpl<T>& block) const;
wireEncode(ndn::EncodingImpl<TAG>& block) const;
const ndn::Block&
wireEncode() const;
+4 -4
View File
@@ -43,9 +43,9 @@ Adjacency::Adjacency(const ndn::Block& block)
wireDecode(block);
}
template<bool T>
template<ndn::encoding::Tag TAG>
size_t
Adjacency::wireEncode(ndn::EncodingImpl<T>& encoder) const
Adjacency::wireEncode(ndn::EncodingImpl<TAG>& encoder) const
{
size_t totalLength = 0;
@@ -63,10 +63,10 @@ Adjacency::wireEncode(ndn::EncodingImpl<T>& encoder) const
}
template size_t
Adjacency::wireEncode<true>(ndn::EncodingImpl<true>& block) const;
Adjacency::wireEncode<ndn::encoding::EncoderTag>(ndn::EncodingImpl<ndn::encoding::EncoderTag>& block) const;
template size_t
Adjacency::wireEncode<false>(ndn::EncodingImpl<false>& block) const;
Adjacency::wireEncode<ndn::encoding::EstimatorTag>(ndn::EncodingImpl<ndn::encoding::EstimatorTag>& block) const;
const ndn::Block&
Adjacency::wireEncode() const
+2 -2
View File
@@ -101,9 +101,9 @@ public:
return *this;
}
template<bool T>
template<ndn::encoding::Tag TAG>
size_t
wireEncode(ndn::EncodingImpl<T>& block) const;
wireEncode(ndn::EncodingImpl<TAG>& block) const;
const ndn::Block&
wireEncode() const;
+4 -4
View File
@@ -44,9 +44,9 @@ CoordinateLsa::CoordinateLsa(const ndn::Block& block)
wireDecode(block);
}
template<bool T>
template<ndn::encoding::Tag TAG>
size_t
CoordinateLsa::wireEncode(ndn::EncodingImpl<T>& block) const
CoordinateLsa::wireEncode(ndn::EncodingImpl<TAG>& block) const
{
size_t totalLength = 0;
size_t doubleLength = 10;
@@ -70,10 +70,10 @@ CoordinateLsa::wireEncode(ndn::EncodingImpl<T>& block) const
}
template size_t
CoordinateLsa::wireEncode<true>(ndn::EncodingImpl<true>& block) const;
CoordinateLsa::wireEncode<ndn::encoding::EncoderTag>(ndn::EncodingImpl<ndn::encoding::EncoderTag>& block) const;
template size_t
CoordinateLsa::wireEncode<false>(ndn::EncodingImpl<false>& block) const;
CoordinateLsa::wireEncode<ndn::encoding::EstimatorTag>(ndn::EncodingImpl<ndn::encoding::EstimatorTag>& block) const;
const ndn::Block&
CoordinateLsa::wireEncode() const
+2 -2
View File
@@ -103,9 +103,9 @@ public:
return *this;
}
template<bool T>
template<ndn::encoding::Tag TAG>
size_t
wireEncode(ndn::EncodingImpl<T>& block) const;
wireEncode(ndn::EncodingImpl<TAG>& block) const;
const ndn::Block&
wireEncode() const;
+4 -4
View File
@@ -47,9 +47,9 @@ LsaInfo::LsaInfo(const ndn::Block& block)
wireDecode(block);
}
template<bool T>
template<ndn::encoding::Tag TAG>
size_t
LsaInfo::wireEncode(ndn::EncodingImpl<T>& encoder) const
LsaInfo::wireEncode(ndn::EncodingImpl<TAG>& encoder) const
{
size_t totalLength = 0;
@@ -73,10 +73,10 @@ LsaInfo::wireEncode(ndn::EncodingImpl<T>& encoder) const
}
template size_t
LsaInfo::wireEncode<true>(ndn::EncodingImpl<true>& block) const;
LsaInfo::wireEncode<ndn::encoding::EncoderTag>(ndn::EncodingImpl<ndn::encoding::EncoderTag>& block) const;
template size_t
LsaInfo::wireEncode<false>(ndn::EncodingImpl<false>& block) const;
LsaInfo::wireEncode<ndn::encoding::EstimatorTag>(ndn::EncodingImpl<ndn::encoding::EstimatorTag>& block) const;
const ndn::Block&
LsaInfo::wireEncode() const
+2 -2
View File
@@ -114,9 +114,9 @@ public:
return m_hasInfiniteExpirationPeriod;
}
template<bool T>
template<ndn::encoding::Tag TAG>
size_t
wireEncode(ndn::EncodingImpl<T>& block) const;
wireEncode(ndn::EncodingImpl<TAG>& block) const;
const ndn::Block&
wireEncode() const;
+4 -4
View File
@@ -45,9 +45,9 @@ LsdbStatus::LsdbStatus(const ndn::Block& block)
wireDecode(block);
}
template<bool T>
template<ndn::encoding::Tag TAG>
size_t
LsdbStatus::wireEncode(ndn::EncodingImpl<T>& block) const
LsdbStatus::wireEncode(ndn::EncodingImpl<TAG>& block) const
{
size_t totalLength = 0;
@@ -73,10 +73,10 @@ LsdbStatus::wireEncode(ndn::EncodingImpl<T>& block) const
}
template size_t
LsdbStatus::wireEncode<true>(ndn::EncodingImpl<true>& block) const;
LsdbStatus::wireEncode<ndn::encoding::EncoderTag>(ndn::EncodingImpl<ndn::encoding::EncoderTag>& block) const;
template size_t
LsdbStatus::wireEncode<false>(ndn::EncodingImpl<false>& block) const;
LsdbStatus::wireEncode<ndn::encoding::EstimatorTag>(ndn::EncodingImpl<ndn::encoding::EstimatorTag>& block) const;
const ndn::Block&
LsdbStatus::wireEncode() const
+2 -2
View File
@@ -156,9 +156,9 @@ public:
return m_hasNameLsas;
}
template<bool T>
template<ndn::encoding::Tag TAG>
size_t
wireEncode(ndn::EncodingImpl<T>& block) const;
wireEncode(ndn::EncodingImpl<TAG>& block) const;
const ndn::Block&
wireEncode() const;
+4 -4
View File
@@ -43,9 +43,9 @@ NameLsa::NameLsa(const ndn::Block& block)
wireDecode(block);
}
template<bool T>
template<ndn::encoding::Tag TAG>
size_t
NameLsa::wireEncode(ndn::EncodingImpl<T>& block) const
NameLsa::wireEncode(ndn::EncodingImpl<TAG>& block) const
{
size_t totalLength = 0;
@@ -63,10 +63,10 @@ NameLsa::wireEncode(ndn::EncodingImpl<T>& block) const
}
template size_t
NameLsa::wireEncode<true>(ndn::EncodingImpl<true>& block) const;
NameLsa::wireEncode<ndn::encoding::EncoderTag>(ndn::EncodingImpl<ndn::encoding::EncoderTag>& block) const;
template size_t
NameLsa::wireEncode<false>(ndn::EncodingImpl<false>& block) const;
NameLsa::wireEncode<ndn::encoding::EstimatorTag>(ndn::EncodingImpl<ndn::encoding::EstimatorTag>& block) const;
const ndn::Block&
NameLsa::wireEncode() const
+2 -2
View File
@@ -108,9 +108,9 @@ public:
return *this;
}
template<bool T>
template<ndn::encoding::Tag TAG>
size_t
wireEncode(ndn::EncodingImpl<T>& block) const;
wireEncode(ndn::EncodingImpl<TAG>& block) const;
const ndn::Block&
wireEncode() const;
+3
View File
@@ -95,5 +95,8 @@ private:
};
BOOST_GLOBAL_FIXTURE(IdentityFixture)
#if BOOST_VERSION >= 105900
;
#endif // BOOST_VERSION >= 105900
} // namespace nlsr
+1 -1
View File
@@ -86,7 +86,7 @@ public:
CoordinateLsa lsa(origin, CoordinateLsa::TYPE_STRING, 1, ndn::time::system_clock::now(),
radius, angle);
return std::move(lsa);
return lsa;
}
void
+1 -1
View File
@@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE(ConfParameterSettersAndGetters)
BOOST_CHECK_EQUAL(cp1.getRouterPrefix(), "/ATT/memphis/router1");
BOOST_CHECK_EQUAL(cp1.getInterestRetryNumber(), (uint32_t)2);
BOOST_CHECK_EQUAL(cp1.getInterestRetryNumber(), 2);
BOOST_CHECK_EQUAL(cp1.getInterestResendTime(), 1000);
+3 -3
View File
@@ -221,7 +221,7 @@ Nlsrc::fetchFromLsdb(const ndn::Name::Component& datasetType,
ndn::util::SegmentFetcher::fetch(m_face,
interest,
ndn::util::DontVerifySegment(),
m_validator,
std::bind(&Nlsrc::onFetchSuccess<T>,
this, _1, recordLsa),
std::bind(&Nlsrc::onTimeout, this, _1, _2));
@@ -351,7 +351,7 @@ Nlsrc::getRouter(const nlsr::tlv::LsaInfo& info)
const ndn::Name& originRouterName = info.getOriginRouter();
const auto& pair =
m_routers.insert(std::make_pair(originRouterName, std::move(Router())));
m_routers.insert(std::make_pair(originRouterName, Router()));
return pair.first->second;
}
@@ -414,4 +414,4 @@ main(int argc, char** argv)
return 2;
}
return 0;
}
}
+2
View File
@@ -26,6 +26,7 @@
#include <boost/noncopyable.hpp>
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/security/validator-null.hpp>
#include <deque>
#include <map>
@@ -146,6 +147,7 @@ private:
private:
ndn::KeyChain m_keyChain;
ndn::Face& m_face;
ndn::ValidatorNull m_validator;
std::deque<std::function<void()>> m_fetchSteps;
+3 -3
View File
@@ -1,7 +1,7 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
"""
Copyright (c) 2014-2015, The University of Memphis,
Copyright (c) 2014-2016, The University of Memphis,
Regents of the University of California,
Arizona Board of Regents.
@@ -20,7 +20,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/>.
"""
VERSION = '0.2.1'
VERSION = '0.2.2'
APPNAME = "nlsr"
BUGREPORT = "http://redmine.named-data.net/projects/nlsr"
URL = "http://named-data.net/doc/NLSR/"
@@ -105,7 +105,7 @@ def build(bld):
name='nsync-objects',
features='cxx',
source=bld.path.ant_glob(['nsync/**/*.cc', 'nsync/**/*.proto']),
use='BOOST NDN_CXX OPENSSL',
use='BOOST NDN_CXX OPENSSL LOG4CXX',
includes='nsync',
export_includes='nsync',
)