blob: c79a2ac549acb5baad38ed7bcfa68277147ec687 [file] [log] [blame]
Steve DiBenedetto5330e0d2014-03-05 21:52:51 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -07003 * 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 DiBenedetto5330e0d2014-03-05 21:52:51 -070024
25#ifndef NFD_MGMT_STRATEGY_CHOICE_MANAGER_HPP
26#define NFD_MGMT_STRATEGY_CHOICE_MANAGER_HPP
27
28#include "mgmt/manager-base.hpp"
29
Steve DiBenedetto7564d972014-03-24 14:28:46 -060030#include <ndn-cpp-dev/management/nfd-control-parameters.hpp>
Steve DiBenedetto5330e0d2014-03-05 21:52:51 -070031
32namespace nfd {
33
34const std::string STRATEGY_CHOICE_PRIVILEGE = "strategy-choice";
35
36class StrategyChoice;
37
38class StrategyChoiceManager : public ManagerBase
39{
40public:
41 StrategyChoiceManager(StrategyChoice& strategyChoice,
Steve DiBenedetto2c2b8892014-02-27 11:46:48 -070042 shared_ptr<InternalFace> face);
Steve DiBenedetto5330e0d2014-03-05 21:52:51 -070043
44 virtual
45 ~StrategyChoiceManager();
46
47 void
48 onStrategyChoiceRequest(const Interest& request);
49
50PUBLIC_WITH_TESTS_ELSE_PRIVATE:
51 void
52 onValidatedStrategyChoiceRequest(const shared_ptr<const Interest>& request);
53
Steve DiBenedetto5330e0d2014-03-05 21:52:51 -070054 void
Steve DiBenedetto51d242a2014-03-31 13:46:43 -060055 setStrategy(ControlParameters& parameters,
Steve DiBenedetto5330e0d2014-03-05 21:52:51 -070056 ControlResponse& response);
57
58 void
Steve DiBenedetto51d242a2014-03-31 13:46:43 -060059 unsetStrategy(ControlParameters& parameters,
Steve DiBenedetto5330e0d2014-03-05 21:52:51 -070060 ControlResponse& response);
Steve DiBenedetto51d242a2014-03-31 13:46:43 -060061
Steve DiBenedetto5330e0d2014-03-05 21:52:51 -070062private:
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 DiBenedetto7564d972014-03-24 14:28:46 -060069 // (/localhost/nfd/strategy-choice + verb + parameters) = 5
Steve DiBenedetto5330e0d2014-03-05 21:52:51 -070070 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
80#endif // NFD_MGMT_STRATEGY_CHOICE_MANAGER_HPP