blob: e8da7c9f0199c122e28d77102e28c97b75eb5742 [file] [log] [blame]
Steve DiBenedetto042bfe92014-01-30 15:05:08 -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_MANAGER_BASE_HPP
8#define NFD_MGMT_MANAGER_BASE_HPP
9
10#include "common.hpp"
Steve DiBenedetto0b73f442014-02-05 22:02:03 -070011#include <ndn-cpp-dev/management/control-response.hpp>
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070012
13namespace nfd {
14
15class AppFace;
16
17class ManagerBase
18{
19public:
20 ManagerBase(shared_ptr<AppFace> face);
21
22 virtual
23 ~ManagerBase();
24
25protected:
26
Steve DiBenedetto3970c892014-01-31 23:31:13 -070027 void
Steve DiBenedetto0b73f442014-02-05 22:02:03 -070028 setResponse(ndn::ControlResponse& response,
29 uint32_t code,
30 const std::string& text);
31
32 void
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070033 sendResponse(const Name& name,
Steve DiBenedetto0b73f442014-02-05 22:02:03 -070034 const ndn::ControlResponse& response);
35
36 void
37 sendResponse(const Name& name,
38 uint32_t code,
39 const std::string& text);
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070040
41protected:
42 shared_ptr<AppFace> m_face;
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070043};
44
Steve DiBenedetto0b73f442014-02-05 22:02:03 -070045inline void
46ManagerBase::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 DiBenedetto042bfe92014-01-30 15:05:08 -070054
Steve DiBenedetto80ddc212014-02-01 22:23:56 -070055} // namespace nfd
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070056
57#endif // NFD_MGMT_MANAGER_BASE_HPP
58