face: add EndpointId in Face and LinkService
refs: #4843
Change-Id: If1249015392ef904a56a0d0d97946e2b3024d7d4
diff --git a/daemon/face/generic-link-service.cpp b/daemon/face/generic-link-service.cpp
index 55ec6ee..09b874c 100644
--- a/daemon/face/generic-link-service.cpp
+++ b/daemon/face/generic-link-service.cpp
@@ -65,15 +65,15 @@
}
void
-GenericLinkService::requestIdlePacket()
+GenericLinkService::requestIdlePacket(const EndpointId& endpointId)
{
// No need to request Acks to attach to this packet from LpReliability, as they are already
// attached in sendLpPacket
- this->sendLpPacket({});
+ this->sendLpPacket({}, endpointId);
}
void
-GenericLinkService::sendLpPacket(lp::Packet&& pkt)
+GenericLinkService::sendLpPacket(lp::Packet&& pkt, const EndpointId& endpointId)
{
const ssize_t mtu = this->getTransport()->getMtu();
@@ -91,38 +91,38 @@
NFD_LOG_FACE_WARN("attempted to send packet over MTU limit");
return;
}
- this->sendPacket(std::move(tp));
+ this->sendPacket(std::move(tp), endpointId);
}
void
-GenericLinkService::doSendInterest(const Interest& interest)
+GenericLinkService::doSendInterest(const Interest& interest, const EndpointId& endpointId)
{
lp::Packet lpPacket(interest.wireEncode());
encodeLpFields(interest, lpPacket);
- this->sendNetPacket(std::move(lpPacket), true);
+ this->sendNetPacket(std::move(lpPacket), endpointId, true);
}
void
-GenericLinkService::doSendData(const Data& data)
+GenericLinkService::doSendData(const Data& data, const EndpointId& endpointId)
{
lp::Packet lpPacket(data.wireEncode());
encodeLpFields(data, lpPacket);
- this->sendNetPacket(std::move(lpPacket), false);
+ this->sendNetPacket(std::move(lpPacket), endpointId, false);
}
void
-GenericLinkService::doSendNack(const lp::Nack& nack)
+GenericLinkService::doSendNack(const lp::Nack& nack, const EndpointId& endpointId)
{
lp::Packet lpPacket(nack.getInterest().wireEncode());
lpPacket.add<lp::NackField>(nack.getHeader());
encodeLpFields(nack, lpPacket);
- this->sendNetPacket(std::move(lpPacket), false);
+ this->sendNetPacket(std::move(lpPacket), endpointId, false);
}
void
@@ -154,7 +154,7 @@
}
void
-GenericLinkService::sendNetPacket(lp::Packet&& pkt, bool isInterest)
+GenericLinkService::sendNetPacket(lp::Packet&& pkt, const EndpointId& endpointId, bool isInterest)
{
std::vector<lp::Packet> frags;
ssize_t mtu = this->getTransport()->getMtu();
@@ -206,7 +206,7 @@
}
for (lp::Packet& frag : frags) {
- this->sendLpPacket(std::move(frag));
+ this->sendLpPacket(std::move(frag), endpointId);
}
}
@@ -302,7 +302,7 @@
std::tie(isReassembled, netPkt, firstPkt) = m_reassembler.receiveFragment(packet.remoteEndpoint,
pkt);
if (isReassembled) {
- this->decodeNetPacket(netPkt, firstPkt);
+ this->decodeNetPacket(netPkt, firstPkt, packet.remoteEndpoint);
}
}
catch (const tlv::Error& e) {
@@ -312,20 +312,21 @@
}
void
-GenericLinkService::decodeNetPacket(const Block& netPkt, const lp::Packet& firstPkt)
+GenericLinkService::decodeNetPacket(const Block& netPkt, const lp::Packet& firstPkt,
+ const EndpointId& endpointId)
{
try {
switch (netPkt.type()) {
case tlv::Interest:
if (firstPkt.has<lp::NackField>()) {
- this->decodeNack(netPkt, firstPkt);
+ this->decodeNack(netPkt, firstPkt, endpointId);
}
else {
- this->decodeInterest(netPkt, firstPkt);
+ this->decodeInterest(netPkt, firstPkt, endpointId);
}
break;
case tlv::Data:
- this->decodeData(netPkt, firstPkt);
+ this->decodeData(netPkt, firstPkt, endpointId);
break;
default:
++this->nInNetInvalid;
@@ -340,7 +341,8 @@
}
void
-GenericLinkService::decodeInterest(const Block& netPkt, const lp::Packet& firstPkt)
+GenericLinkService::decodeInterest(const Block& netPkt, const lp::Packet& firstPkt,
+ const EndpointId& endpointId)
{
BOOST_ASSERT(netPkt.type() == tlv::Interest);
BOOST_ASSERT(!firstPkt.has<lp::NackField>());
@@ -387,11 +389,12 @@
return;
}
- this->receiveInterest(*interest);
+ this->receiveInterest(*interest, endpointId);
}
void
-GenericLinkService::decodeData(const Block& netPkt, const lp::Packet& firstPkt)
+GenericLinkService::decodeData(const Block& netPkt, const lp::Packet& firstPkt,
+ const EndpointId& endpointId)
{
BOOST_ASSERT(netPkt.type() == tlv::Data);
@@ -440,11 +443,12 @@
}
}
- this->receiveData(*data);
+ this->receiveData(*data, endpointId);
}
void
-GenericLinkService::decodeNack(const Block& netPkt, const lp::Packet& firstPkt)
+GenericLinkService::decodeNack(const Block& netPkt, const lp::Packet& firstPkt,
+ const EndpointId& endpointId)
{
BOOST_ASSERT(netPkt.type() == tlv::Interest);
BOOST_ASSERT(firstPkt.has<lp::NackField>());
@@ -484,7 +488,7 @@
return;
}
- this->receiveNack(nack);
+ this->receiveNack(nack, endpointId);
}
} // namespace face