fw: replace Link with forwarding hint
Forwarding now processes forwarding hint on Interests,
and no longer considers the Link object.
refs #4055
Change-Id: I0331687ee8ec31afa2f1a105e903670689647c4d
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 3263b43..9e0b8bb 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -73,53 +73,6 @@
Forwarder::~Forwarder() = default;
void
-Forwarder::startProcessInterest(Face& face, const Interest& interest)
-{
- // check fields used by forwarding are well-formed
- try {
- if (interest.hasLink()) {
- interest.getLink();
- }
- }
- catch (const tlv::Error&) {
- NFD_LOG_DEBUG("startProcessInterest face=" << face.getId() <<
- " interest=" << interest.getName() << " malformed");
- // It's safe to call interest.getName() because Name has been fully parsed
- return;
- }
-
- this->onIncomingInterest(face, interest);
-}
-
-void
-Forwarder::startProcessData(Face& face, const Data& data)
-{
- // check fields used by forwarding are well-formed
- // (none needed)
-
- this->onIncomingData(face, data);
-}
-
-void
-Forwarder::startProcessNack(Face& face, const lp::Nack& nack)
-{
- // check fields used by forwarding are well-formed
- try {
- if (nack.getInterest().hasLink()) {
- nack.getInterest().getLink();
- }
- }
- catch (const tlv::Error&) {
- NFD_LOG_DEBUG("startProcessNack face=" << face.getId() <<
- " nack=" << nack.getInterest().getName() <<
- "~" << nack.getReason() << " malformed");
- return;
- }
-
- this->onIncomingNack(face, nack);
-}
-
-void
Forwarder::onIncomingInterest(Face& inFace, const Interest& interest)
{
// receive Interest
@@ -146,13 +99,12 @@
return;
}
- // strip Link object if Interest has reached producer region
- if (interest.hasLink() && m_networkRegionTable.isInProducerRegion(interest.getLink())) {
+ // strip forwarding hint if Interest has reached producer region
+ if (!interest.getForwardingHint().empty() &&
+ m_networkRegionTable.isInProducerRegion(interest.getForwardingHint())) {
NFD_LOG_DEBUG("onIncomingInterest face=" << inFace.getId() <<
" interest=" << interest.getName() << " reaching-producer-region");
- Interest& interestRef = const_cast<Interest&>(interest);
- interestRef.unsetLink();
- interestRef.unsetSelectedDelegation();
+ const_cast<Interest&>(interest).setForwardingHint({});
}
// PIT insert