blob: d9c9b64ec7b61dece1ec82f769e8cc9e8a49837f [file] [log] [blame]
#ifndef NLSR_CERT_STORE_HPP
#define NLSR_CERT_STORE_HPP
#include<list>
#include <ndn-cpp-dev/security/identity-certificate.hpp>
#include "nlsr_cse.hpp"
#include "nlsr_wl.hpp"
namespace nlsr
{
class NlsrCertificateStore
{
public:
NlsrCertificateStore()
: certTable()
, waitingList()
{}
bool addCertificate(NlsrCertificateStoreEntry & ncse);
bool addCertificate(ndn::shared_ptr<ndn::IdentityCertificate> pcert
, uint32_t csn, bool isv);
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
getCertificateFromStore(const std::string certName);
std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
getCertificateFromStore(const std::string certName, int checkSeqNum);
bool removeCertificateFromStroe(const std::string certName);
bool isCertificateNewInStore(const std::string certName, int checkSeqNo);
std::pair<uint32_t, bool> getCertificateSeqNum(std::string certName);
void printCertStore();
void setCertificateIsVerified(std::string certName, bool isVerified);
bool getCertificateIsVerified(std::string certName);
private:
void updateWaitingList(NlsrCertificateStoreEntry& ncse);
void updateWaitingList(std::string respCertName);
private:
std::list<NlsrCertificateStoreEntry> certTable;
WaitingList waitingList;
};
}
#endif