Vanetza
 
Loading...
Searching...
No Matches
vanetza::security::v2::CertificateCache Class Reference

#include <certificate_cache.hpp>

Classes

struct  CachedCertificate
 
struct  Expiry
 

Public Member Functions

 CertificateCache (const Runtime &rt)
 
void insert (const Certificate &certificate)
 
std::list< Certificatelookup (const HashedId8 &id, SubjectType type)
 
std::size_t size () const
 

Private Types

using map_type = std::multimap< HashedId8, CachedCertificate >
 
using heap_type = boost::heap::binomial_heap< Expiry, boost::heap::compare< std::greater< Expiry > > >
 

Private Member Functions

void drop_expired ()
 
bool is_expired (const Expiry &) const
 
void refresh (heap_type::handle_type &, Clock::duration)
 

Private Attributes

const Runtimem_runtime
 
heap_type m_expiries
 
map_type m_certificates
 

Detailed Description

CertificateCache remembers validated certificates for some time. This is necessary for certificate lookup when only its digest is known.

Definition at line 22 of file certificate_cache.hpp.

Member Typedef Documentation

◆ heap_type

using vanetza::security::v2::CertificateCache::heap_type = boost::heap::binomial_heap<Expiry, boost::heap::compare<std::greater<Expiry> >>
private

Definition at line 59 of file certificate_cache.hpp.

◆ map_type

using vanetza::security::v2::CertificateCache::map_type = std::multimap<HashedId8, CachedCertificate>
private

Definition at line 51 of file certificate_cache.hpp.

Constructor & Destructor Documentation

◆ CertificateCache()

vanetza::security::v2::CertificateCache::CertificateCache ( const Runtime rt)

Definition at line 11 of file certificate_cache.cpp.

Member Function Documentation

◆ drop_expired()

void vanetza::security::v2::CertificateCache::drop_expired ( )
private

Definition at line 84 of file certificate_cache.cpp.

◆ insert()

void vanetza::security::v2::CertificateCache::insert ( const Certificate certificate)

Puts a (validated) certificate into the cache.

Parameters
certificatecertificate to add to the cache

Definition at line 15 of file certificate_cache.cpp.

◆ is_expired()

bool vanetza::security::v2::CertificateCache::is_expired ( const Expiry expiry) const
private

Definition at line 92 of file certificate_cache.cpp.

◆ lookup()

std::list< Certificate > vanetza::security::v2::CertificateCache::lookup ( const HashedId8 &  id,
SubjectType  type 
)

Lookup certificates based on the passed HashedId8.

Parameters
idhash identifier of the certificate
typetype of certificate to lookup
Returns
all stored certificates matching the passed identifier and type

Definition at line 55 of file certificate_cache.cpp.

◆ refresh()

void vanetza::security::v2::CertificateCache::refresh ( heap_type::handle_type &  handle,
Clock::duration  lifetime 
)
private

Definition at line 97 of file certificate_cache.cpp.

◆ size()

std::size_t vanetza::security::v2::CertificateCache::size ( ) const
inline

Number of currently stored certificates

Returns
cache size

Definition at line 47 of file certificate_cache.hpp.

Member Data Documentation

◆ m_certificates

map_type vanetza::security::v2::CertificateCache::m_certificates
private

Definition at line 69 of file certificate_cache.hpp.

◆ m_expiries

heap_type vanetza::security::v2::CertificateCache::m_expiries
private

Definition at line 68 of file certificate_cache.hpp.

◆ m_runtime

const Runtime& vanetza::security::v2::CertificateCache::m_runtime
private

Definition at line 67 of file certificate_cache.hpp.


The documentation for this class was generated from the following files: