|
SNMP 2.1.0
|
BER object to handle embedded BER object. More...
#include <src/BER.h>
Public Member Functions | |
| OpaqueBER (BER *ber) | |
| Creates an OpaqueBER. | |
| virtual | ~OpaqueBER () |
| OpaqueBER destructor. | |
| virtual void | encode (Stream &stream) |
| Encodes OpaqueBER to stream. | |
| virtual void | decode (Stream &stream, const uint8_t flag=Flag::None) |
| Decodes OpaqueBER from stream. | |
| virtual uint8_t * | encode (uint8_t *buffer) |
| Encodes OpaqueBER to memory buffer. | |
| virtual uint8_t * | decode (uint8_t *buffer) |
| Decodes OpaqueBER from memory buffer. | |
| virtual const unsigned int | getSize (const bool refresh=false) |
| Gets the size of the OpaqueBER. | |
| BER * | getBER () |
| Gets the embedded BER. | |
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. | |
Private Attributes | |
| BER * | _ber |
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 Member Functions inherited from SNMP::BER | |
| BER * | create (const Type &type) |
| Creates a BER of given type. | |
Protected Attributes inherited from SNMP::BER | |
| Length | _length |
| Type | _type |
Protected Attributes inherited from SNMP::Base | |
| unsigned int | _size = 0 |
BER object to handle embedded BER object.
Example
| BER | Encoding |
|---|---|
| 9F 78 04 C2 C7 FF FE | 44 07 9F 78 04 C2 C7 FF FE |
| SNMP::OpaqueBER::OpaqueBER | ( | BER * | ber | ) |
Creates an OpaqueBER.
| ber | BER object. |
| ber |
Definition at line 82 of file BER.cpp.
References _ber, SNMP::BER::_length, and SNMP::BER::BER().
|
inlinevirtual |
|
inlinevirtual |
Decodes OpaqueBER from stream.
Type and length are decoded by the inherited BER::decode() then the embedded BER is decoded.
Decoding of embedded BER from stream implies 3 steps.
| stream | Stream to read from. |
| flag | Decoding flag. |
Reimplemented from SNMP::BER.
Definition at line 2361 of file BER.h.
References _ber, SNMP::BER::_length, SNMP::BER::create(), SNMP::BER::decode(), SNMP::Type::decode(), SNMP::Flag::None, and SNMP::Flag::Typed.
|
inlinevirtual |
Decodes OpaqueBER from memory buffer.
Type and length are decoded by the inherited BER::decode() then the embedded BER is decoded.
| buffer | Pointer to the buffer. |
Reimplemented from SNMP::BER.
Definition at line 2400 of file BER.h.
References _ber, SNMP::BER::_length, SNMP::BER::create(), SNMP::BER::decode(), and SNMP::Type::decode().
|
inlinevirtual |
Encodes OpaqueBER to stream.
Type and length are encoded by the inherited BER::encode() then the embedded BER is encoded.
| stream | Stream to write to. |
Reimplemented from SNMP::BER.
Definition at line 2340 of file BER.h.
References _ber, and SNMP::BER::encode().
|
inlinevirtual |
Encodes OpaqueBER to memory buffer.
Type and length are encoded by the inherited BER::encode() then the embedded BER is encoded.
| buffer | Pointer to the buffer. |
Reimplemented from SNMP::BER.
Definition at line 2386 of file BER.h.
References _ber, and SNMP::BER::encode().
|
inline |
|
inlinevirtual |
Gets the size of the OpaqueBER.
The size of the OpaqueBER is computed from:
Length is the size of the embedded BER.
| refresh | If true, computes size, if false returns already computed size. |
Reimplemented from SNMP::BER.
Definition at line 2431 of file BER.h.
References _ber, SNMP::BER::_length, and SNMP::BER::getSize().
|
private |