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-2018 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_PIB_KEY_CONTAINER_HPP
23
#define NDN_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
typedef
const_iterator
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
108
Key
109
add
(
const
uint8_t* key,
size_t
keyLen,
const
Name
& keyName);
110
115
void
116
remove
(
const
Name
& keyName);
117
123
Key
124
get
(
const
Name
& keyName)
const
;
125
131
bool
132
isConsistent
()
const
;
133
134
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
:
139
KeyContainer
(
const
Name
& identity, shared_ptr<PibImpl>
pibImpl
);
140
141
const
std::set<Name>&
142
getKeyNames
()
const
143
{
144
return
m_keyNames;
145
}
146
147
const
std::unordered_map<Name, shared_ptr<detail::KeyImpl>>&
148
getLoadedKeys
()
const
149
{
150
return
m_keys;
151
}
152
153
private
:
154
Name
m_identity;
155
std::set<Name> m_keyNames;
157
mutable
std::unordered_map<Name, shared_ptr<detail::KeyImpl>> m_keys;
158
159
shared_ptr<PibImpl> m_pib;
160
161
friend
class
detail::IdentityImpl
;
162
};
163
164
}
// namespace pib
165
166
using
pib::KeyContainer
;
167
168
}
// namespace security
169
}
// namespace ndn
170
171
#endif // NDN_SECURITY_PIB_KEY_CONTAINER_HPP
ndn::security::pib::detail::IdentityImpl
Backend instance of Identity.
Definition:
identity-impl.hpp:43
ndn::security::pib::KeyContainer::find
const_iterator find(const Name &keyName) const
Definition:
key-container.cpp:104
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
key.hpp
ndn::security::pib::KeyContainer::iterator
const_iterator iterator
Definition:
key-container.hpp:87
ndn::security::pib::KeyContainer::begin
const_iterator begin() const
Definition:
key-container.cpp:92
ndn::security::pib::KeyContainer::getKeyNames
const std::set< Name > & getKeyNames() const
Definition:
key-container.hpp:142
ndn::security::pib::KeyContainer::const_iterator::operator==
bool operator==(const const_iterator &other)
Definition:
key-container.cpp:68
ndn::security::pib::KeyContainer::remove
void remove(const Name &keyName)
Remove a key with keyName from the container.
Definition:
key-container.cpp:130
ndn::security::pib::KeyContainer::const_iterator::operator!=
bool operator!=(const const_iterator &other)
Definition:
key-container.cpp:78
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::KeyContainer::end
const_iterator end() const
Definition:
key-container.cpp:98
ndn::security::pib::Key
A frontend handle of a key instance.
Definition:
key.hpp:49
ndn::security::pib::KeyContainer::size
size_t size() const
Definition:
key-container.cpp:110
ndn::security::pib::KeyContainer::get
Key get(const Name &keyName) const
Get a key with keyName from the container.
Definition:
key-container.cpp:143
ndn::security::pib::KeyContainer::const_iterator::difference_type
std::ptrdiff_t difference_type
Definition:
key-container.hpp:56
ndn::security::pib::KeyContainer::pibImpl
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE shared_ptr< PibImpl > pibImpl
Definition:
key-container.hpp:139
ndn::security::pib::KeyContainer::add
Key add(const uint8_t *key, size_t keyLen, const Name &keyName)
Add key of keyLen bytes with keyName into the container.
Definition:
key-container.cpp:116
ndn::security::pib::KeyContainer::isConsistent
bool isConsistent() const
Check if the container is consistent with the backend storage.
Definition:
key-container.cpp:165
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition:
common.hpp:43
ndn::Name
Represents an absolute name.
Definition:
name.hpp:43
ndn::security::pib::KeyContainer::const_iterator::iterator_category
std::forward_iterator_tag iterator_category
Definition:
key-container.hpp:54
ndn::security::pib::KeyContainer::const_iterator::operator++
const_iterator & operator++()
Definition:
key-container.cpp:53
ndn::security::pib::KeyContainer::const_iterator::operator *
Key operator *()
Definition:
key-container.cpp:46
ndn::security::pib::KeyContainer::getLoadedKeys
const std::unordered_map< Name, shared_ptr< detail::KeyImpl > > & getLoadedKeys() const
Definition:
key-container.hpp:148
ndn::security::pib::KeyContainer::const_iterator::const_iterator
const_iterator()
Definition:
key-container.cpp:33
ndnSIM
ndn-cxx
ndn-cxx
security
pib
key-container.hpp
Generated on Sun Feb 24 2019 22:16:06 for ndnSIM by
1.8.15