diff --git a/daemon/table/name-tree-entry.cpp b/daemon/table/name-tree-entry.cpp
index 40e19c8..673be47 100644
--- a/daemon/table/name-tree-entry.cpp
+++ b/daemon/table/name-tree-entry.cpp
@@ -99,5 +99,11 @@
   return true;
 }
 
+void
+Entry::setStrategyChoiceEntry(shared_ptr<strategy_choice::Entry> strategyChoiceEntry)
+{
+  m_strategyChoiceEntry = strategyChoiceEntry;
+}
+
 } // namespace name_tree
 } // namespace nfd
diff --git a/daemon/table/name-tree-entry.hpp b/daemon/table/name-tree-entry.hpp
index cef42ff..1708dbf 100644
--- a/daemon/table/name-tree-entry.hpp
+++ b/daemon/table/name-tree-entry.hpp
@@ -13,6 +13,7 @@
 #include "table/fib-entry.hpp"
 #include "table/pit-entry.hpp"
 #include "table/measurements-entry.hpp"
+#include "table/strategy-choice-entry.hpp"
 
 namespace nfd {
 
@@ -106,6 +107,12 @@
   bool
   eraseMeasurementsEntry(shared_ptr<measurements::Entry> measurements);
 
+  void
+  setStrategyChoiceEntry(shared_ptr<strategy_choice::Entry> strategyChoiceEntry);
+
+  shared_ptr<strategy_choice::Entry>
+  getStrategyChoiceEntry() const;
+
 private:
   uint32_t m_hash;
   Name m_prefix;
@@ -114,6 +121,7 @@
   shared_ptr<fib::Entry> m_fibEntry;
   std::vector<shared_ptr<pit::Entry> > m_pitEntries;
   shared_ptr<measurements::Entry> m_measurementsEntry;
+  shared_ptr<strategy_choice::Entry> m_strategyChoiceEntry;
 
   // get the Name Tree Node that is associated with this Name Tree Entry
   Node* m_node;
@@ -170,6 +178,12 @@
   return m_measurementsEntry;
 }
 
+inline shared_ptr<strategy_choice::Entry>
+Entry::getStrategyChoiceEntry() const
+{
+  return m_strategyChoiceEntry;
+}
+
 } // namespace name_tree
 } // namespace nfd
 
