remove sync-data-buffer, use string instead; change ccnx-wrapper
accordingly
diff --git a/model/sync-ccnx-wrapper.cc b/model/sync-ccnx-wrapper.cc
index a7936a3..88c65d9 100644
--- a/model/sync-ccnx-wrapper.cc
+++ b/model/sync-ccnx-wrapper.cc
@@ -108,7 +108,7 @@
}
}
-int CcnxWrapper::publishData(string name, shared_ptr< DataBuffer > dataBuffer, int freshness)
+int CcnxWrapper::publishData(string name, string dataBuffer, int freshness)
{
ccn_charbuf *pname = ccn_charbuf_create();
ccn_charbuf *signed_info = ccn_charbuf_create();
@@ -124,7 +124,7 @@
NULL,
m_keyLoactor);
ccn_encode_ContentObject(content, pname, signed_info,
- dataBuffer->buffer(), dataBuffer->length(),
+ dataBuffer.c_str(), dataBuffer.length(),
NULL, getPrivateKey());
ccn_put(m_handle, content->buf, content->length);
@@ -154,10 +154,16 @@
return CCN_UPCALL_RESULT_OK;
}
- char *comp;
- size_t size;
- ccn_name_comp_get(info->content_ccnb, info->content_comps, info->content_comps->n - 3, (const unsigned char **)&comp, &size);
- f((string)comp);
+ string interest;
+ for (int i = 0; i < info->content_comps->n - 1; i++)
+ {
+ char *comp;
+ size_t size;
+ ccn_name_comp_get(info->content_ccnb, info->content_comps, i, (const unsigned char **)&comp, &size);
+ interest += comp;
+ }
+ f(interest);
+ return CCN_UPCALL_RESULT_OK;
}
static ccn_upcall_res incomingData(
@@ -165,7 +171,7 @@
ccn_upcall_kind kind,
ccn_upcall_info *info)
{
- function<void (shared_ptr<DataBuffer>)> f = *(function<void (shared_ptr<DataBuffer>)> *)selfp->data;
+ function<void (string)> f = *(function<void (string)> *)selfp->data;
switch (kind)
{
@@ -183,15 +189,14 @@
char *pcontent;
size_t len;
ccn_content_get_value(info->content_ccnb, info->pco->offset[CCN_PCO_E], info->pco, (const unsigned char **)&pcontent, &len);
- shared_ptr<DataBuffer> data(new DataBufferImpl((const unsigned char*)pcontent, len));
- f(data);
+ f((string)pcontent);
}
-int CcnxWrapper::sendInterest(string strInterest, function< void (shared_ptr< DataBuffer >) > dataCallback)
+int CcnxWrapper::sendInterest(string strInterest, function<void (string)> dataCallback)
{
ccn_charbuf *pname = ccn_charbuf_create();
ccn_closure *dataClosure = new ccn_closure;
- function<void (shared_ptr< DataBuffer >)> *f = new function<void (shared_ptr< DataBuffer >)>(dataCallback);
+ function<void (string)> *f = new function<void (string)>(dataCallback);
ccn_name_from_uri(pname, strInterest.c_str());
ccn_express_interest(m_handle, pname, dataClosure, NULL);
@@ -201,7 +206,7 @@
ccn_charbuf_destroy(&pname);
}
-int CcnxWrapper::setInterestFilter(string prefix, function< void (string) > interestCallback)
+int CcnxWrapper::setInterestFilter(string prefix, function<void (string)> interestCallback)
{
ccn_charbuf *pname = ccn_charbuf_create();
ccn_closure *interestClosure = new ccn_closure;