|
SNMP 2.1.0
|
Base class for BER array of BERs. More...
#include <src/BER.h>
Public Member Functions | |
| ArrayBER (const uint8_t type) | |
| Creates an ArrayBER. | |
| ~ArrayBER () | |
| ArrayBER destructor. | |
| virtual void | encode (Stream &stream) |
| Encodes ArrayBER to stream. | |
| virtual void | decode (Stream &stream, const uint8_t flag=Flag::None) |
| Decodes ArrayBER from stream. | |
| virtual uint8_t * | encode (uint8_t *buffer) |
| Encodes ArrayBER to memory buffer. | |
| virtual uint8_t * | decode (uint8_t *buffer) |
| Decodes ArrayBER from memory buffer. | |
| virtual const unsigned int | getSize (const bool refresh=false) |
| Gets the size of the ArrayBER. | |
| BER * | operator[] (const unsigned int index) |
| Array subscript operator. | |
| const uint8_t | count () const |
| Gets the count of BERs in the array. | |
Public Member Functions inherited from SNMP::BER | |
| BER (const unsigned int type) | |
| Creates a BER object. | |
| virtual | ~BER () |
| BER destructor. | |
| template<typename T> | |
| void | encodeNumeric (T value, Stream &stream) |
| Encodes BER numeric value to stream. | |
| template<typename T> | |
| void | decodeNumeric (T *value, Stream &stream, const uint8_t flag=Flag::None) |
| Decodes BER numeric value from stream. | |
| template<typename T> | |
| uint8_t * | encodeNumeric (T value, uint8_t *buffer) |
| Encodes BER numeric value to memory buffer. | |
| template<typename T> | |
| uint8_t * | decodeNumeric (T *value, uint8_t *buffer, const uint8_t flag=Flag::None) |
| Decodes BER numeric value from memory buffer. | |
| template<typename T> | |
| void | setNegative (T value) |
| Computes BER length of a negative integer. | |
| template<typename T> | |
| void | setPositive (T value) |
| Computes BER length of a positive integer. | |
| const unsigned int | getType () const |
| Gets the BER type. | |
| const unsigned int | getLength () const |
| Gets the BER length. | |
Public Member Functions inherited from SNMP::Base | |
| void | encode7bits (uint32_t value, uint8_t *buffer, const uint8_t size) |
| Encodes integer value to memory buffer. | |
Protected Member Functions | |
| BER * | add (BER *ber) |
| Adds a BER to the array. | |
| void | remove () |
| Removes the last BER in the array. | |
Protected Member Functions inherited from SNMP::BER | |
| BER * | create (const Type &type) |
| Creates a BER of given type. | |
Private Attributes | |
| uint8_t | _count = 0 |
| std::vector< BER * > | _bers |
| BER * | _bers [U] |
Friends | |
| class | Message |
| class | VarBind |
| class | VarBindList |
Additional Inherited Members | |
Static Public Member Functions inherited from SNMP::Base | |
| static void | encode7bits (uint32_t value, Stream &stream, const uint8_t size) |
| Encodes integer value to stream. | |
Protected Attributes inherited from SNMP::BER | |
| Length | _length |
| Type | _type |
Protected Attributes inherited from SNMP::Base | |
| unsigned int | _size = 0 |
Base class for BER array of BERs.
BERs are stored in an array or a vector depending on the definition of SNMP_VECTORS.
| U | Size of the array. Used only if SNMP_VECTORS is set to 0 or undefined. |
|
inline |
Creates an ArrayBER.
| type | ArrayBER type. |
Definition at line 1723 of file BER.h.
References SNMP::BER::BER().
|
inline |
|
inlineprotected |
Adds a BER to the array.
The length of the array is updated.
| ber | BER to add. |
Definition at line 1900 of file BER.h.
References _bers, _count, SNMP::BER::_length, SNMP::BER::BER(), and SNMP::BER::getSize().
Referenced by SNMP::Message::build(), decode(), and decode().
|
inline |
|
inlinevirtual |
Decodes ArrayBER from stream.
Type and length are decoded by the inherited BER::decode() then each BER of the array is decoded.
Decoding of BER from stream implies 3 steps.
| stream | Stream to read from. |
| flag | Decoding flag. |
Reimplemented from SNMP::BER.
Definition at line 1777 of file BER.h.
References SNMP::BER::_length, add(), SNMP::BER::BER(), SNMP::BER::create(), SNMP::BER::decode(), SNMP::Type::decode(), SNMP::BER::getSize(), SNMP::Flag::None, and SNMP::Flag::Typed.
|
inlinevirtual |
Decodes ArrayBER from memory buffer.
Type and length are decoded by the inherited BER::decode() then each BER of the array is decoded.
| buffer | Pointer to the buffer. |
Reimplemented from SNMP::BER.
Definition at line 1827 of file BER.h.
References SNMP::BER::_length, add(), SNMP::BER::BER(), SNMP::BER::create(), SNMP::BER::decode(), and SNMP::Type::decode().
|
inlinevirtual |
Encodes ArrayBER to stream.
Type and length are encoded by the inherited BER::encode() then each BER of the array is encoded.
| stream | Stream to write to. |
Reimplemented from SNMP::BER.
Definition at line 1754 of file BER.h.
References _bers, _count, and SNMP::BER::encode().
|
inlinevirtual |
Encodes ArrayBER to memory buffer.
Type and length are encoded by the inherited BER::encode() then each BER of the array is encoded.
| buffer | Pointer to the buffer. |
Reimplemented from SNMP::BER.
Definition at line 1804 of file BER.h.
References _bers, _count, and SNMP::BER::encode().
|
inlinevirtual |
Gets the size of the ArrayBER.
The size of the ArrayBER is computed from:
Length is the sum of the size of all the BERs in the array.
| refresh | If true, computes size, if false returns already computed size. |
Reimplemented from SNMP::BER.
Reimplemented in SNMP::Message.
Definition at line 1860 of file BER.h.
References _bers, _count, SNMP::BER::_length, and SNMP::BER::getSize().
Referenced by SNMP::Message::getSize().
|
inline |
|
inlineprotected |
Removes the last BER in the array.
The length of the array is updated.
Definition at line 1919 of file BER.h.
References _bers, _count, and SNMP::BER::_length.
Referenced by SNMP::Message::parse().
|
friend |
|
friend |
|
friend |
|
private |
Vector of BERs.
Definition at line 1938 of file BER.h.
Referenced by add(), encode(), encode(), getSize(), operator[](), remove(), and ~ArrayBER().
|
private |
|
private |