utils: Allow resetting command interest validator rules
This feature is necessary for the issue #1584
Change-Id: Ie0a39973b76ded003e4ce88d5a03fa4f73d1468b
diff --git a/src/util/command-interest-validator.hpp b/src/util/command-interest-validator.hpp
index 9a077b1..9d8660e 100644
--- a/src/util/command-interest-validator.hpp
+++ b/src/util/command-interest-validator.hpp
@@ -84,6 +84,12 @@
void
addInterestBypassRule(const std::string& regex);
+ /**
+ * @brief Remove all installed Interest rules (e.g., when reinitialization needed)
+ */
+ void
+ reset();
+
protected:
virtual void
checkPolicy(const Data& data,
@@ -137,6 +143,13 @@
}
inline void
+CommandInterestValidator::reset()
+{
+ m_trustAnchorsForInterest.clear();
+ m_trustScopeForInterest.clear();
+}
+
+inline void
CommandInterestValidator::checkPolicy(const Interest& interest,
int stepCount,
const OnInterestValidated& onValidated,