Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Alexander Afanasyev | 9bcbc7c | 2014-04-06 19:37:37 -0700 | [diff] [blame] | 3 | * Copyright (c) 2014 Regents of the University of California, |
| 4 | * Arizona Board of Regents, |
| 5 | * Colorado State University, |
| 6 | * University Pierre & Marie Curie, Sorbonne University, |
| 7 | * Washington University in St. Louis, |
| 8 | * Beijing Institute of Technology |
| 9 | * |
| 10 | * This file is part of NFD (Named Data Networking Forwarding Daemon). |
| 11 | * See AUTHORS.md for complete list of NFD authors and contributors. |
| 12 | * |
| 13 | * NFD is free software: you can redistribute it and/or modify it under the terms |
| 14 | * of the GNU General Public License as published by the Free Software Foundation, |
| 15 | * either version 3 of the License, or (at your option) any later version. |
| 16 | * |
| 17 | * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 18 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 19 | * PURPOSE. See the GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License along with |
| 22 | * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 23 | **/ |
Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 24 | |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 25 | #ifndef NFD_DAEMON_MGMT_STRATEGY_CHOICE_MANAGER_HPP |
| 26 | #define NFD_DAEMON_MGMT_STRATEGY_CHOICE_MANAGER_HPP |
Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 27 | |
| 28 | #include "mgmt/manager-base.hpp" |
| 29 | |
Alexander Afanasyev | 4a77136 | 2014-04-24 21:29:33 -0700 | [diff] [blame] | 30 | #include <ndn-cxx/management/nfd-control-parameters.hpp> |
Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 31 | |
| 32 | namespace nfd { |
| 33 | |
| 34 | const std::string STRATEGY_CHOICE_PRIVILEGE = "strategy-choice"; |
| 35 | |
| 36 | class StrategyChoice; |
| 37 | |
| 38 | class StrategyChoiceManager : public ManagerBase |
| 39 | { |
| 40 | public: |
| 41 | StrategyChoiceManager(StrategyChoice& strategyChoice, |
Steve DiBenedetto | 2c2b889 | 2014-02-27 11:46:48 -0700 | [diff] [blame] | 42 | shared_ptr<InternalFace> face); |
Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 43 | |
| 44 | virtual |
| 45 | ~StrategyChoiceManager(); |
| 46 | |
| 47 | void |
| 48 | onStrategyChoiceRequest(const Interest& request); |
| 49 | |
| 50 | PUBLIC_WITH_TESTS_ELSE_PRIVATE: |
| 51 | void |
| 52 | onValidatedStrategyChoiceRequest(const shared_ptr<const Interest>& request); |
| 53 | |
Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 54 | void |
Steve DiBenedetto | 51d242a | 2014-03-31 13:46:43 -0600 | [diff] [blame] | 55 | setStrategy(ControlParameters& parameters, |
Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 56 | ControlResponse& response); |
| 57 | |
| 58 | void |
Steve DiBenedetto | 51d242a | 2014-03-31 13:46:43 -0600 | [diff] [blame] | 59 | unsetStrategy(ControlParameters& parameters, |
Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 60 | ControlResponse& response); |
Steve DiBenedetto | 51d242a | 2014-03-31 13:46:43 -0600 | [diff] [blame] | 61 | |
Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 62 | private: |
| 63 | |
| 64 | StrategyChoice& m_strategyChoice; |
| 65 | |
| 66 | static const Name COMMAND_PREFIX; // /localhost/nfd/strategy-choice |
| 67 | |
| 68 | // number of components in an invalid, but not malformed, unsigned command. |
Steve DiBenedetto | 7564d97 | 2014-03-24 14:28:46 -0600 | [diff] [blame] | 69 | // (/localhost/nfd/strategy-choice + verb + parameters) = 5 |
Steve DiBenedetto | 5330e0d | 2014-03-05 21:52:51 -0700 | [diff] [blame] | 70 | static const size_t COMMAND_UNSIGNED_NCOMPS; |
| 71 | |
| 72 | // number of components in a valid signed Interest. |
| 73 | // (see UNSIGNED_NCOMPS), 9 with signed Interest support. |
| 74 | static const size_t COMMAND_SIGNED_NCOMPS; |
| 75 | |
| 76 | }; |
| 77 | |
| 78 | } // namespace nfd |
| 79 | |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 80 | #endif // NFD_DAEMON_MGMT_STRATEGY_CHOICE_MANAGER_HPP |