Added separate PublishPublicKeyDigest and use in Interest.
diff --git a/ndn-cpp/c/encoding/BinaryXMLInterest.c b/ndn-cpp/c/encoding/BinaryXMLInterest.c
index 270e13b..c7e4177 100644
--- a/ndn-cpp/c/encoding/BinaryXMLInterest.c
+++ b/ndn-cpp/c/encoding/BinaryXMLInterest.c
@@ -7,6 +7,7 @@
#include "BinaryXMLEncoder.h"
#include "BinaryXMLDecoder.h"
#include "BinaryXMLName.h"
+#include "BinaryXMLPublisherPublicKeyDigest.h"
#include "BinaryXMLInterest.h"
static ndn_Error encodeExclude(struct ndn_Exclude *exclude, struct ndn_BinaryXMLEncoder *encoder)
@@ -138,13 +139,11 @@
return error;
}
- if (interest->publisherPublicKeyDigest && interest->publisherPublicKeyDigestLength > 0) {
- if (error = ndn_BinaryXMLEncoder_writeBlobDTagElement
- (encoder, ndn_BinaryXML_DTag_PublisherPublicKeyDigest, interest->publisherPublicKeyDigest, interest->publisherPublicKeyDigestLength))
- return error;
- }
+ // This will skip encoding if there is no publisherPublicKeyDigest.
+ if (error = ndn_encodeBinaryXMLPublisherPublicKeyDigest(&interest->publisherPublicKeyDigest, encoder))
+ return error;
- // This will check for no exclude.
+ // This will skip encoding if there is no exclude.
if (error = encodeExclude(&interest->exclude, encoder))
return error;
@@ -208,14 +207,12 @@
if (error = ndn_BinaryXMLDecoder_peekDTag(decoder, ndn_BinaryXML_DTag_PublisherPublicKeyDigest, &gotExpectedTag))
return error;
if (gotExpectedTag) {
- if (error = ndn_BinaryXMLDecoder_readBinaryDTagElement
- (decoder, ndn_BinaryXML_DTag_PublisherPublicKeyDigest, 0, &interest->publisherPublicKeyDigest,
- &interest->publisherPublicKeyDigestLength))
+ if (error = ndn_decodeBinaryXMLPublisherPublicKeyDigest(&interest->publisherPublicKeyDigest, decoder))
return error;
}
else {
- interest->publisherPublicKeyDigest = 0;
- interest->publisherPublicKeyDigestLength = 0;
+ interest->publisherPublicKeyDigest.publisherPublicKeyDigest = 0;
+ interest->publisherPublicKeyDigest.publisherPublicKeyDigestLength = 0;
}
if (error = ndn_BinaryXMLDecoder_peekDTag(decoder, ndn_BinaryXML_DTag_Exclude, &gotExpectedTag))