Browse Source
Send Hello Interest after route to neighbor is successfully registered --> First Hello interval is eliminated --> After Hello Nack, wait exponentially before processing it as a timeout Register sync route for each neighbor after its Hello Data is validated refs: #5009 Change-Id: Ice39a591f1e58e474b494d93c913fa45e10f24f2pull/14/head
39 changed files with 283 additions and 731 deletions
@ -1,47 +0,0 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
||||
/*
|
||||
* Copyright (c) 2014-2019, 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" |
||||
|
||||
namespace nlsr { |
||||
|
||||
NlsrRunner::NlsrRunner(ndn::Face& face, ConfParameter& confParam) |
||||
: m_face(face) |
||||
, m_confParam(confParam) |
||||
, m_nlsr(m_face, m_keyChain, m_confParam) |
||||
{ |
||||
} |
||||
|
||||
void |
||||
NlsrRunner::run() |
||||
{ |
||||
m_nlsr.initialize(); |
||||
|
||||
try { |
||||
m_face.processEvents(); |
||||
} |
||||
catch (...) { |
||||
m_nlsr.getFib().clean(); |
||||
throw; |
||||
} |
||||
} |
||||
|
||||
} // namespace nlsr
|
@ -1,70 +0,0 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
||||
/*
|
||||
* Copyright (c) 2014-2019, 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 "conf-parameter.hpp" |
||||
|
||||
#include <ndn-cxx/face.hpp> |
||||
#include <ndn-cxx/util/scheduler.hpp> |
||||
|
||||
namespace nlsr { |
||||
|
||||
/*! \brief A wrapper class to instantiate and configure an NLSR object.
|
||||
* |
||||
* As its name suggests, this class is responsible for running |
||||
* NLSR. It creates an nlsr::ConfFileProcessor to read a configuration |
||||
* file and uses that to configure and then start an NLSR process. |
||||
* This class only exists to provide this functionality, and there is |
||||
* no special reliance of NLSR on this class. |
||||
*/ |
||||
class NlsrRunner |
||||
{ |
||||
public: |
||||
explicit |
||||
NlsrRunner(ndn::Face& face, ConfParameter& confParam); |
||||
|
||||
/*! \brief Instantiate, configure, and start the NLSR process.
|
||||
* |
||||
* Each NlsrRunner is uniquely paired to the Face it's instantiated |
||||
* with. This is *not* a factory-type class, but a one-to-one |
||||
* relationship. If one wants to create multiple NLSR classes, |
||||
* multiple NLSR runners need to be created, too. |
||||
* |
||||
* \throws ConfFileError The configuration file cannot be processed. |
||||
* NLSR is not started. |
||||
* \sa Nlsr::canonizeNeighborUris |
||||
*/ |
||||
void |
||||
run(); |
||||
|
||||
private: |
||||
ndn::Face& m_face; |
||||
ndn::KeyChain m_keyChain; |
||||
ConfParameter& m_confParam; |
||||
Nlsr m_nlsr; |
||||
}; |
||||
|
||||
} // namespace nlsr
|
||||
|
||||
#endif // NLSR_NLSR_RUNNER_HPP
|
@ -1,44 +0,0 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
||||
/**
|
||||
* 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). |
||||
* 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/>.
|
||||
* |
||||
* \author A K M Mahmudul Hoque <ahoque1@memphis.edu> |
||||
* |
||||
**/ |
||||
#include "face-map.hpp" |
||||
#include "common.hpp" |
||||
#include "logger.hpp" |
||||
|
||||
#include <iostream> |
||||
#include <utility> |
||||
|
||||
namespace nlsr { |
||||
|
||||
INIT_LOGGER(route.FaceMap); |
||||
|
||||
void |
||||
FaceMap::writeLog() |
||||
{ |
||||
NLSR_LOG_DEBUG("------- Face Map-----------"); |
||||
for (const auto& it : m_table) { |
||||
NLSR_LOG_DEBUG("Face Map Entry (FaceUri: " << (it.second).getFaceUri() |
||||
<< " Face Id: " << (it.second).getFaceId() << ")"); |
||||
} |
||||
} |
||||
|
||||
} // namespace nlsr
|
@ -1,121 +0,0 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
||||
/**
|
||||
* Copyright (c) 2014-2017, The University of Memphis, |
||||
* Regents of the University of California |
||||
* |
||||
* 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_FACE_MAP_HPP |
||||
#define NLSR_FACE_MAP_HPP |
||||
|
||||
#include "common.hpp" |
||||
|
||||
#include <map> |
||||
|
||||
namespace nlsr { |
||||
|
||||
class FaceMapEntry |
||||
{ |
||||
|
||||
public: |
||||
FaceMapEntry(const std::string& faceUri, uint32_t faceId) |
||||
: m_faceUri(faceUri) |
||||
, m_faceId(faceId) |
||||
{ |
||||
} |
||||
|
||||
void |
||||
setFaceUri(const std::string& faceUri) |
||||
{ |
||||
m_faceUri = faceUri; |
||||
} |
||||
|
||||
const std::string& |
||||
getFaceUri() const |
||||
{ |
||||
return m_faceUri; |
||||
} |
||||
|
||||
void |
||||
setFaceId(uint32_t faceId) |
||||
{ |
||||
m_faceId = faceId; |
||||
} |
||||
|
||||
uint32_t |
||||
getFaceId() const |
||||
{ |
||||
return m_faceId; |
||||
} |
||||
|
||||
bool |
||||
compare(const FaceMapEntry& fme) |
||||
{ |
||||
return m_faceUri == fme.getFaceUri(); |
||||
} |
||||
|
||||
private: |
||||
std::string m_faceUri; |
||||
uint32_t m_faceId; |
||||
}; |
||||
|
||||
class FaceMap |
||||
{ |
||||
|
||||
public: |
||||
FaceMap() |
||||
{ |
||||
} |
||||
|
||||
~FaceMap() |
||||
{ |
||||
} |
||||
|
||||
inline void |
||||
update(const std::string& faceUri, uint32_t faceId) |
||||
{ |
||||
FaceMapEntry fme(faceUri, faceId); |
||||
std::map<std::string, FaceMapEntry>::iterator it = m_table.find(faceUri); |
||||
if (it == m_table.end()) { |
||||
m_table.emplace(faceUri, fme); |
||||
} |
||||
else { |
||||
(it->second).setFaceId(fme.getFaceId()); |
||||
} |
||||
} |
||||
|
||||
inline uint32_t |
||||
getFaceId(const std::string& faceUri) |
||||
{ |
||||
FaceMapEntry fme(faceUri, 0); |
||||
std::map<std::string, FaceMapEntry>::iterator it = m_table.find(faceUri); |
||||
if (it != m_table.end()) { |
||||
return (it->second).getFaceId(); |
||||
} |
||||
return 0; |
||||
} |
||||
|
||||
void |
||||
writeLog(); |
||||
|
||||
private: |
||||
std::map<std::string, FaceMapEntry> m_table; |
||||
}; |
||||
|
||||
} // namespace nlsr
|
||||
|
||||
#endif // NLSR_FACE_MAP_HPP
|
Loading…
Reference in new issue