In all .cpp files, remove using namespace ndn::ptr_lib and explicitly use ptr_lib::shared_ptr and make_shared.
diff --git a/src/data.cpp b/src/data.cpp
index c9f21fa..db60f80 100644
--- a/src/data.cpp
+++ b/src/data.cpp
@@ -11,7 +11,6 @@
#include "c/data.h"
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
@@ -63,7 +62,7 @@
if (data.signature_)
signature_ = data.signature_->clone();
else
- signature_ = shared_ptr<Signature>();
+ signature_ = ptr_lib::shared_ptr<Signature>();
name_ = data.name_;
metaInfo_ = data.metaInfo_;
diff --git a/src/encoding/der/der.cpp b/src/encoding/der/der.cpp
index fc31161..94578b4 100644
--- a/src/encoding/der/der.cpp
+++ b/src/encoding/der/der.cpp
@@ -15,7 +15,6 @@
INIT_LOGGER("ndn.der.DER");
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
@@ -132,7 +131,7 @@
}
}
-shared_ptr<DerNode>
+ptr_lib::shared_ptr<DerNode>
DerNode::parse(InputIterator& start)
{
int type = ((uint8_t)start.PeekU8());
@@ -140,23 +139,23 @@
// _LOG_DEBUG("Type: " << hex << setw(2) << setfill('0') << type);
switch(type) {
case DER_BOOLEAN:
- return shared_ptr<DerBool>(new DerBool(start));
+ return ptr_lib::shared_ptr<DerBool>(new DerBool(start));
case DER_INTEGER:
- return shared_ptr<DerInteger>(new DerInteger(start));
+ return ptr_lib::shared_ptr<DerInteger>(new DerInteger(start));
case DER_BIT_STRING:
- return shared_ptr<DerBitString>(new DerBitString(start));
+ return ptr_lib::shared_ptr<DerBitString>(new DerBitString(start));
case DER_OCTET_STRING:
- return shared_ptr<DerOctetString>(new DerOctetString(start));
+ return ptr_lib::shared_ptr<DerOctetString>(new DerOctetString(start));
case DER_NULL:
- return shared_ptr<DerNull>(new DerNull(start));
+ return ptr_lib::shared_ptr<DerNull>(new DerNull(start));
case DER_OBJECT_IDENTIFIER:
- return shared_ptr<DerOid>(new DerOid(start));
+ return ptr_lib::shared_ptr<DerOid>(new DerOid(start));
case DER_SEQUENCE:
- return shared_ptr<DerSequence>(new DerSequence(start));
+ return ptr_lib::shared_ptr<DerSequence>(new DerSequence(start));
case DER_PRINTABLE_STRING:
- return shared_ptr<DerPrintableString>(new DerPrintableString(start));
+ return ptr_lib::shared_ptr<DerPrintableString>(new DerPrintableString(start));
case DER_GENERALIZED_TIME:
- return shared_ptr<DerGtime>(new DerGtime(start));
+ return ptr_lib::shared_ptr<DerGtime>(new DerGtime(start));
default:
throw DerDecodingException("Unimplemented DER type");
}
@@ -190,7 +189,7 @@
while (accSize < size_) {
// _LOG_DEBUG("accSize: " << accSize);
- shared_ptr<DerNode> nodePtr = DerNode::parse(start);
+ ptr_lib::shared_ptr<DerNode> nodePtr = DerNode::parse(start);
accSize += nodePtr->getSize();
addChild(nodePtr, false);
}
@@ -215,7 +214,7 @@
Blob
DerComplex::getRaw()
{
- shared_ptr<vector<uint8_t> > blob(new vector<uint8_t>());
+ ptr_lib::shared_ptr<vector<uint8_t> > blob(new vector<uint8_t>());
blob->insert(blob->end(), header_.begin(), header_.end());
DerNodePtrList::iterator it = nodeList_.begin();
@@ -241,7 +240,7 @@
}
void
-DerComplex::addChild(shared_ptr<DerNode> nodePtr, bool notifyParent)
+DerComplex::addChild(ptr_lib::shared_ptr<DerNode> nodePtr, bool notifyParent)
{
nodePtr->setParent(this);
diff --git a/src/encoding/der/visitor/certificate-data-visitor.cpp b/src/encoding/der/visitor/certificate-data-visitor.cpp
index 4270d68..7edf794 100644
--- a/src/encoding/der/visitor/certificate-data-visitor.cpp
+++ b/src/encoding/der/visitor/certificate-data-visitor.cpp
@@ -18,7 +18,6 @@
#include "certificate-data-visitor.hpp"
using namespace std;
-using namespace ndn::ptr_lib;
INIT_LOGGER("ndn.der.CertificateDataVisitor");
@@ -41,7 +40,7 @@
children[1]->accept(subjectVisitor, param);
PublicKeyVisitor pubkeyVisitor;
Certificate* certData = ndnboost::any_cast<Certificate*>(param);
- certData->setPublicKeyInfo(*ndnboost::any_cast<shared_ptr<PublicKey> >(children[2]->accept(pubkeyVisitor)));
+ certData->setPublicKeyInfo(*ndnboost::any_cast<ptr_lib::shared_ptr<PublicKey> >(children[2]->accept(pubkeyVisitor)));
if(children.size() > 3)
{
diff --git a/src/encoding/der/visitor/public-key-visitor.cpp b/src/encoding/der/visitor/public-key-visitor.cpp
index a2eab56..a5f5542 100644
--- a/src/encoding/der/visitor/public-key-visitor.cpp
+++ b/src/encoding/der/visitor/public-key-visitor.cpp
@@ -12,7 +12,6 @@
#include "public-key-visitor.hpp"
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
@@ -24,10 +23,10 @@
DerNodePtrList& children = derSeq.getChildren();
SimpleVisitor simpleVisitor;
- shared_ptr<DerSequence> algoSeq = dynamic_pointer_cast<DerSequence>(children[0]);
+ ptr_lib::shared_ptr<DerSequence> algoSeq = ptr_lib::dynamic_pointer_cast<DerSequence>(children[0]);
OID algorithm = ndnboost::any_cast<OID>(algoSeq->getChildren()[0]->accept(simpleVisitor));
Blob raw = derSeq.getRaw();
- return ndnboost::any(shared_ptr<PublicKey>(new PublicKey(algorithm, raw)));
+ return ndnboost::any(ptr_lib::shared_ptr<PublicKey>(new PublicKey(algorithm, raw)));
}
} // der
diff --git a/src/name.cpp b/src/name.cpp
index 68005e6..b17a163 100644
--- a/src/name.cpp
+++ b/src/name.cpp
@@ -14,7 +14,6 @@
#include "c/util/ndn_memory.h"
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
@@ -130,7 +129,7 @@
Name::Component
Name::Component::fromNumber(uint64_t number)
{
- shared_ptr<vector<uint8_t> > value(new vector<uint8_t>());
+ ptr_lib::shared_ptr<vector<uint8_t> > value(new vector<uint8_t>());
// First encode in little endian.
while (number != 0) {
@@ -146,7 +145,7 @@
Name::Component
Name::Component::fromNumberWithMarker(uint64_t number, uint8_t marker)
{
- shared_ptr<vector<uint8_t> > value(new vector<uint8_t>());
+ ptr_lib::shared_ptr<vector<uint8_t> > value(new vector<uint8_t>());
// Add the leading marker.
value->push_back(marker);
diff --git a/src/node.cpp b/src/node.cpp
index 586f990..3dd3861 100644
--- a/src/node.cpp
+++ b/src/node.cpp
@@ -18,7 +18,6 @@
#include <ndn-cpp/node.hpp>
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
@@ -111,7 +110,7 @@
signature->setSignature(Blob(signatureBits, (size_t)signatureBitsLength));
}
-Node::Node(const shared_ptr<Transport>& transport, const shared_ptr<const Transport::ConnectionInfo>& connectionInfo)
+Node::Node(const ptr_lib::shared_ptr<Transport>& transport, const ptr_lib::shared_ptr<const Transport::ConnectionInfo>& connectionInfo)
: transport_(transport), connectionInfo_(connectionInfo),
ndndIdFetcherInterest_(Name("/%C1.M.S.localhost/%C1.M.SRV/ndnd/KEY"), 4000.0)
{
@@ -125,8 +124,8 @@
transport_->connect(*connectionInfo_, *this);
uint64_t pendingInterestId = PendingInterest::getNextPendingInterestId();
- pendingInterestTable_.push_back(shared_ptr<PendingInterest>(new PendingInterest
- (pendingInterestId, shared_ptr<const Interest>(new Interest(interest)), onData, onTimeout)));
+ pendingInterestTable_.push_back(ptr_lib::shared_ptr<PendingInterest>(new PendingInterest
+ (pendingInterestId, ptr_lib::shared_ptr<const Interest>(new Interest(interest)), onData, onTimeout)));
Blob encoding = interest.wireEncode(wireFormat);
transport_->send(*encoding);
@@ -155,13 +154,13 @@
if (ndndId_.size() == 0) {
// First fetch the ndndId of the connected hub.
NdndIdFetcher fetcher
- (shared_ptr<NdndIdFetcher::Info>(new NdndIdFetcher::Info
+ (ptr_lib::shared_ptr<NdndIdFetcher::Info>(new NdndIdFetcher::Info
(this, registeredPrefixId, prefix, onInterest, onRegisterFailed, flags, wireFormat)));
- // It is OK for func_lib::function make a copy of the function object because the Info is in a shared_ptr.
+ // It is OK for func_lib::function make a copy of the function object because the Info is in a ptr_lib::shared_ptr.
expressInterest(ndndIdFetcherInterest_, fetcher, fetcher, wireFormat);
}
else
- registerPrefixHelper(registeredPrefixId, make_shared<const Name>(prefix), onInterest, onRegisterFailed, flags, wireFormat);
+ registerPrefixHelper(registeredPrefixId, ptr_lib::make_shared<const Name>(prefix), onInterest, onRegisterFailed, flags, wireFormat);
return registeredPrefixId;
}
@@ -178,7 +177,7 @@
}
void
-Node::NdndIdFetcher::operator()(const shared_ptr<const Interest>& interest, const shared_ptr<Data>& ndndIdData)
+Node::NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest>& interest, const ptr_lib::shared_ptr<Data>& ndndIdData)
{
const Sha256WithRsaSignature *signature = dynamic_cast<const Sha256WithRsaSignature*>(ndndIdData->getSignature());
if (signature && signature->getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() > 0) {
@@ -193,14 +192,14 @@
}
void
-Node::NdndIdFetcher::operator()(const shared_ptr<const Interest>& timedOutInterest)
+Node::NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest>& timedOutInterest)
{
info_->onRegisterFailed_(info_->prefix_);
}
void
Node::registerPrefixHelper
- (uint64_t registeredPrefixId, const shared_ptr<const Name>& prefix, const OnInterest& onInterest, const OnRegisterFailed& onRegisterFailed,
+ (uint64_t registeredPrefixId, const ptr_lib::shared_ptr<const Name>& prefix, const OnInterest& onInterest, const OnRegisterFailed& onRegisterFailed,
const ForwardingFlags& flags, WireFormat& wireFormat)
{
// Create a ForwardingEntry.
@@ -229,7 +228,7 @@
Blob encodedInterest = interest.wireEncode();
// Save the onInterest callback and send the registration interest.
- registeredPrefixTable_.push_back(shared_ptr<RegisteredPrefix>(new RegisteredPrefix(registeredPrefixId, prefix, onInterest)));
+ registeredPrefixTable_.push_back(ptr_lib::shared_ptr<RegisteredPrefix>(new RegisteredPrefix(registeredPrefixId, prefix, onInterest)));
transport_->send(*encodedInterest);
}
@@ -244,7 +243,7 @@
for (int i = (int)pendingInterestTable_.size() - 1; i >= 0; --i) {
if (pendingInterestTable_[i]->isTimedOut(nowMilliseconds)) {
// Save the PendingInterest and remove it from the PIT. Then call the callback.
- shared_ptr<PendingInterest> pendingInterest = pendingInterestTable_[i];
+ ptr_lib::shared_ptr<PendingInterest> pendingInterest = pendingInterestTable_[i];
pendingInterestTable_.erase(pendingInterestTable_.begin() + i);
pendingInterest->callTimeout();
@@ -260,7 +259,7 @@
BinaryXmlDecoder decoder(element, elementLength);
if (decoder.peekDTag(ndn_BinaryXml_DTag_Interest)) {
- shared_ptr<Interest> interest(new Interest());
+ ptr_lib::shared_ptr<Interest> interest(new Interest());
interest->wireDecode(element, elementLength);
RegisteredPrefix *entry = getEntryForRegisteredPrefix(interest->getName());
@@ -268,14 +267,14 @@
entry->getOnInterest()(entry->getPrefix(), interest, *transport_, entry->getRegisteredPrefixId());
}
else if (decoder.peekDTag(ndn_BinaryXml_DTag_ContentObject)) {
- shared_ptr<Data> data(new Data());
+ ptr_lib::shared_ptr<Data> data(new Data());
data->wireDecode(element, elementLength);
int iPitEntry = getEntryIndexForExpressedInterest(data->getName());
if (iPitEntry >= 0) {
// Copy pointers to the needed objects and remove the PIT entry before the calling the callback.
const OnData onData = pendingInterestTable_[iPitEntry]->getOnData();
- const shared_ptr<const Interest> interest = pendingInterestTable_[iPitEntry]->getInterest();
+ const ptr_lib::shared_ptr<const Interest> interest = pendingInterestTable_[iPitEntry]->getInterest();
pendingInterestTable_.erase(pendingInterestTable_.begin() + iPitEntry);
onData(interest, data);
}
@@ -334,7 +333,7 @@
}
Node::PendingInterest::PendingInterest
- (uint64_t pendingInterestId, const shared_ptr<const Interest>& interest, const OnData& onData, const OnTimeout& onTimeout)
+ (uint64_t pendingInterestId, const ptr_lib::shared_ptr<const Interest>& interest, const OnData& onData, const OnTimeout& onTimeout)
: pendingInterestId_(pendingInterestId), interest_(interest), onData_(onData), onTimeout_(onTimeout),
interestStruct_(new struct ndn_Interest)
{
diff --git a/src/security/certificate/certificate-extension.cpp b/src/security/certificate/certificate-extension.cpp
index b2c1bad..f081f2a 100644
--- a/src/security/certificate/certificate-extension.cpp
+++ b/src/security/certificate/certificate-extension.cpp
@@ -11,18 +11,17 @@
#include <ndn-cpp/security/certificate/certificate-extension.hpp>
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
-shared_ptr<der::DerNode>
+ptr_lib::shared_ptr<der::DerNode>
CertificateExtension::toDer()
{
- shared_ptr<der::DerSequence> root(new der::DerSequence);
+ ptr_lib::shared_ptr<der::DerSequence> root(new der::DerSequence);
- shared_ptr<der::DerOid> extensionId(new der::DerOid(extensionId_));
- shared_ptr<der::DerBool> isCritical(new der::DerBool(isCritical_));
- shared_ptr<der::DerOctetString> extensionValue(new der::DerOctetString(*extensionValue_));
+ ptr_lib::shared_ptr<der::DerOid> extensionId(new der::DerOid(extensionId_));
+ ptr_lib::shared_ptr<der::DerBool> isCritical(new der::DerBool(isCritical_));
+ ptr_lib::shared_ptr<der::DerOctetString> extensionValue(new der::DerOctetString(*extensionValue_));
root->addChild(extensionId);
root->addChild(isCritical);
diff --git a/src/security/certificate/certificate-subject-description.cpp b/src/security/certificate/certificate-subject-description.cpp
index ee2310c..9aa511f 100644
--- a/src/security/certificate/certificate-subject-description.cpp
+++ b/src/security/certificate/certificate-subject-description.cpp
@@ -10,17 +10,16 @@
#include <ndn-cpp/security/certificate/certificate-subject-description.hpp>
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
-shared_ptr<der::DerNode>
+ptr_lib::shared_ptr<der::DerNode>
CertificateSubjectDescription::toDer()
{
- shared_ptr<der::DerSequence> root(new der::DerSequence());
+ ptr_lib::shared_ptr<der::DerSequence> root(new der::DerSequence());
- shared_ptr<der::DerOid> oid(new der::DerOid(oid_));
- shared_ptr<der::DerPrintableString> value(new der::DerPrintableString(value_));
+ ptr_lib::shared_ptr<der::DerOid> oid(new der::DerOid(oid_));
+ ptr_lib::shared_ptr<der::DerPrintableString> value(new der::DerPrintableString(value_));
root->addChild(oid);
root->addChild(value);
diff --git a/src/security/certificate/certificate.cpp b/src/security/certificate/certificate.cpp
index 6856a2a..82b6364 100644
--- a/src/security/certificate/certificate.cpp
+++ b/src/security/certificate/certificate.cpp
@@ -22,7 +22,6 @@
INIT_LOGGER("ndn.security.Certificate");
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
@@ -68,20 +67,20 @@
void
Certificate::encode()
{
- shared_ptr<der::DerSequence> root(new der::DerSequence());
+ ptr_lib::shared_ptr<der::DerSequence> root(new der::DerSequence());
- shared_ptr<der::DerSequence> validity(new der::DerSequence());
- shared_ptr<der::DerGtime> notBefore(new der::DerGtime(notBefore_));
- shared_ptr<der::DerGtime> notAfter(new der::DerGtime(notAfter_));
+ ptr_lib::shared_ptr<der::DerSequence> validity(new der::DerSequence());
+ ptr_lib::shared_ptr<der::DerGtime> notBefore(new der::DerGtime(notBefore_));
+ ptr_lib::shared_ptr<der::DerGtime> notAfter(new der::DerGtime(notAfter_));
validity->addChild(notBefore);
validity->addChild(notAfter);
root->addChild(validity);
- shared_ptr<der::DerSequence> subjectList(new der::DerSequence());
+ ptr_lib::shared_ptr<der::DerSequence> subjectList(new der::DerSequence());
SubjectDescriptionList::iterator it = subjectDescriptionList_.begin();
for(; it != subjectDescriptionList_.end(); it++)
{
- shared_ptr<der::DerNode> child = it->toDer();
+ ptr_lib::shared_ptr<der::DerNode> child = it->toDer();
subjectList->addChild(child);
}
root->addChild(subjectList);
@@ -90,7 +89,7 @@
if(!extensionList_.empty())
{
- shared_ptr<der::DerSequence> extnList(new der::DerSequence());
+ ptr_lib::shared_ptr<der::DerSequence> extnList(new der::DerSequence());
ExtensionList::iterator it = extensionList_.begin();
for(; it != extensionList_.end(); it++)
extnList->addChild(it->toDer());
@@ -102,7 +101,7 @@
root->encode(start);
- shared_ptr<vector<uint8_t> > blob = blobStream.buf();
+ ptr_lib::shared_ptr<vector<uint8_t> > blob = blobStream.buf();
setContent(blob);
getMetaInfo().setType(ndn_ContentType_KEY);
}
@@ -114,7 +113,7 @@
ndnboost::iostreams::stream<ndnboost::iostreams::array_source> is((const char*)blob.buf(), blob.size());
- shared_ptr<der::DerNode> node = der::DerNode::parse(reinterpret_cast<der::InputIterator&>(is));
+ ptr_lib::shared_ptr<der::DerNode> node = der::DerNode::parse(reinterpret_cast<der::InputIterator&>(is));
// der::PrintVisitor printVisitor;
// node->accept(printVisitor, string(""));
@@ -138,7 +137,7 @@
ndnboost::iostreams::stream<ndnboost::iostreams::array_source> is((const char*)key_.getKeyDer().buf(), key_.getKeyDer().size());
- shared_ptr<der::DerNode> keyRoot = der::DerNode::parse(reinterpret_cast<der::InputIterator&> (is));
+ ptr_lib::shared_ptr<der::DerNode> keyRoot = der::DerNode::parse(reinterpret_cast<der::InputIterator&> (is));
der::PrintVisitor printVisitor;
keyRoot->accept(printVisitor, string(""));
diff --git a/src/security/certificate/public-key.cpp b/src/security/certificate/public-key.cpp
index 1d5deb8..f57f5a6 100644
--- a/src/security/certificate/public-key.cpp
+++ b/src/security/certificate/public-key.cpp
@@ -15,11 +15,10 @@
#include <ndn-cpp/security/certificate/public-key.hpp>
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
-shared_ptr<der::DerNode>
+ptr_lib::shared_ptr<der::DerNode>
PublicKey::toDer()
{
ndnboost::iostreams::stream<ndnboost::iostreams::array_source> is((const char*)keyDer_.buf (), keyDer_.size ());
@@ -29,7 +28,7 @@
static int RSA_OID[] = { 1, 2, 840, 113549, 1, 1, 1 };
-shared_ptr<PublicKey>
+ptr_lib::shared_ptr<PublicKey>
PublicKey::fromDer(const Blob& keyDer)
{
// Use a temporary pointer since d2i updates it.
@@ -39,7 +38,7 @@
throw UnrecognizedKeyFormatException("Error decoding public key DER");
RSA_free(publicKey);
- return shared_ptr<PublicKey>(new PublicKey(OID(vector<int>(RSA_OID, RSA_OID + sizeof(RSA_OID))), keyDer));
+ return ptr_lib::shared_ptr<PublicKey>(new PublicKey(OID(vector<int>(RSA_OID, RSA_OID + sizeof(RSA_OID))), keyDer));
}
Blob
diff --git a/src/security/identity/basic-identity-storage.cpp b/src/security/identity/basic-identity-storage.cpp
index 85af9a9..46a98bf 100644
--- a/src/security/identity/basic-identity-storage.cpp
+++ b/src/security/identity/basic-identity-storage.cpp
@@ -26,7 +26,6 @@
INIT_LOGGER("BasicIdentityStorage");
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn
{
@@ -445,7 +444,7 @@
sqlite3_finalize(statement);
}
-shared_ptr<Data>
+ptr_lib::shared_ptr<Data>
BasicIdentityStorage::getCertificate(const Name &certificateName, bool allowAny)
{
if (doesCertificateExist(certificateName)) {
@@ -469,7 +468,7 @@
int res = sqlite3_step(statement);
- shared_ptr<Data> data(new Data());
+ ptr_lib::shared_ptr<Data> data(new Data());
if (res == SQLITE_ROW)
data->wireDecode((const uint8_t*)sqlite3_column_blob(statement, 0), sqlite3_column_bytes(statement, 0));
@@ -479,7 +478,7 @@
}
else {
_LOG_DEBUG("Certificate does not exist!");
- return shared_ptr<Data>();
+ return ptr_lib::shared_ptr<Data>();
}
}
diff --git a/src/security/identity/identity-manager.cpp b/src/security/identity/identity-manager.cpp
index 28e1d10..88e6782 100644
--- a/src/security/identity/identity-manager.cpp
+++ b/src/security/identity/identity-manager.cpp
@@ -26,7 +26,6 @@
INIT_LOGGER("ndn.security.IdentityManager")
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
@@ -41,7 +40,7 @@
Name keyName = generateRSAKeyPairAsDefault(identityName, true);
_LOG_DEBUG("Create self-signed certificate");
- shared_ptr<IdentityCertificate> selfCert = selfSign(keyName);
+ ptr_lib::shared_ptr<IdentityCertificate> selfCert = selfSign(keyName);
_LOG_DEBUG("Add self-signed certificate as default");
@@ -63,7 +62,7 @@
privateKeyStorage_->generateKeyPair(keyName.toUri(), keyType, keySize);
_LOG_DEBUG("Create a key record in public storage");
- shared_ptr<PublicKey> pubKey = privateKeyStorage_->getPublicKey(keyName.toUri());
+ ptr_lib::shared_ptr<PublicKey> pubKey = privateKeyStorage_->getPublicKey(keyName.toUri());
identityStorage_->addKey(keyName, keyType, pubKey->getKeyDer());
return keyName;
@@ -96,9 +95,9 @@
Name keyName = getKeyNameFromCertificatePrefix(certificatePrefix);
Blob keyBlob = identityStorage_->getKey(keyName);
- shared_ptr<PublicKey> publicKey = PublicKey::fromDer(keyBlob);
+ ptr_lib::shared_ptr<PublicKey> publicKey = PublicKey::fromDer(keyBlob);
- shared_ptr<IdentityCertificate> certificate = createIdentityCertificate
+ ptr_lib::shared_ptr<IdentityCertificate> certificate = createIdentityCertificate
(certificatePrefix, *publicKey, signerCertificateName, notBefore, notAfter);
identityStorage_->addCertificate(*certificate);
@@ -113,7 +112,7 @@
const MillisecondsSince1970& notBefore,
const MillisecondsSince1970& notAfter)
{
- shared_ptr<IdentityCertificate> certificate(new IdentityCertificate());
+ ptr_lib::shared_ptr<IdentityCertificate> certificate(new IdentityCertificate());
Name keyName = getKeyNameFromCertificatePrefix(certificatePrefix);
Name certificateName = certificatePrefix;
@@ -131,7 +130,7 @@
certificate->addSubjectDescription(CertificateSubjectDescription("2.5.4.41", keyName.toUri()));
certificate->encode();
- shared_ptr<Sha256WithRsaSignature> sha256Sig(new Sha256WithRsaSignature());
+ ptr_lib::shared_ptr<Sha256WithRsaSignature> sha256Sig(new Sha256WithRsaSignature());
KeyLocator keyLocator;
keyLocator.setType(ndn_KeyLocatorType_KEYNAME);
@@ -144,7 +143,7 @@
SignedBlob unsignedData = certificate->wireEncode();
- shared_ptr<IdentityCertificate> signerCertificate = getCertificate(signerCertificateName);
+ ptr_lib::shared_ptr<IdentityCertificate> signerCertificate = getCertificate(signerCertificateName);
Name signerkeyName = signerCertificate->getPublicKeyName();
Blob sigBits = privateKeyStorage_->sign(unsignedData, signerkeyName);
@@ -189,12 +188,12 @@
IdentityManager::signByCertificate(const uint8_t* buffer, size_t bufferLength, const Name& certificateName)
{
Name keyName = IdentityCertificate::certificateNameToPublicKeyName(certificateName);
- shared_ptr<PublicKey> publicKey = privateKeyStorage_->getPublicKey(keyName.toUri());
+ ptr_lib::shared_ptr<PublicKey> publicKey = privateKeyStorage_->getPublicKey(keyName.toUri());
Blob sigBits = privateKeyStorage_->sign(buffer, bufferLength, keyName.toUri());
//For temporary usage, we support RSA + SHA256 only, but will support more.
- shared_ptr<Sha256WithRsaSignature> sha256Sig(new Sha256WithRsaSignature());
+ ptr_lib::shared_ptr<Sha256WithRsaSignature> sha256Sig(new Sha256WithRsaSignature());
KeyLocator keyLocator;
keyLocator.setType(ndn_KeyLocatorType_KEYNAME);
@@ -211,7 +210,7 @@
IdentityManager::signByCertificate(Data &data, const Name &certificateName, WireFormat& wireFormat)
{
Name keyName = IdentityCertificate::certificateNameToPublicKeyName(certificateName);
- shared_ptr<PublicKey> publicKey = privateKeyStorage_->getPublicKey(keyName);
+ ptr_lib::shared_ptr<PublicKey> publicKey = privateKeyStorage_->getPublicKey(keyName);
// For temporary usage, we support RSA + SHA256 only, but will support more.
data.setSignature(Sha256WithRsaSignature());
@@ -236,17 +235,17 @@
data.wireEncode(wireFormat);
}
-shared_ptr<IdentityCertificate>
+ptr_lib::shared_ptr<IdentityCertificate>
IdentityManager::selfSign(const Name& keyName)
{
- shared_ptr<IdentityCertificate> certificate(new IdentityCertificate());
+ ptr_lib::shared_ptr<IdentityCertificate> certificate(new IdentityCertificate());
Name certificateName = keyName.getSubName(0, keyName.size() - 1);
certificateName.append("KEY").append(keyName.get(keyName.size() - 1)).append("ID-CERT").append("0");
certificate->setName(certificateName);
Blob keyBlob = identityStorage_->getKey(keyName);
- shared_ptr<PublicKey> publicKey = PublicKey::fromDer(keyBlob);
+ ptr_lib::shared_ptr<PublicKey> publicKey = PublicKey::fromDer(keyBlob);
#if NDN_CPP_HAVE_GMTIME_SUPPORT
time_t nowSeconds = time(NULL);
@@ -268,7 +267,7 @@
certificate->addSubjectDescription(CertificateSubjectDescription("2.5.4.41", keyName.toUri()));
certificate->encode();
- shared_ptr<Sha256WithRsaSignature> sha256Sig(new Sha256WithRsaSignature());
+ ptr_lib::shared_ptr<Sha256WithRsaSignature> sha256Sig(new Sha256WithRsaSignature());
KeyLocator keyLocator;
keyLocator.setType(ndn_KeyLocatorType_KEYNAME);
diff --git a/src/security/identity/memory-identity-storage.cpp b/src/security/identity/memory-identity-storage.cpp
index c5fb409..26341fa 100644
--- a/src/security/identity/memory-identity-storage.cpp
+++ b/src/security/identity/memory-identity-storage.cpp
@@ -14,7 +14,6 @@
#include <ndn-cpp/security/identity/memory-identity-storage.hpp>
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
@@ -64,13 +63,13 @@
if (doesKeyExist(keyName))
throw SecurityException("a key with the same name already exists!");
- keyStore_[keyName.toUri()] = make_shared<KeyRecord>(keyType, publicKeyDer);
+ keyStore_[keyName.toUri()] = ptr_lib::make_shared<KeyRecord>(keyType, publicKeyDer);
}
Blob
MemoryIdentityStorage::getKey(const Name& keyName)
{
- map<string, shared_ptr<KeyRecord> >::iterator record = keyStore_.find(keyName.toUri());
+ map<string, ptr_lib::shared_ptr<KeyRecord> >::iterator record = keyStore_.find(keyName.toUri());
if (record == keyStore_.end())
// Not found. Silently return null.
return Blob();
@@ -130,9 +129,9 @@
map<string, Blob>::iterator record = certificateStore_.find(certificateName.toUri());
if (record == certificateStore_.end())
// Not found. Silently return null.
- return shared_ptr<Data>();
+ return ptr_lib::shared_ptr<Data>();
- shared_ptr<Data> data(new Data());
+ ptr_lib::shared_ptr<Data> data(new Data());
data->wireDecode(*record->second);
return data;
}
diff --git a/src/security/identity/memory-private-key-storage.cpp b/src/security/identity/memory-private-key-storage.cpp
index b2bbcb5..7c3a2e0 100644
--- a/src/security/identity/memory-private-key-storage.cpp
+++ b/src/security/identity/memory-private-key-storage.cpp
@@ -13,7 +13,6 @@
#include <ndn-cpp/security/identity/memory-private-key-storage.hpp>
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
@@ -26,7 +25,7 @@
size_t privateKeyDerLength)
{
publicKeyStore_[keyName.toUri()] = PublicKey::fromDer(Blob(publicKeyDer, publicKeyDerLength));
- privateKeyStore_[keyName.toUri()] = make_shared<RsaPrivateKey>(privateKeyDer, privateKeyDerLength);
+ privateKeyStore_[keyName.toUri()] = ptr_lib::make_shared<RsaPrivateKey>(privateKeyDer, privateKeyDerLength);
}
void
@@ -37,10 +36,10 @@
#endif
}
-shared_ptr<PublicKey>
+ptr_lib::shared_ptr<PublicKey>
MemoryPrivateKeyStorage::getPublicKey(const Name& keyName)
{
- map<string, shared_ptr<PublicKey> >::iterator publicKey = publicKeyStore_.find(keyName.toUri());
+ map<string, ptr_lib::shared_ptr<PublicKey> >::iterator publicKey = publicKeyStore_.find(keyName.toUri());
if (publicKey == publicKeyStore_.end())
throw SecurityException(string("MemoryPrivateKeyStorage: Cannot find public key ") + keyName.toUri());
return publicKey->second;
@@ -59,7 +58,7 @@
unsigned int signatureBitsLength;
// Find the private key and sign.
- map<string, shared_ptr<RsaPrivateKey> >::iterator privateKey = privateKeyStore_.find(keyName.toUri());
+ map<string, ptr_lib::shared_ptr<RsaPrivateKey> >::iterator privateKey = privateKeyStore_.find(keyName.toUri());
if (privateKey == privateKeyStore_.end())
throw SecurityException(string("MemoryPrivateKeyStorage: Cannot find private key ") + keyName.toUri());
if (!RSA_sign(NID_sha256, digest, sizeof(digest), signatureBits, &signatureBitsLength, privateKey->second->getPrivateKey()))
diff --git a/src/security/identity/osx-private-key-storage.cpp b/src/security/identity/osx-private-key-storage.cpp
index aa6b7b8..e504616 100644
--- a/src/security/identity/osx-private-key-storage.cpp
+++ b/src/security/identity/osx-private-key-storage.cpp
@@ -18,7 +18,6 @@
#include <ndn-cpp/security/security-exception.hpp>
using namespace std;
-using namespace ndn::ptr_lib;
INIT_LOGGER("ndn.OSXPrivateKeyStorage");
@@ -124,7 +123,7 @@
throw SecurityException("Fail to create a symmetric key");
}
- shared_ptr<PublicKey> OSXPrivateKeyStorage::getPublicKey(const Name & keyName)
+ ptr_lib::shared_ptr<PublicKey> OSXPrivateKeyStorage::getPublicKey(const Name & keyName)
{
_LOG_TRACE("OSXPrivateKeyStorage::getPublickey");
diff --git a/src/security/key-chain.cpp b/src/security/key-chain.cpp
index fc05969..26dcec8 100644
--- a/src/security/key-chain.cpp
+++ b/src/security/key-chain.cpp
@@ -12,7 +12,6 @@
#include <ndn-cpp/security/key-chain.hpp>
using namespace std;
-using namespace ndn::ptr_lib;
using namespace ndn::func_lib;
#if NDN_CPP_HAVE_STD_FUNCTION
// In the std library, the placeholders are in a different namespace than boost.
@@ -21,7 +20,7 @@
namespace ndn {
-KeyChain::KeyChain(const shared_ptr<IdentityManager>& identityManager, const shared_ptr<PolicyManager>& policyManager)
+KeyChain::KeyChain(const ptr_lib::shared_ptr<IdentityManager>& identityManager, const ptr_lib::shared_ptr<PolicyManager>& policyManager)
: identityManager_(identityManager), policyManager_(policyManager), face_(0), maxSteps_(100)
{
}
@@ -32,7 +31,7 @@
identityManager_->signByCertificate(data, certificateName, wireFormat);
}
-shared_ptr<Signature>
+ptr_lib::shared_ptr<Signature>
KeyChain::sign(const uint8_t* buffer, size_t bufferLength, const Name& certificateName)
{
return identityManager_->signByCertificate(buffer, bufferLength, certificateName);
@@ -62,7 +61,7 @@
identityManager_->signByCertificate(data, signingCertificateName, wireFormat);
}
-shared_ptr<Signature>
+ptr_lib::shared_ptr<Signature>
KeyChain::signByIdentity(const uint8_t* buffer, size_t bufferLength, const Name& identityName)
{
Name signingCertificateName = identityManager_->getDefaultCertificateNameForIdentity(identityName);
@@ -75,12 +74,12 @@
void
KeyChain::verifyData
- (const shared_ptr<Data>& data, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed, int stepCount)
+ (const ptr_lib::shared_ptr<Data>& data, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed, int stepCount)
{
_LOG_TRACE("Enter Verify");
if (policyManager_->requireVerify(*data)) {
- shared_ptr<ValidationRequest> nextStep = policyManager_->checkVerificationPolicy
+ ptr_lib::shared_ptr<ValidationRequest> nextStep = policyManager_->checkVerificationPolicy
(data, stepCount, onVerified, onVerifyFailed);
if (nextStep)
face_->expressInterest
@@ -95,7 +94,7 @@
}
void
-KeyChain::onCertificateData(const shared_ptr<const Interest> &interest, const shared_ptr<Data> &data, shared_ptr<ValidationRequest> nextStep)
+KeyChain::onCertificateData(const ptr_lib::shared_ptr<const Interest> &interest, const ptr_lib::shared_ptr<Data> &data, ptr_lib::shared_ptr<ValidationRequest> nextStep)
{
// Try to verify the certificate (data) according to the parameters in nextStep.
verifyData(data, nextStep->onVerified_, nextStep->onVerifyFailed_, nextStep->stepCount_);
@@ -103,8 +102,8 @@
void
KeyChain::onCertificateInterestTimeout
- (const shared_ptr<const Interest> &interest, int retry, const OnVerifyFailed& onVerifyFailed, const shared_ptr<Data> &data,
- shared_ptr<ValidationRequest> nextStep)
+ (const ptr_lib::shared_ptr<const Interest> &interest, int retry, const OnVerifyFailed& onVerifyFailed, const ptr_lib::shared_ptr<Data> &data,
+ ptr_lib::shared_ptr<ValidationRequest> nextStep)
{
if (retry > 0)
// Issue the same expressInterest as in verifyData except decrement retry.
diff --git a/src/security/policy/no-verify-policy-manager.cpp b/src/security/policy/no-verify-policy-manager.cpp
index 38cc7fd..b93bdb6 100644
--- a/src/security/policy/no-verify-policy-manager.cpp
+++ b/src/security/policy/no-verify-policy-manager.cpp
@@ -9,7 +9,6 @@
#include <ndn-cpp/security/policy/no-verify-policy-manager.hpp>
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
@@ -29,12 +28,12 @@
return false;
}
-shared_ptr<ValidationRequest>
+ptr_lib::shared_ptr<ValidationRequest>
NoVerifyPolicyManager::checkVerificationPolicy
- (const shared_ptr<Data>& data, int stepCount, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed)
+ (const ptr_lib::shared_ptr<Data>& data, int stepCount, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed)
{
onVerified(data);
- return shared_ptr<ValidationRequest>();
+ return ptr_lib::shared_ptr<ValidationRequest>();
}
bool
diff --git a/src/security/policy/self-verify-policy-manager.cpp b/src/security/policy/self-verify-policy-manager.cpp
index 025514c..dc4058e 100644
--- a/src/security/policy/self-verify-policy-manager.cpp
+++ b/src/security/policy/self-verify-policy-manager.cpp
@@ -13,7 +13,6 @@
#include <ndn-cpp/security/policy/self-verify-policy-manager.hpp>
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
@@ -77,9 +76,9 @@
return true;
}
-shared_ptr<ValidationRequest>
+ptr_lib::shared_ptr<ValidationRequest>
SelfVerifyPolicyManager::checkVerificationPolicy
- (const shared_ptr<Data>& data, int stepCount, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed)
+ (const ptr_lib::shared_ptr<Data>& data, int stepCount, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed)
{
// Cast to const Data* so that we use the const version of getSignature() and don't reset the default encoding.
const Sha256WithRsaSignature *signature = dynamic_cast<const Sha256WithRsaSignature*>(((const Data*)data.get())->getSignature());
@@ -111,7 +110,7 @@
onVerifyFailed(data);
// No more steps, so return a null ValidationRequest.
- return shared_ptr<ValidationRequest>();
+ return ptr_lib::shared_ptr<ValidationRequest>();
}
bool
diff --git a/src/security/signature/sha256-with-rsa-handler.cpp b/src/security/signature/sha256-with-rsa-handler.cpp
index 905fc3e..ce6d249 100644
--- a/src/security/signature/sha256-with-rsa-handler.cpp
+++ b/src/security/signature/sha256-with-rsa-handler.cpp
@@ -11,7 +11,6 @@
#include <ndn-cpp/security/signature/sha256-with-rsa-handler.hpp>
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
diff --git a/src/sha256-with-rsa-signature.cpp b/src/sha256-with-rsa-signature.cpp
index bf4dfa6..ccf0230 100644
--- a/src/sha256-with-rsa-signature.cpp
+++ b/src/sha256-with-rsa-signature.cpp
@@ -9,14 +9,13 @@
#include <ndn-cpp/sha256-with-rsa-signature.hpp>
using namespace std;
-using namespace ndn::ptr_lib;
namespace ndn {
-shared_ptr<Signature>
+ptr_lib::shared_ptr<Signature>
Sha256WithRsaSignature::clone() const
{
- return shared_ptr<Signature>(new Sha256WithRsaSignature(*this));
+ return ptr_lib::shared_ptr<Signature>(new Sha256WithRsaSignature(*this));
}
void