|
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.
29 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<KeyLocator>));
33 static_assert(std::is_base_of<tlv::Error, KeyLocator::Error>::value,
34 "KeyLocator::Error must inherit from tlv::Error");
50 template<encoding::Tag TAG>
57 size_t totalLength = 0;
61 [&] (
const Name&
name) { totalLength +=
name.wireEncode(encoder); },
62 [&] (
const Block& digest) { totalLength += encoder.prependBlock(digest); },
64 visit(visitor, m_locator);
66 totalLength += encoder.prependVarNumber(totalLength);
85 m_wire = buffer.block();
100 if (element == m_wire.
elements().end()) {
104 switch (element->type()) {
106 m_locator.emplace<
Name>(*element);
109 m_locator.emplace<
Block>(*element);
112 m_locator = element->
type();
120 switch (m_locator.index()) {
128 return get<uint32_t>(m_locator);
137 m_locator = monostate{};
146 return get<Name>(m_locator);
148 catch (
const bad_variant_access&) {
165 return get<Block>(m_locator);
167 catch (
const bad_variant_access&) {
178 m_locator = keyDigest;
186 BOOST_ASSERT(keyDigest !=
nullptr);
200 os <<
"Name=" <<
name;
202 [&] (
const Block& digest) {
209 [&] (uint32_t type) {
210 os <<
"Unknown(" << type <<
")";
212 visit(visitor, keyLocator.m_locator);
const element_container & elements() const
Get container of sub-elements.
KeyLocator & clear()
Reset KeyLocator to its default-constructed state.
const Block & wireEncode() const
element_const_iterator elements_begin() const
Equivalent to elements().begin()
const Block & getKeyDigest() const
Get nested KeyDigest element.
#define NDN_CXX_UNREACHABLE
void reset() noexcept
Reset the Block to a default-constructed state.
KeyLocator & setKeyDigest(const Block &keyDigest)
Set nested KeyDigest element (whole TLV).
a concept check for TLV abstraction with .wireDecode method and constructible from Block
EncodingImpl< EstimatorTag > EncodingEstimator
Represents an absolute name.
KeyLocator()
Construct an empty KeyLocator.
KeyLocator & setName(const Name &name)
Set nested Name element.
uint32_t type() const
Return the TLV-TYPE of the Block.
void wireDecode(const Block &wire)
Decode from wire encoding.
a concept check for TLV abstraction with .wireEncode method
R visit(const Visitor &v, V1 const &arg1)
constexpr detail::make_overload_t overload
void printHex(std::ostream &os, uint64_t num, bool wantUpperCase)
Output the hex representation of num to the output stream os.
void parse() const
Parse TLV-VALUE into sub-elements.
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(Interest)
Represents a TLV element of NDN packet format.
std::string to_string(const T &val)
std::ostream & operator<<(std::ostream &os, const Data &data)
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
const Name & getName() const
Get nested Name element.
const size_t MAX_KEY_DIGEST_OCTETS_TO_SHOW
Block makeBinaryBlock(uint32_t type, const uint8_t *value, size_t length)
Create a TLV block copying TLV-VALUE from raw buffer.
shared_ptr< const Buffer > ConstBufferPtr
a concept check for TLV abstraction with .wireEncode method
Copyright (c) 2011-2015 Regents of the University of California.
EncodingImpl< EncoderTag > EncodingBuffer