Adjust includes for the updated locations of ndn-cxx security headers
Change-Id: Id1e44e929541fdd1132a4b3e6366404232351e68
diff --git a/src/validator/certificate-fetcher-ndns-appcert.cpp b/src/validator/certificate-fetcher-ndns-appcert.cpp
index e451e96..81f31c6 100644
--- a/src/validator/certificate-fetcher-ndns-appcert.cpp
+++ b/src/validator/certificate-fetcher-ndns-appcert.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California.
+ * Copyright (c) 2014-2020, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -27,7 +27,7 @@
namespace ndn {
namespace ndns {
-using security::v2::Certificate;
+using security::Certificate;
CertificateFetcherAppCert::CertificateFetcherAppCert(Face& face,
size_t nsCacheSize,
@@ -40,8 +40,8 @@
}
void
-CertificateFetcherAppCert::doFetch(const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+CertificateFetcherAppCert::doFetch(const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation)
{
const Name& key = certRequest->interest.getName();
@@ -64,40 +64,40 @@
void
CertificateFetcherAppCert::onQuerySuccessCallback(const Data& data,
- const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation)
{
m_validator->validate(data,
[=] (const Data& d) {
onValidationSuccessCallback(d, certRequest, state, continueValidation);
},
- [=] (const Data&, const security::v2::ValidationError& err) {
+ [=] (const Data&, const security::ValidationError& err) {
onValidationFailCallback(err, certRequest, state, continueValidation);
});
}
void
CertificateFetcherAppCert::onQueryFailCallback(const std::string& errMsg,
- const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation)
{
state->removeTag<IterativeQueryTag>();
- state->fail({security::v2::ValidationError::Code::CANNOT_RETRIEVE_CERT, "Cannot fetch certificate due to " +
+ state->fail({security::ValidationError::Code::CANNOT_RETRIEVE_CERT, "Cannot fetch certificate due to " +
errMsg + " `" + certRequest->interest.getName().toUri() + "`"});
}
void
CertificateFetcherAppCert::onValidationSuccessCallback(const Data& data,
- const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation)
{
state->removeTag<IterativeQueryTag>();
if (data.getContentType() == NDNS_NACK) {
- return state->fail({security::v2::ValidationError::Code::CANNOT_RETRIEVE_CERT,
+ return state->fail({security::ValidationError::Code::CANNOT_RETRIEVE_CERT,
"Cannot fetch certificate: got Nack for query `" +
certRequest->interest.getName().toUri() + "`"});
}
@@ -107,7 +107,7 @@
cert = Certificate(data.getContent().blockFromValue());
}
catch (const ndn::tlv::Error& e) {
- return state->fail({security::v2::ValidationError::Code::MALFORMED_CERT, "Fetched a malformed "
+ return state->fail({security::ValidationError::Code::MALFORMED_CERT, "Fetched a malformed "
"certificate `" + data.getName().toUri() + "` (" + e.what() + ")"});
}
@@ -115,13 +115,13 @@
}
void
-CertificateFetcherAppCert::onValidationFailCallback(const security::v2::ValidationError& err,
- const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+CertificateFetcherAppCert::onValidationFailCallback(const security::ValidationError& err,
+ const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation)
{
state->removeTag<IterativeQueryTag>();
- state->fail({security::v2::ValidationError::Code::CANNOT_RETRIEVE_CERT,
+ state->fail({security::ValidationError::Code::CANNOT_RETRIEVE_CERT,
"Cannot fetch certificate due to NDNS validation error: " +
err.getInfo() + " `" + certRequest->interest.getName().toUri() + "`"});
}
diff --git a/src/validator/certificate-fetcher-ndns-appcert.hpp b/src/validator/certificate-fetcher-ndns-appcert.hpp
index 2bd9305..cf8bb35 100644
--- a/src/validator/certificate-fetcher-ndns-appcert.hpp
+++ b/src/validator/certificate-fetcher-ndns-appcert.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, Regents of the University of California.
+/*
+ * Copyright (c) 2014-2020, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -21,7 +21,7 @@
#define NDNS_VALIDATOR_CERTIFICATE_FETCHER_NDNS_APPCERT_HPP
#include <ndn-cxx/ims/in-memory-storage.hpp>
-#include <ndn-cxx/security/v2/validator.hpp>
+#include <ndn-cxx/security/validator.hpp>
namespace ndn {
namespace ndns {
@@ -31,7 +31,7 @@
* By an iterative-query process, it will retrieve the record, execute authentications,
* and de-encapsulate record to get application's certificate.
*/
-class CertificateFetcherAppCert : public security::v2::CertificateFetcher
+class CertificateFetcherAppCert : public security::CertificateFetcher
{
public:
explicit
@@ -47,8 +47,8 @@
* If validated, de-encapsulate and call continueValidation.
*/
void
- doFetch(const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ doFetch(const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation) override;
private:
@@ -57,8 +57,8 @@
*/
void
onQuerySuccessCallback(const Data& data,
- const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation);
/**
@@ -68,8 +68,8 @@
*/
void
onQueryFailCallback(const std::string& errMsg,
- const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation);
/**
@@ -77,22 +77,22 @@
*/
void
onValidationSuccessCallback(const Data& data,
- const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation);
/**
* @brief Callback invoked when rrset validation failed
*/
void
- onValidationFailCallback(const security::v2::ValidationError& err,
- const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ onValidationFailCallback(const security::ValidationError& err,
+ const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation);
private:
Face& m_face;
- unique_ptr<security::v2::Validator> m_validator;
+ unique_ptr<security::Validator> m_validator;
InMemoryStorage* m_nsCache;
size_t m_startComponentIndex;
};
@@ -100,4 +100,4 @@
} // namespace ndns
} // namespace ndn
-#endif // NDNS_VALIDATOR_CERTIFICATE_FETCHER_NDNS_APPCERT_HPP
\ No newline at end of file
+#endif // NDNS_VALIDATOR_CERTIFICATE_FETCHER_NDNS_APPCERT_HPP
diff --git a/src/validator/certificate-fetcher-ndns-cert.cpp b/src/validator/certificate-fetcher-ndns-cert.cpp
index bf64515..b1979b5 100644
--- a/src/validator/certificate-fetcher-ndns-cert.cpp
+++ b/src/validator/certificate-fetcher-ndns-cert.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California.
+ * Copyright (c) 2014-2020, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -28,7 +28,7 @@
namespace ndn {
namespace ndns {
-using security::v2::Certificate;
+using security::Certificate;
NDNS_LOG_INIT(CertificateFetcherNdnsCert);
@@ -42,8 +42,8 @@
}
void
-CertificateFetcherNdnsCert::doFetch(const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+CertificateFetcherNdnsCert::doFetch(const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation)
{
const Name& key = certRequest->interest.getName();
@@ -77,8 +77,8 @@
void
CertificateFetcherNdnsCert::nsSuccessCallback(const Data& data,
- const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation)
{
Name interestName(certRequest->interest.getName());
@@ -113,8 +113,8 @@
void
CertificateFetcherNdnsCert::nsFailCallback(const std::string& errMsg,
- const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation)
{
NDNS_LOG_WARN("Cannot fetch link due to " +
@@ -148,8 +148,8 @@
void
CertificateFetcherNdnsCert::dataCallback(const Data& data,
- const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation)
{
NDNS_LOG_DEBUG("Fetched certificate from network " << data.getName());
@@ -161,7 +161,7 @@
cert = Certificate(data);
}
catch (const ndn::tlv::Error& e) {
- return state->fail({security::v2::ValidationError::Code::MALFORMED_CERT, "Fetched a malformed "
+ return state->fail({security::ValidationError::Code::MALFORMED_CERT, "Fetched a malformed "
"certificate `" + data.getName().toUri() + "` (" + e.what() + ")"});
}
@@ -170,8 +170,8 @@
void
CertificateFetcherNdnsCert::nackCallback(const lp::Nack& nack,
- const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation)
{
NDNS_LOG_DEBUG("NACK (" << nack.getReason() << ") while fetching certificate "
@@ -184,14 +184,14 @@
}
else {
state->removeTag<IterativeQueryTag>();
- state->fail({security::v2::ValidationError::Code::CANNOT_RETRIEVE_CERT, "Cannot fetch certificate "
+ state->fail({security::ValidationError::Code::CANNOT_RETRIEVE_CERT, "Cannot fetch certificate "
"after all retries `" + certRequest->interest.getName().toUri() + "`"});
}
}
void
-CertificateFetcherNdnsCert::timeoutCallback(const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+CertificateFetcherNdnsCert::timeoutCallback(const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation)
{
NDNS_LOG_DEBUG("Timeout while fetching certificate " << certRequest->interest.getName()
@@ -203,7 +203,7 @@
}
else {
state->removeTag<IterativeQueryTag>();
- state->fail({security::v2::ValidationError::Code::CANNOT_RETRIEVE_CERT, "Cannot fetch certificate "
+ state->fail({security::ValidationError::Code::CANNOT_RETRIEVE_CERT, "Cannot fetch certificate "
"after all retries `" + certRequest->interest.getName().toUri() + "`"});
}
}
diff --git a/src/validator/certificate-fetcher-ndns-cert.hpp b/src/validator/certificate-fetcher-ndns-cert.hpp
index a67e5b0..f0df918 100644
--- a/src/validator/certificate-fetcher-ndns-cert.hpp
+++ b/src/validator/certificate-fetcher-ndns-cert.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, Regents of the University of California.
+/*
+ * Copyright (c) 2014-2020, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -22,7 +22,7 @@
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/ims/in-memory-storage.hpp>
-#include <ndn-cxx/security/v2/certificate-fetcher.hpp>
+#include <ndn-cxx/security/certificate-fetcher.hpp>
namespace ndn {
namespace ndns {
@@ -30,7 +30,7 @@
/**
* @brief Fetch NDNS-owned certificate by an iterative query process
*/
-class CertificateFetcherNdnsCert : public security::v2::CertificateFetcher
+class CertificateFetcherNdnsCert : public security::CertificateFetcher
{
public:
explicit
@@ -46,8 +46,8 @@
protected:
void
- doFetch(const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ doFetch(const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation) override;
private:
@@ -56,8 +56,8 @@
*/
void
nsSuccessCallback(const Data& data,
- const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation);
/**
@@ -67,8 +67,8 @@
*/
void
nsFailCallback(const std::string& errMsg,
- const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation);
/**
@@ -84,8 +84,8 @@
*/
void
dataCallback(const Data& data,
- const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation);
/**
* @brief Callback invoked when interest for fetching certificate gets NACKed.
@@ -96,8 +96,8 @@
*/
void
nackCallback(const lp::Nack& nack,
- const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation);
/**
@@ -106,8 +106,8 @@
* It will retry if certRequest->m_nRetriesLeft > 0
*/
void
- timeoutCallback(const shared_ptr<security::v2::CertificateRequest>& certRequest,
- const shared_ptr<security::v2::ValidationState>& state,
+ timeoutCallback(const shared_ptr<security::CertificateRequest>& certRequest,
+ const shared_ptr<security::ValidationState>& state,
const ValidationContinuation& continueValidation);
protected:
Face& m_face;
@@ -120,4 +120,4 @@
} // namespace ndns
} // namespace ndn
-#endif // NDNS_VALIDATOR_CERTIFICATE_FETCHER_NDNS_CERT_HPP
\ No newline at end of file
+#endif // NDNS_VALIDATOR_CERTIFICATE_FETCHER_NDNS_CERT_HPP
diff --git a/src/validator/validator.cpp b/src/validator/validator.cpp
index 1e14f92..2be191e 100644
--- a/src/validator/validator.cpp
+++ b/src/validator/validator.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California.
+ * Copyright (c) 2014-2020, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -22,7 +22,7 @@
#include "certificate-fetcher-ndns-cert.hpp"
#include "logger.hpp"
-#include <ndn-cxx/security/v2/validation-policy-config.hpp>
+#include <ndn-cxx/security/validation-policy-config.hpp>
namespace ndn {
namespace ndns {
@@ -31,17 +31,17 @@
std::string NdnsValidatorBuilder::VALIDATOR_CONF_FILE(NDNS_CONFDIR "/validator.conf");
-unique_ptr<security::v2::Validator>
+unique_ptr<security::Validator>
NdnsValidatorBuilder::create(Face& face,
size_t nsCacheSize,
size_t startComponentIndex,
const std::string& confFile)
{
- auto validator = make_unique<security::v2::Validator>(make_unique<security::v2::ValidationPolicyConfig>(),
- make_unique<CertificateFetcherNdnsCert>(face,
- nsCacheSize,
- startComponentIndex));
- auto& policy = dynamic_cast<security::v2::ValidationPolicyConfig&>(validator->getPolicy());
+ auto validator = make_unique<security::Validator>(make_unique<security::ValidationPolicyConfig>(),
+ make_unique<CertificateFetcherNdnsCert>(face,
+ nsCacheSize,
+ startComponentIndex));
+ auto& policy = dynamic_cast<security::ValidationPolicyConfig&>(validator->getPolicy());
policy.load(confFile);
NDNS_LOG_TRACE("Validator loads configuration: " << confFile);
diff --git a/src/validator/validator.hpp b/src/validator/validator.hpp
index 92a4c09..cf3a6bb 100644
--- a/src/validator/validator.hpp
+++ b/src/validator/validator.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California.
+ * Copyright (c) 2014-2020, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -23,7 +23,7 @@
#include "config.hpp"
#include <ndn-cxx/data.hpp>
-#include <ndn-cxx/security/v2/validator.hpp>
+#include <ndn-cxx/security/validator.hpp>
namespace ndn {
namespace ndns {
@@ -33,7 +33,7 @@
public:
static std::string VALIDATOR_CONF_FILE;
- static unique_ptr<security::v2::Validator>
+ static unique_ptr<security::Validator>
create(Face& face,
size_t nsCacheSize = 500,
size_t startComponentIndex = 0,