40 :
ManagerBase(
"strategy-choice", dispatcher, authenticator)
41 , m_table(strategyChoice)
43 registerCommandHandler<ndn::nfd::StrategyChoiceSetCommand>(
"set",
44 std::bind(&StrategyChoiceManager::setStrategy,
this, _4, _5));
45 registerCommandHandler<ndn::nfd::StrategyChoiceUnsetCommand>(
"unset",
46 std::bind(&StrategyChoiceManager::unsetStrategy,
this, _4, _5));
49 std::bind(&StrategyChoiceManager::listChoices,
this, _3));
61 NFD_LOG_DEBUG(
"strategy-choice/set(" << prefix <<
"," << strategy <<
"): cannot-create " << res);
65 NFD_LOG_DEBUG(
"strategy-choice/set(" << prefix <<
"," << strategy <<
"): OK");
66 bool hasEntry =
false;
68 std::tie(hasEntry, instanceName) = m_table.
get(prefix);
69 BOOST_ASSERT_MSG(hasEntry,
"StrategyChoice entry must exist after StrategyChoice::insert");
90 for (
const auto& i : m_table) {
93 .setStrategy(i.getStrategyInstanceName());
int getStatusCode() const
Get a status code for use in management command response.
NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED const Name & prefix
A collection of common functions shared by all NFD managers, such as communicating with the dispatche...
StrategyChoiceManager(strategy_choice::StrategyChoice &table, Dispatcher &dispatcher, CommandAuthenticator &authenticator)
#define NFD_LOG_INIT(name)
NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED const Name const Interest const ControlParameters const ndn::mgmt::CommandContinuation done
represents parameters in a ControlCommand request or response
represents a dispatcher on server side of NFD Management protocol
Implements the Strategy Choice Management of NFD Management Protocol.
void erase(const Name &prefix)
Make prefix to inherit strategy from its parent.
size_t wireEncode(EncodingImpl< TAG > &encoder) const
std::pair< bool, Name > get(const Name &prefix) const
Get strategy Name of prefix.
ControlParameters & setStrategy(const Name &strategy)
InsertResult insert(const Name &prefix, const Name &strategyName)
Set strategy of prefix to be strategyName.
const Name & getName() const
mgmt::ControlResponse ControlResponse
Copyright (c) 2011-2015 Regents of the University of California.
void end()
Finalizes the response successfully after appending zero or more blocks.
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Represents an absolute name.
std::function< void(const ControlResponse &resp)> CommandContinuation
a function to be called after ControlCommandHandler completes
void append(span< const uint8_t > bytes)
Appends a sequence of bytes to the response.
Provides ControlCommand authorization according to NFD configuration file.
Represents the Strategy Choice table.
NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED const Name const Interest const ControlParameters & parameters
represents an item in NFD StrategyChoice dataset
Provides a context for generating the response to a StatusDataset request.
const Name & getStrategy() const
void registerStatusDatasetHandler(const std::string &verb, const ndn::mgmt::StatusDatasetHandler &handler)
StrategyChoice & setName(const Name &name)