33 : m_container(nullptr)
40 , m_container(&container)
47 BOOST_ASSERT(m_container !=
nullptr);
48 return m_container->
get(*m_it);
61 BOOST_ASSERT(m_container !=
nullptr);
70 bool isThisEnd = m_container ==
nullptr || m_it == m_container->m_certNames.end();
71 bool isOtherEnd = other.m_container ==
nullptr || other.m_it == other.m_container->m_certNames.end();
72 return ((isThisEnd || isOtherEnd) ?
73 (isThisEnd == isOtherEnd) :
74 m_container->m_pib == other.m_container->m_pib && m_it == other.m_it);
80 return !(*
this == other);
83 CertificateContainer::CertificateContainer(
const Name& keyName, shared_ptr<PibImpl>
pibImpl)
87 BOOST_ASSERT(m_pib !=
nullptr);
88 m_certNames = m_pib->getCertificatesOfKey(keyName);
94 return {m_certNames.begin(), *
this};
106 return {m_certNames.find(certName), *
this};
112 return m_certNames.size();
118 if (m_keyName != certificate.getKeyName())
119 NDN_THROW(std::invalid_argument(
"Certificate name `" + certificate.getKeyName().toUri() +
"` " 120 "does not match key name"));
122 const Name& certName = certificate.getName();
123 m_certNames.insert(certName);
124 m_certs[certName] = certificate;
125 m_pib->addCertificate(certificate);
132 NDN_THROW(std::invalid_argument(
"Certificate name `" + certName.
toUri() +
"` " 133 "is invalid or does not match key name"));
136 m_certNames.erase(certName);
137 m_certs.erase(certName);
138 m_pib->removeCertificate(certName);
144 auto it = m_certs.find(certName);
146 if (it != m_certs.end())
150 NDN_THROW(std::invalid_argument(
"Certificate name `" + certName.
toUri() +
"` " 151 "is invalid or does not match key name"));
154 m_certs[certName] = m_pib->getCertificate(certName);
155 return m_certs[certName];
161 return m_certNames == m_pib->getCertificatesOfKey(m_keyName);
Copyright (c) 2011-2015 Regents of the University of California.
void remove(const Name &certName)
Remove a certificate with certName from the container.
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE shared_ptr< PibImpl > pibImpl
Name extractKeyNameFromCertName(const Name &certName)
Extract key name from the certificate name certName.
bool isConsistent() const
Check if the container is consistent with the backend storage.
bool operator!=(const const_iterator &other) const
NDN_CXX_ASSERT_FORWARD_ITERATOR(CertificateContainer::const_iterator)
const_iterator end() const
Container of certificates of a key.
Certificate get(const Name &certName) const
Get a certificate with certName from the container.
void add(const Certificate &certificate)
Add certificate into the container.
Represents an absolute name.
bool operator==(const const_iterator &other) const
void toUri(std::ostream &os, name::UriFormat format=name::UriFormat::DEFAULT) const
Write URI representation of the name to the output stream.
const_iterator & operator++()
const_iterator find(const Name &certName) const
const_iterator begin() const