NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
certificate-cache.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2013-2019 Regents of the University of California.
4
*
5
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6
*
7
* ndn-cxx library is free software: you can redistribute it and/or modify it under the
8
* terms of the GNU Lesser General Public License as published by the Free Software
9
* Foundation, either version 3 of the License, or (at your option) any later version.
10
*
11
* ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14
*
15
* You should have received copies of the GNU General Public License and GNU Lesser
16
* General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17
* <http://www.gnu.org/licenses/>.
18
*
19
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20
*/
21
22
#ifndef NDN_SECURITY_V2_CERTIFICATE_CACHE_HPP
23
#define NDN_SECURITY_V2_CERTIFICATE_CACHE_HPP
24
25
#include "
ndn-cxx/interest.hpp
"
26
#include "
ndn-cxx/security/v2/certificate.hpp
"
27
28
#include <boost/multi_index_container.hpp>
29
#include <boost/multi_index/ordered_index.hpp>
30
#include <boost/multi_index/mem_fun.hpp>
31
#include <boost/multi_index/member.hpp>
32
33
namespace
ndn
{
34
namespace
security {
35
namespace
v2 {
36
43
class
CertificateCache
: noncopyable
44
{
45
public
:
51
explicit
52
CertificateCache
(
const
time::nanoseconds& maxLifetime =
getDefaultLifetime
());
53
62
void
63
insert
(
const
Certificate
& cert);
64
68
void
69
clear
();
70
78
const
Certificate
*
79
find
(
const
Name
& certPrefix)
const
;
80
88
const
Certificate
*
89
find
(
const
Interest
& interest)
const
;
90
91
private
:
92
class
Entry
93
{
94
public
:
95
Entry(
const
Certificate
& cert,
const
time::system_clock::TimePoint
& removalTime)
96
: cert(cert)
97
, removalTime(removalTime)
98
{
99
}
100
101
const
Name
&
102
getCertName()
const
103
{
104
return
cert.
getName
();
105
}
106
107
public
:
108
Certificate
cert;
109
time::system_clock::TimePoint
removalTime;
110
};
111
115
void
116
refresh();
117
118
public
:
119
static
time::nanoseconds
120
getDefaultLifetime
();
121
122
private
:
124
typedef
boost::multi_index::multi_index_container<
125
Entry,
126
boost::multi_index::indexed_by<
127
boost::multi_index::ordered_non_unique<
128
boost::multi_index::member<Entry, const time::system_clock::TimePoint, &Entry::removalTime>
129
>,
130
boost::multi_index::ordered_unique<
131
boost::multi_index::const_mem_fun<Entry, const Name&, &Entry::getCertName>
132
>
133
>
134
> CertIndex;
135
136
typedef
CertIndex::nth_index<0>::type CertIndexByTime;
137
typedef
CertIndex::nth_index<1>::type CertIndexByName;
138
CertIndex m_certs;
139
CertIndexByTime& m_certsByTime;
140
CertIndexByName& m_certsByName;
141
time::nanoseconds m_maxLifetime;
142
};
143
144
}
// namespace v2
145
}
// namespace security
146
}
// namespace ndn
147
148
#endif // NDN_SECURITY_V2_CERTIFICATE_CACHE_HPP
ndn::time::system_clock::TimePoint
time_point TimePoint
Definition:
time.hpp:195
certificate.hpp
ndn::security::v2::CertificateCache::clear
void clear()
Remove all certificates from cache.
Definition:
certificate-cache.cpp:61
ndn::Data::getName
const Name & getName() const
Get name.
Definition:
data.hpp:124
ndn::security::v2::CertificateCache::getDefaultLifetime
static time::nanoseconds getDefaultLifetime()
Definition:
certificate-cache.cpp:32
ndn::security::v2::CertificateCache::CertificateCache
CertificateCache(const time::nanoseconds &maxLifetime=getDefaultLifetime())
Create an object for certificate cache.
Definition:
certificate-cache.cpp:37
ndn::security::v2::CertificateCache
Represents a container for verified certificates.
Definition:
certificate-cache.hpp:44
ndn::security::v2::CertificateCache::insert
void insert(const Certificate &cert)
Insert certificate into cache.
Definition:
certificate-cache.cpp:45
ndn::Name
Represents an absolute name.
Definition:
name.hpp:44
ndn::security::v2::Certificate
The certificate following the certificate format naming convention.
Definition:
certificate.hpp:82
ndn::Interest
Represents an Interest packet.
Definition:
interest.hpp:44
interest.hpp
ndn::security::v2::CertificateCache::find
const Certificate * find(const Name &certPrefix) const
Get certificate given key name.
Definition:
certificate-cache.cpp:67
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndnSIM
ndn-cxx
ndn-cxx
security
v2
certificate-cache.hpp
Generated on Mon Jun 1 2020 22:32:15 for ndnSIM by
1.8.18