ndn_Error ExcludeLite::appendComponent(const NameLite::Component& component) { ndn_Error error; if ((error = ndn_Exclude_appendComponent(this, 0, 0))) return error; ndn_NameComponent_setFromNameComponent (&entries[nEntries - 1].component, &component); return NDN_ERROR_success; }
static ndn_Error decodeExclude(struct ndn_Exclude *exclude, struct ndn_TlvDecoder *decoder) { ndn_Error error; size_t endOffset; if ((error = ndn_TlvDecoder_readNestedTlvsStart(decoder, ndn_Tlv_Exclude, &endOffset))) return error; exclude->nEntries = 0; while (decoder->offset < endOffset) { int gotExpectedTag; if ((error = ndn_TlvDecoder_peekType (decoder, ndn_Tlv_Any, endOffset, &gotExpectedTag))) return error; if (gotExpectedTag) { // Read past the Any TLV. int dummyValue; if ((error = ndn_TlvDecoder_readBooleanTlv (decoder, ndn_Tlv_Any, endOffset, &dummyValue))) return error; if ((error = ndn_Exclude_appendAny(exclude))) return error; } else { // First append an empty component, then decode into it. if ((error = ndn_Exclude_appendComponent(exclude, 0, 0))) return error; if ((error = ndn_decodeTlvNameComponent (&exclude->entries[exclude->nEntries - 1].component, decoder))) return error; exclude->entries[exclude->nEntries - 1].type = ndn_Exclude_COMPONENT; } } if ((error = ndn_TlvDecoder_finishNestedTlvs(decoder, endOffset))) return error; return NDN_ERROR_success; }
ndn_Error ExcludeLite::appendComponent(const uint8_t* component, size_t componentLength) { return ndn_Exclude_appendComponent(this, component, componentLength); }