build: == Dependency change == ChronoSync now depends on ndn-cxx library
diff --git a/src/sync-diff-leaf.cc b/src/sync-diff-leaf.cc
index bdbbd1b..114b122 100644
--- a/src/sync-diff-leaf.cc
+++ b/src/sync-diff-leaf.cc
@@ -17,12 +17,12 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-diff-leaf.h"
#include <boost/throw_exception.hpp>
-typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info;
+typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info;
using namespace Sync::Error;
diff --git a/src/sync-diff-leaf.h b/src/sync-diff-leaf.h
index 6e09efe..c7862af 100644
--- a/src/sync-diff-leaf.h
+++ b/src/sync-diff-leaf.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_DIFF_LEAF_H
@@ -40,7 +40,7 @@
/**
* @ingroup sync
- * @brief Annotated SYNC leaf
+ * @brief Annotated SYNC leaf
*/
class DiffLeaf : public Leaf
{
diff --git a/src/sync-diff-state-container.h b/src/sync-diff-state-container.h
index 2ae7c59..9cbec2b 100644
--- a/src/sync-diff-state-container.h
+++ b/src/sync-diff-state-container.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_DIFF_STATE_CONTAINER_H
@@ -40,7 +40,7 @@
namespace Sync {
-/// @cond include_hidden
+/// @cond include_hidden
struct sequenced { };
struct timed { };
/// @endcond
@@ -59,7 +59,7 @@
DigestPtrHash,
DigestPtrEqual
>
- ,
+ ,
// sequenced index to access older/newer element (like in list)
mi::sequenced<mi::tag<sequenced> >
>
diff --git a/src/sync-diff-state.cc b/src/sync-diff-state.cc
index 3030940..fefcf5b 100644
--- a/src/sync-diff-state.cc
+++ b/src/sync-diff-state.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-diff-state.h"
@@ -43,7 +43,7 @@
DiffState::diff () const
{
DiffStatePtr ret = make_shared<DiffState> ();
-
+
DiffStatePtr state = m_next;
while (state != 0)
{
@@ -71,10 +71,10 @@
BOOST_ASSERT (false);
}
}
-
+
return *this;
}
-
+
// from State
boost::tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
DiffState::update (NameInfoConstPtr info, const SeqNo &seq)
diff --git a/src/sync-diff-state.h b/src/sync-diff-state.h
index d944c3e..153437e 100644
--- a/src/sync-diff-state.h
+++ b/src/sync-diff-state.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_DIFF_STATE_H
@@ -67,7 +67,7 @@
*/
DigestConstPtr
getDigest () const { return m_digest; }
-
+
/**
* @brief Accumulate differences from `this' state to the most current state
* @returns Accumulated differences from `this' state to the most current state
@@ -84,14 +84,14 @@
*/
DiffState&
operator += (const DiffState &state);
-
+
// from State
virtual boost::tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
update (NameInfoConstPtr info, const SeqNo &seq);
virtual bool
remove (NameInfoConstPtr info);
-
+
private:
DiffStatePtr m_next;
DigestConstPtr m_digest;
diff --git a/src/sync-digest.cc b/src/sync-digest.cc
index 19ec240..d3dde6c 100644
--- a/src/sync-digest.cc
+++ b/src/sync-digest.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-digest.h"
@@ -25,8 +25,8 @@
#include <boost/assert.hpp>
#include <boost/throw_exception.hpp>
-typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info_str;
-typedef boost::error_info<struct tag_errmsg, int> errmsg_info_int;
+typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info_str;
+typedef boost::error_info<struct tag_errmsg, int> errmsg_info_int;
// for printing, may be disabled in optimized build
@@ -89,7 +89,7 @@
value = lookup_table [(unsigned)ch];
if (value == -1)
BOOST_THROW_EXCEPTION (Sync::Error::DigestCalculationError () << errmsg_info_int ((int)ch));
-
+
return value;
}
};
@@ -146,7 +146,7 @@
if (!m_buffer.empty ()) return;
m_buffer.resize (HASH_FUNCTION_LEN);
-
+
unsigned int tmp;
int ok = EVP_DigestFinal_ex (m_context,
&m_buffer[0], &tmp);
@@ -160,14 +160,14 @@
Digest::getHash () const
{
if (isZero ()) return 0;
-
+
if (sizeof (std::size_t) > m_buffer.size ())
{
BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
<< errmsg_info_str ("Hash is not zero and length is less than size_t")
<< errmsg_info_int (m_buffer.size ()));
}
-
+
// just getting first sizeof(std::size_t) bytes
// not ideal, but should work pretty well
return *(reinterpret_cast<const std::size_t*> (&m_buffer[0]));
@@ -192,7 +192,7 @@
Digest::update (const uint8_t *buffer, size_t size)
{
// cout << "Update: " << (void*)buffer << " / size: " << size << "\n";
-
+
// cannot update Digest when it has been finalized
if (!m_buffer.empty ())
BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
@@ -209,7 +209,7 @@
Digest &
Digest::operator << (const Digest &src)
{
- if (src.m_buffer.empty ())
+ if (src.m_buffer.empty ())
BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
<< errmsg_info_str ("Digest has not been yet finalized"));
@@ -222,7 +222,7 @@
operator << (std::ostream &os, const Digest &digest)
{
BOOST_ASSERT (!digest.m_buffer.empty ());
-
+
std::ostreambuf_iterator<char> out_it (os); // ostream iterator
// need to encode to base64
copy (string_from_binary (digest.m_buffer.begin ()),
@@ -241,7 +241,7 @@
if (str.size () == 0)
BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
<< errmsg_info_str ("Input is empty"));
-
+
// uint8_t padding = (3 - str.size () % 3) % 3;
// for (uint8_t i = 0; i < padding; i++) str.push_back ('=');
@@ -251,7 +251,7 @@
<< errmsg_info_str ("Digest has been already finalized"));
digest.m_buffer.clear ();
-
+
copy (string_to_binary (str.begin ()),
string_to_binary (str.end ()),
std::back_inserter (digest.m_buffer));
@@ -261,4 +261,3 @@
} // Sync
-
diff --git a/src/sync-digest.h b/src/sync-digest.h
index ecc8522..881b252 100644
--- a/src/sync-digest.h
+++ b/src/sync-digest.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_DIGEST_H
@@ -47,7 +47,7 @@
*/
bool
empty () const;
-
+
/**
* @brief Reset digest to the initial state
*/
@@ -84,7 +84,7 @@
bool
operator != (const Digest &digest) const
{ return ! (*this == digest); }
-
+
/**
* @brief Add existing digest to digest calculation
@@ -116,11 +116,11 @@
*/
bool
isZero () const;
-
+
private:
Digest &
operator = (Digest &digest) { (void)digest; return *this; }
-
+
/**
* @brief Add size bytes of buffer to the hash
*/
@@ -132,7 +132,7 @@
friend std::istream &
operator >> (std::istream &is, Digest &digest);
-
+
private:
EVP_MD_CTX *m_context;
std::vector<uint8_t> m_buffer;
diff --git a/src/sync-event.h b/src/sync-event.h
index 7808947..ac489ca 100644
--- a/src/sync-event.h
+++ b/src/sync-event.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_EVENT_H
diff --git a/src/sync-full-leaf.cc b/src/sync-full-leaf.cc
index 84f96e3..e261e78 100644
--- a/src/sync-full-leaf.cc
+++ b/src/sync-full-leaf.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-full-leaf.h"
diff --git a/src/sync-full-leaf.h b/src/sync-full-leaf.h
index 08142a6..e40a30f 100644
--- a/src/sync-full-leaf.h
+++ b/src/sync-full-leaf.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_FULL_LEAF_H
@@ -29,7 +29,7 @@
/**
* @ingroup sync
- * @brief SYNC leaf for the full state (with support of Digest calculation)
+ * @brief SYNC leaf for the full state (with support of Digest calculation)
*/
class FullLeaf : public Leaf
{
@@ -49,12 +49,12 @@
* (including updates of child classes)
*/
const Digest &
- getDigest () const { return m_digest; }
+ getDigest () const { return m_digest; }
// from Leaf
virtual void
setSeq (const SeqNo &seq);
-
+
private:
void
updateDigest ();
diff --git a/src/sync-full-state.cc b/src/sync-full-state.cc
index 7000606..4d00aec 100644
--- a/src/sync-full-state.cc
+++ b/src/sync-full-state.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-full-state.h"
diff --git a/src/sync-full-state.h b/src/sync-full-state.h
index 028c41e..99914ab 100644
--- a/src/sync-full-state.h
+++ b/src/sync-full-state.h
@@ -17,13 +17,13 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_FULL_STATE_H
#define SYNC_FULL_STATE_H
-#include <ndn-cpp-dev/util/time.hpp>
+#include <ndn-cxx/util/time.hpp>
#include "sync-state.h"
namespace Sync {
@@ -61,14 +61,14 @@
*/
DigestConstPtr
getDigest ();
-
+
// from State
virtual boost::tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
update (NameInfoConstPtr info, const SeqNo &seq);
virtual bool
remove (NameInfoConstPtr info);
-
+
private:
ndn::time::system_clock::TimePoint m_lastUpdated; ///< @brief Time when state was updated last time
DigestPtr m_digest;
diff --git a/src/sync-interest-container.h b/src/sync-interest-container.h
index f674d05..96086fa 100644
--- a/src/sync-interest-container.h
+++ b/src/sync-interest-container.h
@@ -17,13 +17,13 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_INTEREST_CONTAINER_H
#define SYNC_INTEREST_CONTAINER_H
-#include <ndn-cpp-dev/util/time.hpp>
+#include <ndn-cxx/util/time.hpp>
#include "sync-digest.h"
@@ -51,14 +51,14 @@
, m_unknown (unknown)
{
}
-
+
DigestConstPtr m_digest;
std::string m_name;
ndn::time::system_clock::TimePoint m_time;
bool m_unknown;
};
-/// @cond include_hidden
+/// @cond include_hidden
struct named { };
struct hashed;
struct timed;
@@ -76,7 +76,7 @@
BOOST_MULTI_INDEX_MEMBER(Interest, std::string, m_name)
>
,
-
+
mi::hashed_non_unique<
mi::tag<hashed>,
BOOST_MULTI_INDEX_MEMBER(Interest, DigestConstPtr, m_digest),
@@ -84,7 +84,7 @@
DigestPtrEqual
>
,
-
+
mi::ordered_non_unique<
mi::tag<timed>,
BOOST_MULTI_INDEX_MEMBER(Interest, ndn::time::system_clock::TimePoint, m_time)
diff --git a/src/sync-interest-table.cc b/src/sync-interest-table.cc
index fc1d3bf..16706ea 100644
--- a/src/sync-interest-table.cc
+++ b/src/sync-interest-table.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-interest-table.h"
@@ -56,7 +56,7 @@
SyncInterestTable::insert (DigestConstPtr digest, const std::string& name, bool unknownState/*=false*/)
{
bool existent = false;
-
+
InterestContainer::index<named>::type::iterator it = m_table.get<named> ().find (name);
if (it != m_table.end())
{
@@ -100,14 +100,14 @@
}
void SyncInterestTable::expireInterests ()
-{
+{
uint32_t count = 0;
ndn::time::system_clock::TimePoint expireTime = ndn::time::system_clock::now() - m_entryLifetime;
-
+
while (m_table.size () > 0)
{
InterestContainer::index<timed>::type::iterator item = m_table.get<timed> ().begin ();
-
+
if (item->m_time <= expireTime)
{
m_table.get<timed> ().erase (item);
diff --git a/src/sync-interest-table.h b/src/sync-interest-table.h
index 4810c41..13ea3bc 100644
--- a/src/sync-interest-table.h
+++ b/src/sync-interest-table.h
@@ -17,13 +17,13 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_INTEREST_TABLE_H
#define SYNC_INTEREST_TABLE_H
-#include <ndn-cpp-dev/util/scheduler.hpp>
+#include <ndn-cxx/util/scheduler.hpp>
#include <string>
#include <vector>
@@ -36,7 +36,7 @@
/**
* \ingroup sync
* @brief A table to keep unanswered Sync Interest
- * all access operation to the table should grab the
+ * all access operation to the table should grab the
* mutex first
*/
class SyncInterestTable
@@ -63,7 +63,7 @@
*/
bool
remove (const std::string &name);
-
+
/**
* @brief pop a non-expired Interest from PIT
*/
diff --git a/src/sync-intro-certificate.h b/src/sync-intro-certificate.h
index 3c28366..bc19fd2 100644
--- a/src/sync-intro-certificate.h
+++ b/src/sync-intro-certificate.h
@@ -11,8 +11,8 @@
#ifndef SYNC_INTRO_CERTIFICATE_H
#define SYNC_INTRO_CERTIFICATE_H
-#include <ndn-cpp-dev/security/identity-certificate.hpp>
-#include <ndn-cpp-dev/security/signature-sha256-with-rsa.hpp>
+#include <ndn-cxx/security/identity-certificate.hpp>
+#include <ndn-cxx/security/signature-sha256-with-rsa.hpp>
namespace Sync {
@@ -29,7 +29,7 @@
IntroCertificate()
{}
-
+
/**
* @brief Construct IntroCertificate from IdentityCertificate
*
@@ -43,7 +43,7 @@
/**
* @brief Construct IntroCertificate using a plain data.
- *
+ *
* if data is not actually IntroCertificate, Error will be thrown out.
*
* @param data
@@ -94,7 +94,7 @@
.append(m_introduceeCertName.wireEncode())
.append(m_introducerCertName.wireEncode())
.appendVersion();
-
+
setName(dataName);
setContent(m_introduceeCert.wireEncode());
}
diff --git a/src/sync-leaf.cc b/src/sync-leaf.cc
index 03e2217..e01b192 100644
--- a/src/sync-leaf.cc
+++ b/src/sync-leaf.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-leaf.h"
diff --git a/src/sync-leaf.h b/src/sync-leaf.h
index 345be46..a85544e 100644
--- a/src/sync-leaf.h
+++ b/src/sync-leaf.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_LEAF_H
@@ -42,7 +42,7 @@
*/
Leaf (NameInfoConstPtr info, const SeqNo &seq);
virtual ~Leaf ();
-
+
/**
* @brief Get name of the leaf
*/
@@ -63,7 +63,7 @@
*/
virtual void
setSeq (const SeqNo &seq);
-
+
private:
NameInfoConstPtr m_info;
SeqNo m_seq;
diff --git a/src/sync-logging.cc b/src/sync-logging.cc
index 9048964..3a63232 100644
--- a/src/sync-logging.cc
+++ b/src/sync-logging.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-logging.h"
@@ -43,7 +43,7 @@
static bool configured = false;
if (configured) return;
-
+
if (access ("log4cxx.properties", R_OK)==0)
PropertyConfigurator::configureAndWatch ("log4cxx.properties");
else
diff --git a/src/sync-logging.h b/src/sync-logging.h
index 865204a..2bdc36b 100644
--- a/src/sync-logging.h
+++ b/src/sync-logging.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_LOG_H
diff --git a/src/sync-logic-event-container.h b/src/sync-logic-event-container.h
index ebab72a..fc79282 100644
--- a/src/sync-logic-event-container.h
+++ b/src/sync-logic-event-container.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_LOGIC_EVENT_CONTAINER_H
@@ -49,7 +49,7 @@
, event (_event)
, lbl (_label)
{ }
-
+
boost::system_time time;
Event event;
uint32_t lbl;
diff --git a/src/sync-logic.cc b/src/sync-logic.cc
index 56692e5..86fb69b 100644
--- a/src/sync-logic.cc
+++ b/src/sync-logic.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
* Yingdi Yu <yingdi@cs.ucla.edu>
*/
@@ -61,7 +61,7 @@
SyncLogic::SyncLogic (const Name& syncPrefix,
const IdentityCertificate& myCertificate,
- shared_ptr<Validator> validator,
+ shared_ptr<Validator> validator,
shared_ptr<Face> face,
LogicUpdateCallback onUpdate,
LogicRemoveCallback onRemove)
@@ -79,11 +79,11 @@
, m_rangeUniformRandom (m_randomGenerator, boost::uniform_int<> (200,1000))
, m_reexpressionJitter (m_randomGenerator, boost::uniform_int<> (100,500))
, m_recoveryRetransmissionInterval (m_defaultRecoveryRetransmitInterval)
-{
- m_syncRegisteredPrefixId = m_face->setInterestFilter (m_syncPrefix,
- bind(&SyncLogic::onSyncInterest, this, _1, _2),
+{
+ m_syncRegisteredPrefixId = m_face->setInterestFilter (m_syncPrefix,
+ bind(&SyncLogic::onSyncInterest, this, _1, _2),
bind(&SyncLogic::onSyncRegisterFailed, this, _1, _2));
-
+
m_reexpressingInterestId = m_scheduler.scheduleEvent (time::seconds (0), // no need to add jitter
bind (&SyncLogic::sendSyncInterest, this));
@@ -109,9 +109,9 @@
, m_rangeUniformRandom (m_randomGenerator, boost::uniform_int<> (200,1000))
, m_reexpressionJitter (m_randomGenerator, boost::uniform_int<> (100,500))
, m_recoveryRetransmissionInterval (m_defaultRecoveryRetransmitInterval)
-{
- m_syncRegisteredPrefixId = m_face->setInterestFilter (m_syncPrefix,
- bind(&SyncLogic::onSyncInterest, this, _1, _2),
+{
+ m_syncRegisteredPrefixId = m_face->setInterestFilter (m_syncPrefix,
+ bind(&SyncLogic::onSyncInterest, this, _1, _2),
bind(&SyncLogic::onSyncRegisterFailed, this, _1, _2));
m_reexpressingInterestId = m_scheduler.scheduleEvent (time::seconds (0), // no need to add jitter
@@ -119,8 +119,8 @@
}
SyncLogic::~SyncLogic ()
-{
- m_face->unsetInterestFilter(m_syncRegisteredPrefixId);
+{
+ m_face->unsetInterestFilter(m_syncRegisteredPrefixId);
m_scheduler.cancelEvent (m_reexpressingInterestId);
m_scheduler.cancelEvent (m_delayedInterestProcessingId);
}
@@ -128,7 +128,7 @@
/**
* Two types of intersts
*
- * Normal name: .../<hash>
+ * Normal name: .../<hash>
* Recovery name: .../recovery/<hash>
*/
boost::tuple<DigestConstPtr, std::string>
@@ -139,10 +139,10 @@
int nameLengthDiff = name.size() - m_syncPrefix.size();
BOOST_ASSERT (nameLengthDiff > 0);
BOOST_ASSERT (nameLengthDiff < 3);
-
+
std::string hash = name.get(-1).toEscapedString();
std::string interestType;
-
+
if(nameLengthDiff == 1)
interestType = "normal";
else
@@ -180,7 +180,7 @@
{
processSyncInterest (name, digest);
}
- else if (type == "recovery")
+ else if (type == "recovery")
{
processSyncRecoveryInterest (name, digest);
}
@@ -204,13 +204,13 @@
{
OnDataValidated onValidated = bind(&SyncLogic::onSyncDataValidated, this, _1);
OnDataValidationFailed onValidationFailed = bind(&SyncLogic::onSyncDataValidationFailed, this, _1);
- m_validator->validate(data, onValidated, onValidationFailed);
+ m_validator->validate(data, onValidated, onValidationFailed);
}
void
SyncLogic::onSyncTimeout(const ndn::Interest& interest)
-{
- // It is OK. Others will handle the time out situation.
+{
+ // It is OK. Others will handle the time out situation.
}
void
@@ -229,7 +229,7 @@
try
{
_LOG_DEBUG_ID ("<< D " << name);
-
+
DigestConstPtr digest;
std::string type;
tie (digest, type) = convertNameToDigestAndType (name);
@@ -265,7 +265,7 @@
// Special case when state is not empty and we have received request with zero-root digest
if (digest->isZero () && !rootDigest->isZero ())
{
-
+
SyncStateMsg ssm;
{
ssm << (*m_state);
@@ -280,7 +280,7 @@
m_syncInterestTable.insert (digest, name.toUri(), false);
return;
}
-
+
DiffStateContainer::iterator stateInDiffLog = m_log.find (digest);
if (stateInDiffLog != m_log.end ())
@@ -300,7 +300,7 @@
m_scheduler.cancelEvent (m_delayedInterestProcessingId);
}
- uint32_t waitDelay = GET_RANDOM (m_rangeUniformRandom);
+ uint32_t waitDelay = GET_RANDOM (m_rangeUniformRandom);
_LOG_DEBUG_ID ("Digest is not in the log. Schedule processing after small delay: " << time::milliseconds (waitDelay));
m_delayedInterestProcessingId = m_scheduler.scheduleEvent (time::milliseconds (waitDelay),
@@ -309,7 +309,7 @@
else
{
_LOG_DEBUG_ID (" (timed processing)");
-
+
m_recoveryRetransmissionInterval = m_defaultRecoveryRetransmitInterval;
sendSyncRecoveryInterests (digest);
}
@@ -320,7 +320,7 @@
{
DiffStatePtr diffLog = boost::make_shared<DiffState> ();
bool ownInterestSatisfied = false;
-
+
try
{
@@ -330,7 +330,7 @@
DiffState diff;
SyncStateMsg msg;
- if (!msg.ParseFromArray(wireData, len) || !msg.IsInitialized())
+ if (!msg.ParseFromArray(wireData, len) || !msg.IsInitialized())
{
//Throw
BOOST_THROW_EXCEPTION (Error::SyncStateMsgDecodingFailure () );
@@ -404,7 +404,7 @@
}
}
- if (!v.empty())
+ if (!v.empty())
{
if (!m_perBranch)
{
@@ -430,7 +430,7 @@
// this is kind of wrong
// satisfyPendingSyncInterests (diffLog); // if there are interests in PIT, there is a point to satisfy them using new state
-
+
// if state has changed, then it is safe to express a new interest
time::system_clock::Duration after = time::milliseconds(GET_RANDOM (m_reexpressionJitter));
// cout << "------------ reexpress interest after: " << after << endl;
@@ -472,7 +472,7 @@
/// @todo Impose limit on how many state info should be send out
}
}
-
+
try
{
uint32_t counter = 0;
@@ -501,9 +501,9 @@
}
void
-SyncLogic::insertToDiffLog (DiffStatePtr diffLog)
+SyncLogic::insertToDiffLog (DiffStatePtr diffLog)
{
- diffLog->setDigest (m_state->getDigest());
+ diffLog->setDigest (m_state->getDigest());
if (m_log.size () > 0)
{
m_log.get<sequenced> ().front ()->setNext (diffLog);
@@ -527,23 +527,23 @@
m_state->update(info, seqN);
_LOG_DEBUG_ID ("addLocalNames (): new state " << *m_state->getDigest ());
-
+
diff = boost::make_shared<DiffState>();
diff->update(info, seqN);
insertToDiffLog (diff);
}
// _LOG_DEBUG_ID ("PIT size: " << m_syncInterestTable.size ());
- satisfyPendingSyncInterests (diff);
+ satisfyPendingSyncInterests (diff);
}
void
-SyncLogic::remove(const Name &prefix)
+SyncLogic::remove(const Name &prefix)
{
DiffStatePtr diff;
{
NameInfoConstPtr info = StdNameInfo::FindOrCreate(prefix.toUri());
- m_state->remove(info);
+ m_state->remove(info);
// increment the sequence number for the forwarder node
NameInfoConstPtr forwarderInfo = StdNameInfo::FindOrCreate(forwarderPrefix);
@@ -564,7 +564,7 @@
insertToDiffLog (diff);
}
- satisfyPendingSyncInterests (diff);
+ satisfyPendingSyncInterests (diff);
}
void
@@ -600,14 +600,14 @@
{
std::ostringstream os;
os << *digest;
-
+
Name interestName = m_syncPrefix;
interestName.append("recovery").append(os.str());
time::system_clock::Duration nextRetransmission = time::milliseconds (m_recoveryRetransmissionInterval + GET_RANDOM (m_reexpressionJitter));
m_recoveryRetransmissionInterval <<= 1;
-
+
m_scheduler.cancelEvent (m_reexpressingRecoveryInterestId);
if (m_recoveryRetransmissionInterval < 100*1000) // <100 seconds
m_reexpressingRecoveryInterestId = m_scheduler.scheduleEvent (nextRetransmission,
@@ -643,11 +643,11 @@
Data syncData(name);
syncData.setContent(reinterpret_cast<const uint8_t*>(wireData), size);
syncData.setFreshnessPeriod(time::milliseconds(m_syncResponseFreshness));
-
+
m_keyChain.sign(syncData, m_myCertificate.getName());
-
+
m_face->put(syncData);
-
+
delete []wireData;
// checking if our own interest got satisfied
@@ -655,11 +655,11 @@
{
satisfiedOwnInterest = (m_outstandingInterestName == name);
}
-
+
if (satisfiedOwnInterest)
{
_LOG_DEBUG_ID ("Satisfied our own Interest. Re-expressing (hopefully with a new digest)");
-
+
time::system_clock::Duration after = time::milliseconds(GET_RANDOM (m_reexpressionJitter));
// cout << "------------ reexpress interest after: " << after << endl;
EventId eventId = m_scheduler.scheduleEvent (after,
@@ -670,7 +670,7 @@
}
std::string
-SyncLogic::getRootDigest()
+SyncLogic::getRootDigest()
{
std::ostringstream os;
os << *m_state->getDigest();
diff --git a/src/sync-logic.h b/src/sync-logic.h
index 98ab0aa..9d9f7fe 100644
--- a/src/sync-logic.h
+++ b/src/sync-logic.h
@@ -28,10 +28,10 @@
#include <memory>
#include <map>
-#include <ndn-cpp-dev/face.hpp>
-#include <ndn-cpp-dev/security/validator.hpp>
-#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <ndn-cpp-dev/util/scheduler.hpp>
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/security/validator.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/util/scheduler.hpp>
#include "sync-interest-table.h"
#include "sync-diff-state.h"
@@ -108,7 +108,7 @@
std::map<std::string, bool>
getBranchPrefixes() const;
-private:
+private:
void
delayedChecksLoop ();
@@ -137,12 +137,12 @@
void
processSyncData (const ndn::Name &name,
DigestConstPtr digest, const char *wireData, size_t len);
-
+
void
processSyncRecoveryInterest (const ndn::Name &name,
DigestConstPtr digest);
-
- void
+
+ void
insertToDiffLog (DiffStatePtr diff);
void
@@ -167,7 +167,7 @@
size_t
getNumberOfBranches () const;
-
+
private:
FullStatePtr m_state;
DiffStateContainer m_log;
@@ -198,11 +198,11 @@
static const int m_defaultRecoveryRetransmitInterval = 200; // milliseconds
uint32_t m_recoveryRetransmissionInterval; // milliseconds
-
+
ndn::EventId m_delayedInterestProcessingId;
ndn::EventId m_reexpressingInterestId;
ndn::EventId m_reexpressingRecoveryInterestId;
-
+
std::string m_instanceId;
static int m_instanceCounter;
};
diff --git a/src/sync-name-info.cc b/src/sync-name-info.cc
index 30986cd..3054eac 100644
--- a/src/sync-name-info.cc
+++ b/src/sync-name-info.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-name-info.h"
diff --git a/src/sync-name-info.h b/src/sync-name-info.h
index 2f7c165..cb1125e 100644
--- a/src/sync-name-info.h
+++ b/src/sync-name-info.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_NAME_INFO_H
@@ -39,7 +39,7 @@
{
private:
typedef boost::weak_ptr<const NameInfo> const_weak_ptr;
-
+
public:
virtual ~NameInfo () { };
@@ -75,7 +75,7 @@
*/
virtual std::string
toString () const = 0;
-
+
protected:
// actual stuff
size_t m_id; ///< @brief Identifies NameInfo throughout the library (for hash container, doesn't need to be strictly unique)
diff --git a/src/sync-seq-no.cc b/src/sync-seq-no.cc
index fbbc53f..0d2c8e8 100644
--- a/src/sync-seq-no.cc
+++ b/src/sync-seq-no.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-seq-no.h"
diff --git a/src/sync-seq-no.h b/src/sync-seq-no.h
index bf21704..81955e2 100644
--- a/src/sync-seq-no.h
+++ b/src/sync-seq-no.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
* Yingdi Yu <yingdi@cs.ucla.edu>
*/
@@ -45,7 +45,7 @@
, m_seq (0)
{
}
-
+
/**
* @brief Copy constructor
* @param seq sequence number object to copy from
@@ -145,7 +145,7 @@
{
return m_valid;
}
-
+
/**
* @brief Get session id
*/
@@ -164,10 +164,10 @@
void
setSeq(uint64_t seq)
{ m_seq = seq; }
-
+
private:
bool m_valid;
-
+
/**
* @brief Session ID (e.g., after crash, application will choose new session ID.
*
diff --git a/src/sync-socket.h b/src/sync-socket.h
index 8013635..abf1dfa 100644
--- a/src/sync-socket.h
+++ b/src/sync-socket.h
@@ -21,10 +21,10 @@
#ifndef _SYNC_SOCKET_H
#define _SYNC_SOCKET_H
-#include <ndn-cpp-dev/face.hpp>
-#include <ndn-cpp-dev/security/validator.hpp>
-#include <ndn-cpp-dev/security/validator-null.hpp>
-#include <ndn-cpp-dev/security/key-chain.hpp>
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/security/validator.hpp>
+#include <ndn-cxx/security/validator-null.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
#include "sync-logic.h"
#include "sync-seq-no.h"
@@ -51,7 +51,7 @@
static const ndn::Name EMPTY_NAME;
- SyncSocket(const ndn::Name& syncPrefix,
+ SyncSocket(const ndn::Name& syncPrefix,
const ndn::Name& dataPrefix,
uint64_t dataSession,
bool withRoutingPrefix,
@@ -59,7 +59,7 @@
ndn::shared_ptr<ndn::Face> face,
const ndn::IdentityCertificate& myCertificate,
ndn::shared_ptr<ndn::SecRuleRelative> dataRule,
- NewDataCallback dataCallback,
+ NewDataCallback dataCallback,
RemoveCallback rmCallback);
~SyncSocket();
@@ -67,10 +67,10 @@
void
publishData(const uint8_t* buf, size_t len, int freshness, bool isCert = false);
- void
- leave()
- {
- m_syncLogic->remove(m_withRoutingPrefix ? m_routableDataPrefix : m_dataPrefix);
+ void
+ leave()
+ {
+ m_syncLogic->remove(m_withRoutingPrefix ? m_routableDataPrefix : m_dataPrefix);
}
void
@@ -79,13 +79,13 @@
m_syncLogic->remove(prefix);
}
- void
+ void
fetchData(const ndn::Name &prefix, const SeqNo &seq, const ndn::OnDataValidated& onValidated, int retry = 0);
- std::string
- getRootDigest()
- {
- return m_syncLogic->getRootDigest();
+ std::string
+ getRootDigest()
+ {
+ return m_syncLogic->getRootDigest();
}
uint64_t
@@ -93,7 +93,7 @@
{
// If DNS works, we should use pure m_dataprefix rather than the one with routing prefix.
SequenceLog::iterator i = m_sequenceLog.find (m_withRoutingPrefix ? m_routableDataPrefix : m_dataPrefix);
-
+
if (i != m_sequenceLog.end ())
{
SeqNo s = i->second;
@@ -104,9 +104,9 @@
}
SyncLogic &
- getLogic()
- {
- return *m_syncLogic;
+ getLogic()
+ {
+ return *m_syncLogic;
}
void
@@ -149,16 +149,16 @@
// // make this a static function so we don't have to create socket instance without
// // knowing the local prefix. it's a wrong place for this function anyway
// static std::string
- // GetLocalPrefix ();
-
+ // GetLocalPrefix ();
+
private:
void
publishDataInternal(ndn::shared_ptr<ndn::Data> data, bool isCert);
- void
- passCallback(const std::vector<MissingDataInfo> &v)
- {
- m_newDataCallback(v, this);
+ void
+ passCallback(const std::vector<MissingDataInfo> &v)
+ {
+ m_newDataCallback(v, this);
}
void
diff --git a/src/sync-state-leaf-container.h b/src/sync-state-leaf-container.h
index 48819aa..d14e635 100644
--- a/src/sync-state-leaf-container.h
+++ b/src/sync-state-leaf-container.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_STATE_LEAF_CONTAINER
@@ -66,7 +66,7 @@
}
};
-/// @cond include_hidden
+/// @cond include_hidden
struct hashed { };
struct ordered { };
/// @endcond
@@ -85,7 +85,7 @@
NameInfoHash,
NameInfoEqual
>,
-
+
mi::ordered_unique<
mi::tag<ordered>,
mi::const_mem_fun<Leaf, NameInfoConstPtr, &Leaf::getInfo>,
diff --git a/src/sync-state.cc b/src/sync-state.cc
index 6c374a4..839825b 100644
--- a/src/sync-state.cc
+++ b/src/sync-state.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-state.h"
@@ -33,7 +33,7 @@
// using namespace std;
using namespace boost;
-typedef error_info<struct tag_errmsg, std::string> info_str;
+typedef error_info<struct tag_errmsg, std::string> info_str;
using namespace Sync::Error;
@@ -44,7 +44,7 @@
operator << (std::ostream &os, const State &state)
{
os << "<state>"; DEBUG_ENDL;
-
+
BOOST_FOREACH (shared_ptr<const Leaf> leaf, state.getLeaves ().get<ordered> ())
{
shared_ptr<const DiffLeaf> diffLeaf = dynamic_pointer_cast<const DiffLeaf> (leaf);
@@ -106,7 +106,7 @@
if (doc.RootElement() == 0)
BOOST_THROW_EXCEPTION (SyncXmlDecodingFailure () << info_str ("Empty XML"));
-
+
for (TiXmlElement *iterator = doc.RootElement()->FirstChildElement ("item");
iterator != 0;
iterator = iterator->NextSiblingElement("item"))
@@ -114,15 +114,15 @@
TiXmlElement *name = iterator->FirstChildElement ("name");
if (name == 0 || name->GetText() == 0)
BOOST_THROW_EXCEPTION (SyncXmlDecodingFailure () << info_str ("<name> element is missing"));
-
+
NameInfoConstPtr info = StdNameInfo::FindOrCreate (name->GetText());
-
+
if (iterator->Attribute("action") == 0 || strcmp(iterator->Attribute("action"), "update") == 0)
{
TiXmlElement *seq = iterator->FirstChildElement ("seq");
if (seq == 0)
BOOST_THROW_EXCEPTION (SyncXmlDecodingFailure () << info_str ("<seq> element is missing"));
-
+
TiXmlElement *session = seq->FirstChildElement ("session");
TiXmlElement *seqno = seq->FirstChildElement ("seqno");
diff --git a/src/sync-state.h b/src/sync-state.h
index 54ac9d9..a5a0f62 100644
--- a/src/sync-state.h
+++ b/src/sync-state.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_STATE_H
@@ -38,9 +38,9 @@
/**
* \ingroup sync
* @brief this prefix will be used for the dummy node which increases its sequence number whenever
- * a remove operation happens; this is to prevent the reversion of root digest when we prune
+ * a remove operation happens; this is to prevent the reversion of root digest when we prune
* a branch, i.e. help the root digest to be forward only
- * No corresponding data msg would be published and no attempt would be made to retrieve the
+ * No corresponding data msg would be published and no attempt would be made to retrieve the
* data msg
*/
const std::string forwarderPrefix = "/d0n0t18ak/t0ps8cr8t";
@@ -57,7 +57,7 @@
{
public:
virtual ~State () { };
-
+
/**
* @brief Add or update leaf to the state tree
*
@@ -78,9 +78,9 @@
* @brief Get state leaves
*/
const LeafContainer &
- getLeaves () const
+ getLeaves () const
{ return m_leaves; }
-
+
protected:
LeafContainer m_leaves;
};
diff --git a/src/sync-std-name-info.cc b/src/sync-std-name-info.cc
index 2c0313d..9685f2d 100644
--- a/src/sync-std-name-info.cc
+++ b/src/sync-std-name-info.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-std-name-info.h"
@@ -32,9 +32,9 @@
StdNameInfo::FindOrCreate (const std::string &key)
{
// std::cout << "FindOrCreate: " << m_names.size () << "\n";
-
+
NameInfoConstPtr ret;
-
+
NameMap::iterator item = m_names.find (key);
if (item != m_names.end ())
{
@@ -47,7 +47,7 @@
weak_ptr<const NameInfo> value (ret);
std::pair<NameMap::iterator,bool> inserted =
m_names.insert (make_pair (key, value));
-
+
BOOST_ASSERT (inserted.second); // previous call has to insert value
item = inserted.first;
}
diff --git a/src/sync-std-name-info.h b/src/sync-std-name-info.h
index 83bbebb..2385074 100644
--- a/src/sync-std-name-info.h
+++ b/src/sync-std-name-info.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_STD_NAME_INFO_H
@@ -42,7 +42,7 @@
* @brief Destructor which will clean up m_names structure
*/
virtual ~StdNameInfo ();
-
+
// from NameInfo
virtual bool
operator == (const NameInfo &info) const;
@@ -54,7 +54,7 @@
toString () const;
private:
- // implementing a singleton pattern.
+ // implementing a singleton pattern.
/**
* @brief Disabled default constructor. NameInfo object should be created through FindOrCreate static call.
*/
@@ -65,7 +65,7 @@
StdNameInfo () {}
StdNameInfo& operator = (const StdNameInfo &info) { (void)info; return *this; }
StdNameInfo (const std::string &name);
-
+
std::string m_name;
};
diff --git a/src/sync-validator.cc b/src/sync-validator.cc
index 69e9232..72e45df 100644
--- a/src/sync-validator.cc
+++ b/src/sync-validator.cc
@@ -10,7 +10,7 @@
#include "sync-validator.h"
#include "sync-logging.h"
-#include <ndn-cpp-dev/security/certificate-cache-ttl.hpp>
+#include <ndn-cxx/security/certificate-cache-ttl.hpp>
#include <queue>
using namespace ndn;
@@ -40,7 +40,7 @@
, m_dataRule(rule)
{
if(!static_cast<bool>(m_certificateCache))
- m_certificateCache = make_shared<CertificateCacheTtl>(m_face.ioService());
+ m_certificateCache = make_shared<CertificateCacheTtl>(boost::ref(m_face.getIoService()));
Name certPrefix = prefix;
certPrefix.append("CHRONOS-INTRO-CERT");
diff --git a/src/sync-validator.h b/src/sync-validator.h
index 65f14a3..20ef3c0 100644
--- a/src/sync-validator.h
+++ b/src/sync-validator.h
@@ -12,10 +12,10 @@
#define SYNC_VALIDATOR_H
#include "sync-intro-certificate.h"
-#include <ndn-cpp-dev/security/validator.hpp>
-#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <ndn-cpp-dev/security/sec-rule-relative.hpp>
-#include <ndn-cpp-dev/security/certificate-cache.hpp>
+#include <ndn-cxx/security/validator.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/security/sec-rule-relative.hpp>
+#include <ndn-cxx/security/certificate-cache.hpp>
#include <map>
namespace Sync {
diff --git a/tests/test-socket.cc b/tests/test-socket.cc
index 61519f8..a9bdf29 100644
--- a/tests/test-socket.cc
+++ b/tests/test-socket.cc
@@ -17,11 +17,11 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include <boost/test/unit_test.hpp>
-#include <boost/test/output_test_stream.hpp>
+#include <boost/test/output_test_stream.hpp>
using boost::test_tools::output_test_stream;
#include <boost/make_shared.hpp>
@@ -30,7 +30,7 @@
#include "sync-logging.h"
#include "sync-socket.h"
#include "sync-validator.h"
-#include <ndn-cpp-dev/security/validator-null.hpp>
+#include <ndn-cxx/security/validator-null.hpp>
extern "C" {
#include <unistd.h>
@@ -42,7 +42,7 @@
INIT_LOGGER ("Test.AppSocket");
-#define PRINT
+#define PRINT
// std::cout << "Line: " << __LINE__ << std::endl;
class TestSocketApp {
@@ -64,7 +64,7 @@
string str2(buf, len);
data.insert(make_pair(name, str2));
}
-
+
void setNum(const ndn::shared_ptr<const ndn::Data>& data) {
int n = data->getContent().value_size() / 4;
uint32_t *numbers = new uint32_t [n];
@@ -120,7 +120,7 @@
}
string toString(){
- map<ndn::Name, string>::iterator it = data.begin();
+ map<ndn::Name, string>::iterator it = data.begin();
string str = "\n";
for (; it != data.end(); ++it){
str += "<";
@@ -169,7 +169,7 @@
m_face1,
*m_id1,
m_rule,
- bind(&TestSocketApp::fetchAll, &m_a1, _1, _2),
+ bind(&TestSocketApp::fetchAll, &m_a1, _1, _2),
bind(&TestSocketApp::pass, &m_a1, _1)));
m_s1->addParticipant(*m_id2);
@@ -189,13 +189,13 @@
m_face2,
*m_id2,
m_rule,
- bind(&TestSocketApp::fetchAll, &m_a2, _1, _2),
+ bind(&TestSocketApp::fetchAll, &m_a2, _1, _2),
bind(&TestSocketApp::pass, &m_a2, _1)));
m_s2->addParticipant(*m_id1);
m_s2->addParticipant(*m_id3);
}
-
+
void
createSyncSocket3()
{
@@ -209,8 +209,8 @@
"/",
m_face3,
*m_id3,
- m_rule,
- bind(&TestSocketApp::fetchAll, &m_a3, _1, _2),
+ m_rule,
+ bind(&TestSocketApp::fetchAll, &m_a3, _1, _2),
bind(&TestSocketApp::pass, &m_a3, _1)));
m_s3->addParticipant(*m_id2);
@@ -220,21 +220,21 @@
publishSocket1(string data)
{
_LOG_DEBUG ("s1 publish");
- m_s1->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000);
+ m_s1->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000);
}
void
publishSocket2(string data)
{
_LOG_DEBUG ("s2 publish");
- m_s2->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000);
+ m_s2->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000);
}
void
publishSocket3(string data)
{
_LOG_DEBUG ("s3 publish");
- m_s3->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000);
+ m_s3->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000);
}
void
@@ -243,7 +243,7 @@
_LOG_DEBUG ("a1 set");
ndn::Name name("/irl.cs.ucla.edu");
name.append(suffix);
- m_a1.set (name, data.c_str(), data.size());
+ m_a1.set (name, data.c_str(), data.size());
}
void
@@ -252,7 +252,7 @@
_LOG_DEBUG ("a2 set");
ndn::Name name("/yakshi.org");
name.append(suffix);
- m_a2.set (name, data.c_str(), data.size());
+ m_a2.set (name, data.c_str(), data.size());
}
void
@@ -261,12 +261,12 @@
_LOG_DEBUG ("a3 set");
ndn::Name name("/google.com");
name.append(suffix);
- m_a3.set (name, data.c_str(), data.size());
+ m_a3.set (name, data.c_str(), data.size());
}
void
check(int round)
- {
+ {
BOOST_CHECK_EQUAL(m_a1.toString(), m_a2.toString());
BOOST_CHECK_EQUAL(m_a2.toString(), m_a3.toString());
}
@@ -315,17 +315,17 @@
createSyncSocket1()
{
_LOG_DEBUG ("s1");
-
+
m_s1 = ndn::shared_ptr<SyncSocket>
(new SyncSocket("/this/is/the/prefix",
"/xiaonei.com",
0,
false,
- "/",
+ "/",
m_face1,
*m_id1,
m_rule,
- bind(&TestSocketApp::fetchNumbers, &m_a1, _1, _2),
+ bind(&TestSocketApp::fetchNumbers, &m_a1, _1, _2),
bind(&TestSocketApp::pass, &m_a1, _1)));
m_s1->addParticipant(*m_id2);
@@ -345,43 +345,43 @@
m_face2,
*m_id2,
m_rule,
- bind(&TestSocketApp::fetchNumbers, &m_a2, _1, _2),
+ bind(&TestSocketApp::fetchNumbers, &m_a2, _1, _2),
bind(&TestSocketApp::pass, &m_a2, _1)));
m_s2->addParticipant(*m_id1);
}
-
+
void
publishSocket1(string data)
{
_LOG_DEBUG ("s1 publish");
- m_s1->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000);
+ m_s1->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000);
}
void
publishSocket2(string data)
{
_LOG_DEBUG ("s2 publish");
- m_s2->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000);
+ m_s2->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000);
}
void
setSocket1(const char* ptr, size_t size)
{
_LOG_DEBUG ("a1 setNum");
- m_a1.setNum ("/xiaonei.com", ptr, size);
+ m_a1.setNum ("/xiaonei.com", ptr, size);
}
void
setSocket2(const char* ptr, size_t size)
{
_LOG_DEBUG ("a2 setNum");
- m_a2.setNum ("/mitbbs.com", ptr, size);
+ m_a2.setNum ("/mitbbs.com", ptr, size);
}
void
check(int num)
- {
+ {
_LOG_DEBUG ("codnum " << num);
_LOG_DEBUG ("a1 sum " << m_a1.sum);
_LOG_DEBUG ("a2 sum " << m_a2.sum);
@@ -433,17 +433,17 @@
createSyncSocket1()
{
_LOG_DEBUG ("s1");
-
+
m_s1 = ndn::shared_ptr<SyncSocket>
(new SyncSocket("/this/is/the/prefix",
"/xiaonei.com",
1,
true,
- "/abc",
+ "/abc",
m_face1,
*m_id1,
m_rule,
- bind(&TestSocketApp::fetchNumbers, &m_a1, _1, _2),
+ bind(&TestSocketApp::fetchNumbers, &m_a1, _1, _2),
bind(&TestSocketApp::pass, &m_a1, _1)));
m_s1->addParticipant(*m_id2);
@@ -463,43 +463,43 @@
m_face2,
*m_id2,
m_rule,
- bind(&TestSocketApp::fetchNumbers, &m_a2, _1, _2),
+ bind(&TestSocketApp::fetchNumbers, &m_a2, _1, _2),
bind(&TestSocketApp::pass, &m_a2, _1)));
m_s2->addParticipant(*m_id1);
}
-
+
void
publishSocket1(string data)
{
_LOG_DEBUG ("s1 publish");
- m_s1->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000);
+ m_s1->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000);
}
void
publishSocket2(string data)
{
_LOG_DEBUG ("s2 publish");
- m_s2->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000);
+ m_s2->publishData (reinterpret_cast<const uint8_t*>(data.c_str()), data.size(), 1000);
}
void
setSocket1(const char* ptr, size_t size)
{
_LOG_DEBUG ("a1 setNum");
- m_a1.setNum ("/xiaonei.com", ptr, size);
+ m_a1.setNum ("/xiaonei.com", ptr, size);
}
void
setSocket2(const char* ptr, size_t size)
{
_LOG_DEBUG ("a2 setNum");
- m_a2.setNum ("/mitbbs.com", ptr, size);
+ m_a2.setNum ("/mitbbs.com", ptr, size);
}
void
check(int num)
- {
+ {
_LOG_DEBUG ("codnum " << num);
_LOG_DEBUG ("a1 sum " << m_a1.sum);
_LOG_DEBUG ("a2 sum " << m_a2.sum);
@@ -543,7 +543,7 @@
string data0 = "Very funny Scotty, now beam down my clothes";
scheduler.scheduleEvent(ndn::time::milliseconds(150), ndn::bind(&TestSet1::publishSocket1, &testSet1, data0));
scheduler.scheduleEvent(ndn::time::milliseconds(1150), ndn::bind(&TestSet1::setSocket1, &testSet1, "/0/1", data0));
- scheduler.scheduleEvent(ndn::time::milliseconds(1160), ndn::bind(&TestSet1::check, &testSet1, 1));
+ scheduler.scheduleEvent(ndn::time::milliseconds(1160), ndn::bind(&TestSet1::check, &testSet1, 1));
string data1 = "Yes, give me that ketchup";
string data2 = "Don't look conspicuous, it draws fire";
scheduler.scheduleEvent(ndn::time::milliseconds(1170), ndn::bind(&TestSet1::publishSocket1, &testSet1, data1));
diff --git a/tests/test-sync-logic.cc b/tests/test-sync-logic.cc
index d430a46..84a28cb 100644
--- a/tests/test-sync-logic.cc
+++ b/tests/test-sync-logic.cc
@@ -17,17 +17,17 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include <boost/test/unit_test.hpp>
-#include <boost/test/output_test_stream.hpp>
+#include <boost/test/output_test_stream.hpp>
#include <map>
using boost::test_tools::output_test_stream;
#include <boost/make_shared.hpp>
-#include <ndn-cpp-dev/security/validator-null.hpp>
+#include <ndn-cxx/security/validator-null.hpp>
#include "sync-logic.h"
#include "sync-seq-no.h"
@@ -38,7 +38,7 @@
struct Handler
{
string instance;
-
+
Handler (const string &_instance)
: instance (_instance)
{
@@ -54,7 +54,7 @@
void onUpdate (const string &p/*prefix*/, const SeqNo &seq/*newSeq*/, const SeqNo &oldSeq/*oldSeq*/)
{
m_map[p] = seq.getSeq ();
-
+
// cout << instance << "\t";
// if (!oldSeq.isValid ())
// cout << "Inserted: " << p << " (" << seq << ")" << endl;
@@ -79,10 +79,10 @@
{
m_l[0] = 0;
m_l[1] = 0;
-
+
m_validator = ndn::make_shared<ndn::ValidatorNull>();
}
-
+
~TestCore()
{
if(m_l[0] != 0)
@@ -97,19 +97,19 @@
{
ioService->stop();
}
-
+
void
- createSyncLogic(int index,
+ createSyncLogic(int index,
ndn::shared_ptr<Handler> h)
- {
+ {
ndn::Name identity("/tmp-" + boost::lexical_cast<std::string>(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count()));
ndn::shared_ptr<ndn::IdentityCertificate> cert = m_keyChain.getCertificate(m_keyChain.createIdentity(identity));
m_faces[index] = ndn::make_shared<ndn::Face>(m_ioService);
- m_l[index] = new SyncLogic(ndn::Name("/bcast"),
+ m_l[index] = new SyncLogic(ndn::Name("/bcast"),
*cert,
- m_validator, m_faces[index],
- bind (&Handler::wrapper, &*h, _1),
- bind (&Handler::onRemove, &*h, _1));
+ m_validator, m_faces[index],
+ bind (&Handler::wrapper, &*h, _1),
+ bind (&Handler::onRemove, &*h, _1));
}
void
@@ -117,7 +117,7 @@
{
m_oldDigest = m_l[0]->getRootDigest();
}
-
+
void
getNewDigestForOne()
{
@@ -135,7 +135,7 @@
{
m_l[0]->remove(name);
}
-
+
void
checkDigest()
{
@@ -178,7 +178,7 @@
scheduler.scheduleEvent(ndn::time::milliseconds(800), ndn::bind(&TestCore::getNewDigestForOne, &testCore));
scheduler.scheduleEvent(ndn::time::milliseconds(900), ndn::bind(&TestCore::checkDigest, &testCore));
scheduler.scheduleEvent(ndn::time::milliseconds(1000), ndn::bind(&TestCore::finish, &testCore, ioService));
-
+
ioService->run();
}
diff --git a/wscript b/wscript
index ad6a1f9..dff5965 100644
--- a/wscript
+++ b/wscript
@@ -31,8 +31,8 @@
else:
conf.add_supported_cxxflags (cxxflags = ['-O3', '-g'])
- conf.check_cfg(package='libndn-cpp-dev', args=['--cflags', '--libs'], uselib_store='NDNCPP', mandatory=True)
-
+ conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], uselib_store='NDNCXX', mandatory=True)
+
conf.check_cfg(package='openssl', args=['--cflags', '--libs'], uselib_store='OPENSSL', mandatory=True)
conf.check_boost(lib='system iostreams thread unit_test_framework')
@@ -56,10 +56,10 @@
# vnum = "1.0.0",
features=['cxx', 'cxxshlib'],
source = bld.path.ant_glob (['src/**/*.cc', 'src/**/*.proto']),
- use = 'BOOST NDNCPP OPENSSL',
+ use = 'BOOST NDNCXX OPENSSL',
includes = ['src'],
)
-
+
# Unit tests
if bld.get_define("_TEST"):
unittests = bld.program (
@@ -77,15 +77,15 @@
unittests.use += ' LOG4CXX'
bld.install_files (
- dest = "%s/ChronoSync" % bld.env['INCLUDEDIR'],
- files = bld.path.ant_glob(['src/**/*.h']),
+ dest = "%s/ChronoSync" % bld.env['INCLUDEDIR'],
+ files = bld.path.ant_glob(['src/**/*.h']),
cwd = bld.path.find_dir ("src"),
relative_trick = True,
)
bld.install_files (
- dest = "%s/ChronoSync" % bld.env['INCLUDEDIR'],
- files = bld.path.get_bld().ant_glob(['src/**/*.h']),
+ dest = "%s/ChronoSync" % bld.env['INCLUDEDIR'],
+ files = bld.path.get_bld().ant_glob(['src/**/*.h']),
cwd = bld.path.get_bld().find_dir ("src"),
relative_trick = True,
)