29 const time::seconds& defaultTtl)
30 : m_defaultTtl(defaultTtl)
42 m_scheduler.scheduleEvent(time::seconds(0), [
this, certificate] { this->insert(certificate); });
45 shared_ptr<const IdentityCertificate>
50 return it->second.first;
52 return shared_ptr<IdentityCertificate>();
58 m_scheduler.scheduleEvent(time::seconds(0), [
this] { this->removeAll(); });
68 CertificateCacheTtl::insert(shared_ptr<const IdentityCertificate> certificate)
70 time::milliseconds expire = (certificate->getFreshnessPeriod() >= time::seconds::zero() ?
80 bind(&CertificateCacheTtl::remove,
81 this, certificate->getName()));
83 m_cache[index] = std::make_pair(certificate, eventId);
87 CertificateCacheTtl::remove(
const Name& certificateName)
96 CertificateCacheTtl::removeAll()
Copyright (c) 2011-2015 Regents of the University of California.
virtual void insertCertificate(shared_ptr< const IdentityCertificate > certificate)
std::shared_ptr< ns3::EventId > EventId
Table::const_iterator iterator
virtual ~CertificateCacheTtl()
Name abstraction to represent an absolute name.
virtual shared_ptr< const IdentityCertificate > getCertificate(const Name &certificateNameWithoutVersion)
CertificateCacheTtl(boost::asio::io_service &io, const time::seconds &defaultTtl=time::seconds(3600))
PartialName getPrefix(ssize_t nComponents) const
Extract a prefix (PartialName) of the name, containing first nComponents components.
time::seconds m_defaultTtl