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

BER object to handle variable binding. More...

#include <src/BER.h>

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

Public Member Functions

 VarBind (const char *oid, BER *value=nullptr)
 Creates a VarBind.
 
const char * getName () const
 Gets variable binding name.
 
BERgetValue () const
 Gets variable binding value.
 
- Public Member Functions inherited from SNMP::ArrayBER< 2 >
 ArrayBER (const uint8_t type)
 Creates an ArrayBER.
 
 ~ArrayBER ()
 ArrayBER destructor.
 
virtual void encode (Stream &stream)
 Encodes ArrayBER to stream.
 
virtual uint8_t * encode (uint8_t *buffer)
 Encodes ArrayBER to memory buffer.
 
virtual void decode (Stream &stream, const uint8_t flag=Flag::None)
 Decodes ArrayBER from stream.
 
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.
 
BERoperator[] (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.
 

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::ArrayBER< 2 >
BERadd (BER *ber)
 Adds a BER to the array.
 
void remove ()
 Removes the last BER in the array.
 
- 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 variable binding.

A variable binding is a specialized array of BER. It contains 2 BER objects.

  • An OID BER.
  • A value BER of any type.

Definition at line 1974 of file BER.h.

Constructor & Destructor Documentation

◆ VarBind()

SNMP::VarBind::VarBind ( const char * oid,
BER * value = nullptr )
inline

Creates a VarBind.

Parameters
oidOID BER value.
valueBER of any type. If not set a NullBER is created.

Definition at line 1982 of file BER.h.

References SNMP::ArrayBER< 2 >::add().

Member Function Documentation

◆ getName()

const char * SNMP::VarBind::getName ( ) const
inline

Gets variable binding name.

This function is a shortcut to the OID value of the variable binding.

Returns
OID BER value.

Definition at line 1999 of file BER.h.

References SNMP::ArrayBER< 2 >::_bers, and getValue().

◆ getValue()

BER * SNMP::VarBind::getValue ( ) const
inline

Gets variable binding value.

This function is a shortcut to the value BER of the variable binding.

Returns
Value BER.

Definition at line 2010 of file BER.h.

References SNMP::ArrayBER< 2 >::_bers.

Referenced by getName().


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