interest: declare default CanBePrefix setting
refs #4581
Change-Id: I82de3b13c3010242fa7999a2564d4a5442dfd14b
diff --git a/src/security/v2/certificate-bundle-fetcher.cpp b/src/security/v2/certificate-bundle-fetcher.cpp
index 45a0c38..227a434 100644
--- a/src/security/v2/certificate-bundle-fetcher.cpp
+++ b/src/security/v2/certificate-bundle-fetcher.cpp
@@ -95,9 +95,10 @@
const ValidationContinuation& continueValidation)
{
Interest bundleInterest = Interest(bundleNamePrefix);
- bundleInterest.setInterestLifetime(m_bundleInterestLifetime);
+ bundleInterest.setCanBePrefix(true);
bundleInterest.setMustBeFresh(true);
bundleInterest.setChildSelector(1);
+ bundleInterest.setInterestLifetime(m_bundleInterestLifetime);
m_face.expressInterest(bundleInterest,
[=] (const Interest& interest, const Data& data) {
@@ -123,8 +124,9 @@
}
Interest bundleInterest(fullBundleName.getPrefix(-1).append(segmentNo));
- bundleInterest.setInterestLifetime(m_bundleInterestLifetime);
+ bundleInterest.setCanBePrefix(false);
bundleInterest.setMustBeFresh(false);
+ bundleInterest.setInterestLifetime(m_bundleInterestLifetime);
m_face.expressInterest(bundleInterest,
[=] (const Interest& interest, const Data& data) {
diff --git a/src/security/v2/certificate-request.hpp b/src/security/v2/certificate-request.hpp
index c1d88dc..9bcb93b 100644
--- a/src/security/v2/certificate-request.hpp
+++ b/src/security/v2/certificate-request.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -46,6 +46,12 @@
{
}
+ explicit
+ CertificateRequest(const Name& name)
+ : CertificateRequest(Interest(name).setCanBePrefix(true))
+ {
+ }
+
public:
/// @brief the name for the requested data/certificate.
Interest m_interest;
diff --git a/src/security/v2/validation-policy-config.cpp b/src/security/v2/validation-policy-config.cpp
index 2d82079..ff3f7bf 100644
--- a/src/security/v2/validation-policy-config.cpp
+++ b/src/security/v2/validation-policy-config.cpp
@@ -255,7 +255,7 @@
for (const auto& rule : m_dataRules) {
if (rule->match(tlv::Data, data.getName())) {
if (rule->check(tlv::Data, data.getName(), klName, state)) {
- return continueValidation(make_shared<CertificateRequest>(Interest(klName)), state);
+ return continueValidation(make_shared<CertificateRequest>(klName), state);
}
// rule->check calls state->fail(...) if the check fails
return;
@@ -284,7 +284,7 @@
for (const auto& rule : m_interestRules) {
if (rule->match(tlv::Interest, interest.getName())) {
if (rule->check(tlv::Interest, interest.getName(), klName, state)) {
- return continueValidation(make_shared<CertificateRequest>(Interest(klName)), state);
+ return continueValidation(make_shared<CertificateRequest>(klName), state);
}
// rule->check calls state->fail(...) if the check fails
return;
diff --git a/src/security/v2/validation-policy-simple-hierarchy.cpp b/src/security/v2/validation-policy-simple-hierarchy.cpp
index 0ad6128..e83c9bc 100644
--- a/src/security/v2/validation-policy-simple-hierarchy.cpp
+++ b/src/security/v2/validation-policy-simple-hierarchy.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -35,7 +35,7 @@
}
if (klName.getPrefix(-2).isPrefixOf(data.getName())) {
- continueValidation(make_shared<CertificateRequest>(Interest(klName)), state);
+ continueValidation(make_shared<CertificateRequest>(klName), state);
}
else {
state->fail({ValidationError::Code::INVALID_KEY_LOCATOR, "Data signing policy violation for " +
@@ -53,7 +53,7 @@
}
if (klName.getPrefix(-2).isPrefixOf(interest.getName())) {
- continueValidation(make_shared<CertificateRequest>(Interest(klName)), state);
+ continueValidation(make_shared<CertificateRequest>(klName), state);
}
else {
state->fail({ValidationError::Code::INVALID_KEY_LOCATOR, "Interest signing policy violation for " +