Base class for SNMP variables. More...
#include <AbstractVariable.hpp>
Public Types | |
enum | testset_result_t { noError = 0, genErr = 5, noAccess = 6, wrongType = 7, wrongLength = 8, wrongValue = 10, noCreation = 11, inconsistentValue = 12, resourceUnavailable = 13, notWritable = 17, inconsistentName = 18 } |
Result type for the TestSet validation. More... | |
Public Member Functions | |
virtual | ~AbstractVariable () |
Virtual destructor. More... | |
virtual void | handle_get ()=0 |
Handle AgentX Get request. More... | |
virtual testset_result_t | handle_testset (QSharedPointer< AbstractVariable >)=0 |
Validate whether a Set operation would be successful. More... | |
virtual void | handle_cleanupset ()=0 |
Release resources after a Set operation. More... | |
virtual bool | handle_commitset ()=0 |
Actually perform the Set operation. More... | |
virtual bool | handle_undoset ()=0 |
Undo a Set operation which was already performed. More... | |
virtual binary | serialize () const =0 |
Serialize the variable. More... | |
virtual Oid | toOid () const =0 |
Convert an INDEX variable to an Oid part. More... | |
Base class for SNMP variables.
This class is the base class for SNMP variable implementations. It provides the interface which is used by agentXcpp (namely by the MasterProxy class) to perform operations on variables. An overiew on variable handling in agentxcpp is given in The Variable Objects.
Definition at line 40 of file AbstractVariable.hpp.
Result type for the TestSet validation.
A value of this type is returned during a TestSet operation according to RFC 2741, 7.2.4.1. "Subagent Processing of the agentx-TestSet-PDU".
The numeric values are given in RFC 2741, 7.2.4.1. "Subagent Processing of the agentx-TestSet-PDU".
Definition at line 90 of file AbstractVariable.hpp.
|
inlinevirtual |
Virtual destructor.
Definition at line 48 of file AbstractVariable.hpp.
|
pure virtual |
Release resources after a Set operation.
This method is called when the SNMP request "CleanupSet" is received. It shall release all resources previously allocated by handle_testset() (if any). If no resources were allocated, this method is not required to do anything.
The | function shall not throw. |
Implemented in agentxcpp::IntegerVariable, agentxcpp::IpAddressVariable, agentxcpp::OidVariable, agentxcpp::OctetStringVariable, agentxcpp::Gauge32Variable, agentxcpp::OpaqueVariable, agentxcpp::TimeTicksVariable, agentxcpp::Counter64Variable, and agentxcpp::Counter32Variable.
|
pure virtual |
Actually perform the Set operation.
This method is called when the SNMP request "CommitSet" is received for the variable. It shall perform the Set operation. It shall report whether the operation succeeded.
The | function shall not throw. |
Implemented in agentxcpp::IntegerVariable, agentxcpp::IpAddressVariable, agentxcpp::OidVariable, agentxcpp::OctetStringVariable, agentxcpp::Gauge32Variable, agentxcpp::OpaqueVariable, agentxcpp::TimeTicksVariable, agentxcpp::Counter64Variable, and agentxcpp::Counter32Variable.
|
pure virtual |
Handle AgentX Get request.
This method is called by the MasterProxy object when the SNMP request "Get" is received for the variable. It should update the internal state.
generic_error | If obtaining the current value fails. No other exception shall be thrown. |
Implemented in agentxcpp::IntegerVariable, agentxcpp::IpAddressVariable, agentxcpp::OidVariable, agentxcpp::OctetStringVariable, agentxcpp::OpaqueVariable, agentxcpp::Gauge32Variable, agentxcpp::TimeTicksVariable, agentxcpp::Counter32Variable, and agentxcpp::Counter64Variable.
|
pure virtual |
Validate whether a Set operation would be successful.
This method is called when the SNMP request "TestSet" is received. It shall check whether a Set operation is possible for the variable. It shall acquire the resources needed to perform the Set operation (but the Set shall not yet be performed).
The | function shall not throw. |
Implemented in agentxcpp::IntegerVariable, agentxcpp::IpAddressVariable, agentxcpp::OidVariable, agentxcpp::OctetStringVariable, agentxcpp::OpaqueVariable, agentxcpp::Gauge32Variable, agentxcpp::TimeTicksVariable, agentxcpp::Counter32Variable, and agentxcpp::Counter64Variable.
|
pure virtual |
Undo a Set operation which was already performed.
This method is called when the SNMP request "UndoSet" is received. It shall undo the operation performed by handle_commitset().
The | function shall not throw. |
Implemented in agentxcpp::IntegerVariable, agentxcpp::IpAddressVariable, agentxcpp::OidVariable, agentxcpp::OctetStringVariable, agentxcpp::Gauge32Variable, agentxcpp::OpaqueVariable, agentxcpp::TimeTicksVariable, agentxcpp::Counter64Variable, and agentxcpp::Counter32Variable.
|
pure virtual |
Serialize the variable.
This function shall generate a serialized form of the internal variable (i.e. the network representation of the variable).
The | function shall not throw. |
Implemented in agentxcpp::OidVariable, agentxcpp::IntegerVariable, agentxcpp::Gauge32Variable, agentxcpp::TimeTicksVariable, agentxcpp::IpAddressVariable, agentxcpp::Counter32Variable, agentxcpp::Counter64Variable, agentxcpp::OpaqueVariable, and agentxcpp::OctetStringVariable.
|
pure virtual |
Convert an INDEX variable to an Oid part.
If an SNMP variable is used as INDEX within a table, then its value is used as part of the Oid for that table entry. Therefore, such variables must be convertible to Oid's. This method provides this conversion.
Not all variable types are allowed to be used as INDEX and are therefore not convertible to Oid. For variables which are not convertible, this method shall return the null Oid.
This | method shall not throw. |
Implemented in agentxcpp::Gauge32Variable, agentxcpp::OpaqueVariable, agentxcpp::TimeTicksVariable, agentxcpp::Counter64Variable, agentxcpp::Counter32Variable, agentxcpp::IpAddressVariable, agentxcpp::IntegerVariable, agentxcpp::OidVariable, and agentxcpp::OctetStringVariable.