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)
85 , m_pib(std::move(pibImpl))
87 BOOST_ASSERT(m_pib !=
nullptr);
88 m_certNames = m_pib->getCertificatesOfKey(keyName);
112 return m_certNames.size();
119 BOOST_THROW_EXCEPTION(std::invalid_argument(
"Certificate name `" + certificate.
getKeyName().
toUri() +
"` " 120 "does not match key name"));
123 m_certNames.insert(certName);
124 m_certs[certName] = certificate;
125 m_pib->addCertificate(certificate);
133 BOOST_THROW_EXCEPTION(std::invalid_argument(
"Certificate name `" + certName.
toUri() +
"` " 134 "is invalid or does not match key name"));
137 m_certNames.erase(certName);
138 m_certs.erase(certName);
139 m_pib->removeCertificate(certName);
145 auto it = m_certs.find(certName);
147 if (it != m_certs.end())
152 BOOST_THROW_EXCEPTION(std::invalid_argument(
"Certificate name `" + certName.
toUri() +
"` " 153 "is invalid or does not match key name"));
156 m_certs[certName] = m_pib->getCertificate(certName);
157 return m_certs[certName];
163 return m_certNames == m_pib->getCertificatesOfKey(m_keyName);
Copyright (c) 2013-2017 Regents of the University of California.
The certificate following the certificate format naming convention.
Name getKeyName() const
Get key name.
void remove(const Name &certName)
Remove a certificate with certName from the container.
Name extractKeyNameFromCertName(const Name &certName)
Extract key name from the certificate name certName.
bool operator==(const const_iterator &other) const
#define NDN_CXX_ASSERT_FORWARD_ITERATOR(T)
assert T is a forward iterator
std::string toUri() const
Get URI representation of the name.
bool operator!=(const const_iterator &other) const
Container of certificates of a key.
const_iterator find(const Name &certName) const
bool isConsistent() const
Check if the container is consistent with the backend storage.
v2::Certificate operator*()
const_iterator end() const
Represents an absolute name.
const Name & getName() const
Get name.
void add(const v2::Certificate &certificate)
Add certificate into the container.
static bool isValidName(const Name &certName)
Check if the specified name follows the naming convention for the certificate.
const_iterator begin() const
v2::Certificate get(const Name &certName) const
Get a certificate with certName from the container.
const_iterator & operator++()