src: Change adjacency status from uint32_t to enum
refs: #1946
Change-Id: Ic1abd2610061860d0ac183074395a1d3796e870a
diff --git a/src/hello-protocol.cpp b/src/hello-protocol.cpp
index 98ab9cd..764c7d3 100644
--- a/src/hello-protocol.cpp
+++ b/src/hello-protocol.cpp
@@ -102,7 +102,7 @@
_LOG_DEBUG("Sending out data for name: " << interest.getName());
m_nlsr.getNlsrFace().put(*data);
Adjacent *adjacent = m_nlsr.getAdjacencyList().findAdjacent(neighbor);
- if (adjacent->getStatus() == 0) {
+ if (adjacent->getStatus() == Adjacent::STATUS_INACTIVE) {
if(adjacent->getFaceId() != 0){
/* interest name: /<neighbor>/NLSR/INFO/<router> */
ndn::Name interestName(neighbor);
@@ -132,7 +132,9 @@
ndn::Name neighbor = interestName.getPrefix(-3);
_LOG_DEBUG("Neighbor: " << neighbor);
m_nlsr.getAdjacencyList().incrementTimedOutInterestCount(neighbor);
- int status = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
+
+ Adjacent::Status status = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
+
uint32_t infoIntTimedOutCount =
m_nlsr.getAdjacencyList().getTimedOutInterestCount(neighbor);
_LOG_DEBUG("Status: " << status);
@@ -146,9 +148,9 @@
expressInterest(interestName,
m_nlsr.getConfParameter().getInterestResendTime());
}
- else if ((status == 1) &&
+ else if ((status == Adjacent::STATUS_ACTIVE) &&
(infoIntTimedOutCount == m_nlsr.getConfParameter().getInterestRetryNumber())) {
- m_nlsr.getAdjacencyList().setStatusOfNeighbor(neighbor, 0);
+ m_nlsr.getAdjacencyList().setStatusOfNeighbor(neighbor, Adjacent::STATUS_INACTIVE);
m_nlsr.incrementAdjBuildCount();
if (m_nlsr.getIsBuildAdjLsaSheduled() == false) {
_LOG_DEBUG("Scheduling scheduledAdjLsaBuild");
@@ -184,10 +186,12 @@
_LOG_DEBUG("Data validation successful for INFO(name): " << dataName);
if (dataName.get(-3).toUri() == INFO_COMPONENT) {
ndn::Name neighbor = dataName.getPrefix(-4);
- int oldStatus = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
- m_nlsr.getAdjacencyList().setStatusOfNeighbor(neighbor, 1);
+
+ Adjacent::Status oldStatus = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
+ m_nlsr.getAdjacencyList().setStatusOfNeighbor(neighbor, Adjacent::STATUS_ACTIVE);
m_nlsr.getAdjacencyList().setTimedOutInterestCount(neighbor, 0);
- int newStatus = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
+ Adjacent::Status newStatus = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
+
_LOG_DEBUG("Neighbor : " << neighbor);
_LOG_DEBUG("Old Status: " << oldStatus << " New Status: " << newStatus);
// change in Adjacency list
@@ -272,12 +276,12 @@
Adjacent *adjacent = m_nlsr.getAdjacencyList().findAdjacent(name);
if (adjacent != 0) {
adjacent->setInterestTimedOutNo(adjacent->getInterestTimedOutNo() + 1);
- int status = adjacent->getStatus();
+ Adjacent::Status status = adjacent->getStatus();
uint32_t infoIntTimedOutCount = adjacent->getInterestTimedOutNo();
if (infoIntTimedOutCount == m_nlsr.getConfParameter().getInterestRetryNumber()) {
- if ( status == 1) {
- adjacent->setStatus(0);
+ if (status == Adjacent::STATUS_ACTIVE) {
+ adjacent->setStatus(Adjacent::STATUS_INACTIVE);
}
m_nlsr.incrementAdjBuildCount();
if (m_nlsr.getIsBuildAdjLsaSheduled() == false) {