Jeff Thompson | 47eecfc | 2013-07-07 22:56:46 -0700 | [diff] [blame] | 1 | /** |
| 2 | * @author: Jeff Thompson |
Jeff Thompson | 06f824a | 2013-07-08 17:14:30 -0700 | [diff] [blame] | 3 | * Derived from Interest.js by Meki Cheraoui. |
Jeff Thompson | 47eecfc | 2013-07-07 22:56:46 -0700 | [diff] [blame] | 4 | * See COPYING for copyright and distribution information. |
Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 5 | */ |
| 6 | |
Jeff Thompson | 5341219 | 2013-08-06 13:35:50 -0700 | [diff] [blame] | 7 | #include "binary-xml-encoder.h" |
| 8 | #include "binary-xml-decoder.h" |
| 9 | #include "binary-xml-name.h" |
| 10 | #include "binary-xml-publisher-public-key-digest.h" |
| 11 | #include "binary-xml-interest.h" |
Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 12 | |
Jeff Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 13 | static ndn_Error encodeExclude(struct ndn_Exclude *exclude, struct ndn_BinaryXmlEncoder *encoder) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 14 | { |
| 15 | if (exclude->nEntries == 0) |
Jeff Thompson | adaf923 | 2013-08-08 14:30:29 -0700 | [diff] [blame] | 16 | return NDN_ERROR_success; |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 17 | |
| 18 | ndn_Error error; |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 19 | if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Exclude))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 20 | return error; |
| 21 | |
| 22 | // TODO: Do we want to order the components (except for ANY)? |
| 23 | unsigned int i; |
| 24 | for (i = 0; i < exclude->nEntries; ++i) { |
| 25 | struct ndn_ExcludeEntry *entry = &exclude->entries[i]; |
| 26 | |
| 27 | if (entry->type == ndn_Exclude_COMPONENT) { |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 28 | if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement |
Jeff Thompson | 38d0e08 | 2013-08-12 18:07:44 -0700 | [diff] [blame] | 29 | (encoder, ndn_BinaryXml_DTag_Component, entry->component.value, entry->component.valueLength))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 30 | return error; |
| 31 | } |
| 32 | else if (entry->type == ndn_Exclude_ANY) { |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 33 | if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Any))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 34 | return error; |
Jeff Thompson | 2d27e2f | 2013-08-09 12:55:00 -0700 | [diff] [blame] | 35 | if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 36 | return error; |
| 37 | } |
| 38 | else |
| 39 | return NDN_ERROR_unrecognized_ndn_ExcludeType; |
Jeff Thompson | 2d27e2f | 2013-08-09 12:55:00 -0700 | [diff] [blame] | 40 | } |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 41 | |
Jeff Thompson | 2d27e2f | 2013-08-09 12:55:00 -0700 | [diff] [blame] | 42 | if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 43 | return error; |
| 44 | |
Jeff Thompson | adaf923 | 2013-08-08 14:30:29 -0700 | [diff] [blame] | 45 | return NDN_ERROR_success; |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 46 | } |
| 47 | |
Jeff Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 48 | static ndn_Error decodeExclude(struct ndn_Exclude *exclude, struct ndn_BinaryXmlDecoder *decoder) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 49 | { |
| 50 | ndn_Error error; |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 51 | if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Exclude))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 52 | return error; |
| 53 | |
| 54 | exclude->nEntries = 0; |
| 55 | while (1) { |
| 56 | int gotExpectedTag; |
| 57 | |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 58 | if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Component, &gotExpectedTag))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 59 | return error; |
| 60 | if (gotExpectedTag) { |
| 61 | // Component |
| 62 | unsigned char *component; |
| 63 | unsigned int componentLen; |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 64 | if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(decoder, ndn_BinaryXml_DTag_Component, 0, &component, &componentLen))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 65 | return error; |
| 66 | |
| 67 | // Add the component entry. |
| 68 | if (exclude->nEntries >= exclude->maxEntries) |
| 69 | return NDN_ERROR_read_an_entry_past_the_maximum_number_of_entries_allowed_in_the_exclude; |
Jeff Thompson | d1427fb | 2013-08-29 17:20:32 -0700 | [diff] [blame^] | 70 | ndn_ExcludeEntry_initialize(exclude->entries + exclude->nEntries, ndn_Exclude_COMPONENT, component, componentLen); |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 71 | ++exclude->nEntries; |
| 72 | |
| 73 | continue; |
| 74 | } |
| 75 | |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 76 | if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Any, &gotExpectedTag))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 77 | return error; |
| 78 | if (gotExpectedTag) { |
| 79 | // Any |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 80 | if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Any))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 81 | return error; |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 82 | if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 83 | return error; |
| 84 | |
| 85 | // Add the any entry. |
| 86 | if (exclude->nEntries >= exclude->maxEntries) |
| 87 | return NDN_ERROR_read_an_entry_past_the_maximum_number_of_entries_allowed_in_the_exclude; |
Jeff Thompson | d1427fb | 2013-08-29 17:20:32 -0700 | [diff] [blame^] | 88 | ndn_ExcludeEntry_initialize(exclude->entries + exclude->nEntries, ndn_Exclude_ANY, 0, 0); |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 89 | ++exclude->nEntries; |
| 90 | |
| 91 | continue; |
| 92 | } |
| 93 | |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 94 | if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Bloom, &gotExpectedTag))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 95 | return error; |
| 96 | if (gotExpectedTag) { |
| 97 | // Skip the Bloom and treat it as Any. |
| 98 | unsigned char *value; |
| 99 | unsigned int valueLen; |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 100 | if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(decoder, ndn_BinaryXml_DTag_Bloom, 0, &value, &valueLen))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 101 | return error; |
| 102 | |
| 103 | // Add the any entry. |
| 104 | if (exclude->nEntries >= exclude->maxEntries) |
| 105 | return NDN_ERROR_read_an_entry_past_the_maximum_number_of_entries_allowed_in_the_exclude; |
Jeff Thompson | d1427fb | 2013-08-29 17:20:32 -0700 | [diff] [blame^] | 106 | ndn_ExcludeEntry_initialize(exclude->entries + exclude->nEntries, ndn_Exclude_ANY, 0, 0); |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 107 | ++exclude->nEntries; |
| 108 | |
| 109 | continue; |
| 110 | } |
| 111 | |
| 112 | // Else no more entries. |
| 113 | break; |
| 114 | } |
| 115 | |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 116 | if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 117 | return error; |
| 118 | |
Jeff Thompson | adaf923 | 2013-08-08 14:30:29 -0700 | [diff] [blame] | 119 | return NDN_ERROR_success; |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 120 | } |
| 121 | |
Jeff Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 122 | ndn_Error ndn_encodeBinaryXmlInterest(struct ndn_Interest *interest, struct ndn_BinaryXmlEncoder *encoder) |
Jeff Thompson | 06f824a | 2013-07-08 17:14:30 -0700 | [diff] [blame] | 123 | { |
| 124 | ndn_Error error; |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 125 | if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Interest))) |
Jeff Thompson | 06f824a | 2013-07-08 17:14:30 -0700 | [diff] [blame] | 126 | return error; |
| 127 | |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 128 | if ((error = ndn_encodeBinaryXmlName(&interest->name, encoder))) |
Jeff Thompson | 06f824a | 2013-07-08 17:14:30 -0700 | [diff] [blame] | 129 | return error; |
| 130 | |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 131 | if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement |
| 132 | (encoder, ndn_BinaryXml_DTag_MinSuffixComponents, interest->minSuffixComponents))) |
Jeff Thompson | 45492a7 | 2013-07-11 12:02:47 -0700 | [diff] [blame] | 133 | return error; |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 134 | if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement |
| 135 | (encoder, ndn_BinaryXml_DTag_MaxSuffixComponents, interest->maxSuffixComponents))) |
Jeff Thompson | 45492a7 | 2013-07-11 12:02:47 -0700 | [diff] [blame] | 136 | return error; |
Jeff Thompson | 06f824a | 2013-07-08 17:14:30 -0700 | [diff] [blame] | 137 | |
Jeff Thompson | 8238d00 | 2013-07-10 11:56:49 -0700 | [diff] [blame] | 138 | // This will skip encoding if there is no publisherPublicKeyDigest. |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 139 | if ((error = ndn_encodeBinaryXmlPublisherPublicKeyDigest(&interest->publisherPublicKeyDigest, encoder))) |
Jeff Thompson | 8238d00 | 2013-07-10 11:56:49 -0700 | [diff] [blame] | 140 | return error; |
Jeff Thompson | 06f824a | 2013-07-08 17:14:30 -0700 | [diff] [blame] | 141 | |
Jeff Thompson | 8238d00 | 2013-07-10 11:56:49 -0700 | [diff] [blame] | 142 | // This will skip encoding if there is no exclude. |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 143 | if ((error = encodeExclude(&interest->exclude, encoder))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 144 | return error; |
Jeff Thompson | 06f824a | 2013-07-08 17:14:30 -0700 | [diff] [blame] | 145 | |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 146 | if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement |
| 147 | (encoder, ndn_BinaryXml_DTag_ChildSelector, interest->childSelector))) |
Jeff Thompson | 45492a7 | 2013-07-11 12:02:47 -0700 | [diff] [blame] | 148 | return error; |
Jeff Thompson | 06f824a | 2013-07-08 17:14:30 -0700 | [diff] [blame] | 149 | if (interest->answerOriginKind >= 0 && interest->answerOriginKind != ndn_Interest_DEFAULT_ANSWER_ORIGIN_KIND) { |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 150 | if ((error = ndn_BinaryXmlEncoder_writeUnsignedDecimalIntDTagElement |
| 151 | (encoder, ndn_BinaryXml_DTag_AnswerOriginKind, (unsigned int)interest->answerOriginKind))) |
Jeff Thompson | 06f824a | 2013-07-08 17:14:30 -0700 | [diff] [blame] | 152 | return error; |
| 153 | } |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 154 | if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement |
| 155 | (encoder, ndn_BinaryXml_DTag_Scope, interest->scope))) |
Jeff Thompson | 45492a7 | 2013-07-11 12:02:47 -0700 | [diff] [blame] | 156 | return error; |
Jeff Thompson | 06f824a | 2013-07-08 17:14:30 -0700 | [diff] [blame] | 157 | |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 158 | if ((error = ndn_BinaryXmlEncoder_writeOptionalTimeMillisecondsDTagElement |
| 159 | (encoder, ndn_BinaryXml_DTag_InterestLifetime, interest->interestLifetimeMilliseconds))) |
Jeff Thompson | edc2225 | 2013-07-11 18:05:44 -0700 | [diff] [blame] | 160 | return error; |
Jeff Thompson | 06f824a | 2013-07-08 17:14:30 -0700 | [diff] [blame] | 161 | |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 162 | if ((error = ndn_BinaryXmlEncoder_writeOptionalBlobDTagElement |
| 163 | (encoder, ndn_BinaryXml_DTag_Nonce, interest->nonce, interest->nonceLength))) |
Jeff Thompson | a8749a5 | 2013-07-11 11:48:05 -0700 | [diff] [blame] | 164 | return error; |
Jeff Thompson | 06f824a | 2013-07-08 17:14:30 -0700 | [diff] [blame] | 165 | |
Jeff Thompson | 2d27e2f | 2013-08-09 12:55:00 -0700 | [diff] [blame] | 166 | if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder))) |
Jeff Thompson | 06f824a | 2013-07-08 17:14:30 -0700 | [diff] [blame] | 167 | return error; |
| 168 | |
Jeff Thompson | adaf923 | 2013-08-08 14:30:29 -0700 | [diff] [blame] | 169 | return NDN_ERROR_success; |
Jeff Thompson | 06f824a | 2013-07-08 17:14:30 -0700 | [diff] [blame] | 170 | } |
| 171 | |
Jeff Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 172 | ndn_Error ndn_decodeBinaryXmlInterest(struct ndn_Interest *interest, struct ndn_BinaryXmlDecoder *decoder) |
Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 173 | { |
Jeff Thompson | 8b66600 | 2013-07-08 01:16:26 -0700 | [diff] [blame] | 174 | ndn_Error error; |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 175 | if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Interest))) |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 176 | return error; |
| 177 | |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 178 | if ((error = ndn_decodeBinaryXmlName(&interest->name, decoder))) |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 179 | return error; |
| 180 | |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 181 | if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement |
| 182 | (decoder, ndn_BinaryXml_DTag_MinSuffixComponents, &interest->minSuffixComponents))) |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 183 | return error; |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 184 | if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement |
| 185 | (decoder, ndn_BinaryXml_DTag_MaxSuffixComponents, &interest->maxSuffixComponents))) |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 186 | return error; |
Jeff Thompson | b7f9556 | 2013-07-03 18:36:42 -0700 | [diff] [blame] | 187 | |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 188 | if ((error = ndn_decodeOptionalBinaryXmlPublisherPublicKeyDigest(&interest->publisherPublicKeyDigest, decoder))) |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 189 | return error; |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 190 | |
Jeff Thompson | 5633c30 | 2013-07-11 10:24:27 -0700 | [diff] [blame] | 191 | int gotExpectedTag; |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 192 | if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Exclude, &gotExpectedTag))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 193 | return error; |
| 194 | if (gotExpectedTag) { |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 195 | if ((error = decodeExclude(&interest->exclude, decoder))) |
Jeff Thompson | f084ec6 | 2013-07-09 12:32:52 -0700 | [diff] [blame] | 196 | return error; |
| 197 | } |
| 198 | else |
| 199 | interest->exclude.nEntries = 0; |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 200 | |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 201 | if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement |
| 202 | (decoder, ndn_BinaryXml_DTag_ChildSelector, &interest->childSelector))) |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 203 | return error; |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 204 | if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement |
| 205 | (decoder, ndn_BinaryXml_DTag_AnswerOriginKind, &interest->answerOriginKind))) |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 206 | return error; |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 207 | if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement |
| 208 | (decoder, ndn_BinaryXml_DTag_Scope, &interest->scope))) |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 209 | return error; |
| 210 | |
Jeff Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 211 | if (error= ndn_BinaryXmlDecoder_readOptionalTimeMillisecondsDTagElement |
| 212 | (decoder, ndn_BinaryXml_DTag_InterestLifetime, &interest->interestLifetimeMilliseconds)) |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 213 | return error; |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 214 | |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 215 | if ((error = ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement |
| 216 | (decoder, ndn_BinaryXml_DTag_Nonce, 0, &interest->nonce, &interest->nonceLength))) |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 217 | return error; |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 218 | |
Jeff Thompson | 94ddc27 | 2013-08-08 14:17:38 -0700 | [diff] [blame] | 219 | if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder))) |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 220 | return error; |
| 221 | |
Jeff Thompson | adaf923 | 2013-08-08 14:30:29 -0700 | [diff] [blame] | 222 | return NDN_ERROR_success; |
Jeff Thompson | 06f824a | 2013-07-08 17:14:30 -0700 | [diff] [blame] | 223 | } |