22 #ifndef NDN_TLV_DECODER_HPP
23 #define NDN_TLV_DECODER_HPP
26 #include "../c/encoding/tlv/tlv-decoder.h"
42 ndn_TlvDecoder_initialize(
this, input, inputLength);
46 readNestedTlvsStart(
unsigned int expectedType)
50 if ((error = ndn_TlvDecoder_readNestedTlvsStart
51 (
this, expectedType, &endOffset)))
52 throw runtime_error(ndn_getErrorString(error));
58 finishNestedTlvs(
int endOffset)
61 if ((error = ndn_TlvDecoder_finishNestedTlvs(
this, endOffset)))
62 throw runtime_error(ndn_getErrorString(error));
66 peekType(
unsigned int expectedType,
size_t endOffset)
70 if ((error = ndn_TlvDecoder_peekType
71 (
this, expectedType, endOffset, &gotExpectedType)))
72 throw runtime_error(ndn_getErrorString(error));
74 return gotExpectedType != 0 ?
true :
false;
78 readNonNegativeIntegerTlv(
unsigned int expectedType)
82 if ((error = ndn_TlvDecoder_readNonNegativeIntegerTlv
83 (
this, expectedType, &value)))
84 throw runtime_error(ndn_getErrorString(error));
90 readBlobTlv(unsigned int expectedType)
94 if ((error = ndn_TlvDecoder_readBlobTlv(
this, expectedType, &value)))
95 throw runtime_error(ndn_getErrorString(error));
101 readBooleanTlv(
unsigned int expectedType,
size_t endOffset)
105 if ((error = ndn_TlvDecoder_readBooleanTlv
106 (
this, expectedType, endOffset, &value)))
107 throw runtime_error(ndn_getErrorString(error));
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:35
TlvDecoder(const uint8_t *input, size_t inputLength)
Initialize the base ndn_TlvDecoder struct with the input.
Definition: tlv-decoder.hpp:40
Copyright (C) 2015-2016 Regents of the University of California.
A TlvDecoder extends a C ndn_TlvDecoder struct and wraps related functions.
Definition: tlv-decoder.hpp:35
const uint8_t * value
pointer to the pre-allocated buffer for the value.
Definition: blob-types.h:34
Copyright (C) 2015-2016 Regents of the University of California.
Definition: blob-types.h:33
Copyright (C) 2014-2016 Regents of the University of California.
Definition: tlv-decoder.h:34