Represents an SNMP OBJECT-IDENTENTIFIER variable. More...
#include <OidVariable.hpp>
Public Member Functions | |
OidVariable (const Oid &o) | |
Initialize an OidVariable object with an Oid. More... | |
OidVariable () | |
Default constructor. More... | |
Oid | value () |
Get the current value. More... | |
void | setValue (const Oid &_value) |
Set the value. More... | |
virtual Oid | toOid () const |
Convert the value to an OID. More... | |
virtual void | perform_get () |
Perform a Get request. More... | |
virtual testset_result_t | perform_testset (const Oid &_v) |
Perform an SNMP TestSet request. More... | |
virtual void | perform_cleanupset (const Oid &_v) |
Perform an SNMP CleanupSet request. More... | |
virtual bool | perform_commitset (const Oid &_v) |
Perform an SNMP CommitSet request. More... | |
virtual bool | perform_undoset (const Oid &_v) |
Perform an SNMP UndoSet request. More... | |
![]() | |
virtual | ~AbstractVariable () |
Virtual destructor. More... | |
Protected Attributes | |
Oid | v |
The value represented by this variable. More... | |
Additional Inherited Members | |
![]() | |
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... | |
Represents an SNMP OBJECT-IDENTENTIFIER variable.
The agentXcpp library distinguishes between Oid and OidVariable types. An Oid is a sequence of numbers, while OidVariable is an SNMP variable representing an Oid. That means, that Get and Set requests are possible on OidVariable's, but not on Oid's.
OidVariable::OidVariable | ( | const Oid & | o | ) |
Initialize an OidVariable object with an Oid.
The internal value is set to the provided Oid.
o | The initial Oid. |
None. |
|
inline |
Default constructor.
Initialize the value to the null Oid.
|
inlinevirtual |
Perform an SNMP CleanupSet request.
This method is invoked when an SNMP CleanupSet request is received. It shall release any resources allocated by perform_testset().
The default implementation does nothing. If no action is required to perform the CleanupSet operation, this method need not be overridden.
_v | The value to which the variable was (possibly) set. |
|
inlinevirtual |
Perform an SNMP CommitSet request.
This method is invoked when an SNMP CommitSet request is received. It shall perform the actual write operation.
The default implementation returns false to indicate that the operation failed. To implement a writeable SNMP variable this method must be overridden.
_v | The value which shall be written. |
|
inlinevirtual |
Perform a Get request.
This method is invoked when an SNMP Get request is received. It should update the internal value v.
|
inlinevirtual |
Perform an SNMP TestSet request.
This method is invoked when an SNMP TestSet request 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 operation shall not yet be performed).
The default implementation returns AbstractVariable::noAccess to indicate that this is a read-only variable. Thus, for read-only variables this method need not be overridden.
_v | The new value provided by the master agent. |
|
inlinevirtual |
Perform an SNMP UndoSet request.
This method is invoked when an SNMP UndoSet request is received. It shall undo whatever perform_commitset() performed. It shall also release all resources allocated by perform_testset(), because perform_cleanupset() will not be called afterwards.
The default implementation returns false to indicate that the operation failed. It is strongly recommended that writeable variables override this method.
_v | The value just set by perform_commitset(). |
|
inline |
Set the value.
_value | The new value. |
|
inlinevirtual |
Convert the value to an OID.
The conversion is done according to RFC 2578, 7.7. "Mapping of the INDEX clause". First, the length of the OID (i.e. the number of subid's it has) is converted to a subid. Then, each subid of the value is appended.
None. |
Implements agentxcpp::AbstractVariable.
|
inline |
Get the current value.
|
protected |
The value represented by this variable.