Steve DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -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_MANAGER_BASE_HPP |
| 8 | #define NFD_MGMT_MANAGER_BASE_HPP |
| 9 | |
| 10 | #include "common.hpp" |
Steve DiBenedetto | 0b73f44 | 2014-02-05 22:02:03 -0700 | [diff] [blame^] | 11 | #include <ndn-cpp-dev/management/control-response.hpp> |
Steve DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -0700 | [diff] [blame] | 12 | |
| 13 | namespace nfd { |
| 14 | |
| 15 | class AppFace; |
| 16 | |
| 17 | class ManagerBase |
| 18 | { |
| 19 | public: |
| 20 | ManagerBase(shared_ptr<AppFace> face); |
| 21 | |
| 22 | virtual |
| 23 | ~ManagerBase(); |
| 24 | |
| 25 | protected: |
| 26 | |
Steve DiBenedetto | 3970c89 | 2014-01-31 23:31:13 -0700 | [diff] [blame] | 27 | void |
Steve DiBenedetto | 0b73f44 | 2014-02-05 22:02:03 -0700 | [diff] [blame^] | 28 | setResponse(ndn::ControlResponse& response, |
| 29 | uint32_t code, |
| 30 | const std::string& text); |
| 31 | |
| 32 | void |
Steve DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -0700 | [diff] [blame] | 33 | sendResponse(const Name& name, |
Steve DiBenedetto | 0b73f44 | 2014-02-05 22:02:03 -0700 | [diff] [blame^] | 34 | const ndn::ControlResponse& response); |
| 35 | |
| 36 | void |
| 37 | sendResponse(const Name& name, |
| 38 | uint32_t code, |
| 39 | const std::string& text); |
Steve DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -0700 | [diff] [blame] | 40 | |
| 41 | protected: |
| 42 | shared_ptr<AppFace> m_face; |
Steve DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -0700 | [diff] [blame] | 43 | }; |
| 44 | |
Steve DiBenedetto | 0b73f44 | 2014-02-05 22:02:03 -0700 | [diff] [blame^] | 45 | inline void |
| 46 | ManagerBase::setResponse(ndn::ControlResponse& response, |
| 47 | uint32_t code, |
| 48 | const std::string& text) |
| 49 | { |
| 50 | response.setCode(code); |
| 51 | response.setText(text); |
| 52 | } |
| 53 | |
Steve DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -0700 | [diff] [blame] | 54 | |
Steve DiBenedetto | 80ddc21 | 2014-02-01 22:23:56 -0700 | [diff] [blame] | 55 | } // namespace nfd |
Steve DiBenedetto | 042bfe9 | 2014-01-30 15:05:08 -0700 | [diff] [blame] | 56 | |
| 57 | #endif // NFD_MGMT_MANAGER_BASE_HPP |
| 58 | |