ForwardingFlags: Added ForwardingFlags class and use it in registerPrefix and ForwardingEntry instead of int flags.
diff --git a/ndn-cpp/c/encoding/binary-xml-forwarding-entry.c b/ndn-cpp/c/encoding/binary-xml-forwarding-entry.c
index e8987db..8788cec 100644
--- a/ndn-cpp/c/encoding/binary-xml-forwarding-entry.c
+++ b/ndn-cpp/c/encoding/binary-xml-forwarding-entry.c
@@ -25,8 +25,9 @@
if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
(encoder, ndn_BinaryXml_DTag_FaceID, forwardingEntry->faceId)))
return error;
- if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
- (encoder, ndn_BinaryXml_DTag_ForwardingFlags, forwardingEntry->forwardingFlags)))
+ if ((error = ndn_BinaryXmlEncoder_writeUnsignedDecimalIntDTagElement
+ (encoder, ndn_BinaryXml_DTag_ForwardingFlags,
+ ndn_ForwardingFlags_getForwardingEntryFlags(&forwardingEntry->forwardingFlags))))
return error;
if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
(encoder, ndn_BinaryXml_DTag_FreshnessSeconds, forwardingEntry->freshnessSeconds)))
@@ -54,9 +55,17 @@
if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
(decoder, ndn_BinaryXml_DTag_FaceID, &forwardingEntry->faceId)))
return error;
+
+ int forwardingEntryFlags;
if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
- (decoder, ndn_BinaryXml_DTag_ForwardingFlags, &forwardingEntry->forwardingFlags)))
+ (decoder, ndn_BinaryXml_DTag_ForwardingFlags, &forwardingEntryFlags)))
return error;
+ if (forwardingEntryFlags >= 0)
+ ndn_ForwardingFlags_setForwardingEntryFlags(&forwardingEntry->forwardingFlags, forwardingEntryFlags);
+ else
+ // This sets the default flags.
+ ndn_ForwardingFlags_initialize(&forwardingEntry->forwardingFlags);
+
if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
(decoder, ndn_BinaryXml_DTag_FreshnessSeconds, &forwardingEntry->freshnessSeconds)))
return error;