NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
certificate-cache-ttl.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
24 #ifndef NDN_SECURITY_CERTIFICATE_CACHE_TTL_HPP
25 #define NDN_SECURITY_CERTIFICATE_CACHE_TTL_HPP
26 
27 #include "../common.hpp"
28 #include "certificate-cache.hpp"
29 #include "../util/scheduler.hpp"
30 
31 namespace ndn {
32 
40 {
41 public:
42  explicit
43  CertificateCacheTtl(boost::asio::io_service& io,
44  const time::seconds& defaultTtl = time::seconds(3600));
45 
46  virtual
48 
49  virtual void
50  insertCertificate(shared_ptr<const IdentityCertificate> certificate);
51 
52  virtual shared_ptr<const IdentityCertificate>
53  getCertificate(const Name& certificateNameWithoutVersion);
54 
55  virtual void
56  reset();
57 
58  virtual size_t
59  getSize();
60 
61 private:
62  void
63  insert(shared_ptr<const IdentityCertificate> certificate);
64 
65  void
66  remove(const Name& certificateName);
67 
68  void
69  removeAll();
70 
71 protected:
72  typedef std::map<Name, std::pair<shared_ptr<const IdentityCertificate>, EventId> > Cache;
73 
74  time::seconds m_defaultTtl;
75  Cache m_cache;
76  Scheduler m_scheduler;
77 };
78 
79 } // namespace ndn
80 
81 #endif // NDN_SECURITY_CERTIFICATE_CACHE_TTL_HPP
Cache of validated certificates with freshness-based eviction policy.
Copyright (c) 2011-2015 Regents of the University of California.
virtual void insertCertificate(shared_ptr< const IdentityCertificate > certificate)
std::shared_ptr< ns3::EventId > EventId
Definition: scheduler.hpp:39
Name abstraction to represent an absolute name.
Definition: name.hpp:46
virtual shared_ptr< const IdentityCertificate > getCertificate(const Name &certificateNameWithoutVersion)
std::map< Name, std::pair< shared_ptr< const IdentityCertificate >, EventId > > Cache
CertificateCacheTtl(boost::asio::io_service &io, const time::seconds &defaultTtl=time::seconds(3600))
Interface for the cache of validated certificates.