Major update to rename ContentObject to Data everywhere.
diff --git a/Makefile.am b/Makefile.am
index b9b213f..53004e9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,18 +11,18 @@
lib_LIBRARIES = libndn-c.a libndn-cpp.a
-bin_PROGRAMS = bin/test-encode-decode-Interest bin/test-encode-decode-ContentObject bin/test-get-async
+bin_PROGRAMS = bin/test-encode-decode-Interest bin/test-encode-decode-data bin/test-get-async
libndn_c_a_SOURCES = \
config.h \
- ndn-cpp/c/ContentObject.h \
+ ndn-cpp/c/data.h \
ndn-cpp/c/Interest.h \
ndn-cpp/c/Key.h \
ndn-cpp/c/Name.h \
ndn-cpp/c/PublisherPublicKeyDigest.h \
ndn-cpp/c/errors.c ndn-cpp/c/errors.h \
ndn-cpp/c/encoding/BinaryXML.h \
- ndn-cpp/c/encoding/BinaryXMLContentObject.c ndn-cpp/c/encoding/BinaryXMLContentObject.h \
+ ndn-cpp/c/encoding/binary-xml-data.c ndn-cpp/c/encoding/binary-xml-data.h \
ndn-cpp/c/encoding/BinaryXMLDecoder.c ndn-cpp/c/encoding/BinaryXMLDecoder.h \
ndn-cpp/c/encoding/BinaryXMLElementReader.c ndn-cpp/c/encoding/BinaryXMLElementReader.h \
ndn-cpp/c/encoding/BinaryXMLEncoder.c ndn-cpp/c/encoding/BinaryXMLEncoder.h \
@@ -41,7 +41,7 @@
libndn_cpp_a_SOURCES = \
config.h ndn-cpp/common.hpp \
ndn-cpp/Closure.hpp \
- ndn-cpp/ContentObject.cpp ndn-cpp/c/ContentObject.h ndn-cpp/ContentObject.hpp \
+ ndn-cpp/data.cpp ndn-cpp/c/data.h ndn-cpp/data.hpp \
ndn-cpp/Interest.cpp ndn-cpp/c/Interest.h ndn-cpp/Interest.hpp \
ndn-cpp/Key.cpp ndn-cpp/c/Key.h ndn-cpp/Key.hpp \
ndn-cpp/NDN.cpp ndn-cpp/NDN.hpp \
@@ -61,8 +61,8 @@
bin_test_encode_decode_Interest_SOURCES = tests/test-encode-decode-Interest.cpp
bin_test_encode_decode_Interest_LDADD = libndn-c.a libndn-cpp.a
-bin_test_encode_decode_ContentObject_SOURCES = tests/test-encode-decode-ContentObject.cpp
-bin_test_encode_decode_ContentObject_LDADD = libndn-c.a libndn-cpp.a
+bin_test_encode_decode_data_SOURCES = tests/test-encode-decode-data.cpp
+bin_test_encode_decode_data_LDADD = libndn-c.a libndn-cpp.a
bin_test_get_async_SOURCES = tests/test-get-async.cpp
bin_test_get_async_LDADD = libndn-c.a libndn-cpp.a
diff --git a/Makefile.in b/Makefile.in
index 634aa7c..457f6d4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -86,7 +86,7 @@
$(dist_noinst_SCRIPTS) depcomp COPYING ar-lib compile \
config.guess config.sub install-sh missing ltmain.sh
bin_PROGRAMS = bin/test-encode-decode-Interest$(EXEEXT) \
- bin/test-encode-decode-ContentObject$(EXEEXT) \
+ bin/test-encode-decode-data$(EXEEXT) \
bin/test-get-async$(EXEEXT)
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -137,7 +137,7 @@
libndn_c_a_LIBADD =
am__dirstamp = $(am__leading_dot)dirstamp
am_libndn_c_a_OBJECTS = ndn-cpp/c/errors.$(OBJEXT) \
- ndn-cpp/c/encoding/BinaryXMLContentObject.$(OBJEXT) \
+ ndn-cpp/c/encoding/binary-xml-data.$(OBJEXT) \
ndn-cpp/c/encoding/BinaryXMLDecoder.$(OBJEXT) \
ndn-cpp/c/encoding/BinaryXMLElementReader.$(OBJEXT) \
ndn-cpp/c/encoding/BinaryXMLEncoder.$(OBJEXT) \
@@ -153,7 +153,7 @@
libndn_c_a_OBJECTS = $(am_libndn_c_a_OBJECTS)
libndn_cpp_a_AR = $(AR) $(ARFLAGS)
libndn_cpp_a_LIBADD =
-am_libndn_cpp_a_OBJECTS = ndn-cpp/ContentObject.$(OBJEXT) \
+am_libndn_cpp_a_OBJECTS = ndn-cpp/data.$(OBJEXT) \
ndn-cpp/Interest.$(OBJEXT) ndn-cpp/Key.$(OBJEXT) \
ndn-cpp/NDN.$(OBJEXT) ndn-cpp/Name.$(OBJEXT) \
ndn-cpp/encoding/BinaryXMLElementReader.$(OBJEXT) \
@@ -164,17 +164,16 @@
ndn-cpp/transport/UdpTransport.$(OBJEXT)
libndn_cpp_a_OBJECTS = $(am_libndn_cpp_a_OBJECTS)
PROGRAMS = $(bin_PROGRAMS)
-am_bin_test_encode_decode_ContentObject_OBJECTS = \
- tests/test-encode-decode-ContentObject.$(OBJEXT)
-bin_test_encode_decode_ContentObject_OBJECTS = \
- $(am_bin_test_encode_decode_ContentObject_OBJECTS)
-bin_test_encode_decode_ContentObject_DEPENDENCIES = libndn-c.a \
- libndn-cpp.a
am_bin_test_encode_decode_Interest_OBJECTS = \
tests/test-encode-decode-Interest.$(OBJEXT)
bin_test_encode_decode_Interest_OBJECTS = \
$(am_bin_test_encode_decode_Interest_OBJECTS)
bin_test_encode_decode_Interest_DEPENDENCIES = libndn-c.a libndn-cpp.a
+am_bin_test_encode_decode_data_OBJECTS = \
+ tests/test-encode-decode-data.$(OBJEXT)
+bin_test_encode_decode_data_OBJECTS = \
+ $(am_bin_test_encode_decode_data_OBJECTS)
+bin_test_encode_decode_data_DEPENDENCIES = libndn-c.a libndn-cpp.a
am_bin_test_get_async_OBJECTS = tests/test-get-async.$(OBJEXT)
bin_test_get_async_OBJECTS = $(am_bin_test_get_async_OBJECTS)
bin_test_get_async_DEPENDENCIES = libndn-c.a libndn-cpp.a
@@ -221,12 +220,12 @@
am__v_CXXLD_0 = @echo " CXXLD " $@;
am__v_CXXLD_1 =
SOURCES = $(libndn_c_a_SOURCES) $(libndn_cpp_a_SOURCES) \
- $(bin_test_encode_decode_ContentObject_SOURCES) \
$(bin_test_encode_decode_Interest_SOURCES) \
+ $(bin_test_encode_decode_data_SOURCES) \
$(bin_test_get_async_SOURCES)
DIST_SOURCES = $(libndn_c_a_SOURCES) $(libndn_cpp_a_SOURCES) \
- $(bin_test_encode_decode_ContentObject_SOURCES) \
$(bin_test_encode_decode_Interest_SOURCES) \
+ $(bin_test_encode_decode_data_SOURCES) \
$(bin_test_get_async_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
@@ -417,14 +416,14 @@
lib_LIBRARIES = libndn-c.a libndn-cpp.a
libndn_c_a_SOURCES = \
config.h \
- ndn-cpp/c/ContentObject.h \
+ ndn-cpp/c/data.h \
ndn-cpp/c/Interest.h \
ndn-cpp/c/Key.h \
ndn-cpp/c/Name.h \
ndn-cpp/c/PublisherPublicKeyDigest.h \
ndn-cpp/c/errors.c ndn-cpp/c/errors.h \
ndn-cpp/c/encoding/BinaryXML.h \
- ndn-cpp/c/encoding/BinaryXMLContentObject.c ndn-cpp/c/encoding/BinaryXMLContentObject.h \
+ ndn-cpp/c/encoding/binary-xml-data.c ndn-cpp/c/encoding/binary-xml-data.h \
ndn-cpp/c/encoding/BinaryXMLDecoder.c ndn-cpp/c/encoding/BinaryXMLDecoder.h \
ndn-cpp/c/encoding/BinaryXMLElementReader.c ndn-cpp/c/encoding/BinaryXMLElementReader.h \
ndn-cpp/c/encoding/BinaryXMLEncoder.c ndn-cpp/c/encoding/BinaryXMLEncoder.h \
@@ -443,7 +442,7 @@
libndn_cpp_a_SOURCES = \
config.h ndn-cpp/common.hpp \
ndn-cpp/Closure.hpp \
- ndn-cpp/ContentObject.cpp ndn-cpp/c/ContentObject.h ndn-cpp/ContentObject.hpp \
+ ndn-cpp/data.cpp ndn-cpp/c/data.h ndn-cpp/data.hpp \
ndn-cpp/Interest.cpp ndn-cpp/c/Interest.h ndn-cpp/Interest.hpp \
ndn-cpp/Key.cpp ndn-cpp/c/Key.h ndn-cpp/Key.hpp \
ndn-cpp/NDN.cpp ndn-cpp/NDN.hpp \
@@ -462,8 +461,8 @@
bin_test_encode_decode_Interest_SOURCES = tests/test-encode-decode-Interest.cpp
bin_test_encode_decode_Interest_LDADD = libndn-c.a libndn-cpp.a
-bin_test_encode_decode_ContentObject_SOURCES = tests/test-encode-decode-ContentObject.cpp
-bin_test_encode_decode_ContentObject_LDADD = libndn-c.a libndn-cpp.a
+bin_test_encode_decode_data_SOURCES = tests/test-encode-decode-data.cpp
+bin_test_encode_decode_data_LDADD = libndn-c.a libndn-cpp.a
bin_test_get_async_SOURCES = tests/test-get-async.cpp
bin_test_get_async_LDADD = libndn-c.a libndn-cpp.a
dist_noinst_SCRIPTS = autogen.sh
@@ -567,7 +566,7 @@
ndn-cpp/c/encoding/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) ndn-cpp/c/encoding/$(DEPDIR)
@: > ndn-cpp/c/encoding/$(DEPDIR)/$(am__dirstamp)
-ndn-cpp/c/encoding/BinaryXMLContentObject.$(OBJEXT): \
+ndn-cpp/c/encoding/binary-xml-data.$(OBJEXT): \
ndn-cpp/c/encoding/$(am__dirstamp) \
ndn-cpp/c/encoding/$(DEPDIR)/$(am__dirstamp)
ndn-cpp/c/encoding/BinaryXMLDecoder.$(OBJEXT): \
@@ -627,7 +626,7 @@
ndn-cpp/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) ndn-cpp/$(DEPDIR)
@: > ndn-cpp/$(DEPDIR)/$(am__dirstamp)
-ndn-cpp/ContentObject.$(OBJEXT): ndn-cpp/$(am__dirstamp) \
+ndn-cpp/data.$(OBJEXT): ndn-cpp/$(am__dirstamp) \
ndn-cpp/$(DEPDIR)/$(am__dirstamp)
ndn-cpp/Interest.$(OBJEXT): ndn-cpp/$(am__dirstamp) \
ndn-cpp/$(DEPDIR)/$(am__dirstamp)
@@ -720,21 +719,21 @@
tests/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) tests/$(DEPDIR)
@: > tests/$(DEPDIR)/$(am__dirstamp)
-tests/test-encode-decode-ContentObject.$(OBJEXT): \
- tests/$(am__dirstamp) tests/$(DEPDIR)/$(am__dirstamp)
+tests/test-encode-decode-Interest.$(OBJEXT): tests/$(am__dirstamp) \
+ tests/$(DEPDIR)/$(am__dirstamp)
bin/$(am__dirstamp):
@$(MKDIR_P) bin
@: > bin/$(am__dirstamp)
-bin/test-encode-decode-ContentObject$(EXEEXT): $(bin_test_encode_decode_ContentObject_OBJECTS) $(bin_test_encode_decode_ContentObject_DEPENDENCIES) $(EXTRA_bin_test_encode_decode_ContentObject_DEPENDENCIES) bin/$(am__dirstamp)
- @rm -f bin/test-encode-decode-ContentObject$(EXEEXT)
- $(AM_V_CXXLD)$(CXXLINK) $(bin_test_encode_decode_ContentObject_OBJECTS) $(bin_test_encode_decode_ContentObject_LDADD) $(LIBS)
-tests/test-encode-decode-Interest.$(OBJEXT): tests/$(am__dirstamp) \
- tests/$(DEPDIR)/$(am__dirstamp)
-
bin/test-encode-decode-Interest$(EXEEXT): $(bin_test_encode_decode_Interest_OBJECTS) $(bin_test_encode_decode_Interest_DEPENDENCIES) $(EXTRA_bin_test_encode_decode_Interest_DEPENDENCIES) bin/$(am__dirstamp)
@rm -f bin/test-encode-decode-Interest$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(bin_test_encode_decode_Interest_OBJECTS) $(bin_test_encode_decode_Interest_LDADD) $(LIBS)
+tests/test-encode-decode-data.$(OBJEXT): tests/$(am__dirstamp) \
+ tests/$(DEPDIR)/$(am__dirstamp)
+
+bin/test-encode-decode-data$(EXEEXT): $(bin_test_encode_decode_data_OBJECTS) $(bin_test_encode_decode_data_DEPENDENCIES) $(EXTRA_bin_test_encode_decode_data_DEPENDENCIES) bin/$(am__dirstamp)
+ @rm -f bin/test-encode-decode-data$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(bin_test_encode_decode_data_OBJECTS) $(bin_test_encode_decode_data_LDADD) $(LIBS)
tests/test-get-async.$(OBJEXT): tests/$(am__dirstamp) \
tests/$(DEPDIR)/$(am__dirstamp)
@@ -756,13 +755,12 @@
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/$(DEPDIR)/ContentObject.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/$(DEPDIR)/Interest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/$(DEPDIR)/Key.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/$(DEPDIR)/NDN.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/$(DEPDIR)/Name.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/$(DEPDIR)/data.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/$(DEPDIR)/errors.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/encoding/$(DEPDIR)/BinaryXMLContentObject.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/encoding/$(DEPDIR)/BinaryXMLDecoder.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/encoding/$(DEPDIR)/BinaryXMLElementReader.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/encoding/$(DEPDIR)/BinaryXMLEncoder.Po@am__quote@
@@ -771,6 +769,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/encoding/$(DEPDIR)/BinaryXMLName.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/encoding/$(DEPDIR)/BinaryXMLPublisherPublicKeyDigest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/encoding/$(DEPDIR)/BinaryXMLStructureDecoder.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/encoding/$(DEPDIR)/binary-xml-data.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/transport/$(DEPDIR)/SocketTransport.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/util/$(DEPDIR)/DynamicUCharArray.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/c/util/$(DEPDIR)/ndn_memory.Po@am__quote@
@@ -781,8 +780,8 @@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/transport/$(DEPDIR)/TcpTransport.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/transport/$(DEPDIR)/Transport.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/transport/$(DEPDIR)/UdpTransport.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-encode-decode-ContentObject.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-encode-decode-Interest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-encode-decode-data.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-get-async.Po@am__quote@
.c.o:
diff --git a/ndn-cpp/Closure.hpp b/ndn-cpp/Closure.hpp
index 9efbd03..c017a81 100644
--- a/ndn-cpp/Closure.hpp
+++ b/ndn-cpp/Closure.hpp
@@ -27,35 +27,35 @@
UPCALL_FINAL = 0, // handler is about to be deregistered
UPCALL_INTEREST = 1, // incoming interest
UPCALL_CONSUMED_INTEREST = 2, // incoming interest, someone has answered
- UPCALL_CONTENT = 3, // incoming verified content
+ UPCALL_DATA = 3, // incoming verified data packet
UPCALL_INTEREST_TIMED_OUT = 4, // interest timed out
- UPCALL_CONTENT_UNVERIFIED = 5, // content that has not been verified
- UPCALL_CONTENT_BAD = 6 // verification failed
+ UPCALL_DATA_UNVERIFIED = 5, // data packet that has not been verified
+ UPCALL_DATA_BAD = 6 // verification failed
};
class NDN;
class Interest;
-class ContentObject;
+class Data;
class UpcallInfo {
public:
- UpcallInfo(NDN *ndn, ptr_lib::shared_ptr<Interest> &interest, int matchedComps, ptr_lib::shared_ptr<ContentObject> &contentObject)
+ UpcallInfo(NDN *ndn, ptr_lib::shared_ptr<Interest> &interest, int matchedComps, ptr_lib::shared_ptr<Data> &data)
{
ndn_ = ndn;
interest_ = interest;
- contentObject_ = contentObject;
+ data_ = data;
}
NDN *getNDN() { return ndn_; }
ptr_lib::shared_ptr<Interest> &getInterest() { return interest_; }
- ptr_lib::shared_ptr<ContentObject> &getContentObject() { return contentObject_; }
+ ptr_lib::shared_ptr<Data> &getData() { return data_; }
private:
NDN *ndn_;
ptr_lib::shared_ptr<Interest> interest_;
- ptr_lib::shared_ptr<ContentObject> contentObject_;
+ ptr_lib::shared_ptr<Data> data_;
};
class Closure {
diff --git a/ndn-cpp/NDN.cpp b/ndn-cpp/NDN.cpp
index 1299e94..206af43 100644
--- a/ndn-cpp/NDN.cpp
+++ b/ndn-cpp/NDN.cpp
@@ -5,7 +5,7 @@
#include "encoding/BinaryXMLDecoder.hpp"
#include "c/encoding/BinaryXML.h"
-#include "ContentObject.hpp"
+#include "data.hpp"
#include "NDN.hpp"
using namespace std;
@@ -30,12 +30,12 @@
BinaryXmlDecoder decoder(element, elementLength);
if (decoder.peekDTag(ndn_BinaryXml_DTag_ContentObject)) {
- shared_ptr<ContentObject> contentObject(new ContentObject());
- contentObject->decode(element, elementLength);
+ shared_ptr<Data> data(new Data());
+ data->decode(element, elementLength);
shared_ptr<Interest> dummyInterest;
- UpcallInfo upcallInfo(this, dummyInterest, 0, contentObject);
- tempClosure_->upcall(UPCALL_CONTENT, upcallInfo);
+ UpcallInfo upcallInfo(this, dummyInterest, 0, data);
+ tempClosure_->upcall(UPCALL_DATA, upcallInfo);
}
}
diff --git a/ndn-cpp/NDN.hpp b/ndn-cpp/NDN.hpp
index 2abb8f2..106431a 100644
--- a/ndn-cpp/NDN.hpp
+++ b/ndn-cpp/NDN.hpp
@@ -35,8 +35,8 @@
/**
* Encode name as an Interest. If interestTemplate is not 0, use its interest selectors.
* Send the interest through the transport, read the entire response and call
- * closure->upcall(UPCALL_CONTENT (or UPCALL_CONTENT_UNVERIFIED),
- * UpcallInfo(this, interest, 0, contentObject)).
+ * closure->upcall(UPCALL_DATA (or UPCALL_DATA_UNVERIFIED),
+ * UpcallInfo(this, interest, 0, data)).
* @param name reference to a Name for the interest. This does not keep a pointer to the Name object.
* @param closure a shared_ptr for the Closure. This uses shared_ptr to take another reference to the object.
* @param interestTemplate if not 0, copy interest selectors from the template. This does not keep a pointer to the Interest object.
diff --git a/ndn-cpp/c/ContentObject.h b/ndn-cpp/c/data.h
similarity index 88%
rename from ndn-cpp/c/ContentObject.h
rename to ndn-cpp/c/data.h
index 36ede14..9338846 100644
--- a/ndn-cpp/c/ContentObject.h
+++ b/ndn-cpp/c/data.h
@@ -3,8 +3,8 @@
* See COPYING for copyright and distribution information.
*/
-#ifndef NDN_CONTENTOBJECT_H
-#define NDN_CONTENTOBJECT_H
+#ifndef NDN_DATA_H
+#define NDN_DATA_H
#include "Name.h"
#include "PublisherPublicKeyDigest.h"
@@ -65,7 +65,7 @@
ndn_KeyLocator_init(&self->keyLocator);
}
-struct ndn_ContentObject {
+struct ndn_Data {
struct ndn_Signature signature;
struct ndn_Name name;
struct ndn_SignedInfo signedInfo;
@@ -74,13 +74,13 @@
};
/**
- * Initialize an ndn_ContentObject struct with the pre-allocated nameComponents,
+ * Initialize an ndn_Data struct with the pre-allocated nameComponents,
* and defaults for all the values.
- * @param self pointer to the ndn_ContentObject struct
+ * @param self pointer to the ndn_Data struct
* @param nameComponents the pre-allocated array of ndn_NameComponent
* @param maxNameComponents the number of elements in the allocated nameComponents array
*/
-static inline void ndn_ContentObject_init(struct ndn_ContentObject *self, struct ndn_NameComponent *nameComponents, unsigned int maxNameComponents)
+static inline void ndn_Data_init(struct ndn_Data *self, struct ndn_NameComponent *nameComponents, unsigned int maxNameComponents)
{
ndn_Signature_init(&self->signature);
ndn_Name_init(&self->name, nameComponents, maxNameComponents);
diff --git a/ndn-cpp/c/encoding/BinaryXMLContentObject.h b/ndn-cpp/c/encoding/BinaryXMLContentObject.h
deleted file mode 100644
index eb7cc5e..0000000
--- a/ndn-cpp/c/encoding/BinaryXMLContentObject.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * @author: Jeff Thompson
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BINARYXMLCONTENTOBJECT_H
-#define NDN_BINARYXMLCONTENTOBJECT_H
-
-#include "../errors.h"
-#include "../ContentObject.h"
-#include "BinaryXMLEncoder.h"
-#include "BinaryXMLDecoder.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-ndn_Error ndn_encodeBinaryXmlContentObject(struct ndn_ContentObject *contentObject, struct ndn_BinaryXmlEncoder *encoder);
-
-ndn_Error ndn_decodeBinaryXmlContentObject(struct ndn_ContentObject *contentObject, struct ndn_BinaryXmlDecoder *decoder);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/ndn-cpp/c/encoding/BinaryXMLContentObject.c b/ndn-cpp/c/encoding/binary-xml-data.c
similarity index 85%
rename from ndn-cpp/c/encoding/BinaryXMLContentObject.c
rename to ndn-cpp/c/encoding/binary-xml-data.c
index d95889c..8da14b2 100644
--- a/ndn-cpp/c/encoding/BinaryXMLContentObject.c
+++ b/ndn-cpp/c/encoding/binary-xml-data.c
@@ -8,7 +8,7 @@
#include "BinaryXMLDecoder.h"
#include "BinaryXMLName.h"
#include "BinaryXMLPublisherPublicKeyDigest.h"
-#include "BinaryXMLContentObject.h"
+#include "binary-xml-data.h"
static ndn_Error encodeSignature(struct ndn_Signature *signature, struct ndn_BinaryXmlEncoder *encoder)
{
@@ -129,23 +129,23 @@
return 0;
}
-ndn_Error ndn_encodeBinaryXmlContentObject(struct ndn_ContentObject *contentObject, struct ndn_BinaryXmlEncoder *encoder)
+ndn_Error ndn_encodeBinaryXmlData(struct ndn_Data *data, struct ndn_BinaryXmlEncoder *encoder)
{
ndn_Error error;
if (error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_ContentObject))
return error;
- if (error = encodeSignature(&contentObject->signature, encoder))
+ if (error = encodeSignature(&data->signature, encoder))
return 0;
- if (error = ndn_encodeBinaryXmlName(&contentObject->name, encoder))
+ if (error = ndn_encodeBinaryXmlName(&data->name, encoder))
return error;
- if (error = encodeSignedInfo(&contentObject->signedInfo, encoder))
+ if (error = encodeSignedInfo(&data->signedInfo, encoder))
return 0;
if (error = ndn_BinaryXmlEncoder_writeBlobDTagElement
- (encoder, ndn_BinaryXml_DTag_Content, contentObject->content, contentObject->contentLength))
+ (encoder, ndn_BinaryXml_DTag_Content, data->content, data->contentLength))
return error;
if (error = ndn_BinaryXmlEncoder_writeElementClose(encoder))
@@ -154,7 +154,7 @@
return 0;
}
-ndn_Error ndn_decodeBinaryXmlContentObject(struct ndn_ContentObject *contentObject, struct ndn_BinaryXmlDecoder *decoder)
+ndn_Error ndn_decodeBinaryXmlData(struct ndn_Data *data, struct ndn_BinaryXmlDecoder *decoder)
{
ndn_Error error;
if (error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_ContentObject))
@@ -164,27 +164,27 @@
if (error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Signature, &gotExpectedTag))
return error;
if (gotExpectedTag) {
- if (error = decodeSignature(&contentObject->signature, decoder))
+ if (error = decodeSignature(&data->signature, decoder))
return error;
}
else
- ndn_Signature_init(&contentObject->signature);
+ ndn_Signature_init(&data->signature);
- if (error = ndn_decodeBinaryXmlName(&contentObject->name, decoder))
+ if (error = ndn_decodeBinaryXmlName(&data->name, decoder))
return error;
if (error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_SignedInfo, &gotExpectedTag))
return error;
if (gotExpectedTag) {
- if (error = decodeSignedInfo(&contentObject->signedInfo, decoder))
+ if (error = decodeSignedInfo(&data->signedInfo, decoder))
return error;
}
else
- ndn_SignedInfo_init(&contentObject->signedInfo);
+ ndn_SignedInfo_init(&data->signedInfo);
// Require a Content element, but set allowNull to allow a missing BLOB.
if (error = ndn_BinaryXmlDecoder_readBinaryDTagElement
- (decoder, ndn_BinaryXml_DTag_Content, 1, &contentObject->content, &contentObject->contentLength))
+ (decoder, ndn_BinaryXml_DTag_Content, 1, &data->content, &data->contentLength))
return error;
if (error = ndn_BinaryXmlDecoder_readElementClose(decoder))
diff --git a/ndn-cpp/c/encoding/binary-xml-data.h b/ndn-cpp/c/encoding/binary-xml-data.h
new file mode 100644
index 0000000..f3b14e9
--- /dev/null
+++ b/ndn-cpp/c/encoding/binary-xml-data.h
@@ -0,0 +1,26 @@
+/**
+ * @author: Jeff Thompson
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_BINARY_XML_DATA_H
+#define NDN_BINARY_XML_DATA_H
+
+#include "../errors.h"
+#include "../data.h"
+#include "BinaryXMLEncoder.h"
+#include "BinaryXMLDecoder.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ndn_Error ndn_encodeBinaryXmlData(struct ndn_Data *data, struct ndn_BinaryXmlEncoder *encoder);
+
+ndn_Error ndn_decodeBinaryXmlData(struct ndn_Data *data, struct ndn_BinaryXmlDecoder *decoder);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/ndn-cpp/ContentObject.cpp b/ndn-cpp/data.cpp
similarity index 75%
rename from ndn-cpp/ContentObject.cpp
rename to ndn-cpp/data.cpp
index 637c066..322faff 100644
--- a/ndn-cpp/ContentObject.cpp
+++ b/ndn-cpp/data.cpp
@@ -4,7 +4,7 @@
*/
#include "common.hpp"
-#include "ContentObject.hpp"
+#include "data.hpp"
using namespace std;
@@ -64,25 +64,25 @@
keyLocator_.set(signedInfoStruct.keyLocator);
}
-void ContentObject::get(struct ndn_ContentObject &contentObjectStruct) const
+void Data::get(struct ndn_Data &dataStruct) const
{
- signature_.get(contentObjectStruct.signature);
- name_.get(contentObjectStruct.name);
- signedInfo_.get(contentObjectStruct.signedInfo);
+ signature_.get(dataStruct.signature);
+ name_.get(dataStruct.name);
+ signedInfo_.get(dataStruct.signedInfo);
- contentObjectStruct.contentLength = content_.size();
+ dataStruct.contentLength = content_.size();
if (content_.size() > 0)
- contentObjectStruct.content = (unsigned char *)&content_[0];
+ dataStruct.content = (unsigned char *)&content_[0];
else
- contentObjectStruct.content = 0;
+ dataStruct.content = 0;
}
-void ContentObject::set(const struct ndn_ContentObject &contentObjectStruct)
+void Data::set(const struct ndn_Data &dataStruct)
{
- signature_.set(contentObjectStruct.signature);
- name_.set(contentObjectStruct.name);
- signedInfo_.set(contentObjectStruct.signedInfo);
- setVector(content_, contentObjectStruct.content, contentObjectStruct.contentLength);
+ signature_.set(dataStruct.signature);
+ name_.set(dataStruct.name);
+ signedInfo_.set(dataStruct.signedInfo);
+ setVector(content_, dataStruct.content, dataStruct.contentLength);
}
}
diff --git a/ndn-cpp/ContentObject.hpp b/ndn-cpp/data.hpp
similarity index 82%
rename from ndn-cpp/ContentObject.hpp
rename to ndn-cpp/data.hpp
index 18c69ea..883331f 100644
--- a/ndn-cpp/ContentObject.hpp
+++ b/ndn-cpp/data.hpp
@@ -3,13 +3,13 @@
* See COPYING for copyright and distribution information.
*/
-#ifndef NDN_CONTENTOBJECT_HPP
-#define NDN_CONTENTOBJECT_HPP
+#ifndef NDN_DATA_HPP
+#define NDN_DATA_HPP
#include "Name.hpp"
#include "PublisherPublicKeyDigest.hpp"
#include "Key.hpp"
-#include "c/ContentObject.h"
+#include "c/data.h"
namespace ndn {
@@ -82,11 +82,11 @@
KeyLocator keyLocator_;
};
-class ContentObject {
+class Data {
public:
ptr_lib::shared_ptr<std::vector<unsigned char> > encode(WireFormat &wireFormat) const
{
- return wireFormat.encodeContentObject(*this);
+ return wireFormat.encodeData(*this);
}
ptr_lib::shared_ptr<std::vector<unsigned char> > encode() const
{
@@ -94,7 +94,7 @@
}
void decode(const unsigned char *input, unsigned int inputLength, WireFormat &wireFormat)
{
- wireFormat.decodeContentObject(*this, input, inputLength);
+ wireFormat.decodeData(*this, input, inputLength);
}
void decode(const unsigned char *input, unsigned int inputLength)
{
@@ -110,17 +110,17 @@
}
/**
- * Set the contentObjectStruct to point to the values in this interest, without copying any memory.
- * WARNING: The resulting pointers in contentObjectStruct are invalid after a further use of this object which could reallocate memory.
- * @param contentObjectStruct a C ndn_ContentObject struct where the name components array is already allocated.
+ * Set the dataStruct to point to the values in this interest, without copying any memory.
+ * WARNING: The resulting pointers in dataStruct are invalid after a further use of this object which could reallocate memory.
+ * @param dataStruct a C ndn_Data struct where the name components array is already allocated.
*/
- void get(struct ndn_ContentObject &contentObjectStruct) const;
+ void get(struct ndn_Data &dataStruct) const;
/**
- * Clear this content object, and set the values by copying from the ndn_ContentObject struct.
- * @param contentObjectStruct a C ndn_ContentObject struct
+ * Clear this data object, and set the values by copying from the ndn_Data struct.
+ * @param dataStruct a C ndn_Data struct
*/
- void set(const struct ndn_ContentObject &contentObjectStruct);
+ void set(const struct ndn_Data &dataStruct);
const Signature &getSignature() const { return signature_; }
diff --git a/ndn-cpp/encoding/BinaryXMLWireFormat.cpp b/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
index e0b2b1c..1c6b7b1 100644
--- a/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
+++ b/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
@@ -5,9 +5,9 @@
#include <stdexcept>
#include "../c/encoding/BinaryXMLInterest.h"
-#include "../c/encoding/BinaryXMLContentObject.h"
+#include "../c/encoding/binary-xml-data.h"
#include "../Interest.hpp"
-#include "../ContentObject.hpp"
+#include "../data.hpp"
#include "BinaryXMLEncoder.hpp"
#include "BinaryXMLDecoder.hpp"
#include "BinaryXMLWireFormat.hpp"
@@ -51,33 +51,33 @@
interest.set(interestStruct);
}
-ptr_lib::shared_ptr<vector<unsigned char> > BinaryXmlWireFormat::encodeContentObject(const ContentObject &contentObject)
+ptr_lib::shared_ptr<vector<unsigned char> > BinaryXmlWireFormat::encodeData(const Data &data)
{
struct ndn_NameComponent nameComponents[100];
- struct ndn_ContentObject contentObjectStruct;
- ndn_ContentObject_init
- (&contentObjectStruct, nameComponents, sizeof(nameComponents) / sizeof(nameComponents[0]));
- contentObject.get(contentObjectStruct);
+ struct ndn_Data dataStruct;
+ ndn_Data_init
+ (&dataStruct, nameComponents, sizeof(nameComponents) / sizeof(nameComponents[0]));
+ data.get(dataStruct);
BinaryXmlEncoder encoder;
- ndn_encodeBinaryXmlContentObject(&contentObjectStruct, &encoder);
+ ndn_encodeBinaryXmlData(&dataStruct, &encoder);
return encoder.getOutput();
}
-void BinaryXmlWireFormat::decodeContentObject(ContentObject &contentObject, const unsigned char *input, unsigned int inputLength)
+void BinaryXmlWireFormat::decodeData(Data &data, const unsigned char *input, unsigned int inputLength)
{
struct ndn_NameComponent nameComponents[100];
- struct ndn_ContentObject contentObjectStruct;
- ndn_ContentObject_init
- (&contentObjectStruct, nameComponents, sizeof(nameComponents) / sizeof(nameComponents[0]));
+ struct ndn_Data dataStruct;
+ ndn_Data_init
+ (&dataStruct, nameComponents, sizeof(nameComponents) / sizeof(nameComponents[0]));
BinaryXmlDecoder decoder(input, inputLength);
ndn_Error error;
- if (error = ndn_decodeBinaryXmlContentObject(&contentObjectStruct, &decoder))
+ if (error = ndn_decodeBinaryXmlData(&dataStruct, &decoder))
throw std::runtime_error(ndn_getErrorString(error));
- contentObject.set(contentObjectStruct);
+ data.set(dataStruct);
}
}
diff --git a/ndn-cpp/encoding/BinaryXMLWireFormat.hpp b/ndn-cpp/encoding/BinaryXMLWireFormat.hpp
index ff73218..ffc19b0 100644
--- a/ndn-cpp/encoding/BinaryXMLWireFormat.hpp
+++ b/ndn-cpp/encoding/BinaryXMLWireFormat.hpp
@@ -15,8 +15,8 @@
virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeInterest(const Interest &interest);
virtual void decodeInterest(Interest &interest, const unsigned char *input, unsigned int inputLength);
- virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeContentObject(const ContentObject &contentObject);
- virtual void decodeContentObject(ContentObject &contentObject, const unsigned char *input, unsigned int inputLength);
+ virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeData(const Data &data);
+ virtual void decodeData(Data &data, const unsigned char *input, unsigned int inputLength);
static BinaryXmlWireFormat &getInstance() { return instance_; }
diff --git a/ndn-cpp/encoding/WireFormat.cpp b/ndn-cpp/encoding/WireFormat.cpp
index 238ce9c..39d2e11 100644
--- a/ndn-cpp/encoding/WireFormat.cpp
+++ b/ndn-cpp/encoding/WireFormat.cpp
@@ -18,11 +18,11 @@
throw logic_error("unimplemented");
}
-ptr_lib::shared_ptr<vector<unsigned char> > WireFormat::encodeContentObject(const ContentObject &contentObject)
+ptr_lib::shared_ptr<vector<unsigned char> > WireFormat::encodeData(const Data &data)
{
throw logic_error("unimplemented");
}
-void WireFormat::decodeContentObject(ContentObject &contentObject, const unsigned char *input, unsigned int inputLength)
+void WireFormat::decodeData(Data &data, const unsigned char *input, unsigned int inputLength)
{
throw logic_error("unimplemented");
}
diff --git a/ndn-cpp/encoding/WireFormat.hpp b/ndn-cpp/encoding/WireFormat.hpp
index 1afe25f..a7d62bc 100644
--- a/ndn-cpp/encoding/WireFormat.hpp
+++ b/ndn-cpp/encoding/WireFormat.hpp
@@ -12,15 +12,15 @@
namespace ndn {
class Interest;
-class ContentObject;
+class Data;
class WireFormat {
public:
virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeInterest(const Interest &interest);
virtual void decodeInterest(Interest &interest, const unsigned char *input, unsigned int inputLength);
- virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeContentObject(const ContentObject &contentObject);
- virtual void decodeContentObject(ContentObject &contentObject, const unsigned char *input, unsigned int inputLength);
+ virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeData(const Data &data);
+ virtual void decodeData(Data &data, const unsigned char *input, unsigned int inputLength);
};
}
diff --git a/tests/test-encode-decode-ContentObject.cpp b/tests/test-encode-decode-data.cpp
similarity index 74%
rename from tests/test-encode-decode-ContentObject.cpp
rename to tests/test-encode-decode-data.cpp
index 0ed1c99..bc4a324 100644
--- a/tests/test-encode-decode-ContentObject.cpp
+++ b/tests/test-encode-decode-data.cpp
@@ -11,7 +11,7 @@
#include <boost/date_time/posix_time/time_serialize.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
#endif
-#include <ndn-cpp/ContentObject.hpp>
+#include <ndn-cpp/data.hpp>
using namespace std;
using namespace ndn;
@@ -20,8 +20,8 @@
using namespace boost::gregorian;
#endif
-unsigned char ContentObject1[] = {
-0x04, 0x82, // ContentObject
+unsigned char Data1[] = {
+0x04, 0x82, // NDN Data
0x02, 0xaa, // Signature
0x03, 0xb2, // SignatureBits
0x08, 0x85, 0x20, 0xea, 0xb5, 0xb0, 0x63, 0xda, 0x94, 0xe9, 0x68, 0x7a,
@@ -73,24 +73,24 @@
int main(int argc, char** argv)
{
try {
- ContentObject contentObject;
- contentObject.decode(ContentObject1, sizeof(ContentObject1));
- cout << "ContentObject name " << contentObject.getName().to_uri() << endl;
+ Data data;
+ data.decode(Data1, sizeof(Data1));
+ cout << "Data name " << data.getName().to_uri() << endl;
#if 0
- ptime timestamp = UNIX_EPOCH_TIME + milliseconds(contentObject.getSignedInfo().getTimestampMilliseconds());
- cout << "ContentObject timestamp " << timestamp.date().year() << "/" << timestamp.date().month() << "/" << timestamp.date().day()
+ ptime timestamp = UNIX_EPOCH_TIME + milliseconds(data.getSignedInfo().getTimestampMilliseconds());
+ cout << "Data timestamp " << timestamp.date().year() << "/" << timestamp.date().month() << "/" << timestamp.date().day()
<< " " << timestamp.time_of_day().hours() << ":" << timestamp.time_of_day().minutes() << ":" << timestamp.time_of_day().seconds() << endl;
#endif
- ptr_lib::shared_ptr<vector<unsigned char> > encoding = contentObject.encode();
- cout << "ContentObject encoding length " << encoding->size() << " vs. sizeof(ContentObject1) " << sizeof(ContentObject1) << endl;
+ ptr_lib::shared_ptr<vector<unsigned char> > encoding = data.encode();
+ cout << "Data encoding length " << encoding->size() << " vs. sizeof(Data1) " << sizeof(Data1) << endl;
- ContentObject reDecodedContentObject;
- reDecodedContentObject.decode(*encoding);
- cout << "Re-decoded ContentObject name " << reDecodedContentObject.getName().to_uri() << endl;
+ Data reDecodedData;
+ reDecodedData.decode(*encoding);
+ cout << "Re-decoded Data name " << reDecodedData.getName().to_uri() << endl;
#if 0
- timestamp = UNIX_EPOCH_TIME + milliseconds(reDecodedContentObject.getSignedInfo().getTimestampMilliseconds());
- cout << "Re-decoded ContentObject timestamp " << timestamp.date().year() << "/" << timestamp.date().month() << "/" << timestamp.date().day() << endl;
+ timestamp = UNIX_EPOCH_TIME + milliseconds(reDecodedData.getSignedInfo().getTimestampMilliseconds());
+ cout << "Re-decoded Data timestamp " << timestamp.date().year() << "/" << timestamp.date().month() << "/" << timestamp.date().day() << endl;
#endif
} catch (exception &e) {
cout << "exception: " << e.what() << endl;
diff --git a/tests/test-get-async.cpp b/tests/test-get-async.cpp
index 6524331..fc3a2ca 100644
--- a/tests/test-get-async.cpp
+++ b/tests/test-get-async.cpp
@@ -7,7 +7,7 @@
#include <sstream>
#include <iostream>
#include <ndn-cpp/Interest.hpp>
-#include <ndn-cpp/ContentObject.hpp>
+#include <ndn-cpp/data.hpp>
#include <ndn-cpp/transport/UdpTransport.hpp>
#include <ndn-cpp/NDN.hpp>
@@ -24,11 +24,11 @@
virtual UpcallResult upcall(UpcallKind kind, UpcallInfo &upcallInfo)
{
- if (kind == UPCALL_CONTENT || kind == UPCALL_CONTENT_UNVERIFIED) {
+ if (kind == UPCALL_DATA || kind == UPCALL_DATA_UNVERIFIED) {
gotContent_ = true;
- cout << "Got content with name " << upcallInfo.getContentObject()->getName().to_uri() << endl;
- for (unsigned int i = 0; i < upcallInfo.getContentObject()->getContent().size(); ++i)
- cout << upcallInfo.getContentObject()->getContent()[i];
+ cout << "Got data packet with name " << upcallInfo.getData()->getName().to_uri() << endl;
+ for (unsigned int i = 0; i < upcallInfo.getData()->getContent().size(); ++i)
+ cout << upcallInfo.getData()->getContent()[i];
cout << endl;
return CLOSURE_RESULT_OK;