interest: remove deprecated setDefaultCanBePrefix()
Change-Id: Ifaffb7cc7772a31c3b396c60b816e783d70b7041
diff --git a/tests/unit/interest.t.cpp b/tests/unit/interest.t.cpp
index ff50e8a..903d9bb 100644
--- a/tests/unit/interest.t.cpp
+++ b/tests/unit/interest.t.cpp
@@ -82,7 +82,6 @@
Interest i1;
i1.setName("/local/ndn/prefix");
- i1.setCanBePrefix(false);
i1.setNonce(0x01020304);
BOOST_CHECK_EQUAL(i1.isParametersDigestValid(), true);
@@ -125,7 +124,6 @@
Interest i1;
i1.setName("/local/ndn/prefix");
- i1.setCanBePrefix(false);
i1.setNonce(0x1);
i1.setApplicationParameters("2404C0C1C2C3"_block);
BOOST_CHECK_EQUAL(i1.isParametersDigestValid(), true);
@@ -265,7 +263,6 @@
BOOST_CHECK_EQUAL_COLLECTIONS(wire1.begin(), wire1.end(), WIRE, WIRE + sizeof(WIRE));
Interest i2("/local/ndn/prefix");
- i2.setCanBePrefix(false);
i2.setMustBeFresh(true);
i2.setNonce(0x4c1ecb4a);
i2.setApplicationParameters("2404C0C1C2C3"_block);
@@ -347,7 +344,6 @@
{
Interest i;
i.setName(Name("/A").appendParametersSha256DigestPlaceholder());
- i.setCanBePrefix(false);
BOOST_CHECK_EQUAL(i.isParametersDigestValid(), false);
BOOST_CHECK_EXCEPTION(i.wireEncode(), tlv::Error, [] (const auto& e) {
return e.what() == "Interest without parameters must not have a ParametersSha256DigestComponent"s;
@@ -783,7 +779,6 @@
BOOST_AUTO_TEST_CASE(SetNonce)
{
Interest i1("/A");
- i1.setCanBePrefix(false);
BOOST_CHECK(!i1.hasNonce());
i1.setNonce(1);
@@ -820,7 +815,6 @@
BOOST_AUTO_TEST_CASE(NonceConversions)
{
Interest i;
- i.setCanBePrefix(false);
// 4-arg constructor
Interest::Nonce n1(1, 2, 3, 4);
@@ -908,7 +902,6 @@
BOOST_AUTO_TEST_CASE(SetSignature)
{
Interest i;
- i.setCanBePrefix(false);
BOOST_CHECK(i.getSignatureInfo() == nullopt);
BOOST_CHECK_EQUAL(i.isSigned(), false);
@@ -1055,7 +1048,6 @@
BOOST_AUTO_TEST_CASE(ExtractSignedRanges)
{
Interest i1;
- i1.setCanBePrefix(false);
BOOST_CHECK_EXCEPTION(i1.extractSignedRanges(), tlv::Error, [] (const auto& e) {
return e.what() == "Name has zero name components"s;
});
@@ -1136,7 +1128,6 @@
// Test failure with missing ParametersSha256DigestComponent
Interest i3("/a");
- i3.setCanBePrefix(false);
BOOST_CHECK_EXCEPTION(i3.extractSignedRanges(), tlv::Error, [] (const auto& e) {
return e.what() == "Interest Name must end with a ParametersSha256DigestComponent"s;
});
@@ -1151,7 +1142,6 @@
BOOST_AUTO_TEST_CASE(ToUri)
{
Interest i;
- i.setCanBePrefix(false);
BOOST_CHECK_EQUAL(i.toUri(), "/");
i.setName("/foo");
diff --git a/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp b/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp
index 7757f5b..bc134a1 100644
--- a/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp
+++ b/tests/unit/security/certificate-fetcher-direct-fetch.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -74,9 +74,7 @@
cache.insert(subSubIdentity.getDefaultKey().getDefaultCertificate());
m_keyChain.sign(data, signingByIdentity(subSubIdentity));
- interest.setCanBePrefix(false);
m_keyChain.sign(interest, signingByIdentity(subSubIdentity));
- interestNoTag.setCanBePrefix(false);
m_keyChain.sign(interestNoTag, signingByIdentity(subSubIdentity));
data.setTag(make_shared<lp::IncomingFaceIdTag>(123));
diff --git a/tests/unit/security/certificate-fetcher-from-network.t.cpp b/tests/unit/security/certificate-fetcher-from-network.t.cpp
index 36a1ae9..29d8243 100644
--- a/tests/unit/security/certificate-fetcher-from-network.t.cpp
+++ b/tests/unit/security/certificate-fetcher-from-network.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -62,7 +62,6 @@
cache.insert(subSubIdentity.getDefaultKey().getDefaultCertificate());
m_keyChain.sign(data, signingByIdentity(subSubIdentity));
- interest.setCanBePrefix(false);
m_keyChain.sign(interest, signingByIdentity(subSubIdentity));
processInterest = [this] (const Interest& i) { makeResponse(i); };
diff --git a/tests/unit/security/interest-signer.t.cpp b/tests/unit/security/interest-signer.t.cpp
index 735668c..b4a3991 100644
--- a/tests/unit/security/interest-signer.t.cpp
+++ b/tests/unit/security/interest-signer.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -75,10 +75,9 @@
InterestSigner signer(m_keyChain);
Interest i1("/hello/world");
- i1.setCanBePrefix(false);
signer.makeSignedInterest(i1, SigningInfo(),
InterestSigner::SigningFlags::WantNonce |
- InterestSigner::SigningFlags::WantTime);
+ InterestSigner::SigningFlags::WantTime);
BOOST_TEST(i1.isSigned() == true);
BOOST_TEST_REQUIRE(i1.getName().size() == 3);
BOOST_TEST_REQUIRE(i1.getSignatureInfo().has_value());
@@ -88,11 +87,10 @@
BOOST_TEST(i1.getSignatureInfo()->getSeqNum().has_value() == false);
Interest i2("/hello/world/!");
- i2.setCanBePrefix(false);
signer.makeSignedInterest(i2, signingByIdentity("/test"),
InterestSigner::SigningFlags::WantNonce |
- InterestSigner::SigningFlags::WantTime |
- InterestSigner::SigningFlags::WantSeqNum);
+ InterestSigner::SigningFlags::WantTime |
+ InterestSigner::SigningFlags::WantSeqNum);
BOOST_TEST(i2.isSigned() == true);
BOOST_REQUIRE_EQUAL(i2.getName().size(), 4);
BOOST_REQUIRE(i2.getSignatureInfo());
@@ -104,7 +102,6 @@
advanceClocks(100_s);
Interest i3("/hello/world/2");
- i3.setCanBePrefix(false);
signer.makeSignedInterest(i3, SigningInfo(), InterestSigner::SigningFlags::WantSeqNum);
BOOST_TEST(i3.isSigned() == true);
BOOST_REQUIRE_EQUAL(i3.getName().size(), 4);
diff --git a/tests/unit/security/key-chain.t.cpp b/tests/unit/security/key-chain.t.cpp
index ec40fbd..1e35aef 100644
--- a/tests/unit/security/key-chain.t.cpp
+++ b/tests/unit/security/key-chain.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -341,7 +341,7 @@
struct InterestV02Pkt
{
- Interest packet = Interest{"/interest02"}.setCanBePrefix(false);
+ Interest packet{"/interest02"};
SignedInterestFormat sigFormat = SignedInterestFormat::V02;
SignatureInfo
@@ -353,7 +353,7 @@
struct InterestV03Pkt
{
- Interest packet = Interest{"/interest03"}.setCanBePrefix(false);
+ Interest packet{"/interest03"};
SignedInterestFormat sigFormat = SignedInterestFormat::V03;
SignatureInfo
diff --git a/tests/unit/security/validation-policy-command-interest.t.cpp b/tests/unit/security/validation-policy-command-interest.t.cpp
index 4fe05b7..cf91ee3 100644
--- a/tests/unit/security/validation-policy-command-interest.t.cpp
+++ b/tests/unit/security/validation-policy-command-interest.t.cpp
@@ -69,7 +69,6 @@
{
if (wantV3) {
Interest i(Name(identity.getName()).append("CMD"));
- i.setCanBePrefix(false);
m_signer.makeSignedInterest(i, signingByIdentity(identity));
return i;
}
@@ -113,7 +112,6 @@
VALIDATE_SUCCESS(i2, "Should succeed (timestamp larger than previous)");
Interest i3(Name(identity.getName()).append("CMD"));
- i3.setCanBePrefix(false);
m_signer.makeSignedInterest(i3, signingWithSha256());
VALIDATE_FAILURE(i3, "Should fail (Sha256 signature violates policy)");
}
diff --git a/tests/unit/security/validation-policy-config.t.cpp b/tests/unit/security/validation-policy-config.t.cpp
index 83de50e..32fbf01 100644
--- a/tests/unit/security/validation-policy-config.t.cpp
+++ b/tests/unit/security/validation-policy-config.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -56,7 +56,6 @@
VALIDATE_FAILURE(d, "Empty policy should reject everything");
Interest i("/Security/ValidationPolicyConfig/I");
- i.setCanBePrefix(false);
this->m_keyChain.sign(i, signingByIdentity(this->identity));
VALIDATE_FAILURE(i, "Empty policy should reject everything");
}
@@ -412,9 +411,6 @@
using Packet = typename Policy::Packet;
Packet unsignedPacket("/Security/ValidatorFixture/Sub1/Sub2/Packet");
- // All of the packet types inputed to this test case template are Interests, so we can call
- // setCanBePrefix
- unsignedPacket.setCanBePrefix(false);
Packet packet = unsignedPacket;
VALIDATE_FAILURE(packet, "Unsigned");
@@ -484,7 +480,6 @@
Interest interest("/Security/ValidatorFixture/Sub1/Sub2/Packet");
- interest.setCanBePrefix(false);
this->m_keyChain.sign(interest, signingWithSha256());
VALIDATE_SUCCESS(interest, "Should be accepted");
@@ -557,7 +552,6 @@
Interest interest("/localhost/identity/digest-sha256/foobar");
- interest.setCanBePrefix(false);
this->m_keyChain.sign(interest, signingWithSha256());
VALIDATE_SUCCESS(interest, "Should be accepted");
@@ -630,7 +624,6 @@
Interest interest("/localhost/identity/digest-sha256/foobar");
- interest.setCanBePrefix(false);
this->m_keyChain.sign(interest, signingWithSha256());
VALIDATE_FAILURE(interest, "Signature type check should fail");
diff --git a/tests/unit/security/validation-policy-signed-interest.t.cpp b/tests/unit/security/validation-policy-signed-interest.t.cpp
index d9cddb5..c3d37e6 100644
--- a/tests/unit/security/validation-policy-signed-interest.t.cpp
+++ b/tests/unit/security/validation-policy-signed-interest.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -75,7 +75,6 @@
uint32_t signingFlags = InterestSigner::WantNonce | InterestSigner::WantTime)
{
Interest i(Name(identity.getName()).append("CMD"));
- i.setCanBePrefix(false);
m_signer.makeSignedInterest(i, signingByIdentity(identity), signingFlags);
return i;
}
@@ -102,7 +101,6 @@
VALIDATE_SUCCESS(i2, "Should succeed (timestamp and sequence number larger than previous)");
Interest i3(Name(identity.getName()).append("CMD"));
- i3.setCanBePrefix(false);
m_signer.makeSignedInterest(i3, signingWithSha256());
VALIDATE_FAILURE(i3, "Should fail (Sha256 signature violates policy)");
}
diff --git a/tests/unit/security/validator-config.t.cpp b/tests/unit/security/validator-config.t.cpp
index 573282f..391879d 100644
--- a/tests/unit/security/validator-config.t.cpp
+++ b/tests/unit/security/validator-config.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -157,7 +157,6 @@
InterestSigner signer(m_keyChain);
Interest i1("/hello/world");
- i1.setCanBePrefix(false);
signer.makeSignedInterest(i1);
size_t nValidated = 0, nFailed = 0;
@@ -170,7 +169,6 @@
BOOST_CHECK_EQUAL(nFailed, 1);
Interest i2("/hello/world");
- i2.setCanBePrefix(false);
signer.makeSignedInterest(i2, signingWithSha256());
validator.validate(i2, [&] (auto&&...) { ++nValidated; }, [&] (auto&&...) { ++nFailed; });
BOOST_CHECK_EQUAL(nValidated, 2);
diff --git a/tests/unit/security/validator-fixture.cpp b/tests/unit/security/validator-fixture.cpp
index 7a7ee14..5d50794 100644
--- a/tests/unit/security/validator-fixture.cpp
+++ b/tests/unit/security/validator-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -79,7 +79,6 @@
InterestV02Pkt::makeName(Name name, KeyChain& keyChain)
{
Interest interest(name);
- interest.setCanBePrefix(false);
SigningInfo params;
params.setSignedInterestFormat(SignedInterestFormat::V02);
keyChain.sign(interest, params);
@@ -90,7 +89,6 @@
InterestV03Pkt::makeName(Name name, KeyChain& keyChain)
{
Interest interest(name);
- interest.setCanBePrefix(false);
SigningInfo params;
params.setSignedInterestFormat(SignedInterestFormat::V03);
keyChain.sign(interest, params);
diff --git a/tests/unit/security/validator-fixture.hpp b/tests/unit/security/validator-fixture.hpp
index c56a014..25cbe93 100644
--- a/tests/unit/security/validator-fixture.hpp
+++ b/tests/unit/security/validator-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -212,7 +212,7 @@
static Interest
makePacket(const Name& name)
{
- return Interest(name).setCanBePrefix(false);
+ return Interest(name);
}
static shared_ptr<ValidationState>
@@ -238,7 +238,7 @@
static Interest
makePacket(const Name& name)
{
- return Interest(name).setCanBePrefix(false);
+ return Interest(name);
}
static shared_ptr<ValidationState>
diff --git a/tests/unit/security/validator.t.cpp b/tests/unit/security/validator.t.cpp
index adf72d3..75ab618 100644
--- a/tests/unit/security/validator.t.cpp
+++ b/tests/unit/security/validator.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -209,7 +209,6 @@
HierarchicalValidatorFixture<ValidationPolicySimpleHierarchyForInterestOnly>)
{
Interest interest("/Security/ValidatorFixture/Sub1/Sub2/Interest");
- interest.setCanBePrefix(false);
Data data("/Security/ValidatorFixture/Sub1/Sub2/Interest");
VALIDATE_FAILURE(interest, "Unsigned");
@@ -218,7 +217,6 @@
face.sentInterests.clear();
interest = Interest("/Security/ValidatorFixture/Sub1/Sub2/Interest");
- interest.setCanBePrefix(false);
m_keyChain.sign(interest, signingWithSha256());
m_keyChain.sign(data, signingWithSha256());
VALIDATE_FAILURE(interest, "Required KeyLocator/Name missing (not passed to policy)");
diff --git a/tests/unit/security/verification-helpers.t.cpp b/tests/unit/security/verification-helpers.t.cpp
index 5e313ec..e3ecc86 100644
--- a/tests/unit/security/verification-helpers.t.cpp
+++ b/tests/unit/security/verification-helpers.t.cpp
@@ -97,7 +97,6 @@
// Interest interest1(Name("/test/interest").append(type));
// SigningInfo signingInfoV03(signingInfo);
// signingInfoV03.setSignedInterestFormat(SignedInterestFormat::V03);
-// interest1.setCanBePrefix(false);
// interest1.setNonce(0xF72C8A4B);
// m_keyChain.sign(interest1, signingInfoV03);
// print("goodInterest", interest1.wireEncode().wire(), interest1.wireEncode().size());
@@ -113,7 +112,6 @@
// Interest interest2(Name("/test/interest").append(type));
// SigningInfo signingInfoV02(signingInfo);
// signingInfoV02.setSignedInterestFormat(SignedInterestFormat::V03);
-// interest2.setCanBePrefix(false);
// interest2.setNonce(0xF72C8A4B);
// m_keyChain.sign(interest2, signingInfoV02);
// print("goodInterestOldFormat", interest2.wireEncode().wire(), interest2.wireEncode().size());
@@ -580,9 +578,7 @@
Data unsignedData("/some/data");
Interest unsignedInterest1("/some/interest/with/several/name/components");
- unsignedInterest1.setCanBePrefix(false);
Interest unsignedInterest2("/interest-with-one-name-component");
- unsignedInterest2.setCanBePrefix(false);
BOOST_CHECK(!verifySignature(unsignedData, cert));
BOOST_CHECK(!verifySignature(unsignedData, key));
@@ -605,9 +601,7 @@
const Tpm& tpm = m_keyChain.getTpm();
Data data("/data");
Interest interest("/interest");
- interest.setCanBePrefix(false);
Interest interestOldFormat("/interest");
- interestOldFormat.setCanBePrefix(false);
SigningInfo signingInfo;
signingInfo.setSigningHmacKey("QjM3NEEyNkE3MTQ5MDQzN0FBMDI0RTRGQURENUI0OTdGREZGMUE4RUE2RkYxMkY2"
"RkI2NUFGMjcyMEI1OUNDRg==");
@@ -649,9 +643,7 @@
Data unsignedData("/some/data");
Interest unsignedInterest1("/some/interest/with/several/name/components");
- unsignedInterest1.setCanBePrefix(false);
Interest unsignedInterest2("/interest-with-one-name-component");
- unsignedInterest2.setCanBePrefix(false);
BOOST_CHECK(!verifySignature(unsignedData, nullopt));
BOOST_CHECK(!verifySignature(unsignedInterest1, nullopt));