akmhoque | 3d06e79 | 2014-05-27 16:23:20 -0500 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 3 | * Copyright (c) 2014-2019, The University of Memphis, |
Nick Gordon | f8b5bcd | 2016-08-11 15:06:50 -0500 | [diff] [blame] | 4 | * Regents of the University of California |
akmhoque | 3d06e79 | 2014-05-27 16:23:20 -0500 | [diff] [blame] | 5 | * |
| 6 | * This file is part of NLSR (Named-data Link State Routing). |
| 7 | * See AUTHORS.md for complete list of NLSR authors and contributors. |
| 8 | * |
| 9 | * NLSR is free software: you can redistribute it and/or modify it under the terms |
| 10 | * of the GNU General Public License as published by the Free Software Foundation, |
| 11 | * either version 3 of the License, or (at your option) any later version. |
| 12 | * |
| 13 | * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 14 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 15 | * PURPOSE. See the GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along with |
| 18 | * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
akmhoque | 3d06e79 | 2014-05-27 16:23:20 -0500 | [diff] [blame] | 19 | **/ |
Nick Gordon | d0a7df3 | 2017-05-30 16:44:34 -0500 | [diff] [blame] | 20 | #include "hello-protocol.hpp" |
Junxiao Shi | 63bd034 | 2016-08-17 16:57:14 +0000 | [diff] [blame] | 21 | |
Alejandro Gil Torres | e0d2048 | 2016-03-06 23:56:19 -0600 | [diff] [blame] | 22 | #include "hello-protocol.hpp" |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 23 | #include "nlsr.hpp" |
| 24 | #include "lsdb.hpp" |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 25 | #include "utility/name-helper.hpp" |
akmhoque | 674b0b1 | 2014-05-20 14:33:28 -0500 | [diff] [blame] | 26 | #include "logger.hpp" |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 27 | |
| 28 | namespace nlsr { |
| 29 | |
dmcoomes | cf8d0ed | 2017-02-21 11:39:01 -0600 | [diff] [blame] | 30 | INIT_LOGGER(HelloProtocol); |
akmhoque | 674b0b1 | 2014-05-20 14:33:28 -0500 | [diff] [blame] | 31 | |
akmhoque | 93f1a07 | 2014-06-19 16:24:28 -0500 | [diff] [blame] | 32 | const std::string HelloProtocol::INFO_COMPONENT = "INFO"; |
Ashlesh Gawande | cba0ae2 | 2018-03-27 17:57:56 -0500 | [diff] [blame] | 33 | const std::string HelloProtocol::NLSR_COMPONENT = "nlsr"; |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 34 | |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 35 | HelloProtocol::HelloProtocol(ndn::Face& face, ndn::KeyChain& keyChain, |
| 36 | ndn::security::SigningInfo& signingInfo, |
| 37 | ConfParameter& confParam, RoutingTable& routingTable, |
| 38 | Lsdb& lsdb) |
| 39 | : m_face(face) |
| 40 | , m_scheduler(m_face.getIoService()) |
| 41 | , m_keyChain(keyChain) |
| 42 | , m_signingInfo(signingInfo) |
| 43 | , m_confParam(confParam) |
| 44 | , m_routingTable(routingTable) |
| 45 | , m_lsdb(lsdb) |
Nick Gordon | e18296c | 2017-10-11 16:05:24 -0500 | [diff] [blame] | 46 | { |
| 47 | } |
| 48 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 49 | void |
| 50 | HelloProtocol::expressInterest(const ndn::Name& interestName, uint32_t seconds) |
| 51 | { |
dmcoomes | 5bcb39e | 2017-10-31 15:07:55 -0500 | [diff] [blame] | 52 | NLSR_LOG_DEBUG("Expressing Interest :" << interestName); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 53 | ndn::Interest interest(interestName); |
| 54 | interest.setInterestLifetime(ndn::time::seconds(seconds)); |
| 55 | interest.setMustBeFresh(true); |
| 56 | interest.setCanBePrefix(true); |
| 57 | m_face.expressInterest(interest, |
| 58 | std::bind(&HelloProtocol::onContent, this, _1, _2), |
| 59 | [this] (const ndn::Interest& interest, const ndn::lp::Nack& nack) |
| 60 | { |
| 61 | NDN_LOG_TRACE("Received Nack with reason " << nack.getReason()); |
| 62 | NDN_LOG_TRACE("Treating as timeout"); |
| 63 | processInterestTimedOut(interest); |
| 64 | }, |
| 65 | std::bind(&HelloProtocol::processInterestTimedOut, this, _1)); |
Alejandro Gil Torres | e0d2048 | 2016-03-06 23:56:19 -0600 | [diff] [blame] | 66 | |
| 67 | // increment SENT_HELLO_INTEREST |
| 68 | hpIncrementSignal(Statistics::PacketType::SENT_HELLO_INTEREST); |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | void |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 72 | HelloProtocol::sendScheduledInterest() |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 73 | { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 74 | for (const auto& adjacent : m_confParam.getAdjacencyList().getAdjList()) { |
Nick G | 97e3494 | 2016-07-11 14:46:27 -0500 | [diff] [blame] | 75 | // If this adjacency has a Face, just proceed as usual. |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 76 | if(adjacent.getFaceId() != 0) { |
dmcoomes | 9f93666 | 2017-03-02 10:33:09 -0600 | [diff] [blame] | 77 | // interest name: /<neighbor>/NLSR/INFO/<router> |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 78 | ndn::Name interestName = adjacent.getName() ; |
akmhoque | c04e727 | 2014-07-02 11:00:14 -0500 | [diff] [blame] | 79 | interestName.append(NLSR_COMPONENT); |
| 80 | interestName.append(INFO_COMPONENT); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 81 | interestName.append(m_confParam.getRouterPrefix().wireEncode()); |
| 82 | expressInterest(interestName, m_confParam.getInterestResendTime()); |
dmcoomes | 5bcb39e | 2017-10-31 15:07:55 -0500 | [diff] [blame] | 83 | NLSR_LOG_DEBUG("Sending scheduled interest: " << interestName); |
akmhoque | c04e727 | 2014-07-02 11:00:14 -0500 | [diff] [blame] | 84 | } |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 85 | } |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 86 | scheduleInterest(m_confParam.getInfoInterestInterval()); |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | void |
| 90 | HelloProtocol::scheduleInterest(uint32_t seconds) |
| 91 | { |
dmcoomes | 5bcb39e | 2017-10-31 15:07:55 -0500 | [diff] [blame] | 92 | NLSR_LOG_DEBUG("Scheduling HELLO Interests in " << ndn::time::seconds(seconds)); |
Vince Lehman | 50df6b7 | 2015-03-03 12:06:40 -0600 | [diff] [blame] | 93 | |
Vince Lehman | 7c60329 | 2014-09-11 17:48:16 -0500 | [diff] [blame] | 94 | m_scheduler.scheduleEvent(ndn::time::seconds(seconds), |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 95 | [this] { |
| 96 | sendScheduledInterest(); |
| 97 | }); |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 98 | } |
| 99 | |
| 100 | void |
| 101 | HelloProtocol::processInterest(const ndn::Name& name, |
| 102 | const ndn::Interest& interest) |
| 103 | { |
dmcoomes | 9f93666 | 2017-03-02 10:33:09 -0600 | [diff] [blame] | 104 | // interest name: /<neighbor>/NLSR/INFO/<router> |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 105 | const ndn::Name interestName = interest.getName(); |
Alejandro Gil Torres | e0d2048 | 2016-03-06 23:56:19 -0600 | [diff] [blame] | 106 | |
| 107 | // increment RCV_HELLO_INTEREST |
| 108 | hpIncrementSignal(Statistics::PacketType::RCV_HELLO_INTEREST); |
| 109 | |
dmcoomes | 5bcb39e | 2017-10-31 15:07:55 -0500 | [diff] [blame] | 110 | NLSR_LOG_DEBUG("Interest Received for Name: " << interestName); |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 111 | if (interestName.get(-2).toUri() != INFO_COMPONENT) { |
dmcoomes | 5bcb39e | 2017-10-31 15:07:55 -0500 | [diff] [blame] | 112 | NLSR_LOG_DEBUG("INFO_COMPONENT not found or interestName: " << interestName |
dmcoomes | 9eaf3f4 | 2017-02-21 11:39:01 -0600 | [diff] [blame] | 113 | << " does not match expression"); |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 114 | return; |
| 115 | } |
Alejandro Gil Torres | e0d2048 | 2016-03-06 23:56:19 -0600 | [diff] [blame] | 116 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 117 | ndn::Name neighbor; |
| 118 | neighbor.wireDecode(interestName.get(-1).blockFromValue()); |
dmcoomes | 5bcb39e | 2017-10-31 15:07:55 -0500 | [diff] [blame] | 119 | NLSR_LOG_DEBUG("Neighbor: " << neighbor); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 120 | if (m_confParam.getAdjacencyList().isNeighbor(neighbor)) { |
dmcoomes | 9f93666 | 2017-03-02 10:33:09 -0600 | [diff] [blame] | 121 | std::shared_ptr<ndn::Data> data = std::make_shared<ndn::Data>(); |
akmhoque | 69c9aa9 | 2014-07-23 15:15:05 -0500 | [diff] [blame] | 122 | data->setName(ndn::Name(interest.getName()).appendVersion()); |
| 123 | data->setFreshnessPeriod(ndn::time::seconds(10)); // 10 sec |
| 124 | data->setContent(reinterpret_cast<const uint8_t*>(INFO_COMPONENT.c_str()), |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 125 | INFO_COMPONENT.size()); |
Muktadir Chowdhury | f04f989 | 2017-08-20 20:42:56 -0500 | [diff] [blame] | 126 | |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 127 | m_keyChain.sign(*data, m_signingInfo); |
Muktadir Chowdhury | f04f989 | 2017-08-20 20:42:56 -0500 | [diff] [blame] | 128 | |
dmcoomes | 5bcb39e | 2017-10-31 15:07:55 -0500 | [diff] [blame] | 129 | NLSR_LOG_DEBUG("Sending out data for name: " << interest.getName()); |
Muktadir Chowdhury | f04f989 | 2017-08-20 20:42:56 -0500 | [diff] [blame] | 130 | |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 131 | m_face.put(*data); |
Alejandro Gil Torres | e0d2048 | 2016-03-06 23:56:19 -0600 | [diff] [blame] | 132 | // increment SENT_HELLO_DATA |
| 133 | hpIncrementSignal(Statistics::PacketType::SENT_HELLO_DATA); |
Nick Gordon | c780a69 | 2017-04-27 18:03:02 -0500 | [diff] [blame] | 134 | |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 135 | auto adjacent = m_confParam.getAdjacencyList().findAdjacent(neighbor); |
Nick G | 97e3494 | 2016-07-11 14:46:27 -0500 | [diff] [blame] | 136 | // If this neighbor was previously inactive, send our own hello interest, too |
Vince Lehman | cb76ade | 2014-08-28 21:24:41 -0500 | [diff] [blame] | 137 | if (adjacent->getStatus() == Adjacent::STATUS_INACTIVE) { |
Nick G | 97e3494 | 2016-07-11 14:46:27 -0500 | [diff] [blame] | 138 | // We can only do that if the neighbor currently has a face. |
akmhoque | c04e727 | 2014-07-02 11:00:14 -0500 | [diff] [blame] | 139 | if(adjacent->getFaceId() != 0){ |
dmcoomes | 9f93666 | 2017-03-02 10:33:09 -0600 | [diff] [blame] | 140 | // interest name: /<neighbor>/NLSR/INFO/<router> |
akmhoque | c04e727 | 2014-07-02 11:00:14 -0500 | [diff] [blame] | 141 | ndn::Name interestName(neighbor); |
| 142 | interestName.append(NLSR_COMPONENT); |
| 143 | interestName.append(INFO_COMPONENT); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 144 | interestName.append(m_confParam.getRouterPrefix().wireEncode()); |
| 145 | expressInterest(interestName, m_confParam.getInterestResendTime()); |
akmhoque | c04e727 | 2014-07-02 11:00:14 -0500 | [diff] [blame] | 146 | } |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 147 | } |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | void |
| 152 | HelloProtocol::processInterestTimedOut(const ndn::Interest& interest) |
| 153 | { |
dmcoomes | 9f93666 | 2017-03-02 10:33:09 -0600 | [diff] [blame] | 154 | // interest name: /<neighbor>/NLSR/INFO/<router> |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 155 | const ndn::Name interestName(interest.getName()); |
dmcoomes | 5bcb39e | 2017-10-31 15:07:55 -0500 | [diff] [blame] | 156 | NLSR_LOG_DEBUG("Interest timed out for Name: " << interestName); |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 157 | if (interestName.get(-2).toUri() != INFO_COMPONENT) { |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 158 | return; |
| 159 | } |
akmhoque | 93f1a07 | 2014-06-19 16:24:28 -0500 | [diff] [blame] | 160 | ndn::Name neighbor = interestName.getPrefix(-3); |
dmcoomes | 5bcb39e | 2017-10-31 15:07:55 -0500 | [diff] [blame] | 161 | NLSR_LOG_DEBUG("Neighbor: " << neighbor); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 162 | m_confParam.getAdjacencyList().incrementTimedOutInterestCount(neighbor); |
Vince Lehman | cb76ade | 2014-08-28 21:24:41 -0500 | [diff] [blame] | 163 | |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 164 | Adjacent::Status status = m_confParam.getAdjacencyList().getStatusOfNeighbor(neighbor); |
Vince Lehman | cb76ade | 2014-08-28 21:24:41 -0500 | [diff] [blame] | 165 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 166 | uint32_t infoIntTimedOutCount = |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 167 | m_confParam.getAdjacencyList().getTimedOutInterestCount(neighbor); |
dmcoomes | 5bcb39e | 2017-10-31 15:07:55 -0500 | [diff] [blame] | 168 | NLSR_LOG_DEBUG("Status: " << status); |
| 169 | NLSR_LOG_DEBUG("Info Interest Timed out: " << infoIntTimedOutCount); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 170 | if (infoIntTimedOutCount < m_confParam.getInterestRetryNumber()) { |
dmcoomes | 9f93666 | 2017-03-02 10:33:09 -0600 | [diff] [blame] | 171 | // interest name: /<neighbor>/NLSR/INFO/<router> |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 172 | ndn::Name interestName(neighbor); |
akmhoque | 93f1a07 | 2014-06-19 16:24:28 -0500 | [diff] [blame] | 173 | interestName.append(NLSR_COMPONENT); |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 174 | interestName.append(INFO_COMPONENT); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 175 | interestName.append(m_confParam.getRouterPrefix().wireEncode()); |
dmcoomes | 5bcb39e | 2017-10-31 15:07:55 -0500 | [diff] [blame] | 176 | NLSR_LOG_DEBUG("Resending interest: " << interestName); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 177 | expressInterest(interestName, m_confParam.getInterestResendTime()); |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 178 | } |
Vince Lehman | cb76ade | 2014-08-28 21:24:41 -0500 | [diff] [blame] | 179 | else if ((status == Adjacent::STATUS_ACTIVE) && |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 180 | (infoIntTimedOutCount == m_confParam.getInterestRetryNumber())) { |
| 181 | m_confParam.getAdjacencyList().setStatusOfNeighbor(neighbor, Adjacent::STATUS_INACTIVE); |
Vince Lehman | 50df6b7 | 2015-03-03 12:06:40 -0600 | [diff] [blame] | 182 | |
dmcoomes | 5bcb39e | 2017-10-31 15:07:55 -0500 | [diff] [blame] | 183 | NLSR_LOG_DEBUG("Neighbor: " << neighbor << " status changed to INACTIVE"); |
dmcoomes | 9eaf3f4 | 2017-02-21 11:39:01 -0600 | [diff] [blame] | 184 | |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 185 | m_lsdb.scheduleAdjLsaBuild(); |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 186 | } |
| 187 | } |
| 188 | |
Nick G | 97e3494 | 2016-07-11 14:46:27 -0500 | [diff] [blame] | 189 | // This is the first function that incoming Hello data will |
| 190 | // see. This checks if the data appears to be signed, and passes it |
| 191 | // on to validate the content of the data. |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 192 | void |
| 193 | HelloProtocol::onContent(const ndn::Interest& interest, const ndn::Data& data) |
| 194 | { |
dmcoomes | 5bcb39e | 2017-10-31 15:07:55 -0500 | [diff] [blame] | 195 | NLSR_LOG_DEBUG("Received data for INFO(name): " << data.getName()); |
akmhoque | dfe615f | 2014-07-27 14:12:21 -0500 | [diff] [blame] | 196 | if (data.getSignature().hasKeyLocator()) { |
| 197 | if (data.getSignature().getKeyLocator().getType() == ndn::KeyLocator::KeyLocator_Name) { |
dmcoomes | 5bcb39e | 2017-10-31 15:07:55 -0500 | [diff] [blame] | 198 | NLSR_LOG_DEBUG("Data signed with: " << data.getSignature().getKeyLocator().getName()); |
akmhoque | dfe615f | 2014-07-27 14:12:21 -0500 | [diff] [blame] | 199 | } |
| 200 | } |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 201 | m_confParam.getValidator().validate(data, |
| 202 | std::bind(&HelloProtocol::onContentValidated, this, _1), |
| 203 | std::bind(&HelloProtocol::onContentValidationFailed, |
| 204 | this, _1, _2)); |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 205 | } |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 206 | |
| 207 | void |
Muktadir Chowdhury | f04f989 | 2017-08-20 20:42:56 -0500 | [diff] [blame] | 208 | HelloProtocol::onContentValidated(const ndn::Data& data) |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 209 | { |
dmcoomes | 9f93666 | 2017-03-02 10:33:09 -0600 | [diff] [blame] | 210 | // data name: /<neighbor>/NLSR/INFO/<router>/<version> |
Muktadir Chowdhury | f04f989 | 2017-08-20 20:42:56 -0500 | [diff] [blame] | 211 | ndn::Name dataName = data.getName(); |
dmcoomes | 5bcb39e | 2017-10-31 15:07:55 -0500 | [diff] [blame] | 212 | NLSR_LOG_DEBUG("Data validation successful for INFO(name): " << dataName); |
Muktadir Chowdhury | f04f989 | 2017-08-20 20:42:56 -0500 | [diff] [blame] | 213 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 214 | if (dataName.get(-3).toUri() == INFO_COMPONENT) { |
akmhoque | 93f1a07 | 2014-06-19 16:24:28 -0500 | [diff] [blame] | 215 | ndn::Name neighbor = dataName.getPrefix(-4); |
Vince Lehman | cb76ade | 2014-08-28 21:24:41 -0500 | [diff] [blame] | 216 | |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 217 | Adjacent::Status oldStatus = m_confParam.getAdjacencyList().getStatusOfNeighbor(neighbor); |
| 218 | m_confParam.getAdjacencyList().setStatusOfNeighbor(neighbor, Adjacent::STATUS_ACTIVE); |
| 219 | m_confParam.getAdjacencyList().setTimedOutInterestCount(neighbor, 0); |
| 220 | Adjacent::Status newStatus = m_confParam.getAdjacencyList().getStatusOfNeighbor(neighbor); |
Vince Lehman | cb76ade | 2014-08-28 21:24:41 -0500 | [diff] [blame] | 221 | |
dmcoomes | 5bcb39e | 2017-10-31 15:07:55 -0500 | [diff] [blame] | 222 | NLSR_LOG_DEBUG("Neighbor : " << neighbor); |
| 223 | NLSR_LOG_DEBUG("Old Status: " << oldStatus << " New Status: " << newStatus); |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 224 | // change in Adjacency list |
| 225 | if ((oldStatus - newStatus) != 0) { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 226 | if (m_confParam.getHyperbolicState() == HYPERBOLIC_STATE_ON) { |
| 227 | m_routingTable.scheduleRoutingTableCalculation(); |
Ashlesh Gawande | c5fa320 | 2016-12-05 13:21:51 -0600 | [diff] [blame] | 228 | } |
| 229 | else { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 230 | m_lsdb.scheduleAdjLsaBuild(); |
Ashlesh Gawande | c5fa320 | 2016-12-05 13:21:51 -0600 | [diff] [blame] | 231 | } |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 232 | } |
| 233 | } |
Alejandro Gil Torres | e0d2048 | 2016-03-06 23:56:19 -0600 | [diff] [blame] | 234 | // increment RCV_HELLO_DATA |
| 235 | hpIncrementSignal(Statistics::PacketType::RCV_HELLO_DATA); |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 236 | } |
| 237 | |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 238 | void |
Muktadir Chowdhury | f04f989 | 2017-08-20 20:42:56 -0500 | [diff] [blame] | 239 | HelloProtocol::onContentValidationFailed(const ndn::Data& data, |
| 240 | const ndn::security::v2::ValidationError& ve) |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 241 | { |
Muktadir Chowdhury | f04f989 | 2017-08-20 20:42:56 -0500 | [diff] [blame] | 242 | NLSR_LOG_DEBUG("Validation Error: " << ve); |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 243 | } |
| 244 | |
Nick Gordon | fad8e25 | 2016-08-11 14:21:38 -0500 | [diff] [blame] | 245 | } // namespace nlsr |