bug+codestyle: Fix compile bugs and adjust code style
Change-Id: I008bb538441c099fa25b8b967fbf23ffce13a220
diff --git a/src/validator-panel.hpp b/src/validator-panel.hpp
new file mode 100644
index 0000000..1277ffe
--- /dev/null
+++ b/src/validator-panel.hpp
@@ -0,0 +1,71 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+#ifndef CHRONOS_VALIDATOR_PANEL_HPP
+#define CHRONOS_VALIDATOR_PANEL_HPP
+
+#include "common.hpp"
+
+#include <ndn-cxx/security/validator.hpp>
+#include <ndn-cxx/security/sec-rule-relative.hpp>
+#include <ndn-cxx/security/certificate-cache.hpp>
+
+#include "endorse-certificate.hpp"
+
+namespace chronos {
+
+class ValidatorPanel : public ndn::Validator
+{
+public:
+
+ static const shared_ptr<ndn::CertificateCache> DEFAULT_CERT_CACHE;
+
+ ValidatorPanel(int stepLimit = 10,
+ const shared_ptr<ndn::CertificateCache> cache = DEFAULT_CERT_CACHE);
+
+ ~ValidatorPanel()
+ {
+ }
+
+ void
+ addTrustAnchor(const EndorseCertificate& selfEndorseCertificate);
+
+ void
+ removeTrustAnchor(const Name& keyName);
+
+protected:
+ virtual void
+ checkPolicy(const Data& data,
+ int stepCount,
+ const ndn::OnDataValidated& onValidated,
+ const ndn::OnDataValidationFailed& onValidationFailed,
+ std::vector<shared_ptr<ndn::ValidationRequest> >& nextSteps);
+
+ virtual void
+ checkPolicy(const Interest& interest,
+ int stepCount,
+ const ndn::OnInterestValidated& onValidated,
+ const ndn::OnInterestValidationFailed& onValidationFailed,
+ std::vector<shared_ptr<ndn::ValidationRequest> >& nextSteps)
+ {
+ onValidationFailed(interest.shared_from_this(),
+ "No rules for interest.");
+ }
+
+private:
+ int m_stepLimit;
+ shared_ptr<ndn::CertificateCache> m_certificateCache;
+ shared_ptr<ndn::SecRuleRelative> m_endorseeRule;
+ std::map<Name, ndn::PublicKey> m_trustAnchors;
+};
+
+} // namespace chronos
+
+#endif // CHRONOS_VALIDATOR_PANEL_HPP