30 Pib::Pib(
const std::string& locator, shared_ptr<PibImpl> impl)
32 , m_impl(std::move(impl))
33 , m_identities(m_impl)
35 BOOST_ASSERT(m_impl !=
nullptr);
38 Pib::~Pib() =
default;
41 Pib::getTpmLocator()
const
43 return m_impl->getTpmLocator();
47 Pib::setTpmLocator(
const std::string& tpmLocator)
49 if (tpmLocator == m_impl->getTpmLocator()) {
55 m_impl->setTpmLocator(tpmLocator);
61 m_impl->setTpmLocator(
"");
62 m_impl->clearIdentities();
63 m_defaultIdentity = {};
68 Pib::addIdentity(
const Name& identityName)
70 BOOST_ASSERT(m_identities.isConsistent());
71 return m_identities.add(identityName);
75 Pib::removeIdentity(
const Name& identityName)
77 BOOST_ASSERT(m_identities.isConsistent());
79 if (m_defaultIdentity && m_defaultIdentity.getName() == identityName) {
81 m_defaultIdentity = {};
83 m_identities.remove(identityName);
87 Pib::getIdentity(
const Name& identity)
const
89 BOOST_ASSERT(m_identities.isConsistent());
90 return m_identities.get(identity);
94 Pib::getIdentities()
const
96 BOOST_ASSERT(m_identities.isConsistent());
101 Pib::setDefaultIdentity(
const Name& identityName)
103 BOOST_ASSERT(m_identities.isConsistent());
105 m_defaultIdentity = m_identities.add(identityName);
106 m_impl->setDefaultIdentity(identityName);
109 BOOST_ASSERT(m_defaultIdentity);
110 return m_defaultIdentity;
114 Pib::getDefaultIdentity()
const
116 BOOST_ASSERT(m_identities.isConsistent());
118 if (!m_defaultIdentity) {
119 m_defaultIdentity = m_identities.get(m_impl->getDefaultIdentity());
120 NDN_LOG_DEBUG(
"Caching default identity " << m_defaultIdentity.getName());
123 BOOST_ASSERT(m_defaultIdentity);
124 BOOST_ASSERT(m_defaultIdentity.getName() == m_impl->getDefaultIdentity());
125 return m_defaultIdentity;
Represents an absolute name.
Container of identities of a PIB.
Frontend handle for an identity in the PIB.
#define NDN_LOG_DEBUG(expression)
Log at DEBUG level.
#define NDN_LOG_INIT(name)
Define a non-member log module.
Contains the ndn-cxx security framework.