blob: 2ef4513f76ea77107a3dc899df9a95a6d68cd9d7 [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()
akmhoque05d5fcf2014-04-15 14:58:45 -050015 : m_certTable()
16 , m_waitingList()
akmhoque5a44dd42014-03-12 18:11:32 -050017 {}
18
akmhoque05d5fcf2014-04-15 14:58:45 -050019 bool addCertificate(NlsrCertificateStoreEntry& ncse);
akmhoque5a44dd42014-03-12 18:11:32 -050020 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);
akmhoque05d5fcf2014-04-15 14:58:45 -050029 void print();
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:
akmhoque05d5fcf2014-04-15 14:58:45 -050037 std::list<NlsrCertificateStoreEntry> m_certTable;
38 WaitingList m_waitingList;
akmhoque5a44dd42014-03-12 18:11:32 -050039 };
akmhoqueeb764c52014-03-11 16:01:09 -050040}
akmhoqueba094742014-02-28 11:47:21 -060041
42#endif