An MetaInfo holds the meta info which is signed inside the data packet. More...
#include <meta-info.hpp>
Classes | |
class | Error |
Public Member Functions | |
MetaInfo () | |
MetaInfo (const Block &block) | |
Create from wire encoding. More... | |
template<encoding::Tag TAG> | |
size_t | wireEncode (EncodingImpl< TAG > &encoder) const |
const Block & | wireEncode () const |
void | wireDecode (const Block &wire) |
uint32_t | getType () const |
MetaInfo & | setType (uint32_t type) |
set ContentType More... | |
const time::milliseconds & | getFreshnessPeriod () const |
MetaInfo & | setFreshnessPeriod (const time::milliseconds &freshnessPeriod) |
const name::Component & | getFinalBlockId () const |
MetaInfo & | setFinalBlockId (const name::Component &finalBlockId) |
const std::list< Block > & | getAppMetaInfo () const |
Get all app-defined MetaInfo items. More... | |
MetaInfo & | setAppMetaInfo (const std::list< Block > &info) |
Set app-defined MetaInfo items. More... | |
MetaInfo & | addAppMetaInfo (const Block &block) |
Add an app-defined MetaInfo item. More... | |
bool | removeAppMetaInfo (uint32_t tlvType) |
Remove a first app-defined MetaInfo item with type tlvType . More... | |
const Block * | findAppMetaInfo (uint32_t tlvType) const |
Find a first app-defined MetaInfo item of type tlvType . More... | |
bool | operator== (const MetaInfo &other) const |
bool | operator!= (const MetaInfo &other) const |
An MetaInfo holds the meta info which is signed inside the data packet.
The class allows experimentation with application-defined meta information blocks, which slightly violates NDN-TLV specification. When using the application-defined meta information blocks be aware that this may result in packet drop (NFD and previous versions of ndn-cxx will gracefully accept such packet).
The following definition of MetaInfo block is assumed in this implementation (compared to the NDN-TLV spec, definition extended to allow optional AppMetaInfo TLV blocks):
MetaInfo ::= META-INFO-TYPE TLV-LENGTH ContentType? FreshnessPeriod? FinalBlockId? AppMetaInfo* AppMetaInfo ::= any TLV block with type in the restricted application range [128, 252]
Note that AppMetaInfo blocks are application-defined and must have TLV type from the restricted application range [128, 252].
Definition at line 56 of file meta-info.hpp.
ndn::MetaInfo::MetaInfo | ( | ) |
Definition at line 35 of file meta-info.cpp.
Referenced by ndn::MetaInfo::Error::Error().
|
explicit |
size_t ndn::MetaInfo::wireEncode | ( | EncodingImpl< TAG > & | encoder | ) | const |
Definition at line 130 of file meta-info.cpp.
References ndn::tlv::ContentType, ndn::tlv::ContentType_Blob, ndn::name::Component::empty(), ndn::tlv::FinalBlockId, ndn::tlv::FreshnessPeriod, ndn::tlv::MetaInfo, ndn::encoding::prependNestedBlock(), and ndn::encoding::prependNonNegativeIntegerBlock().
Referenced by operator==(), and ndn::Data::wireEncode().
const Block & ndn::MetaInfo::wireEncode | ( | ) | const |
Definition at line 176 of file meta-info.cpp.
References ndn::Block::hasWire().
Referenced by ndn::MetaInfo::Error::Error(), and operator==().
void ndn::MetaInfo::wireDecode | ( | const Block & | wire | ) |
Definition at line 192 of file meta-info.cpp.
References ndn::Block::blockFromValue(), ndn::tlv::ContentType, ndn::tlv::ContentType_Blob, ndn::Block::elements(), ndn::Block::elements_begin(), ndn::Block::elements_end(), ndn::tlv::FinalBlockId, ndn::tlv::FreshnessPeriod, ndn::tlv::NameComponent, ndn::Block::parse(), ndn::encoding::readNonNegativeInteger(), ndn::Block::reset(), and ndn::Block::type().
Referenced by ndn::MetaInfo::Error::Error(), MetaInfo(), and ndn::Data::wireDecode().
|
inline |
Definition at line 202 of file meta-info.hpp.
Referenced by ndn::MetaInfo::Error::Error(), and ndn::operator<<().
MetaInfo & ndn::MetaInfo::setType | ( | uint32_t | type | ) |
set ContentType
type | a code defined in tlv::ContentTypeValue |
Definition at line 47 of file meta-info.cpp.
References ndn::Block::reset().
Referenced by ndn::MetaInfo::Error::Error(), ndn::mgmt::Dispatcher::removeTopPrefix(), nfd::ManagerBase::sendNack(), and ndn::Data::setContentType().
|
inline |
Definition at line 208 of file meta-info.hpp.
Referenced by ndn::MetaInfo::Error::Error(), and ndn::operator<<().
MetaInfo & ndn::MetaInfo::setFreshnessPeriod | ( | const time::milliseconds & | freshnessPeriod | ) |
Definition at line 55 of file meta-info.cpp.
References ndn::Block::reset().
Referenced by ndn::MetaInfo::Error::Error(), and ndn::Data::setFreshnessPeriod().
|
inline |
Definition at line 214 of file meta-info.hpp.
Referenced by nfd::rib::RibManager::enableLocalControlHeader(), ndn::MetaInfo::Error::Error(), ndn::util::SegmentFetcher::fetch(), and ndn::operator<<().
MetaInfo & ndn::MetaInfo::setFinalBlockId | ( | const name::Component & | finalBlockId | ) |
Definition at line 63 of file meta-info.cpp.
References ndn::Block::reset().
Referenced by ndn::MetaInfo::Error::Error(), and ndn::Data::setFinalBlockId().
const std::list< Block > & ndn::MetaInfo::getAppMetaInfo | ( | ) | const |
Get all app-defined MetaInfo items.
Definition at line 71 of file meta-info.cpp.
Referenced by ndn::MetaInfo::Error::Error(), and ndn::operator<<().
Set app-defined MetaInfo items.
This method will replace all existing app-defined MetaInfo items, if they existed.
Error | if some block in info has type not in the application range (http://named-data.net/doc/ndn-tlv/types.html) |
Definition at line 77 of file meta-info.cpp.
References ndn::Block::reset().
Referenced by ndn::MetaInfo::Error::Error().
Add an app-defined MetaInfo item.
Error | if block has type not in the application range (http://named-data.net/doc/ndn-tlv/types.html) |
Definition at line 91 of file meta-info.cpp.
References ndn::Block::reset(), and ndn::Block::type().
Referenced by ndn::MetaInfo::Error::Error().
bool ndn::MetaInfo::removeAppMetaInfo | ( | uint32_t | tlvType | ) |
Remove a first app-defined MetaInfo item with type tlvType
.
Definition at line 103 of file meta-info.cpp.
References ndn::Block::reset().
Referenced by ndn::MetaInfo::Error::Error().
const Block * ndn::MetaInfo::findAppMetaInfo | ( | uint32_t | tlvType | ) | const |
Find a first app-defined MetaInfo item of type tlvType
.
Error | if tlvType is not in the application range (http://named-data.net/doc/ndn-tlv/types.html) |
Definition at line 117 of file meta-info.cpp.
Referenced by ndn::MetaInfo::Error::Error().
|
inline |
Definition at line 220 of file meta-info.hpp.
References wireEncode().
Referenced by ndn::MetaInfo::Error::Error().
|
inline |
Definition at line 226 of file meta-info.hpp.
Referenced by ndn::MetaInfo::Error::Error().