27 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<KeyLocator>));
31 static_assert(std::is_base_of<tlv::Error, KeyLocator::Error>::value,
32 "KeyLocator::Error must inherit from tlv::Error");
35 : m_type(KeyLocator_None)
49 template<encoding::Tag TAG>
56 size_t totalLength = 0;
65 totalLength += encoder.prependBlock(m_keyDigest);
68 BOOST_THROW_EXCEPTION(
Error(
"Unsupported KeyLocator type"));
71 totalLength += encoder.prependVarNumber(totalLength);
77 KeyLocator::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder)
const;
80 KeyLocator::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder)
const;
94 m_wire = buffer.block();
102 BOOST_THROW_EXCEPTION(
Error(
"Unexpected TLV type during KeyLocator decoding"));
141 BOOST_THROW_EXCEPTION(
Error(
"KeyLocator type is not Name"));
159 BOOST_THROW_EXCEPTION(
Error(
"KeyLocator type is not KeyDigest"));
168 BOOST_THROW_EXCEPTION(
Error(
"expecting KeyDigest block"));
172 m_keyDigest = keyDigest;
size_t wireEncode(EncodingImpl< TAG > &encoder) const
prepend wire encoding
Copyright (c) 2011-2015 Regents of the University of California.
EncodingImpl< EstimatorTag > EncodingEstimator
KeyLocator & setName(const Name &name)
set Name element
void wireDecode(const Block &wire)
decode from wire encoding
const element_container & elements() const
Get all subelements.
KeyLocator & setKeyDigest(const Block &keyDigest)
set KeyDigest element
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Fast encoding or block size estimation.
Class representing a wire element of NDN-TLV packet format.
KeyLocator()
construct an empty KeyLocator
indicates KeyLocator contains a Name
const Name & getName() const
get Name element
element_const_iterator elements_begin() const
a concept check for TLV abstraction with .wireEncode method
const Block & getKeyDigest() const
get KeyDigest element
EncodingImpl< EncoderTag > EncodingBuffer
Block makeBinaryBlock(uint32_t type, const uint8_t *value, size_t length)
Create a TLV block type type with value from a buffer value of size length.
indicates KeyLocator is empty (internal use only)
void reset()
Reset wire buffer of the element.
Name abstraction to represent an absolute name.
indicates KeyLocator contains an unknown element
void parse() const
Parse wire buffer into subblocks.
KeyLocator & clear()
clear KeyLocator
const Block & wireEncode() const
indicates KeyLocator contains a KeyDigest
bool hasWire() const
Check if the Block has fully encoded wire.
bool operator==(const KeyLocator &other) const
shared_ptr< const Buffer > ConstBufferPtr
void wireDecode(const Block &wire)
a concept check for TLV abstraction with .wireEncode method
a concept check for TLV abstraction with .wireDecode method and constructible from Block ...
void clear()
Clear all the components.