mgmt: loosened coupling between FibManager and InternalFace
Implemented InternalFace.setInterestFilter to loosen
coupling
refs: #1138
Change-Id: Ie58daed35bc3613398c8d3fc1de8b796e29907b8
diff --git a/daemon/mgmt/manager-base.cpp b/daemon/mgmt/manager-base.cpp
index 1802018..5e561ff 100644
--- a/daemon/mgmt/manager-base.cpp
+++ b/daemon/mgmt/manager-base.cpp
@@ -11,6 +11,8 @@
namespace nfd {
+NFD_LOG_INIT("ManagerBase");
+
ManagerBase::ManagerBase(shared_ptr<AppFace> face)
: m_face(face)
{
@@ -27,10 +29,47 @@
uint32_t code,
const std::string& text)
{
- Data response(name);
+ // Path 1 - runtime exception on receive's wireDecode.
+ // Set Data response's content payload to the
+ // encoded Block.
+ {
+ ndn::ControlResponse control(code, text);
+ const Block& encodedControl = control.wireEncode();
- response.setContent(ndn::ControlResponse(code, text).wireEncode());
- m_face->put(response);
+ NFD_LOG_DEBUG("sending control response (Path 1)"
+ << " Name: " << name
+ << " code: " << code
+ << " text: " << text);
+
+ NFD_LOG_DEBUG("sending raw control block size = " << encodedControl.size());
+
+ Data response(name);
+ response.setContent(encodedControl);
+
+ m_face->put(response);
+ }
+
+ // Path 2 - works, but not conformant to protocol.
+ // Encode ControlResponse and append Block as
+ // the last component of the name.
+ // {
+ // ndn::ControlResponse control(code, text);
+ // const Block& encodedControl = control.wireEncode();
+
+ // NFD_LOG_DEBUG("sending control response (Path 2)"
+ // << " Name: " << name
+ // << " code: " << code
+ // << " text: " << text);
+
+ // NFD_LOG_DEBUG("sending raw control block size = " << encodedControl.size());
+
+ // Name responseName(name);
+ // responseName.append(encodedControl);
+
+ // Data response(responseName);
+ // m_face->put(response);
+ // }
+
}