namespace: resolve conflict of ndn and std
This commit is contained in:
1 parent
6e1c9cda36
commit
68bc51a3d9
5 files changed
+34
-37
No files matched your search
+3
-4
@@ -41,7 +41,6 @@ typedef boost::error_info<struct tag_errmsg, int> errmsg_info_int;
|
||||
|
||||
using namespace boost;
|
||||
using namespace boost::archive::iterators;
|
||||
using namespace std;
|
||||
|
||||
// Other options: VP_md2, EVP_md5, EVP_sha, EVP_sha1, EVP_sha256, EVP_dss, EVP_dss1, EVP_mdc2, EVP_ripemd160
|
||||
#define HASH_FUNCTION EVP_sha256
|
||||
@@ -95,7 +94,7 @@ struct hex_to_4_bit
|
||||
}
|
||||
};
|
||||
|
||||
typedef transform_width<transform_iterator<hex_to_4_bit<string::const_iterator::value_type>, string::const_iterator>, 8, 4> string_to_binary;
|
||||
typedef transform_width<transform_iterator<hex_to_4_bit<std::string::const_iterator::value_type>, std::string::const_iterator>, 8, 4> string_to_binary;
|
||||
|
||||
namespace Sync {
|
||||
|
||||
@@ -224,7 +223,7 @@ operator << (std::ostream &os, const Digest &digest)
|
||||
{
|
||||
BOOST_ASSERT (!digest.m_buffer.empty ());
|
||||
|
||||
ostreambuf_iterator<char> out_it (os); // ostream iterator
|
||||
std::ostreambuf_iterator<char> out_it (os); // ostream iterator
|
||||
// need to encode to base64
|
||||
copy (string_from_binary (digest.m_buffer.begin ()),
|
||||
string_from_binary (digest.m_buffer.end ()),
|
||||
@@ -236,7 +235,7 @@ operator << (std::ostream &os, const Digest &digest)
|
||||
std::istream &
|
||||
operator >> (std::istream &is, Digest &digest)
|
||||
{
|
||||
string str;
|
||||
std::string str;
|
||||
is >> str; // read string first
|
||||
|
||||
if (str.size () == 0)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include "sync-interest-table.h"
|
||||
#include "sync-logging.h"
|
||||
using namespace std;
|
||||
|
||||
INIT_LOGGER ("SyncInterestTable");
|
||||
|
||||
@@ -54,7 +53,7 @@ SyncInterestTable::pop ()
|
||||
}
|
||||
|
||||
bool
|
||||
SyncInterestTable::insert (DigestConstPtr digest, const string &name, bool unknownState/*=false*/)
|
||||
SyncInterestTable::insert (DigestConstPtr digest, const std::string& name, bool unknownState/*=false*/)
|
||||
{
|
||||
bool existent = false;
|
||||
|
||||
@@ -76,7 +75,7 @@ SyncInterestTable::size () const
|
||||
}
|
||||
|
||||
bool
|
||||
SyncInterestTable::remove (const string &name)
|
||||
SyncInterestTable::remove (const std::string& name)
|
||||
{
|
||||
InterestContainer::index<named>::type::iterator item = m_table.get<named> ().find (name);
|
||||
if (item != m_table.get<named> ().end ())
|
||||
|
||||
+17
-18
@@ -31,7 +31,6 @@
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
using namespace ndn;
|
||||
|
||||
INIT_LOGGER ("SyncLogic");
|
||||
@@ -89,7 +88,7 @@ SyncLogic::SyncLogic (const Name& syncPrefix,
|
||||
m_reexpressingInterestId = m_scheduler.scheduleEvent (time::seconds (0), // no need to add jitter
|
||||
bind (&SyncLogic::sendSyncInterest, this));
|
||||
|
||||
m_instanceId = string("Instance " + boost::lexical_cast<string>(m_instanceCounter++) + " ");
|
||||
m_instanceId = std::string("Instance " + boost::lexical_cast<std::string>(m_instanceCounter++) + " ");
|
||||
}
|
||||
|
||||
SyncLogic::SyncLogic (const Name& syncPrefix,
|
||||
@@ -141,8 +140,8 @@ SyncLogic::convertNameToDigestAndType (const Name &name)
|
||||
BOOST_ASSERT (nameLengthDiff > 0);
|
||||
BOOST_ASSERT (nameLengthDiff < 3);
|
||||
|
||||
string hash = name.get(-1).toEscapedString();
|
||||
string interestType;
|
||||
std::string hash = name.get(-1).toEscapedString();
|
||||
std::string interestType;
|
||||
|
||||
if(nameLengthDiff == 1)
|
||||
interestType = "normal";
|
||||
@@ -152,7 +151,7 @@ SyncLogic::convertNameToDigestAndType (const Name &name)
|
||||
_LOG_DEBUG_ID (hash << ", " << interestType);
|
||||
|
||||
DigestPtr digest = boost::make_shared<Digest> ();
|
||||
istringstream is (hash);
|
||||
std::istringstream is (hash);
|
||||
is >> *digest;
|
||||
|
||||
return make_tuple (digest, interestType);
|
||||
@@ -174,7 +173,7 @@ SyncLogic::onSyncInterest (const Name& prefix, const ndn::Interest& interest)
|
||||
return;
|
||||
|
||||
DigestConstPtr digest;
|
||||
string type;
|
||||
std::string type;
|
||||
tie (digest, type) = convertNameToDigestAndType (name);
|
||||
|
||||
if (type == "normal") // kind of ineffective...
|
||||
@@ -195,7 +194,7 @@ SyncLogic::onSyncInterest (const Name& prefix, const ndn::Interest& interest)
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::onSyncRegisterFailed(const Name& prefix, const string& msg)
|
||||
SyncLogic::onSyncRegisterFailed(const Name& prefix, const std::string& msg)
|
||||
{
|
||||
_LOG_DEBUG_ID("Sync prefix registration failed! " << msg);
|
||||
}
|
||||
@@ -232,7 +231,7 @@ SyncLogic::onSyncDataValidated(const shared_ptr<const Data>& data)
|
||||
_LOG_DEBUG_ID ("<< D " << name);
|
||||
|
||||
DigestConstPtr digest;
|
||||
string type;
|
||||
std::string type;
|
||||
tie (digest, type) = convertNameToDigestAndType (name);
|
||||
|
||||
if (type == "normal")
|
||||
@@ -338,7 +337,7 @@ SyncLogic::processSyncData (const Name &name, DigestConstPtr digest, const char
|
||||
}
|
||||
msg >> diff;
|
||||
|
||||
vector<MissingDataInfo> v;
|
||||
std::vector<MissingDataInfo> v;
|
||||
BOOST_FOREACH (LeafConstPtr leaf, diff.getLeaves().get<ordered>())
|
||||
{
|
||||
DiffLeafConstPtr diffLeaf = boost::dynamic_pointer_cast<const DiffLeaf> (leaf);
|
||||
@@ -372,15 +371,15 @@ SyncLogic::processSyncData (const Name &name, DigestConstPtr digest, const char
|
||||
{
|
||||
MissingDataInfo mdi = {info->toString(), oldSeq, seq};
|
||||
{
|
||||
ostringstream interestName;
|
||||
std::ostringstream interestName;
|
||||
interestName << mdi.prefix << "/" << mdi.high.getSession() << "/" << mdi.high.getSeq();
|
||||
_LOG_DEBUG_ID("+++++++++++++++ " + interestName.str());
|
||||
}
|
||||
if (m_perBranch)
|
||||
{
|
||||
ostringstream interestName;
|
||||
interestName << mdi.prefix << "/" << mdi.high.getSession() << "/" << mdi.high.getSeq();
|
||||
m_onUpdateBranch(interestName.str());
|
||||
std::ostringstream interestName;
|
||||
interestName << mdi.prefix << "/" << mdi.high.getSession() << "/" << mdi.high.getSeq();
|
||||
m_onUpdateBranch(interestName.str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -575,7 +574,7 @@ SyncLogic::sendSyncInterest ()
|
||||
|
||||
{
|
||||
m_outstandingInterestName = m_syncPrefix;
|
||||
ostringstream os;
|
||||
std::ostringstream os;
|
||||
os << *m_state->getDigest();
|
||||
m_outstandingInterestName.append(os.str());
|
||||
_LOG_DEBUG_ID (">> I " << m_outstandingInterestName);
|
||||
@@ -599,7 +598,7 @@ SyncLogic::sendSyncInterest ()
|
||||
void
|
||||
SyncLogic::sendSyncRecoveryInterests (DigestConstPtr digest)
|
||||
{
|
||||
ostringstream os;
|
||||
std::ostringstream os;
|
||||
os << *digest;
|
||||
|
||||
Name interestName = m_syncPrefix;
|
||||
@@ -670,10 +669,10 @@ SyncLogic::sendSyncData (const Name &name, DigestConstPtr digest, SyncStateMsg &
|
||||
}
|
||||
}
|
||||
|
||||
string
|
||||
std::string
|
||||
SyncLogic::getRootDigest()
|
||||
{
|
||||
ostringstream os;
|
||||
std::ostringstream os;
|
||||
os << *m_state->getDigest();
|
||||
return os.str();
|
||||
}
|
||||
@@ -704,7 +703,7 @@ SyncLogic::getBranchPrefixes() const
|
||||
// do not return forwarder prefix
|
||||
if (prefix != forwarderPrefix)
|
||||
{
|
||||
m.insert(pair<std::string, bool>(prefix, false));
|
||||
m.insert(std::pair<std::string, bool>(prefix, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-6
@@ -21,7 +21,6 @@
|
||||
#include "sync-socket.h"
|
||||
#include "sync-logging.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ndn;
|
||||
|
||||
INIT_LOGGER ("SyncSocket");
|
||||
@@ -107,8 +106,8 @@ SyncSocket::publishDataInternal(shared_ptr<Data> data, bool isCert)
|
||||
|
||||
Name dataName;
|
||||
dataName.append(m_dataPrefix)
|
||||
.append(boost::lexical_cast<string>(m_dataSession))
|
||||
.append(boost::lexical_cast<string>(sequence));
|
||||
.append(boost::lexical_cast<std::string>(m_dataSession))
|
||||
.append(boost::lexical_cast<std::string>(sequence));
|
||||
if(isCert)
|
||||
dataName.append("INTRO-CERT");
|
||||
data->setName(dataName);
|
||||
@@ -118,8 +117,8 @@ SyncSocket::publishDataInternal(shared_ptr<Data> data, bool isCert)
|
||||
{
|
||||
Name wrappedName;
|
||||
wrappedName.append(m_routableDataPrefix)
|
||||
.append(boost::lexical_cast<string>(m_dataSession))
|
||||
.append(boost::lexical_cast<string>(sequence));
|
||||
.append(boost::lexical_cast<std::string>(m_dataSession))
|
||||
.append(boost::lexical_cast<std::string>(sequence));
|
||||
|
||||
Data wrappedData(wrappedName);
|
||||
wrappedData.setContent(data->wireEncode());
|
||||
@@ -141,7 +140,7 @@ void
|
||||
SyncSocket::fetchData(const Name& prefix, const SeqNo& seq, const OnDataValidated& dataCallback, int retry)
|
||||
{
|
||||
Name interestName = prefix;
|
||||
interestName.append(boost::lexical_cast<string>(seq.getSession())).append(boost::lexical_cast<string>(seq.getSeq()));
|
||||
interestName.append(boost::lexical_cast<std::string>(seq.getSession())).append(boost::lexical_cast<std::string>(seq.getSeq()));
|
||||
|
||||
ndn::Interest interest(interestName);
|
||||
interest.setMustBeFresh(true);
|
||||
|
||||
@@ -14,12 +14,13 @@
|
||||
#include <queue>
|
||||
|
||||
using namespace ndn;
|
||||
using namespace std;
|
||||
|
||||
INIT_LOGGER ("SyncValidator");
|
||||
|
||||
namespace Sync {
|
||||
|
||||
using ndn::shared_ptr;
|
||||
|
||||
const shared_ptr<CertificateCache> SyncValidator::DefaultCertificateCache = shared_ptr<CertificateCache>();
|
||||
const shared_ptr<SecRuleRelative> SyncValidator::DefaultDataRule = shared_ptr<SecRuleRelative>();
|
||||
|
||||
@@ -56,7 +57,7 @@ SyncValidator::SyncValidator(const Name& prefix,
|
||||
void
|
||||
SyncValidator::deriveTrustNodes()
|
||||
{
|
||||
queue<Name> nodeQueue;
|
||||
std::queue<Name> nodeQueue;
|
||||
|
||||
// Clear existing trust nodes.
|
||||
m_trustedNodes.clear();
|
||||
@@ -151,7 +152,7 @@ SyncValidator::checkPolicy (const Data& data,
|
||||
catch(SignatureSha256WithRsa::Error& e)
|
||||
{
|
||||
return onValidationFailed(data.shared_from_this(),
|
||||
"Not SignatureSha256WithRsa signature: " + string(e.what()));
|
||||
"Not SignatureSha256WithRsa signature: " + std::string(e.what()));
|
||||
}
|
||||
catch(KeyLocator::Error& e)
|
||||
{
|
||||
@@ -194,13 +195,13 @@ SyncValidator::onCertificateValidated(const shared_ptr<const Data>& signCertific
|
||||
catch(IntroCertificate::Error& e)
|
||||
{
|
||||
return onValidationFailed(data,
|
||||
"Intro cert decoding error: " + string(e.what()));
|
||||
"Intro cert decoding error: " + std::string(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SyncValidator::onCertificateValidationFailed(const shared_ptr<const Data>& signCertificate,
|
||||
const string& failureInfo,
|
||||
const std::string& failureInfo,
|
||||
const shared_ptr<const Data>& data,
|
||||
const OnDataValidationFailed& onValidationFailed)
|
||||
{
|
||||
@@ -223,7 +224,7 @@ SyncValidator::onCertInterest(const Name& prefix, const Interest& interest)
|
||||
}
|
||||
|
||||
void
|
||||
SyncValidator::onCertRegisterFailed(const Name& prefix, const string& msg)
|
||||
SyncValidator::onCertRegisterFailed(const Name& prefix, const std::string& msg)
|
||||
{
|
||||
_LOG_DEBUG("SyncValidator::onCertRegisterFailed: " << msg);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user