Represents an Notify-PDU. More...
#include <NotifyPDU.hpp>
Public Types | |
| enum | generic_trap_t { coldStart = 0, warmStart = 1, linkDown = 2, linkUp = 3, authenticationFailure = 4, egpNeighborLoss = 5, enterpriseSpecific = 6 } |
| The allowed values for specific-trap. More... | |
Public Member Functions | |
| NotifyPDU (binary::const_iterator &pos, const binary::const_iterator &end, bool big_endian) | |
| Parse constructor. | |
| NotifyPDU () | |
| Default Constructor. | |
| vector< varbind > & | get_vb () |
| Get the VarBind list. | |
| virtual binary | serialize () const |
| Serialize the PDU. | |
| varbind | trapToNotification (oid enterprise, generic_trap_t generic_trap, uint32_t specific_trap) |
| Create snmpTrapOID.0 from SNMPv1 Trap data. | |
Public Member Functions inherited from agentxcpp::PDUwithContext | |
| bool | has_context () |
| Whether the PDU has a context. | |
| Octet_String | get_context () |
| Get context. | |
| void | set_context (Octet_String value) |
| Set the PDU's context. | |
| void | remove_context () |
| Removes the context from the PDU. | |
Public Member Functions inherited from agentxcpp::PDU | |
| bool | get_new_index () |
| Get new_index flag. | |
| void | set_new_index (bool new_index) |
| Set new_index flag. | |
| bool | get_any_index () |
| Get any_index flag. | |
| void | set_any_index (bool any_index) |
| Set any_index flag. | |
| uint32_t | get_sessionID () |
| Get sessionID. | |
| void | set_sessionID (uint32_t id) |
| Set sessionID. | |
| uint32_t | get_transactionID () |
| Get transactionID. | |
| void | set_transactionID (uint32_t id) |
| Set transactionID. | |
| uint32_t | get_packetID () |
| Get packetID. | |
| void | set_packetID (uint32_t packetID) |
| Set packetID. | |
Private Attributes | |
| vector< varbind > | vb |
| The VarBind list. | |
Additional Inherited Members | |
Protected Member Functions inherited from agentxcpp::PDUwithContext | |
| PDUwithContext (binary::const_iterator &pos, const binary::const_iterator &end, bool big_endian) | |
| Parse constructor. | |
| void | add_header (type_t type, binary &payload) const |
| Add PDU header and context field to the payload. | |
| PDUwithContext () | |
| Default Constructor. | |
Protected Member Functions inherited from agentxcpp::PDU | |
| PDU (binary::const_iterator &pos, const binary::const_iterator &end, bool big_endian) | |
| Parse constructor. | |
| PDU () | |
| Default constructor. | |
| virtual | ~PDU () |
| Destructor. | |
Represents an Notify-PDU.
Definition at line 39 of file NotifyPDU.hpp.
The allowed values for specific-trap.
According to RFC 1157, these values can be used for the generic-trap field in SNMPv1 Traps.
| coldStart | |
| warmStart | |
| linkDown | |
| linkUp | |
| authenticationFailure | |
| egpNeighborLoss | |
| enterpriseSpecific |
Definition at line 115 of file NotifyPDU.hpp.
| NotifyPDU::NotifyPDU | ( | binary::const_iterator & | pos, |
| const binary::const_iterator & | end, | ||
| bool | big_endian | ||
| ) |
Parse constructor.
Construct the object by parsing a stream. See Parsing incoming PDUs for details about PDU parsing.
| pos | Iterator pointing to the current stream position. The iterator is advanced while reading the header. |
| end | Iterator pointing one element past the end of the current stream. This is needed to mark the end of the buffer. |
| big_endian | Whether the serialized form of the PDU is in big_endian format. |
| parse_error | If parsing fails, for example because reading the stream fails or the PDU is malformed. |
Definition at line 25 of file NotifyPDU.cpp.
References vb.
|
inline |
Default Constructor.
Sets the state of the object to the defaults as set by the PDU::PDUwithContext() constructor, and initializes vb to be empty.
Definition at line 79 of file NotifyPDU.hpp.
|
inline |
Get the VarBind list.
This function returns a reference to the internal VarBind list, which can then be modified in place.
Definition at line 99 of file NotifyPDU.hpp.
References vb.
|
virtual |
Serialize the PDU.
Implements agentxcpp::PDU.
Definition at line 40 of file NotifyPDU.cpp.
References agentxcpp::PDUwithContext::add_header(), agentxcpp::PDU::agentxNotifyPDU, and vb.
| varbind NotifyPDU::trapToNotification | ( | oid | enterprise, |
| generic_trap_t | generic_trap, | ||
| uint32_t | specific_trap | ||
| ) |
Create snmpTrapOID.0 from SNMPv1 Trap data.
Each notification must have an snmpTrapOID.0 object. In SNMPv1 no notifications were available; instead Traps were used. This function takes parameters which would be present in an SNMPv1 Trap and converts them to an snmpTrapOID.0 object. The result is a varbind of the form "snmpTrapOID.0 = <calculated value>". Note that the master will convert the snmpTrapOID.0 value back when sending SNMPv1 traps; nevertheless the AgentX protocol requires the snmpTrapOID.0 object.
The conversion is done according to RFC 1908, 3.1.2 "SNMPv1 -> SNMPv2".
| enterprise | Type of object generating trap, see RFC 1155 |
| generic_trap | |
| specific_trap |
| inval_param | If the generic_trap parameter has an invalid value. |
Definition at line 59 of file NotifyPDU.cpp.
References authenticationFailure, coldStart, egpNeighborLoss, enterpriseSpecific, linkDown, linkUp, and warmStart.
|
private |
The VarBind list.
Definition at line 45 of file NotifyPDU.hpp.
Referenced by get_vb(), NotifyPDU(), and serialize().