Internal: Use C struct ndn_Blob where possible. Make ndn::Blob work with ndn_Blob.
diff --git a/ndn-cpp/c/data.h b/ndn-cpp/c/data.h
index 6340c8c..e085f79 100644
--- a/ndn-cpp/c/data.h
+++ b/ndn-cpp/c/data.h
@@ -19,13 +19,10 @@
* An ndn_Signature struct holds the signature bits and other info representing the signature in a data packet.
*/
struct ndn_Signature {
- uint8_t *digestAlgorithm; /**< pointer to pre-allocated buffer. 0 for none.
- * If none, default is 2.16.840.1.101.3.4.2.1 (sha-256). */
- size_t digestAlgorithmLength; /**< length of digestAlgorithm. 0 for none */
- uint8_t *witness; /**< pointer to pre-allocated buffer. 0 for none. */
- size_t witnessLength; /**< length of witness. 0 for none */
- uint8_t *signature;
- size_t signatureLength;
+ struct ndn_Blob digestAlgorithm; /**< A Blob whose value is a pointer to a pre-allocated buffer. 0 for none.
+ * If none, default is 2.16.840.1.101.3.4.2.1 (sha-256). */
+ struct ndn_Blob witness; /**< A Blob whose value is a pointer to pre-allocated buffer. 0 for none. */
+ struct ndn_Blob signature;
struct ndn_PublisherPublicKeyDigest publisherPublicKeyDigest;
struct ndn_KeyLocator keyLocator;
};
@@ -37,12 +34,9 @@
* @param maxKeyNameComponents The number of elements in the allocated keyNameComponents array.
*/
static inline void ndn_Signature_initialize(struct ndn_Signature *self, struct ndn_NameComponent *keyNameComponents, size_t maxKeyNameComponents) {
- self->digestAlgorithm = 0;
- self->digestAlgorithmLength = 0;
- self->witness = 0;
- self->witnessLength = 0;
- self->signature = 0;
- self->signatureLength = 0;
+ ndn_Blob_initialize(&self->digestAlgorithm, 0, 0);
+ ndn_Blob_initialize(&self->witness, 0, 0);
+ ndn_Blob_initialize(&self->signature, 0, 0);
ndn_PublisherPublicKeyDigest_initialize(&self->publisherPublicKeyDigest);
ndn_KeyLocator_initialize(&self->keyLocator, keyNameComponents, maxKeyNameComponents);
}
@@ -81,8 +75,7 @@
struct ndn_Signature signature;
struct ndn_Name name;
struct ndn_MetaInfo metaInfo;
- uint8_t *content; /**< pointer to the content */
- size_t contentLength; /**< length of content */
+ struct ndn_Blob content; /**< A Blob with a pointer to the content. */
};
/**
@@ -101,8 +94,7 @@
ndn_Signature_initialize(&self->signature, keyNameComponents, maxKeyNameComponents);
ndn_Name_initialize(&self->name, nameComponents, maxNameComponents);
ndn_MetaInfo_initialize(&self->metaInfo);
- self->content = 0;
- self->contentLength = 0;
+ ndn_Blob_initialize(&self->content, 0, 0);
}
#ifdef __cplusplus