data: Implementing Data::getFullName() method to get Data packet name with implicit digest
Note that getFullName() method will throw a Data::Error if Data packet
does not have wire encoding, i.e., it has not been constructed from wire
and is not yet signed.
Change-Id: I7a9b8a6c9e4c6eced9bc907bfc81adb5d4f0e4b3
Refs: #1298
diff --git a/src/interest.cpp b/src/interest.cpp
index 590d527..986a5ec 100644
--- a/src/interest.cpp
+++ b/src/interest.cpp
@@ -68,13 +68,13 @@
return false;
if (getMinSuffixComponents() >= 0 &&
- // Add 1 for the implicit digest.
- !(name.size() + 1 - m_name.size() >= static_cast<size_t>(getMinSuffixComponents())))
+ // name must include implicit digest
+ !(name.size() - m_name.size() >= static_cast<size_t>(getMinSuffixComponents())))
return false;
if (getMaxSuffixComponents() >= 0 &&
- // Add 1 for the implicit digest.
- !(name.size() + 1 - m_name.size() <= static_cast<size_t>(getMaxSuffixComponents())))
+ // name must include implicit digest
+ !(name.size() - m_name.size() <= static_cast<size_t>(getMaxSuffixComponents())))
return false;
if (!getExclude().empty() &&
@@ -88,7 +88,7 @@
bool
Interest::matchesData(const Data& data) const
{
- if (!this->matchesName(data.getName())) {
+ if (!this->matchesName(data.getFullName())) {
return false;
}