blob: e8d63cff3b4f3b68bc66b8f1cc5bb8b8924fcb9b [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"
Alexander Afanasyevd482fd32014-02-09 23:40:20 -080011#include <ndn-cpp-dev/management/nfd-control-response.hpp>
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070012
13namespace nfd {
14
Alexander Afanasyevd482fd32014-02-09 23:40:20 -080015using ndn::nfd::ControlResponse;
16
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070017class AppFace;
18
19class ManagerBase
20{
21public:
22 ManagerBase(shared_ptr<AppFace> face);
23
24 virtual
25 ~ManagerBase();
26
27protected:
28
Steve DiBenedetto3970c892014-01-31 23:31:13 -070029 void
Alexander Afanasyevd482fd32014-02-09 23:40:20 -080030 setResponse(ControlResponse& response,
Steve DiBenedetto0b73f442014-02-05 22:02:03 -070031 uint32_t code,
32 const std::string& text);
33
34 void
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070035 sendResponse(const Name& name,
Alexander Afanasyevd482fd32014-02-09 23:40:20 -080036 const ControlResponse& response);
Steve DiBenedetto0b73f442014-02-05 22:02:03 -070037
38 void
39 sendResponse(const Name& name,
40 uint32_t code,
41 const std::string& text);
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070042
43protected:
44 shared_ptr<AppFace> m_face;
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070045};
46
Steve DiBenedetto0b73f442014-02-05 22:02:03 -070047inline void
Alexander Afanasyevd482fd32014-02-09 23:40:20 -080048ManagerBase::setResponse(ControlResponse& response,
Steve DiBenedetto0b73f442014-02-05 22:02:03 -070049 uint32_t code,
50 const std::string& text)
51{
52 response.setCode(code);
53 response.setText(text);
54}
55
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070056
Steve DiBenedetto80ddc212014-02-01 22:23:56 -070057} // namespace nfd
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070058
59#endif // NFD_MGMT_MANAGER_BASE_HPP
60