fw: /localhop scope control on outgoing Interests
refs #1253
Change-Id: I359747688568934070d1583995957835ac690f28
diff --git a/daemon/table/pit-entry.cpp b/daemon/table/pit-entry.cpp
index 2d016ca..7523504 100644
--- a/daemon/table/pit-entry.cpp
+++ b/daemon/table/pit-entry.cpp
@@ -34,6 +34,20 @@
}
static inline bool
+predicate_InRecord_isLocal(const InRecord& inRecord)
+{
+ return inRecord.getFace()->isLocal();
+}
+
+bool
+Entry::hasLocalInRecord() const
+{
+ InRecordCollection::const_iterator it = std::find_if(
+ m_inRecords.begin(), m_inRecords.end(), &predicate_InRecord_isLocal);
+ return it != m_inRecords.end();
+}
+
+static inline bool
predicate_FaceRecord_Face(const FaceRecord& faceRecord, shared_ptr<Face> face)
{
return faceRecord.getFace() == face;
@@ -57,7 +71,7 @@
if (hasUnexpiredOutRecord) {
return false;
}
-
+
InRecordCollection::const_iterator inIt = std::find_if(
m_inRecords.begin(), m_inRecords.end(),
bind(&predicate_FaceRecord_ne_Face_and_unexpired, _1, face, time::now()));
@@ -83,7 +97,7 @@
m_inRecords.push_front(InRecord(face));
it = m_inRecords.begin();
}
-
+
it->update(interest);
return it;
}
@@ -103,7 +117,7 @@
m_outRecords.push_front(OutRecord(face));
it = m_outRecords.begin();
}
-
+
it->update(interest);
m_nonces.insert(interest.getNonce());
return it;
diff --git a/daemon/table/pit-entry.hpp b/daemon/table/pit-entry.hpp
index aeff8d8..1e342e2 100644
--- a/daemon/table/pit-entry.hpp
+++ b/daemon/table/pit-entry.hpp
@@ -53,6 +53,14 @@
const OutRecordCollection&
getOutRecords() const;
+ /** \brief determines whether any InRecord is a local Face
+ *
+ * \return true if any InRecord is a local Face,
+ * false if all InRecords are non-local Faces
+ */
+ bool
+ hasLocalInRecord() const;
+
/** \brief decides whether Interest can be forwarded to face
*
* \return true if OutRecord of this face does not exist or has expired,