Implement timestampMilliseconds
diff --git a/ndn-cpp/ContentObject.cpp b/ndn-cpp/ContentObject.cpp
index e675e5a..637c066 100644
--- a/ndn-cpp/ContentObject.cpp
+++ b/ndn-cpp/ContentObject.cpp
@@ -41,7 +41,7 @@
void SignedInfo::get(struct ndn_SignedInfo &signedInfoStruct) const
{
publisherPublicKeyDigest_.get(signedInfoStruct.publisherPublicKeyDigest);
- // TODO: Implement timestamp
+ signedInfoStruct.timestampMilliseconds = timestampMilliseconds_;
signedInfoStruct.type = type_;
signedInfoStruct.freshnessSeconds = freshnessSeconds_;
@@ -57,7 +57,7 @@
void SignedInfo::set(const struct ndn_SignedInfo &signedInfoStruct)
{
publisherPublicKeyDigest_.set(signedInfoStruct.publisherPublicKeyDigest);
- // TODO: Implement timestamp
+ timestampMilliseconds_ = signedInfoStruct.timestampMilliseconds;
type_ = signedInfoStruct.type;
freshnessSeconds_ = signedInfoStruct.freshnessSeconds;
setVector(finalBlockID_, signedInfoStruct.finalBlockID, signedInfoStruct.finalBlockIDLength);
diff --git a/ndn-cpp/ContentObject.hpp b/ndn-cpp/ContentObject.hpp
index 9cf1c3d..6bd5a80 100644
--- a/ndn-cpp/ContentObject.hpp
+++ b/ndn-cpp/ContentObject.hpp
@@ -63,7 +63,7 @@
const PublisherPublicKeyDigest &getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
- // TODO: Implement timestamp
+ double getTimestampMilliseconds() const { return timestampMilliseconds_; }
int getType() const { return type_; }
@@ -75,10 +75,10 @@
private:
PublisherPublicKeyDigest publisherPublicKeyDigest_;
- // TODO: Implement timestamp
- int type_;
- int freshnessSeconds_;
- std::vector<unsigned char> finalBlockID_;
+ double timestampMilliseconds_; /**< milliseconds since 1/1/1970. -1 for none */
+ int type_; /**< default is ndn_ContentType_DATA. -1 for none */
+ int freshnessSeconds_; /**< -1 for none */
+ std::vector<unsigned char> finalBlockID_; /** size 0 for none */
KeyLocator keyLocator_;
};
diff --git a/ndn-cpp/c/ContentObject.h b/ndn-cpp/c/ContentObject.h
index 4d46e53..36ede14 100644
--- a/ndn-cpp/c/ContentObject.h
+++ b/ndn-cpp/c/ContentObject.h
@@ -44,11 +44,11 @@
struct ndn_SignedInfo {
struct ndn_PublisherPublicKeyDigest publisherPublicKeyDigest;
- // TODO: Implement timestamp
- int type; /**< default is ndn_ContentType_DATA. -1 for none */
- int freshnessSeconds; /**< -1 for none */
- unsigned char *finalBlockID; /**< pointer to pre-allocated buffer. 0 for none */
- unsigned int finalBlockIDLength; /**< length of finalBlockID. 0 for none */
+ double timestampMilliseconds; /**< milliseconds since 1/1/1970. -1 for none */
+ int type; /**< default is ndn_ContentType_DATA. -1 for none */
+ int freshnessSeconds; /**< -1 for none */
+ unsigned char *finalBlockID; /**< pointer to pre-allocated buffer. 0 for none */
+ unsigned int finalBlockIDLength; /**< length of finalBlockID. 0 for none */
struct ndn_KeyLocator keyLocator;
};
diff --git a/ndn-cpp/c/encoding/BinaryXMLContentObject.c b/ndn-cpp/c/encoding/BinaryXMLContentObject.c
index ef50532..29b2065 100644
--- a/ndn-cpp/c/encoding/BinaryXMLContentObject.c
+++ b/ndn-cpp/c/encoding/BinaryXMLContentObject.c
@@ -103,7 +103,9 @@
if (error = ndn_decodeOptionalBinaryXMLPublisherPublicKeyDigest(&signedInfo->publisherPublicKeyDigest, decoder))
return error;
- // TODO: Implement timeStamp
+ if (error= ndn_BinaryXMLDecoder_readOptionalTimeMillisecondsDTagElement
+ (decoder, ndn_BinaryXML_DTag_Timestamp, &signedInfo->timestampMilliseconds))
+ return error;
// TODO: Implement reading the type and converting to an int.
signedInfo->type = ndn_ContentType_DATA;