security: Throw exception when loading on orphaned ValidationPolicyConfig
ValidationPolicyConfig must be assigned to a Validator instance prior to
loading and it is an API violation to load configuration otherwise.
Change-Id: Ib372cd3b6ab7c7ce1e37039f25b97e1d2f1511f9
Refs: #4758
diff --git a/src/security/v2/validation-policy-config.hpp b/src/security/v2/validation-policy-config.hpp
index 7690cc1..d2ed69c 100644
--- a/src/security/v2/validation-policy-config.hpp
+++ b/src/security/v2/validation-policy-config.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).
*
@@ -44,15 +44,31 @@
public:
ValidationPolicyConfig();
+ /**
+ * @brief Load policy from file @p filename
+ * @throw Error Validator instance not assigned to the policy (m_validator == nullptr)
+ */
void
load(const std::string& filename);
+ /**
+ * @brief Load policy from direct @p input
+ * @throw Error Validator instance not assigned to the policy (m_validator == nullptr)
+ */
void
load(const std::string& input, const std::string& filename);
+ /**
+ * @brief Load policy from direct @p input
+ * @throw Error Validator instance not assigned to the policy (m_validator == nullptr)
+ */
void
load(std::istream& input, const std::string& filename);
+ /**
+ * @brief Load policy from @p configSection
+ * @throw Error Validator instance not assigned to the policy (m_validator == nullptr)
+ */
void
load(const ConfigSection& configSection, const std::string& filename);