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