23 #include "../encoding/block-helpers.hpp"
24 #include "../encoding/tlv-nfd.hpp"
32 static_assert(std::is_base_of<tlv::Error, ControlResponse::Error>::value,
33 "ControlResponse::Error must inherit from tlv::Error");
77 throw Error(
"Requested decoding of ControlResponse, but Block is of different type");
81 throw Error(
"Incorrect ControlResponse format (StatusCode missing or not the first item)");
88 throw Error(
"Incorrect ControlResponse format (StatusText missing or not the second item)");
90 m_text.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
Copyright (c) 2013-2016 Regents of the University of California.
Class representing a wire element of NDN-TLV packet format.
const Block & wireEncode() const
Block makeNonNegativeIntegerBlock(uint32_t type, uint64_t value)
Create a TLV block type type containing non-negative integer value.
const std::string & getText() const
uint64_t readNonNegativeInteger(const Block &block)
Helper to read a non-negative integer from a block.
element_const_iterator elements_end() const
element_const_iterator elements_begin() const
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.
element_container::const_iterator element_const_iterator
void push_back(const Block &element)
std::ostream & operator<<(std::ostream &os, const ControlResponse &response)
void parse() const
Parse wire buffer into subblocks.
void wireDecode(const Block &block)
void encode()
Encode subblocks into wire buffer.
bool hasWire() const
Check if the Block has fully encoded wire.
a concept check for TLV abstraction with .wireEncode method
a concept check for TLV abstraction with .wireDecode method and constructible from Block ...