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