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 | |
| 12 | #include <ndn-cpp-dev/management/nfd-fib-management-options.hpp> |
| 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, |
| 24 | shared_ptr<AppFace> face); |
| 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 | |
| 36 | bool |
| 37 | extractOptions(const Interest& request, |
| 38 | ndn::nfd::FibManagementOptions& extractedOptions); |
| 39 | |
| 40 | |
| 41 | |
| 42 | void |
| 43 | setStrategy(const ndn::nfd::FibManagementOptions& options, |
| 44 | ControlResponse& response); |
| 45 | |
| 46 | void |
| 47 | unsetStrategy(const ndn::nfd::FibManagementOptions& options, |
| 48 | ControlResponse& response); |
| 49 | private: |
| 50 | |
| 51 | StrategyChoice& m_strategyChoice; |
| 52 | |
| 53 | static const Name COMMAND_PREFIX; // /localhost/nfd/strategy-choice |
| 54 | |
| 55 | // number of components in an invalid, but not malformed, unsigned command. |
| 56 | // (/localhost/nfd/strategy-choice + verb + options) = 5 |
| 57 | static const size_t COMMAND_UNSIGNED_NCOMPS; |
| 58 | |
| 59 | // number of components in a valid signed Interest. |
| 60 | // (see UNSIGNED_NCOMPS), 9 with signed Interest support. |
| 61 | static const size_t COMMAND_SIGNED_NCOMPS; |
| 62 | |
| 63 | }; |
| 64 | |
| 65 | } // namespace nfd |
| 66 | |
| 67 | #endif // NFD_MGMT_STRATEGY_CHOICE_MANAGER_HPP |
| 68 | |