Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2014 Named Data Networking Project |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
| 7 | #ifndef NFD_MGMT_STRATEGY_CHOICE_MANAGER_HPP |
| 8 | #define NFD_MGMT_STRATEGY_CHOICE_MANAGER_HPP |
| 9 | |
| 10 | #include "mgmt/manager-base.hpp" |
| 11 | |
Steve DiBenedetto | 7564d97 | 2014-03-24 14:28:46 -0600 | [diff] [blame] | 12 | #include <ndn-cpp-dev/management/nfd-control-parameters.hpp> |
Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 13 | |
| 14 | namespace nfd { |
| 15 | |
| 16 | const std::string STRATEGY_CHOICE_PRIVILEGE = "strategy-choice"; |
| 17 | |
| 18 | class StrategyChoice; |
| 19 | |
| 20 | class StrategyChoiceManager : public ManagerBase |
| 21 | { |
| 22 | public: |
| 23 | StrategyChoiceManager(StrategyChoice& strategyChoice, |
Steve DiBenedetto | 2c2b889 | 2014-02-27 11:46:48 -0700 | [diff] [blame] | 24 | shared_ptr<InternalFace> face); |
Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 25 | |
| 26 | virtual |
| 27 | ~StrategyChoiceManager(); |
| 28 | |
| 29 | void |
| 30 | onStrategyChoiceRequest(const Interest& request); |
| 31 | |
| 32 | PUBLIC_WITH_TESTS_ELSE_PRIVATE: |
| 33 | void |
| 34 | onValidatedStrategyChoiceRequest(const shared_ptr<const Interest>& request); |
| 35 | |
Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 36 | void |
Steve DiBenedetto | 7564d97 | 2014-03-24 14:28:46 -0600 | [diff] [blame] | 37 | setStrategy(const ControlParameters& parameters, |
Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 38 | ControlResponse& response); |
| 39 | |
| 40 | void |
Steve DiBenedetto | 7564d97 | 2014-03-24 14:28:46 -0600 | [diff] [blame] | 41 | unsetStrategy(const ControlParameters& parameters, |
Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 42 | ControlResponse& response); |
| 43 | private: |
| 44 | |
| 45 | StrategyChoice& m_strategyChoice; |
| 46 | |
| 47 | static const Name COMMAND_PREFIX; // /localhost/nfd/strategy-choice |
| 48 | |
| 49 | // number of components in an invalid, but not malformed, unsigned command. |
Steve DiBenedetto | 7564d97 | 2014-03-24 14:28:46 -0600 | [diff] [blame] | 50 | // (/localhost/nfd/strategy-choice + verb + parameters) = 5 |
Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 51 | static const size_t COMMAND_UNSIGNED_NCOMPS; |
| 52 | |
| 53 | // number of components in a valid signed Interest. |
| 54 | // (see UNSIGNED_NCOMPS), 9 with signed Interest support. |
| 55 | static const size_t COMMAND_SIGNED_NCOMPS; |
| 56 | |
| 57 | }; |
| 58 | |
| 59 | } // namespace nfd |
| 60 | |
| 61 | #endif // NFD_MGMT_STRATEGY_CHOICE_MANAGER_HPP |
| 62 | |