pco and wrapper refine
diff --git a/include/ccnx-pco.h b/include/ccnx-pco.h
index 4d22765..5b48ccf 100644
--- a/include/ccnx-pco.h
+++ b/include/ccnx-pco.h
@@ -20,10 +20,10 @@
virtual ~ParsedContentObject();
Bytes
- content();
+ content() const;
string
- name();
+ name() const;
protected:
ccn_parsed_ContentObject m_pco;
diff --git a/include/ccnx-wrapper.h b/include/ccnx-wrapper.h
index c5f8b8d..b4a8536 100644
--- a/include/ccnx-wrapper.h
+++ b/include/ccnx-wrapper.h
@@ -32,14 +32,14 @@
class CcnxWrapper {
public:
- typedef boost::function<void (string, Bytes)> DataCallback;
- typedef boost::function<void (string)> InterestCallback;
+ typedef boost::function<void (const string &, const Bytes &)> DataCallback;
+ typedef boost::function<void (const string &)> InterestCallback;
typedef enum
{
RESULT_OK,
RESULT_REEXPRESS
} TimeoutCallbackReturnValue;
- typedef boost::function<TimeoutCallbackReturnValue (string)> TimeoutCallback;
+ typedef boost::function<TimeoutCallbackReturnValue (const string &)> TimeoutCallback;
public:
@@ -65,14 +65,14 @@
getLocalPrefix ();
static string
- extractName(const unsigned char *data, ccn_indexbuf *comps);
+ extractName(const unsigned char *data, const ccn_indexbuf *comps);
protected:
Bytes
createContentObject(const string &name, const char *buf, size_t len, int freshness);
int
- putToCcnd (Bytes &contentObject);
+ putToCcnd (const Bytes &contentObject);
protected:
void
@@ -123,8 +123,8 @@
int getRetry() {return m_retry;}
void decRetry() { m_retry--;}
virtual ~ClosurePass();
- virtual void runDataCallback(string name, const Bytes &content);
- virtual CcnxWrapper::TimeoutCallbackReturnValue runTimeoutCallback(string interest);
+ virtual void runDataCallback(const string &name, const Bytes &content);
+ virtual CcnxWrapper::TimeoutCallbackReturnValue runTimeoutCallback(const string &interest);
protected:
int m_retry;
diff --git a/src/ccnx-pco.cpp b/src/ccnx-pco.cpp
index f592f53..e2db766 100644
--- a/src/ccnx-pco.cpp
+++ b/src/ccnx-pco.cpp
@@ -31,7 +31,7 @@
}
Bytes
-ParsedContentObject::content()
+ParsedContentObject::content() const
{
const unsigned char *content;
size_t len;
@@ -47,7 +47,7 @@
}
string
-ParsedContentObject::name()
+ParsedContentObject::name() const
{
return CcnxWrapper::extractName((const unsigned char *)m_bytes[0], m_comps);
}
diff --git a/src/ccnx-wrapper.cpp b/src/ccnx-wrapper.cpp
index 58a2b7c..7549e3a 100644
--- a/src/ccnx-wrapper.cpp
+++ b/src/ccnx-wrapper.cpp
@@ -240,7 +240,7 @@
}
int
-CcnxWrapper::putToCcnd (Bytes &contentObject)
+CcnxWrapper::putToCcnd (const Bytes &contentObject)
{
recursive_mutex::scoped_lock lock(m_mutex);
if (!m_running || !m_connected)
@@ -269,7 +269,7 @@
}
string
-CcnxWrapper::extractName(const unsigned char *data, ccn_indexbuf *comps)
+CcnxWrapper::extractName(const unsigned char *data, const ccn_indexbuf *comps)
{
ostringstream name (ostringstream::out);
for (int i = 0; i < comps->n - 1; i++)
@@ -538,7 +538,7 @@
}
CcnxWrapper::TimeoutCallbackReturnValue
-ClosurePass::runTimeoutCallback(std::string interest)
+ClosurePass::runTimeoutCallback(const string &interest)
{
if ((*m_timeoutCallback).empty())
{
@@ -550,7 +550,7 @@
void
-ClosurePass::runDataCallback(std::string name, const Bytes &content)
+ClosurePass::runDataCallback(const string &name, const Bytes &content)
{
if (m_dataCallback != NULL) {
(*m_dataCallback)(name, content);
diff --git a/wscript b/wscript
index 47fdd67..c51a765 100644
--- a/wscript
+++ b/wscript
@@ -2,6 +2,7 @@
VERSION='0.0.1'
APPNAME='chronoshare'
+CCNXLIB='ccnx'
from waflib import Build, Logs
@@ -58,11 +59,12 @@
bld.add_group ("code")
libccnx = bld (
- target=APPNAME,
+ target=CCNXLIB,
features=['cxx', 'cxxshlib'],
source = [
'src/ccnx-wrapper.cpp',
- 'src/ccnx-tunnel.cpp',
+ 'src/ccnx-pco.cpp',
+ #'src/ccnx-tunnel.cpp',
],
use = 'BOOST BOOST_THREAD SSL CCNX',
includes = ['include', ],