Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Vince | 12e4946 | 2014-06-09 13:29:32 -0500 | [diff] [blame] | 3 | * Copyright (c) 2014, Regents of the University of California, |
| 4 | * Arizona Board of Regents, |
| 5 | * Colorado State University, |
| 6 | * University Pierre & Marie Curie, Sorbonne University, |
| 7 | * Washington University in St. Louis, |
| 8 | * Beijing Institute of Technology, |
| 9 | * The University of Memphis |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 10 | * |
| 11 | * This file is part of NFD (Named Data Networking Forwarding Daemon). |
| 12 | * See AUTHORS.md for complete list of NFD authors and contributors. |
| 13 | * |
| 14 | * NFD is free software: you can redistribute it and/or modify it under the terms |
| 15 | * of the GNU General Public License as published by the Free Software Foundation, |
| 16 | * either version 3 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 19 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 20 | * PURPOSE. See the GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License along with |
| 23 | * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
Vince | 12e4946 | 2014-06-09 13:29:32 -0500 | [diff] [blame] | 24 | */ |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 25 | |
| 26 | #include "rib-manager.hpp" |
Alexander Afanasyev | 03ea3eb | 2014-04-17 18:19:06 -0700 | [diff] [blame] | 27 | #include "core/global-io.hpp" |
Alexander Afanasyev | 89cf5e0 | 2014-04-17 12:08:57 -0700 | [diff] [blame] | 28 | #include "core/logger.hpp" |
Alexander Afanasyev | 63108c4 | 2014-07-07 19:10:47 -0700 | [diff] [blame] | 29 | #include "core/scheduler.hpp" |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 30 | |
| 31 | namespace nfd { |
| 32 | namespace rib { |
| 33 | |
Alexander Afanasyev | 89cf5e0 | 2014-04-17 12:08:57 -0700 | [diff] [blame] | 34 | NFD_LOG_INIT("RibManager"); |
| 35 | |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 36 | const Name RibManager::COMMAND_PREFIX = "/localhost/nfd/rib"; |
| 37 | const Name RibManager::REMOTE_COMMAND_PREFIX = "/localhop/nfd/rib"; |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 38 | |
| 39 | const size_t RibManager::COMMAND_UNSIGNED_NCOMPS = |
| 40 | RibManager::COMMAND_PREFIX.size() + |
| 41 | 1 + // verb |
| 42 | 1; // verb options |
| 43 | |
| 44 | const size_t RibManager::COMMAND_SIGNED_NCOMPS = |
| 45 | RibManager::COMMAND_UNSIGNED_NCOMPS + |
| 46 | 4; // (timestamp, nonce, signed info tlv, signature tlv) |
| 47 | |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 48 | const RibManager::SignedVerbAndProcessor RibManager::SIGNED_COMMAND_VERBS[] = |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 49 | { |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 50 | SignedVerbAndProcessor( |
| 51 | Name::Component("register"), |
| 52 | &RibManager::registerEntry |
| 53 | ), |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 54 | |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 55 | SignedVerbAndProcessor( |
| 56 | Name::Component("unregister"), |
| 57 | &RibManager::unregisterEntry |
| 58 | ), |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 61 | const RibManager::UnsignedVerbAndProcessor RibManager::UNSIGNED_COMMAND_VERBS[] = |
| 62 | { |
| 63 | UnsignedVerbAndProcessor( |
| 64 | Name::Component("list"), |
| 65 | &RibManager::listEntries |
| 66 | ), |
| 67 | }; |
| 68 | |
| 69 | const Name RibManager::LIST_COMMAND_PREFIX("/localhost/nfd/rib/list"); |
| 70 | const size_t RibManager::LIST_COMMAND_NCOMPS = LIST_COMMAND_PREFIX.size(); |
| 71 | |
Vince Lehman | 72446ec | 2014-07-09 10:50:02 -0500 | [diff] [blame] | 72 | RibManager::RibManager(ndn::Face& face) |
| 73 | : m_face(face) |
Alexander Afanasyev | b3893c9 | 2014-05-15 01:49:54 -0700 | [diff] [blame] | 74 | , m_nfdController(m_face) |
Yingdi Yu | e5224e9 | 2014-04-29 18:04:02 -0700 | [diff] [blame] | 75 | , m_localhostValidator(m_face) |
| 76 | , m_localhopValidator(m_face) |
Yingdi Yu | f4db0b5 | 2014-04-17 13:17:39 -0700 | [diff] [blame] | 77 | , m_faceMonitor(m_face) |
Yingdi Yu | e5224e9 | 2014-04-29 18:04:02 -0700 | [diff] [blame] | 78 | , m_isLocalhopEnabled(false) |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 79 | , m_ribStatusPublisher(m_managedRib, face, LIST_COMMAND_PREFIX, m_keyChain) |
Vince Lehman | 4387e78 | 2014-06-19 16:57:45 -0500 | [diff] [blame] | 80 | , m_lastTransactionId(0) |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 81 | , m_signedVerbDispatch(SIGNED_COMMAND_VERBS, |
| 82 | SIGNED_COMMAND_VERBS + |
| 83 | (sizeof(SIGNED_COMMAND_VERBS) / sizeof(SignedVerbAndProcessor))) |
| 84 | , m_unsignedVerbDispatch(UNSIGNED_COMMAND_VERBS, |
| 85 | UNSIGNED_COMMAND_VERBS + |
| 86 | (sizeof(UNSIGNED_COMMAND_VERBS) / sizeof(UnsignedVerbAndProcessor))) |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 87 | { |
| 88 | } |
| 89 | |
| 90 | void |
Junxiao Shi | a329574 | 2014-05-16 22:40:10 -0700 | [diff] [blame] | 91 | RibManager::startListening(const Name& commandPrefix, const ndn::OnInterest& onRequest) |
| 92 | { |
| 93 | NFD_LOG_INFO("Listening on: " << commandPrefix); |
| 94 | |
| 95 | m_nfdController.start<ndn::nfd::FibAddNextHopCommand>( |
| 96 | ControlParameters() |
| 97 | .setName(commandPrefix) |
| 98 | .setFaceId(0), |
| 99 | bind(&RibManager::onNrdCommandPrefixAddNextHopSuccess, this, cref(commandPrefix)), |
| 100 | bind(&RibManager::onNrdCommandPrefixAddNextHopError, this, cref(commandPrefix), _2)); |
| 101 | |
| 102 | m_face.setInterestFilter(commandPrefix, onRequest); |
| 103 | } |
| 104 | |
| 105 | void |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 106 | RibManager::registerWithNfd() |
| 107 | { |
| 108 | //check whether the components of localhop and localhost prefixes are same |
| 109 | BOOST_ASSERT(COMMAND_PREFIX.size() == REMOTE_COMMAND_PREFIX.size()); |
| 110 | |
Junxiao Shi | a329574 | 2014-05-16 22:40:10 -0700 | [diff] [blame] | 111 | this->startListening(COMMAND_PREFIX, bind(&RibManager::onLocalhostRequest, this, _2)); |
Alexander Afanasyev | b3893c9 | 2014-05-15 01:49:54 -0700 | [diff] [blame] | 112 | |
Junxiao Shi | a329574 | 2014-05-16 22:40:10 -0700 | [diff] [blame] | 113 | if (m_isLocalhopEnabled) { |
| 114 | this->startListening(REMOTE_COMMAND_PREFIX, |
| 115 | bind(&RibManager::onLocalhopRequest, this, _2)); |
| 116 | } |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 117 | |
Alexander Afanasyev | 89cf5e0 | 2014-04-17 12:08:57 -0700 | [diff] [blame] | 118 | NFD_LOG_INFO("Start monitoring face create/destroy events"); |
Alexander Afanasyev | f698028 | 2014-05-13 18:28:40 -0700 | [diff] [blame] | 119 | m_faceMonitor.addSubscriber(bind(&RibManager::onNotification, this, _1)); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 120 | m_faceMonitor.startNotifications(); |
| 121 | } |
| 122 | |
| 123 | void |
| 124 | RibManager::setConfigFile(ConfigFile& configFile) |
| 125 | { |
Yingdi Yu | e5224e9 | 2014-04-29 18:04:02 -0700 | [diff] [blame] | 126 | configFile.addSectionHandler("rib", |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 127 | bind(&RibManager::onConfig, this, _1, _2, _3)); |
| 128 | } |
| 129 | |
| 130 | void |
| 131 | RibManager::onConfig(const ConfigSection& configSection, |
Yingdi Yu | f4db0b5 | 2014-04-17 13:17:39 -0700 | [diff] [blame] | 132 | bool isDryRun, |
| 133 | const std::string& filename) |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 134 | { |
Yingdi Yu | e5224e9 | 2014-04-29 18:04:02 -0700 | [diff] [blame] | 135 | for (ConfigSection::const_iterator i = configSection.begin(); |
| 136 | i != configSection.end(); ++i) |
| 137 | { |
| 138 | if (i->first == "localhost_security") |
| 139 | m_localhostValidator.load(i->second, filename); |
| 140 | else if (i->first == "localhop_security") |
| 141 | { |
| 142 | m_localhopValidator.load(i->second, filename); |
| 143 | m_isLocalhopEnabled = true; |
| 144 | } |
| 145 | else |
| 146 | throw Error("Unrecognized rib property: " + i->first); |
| 147 | } |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 148 | } |
| 149 | |
| 150 | void |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 151 | RibManager::sendResponse(const Name& name, |
| 152 | const ControlResponse& response) |
| 153 | { |
| 154 | const Block& encodedControl = response.wireEncode(); |
| 155 | |
Alexander Afanasyev | 97a9c2c | 2014-07-18 16:57:57 -0700 | [diff] [blame] | 156 | shared_ptr<Data> responseData = make_shared<Data>(name); |
| 157 | responseData->setContent(encodedControl); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 158 | |
Alexander Afanasyev | 97a9c2c | 2014-07-18 16:57:57 -0700 | [diff] [blame] | 159 | m_keyChain.sign(*responseData); |
| 160 | m_face.put(*responseData); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | void |
| 164 | RibManager::sendResponse(const Name& name, |
| 165 | uint32_t code, |
| 166 | const std::string& text) |
| 167 | { |
| 168 | ControlResponse response(code, text); |
| 169 | sendResponse(name, response); |
| 170 | } |
| 171 | |
| 172 | void |
Yingdi Yu | e5224e9 | 2014-04-29 18:04:02 -0700 | [diff] [blame] | 173 | RibManager::onLocalhostRequest(const Interest& request) |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 174 | { |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 175 | const Name& command = request.getName(); |
| 176 | const Name::Component& verb = command.get(COMMAND_PREFIX.size()); |
| 177 | |
| 178 | UnsignedVerbDispatchTable::const_iterator unsignedVerbProcessor = m_unsignedVerbDispatch.find(verb); |
| 179 | |
| 180 | if (unsignedVerbProcessor != m_unsignedVerbDispatch.end()) |
| 181 | { |
| 182 | NFD_LOG_DEBUG("command result: processing unsigned verb: " << verb); |
| 183 | (unsignedVerbProcessor->second)(this, request); |
| 184 | } |
| 185 | else |
| 186 | { |
| 187 | m_localhostValidator.validate(request, |
| 188 | bind(&RibManager::onCommandValidated, this, _1), |
| 189 | bind(&RibManager::onCommandValidationFailed, this, _1, _2)); |
| 190 | } |
Yingdi Yu | e5224e9 | 2014-04-29 18:04:02 -0700 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | void |
| 194 | RibManager::onLocalhopRequest(const Interest& request) |
| 195 | { |
| 196 | m_localhopValidator.validate(request, |
| 197 | bind(&RibManager::onCommandValidated, this, _1), |
| 198 | bind(&RibManager::onCommandValidationFailed, this, _1, _2)); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | void |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 202 | RibManager::onCommandValidated(const shared_ptr<const Interest>& request) |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 203 | { |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 204 | // REMOTE_COMMAND_PREFIX number of componenets are same as |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 205 | // NRD_COMMAND_PREFIX's so no extra checks are required. |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 206 | |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 207 | const Name& command = request->getName(); |
| 208 | const Name::Component& verb = command[COMMAND_PREFIX.size()]; |
| 209 | const Name::Component& parameterComponent = command[COMMAND_PREFIX.size() + 1]; |
| 210 | |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 211 | SignedVerbDispatchTable::const_iterator verbProcessor = m_signedVerbDispatch.find(verb); |
| 212 | if (verbProcessor != m_signedVerbDispatch.end()) |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 213 | { |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 214 | ControlParameters parameters; |
| 215 | if (!extractParameters(parameterComponent, parameters)) |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 216 | { |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 217 | NFD_LOG_DEBUG("command result: malformed verb: " << verb); |
Syed Obaid | 3313a37 | 2014-07-01 01:31:33 -0500 | [diff] [blame] | 218 | if (static_cast<bool>(request)) |
| 219 | sendResponse(command, 400, "Malformed command"); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 220 | return; |
| 221 | } |
| 222 | |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 223 | NFD_LOG_DEBUG("command result: processing verb: " << verb); |
| 224 | (verbProcessor->second)(this, request, parameters); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 225 | } |
| 226 | else |
| 227 | { |
Alexander Afanasyev | 89cf5e0 | 2014-04-17 12:08:57 -0700 | [diff] [blame] | 228 | NFD_LOG_DEBUG("Unsupported command: " << verb); |
Syed Obaid | 3313a37 | 2014-07-01 01:31:33 -0500 | [diff] [blame] | 229 | if (static_cast<bool>(request)) |
| 230 | sendResponse(request->getName(), 501, "Unsupported command"); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 231 | } |
| 232 | } |
| 233 | |
| 234 | void |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 235 | RibManager::registerEntry(const shared_ptr<const Interest>& request, |
| 236 | ControlParameters& parameters) |
| 237 | { |
| 238 | ndn::nfd::RibRegisterCommand command; |
| 239 | |
| 240 | if (!validateParameters(command, parameters)) |
| 241 | { |
| 242 | NFD_LOG_DEBUG("register result: FAIL reason: malformed"); |
Syed Obaid | 3313a37 | 2014-07-01 01:31:33 -0500 | [diff] [blame] | 243 | if (static_cast<bool>(request)) |
| 244 | sendResponse(request->getName(), 400, "Malformed command"); |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 245 | return; |
| 246 | } |
| 247 | |
Alexander Afanasyev | fb1c808 | 2014-07-17 15:16:15 -0700 | [diff] [blame] | 248 | if (!parameters.hasFaceId() || parameters.getFaceId() == 0) |
| 249 | { |
| 250 | parameters.setFaceId(request->getIncomingFaceId()); |
| 251 | } |
| 252 | |
Vince | 12e4946 | 2014-06-09 13:29:32 -0500 | [diff] [blame] | 253 | FaceEntry faceEntry; |
| 254 | faceEntry.faceId = parameters.getFaceId(); |
| 255 | faceEntry.origin = parameters.getOrigin(); |
| 256 | faceEntry.cost = parameters.getCost(); |
| 257 | faceEntry.flags = parameters.getFlags(); |
Syed Obaid | 3313a37 | 2014-07-01 01:31:33 -0500 | [diff] [blame] | 258 | |
Alexander Afanasyev | f67cf08 | 2014-07-18 16:47:29 -0700 | [diff] [blame] | 259 | if (parameters.hasExpirationPeriod() && |
| 260 | parameters.getExpirationPeriod() != time::milliseconds::max()) |
Syed Obaid | 3313a37 | 2014-07-01 01:31:33 -0500 | [diff] [blame] | 261 | { |
| 262 | faceEntry.expires = time::steady_clock::now() + parameters.getExpirationPeriod(); |
| 263 | |
| 264 | // Schedule a new event, the old one will be cancelled during rib insertion. |
| 265 | EventId eventId; |
| 266 | NFD_LOG_TRACE("scheduling unregistration at: " << faceEntry.expires); |
| 267 | eventId = scheduler::schedule(parameters.getExpirationPeriod(), |
| 268 | bind(&RibManager::unregisterEntry, |
| 269 | this, shared_ptr<Interest>(), parameters)); |
| 270 | |
| 271 | //set the NewEventId of this entry |
| 272 | faceEntry.setExpirationEvent(eventId); |
| 273 | } |
| 274 | else |
| 275 | { |
| 276 | faceEntry.expires = time::steady_clock::TimePoint::max(); |
| 277 | } |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 278 | |
Vince | 12e4946 | 2014-06-09 13:29:32 -0500 | [diff] [blame] | 279 | NFD_LOG_TRACE("register prefix: " << faceEntry); |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 280 | |
Vince | 12e4946 | 2014-06-09 13:29:32 -0500 | [diff] [blame] | 281 | m_managedRib.insert(parameters.getName(), faceEntry); |
Vince Lehman | 4387e78 | 2014-06-19 16:57:45 -0500 | [diff] [blame] | 282 | |
| 283 | sendUpdatesToFib(request, parameters); |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 284 | } |
| 285 | |
| 286 | void |
| 287 | RibManager::unregisterEntry(const shared_ptr<const Interest>& request, |
Syed Obaid | 3313a37 | 2014-07-01 01:31:33 -0500 | [diff] [blame] | 288 | ControlParameters& params) |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 289 | { |
Alexander Afanasyev | ce7520e | 2014-04-28 09:40:06 -0700 | [diff] [blame] | 290 | ndn::nfd::RibUnregisterCommand command; |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 291 | |
Syed Obaid | 3313a37 | 2014-07-01 01:31:33 -0500 | [diff] [blame] | 292 | //passing all parameters gives error in validation. |
| 293 | //so passing only the required arguments. |
| 294 | ControlParameters parameters; |
| 295 | parameters.setName(params.getName()); |
Alexander Afanasyev | b609f00 | 2014-07-18 16:56:34 -0700 | [diff] [blame] | 296 | if (params.hasFaceId()) |
| 297 | parameters.setFaceId(params.getFaceId()); |
| 298 | if (params.hasOrigin()) |
| 299 | parameters.setOrigin(params.getOrigin()); |
Syed Obaid | 3313a37 | 2014-07-01 01:31:33 -0500 | [diff] [blame] | 300 | |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 301 | if (!validateParameters(command, parameters)) |
| 302 | { |
Syed Obaid | 3313a37 | 2014-07-01 01:31:33 -0500 | [diff] [blame] | 303 | NFD_LOG_DEBUG("unregister result: FAIL reason: malformed"); |
| 304 | if (static_cast<bool>(request)) |
| 305 | sendResponse(request->getName(), 400, "Malformed command"); |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 306 | return; |
| 307 | } |
| 308 | |
Alexander Afanasyev | fb1c808 | 2014-07-17 15:16:15 -0700 | [diff] [blame] | 309 | if (!parameters.hasFaceId() || parameters.getFaceId() == 0) |
| 310 | { |
| 311 | parameters.setFaceId(request->getIncomingFaceId()); |
| 312 | } |
| 313 | |
Vince | 12e4946 | 2014-06-09 13:29:32 -0500 | [diff] [blame] | 314 | FaceEntry faceEntry; |
| 315 | faceEntry.faceId = parameters.getFaceId(); |
| 316 | faceEntry.origin = parameters.getOrigin(); |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 317 | |
Vince | 12e4946 | 2014-06-09 13:29:32 -0500 | [diff] [blame] | 318 | NFD_LOG_TRACE("unregister prefix: " << faceEntry); |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 319 | |
Vince Lehman | 4387e78 | 2014-06-19 16:57:45 -0500 | [diff] [blame] | 320 | m_managedRib.erase(parameters.getName(), faceEntry); |
| 321 | |
| 322 | sendUpdatesToFib(request, parameters); |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 323 | } |
| 324 | |
| 325 | void |
| 326 | RibManager::onCommandValidationFailed(const shared_ptr<const Interest>& request, |
| 327 | const std::string& failureInfo) |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 328 | { |
Alexander Afanasyev | 89cf5e0 | 2014-04-17 12:08:57 -0700 | [diff] [blame] | 329 | NFD_LOG_DEBUG("RibRequestValidationFailed: " << failureInfo); |
Syed Obaid | 3313a37 | 2014-07-01 01:31:33 -0500 | [diff] [blame] | 330 | if (static_cast<bool>(request)) |
| 331 | sendResponse(request->getName(), 403, failureInfo); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 332 | } |
| 333 | |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 334 | |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 335 | bool |
| 336 | RibManager::extractParameters(const Name::Component& parameterComponent, |
| 337 | ControlParameters& extractedParameters) |
| 338 | { |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 339 | try |
| 340 | { |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 341 | Block rawParameters = parameterComponent.blockFromValue(); |
| 342 | extractedParameters.wireDecode(rawParameters); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 343 | } |
| 344 | catch (const ndn::Tlv::Error& e) |
| 345 | { |
| 346 | return false; |
| 347 | } |
| 348 | |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 349 | NFD_LOG_DEBUG("Parameters parsed OK"); |
| 350 | return true; |
| 351 | } |
| 352 | |
| 353 | bool |
| 354 | RibManager::validateParameters(const ControlCommand& command, |
| 355 | ControlParameters& parameters) |
| 356 | { |
| 357 | try |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 358 | { |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 359 | command.validateRequest(parameters); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 360 | } |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 361 | catch (const ControlCommand::ArgumentError&) |
| 362 | { |
| 363 | return false; |
| 364 | } |
| 365 | |
| 366 | command.applyDefaultsToRequest(parameters); |
| 367 | |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 368 | return true; |
| 369 | } |
| 370 | |
| 371 | void |
| 372 | RibManager::onCommandError(uint32_t code, const std::string& error, |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 373 | const shared_ptr<const Interest>& request, |
Vince | 12e4946 | 2014-06-09 13:29:32 -0500 | [diff] [blame] | 374 | const FaceEntry& faceEntry) |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 375 | { |
Alexander Afanasyev | 89cf5e0 | 2014-04-17 12:08:57 -0700 | [diff] [blame] | 376 | NFD_LOG_ERROR("NFD returned an error: " << error << " (code: " << code << ")"); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 377 | |
| 378 | ControlResponse response; |
| 379 | |
| 380 | if (code == 404) |
| 381 | { |
| 382 | response.setCode(code); |
| 383 | response.setText(error); |
| 384 | } |
| 385 | else |
| 386 | { |
| 387 | response.setCode(533); |
| 388 | std::ostringstream os; |
| 389 | os << "Failure to update NFD " << "(NFD Error: " << code << " " << error << ")"; |
| 390 | response.setText(os.str()); |
| 391 | } |
| 392 | |
Syed Obaid | 3313a37 | 2014-07-01 01:31:33 -0500 | [diff] [blame] | 393 | if (static_cast<bool>(request)) |
| 394 | sendResponse(request->getName(), response); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 395 | } |
| 396 | |
| 397 | void |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 398 | RibManager::onRegSuccess(const shared_ptr<const Interest>& request, |
| 399 | const ControlParameters& parameters, |
Vince | 12e4946 | 2014-06-09 13:29:32 -0500 | [diff] [blame] | 400 | const FaceEntry& faceEntry) |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 401 | { |
| 402 | ControlResponse response; |
| 403 | |
| 404 | response.setCode(200); |
| 405 | response.setText("Success"); |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 406 | response.setBody(parameters.wireEncode()); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 407 | |
Vince | 12e4946 | 2014-06-09 13:29:32 -0500 | [diff] [blame] | 408 | NFD_LOG_TRACE("onRegSuccess: registered " << faceEntry); |
Alexander Afanasyev | 89cf5e0 | 2014-04-17 12:08:57 -0700 | [diff] [blame] | 409 | |
Syed Obaid | 3313a37 | 2014-07-01 01:31:33 -0500 | [diff] [blame] | 410 | if (static_cast<bool>(request)) |
| 411 | sendResponse(request->getName(), response); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 412 | } |
| 413 | |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 414 | |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 415 | void |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 416 | RibManager::onUnRegSuccess(const shared_ptr<const Interest>& request, |
| 417 | const ControlParameters& parameters, |
Vince | 12e4946 | 2014-06-09 13:29:32 -0500 | [diff] [blame] | 418 | const FaceEntry& faceEntry) |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 419 | { |
| 420 | ControlResponse response; |
| 421 | |
| 422 | response.setCode(200); |
| 423 | response.setText("Success"); |
Alexander Afanasyev | 20d3144 | 2014-04-19 17:00:53 -0700 | [diff] [blame] | 424 | response.setBody(parameters.wireEncode()); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 425 | |
Vince | 12e4946 | 2014-06-09 13:29:32 -0500 | [diff] [blame] | 426 | NFD_LOG_TRACE("onUnRegSuccess: unregistered " << faceEntry); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 427 | |
Syed Obaid | 3313a37 | 2014-07-01 01:31:33 -0500 | [diff] [blame] | 428 | if (static_cast<bool>(request)) |
| 429 | sendResponse(request->getName(), response); |
Vince Lehman | 4387e78 | 2014-06-19 16:57:45 -0500 | [diff] [blame] | 430 | } |
| 431 | |
| 432 | void |
| 433 | RibManager::sendSuccessResponse(const shared_ptr<const Interest>& request, |
| 434 | const ControlParameters& parameters) |
| 435 | { |
| 436 | if (!static_cast<bool>(request)) |
| 437 | { |
| 438 | return; |
| 439 | } |
| 440 | |
| 441 | ControlResponse response; |
| 442 | |
| 443 | response.setCode(200); |
| 444 | response.setText("Success"); |
| 445 | response.setBody(parameters.wireEncode()); |
| 446 | |
Syed Obaid | 3313a37 | 2014-07-01 01:31:33 -0500 | [diff] [blame] | 447 | if (static_cast<bool>(request)) |
| 448 | sendResponse(request->getName(), response); |
Vince Lehman | 4387e78 | 2014-06-19 16:57:45 -0500 | [diff] [blame] | 449 | } |
| 450 | |
| 451 | void |
| 452 | RibManager::sendErrorResponse(uint32_t code, const std::string& error, |
| 453 | const shared_ptr<const Interest>& request) |
| 454 | { |
| 455 | NFD_LOG_ERROR("NFD returned an error: " << error << " (code: " << code << ")"); |
| 456 | |
| 457 | if (!static_cast<bool>(request)) |
| 458 | { |
| 459 | return; |
| 460 | } |
| 461 | |
| 462 | ControlResponse response; |
| 463 | |
| 464 | if (code == 404) |
| 465 | { |
| 466 | response.setCode(code); |
| 467 | response.setText(error); |
| 468 | } |
| 469 | else |
| 470 | { |
| 471 | response.setCode(533); |
| 472 | std::ostringstream os; |
| 473 | os << "Failure to update NFD " << "(NFD Error: " << code << " " << error << ")"; |
| 474 | response.setText(os.str()); |
| 475 | } |
| 476 | |
Syed Obaid | 3313a37 | 2014-07-01 01:31:33 -0500 | [diff] [blame] | 477 | if (static_cast<bool>(request)) |
| 478 | sendResponse(request->getName(), response); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 479 | } |
| 480 | |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 481 | void |
Alexander Afanasyev | b3893c9 | 2014-05-15 01:49:54 -0700 | [diff] [blame] | 482 | RibManager::onNrdCommandPrefixAddNextHopSuccess(const Name& prefix) |
| 483 | { |
| 484 | NFD_LOG_DEBUG("Successfully registered " + prefix.toUri() + " with NFD"); |
| 485 | } |
| 486 | |
| 487 | void |
| 488 | RibManager::onNrdCommandPrefixAddNextHopError(const Name& name, const std::string& msg) |
| 489 | { |
| 490 | throw Error("Error in setting interest filter (" + name.toUri() + "): " + msg); |
| 491 | } |
| 492 | |
Vince Lehman | 4387e78 | 2014-06-19 16:57:45 -0500 | [diff] [blame] | 493 | bool |
| 494 | RibManager::isTransactionComplete(const TransactionId transactionId) |
Alexander Afanasyev | b3893c9 | 2014-05-15 01:49:54 -0700 | [diff] [blame] | 495 | { |
Vince Lehman | 4387e78 | 2014-06-19 16:57:45 -0500 | [diff] [blame] | 496 | FibTransactionTable::iterator it = m_pendingFibTransactions.find(transactionId); |
| 497 | |
| 498 | if (it != m_pendingFibTransactions.end()) |
| 499 | { |
| 500 | int& updatesLeft = it->second; |
| 501 | |
| 502 | updatesLeft--; |
| 503 | |
| 504 | // All of the updates have been applied successfully |
| 505 | if (updatesLeft == 0) |
| 506 | { |
| 507 | m_pendingFibTransactions.erase(it); |
| 508 | return true; |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | return false; |
Alexander Afanasyev | b3893c9 | 2014-05-15 01:49:54 -0700 | [diff] [blame] | 513 | } |
| 514 | |
| 515 | void |
Vince Lehman | 4387e78 | 2014-06-19 16:57:45 -0500 | [diff] [blame] | 516 | RibManager::invalidateTransaction(const TransactionId transactionId) |
Alexander Afanasyev | b3893c9 | 2014-05-15 01:49:54 -0700 | [diff] [blame] | 517 | { |
Vince Lehman | 4387e78 | 2014-06-19 16:57:45 -0500 | [diff] [blame] | 518 | FibTransactionTable::iterator it = m_pendingFibTransactions.find(transactionId); |
| 519 | |
| 520 | if (it != m_pendingFibTransactions.end()) |
| 521 | { |
| 522 | m_pendingFibTransactions.erase(it); |
| 523 | } |
| 524 | } |
| 525 | |
| 526 | void |
| 527 | RibManager::onAddNextHopSuccess(const shared_ptr<const Interest>& request, |
| 528 | const ControlParameters& parameters, |
| 529 | const TransactionId transactionId, |
| 530 | const bool shouldSendResponse) |
| 531 | { |
| 532 | if (isTransactionComplete(transactionId) && shouldSendResponse) |
| 533 | { |
| 534 | sendSuccessResponse(request, parameters); |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | void |
| 539 | RibManager::onAddNextHopError(uint32_t code, const std::string& error, |
| 540 | const shared_ptr<const Interest>& request, |
| 541 | const TransactionId transactionId, const bool shouldSendResponse) |
| 542 | { |
| 543 | invalidateTransaction(transactionId); |
| 544 | |
| 545 | if (shouldSendResponse) |
| 546 | { |
| 547 | sendErrorResponse(code, error, request); |
| 548 | } |
| 549 | } |
| 550 | |
| 551 | void |
| 552 | RibManager::onRemoveNextHopSuccess(const shared_ptr<const Interest>& request, |
| 553 | const ControlParameters& parameters, |
| 554 | const TransactionId transactionId, |
| 555 | const bool shouldSendResponse) |
| 556 | { |
| 557 | if (isTransactionComplete(transactionId) && shouldSendResponse) |
| 558 | { |
| 559 | sendSuccessResponse(request, parameters); |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | void |
| 564 | RibManager::onRemoveNextHopError(uint32_t code, const std::string& error, |
| 565 | const shared_ptr<const Interest>& request, |
| 566 | const TransactionId transactionId, const bool shouldSendResponse) |
| 567 | { |
| 568 | invalidateTransaction(transactionId); |
| 569 | |
| 570 | if (shouldSendResponse) |
| 571 | { |
| 572 | sendErrorResponse(code, error, request); |
| 573 | } |
Alexander Afanasyev | b3893c9 | 2014-05-15 01:49:54 -0700 | [diff] [blame] | 574 | } |
| 575 | |
| 576 | void |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 577 | RibManager::onControlHeaderSuccess() |
| 578 | { |
Alexander Afanasyev | 89cf5e0 | 2014-04-17 12:08:57 -0700 | [diff] [blame] | 579 | NFD_LOG_DEBUG("Local control header enabled"); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 580 | } |
| 581 | |
| 582 | void |
| 583 | RibManager::onControlHeaderError(uint32_t code, const std::string& reason) |
| 584 | { |
Alexander Afanasyev | b305165 | 2014-04-30 17:50:26 -0700 | [diff] [blame] | 585 | std::ostringstream os; |
| 586 | os << "Couldn't enable local control header " |
| 587 | << "(code: " << code << ", info: " << reason << ")"; |
| 588 | throw Error(os.str()); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 589 | } |
| 590 | |
| 591 | void |
| 592 | RibManager::enableLocalControlHeader() |
| 593 | { |
Alexander Afanasyev | b3893c9 | 2014-05-15 01:49:54 -0700 | [diff] [blame] | 594 | m_nfdController.start<ndn::nfd::FaceEnableLocalControlCommand>( |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 595 | ControlParameters() |
| 596 | .setLocalControlFeature(ndn::nfd::LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID), |
| 597 | bind(&RibManager::onControlHeaderSuccess, this), |
| 598 | bind(&RibManager::onControlHeaderError, this, _1, _2)); |
| 599 | } |
| 600 | |
| 601 | void |
| 602 | RibManager::onNotification(const FaceEventNotification& notification) |
| 603 | { |
| 604 | /// \todo A notification can be missed, in this case check Facelist |
Alexander Afanasyev | 89cf5e0 | 2014-04-17 12:08:57 -0700 | [diff] [blame] | 605 | NFD_LOG_TRACE("onNotification: " << notification); |
Vince Lehman | 4387e78 | 2014-06-19 16:57:45 -0500 | [diff] [blame] | 606 | if (notification.getKind() == ndn::nfd::FACE_EVENT_DESTROYED) //face destroyed |
| 607 | { |
Alexander Afanasyev | 63108c4 | 2014-07-07 19:10:47 -0700 | [diff] [blame] | 608 | scheduler::schedule(time::seconds(0), |
| 609 | bind(&RibManager::processErasureAfterNotification, this, |
| 610 | notification.getFaceId())); |
Vince Lehman | 4387e78 | 2014-06-19 16:57:45 -0500 | [diff] [blame] | 611 | } |
| 612 | } |
| 613 | |
| 614 | void |
Alexander Afanasyev | 63108c4 | 2014-07-07 19:10:47 -0700 | [diff] [blame] | 615 | RibManager::processErasureAfterNotification(uint64_t faceId) |
| 616 | { |
| 617 | m_managedRib.erase(faceId); |
| 618 | |
| 619 | sendUpdatesToFibAfterFaceDestroyEvent(); |
| 620 | } |
| 621 | |
| 622 | void |
Vince Lehman | 4387e78 | 2014-06-19 16:57:45 -0500 | [diff] [blame] | 623 | RibManager::sendUpdatesToFib(const shared_ptr<const Interest>& request, |
| 624 | const ControlParameters& parameters) |
| 625 | { |
| 626 | const Rib::FibUpdateList& updates = m_managedRib.getFibUpdates(); |
| 627 | |
| 628 | // If no updates were generated, consider the operation a success |
| 629 | if (updates.empty()) |
| 630 | { |
| 631 | sendSuccessResponse(request, parameters); |
| 632 | return; |
| 633 | } |
| 634 | |
| 635 | bool shouldWaitToRespond = false; |
| 636 | |
| 637 | // An application request should wait for all FIB updates to be applied |
| 638 | // successfully before sending a response |
| 639 | if (parameters.getOrigin() == ndn::nfd::ROUTE_ORIGIN_APP) |
| 640 | { |
| 641 | shouldWaitToRespond = true; |
| 642 | } |
| 643 | else // Respond immediately |
| 644 | { |
| 645 | sendSuccessResponse(request, parameters); |
| 646 | } |
| 647 | |
| 648 | NFD_LOG_DEBUG("Applying " << updates.size() << " updates to FIB"); |
| 649 | |
| 650 | // Assign an ID to this FIB transaction |
| 651 | TransactionId currentTransactionId = ++m_lastTransactionId; |
| 652 | |
| 653 | // Add this transaction to the transaction table |
| 654 | m_pendingFibTransactions[currentTransactionId] = updates.size(); |
| 655 | |
| 656 | for (Rib::FibUpdateList::const_iterator it = updates.begin(); it != updates.end(); ++it) |
| 657 | { |
| 658 | shared_ptr<const FibUpdate> update(*it); |
| 659 | |
| 660 | if (update->action == FibUpdate::ADD_NEXTHOP) |
| 661 | { |
| 662 | FaceEntry faceEntry; |
| 663 | faceEntry.faceId = update->faceId; |
| 664 | faceEntry.cost = update->cost; |
| 665 | |
| 666 | m_nfdController.start<ndn::nfd::FibAddNextHopCommand>( |
| 667 | ControlParameters() |
| 668 | .setName(update->name) |
| 669 | .setFaceId(faceEntry.faceId) |
| 670 | .setCost(faceEntry.cost), |
| 671 | bind(&RibManager::onAddNextHopSuccess, this, request, |
| 672 | parameters, |
| 673 | currentTransactionId, |
| 674 | shouldWaitToRespond), |
| 675 | bind(&RibManager::onAddNextHopError, this, _1, _2, request, currentTransactionId, |
| 676 | shouldWaitToRespond)); |
| 677 | } |
| 678 | else if (update->action == FibUpdate::REMOVE_NEXTHOP) |
| 679 | { |
| 680 | FaceEntry faceEntry; |
| 681 | faceEntry.faceId = update->faceId; |
| 682 | |
| 683 | m_nfdController.start<ndn::nfd::FibRemoveNextHopCommand>( |
| 684 | ControlParameters() |
| 685 | .setName(update->name) |
| 686 | .setFaceId(faceEntry.faceId), |
| 687 | bind(&RibManager::onRemoveNextHopSuccess, this, request, |
| 688 | parameters, |
| 689 | currentTransactionId, |
| 690 | shouldWaitToRespond), |
| 691 | bind(&RibManager::onRemoveNextHopError, this, _1, _2, request, currentTransactionId, |
| 692 | shouldWaitToRespond)); |
| 693 | } |
| 694 | } |
| 695 | |
| 696 | m_managedRib.clearFibUpdates(); |
| 697 | } |
| 698 | |
| 699 | void |
| 700 | RibManager::sendUpdatesToFibAfterFaceDestroyEvent() |
| 701 | { |
| 702 | ControlParameters parameters; |
| 703 | parameters.setOrigin(ndn::nfd::ROUTE_ORIGIN_STATIC); |
| 704 | |
| 705 | sendUpdatesToFib(shared_ptr<const Interest>(), parameters); |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 706 | } |
| 707 | |
Vince Lehman | cd16c83 | 2014-07-23 15:14:55 -0700 | [diff] [blame] | 708 | void |
| 709 | RibManager::listEntries(const Interest& request) |
| 710 | { |
| 711 | const Name& command = request.getName(); |
| 712 | const size_t commandNComps = command.size(); |
| 713 | |
| 714 | if (commandNComps < LIST_COMMAND_NCOMPS || |
| 715 | !LIST_COMMAND_PREFIX.isPrefixOf(command)) |
| 716 | { |
| 717 | NFD_LOG_DEBUG("command result: malformed"); |
| 718 | sendResponse(command, 400, "Malformed command"); |
| 719 | return; |
| 720 | } |
| 721 | |
| 722 | m_ribStatusPublisher.publish(); |
| 723 | } |
| 724 | |
Alexander Afanasyev | 3ecec50 | 2014-04-16 13:42:44 -0700 | [diff] [blame] | 725 | } // namespace rib |
| 726 | } // namespace nfd |