Class representing a wire element of NDN-TLV packet format. More...
#include <block.hpp>
Classes | |
class | Error |
Public Types | |
typedef std::vector< Block > | element_container |
typedef element_container::iterator | element_iterator |
typedef element_container::const_iterator | element_const_iterator |
Public Member Functions | |
Block () | |
Create an empty Block. More... | |
Block (const EncodingBuffer &buffer) | |
Create a Block based on EncodingBuffer object. More... | |
Block (const ConstBufferPtr &buffer) | |
Create a Block from the raw buffer with Type-Length parsing. More... | |
Block (const ConstBufferPtr &buffer, const Buffer::const_iterator &begin, const Buffer::const_iterator &end, bool verifyLength=true) | |
Create a Block from a buffer, directly specifying boundaries of the block within the buffer. More... | |
Block (const Block &block, const Buffer::const_iterator &begin, const Buffer::const_iterator &end, bool verifyLength=true) | |
Create a Block from existing block (reusing the underlying buffer), directly specifying boundaries of the block within the buffer. More... | |
Block (const uint8_t *buffer, size_t maxlength) | |
Create a Block from the raw buffer with Type-Length parsing. More... | |
Block (const void *buffer, size_t maxlength) | |
Create a Block from the raw buffer with Type-Length parsing. More... | |
Block (const ConstBufferPtr &wire, uint32_t type, const Buffer::const_iterator &begin, const Buffer::const_iterator &end, const Buffer::const_iterator &valueBegin, const Buffer::const_iterator &valueEnd) | |
Create a Block from the wire buffer (no parsing) More... | |
Block (uint32_t type) | |
Create Block of a specific type with empty wire buffer. More... | |
Block (uint32_t type, const ConstBufferPtr &value) | |
Create a Block of a specific type with the specified value. More... | |
Block (uint32_t type, const Block &value) | |
Create a nested Block of a specific type with the specified value. More... | |
DEPRECATED (static bool fromBuffer(const ConstBufferPtr &buffer, size_t offset, Block &block)) | |
DEPRECATED (static bool fromBuffer(const uint8_t *buffer, size_t maxSize, Block &block)) | |
bool | empty () const |
Check if the Block is empty. More... | |
bool | hasWire () const |
Check if the Block has fully encoded wire. More... | |
void | reset () |
Reset wire buffer of the element. More... | |
void | resetWire () |
Reset wire buffer but keep sub elements (if any) More... | |
Buffer::const_iterator | begin () const |
Buffer::const_iterator | end () const |
const uint8_t * | wire () const |
size_t | size () const |
uint32_t | type () const |
bool | hasValue () const |
Check if the Block has value block (no type and length are encoded) More... | |
Buffer::const_iterator | value_begin () const |
Buffer::const_iterator | value_end () const |
const uint8_t * | value () const |
size_t | value_size () const |
void | parse () const |
Parse wire buffer into subblocks. More... | |
void | encode () |
Encode subblocks into wire buffer. More... | |
const Block & | get (uint32_t type) const |
Get the first subelement of the requested type. More... | |
element_const_iterator | find (uint32_t type) const |
void | remove (uint32_t type) |
remove all subelements of type More... | |
element_iterator | erase (element_const_iterator position) |
element_iterator | erase (element_const_iterator first, element_const_iterator last) |
void | push_back (const Block &element) |
element_iterator | insert (element_const_iterator pos, const Block &element) |
insert Insert a new element in a specific position More... | |
const element_container & | elements () const |
Get all subelements. More... | |
element_const_iterator | elements_begin () const |
element_const_iterator | elements_end () const |
size_t | elements_size () const |
Block | blockFromValue () const |
shared_ptr< const Buffer > | getBuffer () const |
Get underlying buffer. More... | |
bool | operator== (const Block &other) const |
bool | operator!= (const Block &other) const |
operator boost::asio::const_buffer () const | |
Static Public Member Functions | |
static Block | fromStream (std::istream &is) |
Create a Block from an input stream. More... | |
static std::tuple< bool, Block > | fromBuffer (ConstBufferPtr buffer, size_t offset) |
Try to construct block from Buffer. More... | |
static std::tuple< bool, Block > | fromBuffer (const uint8_t *buffer, size_t maxSize) |
Try to construct block from raw buffer. More... | |
Protected Attributes | |
shared_ptr< const Buffer > | m_buffer |
uint32_t | m_type |
Buffer::const_iterator | m_begin |
Buffer::const_iterator | m_end |
uint32_t | m_size |
Buffer::const_iterator | m_value_begin |
Buffer::const_iterator | m_value_end |
element_container | m_subBlocks |
Class representing a wire element of NDN-TLV packet format.
typedef std::vector<Block> ndn::Block::element_container |
typedef element_container::iterator ndn::Block::element_iterator |
typedef element_container::const_iterator ndn::Block::element_const_iterator |
ndn::Block::Block | ( | ) |
Create an empty Block.
Definition at line 48 of file block.cpp.
Referenced by blockFromValue(), fromBuffer(), ndn::name::Component::fromImplicitSha256Digest(), and parse().
|
explicit |
Create a Block based on EncodingBuffer object.
Definition at line 53 of file block.cpp.
References m_begin, m_end, m_type, m_value_begin, m_value_end, ndn::tlv::readType(), and ndn::tlv::readVarNumber().
|
explicit |
Create a Block from the raw buffer with Type-Length parsing.
Definition at line 84 of file block.cpp.
References m_begin, m_end, m_type, m_value_begin, m_value_end, ndn::tlv::readType(), and ndn::tlv::readVarNumber().
ndn::Block::Block | ( | const ConstBufferPtr & | buffer, |
const Buffer::const_iterator & | begin, | ||
const Buffer::const_iterator & | end, | ||
bool | verifyLength = true |
||
) |
Create a Block from a buffer, directly specifying boundaries of the block within the buffer.
This overload will automatically detect type and position of the value within the block
Definition at line 102 of file block.cpp.
References m_begin, m_end, m_type, m_value_begin, m_value_end, ndn::tlv::readType(), and ndn::tlv::readVarNumber().
ndn::Block::Block | ( | const Block & | block, |
const Buffer::const_iterator & | begin, | ||
const Buffer::const_iterator & | end, | ||
bool | verifyLength = true |
||
) |
Create a Block from existing block (reusing the underlying buffer), directly specifying boundaries of the block within the buffer.
This overload will automatically detect type and position of the value within the block
Definition at line 122 of file block.cpp.
References m_begin, m_buffer, m_end, m_type, m_value_begin, m_value_end, ndn::tlv::readType(), and ndn::tlv::readVarNumber().
ndn::Block::Block | ( | const uint8_t * | buffer, |
size_t | maxlength | ||
) |
Create a Block from the raw buffer with Type-Length parsing.
Definition at line 147 of file block.cpp.
References m_begin, m_buffer, m_end, m_size, m_type, m_value_begin, m_value_end, ndn::tlv::readType(), and ndn::tlv::readVarNumber().
ndn::Block::Block | ( | const void * | buffer, |
size_t | maxlength | ||
) |
Create a Block from the raw buffer with Type-Length parsing.
Definition at line 170 of file block.cpp.
References m_begin, m_buffer, m_end, m_size, m_type, m_value_begin, m_value_end, ndn::tlv::readType(), and ndn::tlv::readVarNumber().
ndn::Block::Block | ( | const ConstBufferPtr & | wire, |
uint32_t | type, | ||
const Buffer::const_iterator & | begin, | ||
const Buffer::const_iterator & | end, | ||
const Buffer::const_iterator & | valueBegin, | ||
const Buffer::const_iterator & | valueEnd | ||
) |
|
explicit |
ndn::Block::Block | ( | uint32_t | type, |
const ConstBufferPtr & | value | ||
) |
Create a Block of a specific type with the specified value.
The underlying buffer holds only value Additional operations are needed to construct wire encoding, one need to prepend the wire buffer with type and value-length VAR-NUMBERs
Definition at line 200 of file block.cpp.
References m_size, m_type, ndn::tlv::sizeOfVarNumber(), and value_size().
ndn::Block::Block | ( | uint32_t | type, |
const Block & | value | ||
) |
Create a nested Block of a specific type with the specified value.
The underlying buffer holds only value. Additional operations are needed to construct wire encoding, one need to prepend the wire buffer with type and value-length VAR-NUMBERs
Definition at line 211 of file block.cpp.
References m_size, m_type, ndn::tlv::sizeOfVarNumber(), and value_size().
|
static |
Create a Block from an input stream.
Definition at line 223 of file block.cpp.
References begin(), end(), ndn::encoding::makeBinaryBlock(), ndn::encoding::makeEmptyBlock(), ndn::MAX_SIZE_OF_BLOCK_FROM_STREAM, ndn::tlv::readType(), ndn::tlv::readVarNumber(), and type().
Referenced by ns3::ndn::PacketHeader< Pkt >::Deserialize().
|
static |
Try to construct block from Buffer.
buffer | the buffer to construct block from |
offset | offset from beginning of buffer to construct Block from |
This method does not throw upon decoding error. This method does not copy the bytes.
Definition at line 253 of file block.cpp.
References Block(), ndn::tlv::readType(), ndn::tlv::readVarNumber(), and type().
Referenced by nfd::EthernetFace::close(), nfd::rib::RibManager::enableLocalControlHeader(), nfd::StreamFace< Protocol, FaceBase >::handleReceive(), nfd::WebSocketFace::handleReceive(), ndn::StreamTransportImpl< BaseTransport, Protocol >::processAll(), nfd::ndnlp::PartialMessage::reassemble(), and nfd::DatagramFace< Protocol, Addressing >::receiveDatagram().
|
inline |
|
static |
Try to construct block from raw buffer.
buffer | the raw buffer to copy bytes from |
maxSize | the maximum size of constructed block; buffer must have a size of at least maxSize |
This method does not throw upon decoding error. This method copies the bytes into a new Buffer.
Definition at line 276 of file block.cpp.
References Block(), ndn::tlv::readType(), ndn::tlv::readVarNumber(), and type().
|
inline |
Definition at line 176 of file block.hpp.
References ns3::ndn::operator!=(), and ns3::ndn::operator==().
bool ndn::Block::empty | ( | ) | const |
Check if the Block is empty.
Definition at line 465 of file block.cpp.
References m_type.
Referenced by ndn::Data::getContent().
bool ndn::Block::hasWire | ( | ) | const |
Check if the Block has fully encoded wire.
Definition at line 471 of file block.cpp.
References m_begin, m_buffer, and m_end.
Referenced by ndn::encoding::Encoder::appendBlock(), begin(), ndn::PublicKey::computeDigest(), encode(), end(), ndn::Data::getContent(), ndn::Data::getFullName(), ndn::Interest::getNonce(), ndn::Interest::hasLink(), ndn::encoding::Encoder::prependBlock(), ndn::encoding::Estimator::prependBlock(), ndn::Interest::setLink(), ndn::Interest::setNonce(), size(), nfd::ndnlp::Slicer::slice(), wire(), ndn::security::AdditionalDescription::wireDecode(), ndn::security::ValidityPeriod::wireDecode(), ndn::SignatureInfo::wireDecode(), ndn::lp::Packet::wireEncode(), ndn::nfd::FaceStatus::wireEncode(), ndn::nfd::ChannelStatus::wireEncode(), ndn::nfd::StrategyChoice::wireEncode(), ndn::nfd::FaceEventNotification::wireEncode(), ndn::nfd::FaceQueryFilter::wireEncode(), ndn::lp::NackHeader::wireEncode(), ndn::nfd::ForwarderStatus::wireEncode(), ndn::Selectors::wireEncode(), ndn::Exclude::wireEncode(), ndn::nfd::NextHopRecord::wireEncode(), ndn::mgmt::ControlResponse::wireEncode(), ndn::lp::CachePolicy::wireEncode(), ndn::MetaInfo::wireEncode(), ndn::KeyLocator::wireEncode(), ndn::nfd::ControlParameters::wireEncode(), ndn::Interest::wireEncode(), ndn::security::AdditionalDescription::wireEncode(), ndn::security::ValidityPeriod::wireEncode(), ndn::Data::wireEncode(), ndn::Name::wireEncode(), ndn::SignatureInfo::wireEncode(), ndn::nfd::FibEntry::wireEncode(), ndn::name::Component::wireEncode(), ndn::nfd::Route::wireEncode(), and ndn::nfd::RibEntry::wireEncode().
void ndn::Block::reset | ( | ) |
Reset wire buffer of the element.
Definition at line 302 of file block.cpp.
References m_begin, m_buffer, m_end, m_subBlocks, m_type, m_value_begin, and m_value_end.
Referenced by ndn::MetaInfo::addAppMetaInfo(), ndn::nfd::FibEntry::addNextHopRecord(), ndn::KeyLocator::clear(), ndn::Exclude::excludeAfter(), ndn::Exclude::excludeOne(), ndn::Exclude::excludeRange(), ndn::Data::onChanged(), ndn::MetaInfo::removeAppMetaInfo(), ndn::MetaInfo::setAppMetaInfo(), ndn::mgmt::ControlResponse::setBody(), ndn::Selectors::setChildSelector(), ndn::mgmt::ControlResponse::setCode(), ndn::nfd::NextHopRecord::setCost(), ndn::nfd::ForwarderStatus::setCurrentTimestamp(), ndn::Selectors::setExclude(), ndn::nfd::FaceStatus::setExpirationPeriod(), ndn::nfd::NextHopRecord::setFaceId(), ndn::nfd::FaceQueryFilter::setFaceId(), ndn::nfd::FaceQueryFilter::setFacePersistency(), ndn::nfd::FaceQueryFilter::setFaceScope(), ndn::MetaInfo::setFinalBlockId(), ndn::MetaInfo::setFreshnessPeriod(), ndn::SignatureInfo::setKeyLocator(), ndn::nfd::FaceEventNotification::setKind(), ndn::Interest::setLink(), ndn::nfd::FaceQueryFilter::setLinkType(), ndn::nfd::ChannelStatus::setLocalUri(), ndn::nfd::FaceQueryFilter::setLocalUri(), ndn::Selectors::setMaxSuffixComponents(), ndn::Selectors::setMinSuffixComponents(), ndn::Selectors::setMustBeFresh(), ndn::nfd::StrategyChoice::setName(), ndn::nfd::ForwarderStatus::setNCsEntries(), ndn::nfd::ForwarderStatus::setNfdVersion(), ndn::nfd::ForwarderStatus::setNFibEntries(), ndn::nfd::FaceStatus::setNInBytes(), ndn::nfd::FaceStatus::setNInDatas(), ndn::nfd::ForwarderStatus::setNInDatas(), ndn::nfd::FaceStatus::setNInInterests(), ndn::nfd::ForwarderStatus::setNInInterests(), ndn::nfd::ForwarderStatus::setNMeasurementsEntries(), ndn::nfd::ForwarderStatus::setNNameTreeEntries(), ndn::Interest::setNonce(), ndn::nfd::FaceStatus::setNOutBytes(), ndn::nfd::FaceStatus::setNOutDatas(), ndn::nfd::ForwarderStatus::setNOutDatas(), ndn::nfd::FaceStatus::setNOutInterests(), ndn::nfd::ForwarderStatus::setNOutInterests(), ndn::nfd::ForwarderStatus::setNPitEntries(), ndn::security::ValidityPeriod::setPeriod(), ndn::lp::CachePolicy::setPolicy(), ndn::nfd::FibEntry::setPrefix(), ndn::Selectors::setPublisherPublicKeyLocator(), ndn::lp::NackHeader::setReason(), ndn::nfd::FaceQueryFilter::setRemoteUri(), ndn::Interest::setSelectedDelegation(), ndn::SignatureInfo::setSignatureType(), ndn::nfd::ForwarderStatus::setStartTimestamp(), ndn::nfd::StrategyChoice::setStrategy(), ndn::mgmt::ControlResponse::setText(), ndn::MetaInfo::setType(), ndn::nfd::FaceQueryFilter::setUriScheme(), ndn::nfd::FaceQueryFilter::unsetFaceId(), ndn::nfd::FaceQueryFilter::unsetFacePersistency(), ndn::nfd::FaceQueryFilter::unsetFaceScope(), ndn::SignatureInfo::unsetKeyLocator(), ndn::Interest::unsetLink(), ndn::nfd::FaceQueryFilter::unsetLinkType(), ndn::nfd::FaceQueryFilter::unsetLocalUri(), ndn::nfd::FaceQueryFilter::unsetRemoteUri(), ndn::Interest::unsetSelectedDelegation(), ndn::nfd::FaceQueryFilter::unsetUriScheme(), ndn::SignatureInfo::unsetValidityPeriod(), ndn::MetaInfo::wireDecode(), ndn::nfd::FaceEventNotification::wireReset(), and ndn::nfd::FaceStatus::wireReset().
void ndn::Block::resetWire | ( | ) |
Reset wire buffer but keep sub elements (if any)
Definition at line 312 of file block.cpp.
References m_begin, m_buffer, m_end, m_value_begin, and m_value_end.
Referenced by erase(), insert(), push_back(), and remove().
Buffer::const_iterator ndn::Block::begin | ( | ) | const |
Definition at line 477 of file block.cpp.
References hasWire(), and m_begin.
Referenced by blockFromValue(), fromStream(), operator==(), parse(), and ndn::lp::Packet::wireDecode().
Buffer::const_iterator ndn::Block::end | ( | ) | const |
Definition at line 486 of file block.cpp.
References hasWire(), and m_end.
Referenced by blockFromValue(), ndn::RegexTopMatcher::expand(), fromStream(), operator==(), parse(), and ndn::lp::Packet::wireDecode().
const uint8_t * ndn::Block::wire | ( | ) | const |
Definition at line 495 of file block.cpp.
References hasWire(), and m_begin.
Referenced by nfd::DeadNonceList::add(), ndn::mgmt::StatusDatasetContext::append(), ndn::encoding::Encoder::appendBlock(), ndn::util::Sqlite3Statement::bind(), ndn::name::Component::Error::Error(), ndn::Data::getFullName(), ndn::security::Identity::getName(), operator boost::asio::const_buffer(), ndn::util::Digest< Hash >::operator<<(), ndn::encoding::Encoder::prependBlock(), ndn::util::DummyClientFace::receive(), ndn::io::save(), ndn::util::DummyClientFace::Transport::send(), nfd::MulticastUdpFace::sendData(), nfd::DatagramFace< Protocol, Addressing >::sendData(), nfd::WebSocketFace::sendData(), nfd::DatagramFace< Protocol, Addressing >::sendInterest(), nfd::WebSocketFace::sendInterest(), nfd::ndnlp::Slicer::slice(), and ndn::name::Component::wireDecode().
size_t ndn::Block::size | ( | ) | const |
Definition at line 504 of file block.cpp.
References hasValue(), hasWire(), and m_size.
Referenced by nfd::DeadNonceList::add(), ndn::mgmt::StatusDatasetContext::append(), ndn::encoding::Encoder::appendBlock(), ndn::util::Sqlite3Statement::bind(), ndn::WireEncodable< X >::BOOST_CONCEPT_USAGE(), nfd::EthernetFace::close(), nfd::rib::RibManager::enableLocalControlHeader(), ndn::name::Component::fromEscapedString(), ndn::Data::getFullName(), ndn::security::Identity::getName(), ndn::name::Component::getSuccessor(), nfd::StreamFace< Protocol, FaceBase >::handleReceive(), operator boost::asio::const_buffer(), ndn::util::Digest< Hash >::operator<<(), operator==(), ndn::encoding::Encoder::prependBlock(), ndn::encoding::Estimator::prependBlock(), ndn::StreamTransportImpl< BaseTransport, Protocol >::processAll(), ndn::util::DummyClientFace::receive(), nfd::DatagramFace< Protocol, Addressing >::receiveDatagram(), ndn::io::save(), ndn::util::DummyClientFace::Transport::send(), nfd::MulticastUdpFace::sendData(), nfd::DatagramFace< Protocol, Addressing >::sendData(), nfd::WebSocketFace::sendData(), nfd::DatagramFace< Protocol, Addressing >::sendInterest(), nfd::WebSocketFace::sendInterest(), ndn::security::KeyChain::signWithSha256(), nfd::ndnlp::Slicer::slice(), ndn::Validator::verifySignature(), ndn::lp::Packet::wireEncode(), and ndn::Data::wireEncode().
|
inline |
Definition at line 346 of file block.hpp.
Referenced by ndn::MetaInfo::addAppMetaInfo(), ndn::Name::append(), ndn::encoding::Encoder::appendBlock(), blockFromValue(), nfd::EthernetFace::close(), ndn::name::Component::compare(), ndn::lp::detail::DecodeHelper< TlvType, uint64_t >::decode(), ndn::lp::detail::DecodeHelper< TlvType, std::pair< Buffer::const_iterator, Buffer::const_iterator > >::decode(), nfd::LocalFace::decodeAndDispatchInput(), nfd::Face::decodeAndDispatchInput(), encode(), find(), nfd::ndnlp::NdnlpData::fromBlock(), fromBuffer(), fromStream(), ndn::Link::getDelegationFromWire(), ndn::nfd::LocalControlHeader::getPayload(), ndn::name::Component::getSuccessor(), nfd::StreamFace< Protocol, FaceBase >::handleReceive(), nfd::WebSocketFace::handleReceive(), ndn::name::Component::isGeneric(), ndn::name::Component::isImplicitSha256Digest(), parse(), ndn::encoding::Encoder::prependBlock(), ndn::encoding::Estimator::prependBlock(), nfd::DatagramFace< Protocol, Addressing >::receiveDatagram(), remove(), ndn::Data::setContent(), ndn::KeyLocator::setKeyDigest(), ndn::Signature::setValue(), ndn::name::Component::toUri(), ndn::nfd::FaceStatus::wireDecode(), ndn::nfd::ChannelStatus::wireDecode(), ndn::nfd::StrategyChoice::wireDecode(), ndn::lp::Packet::wireDecode(), ndn::nfd::FaceEventNotification::wireDecode(), ndn::lp::NackHeader::wireDecode(), ndn::nfd::FaceQueryFilter::wireDecode(), ndn::nfd::ForwarderStatus::wireDecode(), ndn::Selectors::wireDecode(), ndn::mgmt::ControlResponse::wireDecode(), ndn::nfd::NextHopRecord::wireDecode(), ndn::Exclude::wireDecode(), ndn::MetaInfo::wireDecode(), ndn::lp::CachePolicy::wireDecode(), ndn::KeyLocator::wireDecode(), ndn::nfd::ControlParameters::wireDecode(), ndn::Interest::wireDecode(), ndn::security::AdditionalDescription::wireDecode(), ndn::security::ValidityPeriod::wireDecode(), ndn::nfd::LocalControlHeader::wireDecode(), ndn::Name::wireDecode(), ndn::SignatureInfo::wireDecode(), ndn::nfd::FibEntry::wireDecode(), ndn::nfd::Route::wireDecode(), ndn::nfd::RibEntry::wireDecode(), and ndn::name::Component::wireEncode().
bool ndn::Block::hasValue | ( | ) | const |
Check if the Block has value block (no type and length are encoded)
Definition at line 514 of file block.cpp.
References m_buffer.
Referenced by ndn::name::Component::empty(), encode(), size(), value(), and value_size().
|
inline |
Definition at line 352 of file block.hpp.
Referenced by blockFromValue(), ndn::lp::detail::DecodeHelper< TlvType, std::pair< Buffer::const_iterator, Buffer::const_iterator > >::decode(), ndn::name::Component::equals(), nfd::ndnlp::NdnlpData::fromBlock(), parse(), ndn::encoding::readNonNegativeInteger(), and ndn::name::Component::toNumberWithMarker().
|
inline |
Definition at line 358 of file block.hpp.
Referenced by blockFromValue(), ndn::lp::detail::DecodeHelper< TlvType, std::pair< Buffer::const_iterator, Buffer::const_iterator > >::decode(), ndn::name::Component::equals(), parse(), ndn::encoding::readNonNegativeInteger(), and ndn::name::Component::toNumberWithMarker().
const uint8_t * ndn::Block::value | ( | ) | const |
Definition at line 520 of file block.cpp.
References hasValue(), and m_value_begin.
Referenced by ndn::encoding::Encoder::appendBlock(), ndn::name::Component::compare(), nfd::rib::RibManager::enableLocalControlHeader(), encode(), ndn::util::SegmentFetcher::fetch(), ndn::name::Component::fromEscapedString(), ndn::name::Component::fromTimestamp(), ndn::Interest::getNonce(), ndn::name::Component::getSuccessor(), ndn::name::Component::isNumberWithMarker(), ndn::encoding::Estimator::prependBlock(), ndn::encoding::Encoder::prependBlock(), ndn::encoding::readString(), ndn::Interest::setNonce(), ndn::name::Component::toTimestamp(), ndn::name::Component::toUri(), ndn::Validator::verifySignature(), ndn::SecuredBag::wireDecode(), and ndn::name::Component::wireEncode().
size_t ndn::Block::value_size | ( | ) | const |
Definition at line 529 of file block.cpp.
References hasValue(), m_value_begin, and m_value_end.
Referenced by nfd::ndnlp::PartialMessage::add(), ndn::encoding::Encoder::appendBlock(), Block(), blockFromValue(), ndn::name::Component::compare(), ndn::lp::detail::DecodeHelper< TlvType, std::pair< Buffer::const_iterator, Buffer::const_iterator > >::decode(), ndn::name::Component::empty(), nfd::rib::RibManager::enableLocalControlHeader(), encode(), ndn::name::Component::equals(), ndn::util::SegmentFetcher::fetch(), nfd::ndnlp::NdnlpData::fromBlock(), ndn::Interest::getNonce(), ndn::name::Component::getSuccessor(), ndn::name::Component::isImplicitSha256Digest(), ndn::name::Component::isNumber(), ndn::name::Component::isNumberWithMarker(), ndn::operator<<(), parse(), ndn::encoding::Estimator::prependBlock(), ndn::encoding::Encoder::prependBlock(), ndn::encoding::readNonNegativeInteger(), ndn::encoding::readString(), ndn::Interest::setNonce(), ndn::name::Component::toNumberWithMarker(), ndn::name::Component::toUri(), ndn::Validator::verifySignature(), ndn::SecuredBag::wireDecode(), and ndn::name::Component::wireEncode().
void ndn::Block::parse | ( | ) | const |
Parse wire buffer into subblocks.
This method is not really const, but it does not modify any data. It simply parses contents of the buffer into subblocks
Definition at line 322 of file block.cpp.
References begin(), Block(), end(), m_buffer, m_subBlocks, ndn::tlv::readType(), ndn::tlv::readVarNumber(), type(), value_begin(), value_end(), and value_size().
Referenced by ndn::Link::countDelegationsFromWire(), ndn::Link::decodeContent(), ndn::Link::findDelegationFromWire(), nfd::ndnlp::NdnlpData::fromBlock(), ndn::Link::getDelegationFromWire(), ndn::nfd::LocalControlHeader::getPayload(), ndn::Name::Name(), ndn::SecuredBag::wireDecode(), ndn::nfd::FaceStatus::wireDecode(), ndn::nfd::ChannelStatus::wireDecode(), ndn::nfd::StrategyChoice::wireDecode(), ndn::lp::Packet::wireDecode(), ndn::nfd::FaceEventNotification::wireDecode(), ndn::lp::NackHeader::wireDecode(), ndn::nfd::FaceQueryFilter::wireDecode(), ndn::nfd::ForwarderStatus::wireDecode(), ndn::Selectors::wireDecode(), ndn::nfd::NextHopRecord::wireDecode(), ndn::mgmt::ControlResponse::wireDecode(), ndn::Exclude::wireDecode(), ndn::MetaInfo::wireDecode(), ndn::lp::CachePolicy::wireDecode(), ndn::KeyLocator::wireDecode(), ndn::nfd::ControlParameters::wireDecode(), ndn::Interest::wireDecode(), ndn::security::AdditionalDescription::wireDecode(), ndn::security::ValidityPeriod::wireDecode(), ndn::nfd::LocalControlHeader::wireDecode(), ndn::Name::wireDecode(), ndn::SignatureInfo::wireDecode(), ndn::Data::wireDecode(), ndn::nfd::FibEntry::wireDecode(), ndn::nfd::Route::wireDecode(), ndn::nfd::RibEntry::wireDecode(), ndn::security::AdditionalDescription::wireEncode(), ndn::security::ValidityPeriod::wireEncode(), and ndn::Name::wireEncode().
void ndn::Block::encode | ( | ) |
Encode subblocks into wire buffer.
Definition at line 355 of file block.cpp.
References ndn::OBufferStream::buf(), hasValue(), hasWire(), m_begin, m_buffer, m_end, m_size, m_subBlocks, m_value_begin, m_value_end, ndn::tlv::readType(), ndn::tlv::readVarNumber(), type(), value(), value_size(), and ndn::tlv::writeVarNumber().
Referenced by ndn::PublicKey::computeDigest(), ndn::Data::getContent(), ndn::Signature::getValue(), ndn::security::KeyChain::importIdentity(), ndn::mgmt::ControlResponse::setBody(), ndn::security::KeyChain::signWithSha256(), ndn::SecuredBag::wireEncode(), and ndn::mgmt::ControlResponse::wireEncode().
const Block & ndn::Block::get | ( | uint32_t | type | ) | const |
Get the first subelement of the requested type.
Definition at line 409 of file block.cpp.
References find(), and m_subBlocks.
Referenced by ndn::Link::countDelegationsFromWire(), ndn::Link::findDelegationFromWire(), ndn::Link::getDelegationFromWire(), ndn::SecuredBag::wireDecode(), ndn::Interest::wireDecode(), and ndn::Data::wireDecode().
Block::element_const_iterator ndn::Block::find | ( | uint32_t | type | ) | const |
Definition at line 420 of file block.cpp.
References m_subBlocks, and type().
Referenced by get(), ndn::Interest::matchesData(), ndn::Selectors::wireDecode(), ndn::nfd::ControlParameters::wireDecode(), ndn::Interest::wireDecode(), and ndn::Data::wireDecode().
void ndn::Block::remove | ( | uint32_t | type | ) |
remove all subelements of type
type | TLV-TYPE of subelements to remove |
Definition at line 427 of file block.cpp.
References m_subBlocks, resetWire(), and type().
Block::element_iterator ndn::Block::erase | ( | Block::element_const_iterator | position | ) |
Definition at line 538 of file block.cpp.
References m_subBlocks, and resetWire().
Block::element_iterator ndn::Block::erase | ( | Block::element_const_iterator | first, |
Block::element_const_iterator | last | ||
) |
Definition at line 552 of file block.cpp.
References m_subBlocks, and resetWire().
void ndn::Block::push_back | ( | const Block & | element | ) |
Definition at line 568 of file block.cpp.
References m_subBlocks, and resetWire().
Referenced by ndn::Name::appendImplicitSha256Digest(), ndn::Name::appendNumber(), ndn::Name::appendNumberWithMarker(), ndn::Name::appendSegment(), ndn::Name::appendSegmentOffset(), ndn::Name::appendSequenceNumber(), ndn::Name::appendTimestamp(), ndn::Name::appendVersion(), ndn::SecuredBag::SecuredBag(), and ndn::mgmt::ControlResponse::wireEncode().
Block::element_iterator ndn::Block::insert | ( | Block::element_const_iterator | pos, |
const Block & | element | ||
) |
insert Insert a new element in a specific position
pos | Position to insert the new element |
element | Element to be inserted |
Definition at line 575 of file block.cpp.
References m_subBlocks, and resetWire().
Referenced by ndn::lp::Packet::add().
|
inline |
Get all subelements.
Definition at line 364 of file block.hpp.
Referenced by ndn::Link::decodeContent(), ndn::Link::findDelegationFromWire(), nfd::ndnlp::NdnlpData::fromBlock(), ndn::lp::Packet::get(), ndn::Link::getDelegationFromWire(), ndn::nfd::LocalControlHeader::getPayload(), ndn::lp::Packet::list(), ndn::lp::Packet::wireDecode(), ndn::MetaInfo::wireDecode(), ndn::KeyLocator::wireDecode(), ndn::security::AdditionalDescription::wireDecode(), ndn::security::ValidityPeriod::wireDecode(), and ndn::lp::Packet::wireEncode().
Block::element_const_iterator ndn::Block::elements_begin | ( | ) | const |
Definition at line 589 of file block.cpp.
References m_subBlocks.
Referenced by ndn::nfd::FaceStatus::wireDecode(), ndn::nfd::ChannelStatus::wireDecode(), ndn::nfd::StrategyChoice::wireDecode(), ndn::nfd::FaceEventNotification::wireDecode(), ndn::lp::NackHeader::wireDecode(), ndn::nfd::FaceQueryFilter::wireDecode(), ndn::nfd::ForwarderStatus::wireDecode(), ndn::mgmt::ControlResponse::wireDecode(), ndn::nfd::NextHopRecord::wireDecode(), ndn::Exclude::wireDecode(), ndn::MetaInfo::wireDecode(), ndn::lp::CachePolicy::wireDecode(), ndn::KeyLocator::wireDecode(), ndn::security::AdditionalDescription::wireDecode(), ndn::nfd::LocalControlHeader::wireDecode(), ndn::SignatureInfo::wireDecode(), ndn::nfd::FibEntry::wireDecode(), ndn::nfd::Route::wireDecode(), and ndn::nfd::RibEntry::wireDecode().
Block::element_const_iterator ndn::Block::elements_end | ( | ) | const |
Definition at line 595 of file block.cpp.
References m_subBlocks.
Referenced by ndn::Interest::matchesData(), ndn::nfd::FaceStatus::wireDecode(), ndn::nfd::ChannelStatus::wireDecode(), ndn::nfd::StrategyChoice::wireDecode(), ndn::nfd::FaceEventNotification::wireDecode(), ndn::nfd::FaceQueryFilter::wireDecode(), ndn::nfd::ForwarderStatus::wireDecode(), ndn::Selectors::wireDecode(), ndn::mgmt::ControlResponse::wireDecode(), ndn::nfd::NextHopRecord::wireDecode(), ndn::Exclude::wireDecode(), ndn::MetaInfo::wireDecode(), ndn::lp::CachePolicy::wireDecode(), ndn::nfd::ControlParameters::wireDecode(), ndn::Interest::wireDecode(), ndn::security::AdditionalDescription::wireDecode(), ndn::nfd::LocalControlHeader::wireDecode(), ndn::SignatureInfo::wireDecode(), ndn::Data::wireDecode(), ndn::nfd::FibEntry::wireDecode(), ndn::nfd::Route::wireDecode(), and ndn::nfd::RibEntry::wireDecode().
size_t ndn::Block::elements_size | ( | ) | const |
Definition at line 601 of file block.cpp.
References m_subBlocks.
Referenced by ndn::Link::countDelegationsFromWire(), ndn::nfd::LocalControlHeader::getPayload(), ndn::lp::NackHeader::wireDecode(), ndn::Exclude::wireDecode(), ndn::security::AdditionalDescription::wireDecode(), and ndn::security::ValidityPeriod::wireDecode().
Block ndn::Block::blockFromValue | ( | ) | const |
Definition at line 437 of file block.cpp.
References begin(), Block(), end(), m_buffer, ndn::tlv::readType(), ndn::tlv::readVarNumber(), type(), value_begin(), value_end(), and value_size().
Referenced by ndn::nfd::Controller::Controller(), nfd::ManagerBase::extractParameters(), nfd::ndnlp::PartialMessage::reassembleSingle(), nfd::rib::RibManager::setConfigFile(), ndn::SecuredBag::wireDecode(), and ndn::MetaInfo::wireDecode().
|
inline |
bool ndn::Block::operator== | ( | const Block & | other | ) | const |
bool ndn::Block::operator!= | ( | const Block & | other | ) | const |
Definition at line 607 of file block.cpp.
References operator==().
ndn::Block::operator boost::asio::const_buffer | ( | ) | const |
|
protected |
Definition at line 321 of file block.hpp.
Referenced by Block(), blockFromValue(), encode(), hasValue(), hasWire(), parse(), reset(), and resetWire().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Definition at line 329 of file block.hpp.
Referenced by Block(), encode(), reset(), resetWire(), value(), and value_size().
|
protected |
Definition at line 330 of file block.hpp.
Referenced by Block(), encode(), reset(), resetWire(), and value_size().
|
mutableprotected |
Definition at line 332 of file block.hpp.
Referenced by elements_begin(), elements_end(), elements_size(), encode(), erase(), find(), get(), insert(), parse(), push_back(), remove(), and reset().