|
NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
|
API Documentation
|
Go to the documentation of this file.
31 static_assert(std::is_base_of<tlv::Error, MetaInfo::Error>::value,
32 "MetaInfo::Error must inherit from tlv::Error");
56 if (freshnessPeriod < time::milliseconds::zero()) {
57 NDN_THROW(std::invalid_argument(
"FreshnessPeriod must be >= 0"));
60 m_freshnessPeriod = freshnessPeriod;
72 const std::list<Block>&
81 for (
const auto& block : info) {
82 if (block.type() < 128 || block.type() > 252)
83 NDN_THROW(
Error(
"AppMetaInfo block has type outside the application range [128, 252]"));
94 if (!(128 <= block.
type() && block.
type() <= 252))
95 NDN_THROW(
Error(
"AppMetaInfo block has type outside the application range [128, 252]"));
98 m_appMetaInfo.push_back(block);
105 for (
auto it = m_appMetaInfo.begin(); it != m_appMetaInfo.end(); ++it) {
108 m_appMetaInfo.erase(it);
118 auto it = std::find_if(m_appMetaInfo.begin(), m_appMetaInfo.end(),
119 [=] (
const Block& b) { return b.type() == tlvType; });
120 return it != m_appMetaInfo.end() ? &*it :
nullptr;
123 template<encoding::Tag TAG>
133 size_t totalLength = 0;
135 for (
auto it = m_appMetaInfo.rbegin(); it != m_appMetaInfo.rend(); ++it) {
136 totalLength += encoder.prependBlock(*it);
140 if (m_finalBlockId) {
147 static_cast<uint64_t
>(m_freshnessPeriod.count()));
155 totalLength += encoder.prependVarNumber(totalLength);
174 m_wire = buffer.block();
194 m_type = readNonNegativeIntegerAs<uint32_t>(*val);
212 m_finalBlockId.emplace(val->blockFromValue());
220 for (; val != m_wire.
elements().end(); ++val) {
221 m_appMetaInfo.push_back(*val);
229 os <<
"ContentType: " << info.
getType();
238 os <<
", FinalBlockId: ";
244 os <<
", AppMetaInfoTlvType: " << block.type();
const element_container & elements() const
Get container of sub-elements.
const time::milliseconds DEFAULT_FRESHNESS_PERIOD
element_const_iterator elements_begin() const
Equivalent to elements().begin()
void reset() noexcept
Reset the Block to a default-constructed state.
a concept check for TLV abstraction with .wireDecode method and constructible from Block
EncodingImpl< EstimatorTag > EncodingEstimator
uint64_t readNonNegativeInteger(const Block &block)
Read a non-negative integer from a TLV element.
size_t prependNestedBlock(EncodingImpl< TAG > &encoder, uint32_t type, const U &value)
Prepend a TLV element containing a nested TLV element.
uint32_t type() const
Return the TLV-TYPE of the Block.
a concept check for TLV abstraction with .wireEncode method
uint64_t tlvType
TLV-TYPE of the field; 0 if field does not exist.
const nullopt_t nullopt((nullopt_t::init()))
@ ContentType_Blob
payload
void parse() const
Parse TLV-VALUE into sub-elements.
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Prepend a TLV element containing a non-negative integer.
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(Interest)
Represents a TLV element of NDN packet format.
element_const_iterator elements_end() const
Equivalent to elements().end()
std::ostream & operator<<(std::ostream &os, const Data &data)
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
a concept check for TLV abstraction with .wireEncode method
Copyright (c) 2011-2015 Regents of the University of California.
EncodingImpl< EncoderTag > EncodingBuffer