diff --git a/daemon/table/strategy-choice-entry.cpp b/daemon/table/strategy-choice-entry.cpp
new file mode 100644
index 0000000..9d3f218
--- /dev/null
+++ b/daemon/table/strategy-choice-entry.cpp
@@ -0,0 +1,25 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "strategy-choice-entry.hpp"
+
+namespace nfd {
+namespace strategy_choice {
+
+Entry::Entry(const Name& prefix)
+  : m_prefix(prefix)
+{
+}
+
+void
+Entry::setStrategy(shared_ptr<fw::Strategy> strategy)
+{
+  BOOST_ASSERT(static_cast<bool>(strategy));
+  m_strategy = strategy;
+}
+
+} // namespace strategy_choice
+} // namespace nfd
diff --git a/daemon/table/strategy-choice-entry.hpp b/daemon/table/strategy-choice-entry.hpp
new file mode 100644
index 0000000..f1b8c7a
--- /dev/null
+++ b/daemon/table/strategy-choice-entry.hpp
@@ -0,0 +1,66 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NFD_TABLE_STRATEGY_CHOICE_ENTRY_HPP
+#define NFD_TABLE_STRATEGY_CHOICE_ENTRY_HPP
+
+#include "common.hpp"
+
+namespace nfd {
+
+class NameTree;
+namespace name_tree {
+class Entry;
+}
+namespace fw {
+class Strategy;
+}
+
+namespace strategy_choice {
+
+/** \brief represents a Strategy Choice entry
+ */
+class Entry : noncopyable
+{
+public:
+  Entry(const Name& prefix);
+
+  const Name&
+  getPrefix() const;
+
+  fw::Strategy&
+  getStrategy() const;
+
+  void
+  setStrategy(shared_ptr<fw::Strategy> strategy);
+
+private:
+  Name m_prefix;
+  shared_ptr<fw::Strategy> m_strategy;
+
+  shared_ptr<name_tree::Entry> m_nameTreeEntry;
+  friend class nfd::NameTree;
+  friend class nfd::name_tree::Entry;
+};
+
+
+inline const Name&
+Entry::getPrefix() const
+{
+  return m_prefix;
+}
+
+inline fw::Strategy&
+Entry::getStrategy() const
+{
+  BOOST_ASSERT(static_cast<bool>(m_strategy));
+  return *m_strategy;
+}
+
+} // namespace strategy_choice
+} // namespace nfd
+
+#endif // NFD_TABLE_STRATEGY_CHOICE_ENTRY_HPP
diff --git a/daemon/table/strategy-choice.cpp b/daemon/table/strategy-choice.cpp
new file mode 100644
index 0000000..9e5cb37
--- /dev/null
+++ b/daemon/table/strategy-choice.cpp
@@ -0,0 +1,178 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "strategy-choice.hpp"
+#include "fw/strategy.hpp"
+#include "pit-entry.hpp"
+
+namespace nfd {
+
+using strategy_choice::Entry;
+using fw::Strategy;
+
+NFD_LOG_INIT("StrategyChoice");
+
+StrategyChoice::StrategyChoice(NameTree& nameTree, shared_ptr<Strategy> defaultStrategy)
+  : m_nameTree(nameTree)
+{
+  this->setDefaultStrategy(defaultStrategy);
+}
+
+bool
+StrategyChoice::hasStrategy(const Name& strategyName) const
+{
+  return m_strategyInstances.count(strategyName) > 0;
+}
+
+bool
+StrategyChoice::install(shared_ptr<Strategy> strategy)
+{
+  BOOST_ASSERT(static_cast<bool>(strategy));
+  const Name& strategyName = strategy->getName();
+
+  if (this->hasStrategy(strategyName)) {
+    NFD_LOG_ERROR("install(" << strategyName << ") duplicate strategyName");
+    return false;
+  }
+
+  m_strategyInstances[strategyName] = strategy;
+  return true;
+}
+
+bool
+StrategyChoice::insert(const Name& prefix, const Name& strategyName)
+{
+  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.lookup(prefix);
+  shared_ptr<Entry> entry = nameTreeEntry->getStrategyChoiceEntry();
+  shared_ptr<Strategy> oldStrategy;
+
+  if (static_cast<bool>(entry)) {
+    if (entry->getStrategy().getName() == strategyName) {
+      NFD_LOG_INFO("insert(" << prefix << "," << strategyName << ") not changing");
+      return true;
+    }
+    oldStrategy = entry->getStrategy().shared_from_this();
+    NFD_LOG_INFO("insert(" << prefix << "," << strategyName << ") "
+                 "changing from " << oldStrategy->getName());
+  }
+
+  shared_ptr<Strategy> strategy = this->getStrategy(strategyName);
+  if (!static_cast<bool>(strategy)) {
+    NFD_LOG_ERROR("insert(" << prefix << "," << strategyName << ") strategy not installed");
+    return false;
+  }
+
+  if (!static_cast<bool>(entry)) {
+    oldStrategy = this->findEffectiveStrategy(prefix).shared_from_this();
+    entry = make_shared<Entry>(prefix);
+    nameTreeEntry->setStrategyChoiceEntry(entry);
+    ++m_nItems;
+    NFD_LOG_INFO("insert(" << prefix << "," << strategyName << ") new entry");
+  }
+
+  this->changeStrategy(entry, oldStrategy, strategy);
+  return true;
+}
+
+void
+StrategyChoice::erase(const Name& prefix)
+{
+  BOOST_ASSERT(prefix.size() > 0);
+
+  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.findExactMatch(prefix);
+  if (!static_cast<bool>(nameTreeEntry)) {
+    return;
+  }
+
+  shared_ptr<Entry> entry = nameTreeEntry->getStrategyChoiceEntry();
+  if (!static_cast<bool>(entry)) {
+    return;
+  }
+
+  Strategy& oldStrategy = entry->getStrategy();
+  nameTreeEntry->setStrategyChoiceEntry(shared_ptr<Entry>());
+  --m_nItems;
+
+  Strategy& parentStrategy = this->findEffectiveStrategy(prefix);
+  this->changeStrategy(entry, oldStrategy.shared_from_this(), parentStrategy.shared_from_this());
+}
+
+shared_ptr<const Name>
+StrategyChoice::get(const Name& prefix) const
+{
+  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.findExactMatch(prefix);
+  if (!static_cast<bool>(nameTreeEntry)) {
+    return shared_ptr<const Name>();
+  }
+
+  shared_ptr<Entry> entry = nameTreeEntry->getStrategyChoiceEntry();
+  if (!static_cast<bool>(entry)) {
+    return shared_ptr<const Name>();
+  }
+
+  return entry->getStrategy().getName().shared_from_this();
+}
+
+static inline bool
+predicate_NameTreeEntry_hasStrategyChoiceEntry(const name_tree::Entry& entry)
+{
+  return static_cast<bool>(entry.getStrategyChoiceEntry());
+}
+
+Strategy&
+StrategyChoice::findEffectiveStrategy(const Name& prefix) const
+{
+  shared_ptr<name_tree::Entry> nameTreeEntry =
+    m_nameTree.findLongestPrefixMatch(prefix, &predicate_NameTreeEntry_hasStrategyChoiceEntry);
+  BOOST_ASSERT(static_cast<bool>(nameTreeEntry));
+  return nameTreeEntry->getStrategyChoiceEntry()->getStrategy();
+}
+
+Strategy&
+StrategyChoice::findEffectiveStrategy(const pit::Entry& pitEntry) const
+{
+  return this->findEffectiveStrategy(pitEntry.getName());
+}
+
+shared_ptr<fw::Strategy>
+StrategyChoice::getStrategy(const Name& strategyName)
+{
+  StrategyInstanceTable::iterator it = m_strategyInstances.find(strategyName);
+  return it != m_strategyInstances.end() ? it->second : shared_ptr<fw::Strategy>();
+}
+
+void
+StrategyChoice::setDefaultStrategy(shared_ptr<Strategy> strategy)
+{
+  this->install(strategy);
+
+  // don't use .insert here, because it will invoke findEffectiveStrategy
+  // which expects an existing root entry
+  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.lookup(Name());
+  shared_ptr<Entry> entry = make_shared<Entry>(Name());
+  nameTreeEntry->setStrategyChoiceEntry(entry);
+  ++m_nItems;
+  NFD_LOG_INFO("setDefaultStrategy(" << strategy->getName() << ") new entry");
+
+  entry->setStrategy(strategy);
+}
+
+void
+StrategyChoice::changeStrategy(shared_ptr<strategy_choice::Entry> entry,
+                               shared_ptr<fw::Strategy> oldStrategy,
+                               shared_ptr<fw::Strategy> newStrategy)
+{
+  entry->setStrategy(newStrategy);
+  if (oldStrategy == newStrategy) {
+    return;
+  }
+
+  // TODO delete incompatible StrategyInfo
+  NFD_LOG_WARN("changeStrategy(" << entry->getPrefix() << ") " <<
+               "runtime strategy change not implemented");
+}
+
+} // namespace nfd
diff --git a/daemon/table/strategy-choice.hpp b/daemon/table/strategy-choice.hpp
new file mode 100644
index 0000000..7624dd4
--- /dev/null
+++ b/daemon/table/strategy-choice.hpp
@@ -0,0 +1,94 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NFD_TABLE_STRATEGY_CHOICE_HPP
+#define NFD_TABLE_STRATEGY_CHOICE_HPP
+
+#include "strategy-choice-entry.hpp"
+#include "name-tree.hpp"
+
+namespace nfd {
+
+class StrategyChoice : noncopyable
+{
+public:
+  StrategyChoice(NameTree& nameTree, shared_ptr<fw::Strategy> defaultStrategy);
+
+public: // available Strategy types
+  /** \return true if strategy is installed
+   */
+  bool
+  hasStrategy(const Name& strategyName) const;
+
+  /** \brief install a strategy
+   *  \return true if installed; false if not installed due to duplicate strategyName
+   */
+  bool
+  install(shared_ptr<fw::Strategy> strategy);
+
+public: // Strategy Choice table
+  /** \brief set strategy of prefix to be strategyName
+   *  \param strategyName the strategy to be used, must be installed
+   *  \return true on success
+   */
+  bool
+  insert(const Name& prefix, const Name& strategyName);
+
+  /** \brief make prefix to inherit strategy from its parent
+   *
+   *  not allowed for root prefix (ndn:/)
+   */
+  void
+  erase(const Name& prefix);
+
+  /** \brief get strategy Name of prefix
+   *  \return strategyName at exact match, or nullptr
+   */
+  shared_ptr<const Name>
+  get(const Name& prefix) const;
+
+public: // effect strategy
+  /// get effective strategy for prefix
+  fw::Strategy&
+  findEffectiveStrategy(const Name& prefix) const;
+
+  /// get effective strategy for pitEntry
+  fw::Strategy&
+  findEffectiveStrategy(const pit::Entry& pitEntry) const;
+
+  /// number of entries stored
+  size_t
+  size() const;
+
+private:
+  shared_ptr<fw::Strategy>
+  getStrategy(const Name& strategyName);
+
+  void
+  setDefaultStrategy(shared_ptr<fw::Strategy> strategy);
+
+  void
+  changeStrategy(shared_ptr<strategy_choice::Entry> entry,
+                 shared_ptr<fw::Strategy> oldStrategy,
+                 shared_ptr<fw::Strategy> newStrategy);
+
+private:
+  NameTree& m_nameTree;
+  size_t m_nItems;
+
+  typedef std::map<Name, shared_ptr<fw::Strategy> > StrategyInstanceTable;
+  StrategyInstanceTable m_strategyInstances;
+};
+
+inline size_t
+StrategyChoice::size() const
+{
+  return m_nItems;
+}
+
+} // namespace nfd
+
+#endif // NFD_TABLE_STRATEGY_CHOICE_HPP
