blob: d9c9b64ec7b61dece1ec82f769e8cc9e8a49837f [file] [log] [blame]
akmhoqueba094742014-02-28 11:47:21 -06001#ifndef NLSR_CERT_STORE_HPP
2#define NLSR_CERT_STORE_HPP
3
akmhoqueeb764c52014-03-11 16:01:09 -05004#include<list>
5#include <ndn-cpp-dev/security/identity-certificate.hpp>
6#include "nlsr_cse.hpp"
akmhoquefa8ee9b2014-03-14 09:06:24 -05007#include "nlsr_wl.hpp"
akmhoqueba094742014-02-28 11:47:21 -06008
akmhoqueeb764c52014-03-11 16:01:09 -05009namespace nlsr
10{
akmhoque5a44dd42014-03-12 18:11:32 -050011 class NlsrCertificateStore
12 {
13 public:
14 NlsrCertificateStore()
akmhoquefa8ee9b2014-03-14 09:06:24 -050015 : certTable()
16 , waitingList()
akmhoque5a44dd42014-03-12 18:11:32 -050017 {}
18
19 bool addCertificate(NlsrCertificateStoreEntry & ncse);
20 bool addCertificate(ndn::shared_ptr<ndn::IdentityCertificate> pcert
21 , uint32_t csn, bool isv);
22 std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
akmhoquefa8ee9b2014-03-14 09:06:24 -050023 getCertificateFromStore(const std::string certName);
akmhoque5a44dd42014-03-12 18:11:32 -050024 std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
akmhoquefa8ee9b2014-03-14 09:06:24 -050025 getCertificateFromStore(const std::string certName, int checkSeqNum);
akmhoque5a44dd42014-03-12 18:11:32 -050026 bool removeCertificateFromStroe(const std::string certName);
27 bool isCertificateNewInStore(const std::string certName, int checkSeqNo);
akmhoquefa8ee9b2014-03-14 09:06:24 -050028 std::pair<uint32_t, bool> getCertificateSeqNum(std::string certName);
akmhoque5a44dd42014-03-12 18:11:32 -050029 void printCertStore();
akmhoquefa8ee9b2014-03-14 09:06:24 -050030 void setCertificateIsVerified(std::string certName, bool isVerified);
31 bool getCertificateIsVerified(std::string certName);
32 private:
33 void updateWaitingList(NlsrCertificateStoreEntry& ncse);
34 void updateWaitingList(std::string respCertName);
35
akmhoque5a44dd42014-03-12 18:11:32 -050036 private:
37 std::list<NlsrCertificateStoreEntry> certTable;
akmhoquefa8ee9b2014-03-14 09:06:24 -050038 WaitingList waitingList;
akmhoque5a44dd42014-03-12 18:11:32 -050039 };
akmhoqueeb764c52014-03-11 16:01:09 -050040}
akmhoqueba094742014-02-28 11:47:21 -060041
42#endif