face+fw: store and return PitToken from downstream
refs #4532
Change-Id: I97b95232a242186601459622f17983d1bef806d6
diff --git a/daemon/face/generic-link-service.cpp b/daemon/face/generic-link-service.cpp
index 5a3664c..2ab9f7e 100644
--- a/daemon/face/generic-link-service.cpp
+++ b/daemon/face/generic-link-service.cpp
@@ -25,6 +25,7 @@
#include "generic-link-service.hpp"
+#include <ndn-cxx/lp/pit-token.hpp>
#include <ndn-cxx/lp/tags.hpp>
#include <cmath>
@@ -129,28 +130,33 @@
GenericLinkService::encodeLpFields(const ndn::PacketBase& netPkt, lp::Packet& lpPacket)
{
if (m_options.allowLocalFields) {
- shared_ptr<lp::IncomingFaceIdTag> incomingFaceIdTag = netPkt.getTag<lp::IncomingFaceIdTag>();
+ auto incomingFaceIdTag = netPkt.getTag<lp::IncomingFaceIdTag>();
if (incomingFaceIdTag != nullptr) {
lpPacket.add<lp::IncomingFaceIdField>(*incomingFaceIdTag);
}
}
- shared_ptr<lp::CongestionMarkTag> congestionMarkTag = netPkt.getTag<lp::CongestionMarkTag>();
+ auto congestionMarkTag = netPkt.getTag<lp::CongestionMarkTag>();
if (congestionMarkTag != nullptr) {
lpPacket.add<lp::CongestionMarkField>(*congestionMarkTag);
}
if (m_options.allowSelfLearning) {
- shared_ptr<lp::NonDiscoveryTag> nonDiscoveryTag = netPkt.getTag<lp::NonDiscoveryTag>();
+ auto nonDiscoveryTag = netPkt.getTag<lp::NonDiscoveryTag>();
if (nonDiscoveryTag != nullptr) {
lpPacket.add<lp::NonDiscoveryField>(*nonDiscoveryTag);
}
- shared_ptr<lp::PrefixAnnouncementTag> prefixAnnouncementTag = netPkt.getTag<lp::PrefixAnnouncementTag>();
+ auto prefixAnnouncementTag = netPkt.getTag<lp::PrefixAnnouncementTag>();
if (prefixAnnouncementTag != nullptr) {
lpPacket.add<lp::PrefixAnnouncementField>(*prefixAnnouncementTag);
}
}
+
+ auto pitToken = netPkt.getTag<lp::PitToken>();
+ if (pitToken != nullptr) {
+ lpPacket.add<lp::PitTokenField>(*pitToken);
+ }
}
void
@@ -388,6 +394,10 @@
return;
}
+ if (firstPkt.has<lp::PitTokenField>()) {
+ interest->setTag(make_shared<lp::PitToken>(firstPkt.get<lp::PitTokenField>()));
+ }
+
this->receiveInterest(*interest, endpointId);
}