38 : m_certsByTime(m_certs.get<0>())
39 , m_certsByName(m_certs.get<1>())
40 , m_maxLifetime(maxLifetime)
49 if (notAfterTime < now) {
56 << time::duration_cast<time::seconds>(removalTime - now));
57 m_certs.insert(Entry(cert, removalTime));
70 if (certPrefix.
size() > 0 && certPrefix[-1].isImplicitSha256Digest()) {
71 NDN_LOG_INFO(
"Certificate search using name with the implicit digest is not yet supported");
73 auto itr = m_certsByName.lower_bound(certPrefix);
74 if (itr == m_certsByName.end() || !certPrefix.
isPrefixOf(itr->getCertName()))
83 NDN_LOG_DEBUG(
"Certificate search using ChildSelector is not supported, searching as if selector not specified");
85 if (interest.
getName().
size() > 0 && interest.
getName()[-1].isImplicitSha256Digest()) {
86 NDN_LOG_INFO(
"Certificate search using name with implicit digest is not yet supported");
90 for (
auto i = m_certsByName.lower_bound(interest.
getName());
93 const auto& cert = i->cert;
102 CertificateCache::refresh()
106 auto cIt = m_certsByTime.begin();
107 while (cIt != m_certsByTime.end() && cIt->removalTime < now) {
108 m_certsByTime.erase(cIt);
109 cIt = m_certsByTime.begin();
#define NDN_LOG_INFO(expression)
Copyright (c) 2011-2015 Regents of the University of California.
The certificate following the certificate format naming convention.
const Name & getName() const
Get name.
int getChildSelector() const
const Certificate * find(const Name &certPrefix) const
Get certificate given key name.
bool isPrefixOf(const Name &other) const
Check if this name is a prefix of another name.
void clear()
Remove all certificates from cache.
represents an Interest packet
static time::nanoseconds getDefaultLifetime()
static time_point now() noexcept
Represents a container for verified certificates.
#define NDN_LOG_INIT(name)
declare a log module
CertificateCache(const time::nanoseconds &maxLifetime=getDefaultLifetime())
Create an object for certificate cache.
#define NDN_LOG_DEBUG(expression)
std::pair< time::system_clock::TimePoint, time::system_clock::TimePoint > getPeriod() const
Get the stored validity period.
bool matchesData(const Data &data) const
Check if Interest can be satisfied by data.
Represents an absolute name.
std::string toIsoString(const system_clock::TimePoint &timePoint)
Convert to the ISO string representation of the time (YYYYMMDDTHHMMSS,fffffffff)
size_t size() const
Get number of components.
void insert(const Certificate &cert)
Insert certificate into cache.
ValidityPeriod getValidityPeriod() const
Get validity period of the certificate.
const Name & getName() const