|
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.
22 #ifndef NDN_ENCODING_ENCODER_HPP
23 #define NDN_ENCODING_ENCODER_HPP
65 template<
class Iterator>
72 template<
class Iterator>
235 size() const noexcept;
245 block(
bool verifyLength = true) const;
248 shared_ptr<
Buffer> m_buffer;
259 return m_end - m_begin;
262 inline shared_ptr<Buffer>
271 return m_buffer->size();
274 inline Buffer::iterator
280 inline Buffer::iterator
286 inline Buffer::const_iterator
292 inline Buffer::const_iterator
304 inline const uint8_t*
310 template<
class Iterator>
314 using ValueType =
typename std::iterator_traits<Iterator>::value_type;
315 static_assert(
sizeof(ValueType) == 1 && !std::is_same<ValueType, bool>::value,
"");
317 size_t length = std::distance(first, last);
321 std::copy(first, last, m_begin);
325 template<
class Iterator>
329 using ValueType =
typename std::iterator_traits<Iterator>::value_type;
330 static_assert(
sizeof(ValueType) == 1 && !std::is_same<ValueType, bool>::value,
"");
332 size_t length = std::distance(first, last);
335 std::copy(first, last, m_end);
343 #endif // NDN_ENCODING_ENCODER_HPP
size_t prependNonNegativeInteger(uint64_t integer)
Prepend non-negative integer integer of NDN TLV encoding.
size_t appendRange(Iterator first, Iterator last)
Append range of bytes from the range [first, last)
void reserveBack(size_t size)
Reserve at least size bytes at the back of the underlying buffer.
uint8_t * buf()
Get a pointer to the first byte of the encoded buffer.
size_t size() const noexcept
Get the size of the encoded buffer.
General-purpose automatically managed/resized buffer.
Helper class to perform TLV encoding Interface of this class (mostly) matches interface of Estimator ...
iterator begin()
Get an iterator pointing to the first byte of the encoded buffer.
size_t prependVarNumber(uint64_t varNumber)
Prepend VarNumber varNumber of NDN TLV encoding.
size_t prependByteArray(const uint8_t *array, size_t length)
Prepend a byte array array of length length.
size_t prependByte(uint8_t value)
Prepend a byte.
iterator end()
Get an iterator pointing to the past-the-end byte of the encoded buffer.
Buffer::value_type value_type
Block block(bool verifyLength=true) const
Create Block from the underlying buffer.
size_t prependRange(Iterator first, Iterator last)
Prepend range of bytes from the range [first, last)
Encoder(size_t totalReserve=MAX_NDN_PACKET_SIZE, size_t reserveFromBack=400)
Create instance of the encoder with the specified reserved sizes.
Buffer::const_iterator const_iterator
size_t appendByteArrayBlock(uint32_t type, const uint8_t *array, size_t arraySize)
Append TLV block of type type and value from buffer array of size arraySize.
void reserve(size_t size, bool addInFront)
Reserve size bytes for the underlying buffer.
size_t appendBlock(const Block &block)
Append TLV block block.
const size_t MAX_NDN_PACKET_SIZE
practical limit of network layer packet size
Represents a TLV element of NDN packet format.
size_t appendByte(uint8_t value)
Append a byte.
size_t appendVarNumber(uint64_t varNumber)
Prepend VarNumber varNumber of NDN TLV encoding.
shared_ptr< Buffer > getBuffer() const noexcept
Get underlying buffer.
void reserveFront(size_t size)
Reserve at least isze bytes at the beginning of the underlying buffer.
Buffer::iterator iterator
size_t appendByteArray(const uint8_t *array, size_t length)
Append a byte array array of length length.
size_t prependByteArrayBlock(uint32_t type, const uint8_t *array, size_t arraySize)
Prepend TLV block of type type and value from buffer array of size arraySize.
size_t capacity() const noexcept
Get size of the underlying buffer.
size_t prependBlock(const Block &block)
Prepend TLV block block.
size_t appendNonNegativeInteger(uint64_t integer)
Append non-negative integer integer of NDN TLV encoding.
Copyright (c) 2011-2015 Regents of the University of California.