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-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_PIB_HPP
23 #define NDN_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 class v2::KeyChain;
178 };
179 
180 } // namespace pib
181 
182 using pib::Pib;
183 
184 } // namespace security
185 } // namespace ndn
186 
187 #endif // NDN_SECURITY_PIB_PIB_HPP
ndn::security::pib::Pib::m_impl
shared_ptr< PibImpl > m_impl
Definition: pib.hpp:175
ndn::security::pib::Pib::getDefaultIdentity
const Identity & getDefaultIdentity() const
Get the default identity.
Definition: pib.cpp:129
ndn::security::pib::Pib::location
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const std::string & location
Definition: pib.hpp:130
ndn::security::pib::Pib::setDefaultIdentity
const Identity & setDefaultIdentity(const Name &identity)
Set an identity as the default identity.
Definition: pib.cpp:116
ndn::security::pib::Pib::getImpl
shared_ptr< PibImpl > getImpl()
Definition: pib.hpp:161
ndn::security::pib::Pib::getIdentities
const IdentityContainer & getIdentities() const
Get all the identities.
Definition: pib.cpp:108
ndn::security::pib::Pib
ndn security pib Pib
Definition: pib.cpp:30
ndn::security::pib::Pib::m_location
std::string m_location
Definition: pib.hpp:168
ndn::security::pib::Pib::getPibLocator
std::string getPibLocator() const
Get PIB Locator.
Definition: pib.cpp:45
ndn::security::pib::Pib
represents the PIB
Definition: pib.hpp:53
ndn::security::pib::Pib::m_defaultIdentity
Identity m_defaultIdentity
Definition: pib.hpp:171
ndn::security::pib::Pib::addIdentity
Identity addIdentity(const Name &identity)
Add an identity.
Definition: pib.cpp:80
ndn::security::pib::Pib::setTpmLocator
void setTpmLocator(const std::string &tpmLocator)
Set the corresponding TPM information to tpmLocator.
Definition: pib.cpp:51
ndn::Name
Represents an absolute name.
Definition: name.hpp:44
identity-container.hpp
ndn::security::pib::Pib::removeIdentity
void removeIdentity(const Name &identity)
Remove an identity.
Definition: pib.cpp:88
ndn::security::v2::KeyChain
The interface of signing key management.
Definition: key-chain.hpp:47
ndn::security::pib::Pib::~Pib
~Pib()
ndn::security::pib::Pib::m_identities
IdentityContainer m_identities
Definition: pib.hpp:173
ndn::security::pib::Pib::Error
represents a semantic error
Definition: pib.hpp:57
ndn::security::pib::Pib::getTpmLocator
std::string getTpmLocator() const
Get TPM Locator.
Definition: pib.cpp:61
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:48
ndn::security::pib::Pib::impl
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const std::string shared_ptr< PibImpl > impl
Definition: pib.hpp:130
ndn::security::pib::Pib::m_scheme
std::string m_scheme
Definition: pib.hpp:167
ndn::security::pib::Pib::getScheme
std::string getScheme() const
return the scheme of the PIB Locator
Definition: pib.hpp:69
ndn::security::pib::IdentityContainer
Container of identities of a Pib.
Definition: identity-container.hpp:48
ndn::security::pib::Pib::m_isDefaultIdentityLoaded
bool m_isDefaultIdentityLoaded
Definition: pib.hpp:170
ndn::security::pib::Identity
A frontend handle of an Identity.
Definition: identity.hpp:43
ndn::security::pib::Pib::reset
void reset()
Reset content in PIB, including reset of the TPM locator.
Definition: pib.cpp:71
ndn::security::pib::Pib::getIdentity
Identity getIdentity(const Name &identityName) const
Get an identity with name identityName.
Definition: pib.cpp:100
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34