NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: 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; -*- */
22 #ifndef NDN_SECURITY_PIB_PIB_HPP
23 #define NDN_SECURITY_PIB_PIB_HPP
24 
25 #include "identity-container.hpp"
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  explicit
60  Error(const std::string& what)
61  : std::runtime_error(what)
62  {
63  }
64  };
65 
66 public:
67  ~Pib();
68 
72  std::string
73  getScheme() const
74  {
75  return m_scheme;
76  }
77 
81  std::string
82  getPibLocator() const;
83 
90  void
91  setTpmLocator(const std::string& tpmLocator);
92 
97  std::string
98  getTpmLocator() const;
99 
103  void
104  reset();
105 
110  Identity
111  getIdentity(const Name& identityName) const;
112 
114  const IdentityContainer&
115  getIdentities() const;
116 
121  const Identity&
122  getDefaultIdentity() const;
123 
124 NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE: // write operations should be private
125  /*
126  * @brief Create a Pib instance
127  *
128  * @param scheme The scheme for the Pib
129  * @param location The location for the Pib
130  * @param impl The backend implementation
131  */
132  Pib(const std::string& scheme, const std::string& location, shared_ptr<PibImpl> impl);
133 
134  /*
135  * @brief Create an identity with name @p identityName and return a reference to it.
136  *
137  * If there already exists an identity for the name @p identityName, then it is returned.
138  * If no default identity is set, the newly created identity will be set as the default.
139  *
140  * @param identityName The name for the identity to be added
141  */
142 
150  Identity
151  addIdentity(const Name& identity);
152 
153  /*
154  * @brief Remove an @p identity.
155  *
156  * If the default identity is being removed, no default identity will be selected.
157  */
158  void
159  removeIdentity(const Name& identity);
160 
168  const Identity&
169  setDefaultIdentity(const Name& identity);
170 
171  shared_ptr<PibImpl>
173  {
174  return m_impl;
175  }
176 
177 protected:
178  std::string m_scheme;
179  std::string m_location;
180 
183 
185 
186  shared_ptr<PibImpl> m_impl;
187 
188  friend class v2::KeyChain;
189 };
190 
191 } // namespace pib
192 
193 using pib::Pib;
194 
195 } // namespace security
196 } // namespace ndn
197 
198 #endif // NDN_SECURITY_PIB_PIB_HPP
Copyright (c) 2011-2015 Regents of the University of California.
represents a semantic error
Definition: pib.hpp:56
std::string getTpmLocator() const
Get TPM Locator.
Definition: pib.cpp:61
The interface of signing key management.
Definition: key-chain.hpp:46
bool m_isDefaultIdentityLoaded
Definition: pib.hpp:181
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:43
std::string m_location
Definition: pib.hpp:179
void removeIdentity(const Name &identity)
Definition: pib.cpp:88
std::string getPibLocator() const
Get PIB Locator.
Definition: pib.cpp:45
STL namespace.
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const std::string shared_ptr< PibImpl > impl
Definition: pib.hpp:132
void reset()
Reset content in PIB, including reset of the TPM locator.
Definition: pib.cpp:71
shared_ptr< PibImpl > m_impl
Definition: pib.hpp:186
void setTpmLocator(const std::string &tpmLocator)
Set the corresponding TPM information to tpmLocator.
Definition: pib.cpp:51
Catch-all error for security policy errors that don&#39;t fit in other categories.
Definition: base.hpp:79
IdentityContainer m_identities
Definition: pib.hpp:184
Error(const std::string &what)
Definition: pib.hpp:60
ndn security pib Pib
Definition: pib.cpp:30
std::string getScheme() const
return the scheme of the PibLocator
Definition: pib.hpp:73
const Identity & setDefaultIdentity(const Name &identity)
Set an identity as the default identity.
Definition: pib.cpp:116
const IdentityContainer & getIdentities() const
Get all the identities.
Definition: pib.cpp:108
shared_ptr< PibImpl > getImpl()
Definition: pib.hpp:172
Represents an absolute name.
Definition: name.hpp:42
Identity addIdentity(const Name &identity)
Add an identity.
Definition: pib.cpp:80
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:178
A frontend handle of an Identity.
Definition: identity.hpp:42
Identity getIdentity(const Name &identityName) const
Get an identity with name identityName.
Definition: pib.cpp:100
Identity m_defaultIdentity
Definition: pib.hpp:182
represents the PIB
Definition: pib.hpp:52
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const std::string & location
Definition: pib.hpp:132