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);
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;
element_const_iterator elements_begin() const
bool hasWire() const
Check if the Block has fully encoded wire.
Copyright (c) 2011-2015 Regents of the University of California.
EncodingImpl< EstimatorTag > EncodingEstimator
const Block & getKeyDigest() const
get KeyDigest element
KeyLocator & setName(const Name &name)
set Name element
const Name & getName() const
get Name element
void wireDecode(const Block &wire)
decode from wire encoding
void parse() const
Parse wire buffer into subblocks.
KeyLocator & setKeyDigest(const Block &keyDigest)
set KeyDigest element
Class representing a wire element of NDN-TLV packet format.
KeyLocator()
construct an empty KeyLocator
indicates KeyLocator contains a Name
const Block & wireEncode() const
a concept check for TLV abstraction with .wireEncode method
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
KeyLocator & clear()
clear KeyLocator
size_t wireEncode(EncodingImpl< TAG > &encoder) const
prepend wire encoding
indicates KeyLocator contains a KeyDigest
const element_container & elements() const
Get all subelements.
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Fast encoding or block size estimation.
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.
bool operator==(const KeyLocator &other) const