akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 1 | #ifndef NLSR_CERT_STORE_HPP |
| 2 | #define NLSR_CERT_STORE_HPP |
| 3 | |
| 4 | #include <list> |
| 5 | #include <ndn-cpp-dev/security/identity-certificate.hpp> |
| 6 | #include "certificate-store-entry.hpp" |
| 7 | #include "waiting-list.hpp" |
| 8 | |
| 9 | namespace nlsr { |
| 10 | class CertificateStore |
| 11 | { |
| 12 | public: |
| 13 | CertificateStore() |
| 14 | : m_certTable() |
| 15 | , m_waitingList() |
| 16 | {} |
| 17 | |
| 18 | bool |
| 19 | addCertificate(CertificateStoreEntry& ncse); |
| 20 | |
| 21 | bool |
| 22 | addCertificate(ndn::shared_ptr<ndn::IdentityCertificate> pcert |
| 23 | , uint32_t csn, bool isv); |
| 24 | |
| 25 | std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> |
| 26 | getCertificateFromStore(const std::string certName); |
| 27 | |
| 28 | std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> |
| 29 | getCertificateFromStore(const std::string certName, uint64_t checkSeqNum); |
| 30 | |
| 31 | bool |
| 32 | removeCertificateFromStroe(const std::string certName); |
| 33 | |
| 34 | bool |
| 35 | isCertificateNewInStore(const std::string certName, int checkSeqNo); |
| 36 | |
| 37 | std::pair<uint32_t, bool> |
| 38 | getCertificateSeqNum(std::string certName); |
| 39 | |
| 40 | void |
| 41 | print(); |
| 42 | |
| 43 | void |
| 44 | setCertificateIsVerified(std::string certName, bool isVerified); |
| 45 | |
| 46 | bool |
| 47 | getCertificateIsVerified(std::string certName); |
| 48 | |
| 49 | private: |
| 50 | void |
| 51 | updateWaitingList(CertificateStoreEntry& ncse); |
| 52 | |
| 53 | void |
| 54 | updateWaitingList(std::string respCertName); |
| 55 | |
| 56 | private: |
| 57 | std::list<CertificateStoreEntry> m_certTable; |
| 58 | WaitingList m_waitingList; |
| 59 | }; |
| 60 | |
| 61 | } //namespace nlsr |
| 62 | |
| 63 | #endif // NLSR_CERT_STORE_HPP |