41 , m_table(strategyChoice)
43 registerCommandHandler<ndn::nfd::StrategyChoiceSetCommand>(
"set",
44 bind(&StrategyChoiceManager::setStrategy,
this, _4, _5));
45 registerCommandHandler<ndn::nfd::StrategyChoiceUnsetCommand>(
"unset",
46 bind(&StrategyChoiceManager::unsetStrategy,
this, _4, _5));
49 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");
78 const Name& prefix = parameters.getName();
81 m_table.
erase(parameters.getName());
90 for (
const auto& i : m_table) {
93 .setStrategy(i.getStrategyInstanceName());
int getStatusCode() const
get a status code for use in management command response
StrategyChoiceManager(strategy_choice::StrategyChoice &table, Dispatcher &dispatcher, CommandAuthenticator &authenticator)
represents parameters in a ControlCommand request or response
represents a dispatcher on server side of NFD Management protocol
implement 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()
end 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
Provides ControlCommand authorization according to NFD configuration file.
represents the Strategy Choice table
void append(const Block &block)
append a Block to the response
represents an item in NFD StrategyChoice dataset
provides a context for generating response to a StatusDataset request
a collection of common functions shared by all NFD managers, such as communicating with the dispatche...
#define NFD_LOG_INIT(name)
const Name & getStrategy() const
void registerStatusDatasetHandler(const std::string &verb, const ndn::mgmt::StatusDatasetHandler &handler)
StrategyChoice & setName(const Name &name)