118 static constexpr char *
COLDSTART =
"1.3.6.1.6.3.1.1.5.1";
119 static constexpr char *
WARMSTART =
"1.3.6.1.6.3.1.1.5.2";
120 static constexpr char *
LINKDOWN =
"1.3.6.1.6.3.1.1.5.3";
121 static constexpr char *
LINKUP =
"1.3.6.1.6.3.1.1.5.4";
166 virtual const unsigned int getSize(
const bool refresh =
false) {
263 void setError(
const uint8_t status,
const uint8_t index) {
342 void setTrap(
const uint8_t generic,
const uint8_t specific = 0) {
virtual void decode(Stream &stream, const uint8_t flag=Flag::None)
void remove()
Removes the last BER in the array.
BER * operator[](const unsigned int index)
BER * add(BER *ber)
Adds a BER to the array.
virtual void encode(Stream &stream)
virtual const unsigned int getSize(const bool refresh=false)
Gets the size of the ArrayBER.
const unsigned int getType() const
Gets the BER type.
BER object to handle IP address.
BER object to handle integer.
Helper class to defines some useful SNMP OIDs.
static constexpr char * LINKUP
static constexpr char * SNMPTRAPOID
static constexpr char * COLDSTART
static constexpr char * LINKDOWN
static constexpr char * SNMPTRAPENTERPRISE
static constexpr char * WARMSTART
static constexpr char * SYSUPTIME
static constexpr char * AUTHENTICATIONFAILURE
void setRequestID(const int32_t requestId)
Sets the request identifier.
const char * getCommunity() const
Gets the community.
const int32_t getRequestID() const
Gets the request identifier.
VarBindList * _varBindList
Message(const uint8_t version=Version::V1, const char *community=nullptr, const uint8_t type=Type::GetRequest)
Creates a Message.
void build(Stream &stream)
Builds the message to stream.
void setTrap(const uint8_t generic, const uint8_t specific=0)
Sets the generic and specific traps.
const uint8_t getType() const
Gets the type.
const uint8_t mapErrorStatus(const uint8_t status) const
Maps error status.
void setNonRepeaters(const uint8_t nonRepeaters)
Sets the non repeaters.
VarBindList * getVarBindList() const
Gets the variable bindings list.
const uint8_t getErrorStatus() const
Gets the error status.
void setMaxRepetitions(const uint8_t maxRepetitions)
Sets the maximum repetition.
void parse(Stream &stream)
Parses the message from stream.
void setSNMPTrapOID(const char *name)
Sets the SNMPTRAPOID variable binding.
void build()
Builds the message.
VarBind * add(const char *oid, BER *value=nullptr)
Adds a VarBind.
const uint8_t getVersion() const
Gets the version.
virtual const unsigned int getSize(const bool refresh=false)
Gets the size of the message.
void setEnterprise(const char *enterprise)
Sets the enterprise.
const uint8_t getNonRepeaters() const
Gets the non repeaters.
void setAgentAddress(IPAddress agentAddr)
Sets the agent address.
void build(uint8_t *buffer)
Builds the message to buffer.
void setError(const uint8_t status, const uint8_t index)
Sets error status and error index.
void parse()
Parses the message.
const uint8_t getErrorIndex() const
Gets the error index.
void parse(uint8_t *buffer)
Parses the message from buffer.
virtual ~Message()
Message destructor.
const uint8_t getMaxRepetition() const
Gets the maximum repetition.
BER object to handle OID.
BER object to handle octet string.
Helper class to handle PDU.
PDU()
Creates a PDU object.
BER object to handle sequence of BER objects.
SequenceBER(const uint8_t type=Type::Sequence)
Creates a SequenceBER.
BER object to handle time.
BER object to handle variable binding.
BER object to handle a list of variable bindings.
Helper struct to handle SNMP error.
Helper struct to handle GetBulkRequest PDU.
Helper struct to handle generic PDU.
Generic()
Initializes to default values.
Helper struct to handle trap PDU.