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 (data_t::const_iterator &pos, const data_t::const_iterator &end, bool big_endian) | |
| Parse constructor. | |
| NotifyPDU () | |
| Default Constructor. | |
| vector< varbind > & | get_vb () |
| Get the VarBind list. | |
| virtual data_t | 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. | |
Private Attributes | |
| vector< varbind > | vb |
| The VarBind list. | |
Represents an Notify-PDU.
Definition at line 35 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 111 of file NotifyPDU.hpp.
| NotifyPDU::NotifyPDU | ( | data_t::const_iterator & | pos, |
| const data_t::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.
| agentxcpp::NotifyPDU::NotifyPDU | ( | ) | [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 75 of file NotifyPDU.hpp.
| vector<varbind>& agentxcpp::NotifyPDU::get_vb | ( | ) | [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 95 of file NotifyPDU.hpp.
References vb.
| data_t NotifyPDU::serialize | ( | ) | const [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.
vector<varbind> agentxcpp::NotifyPDU::vb [private] |
The VarBind list.
Definition at line 41 of file NotifyPDU.hpp.
Referenced by get_vb(), NotifyPDU(), and serialize().