mgmt: publish Strategy Choice dataset
refs: #1632
Change-Id: I4ed09d191433fd80071367e7b2ffcd2ac81c5c17
diff --git a/daemon/mgmt/strategy-choice-manager.cpp b/daemon/mgmt/strategy-choice-manager.cpp
index 261358a..b51badc 100644
--- a/daemon/mgmt/strategy-choice-manager.cpp
+++ b/daemon/mgmt/strategy-choice-manager.cpp
@@ -5,7 +5,8 @@
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
* Washington University in St. Louis,
- * Beijing Institute of Technology
+ * Beijing Institute of Technology,
+ * The University of Memphis
*
* This file is part of NFD (Named Data Networking Forwarding Daemon).
* See AUTHORS.md for complete list of NFD authors and contributors.
@@ -42,10 +43,13 @@
StrategyChoiceManager::COMMAND_UNSIGNED_NCOMPS +
4; // (timestamp, nonce, signed info tlv, signature tlv)
+const Name StrategyChoiceManager::LIST_DATASET_PREFIX("/localhost/nfd/strategy-choice/list");
+
StrategyChoiceManager::StrategyChoiceManager(StrategyChoice& strategyChoice,
shared_ptr<InternalFace> face)
: ManagerBase(face, STRATEGY_CHOICE_PRIVILEGE)
, m_strategyChoice(strategyChoice)
+ , m_listPublisher(strategyChoice, m_face, LIST_DATASET_PREFIX)
{
face->setInterestFilter("/localhost/nfd/strategy-choice",
bind(&StrategyChoiceManager::onStrategyChoiceRequest, this, _2));
@@ -62,6 +66,12 @@
const Name& command = request.getName();
const size_t commandNComps = command.size();
+ if (command == LIST_DATASET_PREFIX)
+ {
+ listStrategies(request);
+ return;
+ }
+
if (COMMAND_UNSIGNED_NCOMPS <= commandNComps &&
commandNComps < COMMAND_SIGNED_NCOMPS)
{
@@ -84,6 +94,12 @@
}
void
+StrategyChoiceManager::listStrategies(const Interest& request)
+{
+ m_listPublisher.publish();
+}
+
+void
StrategyChoiceManager::onValidatedStrategyChoiceRequest(const shared_ptr<const Interest>& request)
{
static const Name::Component VERB_SET("set");