encoding: Remove SCOPE from Interests and all references to it in the related code
Change-Id: I2b19d0bb7ea5fdcea0da3996b946bb7797a9ea2d
Refs: #2345
diff --git a/src/encoding/tlv.hpp b/src/encoding/tlv.hpp
index da7b8ea..78564d8 100644
--- a/src/encoding/tlv.hpp
+++ b/src/encoding/tlv.hpp
@@ -65,7 +65,7 @@
NameComponent = 8,
Selectors = 9,
Nonce = 10,
- Scope = 11, // deprecated
+ // <Unassigned> = 11,
InterestLifetime = 12,
MinSuffixComponents = 13,
MaxSuffixComponents = 14,
@@ -95,6 +95,7 @@
enum SignatureTypeValue {
DigestSha256 = 0,
SignatureSha256WithRsa = 1,
+ // <Unassigned> = 2,
SignatureSha256WithEcdsa = 3
};
diff --git a/src/interest.cpp b/src/interest.cpp
index 017711a..a7ba973 100644
--- a/src/interest.cpp
+++ b/src/interest.cpp
@@ -34,15 +34,13 @@
"Interest::Error must inherit from tlv::Error");
Interest::Interest()
- : m_scope(-1)
- , m_interestLifetime(time::milliseconds::min())
+ : m_interestLifetime(time::milliseconds::min())
, m_selectedDelegationIndex(INVALID_SELECTED_DELEGATION_INDEX)
{
}
Interest::Interest(const Name& name)
: m_name(name)
- , m_scope(-1)
, m_interestLifetime(time::milliseconds::min())
, m_selectedDelegationIndex(INVALID_SELECTED_DELEGATION_INDEX)
{
@@ -50,28 +48,11 @@
Interest::Interest(const Name& name, const time::milliseconds& interestLifetime)
: m_name(name)
- , m_scope(-1)
, m_interestLifetime(interestLifetime)
, m_selectedDelegationIndex(INVALID_SELECTED_DELEGATION_INDEX)
{
}
-Interest::Interest(const Name& name,
- const Selectors& selectors,
- int scope,
- const time::milliseconds& interestLifetime,
- uint32_t nonce)
- : m_name(name)
- , m_selectors(selectors)
- , m_scope(scope)
- , m_interestLifetime(interestLifetime)
- , m_selectedDelegationIndex(INVALID_SELECTED_DELEGATION_INDEX)
-{
- if (nonce > 0) {
- setNonce(nonce);
- }
-}
-
Interest::Interest(const Block& wire)
{
wireDecode(wire);
@@ -241,7 +222,6 @@
// Name
// Selectors?
// Nonce
- // Scope?
// InterestLifetime?
// Link?
// SelectedDelegation?
@@ -269,12 +249,6 @@
getInterestLifetime().count());
}
- // Scope
- if (getScope() >= 0)
- {
- totalLength += prependNonNegativeIntegerBlock(block, tlv::Scope, getScope());
- }
-
// Nonce
getNonce(); // to ensure that Nonce is properly set
totalLength += block.prependBlock(m_nonce);
@@ -327,7 +301,6 @@
// Name
// Selectors?
// Nonce
- // Scope?
// InterestLifetime?
// Link?
// SelectedDelegation?
@@ -350,15 +323,6 @@
// Nonce
m_nonce = m_wire.get(tlv::Nonce);
- // Scope
- val = m_wire.find(tlv::Scope);
- if (val != m_wire.elements_end())
- {
- m_scope = readNonNegativeInteger(*val);
- }
- else
- m_scope = -1;
-
// InterestLifetime
val = m_wire.find(tlv::InterestLifetime);
if (val != m_wire.elements_end())
@@ -502,10 +466,6 @@
os << delim << "ndn.MustBeFresh=" << interest.getMustBeFresh();
delim = '&';
}
- if (interest.getScope() >= 0) {
- os << delim << "ndn.Scope=" << interest.getScope();
- delim = '&';
- }
if (interest.getInterestLifetime() >= time::milliseconds::zero()
&& interest.getInterestLifetime() != DEFAULT_INTEREST_LIFETIME) {
os << delim << "ndn.InterestLifetime=" << interest.getInterestLifetime().count();
diff --git a/src/interest.hpp b/src/interest.hpp
index 1e064fb..41e3848 100644
--- a/src/interest.hpp
+++ b/src/interest.hpp
@@ -77,16 +77,6 @@
*/
Interest(const Name& name, const time::milliseconds& interestLifetime);
- /** @brief Create a new Interest for the given name, selectors, and guiders
- * @warning In certain contexts that use Interest::shared_from_this(), Interest must be created
- * using `make_shared`. Otherwise, .shared_from_this() will throw an exception.
- */
- Interest(const Name& name,
- const Selectors& selectors,
- int scope,
- const time::milliseconds& interestLifetime,
- uint32_t nonce = 0);
-
/** @brief Create from wire encoding
* @warning In certain contexts that use Interest::shared_from_this(), Interest must be created
* using `make_shared`. Otherwise, .shared_from_this() will throw an exception.
@@ -236,20 +226,6 @@
return *this;
}
- int
- getScope() const
- {
- return m_scope;
- }
-
- Interest&
- setScope(int scope)
- {
- m_scope = scope;
- m_wire.reset();
- return *this;
- }
-
const time::milliseconds&
getInterestLifetime() const
{
@@ -463,7 +439,6 @@
Name m_name;
Selectors m_selectors;
mutable Block m_nonce;
- int m_scope;
time::milliseconds m_interestLifetime;
mutable Block m_link;
diff --git a/tests/unit-tests/interest.t.cpp b/tests/unit-tests/interest.t.cpp
index 42be675..106fbf0 100644
--- a/tests/unit-tests/interest.t.cpp
+++ b/tests/unit-tests/interest.t.cpp
@@ -35,7 +35,7 @@
BOOST_AUTO_TEST_SUITE(TestInterest)
const uint8_t Interest1[] = {
- 0x05, 0x5c, // NDN Interest
+ 0x05, 0x59, // NDN Interest
0x07, 0x14, // Name
0x08, 0x5, // NameComponent
0x6c, 0x6f, 0x63, 0x61, 0x6c,
@@ -66,14 +66,12 @@
0x1,
0x0a, 0x4, // Nonce
0x1, 0x0, 0x0, 0x00,
- 0x0b, 0x1, // Scope
- 0x1,
0x0c, // InterestLifetime
0x2, 0x3, 0xe8
};
const uint8_t Interest2[] = {
- 0x05, 0x5c, // NDN Interest
+ 0x05, 0x59, // NDN Interest
0x07, 0x14, // Name
0x08, 0x5, // NameComponent
0x6c, 0x6f, 0x63, 0x61, 0x6c,
@@ -104,8 +102,6 @@
0x1,
0x0a, 0x4, // Nonce
0x2, 0x0, 0x0, 0x00,
- 0x0b, 0x1, // Scope
- 0x1,
0x0c, // InterestLifetime
0x2, 0x3, 0xe8
};
@@ -515,7 +511,6 @@
// Name
// Selectors?
// Nonce
- // Scope?
// InterestLifetime?
// Link?
// SelectedDelegation?
@@ -561,15 +556,6 @@
BOOST_CHECK_EQUAL(a == b, true);
BOOST_CHECK_EQUAL(a != b, false);
- // check comparison on Nonce
- a.setScope(1);
- BOOST_CHECK_EQUAL(a == b, false);
- BOOST_CHECK_EQUAL(a != b, true);
-
- b.setScope(1);
- BOOST_CHECK_EQUAL(a == b, true);
- BOOST_CHECK_EQUAL(a != b, false);
-
// check comparison on InterestLifetime
a.setInterestLifetime(time::seconds(10));
BOOST_CHECK_EQUAL(a == b, false);
@@ -745,7 +731,6 @@
a.setName("/Test/Encode/Decode/With/Link");
a.setChildSelector(1);
a.setNonce(100);
- a.setScope(1);
a.setInterestLifetime(time::seconds(10));
a.setLink(wire);
@@ -861,7 +846,6 @@
a.setName("/Test/Encode/Decode/With/Link");
a.setChildSelector(1);
a.setNonce(100);
- a.setScope(1);
a.setInterestLifetime(time::seconds(10));
a.setLink(wire);
BOOST_REQUIRE_THROW(a.setSelectedDelegation(3), Interest::Error);
@@ -878,7 +862,6 @@
a.setName("/Test/Encode/Decode/With/Link");
a.setChildSelector(1);
a.setNonce(100);
- a.setScope(1);
a.setInterestLifetime(time::seconds(10));
a.setLink(wire);
BOOST_REQUIRE_THROW(a.setSelectedDelegation(4), Interest::Error);
@@ -892,7 +875,6 @@
BOOST_REQUIRE_NO_THROW(i.wireDecode(interestBlock));
BOOST_CHECK_EQUAL(i.getName().toUri(), "/local/ndn/prefix");
- BOOST_CHECK_EQUAL(i.getScope(), 1);
BOOST_CHECK_EQUAL(i.getInterestLifetime(), time::milliseconds(1000));
BOOST_CHECK_EQUAL(i.getMinSuffixComponents(), 1);
BOOST_CHECK_EQUAL(i.getMaxSuffixComponents(), 1);
@@ -916,7 +898,6 @@
BOOST_REQUIRE_NO_THROW(i.wireDecode(interestBlock));
BOOST_CHECK_EQUAL(i.getName().toUri(), "/local/ndn/prefix");
- BOOST_CHECK_EQUAL(i.getScope(), 1);
BOOST_CHECK_EQUAL(i.getInterestLifetime(), time::milliseconds(1000));
BOOST_CHECK_EQUAL(i.getMinSuffixComponents(), 1);
BOOST_CHECK_EQUAL(i.getMaxSuffixComponents(), 1);
@@ -929,7 +910,6 @@
BOOST_AUTO_TEST_CASE(Encode)
{
ndn::Interest i(ndn::Name("/local/ndn/prefix"));
- i.setScope(1);
i.setInterestLifetime(time::milliseconds(1000));
i.setMinSuffixComponents(1);
i.setMaxSuffixComponents(1);
@@ -965,7 +945,7 @@
BOOST_CHECK_EQUAL(strStream.str(),
"/local/ndn/prefix?"
"ndn.MinSuffixComponents=1&ndn.MaxSuffixComponents=1&"
- "ndn.ChildSelector=1&ndn.Scope=1&"
+ "ndn.ChildSelector=1&"
"ndn.InterestLifetime=1000&"
"ndn.Nonce=2&ndn.Exclude=alex,xxxx,*,yyyy");
diff --git a/tools/ndncatchunks3.cpp b/tools/ndncatchunks3.cpp
index d84758a..25c466b 100644
--- a/tools/ndncatchunks3.cpp
+++ b/tools/ndncatchunks3.cpp
@@ -30,14 +30,13 @@
public:
Consumer(const std::string& dataName,
size_t pipeSize, size_t nTotalSegments,
- int scope = -1, bool mustBeFresh = true)
+ bool mustBeFresh = true)
: m_dataName(dataName)
, m_pipeSize(pipeSize)
, m_nTotalSegments(nTotalSegments)
, m_nextSegment(0)
, m_totalSize(0)
, m_isOutputEnabled(false)
- , m_scope(scope)
, m_mustBeFresh(mustBeFresh)
{
}
@@ -66,7 +65,6 @@
size_t m_totalSize;
bool m_isOutputEnabled; // set to false by default
- int m_scope;
bool m_mustBeFresh;
};
@@ -79,8 +77,6 @@
{
Interest interest(Name(m_dataName).appendSegment(m_nextSegment++));
interest.setInterestLifetime(time::milliseconds(4000));
- if (m_scope >= 0)
- interest.setScope(m_scope);
interest.setMustBeFresh(m_mustBeFresh);
m_face.expressInterest(interest,
@@ -119,8 +115,6 @@
{
// Send interest for next segment
Interest interest(Name(m_dataName).appendSegment(m_nextSegment++));
- if (m_scope >= 0)
- interest.setScope(m_scope);
interest.setInterestLifetime(time::milliseconds(4000));
interest.setMustBeFresh(m_mustBeFresh);
diff --git a/tools/tlvdump.cpp b/tools/tlvdump.cpp
index 90aa71c..cd5080c 100644
--- a/tools/tlvdump.cpp
+++ b/tools/tlvdump.cpp
@@ -38,7 +38,6 @@
{tlv::ImplicitSha256DigestComponent, "ImplicitSha256DigestComponent"},
{tlv::Selectors , "Selectors"},
{tlv::Nonce , "Nonce"},
- {tlv::Scope , "Scope"},
{tlv::InterestLifetime , "InterestLifetime"},
{tlv::MinSuffixComponents , "MinSuffixComponents"},
{tlv::MaxSuffixComponents , "MaxSuffixComponents"},