NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
rib-manager.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2019, 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.
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/>.
24  */
25 
26 #include "rib-manager.hpp"
27 
28 #include "core/fib-max-depth.hpp"
29 #include "core/logger.hpp"
30 
31 #include <ndn-cxx/lp/tags.hpp>
37 
38 namespace nfd {
39 namespace rib {
40 
42 
43 static const std::string MGMT_MODULE_NAME = "rib";
44 static const Name LOCALHOST_TOP_PREFIX = "/localhost/nfd";
45 static const time::seconds ACTIVE_FACE_FETCH_INTERVAL = 5_min;
46 
47 const Name RibManager::LOCALHOP_TOP_PREFIX = "/localhop/nfd";
48 
50  ndn::nfd::Controller& nfdController, Dispatcher& dispatcher,
51  ndn::util::Scheduler& scheduler)
52  : ManagerBase(dispatcher, MGMT_MODULE_NAME)
53  , m_rib(rib)
54  , m_keyChain(keyChain)
55  , m_nfdController(nfdController)
56  , m_dispatcher(dispatcher)
57  , m_scheduler(scheduler)
58  , m_faceMonitor(face)
59  , m_localhostValidator(face)
60  , m_localhopValidator(face)
61  , m_isLocalhopEnabled(false)
62 {
63  registerCommandHandler<ndn::nfd::RibRegisterCommand>("register",
64  bind(&RibManager::registerEntry, this, _2, _3, _4, _5));
65  registerCommandHandler<ndn::nfd::RibUnregisterCommand>("unregister",
66  bind(&RibManager::unregisterEntry, this, _2, _3, _4, _5));
67 
68  registerStatusDatasetHandler("list", bind(&RibManager::listEntries, this, _1, _2, _3));
69 }
70 
71 void
72 RibManager::applyLocalhostConfig(const ConfigSection& section, const std::string& filename)
73 {
74  m_localhostValidator.load(section, filename);
75 }
76 
77 void
78 RibManager::enableLocalhop(const ConfigSection& section, const std::string& filename)
79 {
80  m_localhopValidator.load(section, filename);
81  m_isLocalhopEnabled = true;
82 }
83 
84 void
86 {
87  m_isLocalhopEnabled = false;
88 }
89 
90 void
92 {
93  registerTopPrefix(LOCALHOST_TOP_PREFIX);
94 
95  if (m_isLocalhopEnabled) {
96  registerTopPrefix(LOCALHOP_TOP_PREFIX);
97  }
98 
99  NFD_LOG_INFO("Start monitoring face create/destroy events");
100  m_faceMonitor.onNotification.connect(bind(&RibManager::onNotification, this, _1));
101  m_faceMonitor.start();
102 
103  scheduleActiveFaceFetch(ACTIVE_FACE_FETCH_INTERVAL);
104 }
105 
106 void
108 {
109  m_nfdController.start<ndn::nfd::FaceUpdateCommand>(
111  [] (const ControlParameters& res) {
112  NFD_LOG_DEBUG("Local fields enabled");
113  },
114  [] (const ControlResponse& res) {
115  BOOST_THROW_EXCEPTION(Error("Couldn't enable local fields (" + to_string(res.getCode()) +
116  " " + res.getText() + ")"));
117  });
118 }
119 
120 void
121 RibManager::beginAddRoute(const Name& name, Route route, optional<time::nanoseconds> expires,
122  const std::function<void(RibUpdateResult)>& done)
123 {
124  if (expires) {
125  route.expires = time::steady_clock::now() + *expires;
126  }
127  else if (route.expires) {
128  expires = *route.expires - time::steady_clock::now();
129  }
130 
131  if (expires && *expires <= 0_s) {
132  m_rib.onRouteExpiration(name, route);
133  return done(RibUpdateResult::EXPIRED);
134  }
135 
136  NFD_LOG_INFO("Adding route " << name << " nexthop=" << route.faceId <<
137  " origin=" << route.origin << " cost=" << route.cost);
138 
139  if (expires) {
140  auto event = m_scheduler.scheduleEvent(*expires, [=] { m_rib.onRouteExpiration(name, route); });
141  route.setExpirationEvent(event);
142  NFD_LOG_TRACE("Scheduled unregistration at: " << *route.expires);
143  }
144 
145  m_registeredFaces.insert(route.faceId);
146 
147  RibUpdate update;
148  update.setAction(RibUpdate::REGISTER)
149  .setName(name)
150  .setRoute(route);
151  beginRibUpdate(update, done);
152 }
153 
154 void
155 RibManager::beginRemoveRoute(const Name& name, const Route& route,
156  const std::function<void(RibUpdateResult)>& done)
157 {
158  NFD_LOG_INFO("Removing route " << name << " nexthop=" << route.faceId <<
159  " origin=" << route.origin);
160 
161  RibUpdate update;
162  update.setAction(RibUpdate::UNREGISTER)
163  .setName(name)
164  .setRoute(route);
165  beginRibUpdate(update, done);
166 }
167 
168 void
169 RibManager::beginRibUpdate(const RibUpdate& update,
170  const std::function<void(RibUpdateResult)>& done)
171 {
172  m_rib.beginApplyUpdate(update,
173  [=] {
174  NFD_LOG_DEBUG("RIB update succeeded for " << update);
175  done(RibUpdateResult::OK);
176  },
177  [=] (uint32_t code, const std::string& error) {
178  NFD_LOG_DEBUG("RIB update failed for " << update << " (" << code << " " << error << ")");
179 
180  // Since the FIB rejected the update, clean up invalid routes
181  scheduleActiveFaceFetch(1_s);
182 
183  done(RibUpdateResult::ERROR);
184  });
185 }
186 
187 void
188 RibManager::registerTopPrefix(const Name& topPrefix)
189 {
190  // add FIB nexthop
191  m_nfdController.start<ndn::nfd::FibAddNextHopCommand>(
192  ControlParameters().setName(Name(topPrefix).append(MGMT_MODULE_NAME))
193  .setFaceId(0),
194  [=] (const ControlParameters& res) {
195  NFD_LOG_DEBUG("Successfully registered " << topPrefix << " with NFD");
196 
197  // Routes must be inserted into the RIB so route flags can be applied
198  Route route;
199  route.faceId = res.getFaceId();
200  route.origin = ndn::nfd::ROUTE_ORIGIN_APP;
202 
203  m_rib.insert(topPrefix, route);
204 
205  m_registeredFaces.insert(route.faceId);
206  },
207  [=] (const ControlResponse& res) {
208  BOOST_THROW_EXCEPTION(Error("Cannot add FIB entry " + topPrefix.toUri() + " (" +
209  to_string(res.getCode()) + " " + res.getText() + ")"));
210  });
211 
212  // add top prefix to the dispatcher without prefix registration
213  m_dispatcher.addTopPrefix(topPrefix, false);
214 }
215 
216 void
217 RibManager::registerEntry(const Name& topPrefix, const Interest& interest,
218  ControlParameters parameters,
219  const ndn::mgmt::CommandContinuation& done)
220 {
221  if (parameters.getName().size() > FIB_MAX_DEPTH) {
222  done(ControlResponse(414, "Route prefix cannot exceed " + ndn::to_string(FIB_MAX_DEPTH) +
223  " components"));
224  return;
225  }
226 
227  setFaceForSelfRegistration(interest, parameters);
228 
229  // Respond since command is valid and authorized
230  done(ControlResponse(200, "Success").setBody(parameters.wireEncode()));
231 
232  Route route;
233  route.faceId = parameters.getFaceId();
234  route.origin = parameters.getOrigin();
235  route.cost = parameters.getCost();
236  route.flags = parameters.getFlags();
237 
238  optional<time::nanoseconds> expires;
239  if (parameters.hasExpirationPeriod() &&
240  parameters.getExpirationPeriod() != time::milliseconds::max()) {
241  expires = time::duration_cast<time::nanoseconds>(parameters.getExpirationPeriod());
242  }
243 
244  beginAddRoute(parameters.getName(), std::move(route), expires, [] (RibUpdateResult) {});
245 }
246 
247 void
248 RibManager::unregisterEntry(const Name& topPrefix, const Interest& interest,
249  ControlParameters parameters,
250  const ndn::mgmt::CommandContinuation& done)
251 {
252  setFaceForSelfRegistration(interest, parameters);
253 
254  // Respond since command is valid and authorized
255  done(ControlResponse(200, "Success").setBody(parameters.wireEncode()));
256 
257  Route route;
258  route.faceId = parameters.getFaceId();
259  route.origin = parameters.getOrigin();
260 
261  beginRemoveRoute(parameters.getName(), route, [] (RibUpdateResult) {});
262 }
263 
264 void
265 RibManager::listEntries(const Name& topPrefix, const Interest& interest,
267 {
268  auto now = time::steady_clock::now();
269  for (const auto& kv : m_rib) {
270  const RibEntry& entry = *kv.second;
271  ndn::nfd::RibEntry item;
272  item.setName(entry.getName());
273  for (const Route& route : entry.getRoutes()) {
274  ndn::nfd::Route r;
275  r.setFaceId(route.faceId);
276  r.setOrigin(route.origin);
277  r.setCost(route.cost);
278  r.setFlags(route.flags);
279  if (route.expires) {
280  r.setExpirationPeriod(time::duration_cast<time::milliseconds>(*route.expires - now));
281  }
282  item.addRoute(r);
283  }
284  context.append(item.wireEncode());
285  }
286  context.end();
287 }
288 
289 void
290 RibManager::setFaceForSelfRegistration(const Interest& request, ControlParameters& parameters)
291 {
292  bool isSelfRegistration = (parameters.getFaceId() == 0);
293  if (isSelfRegistration) {
294  shared_ptr<lp::IncomingFaceIdTag> incomingFaceIdTag = request.getTag<lp::IncomingFaceIdTag>();
295  // NDNLPv2 says "application MUST be prepared to receive a packet without IncomingFaceId field",
296  // but it's fine to assert IncomingFaceId is available, because InternalFace lives inside NFD
297  // and is initialized synchronously with IncomingFaceId field enabled.
298  BOOST_ASSERT(incomingFaceIdTag != nullptr);
299  parameters.setFaceId(*incomingFaceIdTag);
300  }
301 }
302 
304 RibManager::makeAuthorization(const std::string& verb)
305 {
306  return [this] (const Name& prefix, const Interest& interest,
307  const ndn::mgmt::ControlParameters* params,
308  const ndn::mgmt::AcceptContinuation& accept,
309  const ndn::mgmt::RejectContinuation& reject) {
310  BOOST_ASSERT(params != nullptr);
311  BOOST_ASSERT(typeid(*params) == typeid(ndn::nfd::ControlParameters));
312  BOOST_ASSERT(prefix == LOCALHOST_TOP_PREFIX || prefix == LOCALHOP_TOP_PREFIX);
313 
314  ndn::ValidatorConfig& validator = prefix == LOCALHOST_TOP_PREFIX ?
315  m_localhostValidator : m_localhopValidator;
316  validator.validate(interest,
317  bind([&interest, this, accept] { extractRequester(interest, accept); }),
318  bind([reject] { reject(ndn::mgmt::RejectReply::STATUS403); }));
319  };
320 }
321 
322 std::ostream&
324 {
325  switch (res) {
327  return os << "OK";
329  return os << "ERROR";
331  return os << "VALIDATION_FAILURE";
333  return os << "EXPIRED";
335  return os << "NOT_FOUND";
336  }
337  BOOST_ASSERT_MSG(false, "bad SlAnnounceResult");
338  return os;
339 }
340 
342 RibManager::getSlAnnounceResultFromRibUpdateResult(RibUpdateResult r)
343 {
344  switch (r) {
345  case RibUpdateResult::OK:
346  return SlAnnounceResult::OK;
347  case RibUpdateResult::ERROR:
349  case RibUpdateResult::EXPIRED:
351  default:
352  BOOST_ASSERT(false);
354  }
355 }
356 
357 void
359  time::milliseconds maxLifetime, const SlAnnounceCallback& cb)
360 {
361  BOOST_ASSERT(pa.getData());
362 
363  if (!m_isLocalhopEnabled) {
364  NFD_LOG_INFO("slAnnounce " << pa.getAnnouncedName() << " " << faceId <<
365  ": localhop_security unconfigured");
367  return;
368  }
369 
370  m_localhopValidator.validate(*pa.getData(),
371  [=] (const Data&) {
372  Route route(pa, faceId);
373  route.expires = std::min(route.annExpires, time::steady_clock::now() + maxLifetime);
374  beginAddRoute(pa.getAnnouncedName(), route, nullopt,
375  [=] (RibUpdateResult ribRes) {
376  auto res = getSlAnnounceResultFromRibUpdateResult(ribRes);
377  NFD_LOG_INFO("slAnnounce " << pa.getAnnouncedName() << " " << faceId << ": " << res);
378  cb(res);
379  });
380  },
381  [=] (const Data&, ndn::security::v2::ValidationError err) {
382  NFD_LOG_INFO("slAnnounce " << pa.getAnnouncedName() << " " << faceId <<
383  " validation error: " << err);
385  }
386  );
387 }
388 
389 void
390 RibManager::slRenew(const Name& name, uint64_t faceId, time::milliseconds maxLifetime,
391  const SlAnnounceCallback& cb)
392 {
393  Route routeQuery;
394  routeQuery.faceId = faceId;
396  Route* oldRoute = m_rib.findLongestPrefix(name, routeQuery);
397 
398  if (oldRoute == nullptr || !oldRoute->announcement) {
399  NFD_LOG_DEBUG("slRenew " << name << " " << faceId << ": not found");
400  return cb(SlAnnounceResult::NOT_FOUND);
401  }
402  Name routeName = oldRoute->announcement->getAnnouncedName();
403 
404  Route route = *oldRoute;
405  route.expires = std::min(route.annExpires, time::steady_clock::now() + maxLifetime);
406  beginAddRoute(routeName, route, nullopt,
407  [=] (RibUpdateResult ribRes) {
408  auto res = getSlAnnounceResultFromRibUpdateResult(ribRes);
409  NFD_LOG_INFO("slRenew " << name << " " << faceId << ": " << res << " " << routeName);
410  cb(res);
411  });
412 }
413 
414 void
416 {
417  shared_ptr<RibEntry> entry;
418  auto exactMatch = m_rib.find(name);
419  if (exactMatch != m_rib.end()) {
420  entry = exactMatch->second;
421  }
422  else {
423  entry = m_rib.findParent(name);
424  }
425  if (entry == nullptr) {
426  return cb(nullopt);
427  }
428 
429  auto pa = entry->getPrefixAnnouncement();
430  pa.toData(m_keyChain);
431  cb(pa);
432 }
433 
434 void
435 RibManager::fetchActiveFaces()
436 {
437  NFD_LOG_DEBUG("Fetching active faces");
438 
439  m_nfdController.fetch<ndn::nfd::FaceDataset>(
440  bind(&RibManager::removeInvalidFaces, this, _1),
441  bind(&RibManager::onFetchActiveFacesFailure, this, _1, _2),
443 }
444 
445 void
446 RibManager::onFetchActiveFacesFailure(uint32_t code, const std::string& reason)
447 {
448  NFD_LOG_DEBUG("Face Status Dataset request failure " << code << " " << reason);
449  scheduleActiveFaceFetch(ACTIVE_FACE_FETCH_INTERVAL);
450 }
451 
452 void
453 RibManager::onFaceDestroyedEvent(uint64_t faceId)
454 {
455  m_rib.beginRemoveFace(faceId);
456  m_registeredFaces.erase(faceId);
457 }
458 
459 void
460 RibManager::scheduleActiveFaceFetch(const time::seconds& timeToWait)
461 {
462  m_activeFaceFetchEvent = m_scheduler.scheduleEvent(timeToWait, [this] { fetchActiveFaces(); });
463 }
464 
465 void
466 RibManager::removeInvalidFaces(const std::vector<ndn::nfd::FaceStatus>& activeFaces)
467 {
468  NFD_LOG_DEBUG("Checking for invalid face registrations");
469 
470  FaceIdSet activeFaceIds;
471  for (const auto& faceStatus : activeFaces) {
472  activeFaceIds.insert(faceStatus.getFaceId());
473  }
474 
475  // Look for face IDs that were registered but not active to find missed
476  // face destroyed events
477  for (auto faceId : m_registeredFaces) {
478  if (activeFaceIds.count(faceId) == 0) {
479  NFD_LOG_DEBUG("Removing invalid face ID: " << faceId);
480  m_scheduler.scheduleEvent(0_ns, [this, faceId] { this->onFaceDestroyedEvent(faceId); });
481  }
482  }
483 
484  // Reschedule the check for future clean up
485  scheduleActiveFaceFetch(ACTIVE_FACE_FETCH_INTERVAL);
486 }
487 
488 void
489 RibManager::onNotification(const ndn::nfd::FaceEventNotification& notification)
490 {
491  NFD_LOG_TRACE("onNotification: " << notification);
492 
493  if (notification.getKind() == ndn::nfd::FACE_EVENT_DESTROYED) {
494  NFD_LOG_DEBUG("Received notification for destroyed faceId: " << notification.getFaceId());
495  m_scheduler.scheduleEvent(0_ns, [this, id = notification.getFaceId()] { onFaceDestroyedEvent(id); });
496  }
497 }
498 
499 } // namespace rib
500 } // namespace nfd
void start()
start or resume receiving notifications
void start(const ControlParameters &parameters, const CommandSucceedCallback &onSuccess, const CommandFailCallback &onFailure, const CommandOptions &options=CommandOptions())
start command execution
Definition: controller.hpp:78
void disableLocalhop()
Disallow accepting commands on /localhop/nfd/rib prefix.
Definition: rib-manager.cpp:85
a collection of common functions shared by all NFD managers and RIB manager, such as communicating wi...
represents the Routing Information Base
Definition: rib.hpp:59
void applyLocalhostConfig(const ConfigSection &section, const std::string &filename)
Apply localhost_security configuration.
Definition: rib-manager.cpp:72
void load(const std::string &filename)
represents a fib/add-nexthop command
The interface of signing key management.
Definition: key-chain.hpp:46
Serve commands and datasets in NFD RIB management protocol.
Definition: rib-manager.hpp:47
void beginApplyUpdate(const RibUpdate &update, const UpdateSuccessCallback &onSuccess, const UpdateFailureCallback &onFailure)
passes the provided RibUpdateBatch to FibUpdater to calculate and send FibUpdates.
Definition: rib.cpp:350
represents parameters in a ControlCommand request or response
represents a dispatcher on server side of NFD Management protocol
Definition: dispatcher.hpp:130
static time_point now() noexcept
Definition: time.cpp:80
std::ostream & operator<<(std::ostream &os, const FibUpdate &update)
Definition: fib-update.hpp:74
void extractRequester(const Interest &interest, ndn::mgmt::AcceptContinuation accept)
extract a requester from a ControlCommand request
Helper for validator that uses CommandInterest + Config policy and NetworkFetcher.
reply with a ControlResponse where StatusCode is 403
Route & setFlags(uint64_t flags)
Definition: rib-entry.cpp:75
RIB and FIB have been updated.
static const time::seconds ACTIVE_FACE_FETCH_INTERVAL
Definition: rib-manager.cpp:45
Route & setOrigin(RouteOrigin origin)
Definition: rib-entry.cpp:59
represents a Face status change notification
#define NFD_LOG_INFO
Definition: logger.hpp:39
uint64_t cost
Definition: route.hpp:83
uint64_t faceId
Definition: route.hpp:81
void enableLocalhop(const ConfigSection &section, const std::string &filename)
Apply localhop_security configuration and allow accepting commands on /localhop/nfd/rib prefix.
Definition: rib-manager.cpp:78
std::function< void(const std::string &requester)> AcceptContinuation
a function to be called if authorization is successful
Definition: dispatcher.hpp:45
represents a route in a RibEntry
Definition: rib-entry.hpp:42
optional< time::steady_clock::TimePoint > expires
Definition: route.hpp:85
signal::Signal< NotificationSubscriber, Notification > onNotification
fires when a Notification is received
Route & setCost(uint64_t cost)
Definition: rib-entry.cpp:67
std::enable_if_t< std::is_default_constructible< Dataset >::value > fetch(const std::function< void(typename Dataset::ResultType)> &onSuccess, const DatasetFailCallback &onFailure, const CommandOptions &options=CommandOptions())
start dataset fetching
Definition: controller.hpp:90
EventId scheduleEvent(time::nanoseconds after, const EventCallback &callback)
Schedule a one-time event after the specified delay.
Definition: scheduler.cpp:103
A prefix announcement object that represents an application's intent of registering a prefix toward i...
provides a tag type for simple types
Definition: tag.hpp:58
time::steady_clock::TimePoint annExpires
Expiration time of the prefix announcement.
Definition: route.hpp:101
optional< ndn::PrefixAnnouncement > announcement
The prefix announcement that caused the creation of this route.
Definition: route.hpp:91
ndn::nfd::RouteOrigin origin
Definition: route.hpp:82
void insert(const Name &prefix, const Route &route)
Definition: rib.cpp:98
mgmt::ControlResponse ControlResponse
std::function< void(SlAnnounceResult res)> SlAnnounceCallback
Definition: rib-manager.hpp:99
contains options for ControlCommand execution
std::function< void(RejectReply reply)> RejectContinuation
a function to be called if authorization is rejected
Definition: dispatcher.hpp:60
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
#define NFD_LOG_TRACE
Definition: logger.hpp:37
size_t wireEncode(EncodingImpl< TAG > &block) const
Definition: rib-entry.cpp:254
route does not exist (slRenew only)
void end()
end the response successfully after appending zero or more blocks
represents a route for a name prefix
Definition: route.hpp:43
void validate(const Data &data, const DataValidationSuccessCallback &successCb, const DataValidationFailureCallback &failureCb)
Asynchronously validate data.
Definition: validator.cpp:75
Provide a communication channel with local or remote NDN forwarder.
Definition: face.hpp:93
void addTopPrefix(const Name &prefix, bool wantRegister=true, const security::SigningInfo &signingInfo=security::SigningInfo())
add a top-level prefix
Definition: dispatcher.cpp:58
NFD Management protocol client.
Definition: controller.hpp:51
RibManager(Rib &rib, ndn::Face &face, ndn::KeyChain &keyChain, ndn::nfd::Controller &nfdController, Dispatcher &dispatcher, ndn::util::Scheduler &scheduler)
Definition: rib-manager.cpp:49
RibEntry & addRoute(const Route &route)
Definition: rib-entry.cpp:237
const Name & getAnnouncedName() const
Return announced name.
boost::property_tree::ptree ConfigSection
a config file section
void slAnnounce(const ndn::PrefixAnnouncement &pa, uint64_t faceId, time::milliseconds maxLifetime, const SlAnnounceCallback &cb)
Insert a route by prefix announcement from self-learning strategy.
Represents an absolute name.
Definition: name.hpp:43
static const std::string MGMT_MODULE_NAME
Definition: rib-manager.cpp:43
std::function< void(const ControlResponse &resp)> CommandContinuation
a function to be called after ControlCommandHandler completes
Definition: dispatcher.hpp:95
void setExpirationEvent(const ndn::util::scheduler::EventId &eid)
Definition: route.hpp:63
base class for a struct that contains ControlCommand parameters
represents a faces/update command
#define NFD_LOG_DEBUG
Definition: logger.hpp:38
static const int FIB_MAX_DEPTH
Maximum number of components in a FIB entry prefix.
void slFindAnn(const Name &name, const SlFindAnnCallback &cb) const
Retrieve an outgoing prefix announcement for self-learning strategy.
Validation error code and optional detailed error message.
void onRouteExpiration(const Name &prefix, const Route &route)
Definition: rib.cpp:201
static const Name LOCALHOST_TOP_PREFIX
Definition: rib-manager.cpp:44
std::function< void(optional< ndn::PrefixAnnouncement >)> SlFindAnnCallback
Route & setFaceId(uint64_t faceId)
Definition: rib-entry.cpp:51
void append(const Block &block)
append a Block to the response
represents a faces/list dataset
std::string to_string(const V &v)
Definition: backports.hpp:67
ControlCommand response.
const optional< Data > & getData() const
Get the Data representing the prefix announcement, if available.
provides a context for generating response to a StatusDataset request
uint64_t getFaceId() const
Definition: face-traits.hpp:47
#define NFD_LOG_INIT(name)
Definition: logger.hpp:31
void slRenew(const Name &name, uint64_t faceId, time::milliseconds maxLifetime, const SlAnnounceCallback &cb)
Renew a route created by prefix announcement from self-learning strategy.
Represents a Data packet.
Definition: data.hpp:35
Route & setExpirationPeriod(time::milliseconds expirationPeriod)
Definition: rib-entry.cpp:83
whether local fields are enabled on a face
RibEntry & setName(const Name &prefix)
Definition: rib-entry.cpp:229
static const Name LOCALHOP_TOP_PREFIX
std::function< void(const Name &prefix, const Interest &interest, const ControlParameters *params, const AcceptContinuation &accept, const RejectContinuation &reject)> Authorization
a function that performs authorization
Definition: dispatcher.hpp:77
void registerStatusDatasetHandler(const std::string &verb, const ndn::mgmt::StatusDatasetHandler &handler)
the announcement cannot be verified against the trust schema
represents an item in NFD RIB dataset
Definition: rib-entry.hpp:153
void enableLocalFields()
Enable NDNLP IncomingFaceId field in order to support self-registration commands.
const nullopt_t nullopt((nullopt_t::init()))
void registerWithNfd()
Start accepting commands and dataset requests.
Definition: rib-manager.cpp:91