Represents an IP address as described in RFC 2741, section 5.4. More...
#include <IpAddressVariable.hpp>
Public Member Functions | |
IpAddressVariable (quint8 a, quint8 b, quint8 c, quint8 d) | |
Construct an IpAddressValue object. More... | |
void | set_value (quint8 a, quint8 b, quint8 c, quint8 d) |
Set the value. More... | |
quint8 & | operator[] (unsigned index) |
Access a component of the stored IpAddress. 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 quint8 _v[4]) |
Handle a TestSet request. More... | |
virtual void | perform_cleanupset (const quint8 _v[4]) |
Perform an SNMP CleanupSet request. More... | |
virtual bool | perform_commitset (const quint8 _v[4]) |
Perform an SNMP CommitSet request. More... | |
virtual bool | perform_undoset (const quint8 _v[4]) |
Perform an SNMP UndoSet request. More... | |
![]() | |
virtual | ~AbstractVariable () |
Virtual destructor. More... | |
Protected Attributes | |
quint8 | v [4] |
The IP address. 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 IP address as described in RFC 2741, section 5.4.
|
inline |
Construct an IpAddressValue object.
The stored IpAddress is initialized to "a.b.c.d".
None. |
|
inline |
Access a component of the stored IpAddress.
This function returns the component with the given index. Note that exactly 4 components are stored. The return value is a reference to the component, so that it can be read/written, in other words, the IpAddressValue object can be accessed like an ordinary array.
index | The index (value in the range 0...3). |
inval_param | If the index is out of bound. |
|
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 |
Handle a TestSet request.
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.
The stored IpAddress is updated to "a.b.c.d".
None. |
|
inlinevirtual |
Convert the value to an OID.
The conversion is done according to RFC 2578, 7.7. "Mapping of the INDEX clause". The created OID has exactly 4 subids which corresponds to the 4 integers of the IP address.
Implements agentxcpp::AbstractVariable.
|
protected |
The IP address.
According to RFC 2578, IpAddress is a 32-bit number.