32 static_assert(std::is_base_of<tlv::Error, MetaInfo::Error>::value,
33 "MetaInfo::Error must inherit from tlv::Error");
57 if (freshnessPeriod < time::milliseconds::zero()) {
58 BOOST_THROW_EXCEPTION(std::invalid_argument(
"FreshnessPeriod must be >= 0"));
61 m_freshnessPeriod = freshnessPeriod;
69 m_finalBlockId = finalBlockId;
73 const std::list<Block>&
82 for (std::list<Block>::const_iterator i = info.begin(); i != info.end(); ++i) {
83 if (!(128 <= i->type() && i->type() <= 252))
84 BOOST_THROW_EXCEPTION(
Error(
"AppMetaInfo block has type outside the application range " 96 if (!(128 <= block.
type() && block.
type() <= 252))
97 BOOST_THROW_EXCEPTION(
Error(
"AppMetaInfo block has type outside the application range " 101 m_appMetaInfo.push_back(block);
108 for (std::list<Block>::iterator iter = m_appMetaInfo.begin();
109 iter != m_appMetaInfo.end(); ++iter) {
112 m_appMetaInfo.erase(iter);
122 for (std::list<Block>::const_iterator iter = m_appMetaInfo.begin();
123 iter != m_appMetaInfo.end(); ++iter) {
131 template<encoding::Tag TAG>
141 size_t totalLength = 0;
143 for (std::list<Block>::const_reverse_iterator appMetaInfoItem = m_appMetaInfo.rbegin();
144 appMetaInfoItem != m_appMetaInfo.rend(); ++appMetaInfoItem) {
145 totalLength += encoder.prependBlock(*appMetaInfoItem);
149 if (!m_finalBlockId.
empty()) {
163 totalLength += encoder.prependVarNumber(totalLength);
182 m_wire = buffer.block();
203 m_type = readNonNegativeIntegerAs<uint32_t>(*val);
234 for (; val != m_wire.
elements().end(); ++val) {
235 m_appMetaInfo.push_back(*val);
243 os <<
"ContentType: " << info.
getType();
252 os <<
", FinalBlockId: ";
257 for (std::list<Block>::const_iterator iter = info.
getAppMetaInfo().begin();
259 os <<
", AppMetaInfoTlvType: " << iter->type();
Copyright (c) 2013-2017 Regents of the University of California.
const element_container & elements() const
Get container of sub elements.
BOOST_CONCEPT_ASSERT((boost::EqualityComparable< Data >))
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Prepend a TLV element containing a non-negative integer.
std::ostream & operator<<(std::ostream &os, const Data &data)
element_container::const_iterator element_const_iterator
size_t prependNestedBlock(EncodingImpl< TAG > &encoder, uint32_t type, const U &value)
Prepend a TLV element containing a nested TLV element.
Represents a TLV element of NDN packet format.
uint64_t readNonNegativeInteger(const Block &block)
Read a non-negative integer from a TLV element.
const time::milliseconds DEFAULT_FRESHNESS_PERIOD
Block blockFromValue() const
void toUri(std::ostream &os) const
Write *this to the output stream, escaping characters according to the NDN URI Scheme.
#define NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(ClassName)
void reset()
Reset wire buffer of the element.
void parse() const
Parse TLV-VALUE into sub elements.
uint32_t type() const
Get TLV-TYPE.
indicates content is the actual data bits
uint64_t tlvType
TLV-TYPE of the field; 0 if field does not exist.
Component holds a read-only name component value.
bool hasWire() const
Check if the Block has fully encoded wire.
element_const_iterator elements_end() const
Equivalent to elements().end()
element_const_iterator elements_begin() const
Equivalent to elements().begin()
EncodingImpl< EncoderTag > EncodingBuffer
EncodingImpl< EstimatorTag > EncodingEstimator