29 #include <ndn-cxx/mgmt/nfd/command-options.hpp> 30 #include <ndn-cxx/mgmt/nfd/control-command.hpp> 31 #include <ndn-cxx/mgmt/nfd/control-parameters.hpp> 32 #include <ndn-cxx/mgmt/nfd/control-response.hpp> 39 using ndn::nfd::CommandOptions;
40 using ndn::nfd::ControlParameters;
41 using ndn::nfd::ControlResponse;
44 const Name& commandPrefix,
46 : m_controller(controller)
47 , m_commandPrefix(commandPrefix)
50 std::bind(&NfdRibReadvertiseDestination::handleRibInsert,
this, _1));
52 std::bind(&NfdRibReadvertiseDestination::handleRibErase,
this, _1));
57 std::function<
void()> successCb,
58 std::function<
void(
const std::string&)> failureCb)
62 m_controller.start<ndn::nfd::RibRegisterCommand>(
63 ControlParameters().setName(rr.
prefix).setOrigin(ndn::nfd::ROUTE_ORIGIN_CLIENT),
64 [=] (
const ControlParameters& cp) { successCb(); },
65 [=] (
const ControlResponse& cr) { failureCb(cr.getText()); },
66 CommandOptions().setPrefix(m_commandPrefix).setSigningInfo(rr.
signer));
71 std::function<
void()> successCb,
72 std::function<
void(
const std::string&)> failureCb)
76 m_controller.start<ndn::nfd::RibUnregisterCommand>(
77 ControlParameters().setName(rr.
prefix).setOrigin(ndn::nfd::ROUTE_ORIGIN_CLIENT),
78 [=] (
const ControlParameters& cp) { successCb(); },
79 [=] (
const ControlResponse& cr) { failureCb(cr.getText()); },
80 CommandOptions().setPrefix(m_commandPrefix).setSigningInfo(rr.
signer));
84 NfdRibReadvertiseDestination::handleRibInsert(
const ndn::Name& name)
86 if (name.isPrefixOf(m_commandPrefix)) {
92 NfdRibReadvertiseDestination::handleRibErase(
const ndn::Name& name)
94 if (name.isPrefixOf(m_commandPrefix)) {
void withdraw(const ReadvertisedRoute &rr, std::function< void()> successCb, std::function< void(const std::string &)> failureCb) override
remove a name prefix from NFD RIB
represents the Routing Information Base
#define NFD_LOG_DEBUG(expression)
void setAvailability(bool isAvailable)
state of a readvertised route
Name prefix
readvertised prefix
ndn::util::signal::Signal< Rib, Name > afterEraseEntry
signals after a RIB entry is erased
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
ndn::security::SigningInfo signer
signer for commands
void advertise(const ReadvertisedRoute &rr, std::function< void()> successCb, std::function< void(const std::string &)> failureCb) override
add a name prefix into NFD RIB
#define NFD_LOG_INIT(name)
NfdRibReadvertiseDestination(ndn::nfd::Controller &controller, const Name &commandPrefix, Rib &rib)
ndn::util::signal::Signal< Rib, Name > afterInsertEntry
signals after a RIB entry is inserted