29 #include <ndn-cxx/mgmt/nfd/control-command.hpp> 30 #include <ndn-cxx/mgmt/nfd/control-response.hpp> 37 using ndn::nfd::ControlResponse;
41 const ndn::nfd::CommandOptions& options,
42 const ndn::nfd::ControlParameters& parameters)
43 : m_controller(controller)
44 , m_commandOptions(options)
45 , m_controlParameters(parameters)
48 std::bind(&NfdRibReadvertiseDestination::handleRibInsert,
this, _1));
50 std::bind(&NfdRibReadvertiseDestination::handleRibErase,
this, _1));
55 std::function<
void()> successCb,
56 std::function<
void(
const std::string&)> failureCb)
60 m_controller.start<ndn::nfd::RibRegisterCommand>(
62 [=] (
const ControlParameters& cp) { successCb(); },
63 [=] (
const ControlResponse& cr) { failureCb(cr.getText()); },
69 std::function<
void()> successCb,
70 std::function<
void(
const std::string&)> failureCb)
74 m_controller.start<ndn::nfd::RibUnregisterCommand>(
76 [=] (
const ControlParameters& cp) { successCb(); },
77 [=] (
const ControlResponse& cr) { failureCb(cr.getText()); },
81 ndn::nfd::ControlParameters
84 return m_controlParameters;
87 ndn::nfd::CommandOptions
90 return m_commandOptions;
94 NfdRibReadvertiseDestination::handleRibInsert(
const ndn::Name& name)
96 if (name.isPrefixOf(m_commandOptions.getPrefix())) {
102 NfdRibReadvertiseDestination::handleRibErase(
const ndn::Name& name)
104 if (name.isPrefixOf(m_commandOptions.getPrefix())) {
void withdraw(const ReadvertisedRoute &rr, std::function< void()> successCb, std::function< void(const std::string &)> failureCb) override
remove a name prefix from NFD RIB
NfdRibReadvertiseDestination(ndn::nfd::Controller &controller, Rib &rib, const ndn::nfd::CommandOptions &options=ndn::nfd::CommandOptions(), const ndn::nfd::ControlParameters ¶meters=ndn::nfd::ControlParameters() .setOrigin(ndn::nfd::ROUTE_ORIGIN_CLIENT))
represents the Routing Information Base
signal::Signal< Rib, Name > afterEraseEntry
signals after a RIB entry is erased
signal::Signal< Rib, Name > afterInsertEntry
signals after a RIB entry is inserted
void setAvailability(bool isAvailable)
state of a readvertised route
Name prefix
readvertised prefix
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
ndn::nfd::CommandOptions getCommandOptions()
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)
ndn::nfd::ControlParameters getControlParameters()