face: Update code to work with updated LocalControlHeader implementation
Change-Id: I3a73269ad30cfd8d7e366115aae08728f17c3b17
Refs: #2183
diff --git a/daemon/face/local-face.hpp b/daemon/face/local-face.hpp
index c54374c..e2bf479 100644
--- a/daemon/face/local-face.hpp
+++ b/daemon/face/local-face.hpp
@@ -152,9 +152,11 @@
i->wireDecode(payload);
if (&payload != &element)
{
- i->getLocalControlHeader().wireDecode(element,
- false,
- this->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID));
+ uint8_t mask = 0;
+ if (this->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID)) {
+ mask |= ndn::nfd::LocalControlHeader::ENCODE_NEXT_HOP;
+ }
+ i->getLocalControlHeader().wireDecode(element, mask);
}
this->emitSignal(onReceiveInterest, *i);
@@ -193,17 +195,22 @@
if (!this->isLocalControlHeaderEnabled())
return true;
- return header.empty(this->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID),
- false);
+ uint8_t mask = 0;
+ if (this->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID)) {
+ mask |= ndn::nfd::LocalControlHeader::ENCODE_INCOMING_FACE_ID;
+ }
+ return header.empty(mask);
}
template<class Packet>
inline Block
LocalFace::filterAndEncodeLocalControlHeader(const Packet& packet)
{
- return packet.getLocalControlHeader().wireEncode(packet,
- this->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID),
- false);
+ uint8_t mask = 0;
+ if (this->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID)) {
+ mask |= ndn::nfd::LocalControlHeader::ENCODE_INCOMING_FACE_ID;
+ }
+ return packet.getLocalControlHeader().wireEncode(packet, mask);
}
} // namespace nfd
diff --git a/tests/daemon/face/unix-stream.cpp b/tests/daemon/face/unix-stream.cpp
index 02a48d9..a8390fb 100644
--- a/tests/daemon/face/unix-stream.cpp
+++ b/tests/daemon/face/unix-stream.cpp
@@ -382,13 +382,17 @@
using namespace boost::asio;
std::vector<const_buffer> interestWithHeader;
- Block iHeader = interest1->getLocalControlHeader().wireEncode(*interest1, true, true);
+ Block iHeader = interest1->getLocalControlHeader().wireEncode(*interest1,
+ ndn::nfd::LocalControlHeader::ENCODE_INCOMING_FACE_ID |
+ ndn::nfd::LocalControlHeader::ENCODE_NEXT_HOP);
Block iPayload = interest1->wireEncode();
interestWithHeader.push_back(buffer(iHeader.wire(), iHeader.size()));
interestWithHeader.push_back(buffer(iPayload.wire(), iPayload.size()));
std::vector<const_buffer> dataWithHeader;
- Block dHeader = data1->getLocalControlHeader().wireEncode(*data1, true, true);
+ Block dHeader = data1->getLocalControlHeader().wireEncode(*data1,
+ ndn::nfd::LocalControlHeader::ENCODE_INCOMING_FACE_ID |
+ ndn::nfd::LocalControlHeader::ENCODE_NEXT_HOP);
Block dPayload = data1->wireEncode();
dataWithHeader.push_back(buffer(dHeader.wire(), dHeader.size()));
dataWithHeader.push_back(buffer(dPayload.wire(), dPayload.size()));