NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
trust-anchor-container.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_TRUST_ANCHOR_CONTAINER_HPP
23
#define NDN_SECURITY_V2_TRUST_ANCHOR_CONTAINER_HPP
24
25
#include "
ndn-cxx/interest.hpp
"
26
#include "
ndn-cxx/security/v2/certificate.hpp
"
27
#include "
ndn-cxx/security/v2/trust-anchor-group.hpp
"
28
29
#include <boost/multi_index_container.hpp>
30
#include <boost/multi_index/hashed_index.hpp>
31
#include <boost/multi_index/ordered_index.hpp>
32
#include <boost/multi_index/mem_fun.hpp>
33
34
namespace
ndn
{
35
namespace
security {
36
namespace
v2 {
37
55
class
TrustAnchorContainer
: noncopyable
56
{
57
public
:
58
class
Error
:
public
std::runtime_error
59
{
60
public
:
61
using
std::runtime_error::runtime_error;
62
};
63
75
void
76
insert
(
const
std::string& groupId,
Certificate
&& cert);
77
90
void
91
insert
(
const
std::string& groupId,
const
boost::filesystem::path& path,
92
time::nanoseconds refreshPeriod,
bool
isDir =
false
);
93
97
void
98
clear
();
99
107
const
Certificate
*
108
find
(
const
Name
& keyName)
const
;
109
119
const
Certificate
*
120
find
(
const
Interest
& interest)
const
;
121
126
TrustAnchorGroup
&
127
getGroup
(
const
std::string& groupId)
const
;
128
132
size_t
133
size
()
const
;
134
135
private
:
136
void
137
refresh();
138
139
private
:
140
using
AnchorContainerBase = boost::multi_index::multi_index_container<
141
Certificate
,
142
boost::multi_index::indexed_by<
143
boost::multi_index::ordered_unique<
144
boost::multi_index::const_mem_fun<Data, const Name&, &Data::getName>
145
>
146
>
147
>;
148
149
class
AnchorContainer :
public
CertContainerInterface
,
150
public
AnchorContainerBase
151
{
152
public
:
153
void
154
add(
Certificate
&& cert)
final
;
155
156
void
157
remove(
const
Name
& certName)
final
;
158
159
void
160
clear
();
161
};
162
163
using
GroupContainer = boost::multi_index::multi_index_container<
164
shared_ptr<TrustAnchorGroup>,
165
boost::multi_index::indexed_by<
166
boost::multi_index::hashed_unique<
167
boost::multi_index::const_mem_fun<TrustAnchorGroup, const std::string&, &TrustAnchorGroup::getId>
168
>
169
>
170
>;
171
172
GroupContainer m_groups;
173
AnchorContainer m_anchors;
174
};
175
176
}
// namespace v2
177
}
// namespace security
178
}
// namespace ndn
179
180
#endif // NDN_SECURITY_V2_TRUST_ANCHOR_CONTAINER_HPP
ndn::security::v2::CertContainerInterface
Definition:
trust-anchor-group.hpp:36
certificate.hpp
ndn::security::v2::TrustAnchorGroup
A group of trust anchors.
Definition:
trust-anchor-group.hpp:52
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::security::v2::TrustAnchorContainer::getGroup
TrustAnchorGroup & getGroup(const std::string &groupId) const
Get trusted anchor group.
Definition:
trust-anchor-container.cpp:108
ndn::security::v2::TrustAnchorContainer::find
const Certificate * find(const Name &keyName) const
Search for certificate across all groups (longest prefix match)
Definition:
trust-anchor-container.cpp:81
ndn::Interest
Represents an Interest packet.
Definition:
interest.hpp:44
interest.hpp
ndn::security::v2::TrustAnchorContainer
represents a container for trust anchors.
Definition:
trust-anchor-container.hpp:56
ndn::security::v2::TrustAnchorContainer::size
size_t size() const
Get number of trust anchors across all groups.
Definition:
trust-anchor-container.cpp:118
trust-anchor-group.hpp
ndn::security::v2::TrustAnchorContainer::Error
Definition:
trust-anchor-container.hpp:59
ndn::security::v2::TrustAnchorContainer::insert
void insert(const std::string &groupId, Certificate &&cert)
Insert a static trust anchor.
Definition:
trust-anchor-container.cpp:49
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::security::v2::TrustAnchorContainer::clear
void clear()
Remove all static or dynamic anchors.
Definition:
trust-anchor-container.cpp:74
ndnSIM
ndn-cxx
ndn-cxx
security
v2
trust-anchor-container.hpp
Generated on Mon Jun 1 2020 22:32:15 for ndnSIM by
1.8.18