|
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.
24 #ifndef NDN_ENCODING_BLOCK_HPP
25 #define NDN_ENCODING_BLOCK_HPP
104 bool verifyLength = true);
115 bool verifyLength = true);
127 Buffer::const_iterator valueBegin,
Buffer::const_iterator valueEnd);
135 Block(const uint8_t*
buf,
size_t bufSize);
238 Buffer::const_iterator
244 Buffer::const_iterator
295 Buffer::const_iterator
304 Buffer::const_iterator
314 value() const noexcept;
423 operator boost::asio::const_buffer()
const;
495 operator==(const
Block& lhs, const
Block& rhs);
500 return !(lhs == rhs);
517 operator "" _block(
const char* input, std::size_t len);
521 #endif // NDN_ENCODING_BLOCK_HPP
const element_container & elements() const
Get container of sub-elements.
size_t m_size
Total size including Type-Length-Value.
Block blockFromValue() const
size_t value_size() const noexcept
Return the size of TLV-VALUE, aka TLV-LENGTH.
element_iterator insert(element_const_iterator pos, const Block &element)
Insert a sub-element.
Block()
Create an invalid Block.
friend std::ostream & operator<<(std::ostream &os, const Block &block)
Print block to os.
bool hasValue() const noexcept
Check if the Block has a non-empty TLV-VALUE.
Buffer::const_iterator begin() const
Get begin iterator of encoded wire.
General-purpose automatically managed/resized buffer.
element_const_iterator elements_begin() const
Equivalent to elements().begin()
Buffer::const_iterator m_valueBegin
element_const_iterator find(uint32_t type) const
Find the first sub-element of the specified TLV-TYPE.
NDN_CXX_NODISCARD bool empty() const noexcept
Check if the Block is empty.
Buffer::const_iterator value_end() const
Get end iterator of TLV-VALUE.
void reset() noexcept
Reset the Block to a default-constructed state.
bool isValid() const noexcept
Check if the Block is valid.
Block & operator=(const Block &)
Copy assignment operator.
element_container::const_iterator element_const_iterator
void push_back(const Block &element)
Append a sub-element.
element_container m_elements
Contains the sub-elements.
EncodingImpl< EstimatorTag > EncodingEstimator
const Block & get(uint32_t type) const
Return the first sub-element of the specified TLV-TYPE.
void remove(uint32_t type)
Remove all sub-elements of the specified TLV-TYPE.
#define NDN_CXX_NODISCARD
static NDN_CXX_NODISCARD std::tuple< bool, Block > fromBuffer(ConstBufferPtr buffer, size_t offset)
Try to parse Block from a wire buffer.
uint32_t type() const
Return the TLV-TYPE of the Block.
element_iterator erase(element_const_iterator position)
Erase a sub-element.
Buffer::const_iterator value_begin() const
Get begin iterator of TLV-VALUE.
Buffer::const_iterator m_end
element_container::iterator element_iterator
std::vector< Block > element_container
void resetWire() noexcept
Reset wire buffer but keep TLV-TYPE and sub-elements (if any)
ConstBufferPtr getBuffer() const
Get underlying buffer.
void parse() const
Parse TLV-VALUE into sub-elements.
Buffer::const_iterator m_begin
Buffer::const_iterator end() const
Get end iterator of encoded wire.
static Block fromStream(std::istream &is)
Parse Block from an input stream.
const uint8_t * value() const noexcept
Return a raw pointer to the beginning of TLV-VALUE.
Represents a TLV element of NDN packet format.
size_t elements_size() const
Equivalent to elements().size()
size_t size() const
Return the size of the encoded wire, i.e.
element_const_iterator elements_end() const
Equivalent to elements().end()
Buffer::const_iterator m_valueEnd
Block(Block &&) noexcept
Move constructor.
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
Block(const Block &)
Copy constructor.
represents an error in TLV encoding or decoding
const uint8_t * wire() const
Return a raw pointer to the beginning of the encoded wire.
void encode()
Encode sub-elements into TLV-VALUE.
Error(const char *expectedType, uint32_t actualType)
shared_ptr< const Buffer > ConstBufferPtr
Copyright (c) 2011-2015 Regents of the University of California.
EncodingImpl< EncoderTag > EncodingBuffer
shared_ptr< const Buffer > m_buffer
Underlying buffer storing TLV-VALUE and possibly TLV-TYPE and TLV-LENGTH fields.