Merge branch 'master' into dev
diff --git a/include/ccnx-closure.h b/include/ccnx-closure.h
index 54306d6..01358c4 100644
--- a/include/ccnx-closure.h
+++ b/include/ccnx-closure.h
@@ -7,7 +7,7 @@
namespace Ccnx {
-class Closure
+class Closure
{
public:
typedef boost::function<void (const string &, const Bytes &)> DataCallback;
@@ -25,15 +25,15 @@
int getRetry() {return m_retry;}
void decRetry() { m_retry--;}
virtual ~Closure();
- virtual void
+ virtual void
runDataCallback(const string &name, const Bytes &content);
- virtual TimeoutCallbackReturnValue
+ virtual TimeoutCallbackReturnValue
runTimeoutCallback(const string &interest);
protected:
int m_retry;
TimeoutCallback *m_timeoutCallback;
- DataCallback *m_dataCallback;
+ DataCallback *m_dataCallback;
};
} // Ccnx
diff --git a/include/ccnx-pco.h b/include/ccnx-pco.h
index 1357333..829e0cc 100644
--- a/include/ccnx-pco.h
+++ b/include/ccnx-pco.h
@@ -10,7 +10,7 @@
struct MisformedContentObjectException : virtual boost::exception, virtual exception { };
-class ParsedContentObject
+class ParsedContentObject
{
public:
ParsedContentObject(const unsigned char *data, size_t len);
diff --git a/include/ccnx-tunnel.h b/include/ccnx-tunnel.h
index af49a9b..dff2f50 100644
--- a/include/ccnx-tunnel.h
+++ b/include/ccnx-tunnel.h
@@ -6,7 +6,7 @@
#include "ccnx-common.h"
#include "ccnx-wrapper.h"
-#define _OVERRIDE
+#define _OVERRIDE
#ifdef __GNUC__
#if __GNUC_MAJOR >= 4 && __GNUC_MINOR__ >= 7
#undef _OVERRIDE
@@ -16,19 +16,19 @@
using namespace std;
-// Eventually, Sync::CcnxWrapper should be moved to this namespace.
+// Eventually, Sync::CcnxWrapper should be moved to this namespace.
// It has nothing to do with Sync.
namespace Ccnx
{
-class CcnxTunnel : public CcnxWrapper
+class CcnxTunnel : public CcnxWrapper
{
-public:
+public:
typedef multimap<string, InterestCallback> RegisteredInterestTable;
typedef multimap<string, InterestCallback>::iterator RitIter;
- CcnxTunnel();
+ CcnxTunnel();
virtual ~CcnxTunnel();
// name is topology-independent
@@ -70,7 +70,7 @@
void
handleTunneledInterest(const string &tunneldInterest);
-
+
void
handleTunneledData(const string &name, const Bytes &tunneledData, const Closure::DataCallback &originalDataCallback);
@@ -88,7 +88,7 @@
TunnelClosure(const Closure *closure, CcnxTunnel *tunnel, const string &originalInterest);
- virtual void
+ virtual void
runDataCallback(const string &name, const Bytes &content) _OVERRIDE;
virtual TimeoutCallbackReturnValue
diff --git a/include/ccnx-wrapper.h b/include/ccnx-wrapper.h
index e5754da..9b50ae8 100644
--- a/include/ccnx-wrapper.h
+++ b/include/ccnx-wrapper.h
@@ -24,7 +24,7 @@
struct CcnxOperationException : virtual boost::exception, virtual exception { };
-class CcnxWrapper
+class CcnxWrapper
{
public:
typedef boost::shared_mutex Lock;
@@ -45,10 +45,10 @@
virtual void
clearInterestFilter (const string &prefix);
- virtual int
+ virtual int
sendInterest (const Interest &interest, Closure *closure);
- virtual int
+ virtual int
publishData (const string &name, const unsigned char *buf, size_t len, int freshness);
int
@@ -64,14 +64,14 @@
Bytes
createContentObject(const string &name, const unsigned char *buf, size_t len, int freshness);
- int
+ int
putToCcnd (const Bytes &contentObject);
-
+
protected:
void
connectCcnd();
- /// @cond include_hidden
+ /// @cond include_hidden
void
createKeyLocator ();
@@ -110,4 +110,4 @@
} // Ccnx
-#endif
+#endif
diff --git a/src/ccnx-closure.cpp b/src/ccnx-closure.cpp
index 43b0d65..5b24f66 100644
--- a/src/ccnx-closure.cpp
+++ b/src/ccnx-closure.cpp
@@ -6,7 +6,7 @@
: m_retry(retry), m_timeoutCallback(NULL)
{
m_timeoutCallback = new TimeoutCallback (timeoutCallback);
- m_dataCallback = new DataCallback (dataCallback);
+ m_dataCallback = new DataCallback (dataCallback);
}
Closure::Closure(const Closure &other)
@@ -14,7 +14,7 @@
Closure(other.m_retry, *(other.m_dataCallback), *(other.m_timeoutCallback));
}
-Closure::~Closure ()
+Closure::~Closure ()
{
delete m_dataCallback;
delete m_timeoutCallback;
@@ -22,20 +22,20 @@
m_timeoutCallback = NULL;
}
-Closure::TimeoutCallbackReturnValue
+Closure::TimeoutCallbackReturnValue
Closure::runTimeoutCallback(const string &interest)
{
if ((*m_timeoutCallback).empty())
{
return RESULT_OK;
}
-
+
return (*m_timeoutCallback)(interest);
}
-void
-Closure::runDataCallback(const string &name, const Bytes &content)
+void
+Closure::runDataCallback(const string &name, const Bytes &content)
{
if (m_dataCallback != NULL) {
(*m_dataCallback)(name, content);
diff --git a/src/ccnx-pco.cpp b/src/ccnx-pco.cpp
index df3bd06..1c24891 100644
--- a/src/ccnx-pco.cpp
+++ b/src/ccnx-pco.cpp
@@ -21,7 +21,7 @@
ParsedContentObject::ParsedContentObject(const ParsedContentObject &other)
{
- ParsedContentObject(other.m_bytes);
+ ParsedContentObject(other.m_bytes);
}
ParsedContentObject::~ParsedContentObject()
diff --git a/src/ccnx-tunnel.cpp b/src/ccnx-tunnel.cpp
index 281079f..06adae0 100644
--- a/src/ccnx-tunnel.cpp
+++ b/src/ccnx-tunnel.cpp
@@ -11,12 +11,12 @@
refreshLocalPrefix();
}
-CcnxTunnel::~CcnxTunnel()
+CcnxTunnel::~CcnxTunnel()
{
}
void
-CcnxTunnel::refreshLocalPrefix()
+CcnxTunnel::refreshLocalPrefix()
{
string newPrefix = getLocalPrefix();
if (!newPrefix.empty() && m_localPrefix != newPrefix)
@@ -36,7 +36,7 @@
sendInterest(tunneledInterest, cp);
}
-void
+void
CcnxTunnel::handleTunneledData(const string &name, const Bytes &tunneledData, const Closure::DataCallback &originalDataCallback)
{
ParsedContentObject pco(tunneledData);
@@ -48,7 +48,7 @@
{
Bytes content = createContentObject(name, buf, len, freshness);
storeContentObject(name, content);
-
+
return publishContentObject(name, content, freshness);
}
@@ -64,12 +64,12 @@
CcnxTunnel::handleTunneledInterest(const string &tunneledInterest)
{
// The interest must have m_localPrefix as a prefix (component-wise), otherwise ccnd would not deliver it to us
- string interest = (m_localPrefix == "/")
+ string interest = (m_localPrefix == "/")
? tunneledInterest
: tunneledInterest.substr(m_localPrefix.size());
- ReadLock(m_ritLock);
-
+ ReadLock(m_ritLock);
+
// This is linear scan, but should be acceptable under the assumption that the caller wouldn't be listening to a lot prefixes (as of now, most app listen to one or two prefixes)
for (RitIter it = m_rit.begin(); it != m_rit.end(); it++)
{
@@ -84,7 +84,7 @@
bool
CcnxTunnel::isPrefix(const string &prefix, const string &name)
{
- // prefix is literally prefix of name
+ // prefix is literally prefix of name
if (name.find(prefix) == 0)
{
// name and prefix are exactly the same, or the next character in name
@@ -97,7 +97,7 @@
return false;
}
-int
+int
CcnxTunnel::setInterestFilter(const string &prefix, const InterestCallback &interestCallback)
{
WriteLock(m_ritLock);
@@ -106,7 +106,7 @@
return 0;
}
-void
+void
CcnxTunnel::clearInterestFilter(const string &prefix)
{
WriteLock(m_ritLock);
@@ -127,7 +127,7 @@
{
}
-void
+void
TunnelClosure::runDataCallback(const string &name, const Bytes &content)
{
if (m_tunnel != NULL)
diff --git a/src/ccnx-wrapper.cpp b/src/ccnx-wrapper.cpp
index 041665e..d84dc0d 100644
--- a/src/ccnx-wrapper.cpp
+++ b/src/ccnx-wrapper.cpp
@@ -22,7 +22,7 @@
if (len > 0)
{
bytes.resize(len);
- memcpy(&bytes[0], src, len);
+ memcpy(&bytes[0], src, len);
}
}
@@ -64,7 +64,7 @@
ccn_disconnect (m_handle);
ccn_destroy (&m_handle);
}
-
+
m_handle = ccn_create ();
if (ccn_connect(m_handle, NULL) < 0)
{
@@ -88,7 +88,7 @@
UniqueRecLock(m_mutex);
m_running = false;
}
-
+
m_thread.join ();
ccn_disconnect (m_handle);
ccn_destroy (&m_handle);
@@ -154,7 +154,7 @@
}
if (!m_running) break;
-
+
if (res < 0)
BOOST_THROW_EXCEPTION (CcnxOperationException()
<< errmsg_info_str("ccn_run returned error"));
@@ -163,13 +163,13 @@
pollfd pfds[1];
{
UniqueRecLock(m_mutex);
-
+
pfds[0].fd = ccn_get_connection_fd (m_handle);
pfds[0].events = POLLIN;
if (ccn_output_is_pending (m_handle))
pfds[0].events |= POLLOUT;
}
-
+
int ret = poll (pfds, 1, 1);
if (ret < 0)
{
@@ -216,9 +216,9 @@
}
catch (...)
{
- cout << "UNKNOWN EXCEPTION !!!" << endl;
+ cout << "UNKNOWN EXCEPTION !!!" << endl;
}
- }
+ }
}
Bytes
@@ -260,7 +260,7 @@
UniqueRecLock(m_mutex);
if (!m_running || !m_connected)
return -1;
-
+
if (ccn_put(m_handle, head(contentObject), contentObject.size()) < 0)
{
@@ -273,7 +273,7 @@
int
CcnxWrapper::publishData (const string &name, const unsigned char *buf, size_t len, int freshness)
{
- Bytes co = createContentObject(name, buf, len, freshness);
+ Bytes co = createContentObject(name, buf, len, freshness);
return putToCcnd(co);
}
@@ -391,7 +391,7 @@
UniqueRecLock(m_mutex);
if (!m_running || !m_connected)
return -1;
-
+
ccn_charbuf *pname = ccn_charbuf_create();
ccn_closure *dataClosure = new ccn_closure;
@@ -456,9 +456,9 @@
{
return "";
}
-
+
string retval = "";
-
+
struct ccn_charbuf *templ = ccn_charbuf_create();
ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
@@ -477,9 +477,9 @@
else
{
struct ccn_fetch *fetch = ccn_fetch_new (tmp_handle);
-
+
struct ccn_fetch_stream *stream = ccn_fetch_open (fetch, name, "/local/ndn/prefix",
- NULL, 4, CCN_V_HIGHEST, 0);
+ NULL, 4, CCN_V_HIGHEST, 0);
if (stream == NULL) {
}
else
@@ -490,11 +490,11 @@
char buf[256];
while (true) {
res = ccn_fetch_read (stream, buf, sizeof(buf));
-
+
if (res == 0) {
break;
}
-
+
if (res > 0) {
os << string(buf, res);
} else if (res == CCN_FETCH_READ_NONE) {
@@ -525,7 +525,7 @@
ccn_disconnect (tmp_handle);
ccn_destroy (&tmp_handle);
-
+
return retval;
}