NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
pib.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_PIB_HPP
23 #define NDN_CXX_SECURITY_PIB_PIB_HPP
24 
26 
27 namespace ndn {
28 namespace security {
29 namespace pib {
30 
31 class PibImpl;
32 
52 class Pib : noncopyable
53 {
54 public:
56  class Error : public std::runtime_error
57  {
58  public:
59  using std::runtime_error::runtime_error;
60  };
61 
62 public:
63  ~Pib();
64 
68  std::string
69  getScheme() const
70  {
71  return m_scheme;
72  }
73 
77  std::string
78  getPibLocator() const;
79 
86  void
87  setTpmLocator(const std::string& tpmLocator);
88 
93  std::string
94  getTpmLocator() const;
95 
99  void
100  reset();
101 
106  Identity
107  getIdentity(const Name& identityName) const;
108 
112  const IdentityContainer&
113  getIdentities() const;
114 
119  const Identity&
120  getDefaultIdentity() const;
121 
122 NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE: // write operations should be private
130  Pib(const std::string& scheme, const std::string& location, shared_ptr<PibImpl> impl);
131 
139  Identity
140  addIdentity(const Name& identity);
141 
147  void
148  removeIdentity(const Name& identity);
149 
157  const Identity&
158  setDefaultIdentity(const Name& identity);
159 
160  shared_ptr<PibImpl>
162  {
163  return m_impl;
164  }
165 
166 protected:
167  std::string m_scheme;
168  std::string m_location;
169 
172 
174 
175  shared_ptr<PibImpl> m_impl;
176 
177  friend KeyChain;
178 };
179 
180 } // namespace pib
181 
182 using pib::Pib;
183 
184 } // namespace security
185 } // namespace ndn
186 
187 #endif // NDN_CXX_SECURITY_PIB_PIB_HPP
std::string getScheme() const
return the scheme of the PIB Locator
Definition: pib.hpp:69
Copyright (c) 2011-2015 Regents of the University of California.
represents a semantic error
Definition: pib.hpp:56
bool m_isDefaultIdentityLoaded
Definition: pib.hpp:170
std::string m_location
Definition: pib.hpp:168
void removeIdentity(const Name &identity)
Remove an identity.
Definition: pib.cpp:88
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const std::string shared_ptr< PibImpl > impl
Definition: pib.hpp:130
void reset()
Reset content in PIB, including reset of the TPM locator.
Definition: pib.cpp:71
const IdentityContainer & getIdentities() const
Get all the identities.
Definition: pib.cpp:108
shared_ptr< PibImpl > m_impl
Definition: pib.hpp:175
void setTpmLocator(const std::string &tpmLocator)
Set the corresponding TPM information to tpmLocator.
Definition: pib.cpp:51
IdentityContainer m_identities
Definition: pib.hpp:173
ndn security pib Pib
Definition: pib.cpp:30
Identity getIdentity(const Name &identityName) const
Get an identity with name identityName.
Definition: pib.cpp:100
const Identity & setDefaultIdentity(const Name &identity)
Set an identity as the default identity.
Definition: pib.cpp:116
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:48
shared_ptr< PibImpl > getImpl()
Definition: pib.hpp:161
Represents an absolute name.
Definition: name.hpp:41
Identity addIdentity(const Name &identity)
Add an identity.
Definition: pib.cpp:80
std::string getPibLocator() const
Get PIB Locator.
Definition: pib.cpp:45
const Identity & getDefaultIdentity() const
Get the default identity.
Definition: pib.cpp:129
Container of identities of a Pib.
std::string m_scheme
Definition: pib.hpp:167
A frontend handle of an Identity.
Definition: identity.hpp:47
std::string getTpmLocator() const
Get TPM Locator.
Definition: pib.cpp:61
Identity m_defaultIdentity
Definition: pib.hpp:171
represents the PIB
Definition: pib.hpp:52
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const std::string & location
Definition: pib.hpp:130