docs: improve Doxygen comments.
refs: #1435
Change-Id: I21624ef4eec393c82a50229a07e8277fb6ae4ddf
diff --git a/src/adjacency-list.hpp b/src/adjacency-list.hpp
index 8f7864b..f255131 100644
--- a/src/adjacency-list.hpp
+++ b/src/adjacency-list.hpp
@@ -1,4 +1,4 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2016, The University of Memphis,
* Regents of the University of California,
@@ -39,9 +39,28 @@
AdjacencyList();
~AdjacencyList();
+ /*! \brief Inserts an adjacency into the list.
+
+ \param adjacent The adjacency that we want to add to this list.
+
+ \retval 0 Indicates success.
+ \retval 1 Indicates failure.
+
+ This function attempts to insert the supplied adjacency into this
+ object, which is an adjacency list.
+ */
int32_t
insert(Adjacent& adjacent);
+ /*! \brief Sets the status of an adjacency.
+
+ \param adjName The adjacency in this list you want to change the status of.
+
+ \param s The status to change to.
+
+ \return A boolean indicating whether an adjacency was
+ updated. This is false if s is not in the list.
+ */
bool
updateAdjacentStatus(const ndn::Name& adjName, Adjacent::Status s);
@@ -69,9 +88,31 @@
void
setTimedOutInterestCount(const ndn::Name& neighbor, uint32_t count);
+ /*! \brief Copies the adjacencies in a list to this one.
+
+ \param adl The adjacency list, the entries of which we want to
+ copy into this object.
+
+ Copies the entries contained in one list into this object.
+ */
void
addAdjacents(AdjacencyList& adl);
+ /*! \brief Determines whether this list can be used to build an adj. LSA.
+ \param interestRetryNo The maximum number of hello-interest
+ retries to contact a neighbor.
+
+ \return Returns a boolean indicating whether this list can be used
+ to build an adj. LSA.
+
+ Determines whether this adjacency list object could be used to
+ build an adjacency LSA. An LSA is buildable when the status of all
+ neighbors is known. A neighbor's status is known when their status
+ is ACTIVE, or INACTIVE and some number of hello interests
+ (specified by nlsr::ConfParameter::getInterestRetryNumber()) have
+ failed. To be explicit, a neighbor's status is unknown if we are
+ still sending hello interests.
+ */
bool
isAdjLsaBuildable(const uint32_t interestRetryNo) const;
diff --git a/src/communication/sync-logic-handler.hpp b/src/communication/sync-logic-handler.hpp
index b182a4b..db7bc48 100644
--- a/src/communication/sync-logic-handler.hpp
+++ b/src/communication/sync-logic-handler.hpp
@@ -56,6 +56,11 @@
SyncLogicHandler(ndn::Face& face, Lsdb& lsdb, ConfParameter& conf, SequencingManager& seqManager);
+ /*! \brief Simple wrapper function to handle updates from Sync.
+
+ \param v The information that Sync has acquired.
+ \param socket The socket that Sync is using to synchronize updates.
+ */
void
onNsyncUpdate(const std::vector<Sync::MissingDataInfo>& v, Sync::SyncSocket* socket);
diff --git a/src/hello-protocol.cpp b/src/hello-protocol.cpp
index 4f55af9..377c69d 100644
--- a/src/hello-protocol.cpp
+++ b/src/hello-protocol.cpp
@@ -55,6 +55,7 @@
std::list<Adjacent> adjList = m_nlsr.getAdjacencyList().getAdjList();
for (std::list<Adjacent>::iterator it = adjList.begin(); it != adjList.end();
++it) {
+ // If this adjacency has a Face, just proceed as usual.
if((*it).getFaceId() != 0) {
/* interest name: /<neighbor>/NLSR/INFO/<router> */
ndn::Name interestName = (*it).getName() ;
@@ -64,6 +65,9 @@
expressInterest(interestName,
m_nlsr.getConfParameter().getInterestResendTime());
}
+ // If it does not have a Face, we need to give it one. A
+ // successful registration prompts a callback that sends the hello
+ // Interest to the new Face.
else {
registerPrefixes((*it).getName(), (*it).getConnectingFaceUri(),
(*it).getLinkCost(), ndn::time::milliseconds::max());
@@ -104,7 +108,9 @@
_LOG_DEBUG("Sending out data for name: " << interest.getName());
m_nlsr.getNlsrFace().put(*data);
Adjacent *adjacent = m_nlsr.getAdjacencyList().findAdjacent(neighbor);
+ // If this neighbor was previously inactive, send our own hello interest, too
if (adjacent->getStatus() == Adjacent::STATUS_INACTIVE) {
+ // We can only do that if the neighbor currently has a face.
if(adjacent->getFaceId() != 0){
/* interest name: /<neighbor>/NLSR/INFO/<router> */
ndn::Name interestName(neighbor);
@@ -114,6 +120,8 @@
expressInterest(interestName,
m_nlsr.getConfParameter().getInterestResendTime());
}
+ // If the originator of the Interest currently lacks a Face, we
+ // need to give it one.
else {
registerPrefixes(adjacent->getName(), adjacent->getConnectingFaceUri(),
adjacent->getLinkCost(), ndn::time::milliseconds::max());
@@ -158,6 +166,9 @@
}
}
+ // This is the first function that incoming Hello data will
+ // see. This checks if the data appears to be signed, and passes it
+ // on to validate the content of the data.
void
HelloProtocol::onContent(const ndn::Interest& interest, const ndn::Data& data)
{
@@ -173,6 +184,11 @@
this, _1, _2));
}
+ // A validator is called on the incoming data, and if the data
+ // passes the validator's description/definitions, this function is
+ // called. Set the neighbor's status to active and refresh its
+ // LSA. If there was a change in status, we schedule an adjacency
+ // LSA build.
void
HelloProtocol::onContentValidated(const ndn::shared_ptr<const ndn::Data>& data)
{
@@ -196,6 +212,8 @@
}
}
+ // Simply logs a debug message that the content could not be
+ // validated (and is implicitly being discarded as a result).
void
HelloProtocol::onContentValidationFailed(const ndn::shared_ptr<const ndn::Data>& data,
const std::string& msg)
@@ -203,6 +221,9 @@
_LOG_DEBUG("Validation Error: " << msg);
}
+
+ // Asks the FIB to register the supplied adjacency (in other words,
+ // create a Face for it).
void
HelloProtocol::registerPrefixes(const ndn::Name& adjName, const std::string& faceUri,
double linkCost, const ndn::time::milliseconds& timeout)
@@ -215,6 +236,9 @@
this, _1, adjName));
}
+ // After we create a new Face, we need to set it up for use. This
+ // function sets the controlling strategy, registers prefixes in
+ // sync, broadcast, and LSA.
void
HelloProtocol::onRegistrationSuccess(const ndn::nfd::ControlParameters& commandSuccessResult,
const ndn::Name& neighbor,const ndn::time::milliseconds& timeout)
@@ -237,6 +261,7 @@
ndn::nfd::ROUTE_FLAG_CAPTURE, 0);
m_nlsr.setStrategies();
+ // Sends a Hello Interest to determine status before the next scheduled.
/* interest name: /<neighbor>/NLSR/INFO/<router> */
ndn::Name interestName(neighbor);
interestName.append(NLSR_COMPONENT);
diff --git a/src/hello-protocol.hpp b/src/hello-protocol.hpp
index b145f6b..bd88628 100644
--- a/src/hello-protocol.hpp
+++ b/src/hello-protocol.hpp
@@ -42,15 +42,54 @@
{
}
+ /*! \brief Schedules a hello Interest event.
+
+ \param seconds The number of seconds to wait before calling the event.
+ */
void
scheduleInterest(uint32_t seconds);
+ /*! \brief Sends a hello Interest packet.
+
+ \param interestNamePrefix The name of the router that has published the
+ update we want. Here that should be: \<router name\>/NLSR/INFO
+
+ \param seconds The lifetime of the Interest we construct, in seconds
+
+ This function attempts to contact neighboring routers to
+ determine their status (which currently is one of: ACTIVE,
+ INACTIVE, or UNKNOWN)
+ */
void
expressInterest(const ndn::Name& interestNamePrefix, uint32_t seconds);
+ /*! \brief Sends a hello Interest packet that was previously scheduled.
+
+ \param seconds (ignored)
+
+ This function is called as part of a schedule to regularly
+ determine the adjacency status of neighbors. This function checks
+ if the specified neighbor has a Face, and if not creates one. If
+ the neighbor had a Face, it calls \c expressInterest, else it will
+ attempt to create a Face, which will itself attempt to contact the
+ neighbor. Then the function schedules for this function to be invoked again.
+ */
void
sendScheduledInterest(uint32_t seconds);
+ /*! \brief Processes a hello Interest from a neighbor.
+
+ \param name (ignored)
+
+ \param interest The Interest object that we have received and need to
+ process.
+
+ Processes a hello Interest that this router receives from one of
+ its neighbors. If the neighbor that sent the Interest does not
+ have a Face, NLSR will attempt to register one. Also, if the
+ neighbor that sent the Interest was previously marked as INACTIVE,
+ NLSR will attempt to contact it with its own hello Interest.
+ */
void
processInterest(const ndn::Name& name, const ndn::Interest& interest);
diff --git a/src/lsa.cpp b/src/lsa.cpp
index 753ace3..410d56a 100644
--- a/src/lsa.cpp
+++ b/src/lsa.cpp
@@ -248,7 +248,6 @@
return m_adl == alsa.getAdl();
}
-
string
AdjLsa::getData()
{
@@ -311,11 +310,13 @@
return true;
}
-
void
AdjLsa::addNptEntries(Nlsr& pnlsr)
{
+ // Only add NPT entries if this is an adj LSA from another router.
if (getOrigRouter() != pnlsr.getConfParameter().getRouterPrefix()) {
+ // Pass the originating router as both the name to register and
+ // where it came from.
pnlsr.getNamePrefixTable().addEntry(getOrigRouter(), getOrigRouter());
}
}
diff --git a/src/lsa.hpp b/src/lsa.hpp
index 313b781..48a886d 100644
--- a/src/lsa.hpp
+++ b/src/lsa.hpp
@@ -139,12 +139,30 @@
m_npl.remove(name);
}
+ /*! \brief Gets the key for this LSA.
+
+ Format is: \<router name\>/\<LSA type>\
+ */
const ndn::Name
getKey() const;
+ /*! \brief Returns the data that this name LSA has.
+
+ Format is: \<original router
+ prefix\>|name|\<seq. no.\>|\<exp. time\>|\<prefix 1\>|\<prefix
+ 2\>|...|\<prefix n\>|
+ */
std::string
getData();
+ /*! \brief Initializes this LSA object with content's data.
+
+ \param content The data (e.g. name prefixes) to initialize this LSA with.
+
+ This function initializes this object to represent the data
+ contained in content. The format for this is the same as for
+ getData(); getData() returns data of this format, in other words.
+ */
bool
initializeFromContent(const std::string& content);
@@ -187,9 +205,21 @@
const ndn::Name
getKey() const;
+ /*! \brief Returns the data this adjacency LSA has.
+
+ The format is: \<original
+ router\>|adjacency|\<seq. no.\>|\<exp. time\>|\<size\>|\<adjacency prefix
+ 1\>|\<face uri 1\>|\<cost 1\>|...|\<adjacency prefix n\>|\<face uri
+ n\>|\<cost n\>|
+ */
std::string
getData();
+ /*! \brief Initializes this adj. LSA from the supplied content.
+
+ \param content The content that this LSA is to have, formatted
+ according to getData().
+ */
bool
initializeFromContent(const std::string& content);
@@ -202,6 +232,11 @@
bool
isEqualContent(AdjLsa& alsa);
+ /*! \brief Installs this LSA's name prefixes into the NPT.
+
+ \param pnlsr The NLSR top-level whose NPT you want to install the
+ entries into.
+ */
void
addNptEntries(Nlsr& pnlsr);
@@ -249,9 +284,22 @@
const ndn::Name
getKey() const;
+ /*! \brief Returns the data that this coordinate LSA represents.
+
+ The format is: \<original
+ router\>|coordinate|\<seq. no.\>|\<exp. time\>|\<radians\>|\<theta\>|
+ */
std::string
getData();
+ /*! \brief Initializes this coordinate LSA with the data in content.
+
+ \param content The string content that is used to build the LSA.
+
+ This function initializes this LSA object to represent the data
+ specified by the parameter. The format that it is expecting is the
+ same as for getData();
+ */
bool
initializeFromContent(const std::string& content);
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index 1486c2c..162429e 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -134,6 +134,11 @@
m_scheduler.cancelEvent(eid);
}
+ /*! \brief Compares if a name LSA is the same as the one specified by key
+
+ \param nlsa1 A name LSA object
+ \param key A key of an originating router to compare to nlsa1
+ */
static bool
nameLsaCompareByKey(const NameLsa& nlsa1, const ndn::Name& key)
{
@@ -167,7 +172,9 @@
Lsdb::isNameLsaNew(const ndn::Name& key, uint64_t seqNo)
{
NameLsa* nameLsaCheck = findNameLsa(key);
+ // Is the name in the LSDB
if (nameLsaCheck != 0) {
+ // And the supplied seq no is the highest so far
if (nameLsaCheck->getLsSeqNo() < seqNo) {
return true;
}
@@ -191,6 +198,7 @@
{
ndn::time::seconds timeToExpire = m_lsaRefreshTime;
NameLsa* chkNameLsa = findNameLsa(nlsa.getKey());
+ // Determines if the name LSA is new or not.
if (chkNameLsa == 0) {
addNameLsa(nlsa);
_LOG_DEBUG("New Name LSA");
@@ -198,6 +206,8 @@
nlsa.writeLog();
if (nlsa.getOrigRouter() != m_nlsr.getConfParameter().getRouterPrefix()) {
+ // If this name LSA is from another router, add the advertised
+ // prefixes to the NPT.
m_nlsr.getNamePrefixTable().addEntry(nlsa.getOrigRouter(),
nlsa.getOrigRouter());
std::list<ndn::Name> nameList = nlsa.getNpl().getNameList();
@@ -217,6 +227,7 @@
nlsa.getLsSeqNo(),
timeToExpire));
}
+ // Else this is a known name LSA, so we are updating it.
else {
if (chkNameLsa->getLsSeqNo() < nlsa.getLsSeqNo()) {
_LOG_DEBUG("Updated Name LSA. Updating LSDB");
@@ -226,6 +237,8 @@
chkNameLsa->setExpirationTimePoint(nlsa.getExpirationTimePoint());
chkNameLsa->getNpl().sort();
nlsa.getNpl().sort();
+ // Obtain the set difference of the current and the incoming
+ // name prefix sets, and add those.
std::list<ndn::Name> nameToAdd;
std::set_difference(nlsa.getNpl().getNameList().begin(),
nlsa.getNpl().getNameList().end(),
@@ -244,6 +257,7 @@
chkNameLsa->getNpl().sort();
+ // Also remove any names that are no longer being advertised.
std::list<ndn::Name> nameToRemove;
std::set_difference(chkNameLsa->getNpl().getNameList().begin(),
chkNameLsa->getNpl().getNameList().end(),
@@ -298,6 +312,8 @@
if (it != m_nameLsdb.end()) {
_LOG_DEBUG("Deleting Name Lsa");
(*it).writeLog();
+ // If the requested name LSA is not ours, we also need to remove
+ // its entries from the NPT.
if ((*it).getOrigRouter() !=
m_nlsr.getConfParameter().getRouterPrefix()) {
m_nlsr.getNamePrefixTable().removeEntry((*it).getOrigRouter(),
@@ -345,6 +361,10 @@
// Cor LSA and LSDB related Functions start here
+/*! \brief Compares whether an LSA object is the same as a key.
+ \param clsa The cor. LSA to check the identity of.
+ \param key The key of the publishing router to check against.
+*/
static bool
corLsaCompareByKey(const CoordinateLsa& clsa, const ndn::Name& key)
{
@@ -387,7 +407,9 @@
Lsdb::isCoordinateLsaNew(const ndn::Name& key, uint64_t seqNo)
{
CoordinateLsa* clsa = findCoordinateLsa(key);
+ // Is the coordinate LSA in the LSDB already
if (clsa != 0) {
+ // And the seq no is newer (higher) than the current one
if (clsa->getLsSeqNo() < seqNo) {
return true;
}
@@ -398,6 +420,10 @@
return true;
}
+ // Schedules a refresh/expire event in the scheduler.
+ // \param key The name of the router that published the LSA.
+ // \param seqNo the seq. no. associated with the LSA to check.
+ // \param expTime How long to wait before triggering the event.
ndn::EventId
Lsdb::scheduleCoordinateLsaExpiration(const ndn::Name& key, int seqNo,
const ndn::time::seconds& expTime)
@@ -412,6 +438,7 @@
{
ndn::time::seconds timeToExpire = m_lsaRefreshTime;
CoordinateLsa* chkCorLsa = findCoordinateLsa(clsa.getKey());
+ // Checking whether the LSA is new or not.
if (chkCorLsa == 0) {
_LOG_DEBUG("New Coordinate LSA. Adding to LSDB");
_LOG_DEBUG("Adding Coordinate Lsa");
@@ -426,6 +453,7 @@
if (m_nlsr.getConfParameter().getHyperbolicState() != HYPERBOLIC_STATE_OFF) {
m_nlsr.getRoutingTable().scheduleRoutingTableCalculation(m_nlsr);
}
+ // Set the expiration time for the new LSA.
if (clsa.getOrigRouter() != m_nlsr.getConfParameter().getRouterPrefix()) {
ndn::time::system_clock::Duration duration = clsa.getExpirationTimePoint() -
ndn::time::system_clock::now();
@@ -434,6 +462,7 @@
scheduleCoordinateLsaExpiration(clsa.getKey(),
clsa.getLsSeqNo(), timeToExpire);
}
+ // We are just updating this LSA.
else {
if (chkCorLsa->getLsSeqNo() < clsa.getLsSeqNo()) {
_LOG_DEBUG("Updated Coordinate LSA. Updating LSDB");
@@ -441,6 +470,7 @@
chkCorLsa->writeLog();
chkCorLsa->setLsSeqNo(clsa.getLsSeqNo());
chkCorLsa->setExpirationTimePoint(clsa.getExpirationTimePoint());
+ // If the new LSA contains new routing information, update the LSDB with it.
if (!chkCorLsa->isEqualContent(clsa)) {
chkCorLsa->setCorRadius(clsa.getCorRadius());
chkCorLsa->setCorTheta(clsa.getCorTheta());
@@ -448,6 +478,7 @@
m_nlsr.getRoutingTable().scheduleRoutingTableCalculation(m_nlsr);
}
}
+ // If this is an LSA from another router, refresh its expiration time.
if (clsa.getOrigRouter() != m_nlsr.getConfParameter().getRouterPrefix()) {
ndn::time::system_clock::Duration duration = clsa.getExpirationTimePoint() -
ndn::time::system_clock::now();
@@ -530,6 +561,10 @@
// Adj LSA and LSDB related function starts here
+ /*! \brief Returns whether an adj. LSA object is from some router.
+ \param alsa The adj. LSA object.
+ \param key The router name that you want to compare the LSA with.
+ */
static bool
adjLsaCompareByKey(AdjLsa& alsa, const ndn::Name& key)
{
@@ -564,33 +599,45 @@
if (m_nlsr.getAdjacencyList().isAdjLsaBuildable(m_nlsr.getConfParameter().getInterestRetryNumber())) {
int adjBuildCount = m_nlsr.getAdjBuildCount();
-
- // Is the adjacency LSA build still necessary, or has another build
- // fulfilled this request?
+ // Only do the adjLsa build if there's one scheduled
if (adjBuildCount > 0) {
+ // It only makes sense to do the adjLsa build if we have neighbors
if (m_nlsr.getAdjacencyList().getNumOfActiveNeighbor() > 0) {
_LOG_DEBUG("Building and installing own Adj LSA");
buildAndInstallOwnAdjLsa();
}
+ // We have no active neighbors, meaning no one can route through
+ // us. So delete our entry in the LSDB. This prevents this
+ // router from refreshing the LSA, eventually causing other
+ // routers to delete it, too.
else {
_LOG_DEBUG("Removing own Adj LSA; no ACTIVE neighbors")
+ // Get this router's key
ndn::Name key = m_nlsr.getConfParameter().getRouterPrefix();
key.append(AdjLsa::TYPE_STRING);
removeAdjLsa(key);
-
+ // Recompute routing table after removal
m_nlsr.getRoutingTable().scheduleRoutingTableCalculation(m_nlsr);
}
-
- // Since more adjacency LSA builds may have been scheduled while this build
- // was in progress, decrease the build count by the number of scheduled
- // builds at the beginning of this build.
+ // In the case that during building the adj LSA, the FIB has to
+ // wait on an Interest response, the number of scheduled adj LSA
+ // builds could change, so we shouldn't just set it to 0.
m_nlsr.setAdjBuildCount(m_nlsr.getAdjBuildCount() - adjBuildCount);
}
}
+ // We are still waiting to know the adjacency status of some
+ // neighbor, so schedule a build for later (when all that has
+ // hopefully finished)
+ else {
+ m_nlsr.setIsBuildAdjLsaSheduled(true);
+ int schedulingTime = m_nlsr.getConfParameter().getInterestRetryNumber() *
+ m_nlsr.getConfParameter().getInterestResendTime();
+ m_scheduler.scheduleEvent(ndn::time::seconds(schedulingTime),
+ ndn::bind(&Lsdb::buildAdjLsa, this));
+ }
}
-
bool
Lsdb::addAdjLsa(AdjLsa& alsa)
{
@@ -617,12 +664,13 @@
return 0;
}
-
bool
Lsdb::isAdjLsaNew(const ndn::Name& key, uint64_t seqNo)
{
AdjLsa* adjLsaCheck = findAdjLsa(key);
+ // If it is in the LSDB
if (adjLsaCheck != 0) {
+ // And the supplied seq no is newer (higher) than the current one.
if (adjLsaCheck->getLsSeqNo() < seqNo) {
return true;
}
@@ -633,7 +681,6 @@
return true;
}
-
ndn::EventId
Lsdb::scheduleAdjLsaExpiration(const ndn::Name& key, int seqNo,
const ndn::time::seconds& expTime)
@@ -647,11 +694,13 @@
{
ndn::time::seconds timeToExpire = m_lsaRefreshTime;
AdjLsa* chkAdjLsa = findAdjLsa(alsa.getKey());
+ // If this adj. LSA is not in the LSDB already
if (chkAdjLsa == 0) {
_LOG_DEBUG("New Adj LSA. Adding to LSDB");
_LOG_DEBUG("Adding Adj Lsa");
alsa.writeLog();
addAdjLsa(alsa);
+ // Add any new name prefixes to the NPT
alsa.addNptEntries(m_nlsr);
m_nlsr.getRoutingTable().scheduleRoutingTableCalculation(m_nlsr);
if (alsa.getOrigRouter() != m_nlsr.getConfParameter().getRouterPrefix()) {
@@ -669,6 +718,10 @@
chkAdjLsa->writeLog();
chkAdjLsa->setLsSeqNo(alsa.getLsSeqNo());
chkAdjLsa->setExpirationTimePoint(alsa.getExpirationTimePoint());
+ // If the new adj LSA has new content, update the contents of
+ // the LSDB entry. Additionally, since we've changed the
+ // contents of the LSDB, we have to schedule a routing
+ // calculation.
if (!chkAdjLsa->isEqualContent(alsa)) {
chkAdjLsa->getAdl().reset();
chkAdjLsa->getAdl().addAdjacents(alsa.getAdl());
@@ -754,14 +807,23 @@
m_thisRouterPrefix = trp;
}
+ // This function determines whether a name LSA should be refreshed
+ // or expired. The conditions for getting refreshed are: it is still
+ // in the LSDB, it hasn't been updated by something else already (as
+ // evidenced by its seq. no.), and this is the originating router for
+ // the LSA. Is it let expire in all other cases.
+ // lsaKey is the key of the LSA's publishing router.
+ // seqNo is the seq. no. of the candidate LSA.
void
Lsdb::exprireOrRefreshNameLsa(const ndn::Name& lsaKey, uint64_t seqNo)
{
_LOG_DEBUG("Lsdb::exprireOrRefreshNameLsa Called");
_LOG_DEBUG("LSA Key : " << lsaKey << " Seq No: " << seqNo);
NameLsa* chkNameLsa = findNameLsa(lsaKey);
+ // If this name LSA exists in the LSDB
if (chkNameLsa != 0) {
_LOG_DEBUG("LSA Exists with seq no: " << chkNameLsa->getLsSeqNo());
+ // If its seq no is the one we are expecting.
if (chkNameLsa->getLsSeqNo() == seqNo) {
if (chkNameLsa->getOrigRouter() == m_thisRouterPrefix) {
_LOG_DEBUG("Own Name LSA, so refreshing it");
@@ -778,6 +840,7 @@
m_lsaRefreshTime));
m_sync.publishRoutingUpdate();
}
+ // Since we cannot refresh other router's LSAs, our only choice is to expire.
else {
_LOG_DEBUG("Other's Name LSA, so removing form LSDB");
removeNameLsa(lsaKey);
@@ -786,15 +849,25 @@
}
}
+ // This function determines whether an adj. LSA should be refreshed
+ // or expired. The conditions for getting refreshed are: it is still
+ // in the LSDB, it hasn't been updated by something else already (as
+ // evidenced by its seq. no.), and this is the originating router for
+ // the LSA. Is it let expire in all other cases.
+ // lsaKey is the key of the LSA's publishing router.
+ // seqNo is the seq. no. of the candidate LSA.
void
Lsdb::exprireOrRefreshAdjLsa(const ndn::Name& lsaKey, uint64_t seqNo)
{
_LOG_DEBUG("Lsdb::exprireOrRefreshAdjLsa Called");
_LOG_DEBUG("LSA Key : " << lsaKey << " Seq No: " << seqNo);
AdjLsa* chkAdjLsa = findAdjLsa(lsaKey);
+ // If this is a valid LSA
if (chkAdjLsa != 0) {
_LOG_DEBUG("LSA Exists with seq no: " << chkAdjLsa->getLsSeqNo());
+ // And if it hasn't been updated for some other reason
if (chkAdjLsa->getLsSeqNo() == seqNo) {
+ // If it is our own LSA
if (chkAdjLsa->getOrigRouter() == m_thisRouterPrefix) {
_LOG_DEBUG("Own Adj LSA, so refreshing it");
_LOG_DEBUG("Deleting Adj Lsa");
@@ -810,16 +883,25 @@
m_lsaRefreshTime));
m_sync.publishRoutingUpdate();
}
+ // An LSA from another router is expiring
else {
_LOG_DEBUG("Other's Adj LSA, so removing form LSDB");
removeAdjLsa(lsaKey);
}
- // schedule Routing table calculaiton
+ // We have changed the contents of the LSDB, so we have to
+ // schedule a routing calculation
m_nlsr.getRoutingTable().scheduleRoutingTableCalculation(m_nlsr);
}
}
}
+ // This function determines whether an adj. LSA should be refreshed
+ // or expired. The conditions for getting refreshed are: it is still
+ // in the LSDB, it hasn't been updated by something else already (as
+ // evidenced by its seq. no.), and this is the originating router for
+ // the LSA. It is let expire in all other cases.
+ // lsaKey is the key of the LSA's publishing router.
+ // seqNo is the seq. no. of the candidate LSA.
void
Lsdb::exprireOrRefreshCoordinateLsa(const ndn::Name& lsaKey,
uint64_t seqNo)
@@ -827,8 +909,10 @@
_LOG_DEBUG("Lsdb::exprireOrRefreshCorLsa Called ");
_LOG_DEBUG("LSA Key : " << lsaKey << " Seq No: " << seqNo);
CoordinateLsa* chkCorLsa = findCoordinateLsa(lsaKey);
+ // Whether the LSA is in the LSDB or not.
if (chkCorLsa != 0) {
_LOG_DEBUG("LSA Exists with seq no: " << chkCorLsa->getLsSeqNo());
+ // Whether the LSA has been updated without our knowledge.
if (chkCorLsa->getLsSeqNo() == seqNo) {
if (chkCorLsa->getOrigRouter() == m_thisRouterPrefix) {
_LOG_DEBUG("Own Cor LSA, so refreshing it");
@@ -852,6 +936,7 @@
m_sync.publishRoutingUpdate();
}
}
+ // We can't refresh other router's LSAs, so we remove it.
else {
_LOG_DEBUG("Other's Cor LSA, so removing form LSDB");
removeCoordinateLsa(lsaKey);
@@ -870,16 +955,20 @@
if (deadline == DEFAULT_LSA_RETRIEVAL_DEADLINE) {
deadline = steady_clock::now() + ndn::time::seconds(static_cast<int>(LSA_REFRESH_TIME_MAX));
}
-
+ // The first component of the interest is the name.
ndn::Name lsaName = interestName.getSubName(0, interestName.size()-1);
+ // The seq no is the last
uint64_t seqNo = interestName[-1].toNumber();
+ // If the LSA is not found in the list currently.
if (m_highestSeqNo.find(lsaName) == m_highestSeqNo.end()) {
m_highestSeqNo[lsaName] = seqNo;
}
+ // If the new seq no is higher, that means the LSA is valid
else if (seqNo > m_highestSeqNo[lsaName]) {
m_highestSeqNo[lsaName] = seqNo;
}
+ // Otherwise, its an old/invalid LSA
else if (seqNo < m_highestSeqNo[lsaName]) {
return;
}
@@ -906,6 +995,7 @@
if (lsaPosition >= 0) {
+ // Forms the name of the router that the Interest packet came from.
ndn::Name originRouter = m_nlsr.getConfParameter().getNetwork();
originRouter.append(interestName.getSubName(lsaPosition + 1,
interest.getName().size() - lsaPosition - 3));
@@ -915,6 +1005,7 @@
std::string interestedLsType = interestName[-2].toUri();
+ // Passes the Interest off to the appropriate subprocessor
if (interestedLsType == NameLsa::TYPE_STRING) {
processInterestForNameLsa(interest, originRouter.append(interestedLsType), seqNo);
}
@@ -930,6 +1021,9 @@
}
}
+ // \brief Sends LSA data.
+ // \param interest The Interest that warranted the data.
+ // \param content The data that the Interest was seeking.
void
Lsdb::putLsaData(const ndn::Interest& interest, const std::string& content)
{
@@ -941,6 +1035,11 @@
ndn::security::signingByCertificate(m_nlsr.getDefaultCertName()));
}
+ // \brief Finds and sends a requested name LSA.
+ // \param interest The interest that seeks the name LSA.
+ // \param lsaKey The LSA that the Interest is seeking.
+ // \param seqNo A sequence number to ensure that we are sending the
+ // version that was requested.
void
Lsdb::processInterestForNameLsa(const ndn::Interest& interest,
const ndn::Name& lsaKey,
@@ -955,6 +1054,11 @@
}
}
+ // \brief Finds and sends a requested adj. LSA.
+ // \param interest The interest that seeks the adj. LSA.
+ // \param lsaKey The LSA that the Interest is seeking.
+ // \param seqNo A sequence number to ensure that we are sending the
+ // version that was requested.
void
Lsdb::processInterestForAdjacencyLsa(const ndn::Interest& interest,
const ndn::Name& lsaKey,
@@ -973,6 +1077,11 @@
}
}
+ // \brief Finds and sends a requested cor. LSA.
+ // \param interest The interest that seeks the cor. LSA.
+ // \param lsaKey The LSA that the Interest is seeking.
+ // \param seqNo A sequence number to ensure that we are sending the
+ // version that was requested.
void
Lsdb::processInterestForCoordinateLsa(const ndn::Interest& interest,
const ndn::Name& lsaKey,
@@ -1002,6 +1111,7 @@
if (lsaPosition >= 0) {
+ // Extracts the prefix of the originating router from the data.
ndn::Name originRouter = m_nlsr.getConfParameter().getNetwork();
originRouter.append(dataName.getSubName(lsaPosition + 1, dataName.size() - lsaPosition - 3));
diff --git a/src/lsdb.hpp b/src/lsdb.hpp
index 9060ba0..6666558 100644
--- a/src/lsdb.hpp
+++ b/src/lsdb.hpp
@@ -47,19 +47,39 @@
bool
doesLsaExist(const ndn::Name& key, const std::string& lsType);
- // functions related to Name LSDB
+
+ /*! \brief Builds a name LSA for this router and then installs it
+ into the LSDB.
+ */
bool
buildAndInstallOwnNameLsa();
+ /*! \brief Returns the name LSA with the given key.
+ \param key The name of the router that the desired LSA comes from.
+ */
NameLsa*
findNameLsa(const ndn::Name& key);
+ /*! \brief Installs a name LSA into the LSDB
+ \param nlsa The name LSA to install into the LSDB.
+ */
bool
installNameLsa(NameLsa& nlsa);
+ /*! \brief Remove a name LSA from the LSDB.
+ \param key The name of the router that published the LSA to remove.
+
+ This function will remove a name LSA from the LSDB by finding an
+ LSA whose name matches key. This removal also causes the NPT to
+ remove those name prefixes if no more LSAs advertise them.
+ */
bool
removeNameLsa(const ndn::Name& key);
+ /*! Returns whether a seq. no. from a certain router signals a new LSA.
+ \param key The name of the originating router.
+ \param seqNo The sequence number to check.
+ */
bool
isNameLsaNew(const ndn::Name& key, uint64_t seqNo);
@@ -69,19 +89,36 @@
const std::list<NameLsa>&
getNameLsdb();
- // functions related to Cor LSDB
+ /*! \brief Builds a cor. LSA for this router and installs it into the LSDB. */
bool
buildAndInstallOwnCoordinateLsa();
+ /*! \brief Finds a cor. LSA in the LSDB.
+ \param key The name of the originating router that published the LSA.
+ */
CoordinateLsa*
findCoordinateLsa(const ndn::Name& key);
+ /*! \brief Installs a cor. LSA into the LSDB.
+ \param clsa The cor. LSA to install.
+ */
bool
installCoordinateLsa(CoordinateLsa& clsa);
+ /*! \brief Removes a cor. LSA from the LSDB.
+ \param key The name of the router that published the LSA to remove.
+
+ Removes the coordinate LSA whose origin router name matches that
+ given by key. Additionally, ask the NPT to remove the prefix,
+ which will occur if no other LSAs point there.
+ */
bool
removeCoordinateLsa(const ndn::Name& key);
+ /*! \brief Returns whether a cor. LSA from a router is new or not.
+ \param key The name prefix of the originating router.
+ \param seqNo The sequence number of the candidate LSA.
+ */
bool
isCoordinateLsaNew(const ndn::Name& key, uint64_t seqNo);
@@ -91,22 +128,41 @@
const std::list<CoordinateLsa>&
getCoordinateLsdb();
- // functions related to Adj LSDB
+ //function related to Adj LSDB
+
+ /*! \brief Schedules a build of this router's LSA. */
void
scheduleAdjLsaBuild();
+ /*! \brief Wrapper event to build and install an adj. LSA for this router. */
bool
buildAndInstallOwnAdjLsa();
+ /*! \brief Removes an adj. LSA from the LSDB.
+ \param key The name of the publishing router whose LSA to remove.
+ */
bool
removeAdjLsa(const ndn::Name& key);
+ /*! \brief Returns whether an LSA is new.
+ \param key The name of the publishing router.
+ \param seqNo The seq. no. of the candidate LSA.
+
+ This function determines whether the LSA with the name key and
+ seq. no. seqNo would be new to this LSDB.
+ */
bool
isAdjLsaNew(const ndn::Name& key, uint64_t seqNo);
+ /*! \brief Installs an adj. LSA into the LSDB.
+ \param alsa The adj. LSA to add to the LSDB.
+ */
bool
installAdjLsa(AdjLsa& alsa);
+ /*! \brief Finds an adj. LSA in the LSDB.
+ \param key The name of the publishing router whose LSA to find.
+ */
AdjLsa*
findAdjLsa(const ndn::Name& key);
@@ -142,41 +198,80 @@
processInterest(const ndn::Name& name, const ndn::Interest& interest);
private:
+ /* \brief Add a name LSA to the LSDB if it isn't already there.
+ \param nlsa The candidade name LSA.
+ */
bool
addNameLsa(NameLsa& nlsa);
+ /*! \brief Returns whether the LSDB contains some LSA.
+ \param key The name of the publishing router whose LSA to check for.
+ */
bool
doesNameLsaExist(const ndn::Name& key);
-
+ /*! \brief Adds a cor. LSA to the LSDB if it isn't already there.
+ \param clsa The candidate cor. LSA.
+ */
bool
addCoordinateLsa(CoordinateLsa& clsa);
+ /*! \brief Returns whether a cor. LSA is in the LSDB.
+ \param key The name of the router that published the queried LSA.
+ */
bool
doesCoordinateLsaExist(const ndn::Name& key);
+ /*! \brief Attempts to construct an adj. LSA.
+
+ This function will attempt to construct an adjacency LSA. An LSA
+ can only be built when the status of all of the router's neighbors
+ is known. That is, when we are not currently trying to contact any
+ neighbor.
+ */
void
buildAdjLsa();
+ /*! \brief Adds an adj. LSA to the LSDB if it isn't already there.
+ \param alsa The candidate adj. LSA to add to the LSDB.
+ */
bool
addAdjLsa(AdjLsa& alsa);
+ /*! \brief Returns whether the LSDB contains an LSA.
+ \param key The name of a router whose LSA to check for in the LSDB.
+ */
bool
doesAdjLsaExist(const ndn::Name& key);
+ /*! \brief Schedules a refresh/expire event in the scheduler.
+ \param key The name of the router that published the LSA.
+ \param seqNo The seq. no. associated with the LSA.
+ \param expTime How many seconds to wait before triggering the event.
+ */
ndn::EventId
scheduleNameLsaExpiration(const ndn::Name& key, int seqNo,
const seconds& expTime);
+ /*! \brief Either allow to expire, or refresh a name LSA.
+ \param lsaKey The name of the router that published the LSA.
+ \param seqNo The seq. no. of the LSA to check.
+ */
void
exprireOrRefreshNameLsa(const ndn::Name& lsaKey, uint64_t seqNo);
PUBLIC_WITH_TESTS_ELSE_PRIVATE:
+ /*! \brief Schedules an expire/refresh event in the LSA.
+ \param key The name of the router whose LSA is in question.
+ \param seqNo The sequence number of the LSA to check.
+ \param expTime The number of seconds to wait before triggering the event.
+ */
ndn::EventId
scheduleAdjLsaExpiration(const ndn::Name& key, int seqNo,
const seconds& expTime);
private:
+
void
exprireOrRefreshAdjLsa(const ndn::Name& lsaKey, uint64_t seqNo);
@@ -188,6 +283,8 @@
exprireOrRefreshCoordinateLsa(const ndn::Name& lsaKey,
uint64_t seqNo);
+private:
+
void
putLsaData(const ndn::Interest& interest, const std::string& content);
@@ -205,7 +302,6 @@
processInterestForCoordinateLsa(const ndn::Interest& interest,
const ndn::Name& lsaKey,
uint64_t seqNo);
-
void
onContentValidated(const ndn::shared_ptr<const ndn::Data>& data);
@@ -222,19 +318,19 @@
uint64_t lsSeqNo, std::string& dataContent);
PUBLIC_WITH_TESTS_ELSE_PRIVATE:
- /**
- * @brief Error callback when SegmentFetcher fails to return an LSA
- *
- * In all error cases, a reattempt to fetch the LSA will be made.
- *
- * Segment validation can fail either because the packet does not have a
- * valid signature (fatal) or because some of the certificates in the trust chain
- * could not be fetched (non-fatal).
- *
- * Currently, the library does not provide clear indication (besides a plain-text message
- * in the error callback) of the reason for the failure nor the segment that failed
- * to be validated, thus we will continue to try to fetch the LSA until the deadline
- * is reached.
+ /*!
+ \brief Error callback when SegmentFetcher fails to return an LSA
+
+ In all error cases, a reattempt to fetch the LSA will be made.
+
+ Segment validation can fail either because the packet does not have a
+ valid signature (fatal) or because some of the certificates in the trust chain
+ could not be fetched (non-fatal).
+
+ Currently, the library does not provide clear indication (besides a plain-text message
+ in the error callback) of the reason for the failure nor the segment that failed
+ to be validated, thus we will continue to try to fetch the LSA until the deadline
+ is reached.
*/
void
onFetchLsaError(uint32_t errorCode,
@@ -245,11 +341,11 @@
ndn::Name lsaName,
uint64_t seqNo);
- /**
- * @brief Success callback when SegmentFetcher returns a valid LSA
- *
- * \param The base Interest used to fetch the LSA in the format:
- * /<network>/NLSR/LSA/<site>/%C1.Router/<router>/<lsa-type>/<seqNo>
+ /*!
+ \brief Success callback when SegmentFetcher returns a valid LSA
+
+ \param The base Interest used to fetch the LSA in the format:
+ /<network>/NLSR/LSA/<site>/%C1.Router/<router>/<lsa-type>/<seqNo>
*/
void
afterFetchLsa(const ndn::ConstBufferPtr& data, ndn::Name& interestName);
@@ -258,6 +354,7 @@
system_clock::TimePoint
getLsaExpirationTimePoint();
+ /*! \brief Cancels an event in the event scheduler. */
void
cancelScheduleLsaExpiringEvent(ndn::EventId eid);
diff --git a/src/name-prefix-list.hpp b/src/name-prefix-list.hpp
index 02445af..a4e71f0 100644
--- a/src/name-prefix-list.hpp
+++ b/src/name-prefix-list.hpp
@@ -37,14 +37,16 @@
~NamePrefixList();
- /** \brief inserts name into NamePrefixList
- * \return true if the name is inserted, otherwise false
+ /*! \brief inserts name into NamePrefixList
+ \retval true If the name was successfully inserted.
+ \retval false If the name could not be inserted.
*/
bool
insert(const ndn::Name& name);
- /** \brief removes name from NamePrefixList
- * \return true if the name is removed, otherwise false
+ /*! \brief removes name from NamePrefixList
+ \retval true If the name is removed
+ \retval false If the name failed to be removed.
*/
bool
remove(const ndn::Name& name);
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index d5c0038..faf6f70 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -361,18 +361,21 @@
adjacent->setFaceId(0);
- // Only trigger an Adjacency LSA build if this node is changing from ACTIVE to INACTIVE
- // since this rebuild will effectively cancel the previous Adjacency LSA refresh event
- // and schedule a new one further in the future.
+ // Only trigger an Adjacency LSA build if this node is changing
+ // from ACTIVE to INACTIVE since this rebuild will effectively
+ // cancel the previous Adjacency LSA refresh event and schedule
+ // a new one further in the future.
//
- // Continuously scheduling the refresh in the future will block the router from refreshing
- // its Adjacency LSA. Since other routers' Name prefixes' expiration times are updated
- // when this router refreshes its Adjacency LSA, the other routers' prefixes will expire
- // and be removed from the RIB.
+ // Continuously scheduling the refresh in the future will block
+ // the router from refreshing its Adjacency LSA. Since other
+ // routers' Name prefixes' expiration times are updated when
+ // this router refreshes its Adjacency LSA, the other routers'
+ // prefixes will expire and be removed from the RIB.
//
- // This check is required to fix Bug #2733 for now. This check would be unnecessary
- // to fix Bug #2733 when Issue #2732 is completed, but the check also helps with
- // optimization so it can remain even when Issue #2732 is implemented.
+ // This check is required to fix Bug #2733 for now. This check
+ // would be unnecessary to fix Bug #2733 when Issue #2732 is
+ // completed, but the check also helps with optimization so it
+ // can remain even when Issue #2732 is implemented.
if (adjacent->getStatus() == Adjacent::STATUS_ACTIVE) {
adjacent->setStatus(Adjacent::STATUS_INACTIVE);
diff --git a/src/publisher/lsa-publisher.cpp b/src/publisher/lsa-publisher.cpp
index bdeac6d..0574a41 100644
--- a/src/publisher/lsa-publisher.cpp
+++ b/src/publisher/lsa-publisher.cpp
@@ -78,6 +78,7 @@
{
}
+ // Returns the list of coordinate LSAs represented by this object.
std::list<tlv::CoordinateLsa>
CoordinateLsaPublisher::getTlvLsas()
{
@@ -113,6 +114,8 @@
{
}
+ // Returns the list of name LSAs represented by this object.
+ // Note: each name LSA has a list of prefixes as well.
std::list<tlv::NameLsa>
NameLsaPublisher::getTlvLsas()
{
diff --git a/src/publisher/lsa-publisher.hpp b/src/publisher/lsa-publisher.hpp
index aa9d2c6..bd2d830 100644
--- a/src/publisher/lsa-publisher.hpp
+++ b/src/publisher/lsa-publisher.hpp
@@ -63,10 +63,11 @@
getTlvLsas() = 0;
};
-/**
- * @brief Abstraction to publish adjacency lsa dataset
- * \sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
- */
+ /*! \brief Class to publish adjacency lsa dataset
+
+ \sa https://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+
+ */
class AdjacencyLsaPublisher : public LsaPublisher<tlv::AdjacencyLsa>
{
public:
@@ -74,6 +75,7 @@
ndn::Face& face,
ndn::KeyChain& keyChain);
+ /*! \brief Returns the adj. LSAs represented by this object. */
std::list<tlv::AdjacencyLsa>
getTlvLsas();
@@ -84,10 +86,9 @@
const std::list<AdjLsa>& m_adjacencyLsas;
};
-/**
- * @brief Abstraction to publish coordinate lsa dataset
- * \sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
- */
+ /*! \brief Class to publish coordinate lsa dataset
+ \sa https://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+ */
class CoordinateLsaPublisher : public LsaPublisher<tlv::CoordinateLsa>
{
public:
@@ -95,6 +96,7 @@
ndn::Face& face,
ndn::KeyChain& keyChain);
+ /*! \brief Returns the cor. LSAs represented by this object. */
std::list<tlv::CoordinateLsa>
getTlvLsas();
@@ -105,17 +107,16 @@
const std::list<CoordinateLsa>& m_coordinateLsas;
};
-/**
- * @brief Abstraction to publish name lsa dataset
- * \sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
- */
+ /*! \brief Class to publish name lsa dataset
+ \sa https://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+ */
class NameLsaPublisher : public LsaPublisher<tlv::NameLsa>
{
public:
NameLsaPublisher(Lsdb& lsdb,
ndn::Face& face,
ndn::KeyChain& keyChain);
-
+ /*! \brief Returns the name LSAs represented by this object. */
std::list<tlv::NameLsa>
getTlvLsas();
diff --git a/src/publisher/lsdb-dataset-interest-handler.cpp b/src/publisher/lsdb-dataset-interest-handler.cpp
index 715e1d9..3d4519c 100644
--- a/src/publisher/lsdb-dataset-interest-handler.cpp
+++ b/src/publisher/lsdb-dataset-interest-handler.cpp
@@ -19,6 +19,13 @@
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
+/*! \file lsdb-dataset-interest-handler.cpp
+
+ This file details a class that is used by NLSRC and other command-line
+ tools to examine the state of NLSR. This system is not designed to
+ be used by routers to publish data to each other.
+ */
+
#include "lsdb-dataset-interest-handler.hpp"
#include "logger.hpp"
@@ -92,7 +99,6 @@
{
size_t commandSize = interest.getName().size();
- // Does the Interest match the command prefix with one additional component?
return (commandSize == commandPrefix.size() + 1 && commandPrefix.isPrefixOf(interest.getName()));
}
diff --git a/src/publisher/lsdb-dataset-interest-handler.hpp b/src/publisher/lsdb-dataset-interest-handler.hpp
index 5311f26..e354bf3 100644
--- a/src/publisher/lsdb-dataset-interest-handler.hpp
+++ b/src/publisher/lsdb-dataset-interest-handler.hpp
@@ -29,9 +29,9 @@
namespace nlsr {
-/**
- * @brief Abstraction to publish all lsa dataset
- * \sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+/*!
+ \brief Class to publish all lsa dataset
+ \sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
*/
class LsdbDatasetInterestHandler
{
diff --git a/src/publisher/lsdb-status-publisher.hpp b/src/publisher/lsdb-status-publisher.hpp
index fb91188..8ec84dd 100644
--- a/src/publisher/lsdb-status-publisher.hpp
+++ b/src/publisher/lsdb-status-publisher.hpp
@@ -30,9 +30,9 @@
namespace nlsr {
-/**
- * @brief Abstraction to publish lsdb status dataset
- * \sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+/*!
+ \brief Publishes lsdb status dataset
+ \sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
*/
class LsdbStatusPublisher : public SegmentPublisher<ndn::Face>
{
diff --git a/src/publisher/segment-publisher.hpp b/src/publisher/segment-publisher.hpp
index d420b45..f2e72b7 100644
--- a/src/publisher/segment-publisher.hpp
+++ b/src/publisher/segment-publisher.hpp
@@ -31,8 +31,8 @@
namespace nlsr {
-/** \brief provides a publisher of Status Dataset or other segmented octet stream
- * \sa http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
+/*! \brief provides a publisher of Status Dataset or other segmented octet stream
+ \sa http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
*/
template <class FaceBase>
class SegmentPublisher : ndn::noncopyable
@@ -65,7 +65,7 @@
return ndn::time::milliseconds(1000);
}
- /** \brief Publish data under provided prefix
+ /*! \brief Publish data under provided prefix
*/
void
publish(const ndn::Name& prefix,
@@ -106,7 +106,7 @@
}
protected:
- /** \brief In a derived class, write the octets into outBuffer.
+ /*! \brief In a derived class, write the octets into outBuffer.
*/
virtual size_t
generate(ndn::EncodingBuffer& outBuffer) = 0;
diff --git a/src/route/map.hpp b/src/route/map.hpp
index a37f1ac..b9729fc 100644
--- a/src/route/map.hpp
+++ b/src/route/map.hpp
@@ -43,7 +43,12 @@
{
}
+ /*! \brief Add a map entry to this map.
+ \param rtrName The name of the router.
+ Adds a router to this map. Each entry is also given an arbitrary,
+ ascending mappingNo (mapping number).
+ */
void
addEntry(const ndn::Name& rtrName);
diff --git a/src/route/name-prefix-table-entry.cpp b/src/route/name-prefix-table-entry.cpp
index 1236777..a9682ef 100644
--- a/src/route/name-prefix-table-entry.cpp
+++ b/src/route/name-prefix-table-entry.cpp
@@ -33,9 +33,11 @@
NamePrefixTableEntry::generateNhlfromRteList()
{
m_nexthopList.reset();
+ // For every routing table entry associated with this name prefix
for (std::list<RoutingTableEntry>::iterator it = m_rteList.begin();
it != m_rteList.end(); ++it)
{
+ // Add every next hop from each routing table entry to this entry's NHL.
for (std::list<NextHop>::iterator nhit =
(*it).getNexthopList().getNextHops().begin();
nhit != (*it).getNexthopList().getNextHops().end(); ++nhit)
diff --git a/src/route/name-prefix-table-entry.hpp b/src/route/name-prefix-table-entry.hpp
index a3428dd..ddae8ce 100644
--- a/src/route/name-prefix-table-entry.hpp
+++ b/src/route/name-prefix-table-entry.hpp
@@ -77,12 +77,20 @@
return m_nexthopList;
}
+ /*! \brief Generates a next-hop list from routing table entries. */
void
generateNhlfromRteList();
void
removeRoutingTableEntry(RoutingTableEntry& rte);
+ /*! \brief Adds a routing table entry to this object's list.
+ \param rte The routing table entry.
+
+ Adds a routing table entry to this NPT entry's list. (reminder:
+ each RTE has a next-hop list) They are used to calculate this
+ entry's next-hop list.
+ */
void
addRoutingTableEntry(RoutingTableEntry& rte);
diff --git a/src/route/name-prefix-table.cpp b/src/route/name-prefix-table.cpp
index 0add13e..e5199b0 100644
--- a/src/route/name-prefix-table.cpp
+++ b/src/route/name-prefix-table.cpp
@@ -42,21 +42,22 @@
void
NamePrefixTable::addEntry(const ndn::Name& name, RoutingTableEntry& rte)
{
+ // Check if the advertised name prefix is in the table already.
NptEntryList::iterator it = std::find_if(m_table.begin(),
m_table.end(),
bind(&npteCompare, _1, name));
+ // If not, create a new entry and add it.
if (it == m_table.end()) {
_LOG_TRACE("Adding origin: " << rte.getDestination() << " to new name prefix: " << name);
NamePrefixTableEntry entry(name);
+ entry.addRoutingTableEntry(rte); // Add this RTE to this new NPT entry.
+ entry.generateNhlfromRteList(); // Generate a list of next-hops from the RTE.
+ entry.getNexthopList().sort(); // Sort it.
- entry.addRoutingTableEntry(rte);
+ m_table.push_back(entry); // Add the new, completed entry into the main table.
- entry.generateNhlfromRteList();
- entry.getNexthopList().sort();
-
- m_table.push_back(entry);
-
+ // If the RTE we added has any next hops, we inform the FIB of this.
if (rte.getNexthopList().getSize() > 0) {
_LOG_TRACE("Updating FIB with next hops for " << entry);
m_nlsr.getFib().update(name, entry.getNexthopList());
@@ -64,22 +65,26 @@
}
else {
_LOG_TRACE("Adding origin: " << rte.getDestination() << " to existing prefix: " << *it);
-
+ // Update the existing entry with the new RTE.
it->addRoutingTableEntry(rte);
- it->generateNhlfromRteList();
- it->getNexthopList().sort();
+ it->generateNhlfromRteList(); // Rebuild the list of next-hops
+ it->getNexthopList().sort(); // Sort it.
+ // As above, inform the FIB of this fact.
+ // We may possibly have a new best next-hop for this name prefix
+ // So this is a necessary step.
if (it->getNexthopList().getSize() > 0) {
_LOG_TRACE("Updating FIB with next hops for " << *it);
m_nlsr.getFib().update(name, it->getNexthopList());
}
else {
- // The routing table may recalculate and add a routing table entry with no next hops to
- // replace an existing routing table entry. In this case, the name prefix is no longer
- // reachable through a next hop and should be removed from the FIB. But, the prefix
- // should remain in the Name Prefix Table as a future routing table calculation may
- // add next hops.
+ // The routing table may recalculate and add a routing table
+ // entry with no next hops to replace an existing routing table
+ // entry. In this case, the name prefix is no longer reachable
+ // through a next hop and should be removed from the FIB. But,
+ // the prefix should remain in the Name Prefix Table as a future
+ // routing table calculation may add next hops.
_LOG_TRACE(*it << " has no next hops; removing from FIB");
m_nlsr.getFib().remove(name);
}
@@ -162,7 +167,9 @@
_LOG_DEBUG("Updating table with newly calculated routes");
// Update each name prefix entry in the Name Prefix Table with newly calculated next hops
+ // For each entry in the NPT
for (const NamePrefixTableEntry& prefixEntry : m_table) {
+ // For each routing table entry
for (const RoutingTableEntry& routingEntry : prefixEntry.getRteList()) {
_LOG_TRACE("Updating next hops to origin: " << routingEntry.getDestination()
<< " for prefix: " << prefixEntry);
@@ -170,6 +177,7 @@
RoutingTableEntry* rteCheck =
m_nlsr.getRoutingTable().findRoutingTableEntry(routingEntry.getDestination());
+ // If there is a routing table entry for this prefix, update the NPT with it.
if (rteCheck != nullptr) {
addEntry(prefixEntry.getNamePrefix(), *rteCheck);
}
diff --git a/src/route/name-prefix-table.hpp b/src/route/name-prefix-table.hpp
index 985f91e..d8a3bc1 100644
--- a/src/route/name-prefix-table.hpp
+++ b/src/route/name-prefix-table.hpp
@@ -42,6 +42,20 @@
{
}
+ /*! \brief Adds an entry to the NPT.
+ \param name The name prefix that is being advertised.
+ \param destRouter The destination router that is advertising the prefix.
+
+ Adds a destination router to the name prefix. If there isn't
+ currently an entry present for the prefix, one is made and
+ added. If there is no routing table entry available for the
+ destination router, a placeholder routing table entry without next
+ hops will be made. Since this function can be called when a
+ routing table entry has been updated to have no hops (i.e. is
+ unreachable), this function will check for the number of next hops
+ an entry has. If it is found to have no next hops, the NPT will
+ inform the FIB to remove that prefix.
+ */
void
addEntry(const ndn::Name& name, const ndn::Name& destRouter);
@@ -61,6 +75,11 @@
end() const;
private:
+ /*! \brief Adds an entry to the NPT table.
+ \param name The name prefix to add to the table.
+ \param rte The routing table entry with the next hop information to
+ reach the prefix.
+ */
void
addEntry(const ndn::Name& name, RoutingTableEntry& rte);
diff --git a/src/route/nexthop-list.cpp b/src/route/nexthop-list.cpp
index dc11113..ed46b55 100644
--- a/src/route/nexthop-list.cpp
+++ b/src/route/nexthop-list.cpp
@@ -59,7 +59,7 @@
}
}
-/**
+/*!
Add next hop to the Next Hop list
If next hop is new it is added
If next hop already exists in next
@@ -82,7 +82,7 @@
}
}
-/**
+/*!
Remove a next hop only if both next hop face and route cost are same
*/
diff --git a/src/route/nexthop-list.hpp b/src/route/nexthop-list.hpp
index be0c144..0c57ba3 100644
--- a/src/route/nexthop-list.hpp
+++ b/src/route/nexthop-list.hpp
@@ -45,9 +45,22 @@
{
}
+
+ /*! \brief Adds a next hop to the list.
+ \param nh The next hop.
+
+ Add next hop to the Next Hop list If next hop is new it is added
+ If next hop already exists in next hop list then updates the route
+ cost with new next hop's route cost
+ */
void
addNextHop(NextHop& nh);
+ /*! \brief Removes a next hop.
+ \param nh The next hop.
+
+ Remove a next hop only if both next hop face and route cost are same.
+ */
void
removeNextHop(NextHop& nh);
diff --git a/src/route/nexthop.hpp b/src/route/nexthop.hpp
index 72435cd..8c5ffd1 100644
--- a/src/route/nexthop.hpp
+++ b/src/route/nexthop.hpp
@@ -103,15 +103,15 @@
bool m_isHyperbolic;
PUBLIC_WITH_TESTS_ELSE_PRIVATE:
- /** \brief Used to adjust floating point route costs to integers
- * Since NFD uses integer route costs in the FIB, hyperbolic paths with similar route costs
- * will be rounded to integers and installed with identical nexthop costs.
- *
- * e.g. costs 12.34 and 12.35 will be equal in NFD's FIB
- *
- * This multiplier is used to differentiate similar route costs in the FIB.
- *
- * e.g costs 12.34 and 12.35 will be installed into NFD's FIB as 12340 and 12350
+ /*! \brief Used to adjust floating point route costs to integers
+ Since NFD uses integer route costs in the FIB, hyperbolic paths with similar route costs
+ will be rounded to integers and installed with identical nexthop costs.
+
+ e.g. costs 12.34 and 12.35 will be equal in NFD's FIB
+
+ This multiplier is used to differentiate similar route costs in the FIB.
+
+ e.g costs 12.34 and 12.35 will be installed into NFD's FIB as 12340 and 12350
*/
static const uint64_t HYPERBOLIC_COST_ADJUSTMENT_FACTOR = 1000;
};
diff --git a/src/route/routing-table-calculator.cpp b/src/route/routing-table-calculator.cpp
index ccc6114..b3a66b3 100644
--- a/src/route/routing-table-calculator.cpp
+++ b/src/route/routing-table-calculator.cpp
@@ -60,11 +60,14 @@
RoutingTableCalculator::makeAdjMatrix(Nlsr& pnlsr, Map pMap)
{
std::list<AdjLsa> adjLsdb = pnlsr.getLsdb().getAdjLsdb();
+ // For each LSA represented in the map
for (std::list<AdjLsa>::iterator it = adjLsdb.begin(); it != adjLsdb.end() ; it++) {
+
int32_t row = pMap.getMappingNoByRouterName((*it).getOrigRouter());
std::list<Adjacent> adl = (*it).getAdl().getAdjList();
+ // For each adjacency represented in the LSA
for (std::list<Adjacent>::iterator itAdl = adl.begin(); itAdl != adl.end() ; itAdl++) {
int32_t col = pMap.getMappingNoByRouterName((*itAdl).getName());
@@ -78,14 +81,17 @@
}
}
- // Links that do not have the same cost for both directions should have their
- // costs corrected:
+ // Links that do not have the same cost for both directions should
+ // have their costs corrected:
//
- // If the cost of one side of the link is 0, both sides of the link should have their cost
- // corrected to 0.
+ // If the cost of one side of the link is 0, both sides of the
+ // link should have their cost corrected to 0.
//
// Otherwise, both sides of the link should use the larger of the two costs.
//
+ // Additionally, this means that we can halve the amount of space
+ // that the matrix uses by only maintaining a triangle.
+ // - But that is not yet implemented.
for (size_t row = 0; row < m_nRouters; ++row) {
for (size_t col = 0; col < m_nRouters; ++col) {
double toCost = adjMatrix[row][col];
@@ -173,7 +179,6 @@
delete [] adjMatrix;
}
-
void
RoutingTableCalculator::allocateLinks()
{
@@ -208,12 +213,12 @@
makeAdjMatrix(pnlsr, pMap);
writeAdjMatrixLog();
int sourceRouter = pMap.getMappingNoByRouterName(pnlsr.getConfParameter().getRouterPrefix());
- allocateParent();
- allocateDistance();
+ allocateParent(); // These two matrices are used in Dijkstra's algorithm.
+ allocateDistance(); //
if (pnlsr.getConfParameter().getMaxFacesPerPrefix() == 1) {
- // Single Path
+ // In the single path case we can simply run Dijkstra's algorithm.
doDijkstraPathCalculation(sourceRouter);
- // update routing table
+ // Inform the routing table of the new next hops.
addAllLsNextHopsToRoutingTable(pnlsr, rt, pMap, sourceRouter);
}
else {
@@ -221,12 +226,15 @@
setNoLink(getNumOfLinkfromAdjMatrix(sourceRouter));
allocateLinks();
allocateLinkCosts();
+ // Gets a sparse listing of adjacencies for path calculation
getLinksFromAdjMatrix(links, linkCosts, sourceRouter);
for (int i = 0 ; i < vNoLink; i++) {
+ // Simulate that only the current neighbor is accessible
adjustAdMatrix(sourceRouter, links[i], linkCosts[i]);
writeAdjMatrixLog();
+ // Do Dijkstra's algorithm using the current neighbor as your start.
doDijkstraPathCalculation(sourceRouter);
- //update routing table
+ // Update the routing table with the calculations.
addAllLsNextHopsToRoutingTable(pnlsr, rt, pMap, sourceRouter);
}
freeLinks();
@@ -242,32 +250,44 @@
{
int i;
int v, u;
- int* Q = new int[m_nRouters];
+ int* Q = new int[m_nRouters]; // Each cell represents the router with that mapping no.
int head = 0;
/* Initiate the Parent */
for (i = 0 ; i < static_cast<int>(m_nRouters); i++) {
m_parent[i] = EMPTY_PARENT;
+ // Array where the ith element is the distance to the router with mapping no i.
m_distance[i] = INF_DISTANCE;
Q[i] = i;
}
if (sourceRouter != NO_MAPPING_NUM) {
+ // Distance to source from source is always 0.
m_distance[sourceRouter] = 0;
sortQueueByDistance(Q, m_distance, head, m_nRouters);
+ // While we haven't visited every node.
while (head < static_cast<int>(m_nRouters)) {
- u = Q[head];
+ u = Q[head]; // Set u to be the current node pointed to by head.
if (m_distance[u] == INF_DISTANCE) {
- break;
+ break; // This can only happen when there are no accessible nodes.
}
+ // Iterate over the adjacent nodes to u.
for (v = 0 ; v < static_cast<int>(m_nRouters); v++) {
+ // If the current node is accessible.
if (adjMatrix[u][v] > 0) {
+ // And we haven't visited it yet.
if (isNotExplored(Q, v, head + 1, m_nRouters)) {
+ // And if the distance to this node + from this node to v
+ // is less than the distance from our source node to v
+ // that we got when we built the adj LSAs
if (m_distance[u] + adjMatrix[u][v] < m_distance[v]) {
+ // Set the new distance
m_distance[v] = m_distance[u] + adjMatrix[u][v] ;
+ // Set how we get there.
m_parent[v] = u;
}
}
}
}
+ // Increment the head position, resort the list by distance from where we are.
head++;
sortQueueByDistance(Q, m_distance, head, m_nRouters);
}
@@ -283,14 +303,19 @@
int nextHopRouter = 0;
+ // For each router we have
for (size_t i = 0; i < m_nRouters ; i++) {
if (i != sourceRouter) {
+ // Obtain the next hop that was determined by the algorithm
nextHopRouter = getLsNextHop(i, sourceRouter);
+ // If this router is accessible at all
if (nextHopRouter != NO_NEXT_HOP) {
+ // Fetch its distance
double routeCost = m_distance[i];
+ // Fetch its actual name
ndn::Name nextHopRouterName = pMap.getRouterNameByMappingNo(nextHopRouter);
std::string nextHopFace =
pnlsr.getAdjacencyList().getAdjacent(nextHopRouterName).getConnectingFaceUri();
diff --git a/src/route/routing-table-calculator.hpp b/src/route/routing-table-calculator.hpp
index 4ee683e..bfeeb87 100644
--- a/src/route/routing-table-calculator.hpp
+++ b/src/route/routing-table-calculator.hpp
@@ -46,30 +46,56 @@
m_nRouters = nRouters;
}
protected:
+ /*! \brief Allocate the space needed for the adj. matrix. */
void
allocateAdjMatrix();
+ /*! \brief Zero every cell of the matrix to ensure that the memory is safe. */
void
initMatrix();
+ /*! \brief Constructs an adj. matrix to calculate with.
+ \param pnlsr The NLSR object that contains the LSAs that we need to iterate
+ over.
+ \param pMap The map to populate with the adj. data.
+ */
void
makeAdjMatrix(Nlsr& pnlsr, Map pMap);
void
writeAdjMatrixLog();
+ /*! \brief Returns how many links a router in the matrix has.
+ \param sRouter The router to count the links of.
+ */
int
getNumOfLinkfromAdjMatrix(int sRouter);
void
freeAdjMatrix();
-
+ /*! \brief Adjust a link cost in the adj. matrix
+ \param source The source router whose adjacency to adjust.
+ \param link The adjacency of the source to adjust.
+ \param linkCost The cost to change to.
+ */
void
adjustAdMatrix(int source, int link, double linkCost);
+ /*! \brief Populates temp. variables with the link costs for some router.
+ \param source The router whose values are to be adjusted.
+ \param links An integer pointer array for the link mappingNos.
+ \param linkCosts A double pointer array that stores the link costs.
+
+ Obtains a sparse list of adjacencies and link costs for some
+ router. Since this is sparse, that means while generating these
+ arrays, if there is no adjacency at i in the matrix, these
+ temporary variables will not contain a 0 at i, but rather will
+ contain the values for the next valid adjacency.
+ */
void
getLinksFromAdjMatrix(int* links, double* linkCosts, int source);
+ /*! Allocates an array large enough to hold multipath calculation temps. */
void
allocateLinks();
@@ -113,12 +139,30 @@
calculatePath(Map& pMap, RoutingTable& rt, Nlsr& pnlsr);
private:
+ /*! \brief Performs a Dijkstra's calculation over the adjacency matrix.
+ \param sourceRouter The origin router to compute paths from.
+ */
void
doDijkstraPathCalculation(int sourceRouter);
+ /*! \brief Sort the elements of a list.
+ \param Q The array that contains the elements to sort.
+ \param dist The array that contains the distances.
+ \param start The first element in the list to sort.
+ \param element The last element in the list to sort through.
+
+ Sorts the list based on distance. The distances are indexed by
+ their mappingNo in dist. Currently uses an insertion sort.
+ */
void
sortQueueByDistance(int* Q, double* dist, int start, int element);
+ /*! \brief Returns whether an element has been visited yet.
+ \param Q The list of elements to look through.
+ \param u The element to check.
+ \param start The start of list to look through.
+ \param element The end of the list to look through.
+ */
int
isNotExplored(int* Q, int u, int start, int element);
@@ -126,6 +170,10 @@
addAllLsNextHopsToRoutingTable(Nlsr& pnlsr, RoutingTable& rt,
Map& pMap, uint32_t sourceRouter);
+ /*! \brief Determines a destination's next hop.
+ \param dest The router whose next hop we want to determine.
+ \param source The router to determine a next path to.
+ */
int
getLsNextHop(int dest, int source);
diff --git a/src/route/routing-table.cpp b/src/route/routing-table.cpp
index 9d45f2e..b610722 100644
--- a/src/route/routing-table.cpp
+++ b/src/route/routing-table.cpp
@@ -84,7 +84,7 @@
if (pnlsr.getConfParameter().getHyperbolicState() == HYPERBOLIC_STATE_DRY_RUN) {
calculateHypDryRoutingTable(pnlsr);
}
- //need to update NPT here
+ // Inform the NPT that updates have been made
_LOG_DEBUG("Calling Update NPT With new Route");
pnlsr.getNamePrefixTable().updateWithNewRoute();
writeLog(pnlsr.getConfParameter().getHyperbolicState());
@@ -117,7 +117,6 @@
}
}
-
void
RoutingTable::calculateLsRoutingTable(Nlsr& nlsr)
{
@@ -185,7 +184,6 @@
return rte.getDestination() == destRouter;
}
-// function related to manipulation of routing table
void
RoutingTable::addNextHop(const ndn::Name& destRouter, NextHop& nh)
{
@@ -237,7 +235,6 @@
}
}
-//function related to manipulation of dry routing table
void
RoutingTable::addNextHopToDryTable(const ndn::Name& destRouter, NextHop& nh)
{
@@ -274,4 +271,3 @@
}
} // namespace nlsr
-
diff --git a/src/route/routing-table.hpp b/src/route/routing-table.hpp
index 1fd8049..c8c0c52 100644
--- a/src/route/routing-table.hpp
+++ b/src/route/routing-table.hpp
@@ -47,18 +47,34 @@
{
}
+ /*! \brief Calculates a list of next hops for each router in the network.
+ \param pnlsr The NLSR object that contains the LSAs needed for adj. info.
+
+ Calculates the list of next hops to every other router in the network.
+ */
void
calculate(Nlsr& pnlsr);
+ /*! \brief Adds a next hop to a routing table entry.
+ \param destRouter The destination router whose RTE we want to modify.
+ \param nh The next hop to add to the RTE.
+ */
void
addNextHop(const ndn::Name& destRouter, NextHop& nh);
+ /*! \brief Adds a next hop to a routing table entry in a dry run scenario.
+ \param destRouter The destination router whose RTE we want to modify.
+ \param nh The next hop to add to the router.
+ */
void
addNextHopToDryTable(const ndn::Name& destRouter, NextHop& nh);
RoutingTableEntry*
findRoutingTableEntry(const ndn::Name& destRouter);
+ /*! \brief Schedules a calculation event in the event scheduler.
+ \param pnlsr The NLSR whose scheduling status is needed.
+ */
void
scheduleRoutingTableCalculation(Nlsr& pnlsr);
@@ -81,12 +97,15 @@
}
private:
+ /*! \brief Calculates a link-state routing table. */
void
calculateLsRoutingTable(Nlsr& pnlsr);
+ /*! \brief Calculates a HR routing table. */
void
calculateHypRoutingTable(Nlsr& pnlsr);
+ /*! \brief Calculates a dry-run HR routing table. */
void
calculateHypDryRoutingTable(Nlsr& pnlsr);
diff --git a/src/tlv/adjacency-lsa.hpp b/src/tlv/adjacency-lsa.hpp
index d9c5a73..6ba7d9d 100644
--- a/src/tlv/adjacency-lsa.hpp
+++ b/src/tlv/adjacency-lsa.hpp
@@ -34,16 +34,16 @@
#include <list>
namespace nlsr {
-namespace tlv {
+namespace tlv {
-/**
- * @brief Data abstraction for AdjacencyLsa
- *
- * AdjacencyLsa := ADJACENCY-LSA-TYPE TLV-LENGTH
- * LsaInfo
- * Adjacency*
- *
- * @sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+/*!
+ \brief Data abstraction for AdjacencyLsa
+
+ AdjacencyLsa := ADJACENCY-LSA-TYPE TLV-LENGTH
+ LsaInfo
+ Adjacency*
+
+ \sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
*/
class AdjacencyLsa
{
diff --git a/src/tlv/adjacency.hpp b/src/tlv/adjacency.hpp
index bf36627..62e6380 100644
--- a/src/tlv/adjacency.hpp
+++ b/src/tlv/adjacency.hpp
@@ -29,17 +29,17 @@
#include <ndn-cxx/name.hpp>
namespace nlsr {
-namespace tlv {
+namespace tlv {
-/**
- * @brief Data abstraction for Adjacency
- *
- * Adjacency := ADJACENCY-TYPE TLV-LENGTH
- * Name
- * Uri
- * Cost
- *
- * @sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+/*!
+ \brief Data abstraction for Adjacency
+
+ Adjacency := ADJACENCY-TYPE TLV-LENGTH
+ Name
+ Uri
+ Cost
+
+ \sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
*/
class Adjacency
{
diff --git a/src/tlv/coordinate-lsa.hpp b/src/tlv/coordinate-lsa.hpp
index 16bf5aa..f1d8a97 100644
--- a/src/tlv/coordinate-lsa.hpp
+++ b/src/tlv/coordinate-lsa.hpp
@@ -31,17 +31,17 @@
#include <ndn-cxx/name.hpp>
namespace nlsr {
-namespace tlv {
+namespace tlv {
-/**
- * @brief Data abstraction for CoordinateLsa
- *
- * CoordinateLsa := COORDINATE-LSA-TYPE TLV-LENGTH
- * LsaInfo
- * HyperbolicRadius
- * HyperbolicAngle
- *
- * @sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+/*!
+ \brief Data abstraction for CoordinateLsa
+
+ CoordinateLsa := COORDINATE-LSA-TYPE TLV-LENGTH
+ LsaInfo
+ HyperbolicRadius
+ HyperbolicAngle
+
+ \sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
*/
class CoordinateLsa
{
diff --git a/src/tlv/lsa-info.hpp b/src/tlv/lsa-info.hpp
index 86e33a3..4ea3d67 100644
--- a/src/tlv/lsa-info.hpp
+++ b/src/tlv/lsa-info.hpp
@@ -31,17 +31,17 @@
#include "lsa.hpp"
namespace nlsr {
-namespace tlv {
+namespace tlv {
-/**
- * @brief Data abstraction for LsaInfo
- *
- * LsaInfo := LSA-TYPE TLV-LENGTH
- * OriginRouter
- * SequenceNumber
- * ExpirationPeriod?
- *
- * @sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+/*!
+ \brief Data abstraction for LsaInfo
+
+ LsaInfo := LSA-TYPE TLV-LENGTH
+ OriginRouter
+ SequenceNumber
+ ExpirationPeriod?
+
+ \sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
*/
class LsaInfo
{
diff --git a/src/tlv/lsdb-status.hpp b/src/tlv/lsdb-status.hpp
index 43aa57d..c911cfd 100644
--- a/src/tlv/lsdb-status.hpp
+++ b/src/tlv/lsdb-status.hpp
@@ -35,17 +35,17 @@
#include <list>
namespace nlsr {
-namespace tlv {
+namespace tlv {
-/**
- * @brief Data abstraction for LsdbStatus
- *
- * LsdbStatus := LSDB-STATUS-TYPE TLV-LENGTH
- * AdjacencyLsa*
- * CoordinateLsa*
- * NameLsa*
- *
- * @sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+/*!
+ \brief Data abstraction for LsdbStatus
+
+ LsdbStatus := LSDB-STATUS-TYPE TLV-LENGTH
+ AdjacencyLsa*
+ CoordinateLsa*
+ NameLsa*
+
+ \sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
*/
class LsdbStatus
{
diff --git a/src/tlv/name-lsa.hpp b/src/tlv/name-lsa.hpp
index dcfd861..2273abb 100644
--- a/src/tlv/name-lsa.hpp
+++ b/src/tlv/name-lsa.hpp
@@ -33,16 +33,16 @@
#include <list>
namespace nlsr {
-namespace tlv {
+namespace tlv {
-/**
- * @brief Data abstraction for NameLsa
- *
- * NameLsa := NAME-LSA-TYPE TLV-LENGTH
- * LsaInfo
- * Name+
- *
- * @sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+/*!
+ \brief Data abstraction for NameLsa
+
+ NameLsa := NAME-LSA-TYPE TLV-LENGTH
+ LsaInfo
+ Name+
+
+ \sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
*/
class NameLsa
{
diff --git a/src/update/prefix-update-processor.hpp b/src/update/prefix-update-processor.hpp
index f316586..79e8070 100644
--- a/src/update/prefix-update-processor.hpp
+++ b/src/update/prefix-update-processor.hpp
@@ -43,7 +43,7 @@
namespace security {
class CertificateStore;
-}
+} // namespace security
namespace update {
@@ -96,13 +96,13 @@
uint32_t code,
const std::string& text);
- /** \brief adds desired name prefix to the advertised name prefix list
+ /*! \brief adds desired name prefix to the advertised name prefix list
*/
void
advertise(const std::shared_ptr<const ndn::Interest>& request,
const ndn::nfd::ControlParameters& parameters);
- /** \brief removes desired name prefix from the advertised name prefix list
+ /*! \brief removes desired name prefix from the advertised name prefix list
*/
void
withdraw(const std::shared_ptr<const ndn::Interest>& request,
diff --git a/src/utility/name-helper.hpp b/src/utility/name-helper.hpp
index c876f6a..768ca7a 100644
--- a/src/utility/name-helper.hpp
+++ b/src/utility/name-helper.hpp
@@ -33,12 +33,12 @@
namespace nlsr {
namespace util {
-/**
- * @brief search a name component in ndn::Name and return the position of the component
- * @param name where to search the searchString
- * @param searchString the string to search in name
- * @return -1 if searchString not found else return the position
- * starting from 0
+/*!
+ \brief search a name component in ndn::Name and return the position of the component
+ \param name where to search the searchString
+ \param searchString the string to search in name
+ \return -1 if searchString not found else return the position
+ starting from 0
*/
inline static int32_t
getNameComponentPosition(const ndn::Name& name, const std::string& searchString)