akmhoque | 099495b | 2014-03-11 16:01:19 -0500 | [diff] [blame] | 1 | #ifndef NLSR_CERT_STORE_ENTRY_HPP |
| 2 | #define NLSR_CERT_STORE_ENTRY_HPP |
| 3 | |
| 4 | #include <iostream> |
| 5 | #include <ndn-cpp-dev/face.hpp> |
| 6 | #include <ndn-cpp-dev/security/identity-certificate.hpp> |
| 7 | |
| 8 | namespace nlsr |
| 9 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 10 | class NlsrCertificateStoreEntry |
| 11 | { |
| 12 | public: |
| 13 | NlsrCertificateStoreEntry() |
akmhoque | 05d5fcf | 2014-04-15 14:58:45 -0500 | [diff] [blame^] | 14 | : m_cert(ndn::make_shared<ndn::IdentityCertificate>()) |
| 15 | , m_certSeqNum(0) |
| 16 | , m_isSignerVerified(false) |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 17 | {} |
| 18 | |
| 19 | NlsrCertificateStoreEntry(ndn::shared_ptr<ndn::IdentityCertificate> pcert |
| 20 | , uint32_t csn, bool isv) |
akmhoque | 05d5fcf | 2014-04-15 14:58:45 -0500 | [diff] [blame^] | 21 | : m_cert(pcert) |
| 22 | , m_certSeqNum(csn) |
| 23 | , m_isSignerVerified(isv) |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 24 | {} |
| 25 | |
| 26 | ndn::shared_ptr<ndn::IdentityCertificate> getCert() const |
akmhoque | 099495b | 2014-03-11 16:01:19 -0500 | [diff] [blame] | 27 | { |
akmhoque | 05d5fcf | 2014-04-15 14:58:45 -0500 | [diff] [blame^] | 28 | return m_cert; |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | void setCert(ndn::shared_ptr<ndn::IdentityCertificate> pcert) |
| 32 | { |
akmhoque | 05d5fcf | 2014-04-15 14:58:45 -0500 | [diff] [blame^] | 33 | m_cert=pcert; |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | uint32_t getCertSeqNum() const |
| 37 | { |
akmhoque | 05d5fcf | 2014-04-15 14:58:45 -0500 | [diff] [blame^] | 38 | return m_certSeqNum; |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | void setCertSeqNum(uint32_t csn) |
| 42 | { |
akmhoque | 05d5fcf | 2014-04-15 14:58:45 -0500 | [diff] [blame^] | 43 | m_certSeqNum=csn; |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | bool getIsSignerVerified() const |
| 47 | { |
akmhoque | 05d5fcf | 2014-04-15 14:58:45 -0500 | [diff] [blame^] | 48 | return m_isSignerVerified; |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | void setIsSignerVerified(bool isv) |
| 52 | { |
akmhoque | 05d5fcf | 2014-04-15 14:58:45 -0500 | [diff] [blame^] | 53 | m_isSignerVerified=isv; |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | private: |
akmhoque | 05d5fcf | 2014-04-15 14:58:45 -0500 | [diff] [blame^] | 57 | ndn::shared_ptr<ndn::IdentityCertificate> m_cert; |
| 58 | uint32_t m_certSeqNum; |
| 59 | bool m_isSignerVerified; |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 60 | }; |
| 61 | /* Debugging Purpose */ |
| 62 | std::ostream& |
| 63 | operator <<(std::ostream& os, const NlsrCertificateStoreEntry& ncse); |
akmhoque | 099495b | 2014-03-11 16:01:19 -0500 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | #endif |