akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 1 | #ifndef NLSR_CERT_STORE_HPP |
| 2 | #define NLSR_CERT_STORE_HPP |
| 3 | |
akmhoque | eb764c5 | 2014-03-11 16:01:09 -0500 | [diff] [blame] | 4 | #include<list> |
| 5 | #include <ndn-cpp-dev/security/identity-certificate.hpp> |
| 6 | #include "nlsr_cse.hpp" |
akmhoque | fa8ee9b | 2014-03-14 09:06:24 -0500 | [diff] [blame^] | 7 | #include "nlsr_wl.hpp" |
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 8 | |
akmhoque | eb764c5 | 2014-03-11 16:01:09 -0500 | [diff] [blame] | 9 | namespace nlsr |
| 10 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 11 | class NlsrCertificateStore |
| 12 | { |
| 13 | public: |
| 14 | NlsrCertificateStore() |
akmhoque | fa8ee9b | 2014-03-14 09:06:24 -0500 | [diff] [blame^] | 15 | : certTable() |
| 16 | , waitingList() |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 17 | {} |
| 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> |
akmhoque | fa8ee9b | 2014-03-14 09:06:24 -0500 | [diff] [blame^] | 23 | getCertificateFromStore(const std::string certName); |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 24 | std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> |
akmhoque | fa8ee9b | 2014-03-14 09:06:24 -0500 | [diff] [blame^] | 25 | getCertificateFromStore(const std::string certName, int checkSeqNum); |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 26 | bool removeCertificateFromStroe(const std::string certName); |
| 27 | bool isCertificateNewInStore(const std::string certName, int checkSeqNo); |
akmhoque | fa8ee9b | 2014-03-14 09:06:24 -0500 | [diff] [blame^] | 28 | std::pair<uint32_t, bool> getCertificateSeqNum(std::string certName); |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 29 | void printCertStore(); |
akmhoque | fa8ee9b | 2014-03-14 09:06:24 -0500 | [diff] [blame^] | 30 | 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 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 36 | private: |
| 37 | std::list<NlsrCertificateStoreEntry> certTable; |
akmhoque | fa8ee9b | 2014-03-14 09:06:24 -0500 | [diff] [blame^] | 38 | WaitingList waitingList; |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 39 | }; |
akmhoque | eb764c5 | 2014-03-11 16:01:09 -0500 | [diff] [blame] | 40 | } |
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 41 | |
| 42 | #endif |