security: Clean up ValidatorConfig when it is re-loaded.

Refs: #1492

Change-Id: I203a57c0cf18c3c5993abfa9c3c7ca9decbed6c2
diff --git a/src/security/validator-config.hpp b/src/security/validator-config.hpp
index a5a8af1..e22c446 100644
--- a/src/security/validator-config.hpp
+++ b/src/security/validator-config.hpp
@@ -60,6 +60,12 @@
   load(const security::conf::ConfigSection& configSection,
        const std::string& filename);
 
+  inline void
+  reset();
+
+  inline bool
+  isEmpty();
+
 protected:
   virtual void
   checkPolicy(const Data& data,
@@ -122,6 +128,26 @@
   AnchorList m_anchors;
 };
 
+inline void
+ValidatorConfig::reset()
+{
+  m_certificateCache->reset();
+  m_interestRules.clear();
+  m_dataRules.clear();
+  m_anchors.clear();
+}
+
+inline bool
+ValidatorConfig::isEmpty()
+{
+  if (m_certificateCache->isEmpty() &&
+      m_interestRules.empty() &&
+      m_dataRules.empty() &&
+      m_anchors.empty())
+    return true;
+  return false;
+}
+
 template<class Packet, class OnValidated, class OnFailed>
 void
 ValidatorConfig::checkSignature(const Packet& packet,