blob: 223258826862c74bbd008fec96d83eb9c994bf01 [file] [log] [blame]
Steve DiBenedetto5330e0d2014-03-05 21:52:51 -07001/* -*- 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 DiBenedetto1d75f542014-03-15 19:21:44 -060012#include <ndn-cpp-dev/management/nfd-strategy-choice-options.hpp>
Steve DiBenedetto5330e0d2014-03-05 21:52:51 -070013
14namespace nfd {
15
16const std::string STRATEGY_CHOICE_PRIVILEGE = "strategy-choice";
17
18class StrategyChoice;
19
20class StrategyChoiceManager : public ManagerBase
21{
22public:
23 StrategyChoiceManager(StrategyChoice& strategyChoice,
Steve DiBenedetto2c2b8892014-02-27 11:46:48 -070024 shared_ptr<InternalFace> face);
Steve DiBenedetto5330e0d2014-03-05 21:52:51 -070025
26 virtual
27 ~StrategyChoiceManager();
28
29 void
30 onStrategyChoiceRequest(const Interest& request);
31
32PUBLIC_WITH_TESTS_ELSE_PRIVATE:
33 void
34 onValidatedStrategyChoiceRequest(const shared_ptr<const Interest>& request);
35
36 bool
37 extractOptions(const Interest& request,
Steve DiBenedetto1d75f542014-03-15 19:21:44 -060038 ndn::nfd::StrategyChoiceOptions& extractedOptions);
Steve DiBenedetto5330e0d2014-03-05 21:52:51 -070039
40
41
42 void
Steve DiBenedetto1d75f542014-03-15 19:21:44 -060043 setStrategy(const ndn::nfd::StrategyChoiceOptions& options,
Steve DiBenedetto5330e0d2014-03-05 21:52:51 -070044 ControlResponse& response);
45
46 void
Steve DiBenedetto1d75f542014-03-15 19:21:44 -060047 unsetStrategy(const ndn::nfd::StrategyChoiceOptions& options,
Steve DiBenedetto5330e0d2014-03-05 21:52:51 -070048 ControlResponse& response);
49private:
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