NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
key-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-2021 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_CXX_SECURITY_PIB_KEY_CONTAINER_HPP
23
#define NDN_CXX_SECURITY_PIB_KEY_CONTAINER_HPP
24
25
#include "
ndn-cxx/security/pib/key.hpp
"
26
27
#include <iterator>
28
#include <set>
29
#include <unordered_map>
30
31
namespace
ndn
{
32
namespace
security
{
33
namespace
pib {
34
35
class
PibImpl;
36
37
namespace
detail {
38
class
KeyImpl;
39
class
IdentityImpl;
40
}
// namespace detail
41
48
class
KeyContainer
: noncopyable
49
{
50
public
:
51
class
const_iterator
52
{
53
public
:
54
using
iterator_category
= std::forward_iterator_tag;
55
using
value_type
=
const
Key
;
56
using
difference_type
= std::ptrdiff_t;
57
using
pointer
=
value_type
*;
58
using
reference
=
value_type
&;
59
60
const_iterator
();
61
62
Key
63
operator*();
64
65
const_iterator
&
66
operator++();
67
68
const_iterator
69
operator++(
int
);
70
71
bool
72
operator==
(
const
const_iterator
& other);
73
74
bool
75
operator!=
(
const
const_iterator
& other);
76
77
private
:
78
const_iterator
(std::set<Name>::const_iterator it,
const
KeyContainer
& container);
79
80
private
:
81
std::set<Name>::const_iterator m_it;
82
const
KeyContainer
* m_container;
83
84
friend
class
KeyContainer
;
85
};
86
87
using
iterator
=
const_iterator
;
88
89
public
:
90
const_iterator
91
begin()
const
;
92
93
const_iterator
94
end()
const
;
95
96
const_iterator
97
find(
const
Name
& keyName)
const
;
98
99
size_t
100
size
()
const
;
101
109
Key
110
add(span<const uint8_t> key,
const
Name
& keyName);
111
116
void
117
remove
(
const
Name
& keyName);
118
124
Key
125
get
(
const
Name
& keyName)
const
;
126
132
bool
133
isConsistent()
const
;
134
135
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
:
140
KeyContainer
(
const
Name
& identity, shared_ptr<PibImpl> pibImpl);
141
142
const
std::set<Name>&
143
getKeyNames
()
const
144
{
145
return
m_keyNames;
146
}
147
148
const
std::unordered_map<Name, shared_ptr<detail::KeyImpl>>&
149
getLoadedKeys
()
const
150
{
151
return
m_keys;
152
}
153
154
private
:
155
Name
m_identity;
156
std::set<Name> m_keyNames;
158
mutable
std::unordered_map<Name, shared_ptr<detail::KeyImpl>> m_keys;
159
160
shared_ptr<PibImpl> m_pib;
161
162
#ifndef DOXYGEN
163
friend
detail::IdentityImpl
;
164
#endif
165
};
166
167
}
// namespace pib
168
169
using
pib::KeyContainer
;
170
171
}
// namespace security
172
}
// namespace ndn
173
174
#endif // NDN_CXX_SECURITY_PIB_KEY_CONTAINER_HPP
ndn::security::pib::detail::IdentityImpl
Backend instance of Identity.
Definition:
identity-impl.hpp:43
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::security::pib::operator==
bool operator==(const Identity &lhs, const Identity &rhs)
Definition:
identity.hpp:167
key.hpp
ndn::security::pib::KeyContainer::getKeyNames
const std::set< Name > & getKeyNames() const
Definition:
key-container.hpp:143
ndn::security::pib::KeyContainer::const_iterator
Definition:
key-container.hpp:51
ndn::security::pib::KeyContainer
Container of keys of an identity.
Definition:
key-container.hpp:48
ndn::security::pib::Key
A frontend handle of a key instance.
Definition:
key.hpp:49
ndn::security::pib::KeyContainer::const_iterator::difference_type
std::ptrdiff_t difference_type
Definition:
key-container.hpp:56
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition:
common.hpp:48
ndn::Name
Represents an absolute name.
Definition:
name.hpp:41
ndn::security
Definition:
dummy-keychain.cpp:28
ndn::security::pib::KeyContainer::const_iterator::iterator_category
std::forward_iterator_tag iterator_category
Definition:
key-container.hpp:54
ndn::security::pib::operator!=
bool operator!=(const Identity &lhs, const Identity &rhs)
Definition:
identity.cpp:101
nonstd::span_lite::size
span_constexpr std::size_t size(span< T, Extent > const &spn)
Definition:
span-lite.hpp:1535
ndn::security::pib::KeyContainer::getLoadedKeys
const std::unordered_map< Name, shared_ptr< detail::KeyImpl > > & getLoadedKeys() const
Definition:
key-container.hpp:149
ndnSIM
ndn-cxx
ndn-cxx
security
pib
key-container.hpp
Generated on Fri May 6 2022 12:34:12 for ndnSIM by
1.8.13