|
NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
|
API Documentation
|
Go to the documentation of this file.
26 #include <boost/range/adaptor/map.hpp>
33 : m_hasDefaultIdentity(false)
40 static std::string scheme =
"pib-memory";
47 m_tpmLocator = tpmLocator;
59 return (m_identities.count(identity) > 0);
65 m_identities.insert(identity);
67 if (!m_hasDefaultIdentity) {
68 m_defaultIdentity = identity;
69 m_hasDefaultIdentity =
true;
76 m_identities.erase(identity);
77 if (identity == m_defaultIdentity) {
78 m_hasDefaultIdentity =
false;
79 m_defaultIdentity.
clear();
83 for (
const Name& keyName : keyNames) {
91 m_hasDefaultIdentity =
false;
92 m_defaultIdentity.
clear();
94 m_defaultKeys.clear();
96 m_defaultCerts.clear();
110 m_defaultIdentity = identityName;
111 m_hasDefaultIdentity =
true;
117 if (m_hasDefaultIdentity) {
118 return m_defaultIdentity;
127 return (m_keys.count(keyName) > 0);
132 const uint8_t* key,
size_t keyLen)
136 m_keys[keyName] =
Buffer(key, keyLen);
138 if (m_defaultKeys.count(identity) == 0) {
139 m_defaultKeys[identity] = keyName;
148 m_keys.erase(keyName);
149 m_defaultKeys.erase(identity);
152 for (
const auto& certName : certNames) {
164 auto key = m_keys.find(keyName);
165 BOOST_ASSERT(key != m_keys.end());
173 for (
const auto& keyName : m_keys | boost::adaptors::map_keys) {
188 m_defaultKeys[identity] = keyName;
194 auto defaultKey = m_defaultKeys.find(identity);
195 if (defaultKey == m_defaultKeys.end()) {
199 return defaultKey->second;
205 return (m_certs.count(certName) > 0);
217 m_certs[certName] = certificate;
218 if (m_defaultCerts.count(keyName) == 0) {
219 m_defaultCerts[keyName] = certName;
226 m_certs.erase(certName);
228 if (defaultCert != m_defaultCerts.end() && defaultCert->second == certName) {
229 m_defaultCerts.erase(defaultCert);
240 auto it = m_certs.find(certName);
247 std::set<Name> certNames;
248 for (
const auto& it : m_certs) {
250 certNames.insert(it.first);
263 m_defaultCerts[keyName] = certName;
269 auto it = m_defaultCerts.find(keyName);
270 if (it == m_defaultCerts.end()) {
274 auto certIt = m_certs.find(it->second);
275 BOOST_ASSERT(certIt != m_certs.end());
276 return certIt->second;
static const std::string & getScheme()
void removeCertificate(const Name &certName) override
Remove a certificate with name certName.
void setTpmLocator(const std::string &tpmLocator) override
Set the corresponding TPM information to tpmLocator.
std::string getTpmLocator() const override
Get TPM Locator.
Name getIdentity() const
Get identity name.
bool hasCertificate(const Name &certName) const override
Check the existence of a certificate with name certName.
void addIdentity(const Name &identity) override
Add an identity.
size_t value_size() const noexcept
Return the size of TLV-VALUE, aka TLV-LENGTH.
General-purpose automatically managed/resized buffer.
Name getKeyName() const
Get key name.
void addKey(const Name &identity, const Name &keyName, const uint8_t *key, size_t keyLen) override
Add a key.
const Block & getContent() const
Get Content.
Buffer getKeyBits(const Name &keyName) const override
Get the key bits of a key with name keyName.
const Name & getName() const
Get name.
Name extractIdentityFromKeyName(const Name &keyName)
Extract identity namespace from the key name keyName.
Name getDefaultIdentity() const override
Get the default identity.
Name getDefaultKeyOfIdentity(const Name &identity) const override
Represents an absolute name.
v2::Certificate getDefaultCertificateOfKey(const Name &keyName) const override
The certificate following the certificate format naming convention.
void setDefaultCertificateOfKey(const Name &keyName, const Name &certName) override
Set a cert with name certName as the default of a key with keyName.
bool hasKey(const Name &keyName) const override
Check the existence of a key with keyName.
std::set< Name > getCertificatesOfKey(const Name &keyName) const override
Get a list of certificate names of a key with id keyName.
represents a semantic error
void removeIdentity(const Name &identity) override
Remove an identity and related keys and certificates.
Name extractKeyNameFromCertName(const Name &certName)
Extract key name from the certificate name certName.
bool hasIdentity(const Name &identity) const override
Check the existence of an identity.
void toUri(std::ostream &os, name::UriFormat format=name::UriFormat::DEFAULT) const
Write URI representation of the name to the output stream.
std::set< Name > getKeysOfIdentity(const Name &identity) const override
Get all the key names of an identity with name identity.
void removeKey(const Name &keyName) override
Remove a key with keyName and related certificates.
void clearIdentities() override
Erasing all certificates, keys, and identities.
const uint8_t * value() const noexcept
Return a raw pointer to the beginning of TLV-VALUE.
void addCertificate(const v2::Certificate &certificate) override
Add a certificate.
void clear()
Remove all components.
void setDefaultKeyOfIdentity(const Name &identity, const Name &keyName) override
Set an key with keyName as the default key of an identity with name identity.
PibMemory(const std::string &location="")
Create memory based PIB backend.
Copyright (c) 2011-2015 Regents of the University of California.
v2::Certificate getCertificate(const Name &certName) const override
Get a certificate with name certName.
std::set< Name > getIdentities() const override
Get the name of all the identities.
void setDefaultIdentity(const Name &identityName) override
Set an identity with name identityName as the default identity.