29 #include <ndn-cxx/mgmt/nfd/control-command.hpp>
30 #include <ndn-cxx/mgmt/nfd/control-response.hpp>
36 using ndn::nfd::ControlResponse;
40 const ndn::nfd::CommandOptions& options,
41 const ndn::nfd::ControlParameters& parameters)
42 : m_controller(controller)
43 , m_commandOptions(options)
44 , m_controlParameters(parameters)
47 if (name.isPrefixOf(m_commandOptions.getPrefix())) {
48 setAvailability(true);
52 m_ribEraseConn = rib.
afterEraseEntry.connect([
this] (
const Name& name) {
53 if (name.isPrefixOf(m_commandOptions.getPrefix())) {
54 setAvailability(false);
61 std::function<
void()> successCb,
62 std::function<
void(
const std::string&)> failureCb)
66 m_controller.start<ndn::nfd::RibRegisterCommand>(
68 [=] (
const ControlParameters&) { successCb(); },
69 [=] (
const ControlResponse& cr) { failureCb(cr.getText()); },
75 std::function<
void()> successCb,
76 std::function<
void(
const std::string&)> failureCb)
80 m_controller.start<ndn::nfd::RibUnregisterCommand>(
82 [=] (
const ControlParameters&) { successCb(); },
83 [=] (
const ControlResponse& cr) { failureCb(cr.getText()); },
void advertise(const ReadvertisedRoute &rr, std::function< void()> successCb, std::function< void(const std::string &)> failureCb) override
Add a name prefix into NFD RIB.
ndn::nfd::CommandOptions getCommandOptions() const
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))
ndn::nfd::ControlParameters getControlParameters() const
State of a readvertised route.
ndn::security::SigningInfo signer
signer for commands
Name prefix
readvertised prefix
Represents the Routing Information Base.
signal::Signal< Rib, Name > afterInsertEntry
Signals after a RIB entry is inserted.
signal::Signal< Rib, Name > afterEraseEntry
Signals after a RIB entry is erased.
#define NFD_LOG_INIT(name)