SNMP 2.0.0
Loading...
Searching...
No Matches
SNMP::ObjectIdentifierBER Class Reference

BER object to handle OID. More...

#include <src/BER.h>

Inheritance diagram for SNMP::ObjectIdentifierBER:
[legend]
Collaboration diagram for SNMP::ObjectIdentifierBER:
[legend]

Public Member Functions

 ObjectIdentifierBER (const char *value)
 Creates an ObjectIdentifierBER object.
 
virtual void encode (Stream &stream)
 Encodes ObjectIdentifierBER to stream.
 
virtual void decode (Stream &stream, const uint8_t flag=Flag::None)
 Decodes ObjectIdentifierBER from stream.
 
virtual uint8_t * encode (uint8_t *buffer)
 Encodes ObjectIdentifierBER to memory buffer.
 
virtual uint8_t * decode (uint8_t *buffer)
 Decodes ObjectIdentifierBER from memory buffer.
 
const char * getValue () const
 Gets the ObjectIdentifierBER value.
 
void setValue (const char *value)
 Set the ObjectIdentifierBER value.
 
- 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.
 
virtual const unsigned int getSize (const bool refresh=false)
 Gets the size of the BER.
 
- 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

String _value
 

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
BERcreate (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
 

Detailed Description

BER object to handle OID.

  • Type is TYPE_OBJECTIDENTIFIER.
  • Length is variable.
  • Size is variable.

Example

Object Identifier Encoding
1.3.6.1.2.1.2.2.1.8.4096 06 0B 2B 06 01 02 01 02 02 01 08 A0 00
1.3.6.1.4.1.54858.81.1.1.1.0 06 0D 2B 06 01 04 01 83 AC 4A 51 01 01 01 00

Definition at line 1487 of file BER.h.

Constructor & Destructor Documentation

◆ ObjectIdentifierBER()

SNMP::ObjectIdentifierBER::ObjectIdentifierBER ( const char * value)
inline

Creates an ObjectIdentifierBER object.

Creates an ObjectIdentifierBER object from a pointer to a null-terminated array of char.

The constructor copies the value parameter into a string.

Parameters
valueObjectIdentifierBER char pointer value.

Definition at line 1499 of file BER.h.

References setValue().

Member Function Documentation

◆ decode() [1/2]

virtual void SNMP::ObjectIdentifierBER::decode ( Stream & stream,
const uint8_t flag = Flag::None )
inlinevirtual

Decodes ObjectIdentifierBER from stream.

Type and length are decoded by the inherited BER::decode() then ObjectIdentifierBER value is decoded.

Parameters
streamStream to read from.
flagDecoding flag.

Reimplemented from SNMP::BER.

Definition at line 1556 of file BER.h.

References SNMP::BER::_length, SNMP::Base::_size, _value, and SNMP::BER::decode().

◆ decode() [2/2]

virtual uint8_t * SNMP::ObjectIdentifierBER::decode ( uint8_t * buffer)
inlinevirtual

Decodes ObjectIdentifierBER from memory buffer.

Type and length are decoded by the inherited BER::decode() then ObjectIdentifierBER value is decoded.

Parameters
bufferPointer to the buffer.
Returns
Next position to be read in buffer.

Reimplemented from SNMP::BER.

Definition at line 1633 of file BER.h.

References SNMP::BER::_length, _value, and SNMP::BER::decode().

◆ encode() [1/2]

virtual void SNMP::ObjectIdentifierBER::encode ( Stream & stream)
inlinevirtual

Encodes ObjectIdentifierBER to stream.

Type and length are encoded by the inherited BER::encode() then ObjectIdentifierBER value is encoded.

Parameters
streamStream to write to.

Reimplemented from SNMP::BER.

Definition at line 1513 of file BER.h.

References SNMP::Base::_size, _value, SNMP::BER::encode(), and SNMP::Base::encode7bits().

◆ encode() [2/2]

virtual uint8_t * SNMP::ObjectIdentifierBER::encode ( uint8_t * buffer)
inlinevirtual

Encodes ObjectIdentifierBER to memory buffer.

Type and length are encoded by the inherited BER::encode() then ObjectIdentifierBER value is encoded.

Parameters
bufferPointer to the buffer.
Returns
Next position to be written in buffer.

Reimplemented from SNMP::BER.

Definition at line 1590 of file BER.h.

References _value, SNMP::BER::encode(), and SNMP::Base::encode7bits().

◆ getValue()

const char * SNMP::ObjectIdentifierBER::getValue ( ) const
inline

Gets the ObjectIdentifierBER value.

Returns
ObjectIdentifierBER char array pointer value.

Definition at line 1661 of file BER.h.

References _value.

◆ setValue()

void SNMP::ObjectIdentifierBER::setValue ( const char * value)
inline

Set the ObjectIdentifierBER value.

Note
Length is updated.
Parameters
valueObjectIdentifierBER char pointer value.

Definition at line 1672 of file BER.h.

References SNMP::BER::_length, and _value.

Referenced by ObjectIdentifierBER().

Member Data Documentation

◆ _value

String SNMP::ObjectIdentifierBER::_value
private

OctetStringBER string value.

Definition at line 1702 of file BER.h.

Referenced by decode(), decode(), encode(), encode(), getValue(), and setValue().


The documentation for this class was generated from the following file: