blob: 55787b6ec8a275ca0a459e87f209f761491aae2f [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#include "manager-base.hpp"
8#include "mgmt/app-face.hpp"
9
10#include <ndn-cpp-dev/management/control-response.hpp>
11
12namespace nfd {
13
Steve DiBenedetto3970c892014-01-31 23:31:13 -070014NFD_LOG_INIT("ManagerBase");
15
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070016ManagerBase::ManagerBase(shared_ptr<AppFace> face)
17 : m_face(face)
18{
19
20}
21
22ManagerBase::~ManagerBase()
23{
24
25}
26
27void
28ManagerBase::sendResponse(const Name& name,
29 uint32_t code,
30 const std::string& text)
31{
Steve DiBenedetto43cd0372014-02-01 17:05:07 -070032 ndn::ControlResponse control(code, text);
33 const Block& encodedControl = control.wireEncode();
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070034
Steve DiBenedetto43cd0372014-02-01 17:05:07 -070035 NFD_LOG_DEBUG("sending control response"
36 << " Name: " << name
37 << " code: " << code
38 << " text: " << text);
Steve DiBenedetto3970c892014-01-31 23:31:13 -070039
Steve DiBenedetto43cd0372014-02-01 17:05:07 -070040 Data response(name);
41 response.setContent(encodedControl);
Steve DiBenedetto3970c892014-01-31 23:31:13 -070042
Steve DiBenedettobdedce92014-02-02 22:49:39 -070043 m_face->sign(response);
Steve DiBenedetto43cd0372014-02-01 17:05:07 -070044 m_face->put(response);
Steve DiBenedetto042bfe92014-01-30 15:05:08 -070045}
46
47
48} // namespace nfd