The NotificationOriginator provides services to send traps and notifications by using the SNMP-TARGET-MIB and the SNMP-NOTIFICATION-MIB.
More...
#include <notification_originator.h>
|
| NotificationOriginator () |
| Constructs a notification originator instance.
|
|
virtual | ~NotificationOriginator () |
| Destructor.
|
|
void | generate (Vbx *, int, const Oidx &, const Oidx &, const NS_SNMP OctetStr &) |
| Generate a notification message.
|
|
void | generate (Vbx *, int, const Oidx &, unsigned int, const NS_SNMP OctetStr &) |
| Generate a notification message.
|
|
virtual int | notify (const NS_SNMP OctetStr &, const Oidx &, Vbx *, int, unsigned int=0) |
| Send a notification.
|
|
|
virtual bool | add_v1_trap_destination (const NS_SNMP UdpAddress &addr, const NS_SNMP OctetStr &name, const NS_SNMP OctetStr &tag, const NS_SNMP OctetStr &community) |
| Make all necessary entries in snmpTargetAddressTable, snmpTargetParamsTable, and snmpNotifyTable for the given v1, v2 or v3 trap destination.
|
|
virtual bool | add_v2_trap_destination (const NS_SNMP UdpAddress &addr, const NS_SNMP OctetStr &name, const NS_SNMP OctetStr &tag, const NS_SNMP OctetStr &community) |
|
virtual bool | add_v3_trap_destination (const NS_SNMP UdpAddress &addr, const NS_SNMP OctetStr &name, const NS_SNMP OctetStr &tag, const NS_SNMP OctetStr &secName, const int secLevel) |
|
| NotificationSender () |
| Default constructor.
|
|
virtual | ~NotificationSender () |
| Destructor.
|
|
The NotificationOriginator provides services to send traps and notifications by using the SNMP-TARGET-MIB and the SNMP-NOTIFICATION-MIB.
NotificationOriginator is typically used outside the main loop of an agent's request handling.
- Author
- Frank Fock
- Version
- 3.5.10
NotificationOriginator::NotificationOriginator |
( |
| ) |
|
Constructs a notification originator instance.
virtual NotificationOriginator::~NotificationOriginator |
( |
| ) |
|
|
virtual |
virtual bool NotificationOriginator::add_v1_trap_destination |
( |
const NS_SNMP UdpAddress & |
addr, |
|
|
const NS_SNMP OctetStr & |
name, |
|
|
const NS_SNMP OctetStr & |
tag, |
|
|
const NS_SNMP OctetStr & |
community |
|
) |
| |
|
virtual |
Make all necessary entries in snmpTargetAddressTable, snmpTargetParamsTable, and snmpNotifyTable for the given v1, v2 or v3 trap destination.
- Parameters
-
addr | an UDP target address. |
name | unique name for the entries. |
tag | unique tag for the entries. |
community | / secName community / security name to use when sending traps. |
secLevel | security level to use when sending v3 traps |
- Returns
- TRUE if the operation has been successful, FALSE otherwise.
virtual bool NotificationOriginator::add_v2_trap_destination |
( |
const NS_SNMP UdpAddress & |
addr, |
|
|
const NS_SNMP OctetStr & |
name, |
|
|
const NS_SNMP OctetStr & |
tag, |
|
|
const NS_SNMP OctetStr & |
community |
|
) |
| |
|
virtual |
virtual bool NotificationOriginator::add_v3_trap_destination |
( |
const NS_SNMP UdpAddress & |
addr, |
|
|
const NS_SNMP OctetStr & |
name, |
|
|
const NS_SNMP OctetStr & |
tag, |
|
|
const NS_SNMP OctetStr & |
secName, |
|
|
const int |
secLevel |
|
) |
| |
|
virtual |
Check notification access for a management target.
Call this to validate access before sending the notificaiton. The NotificationOriginatorParams parameter must have the vbs, size, id, and contextName parameters filled in. Upon a TRUE return, the securityName, securityModel, securityLevel, mpModel, and target parameters will be filled in. If TRUE is returned, the caller is responsible to delete the target object in the NotificationOriginatorParams object (after sending the notification).
- Parameters
-
cur | the selected entry in the snmpTargetAddrTable |
nop | the notification originator parameters |
- Returns
- TRUE if access is okay, FALSE otherwise
void NotificationOriginator::generate |
( |
Vbx * |
, |
|
|
int |
, |
|
|
const Oidx & |
, |
|
|
const Oidx & |
, |
|
|
const NS_SNMP OctetStr & |
|
|
) |
| |
Generate a notification message.
- Parameters
-
vbs | an array of variable bindings - the payload of the notification. |
size | the size of the above array. |
id | the trap oid which identifies the notification. |
enterprise | the enterprise oid. For v2,v3 and enterprise specific v1 traps this parameter should be "" (empty OID). |
contextName | the context in which the trap occured. |
void NotificationOriginator::generate |
( |
Vbx * |
, |
|
|
int |
, |
|
|
const Oidx & |
, |
|
|
unsigned |
int, |
|
|
const NS_SNMP OctetStr & |
|
|
) |
| |
Generate a notification message.
- Parameters
-
vbs | an array of variable bindings - the payload of the notification. |
size | the size of the above array. |
id | the trap oid which identifies the notification. |
sysUpTime | the timestamp to be used |
contextName | the context in which the trap occured. |
int NotificationOriginator::generate |
( |
Vbx * |
, |
|
|
int |
, |
|
|
const Oidx & |
, |
|
|
unsigned |
int, |
|
|
const Oidx & |
, |
|
|
const NS_SNMP OctetStr & |
|
|
) |
| |
|
protected |
Generate a notification message.
- Parameters
-
vbs | an array of variable bindings - the payload of the notification. |
size | the size of the above array. |
id | the trap oid which identifies the notification. |
sysUpTime | the timestamp to be used |
enterprise | the enterprise oid. For v2,v3 and enterprise specific v1 traps this parameter should be "" (empty OID). |
contextName | the context in which the trap occured. |
virtual int NotificationOriginator::notify |
( |
const NS_SNMP OctetStr & |
, |
|
|
const Oidx & |
, |
|
|
Vbx * |
, |
|
|
int |
, |
|
|
unsigned |
int = 0 |
|
) |
| |
|
virtual |
Send a notification.
This implements the NotificationSender interface.
- Parameters
-
context | the context originating the notification ("" for the default context). |
trapoid | the oid of the notification. |
vbs | an array of variable bindings. |
size | the size of the above variable binding array. |
timestamp | an optional timestamp. |
- Returns
- SNMP_ERROR_SUCCESS if the notification could be sent successfully, otherwise an appropriate SNMP error is returned.
Implements NotificationSender.
Send a notification to a valid target.
Call this only after validating access by calling the check_access method first. The NotificationOriginatorParams parameter must have the vbs, size, id, timestamp, enterprise, contextName, securityName, securityLevel, mpModel, and target parameters filled in.
- Parameters
-
cur | the selected entry in the snmpTargetAddrTable |
nop | the notification originator parameters |
notify | specifies the notification type (trap or inform) |
- Returns
- The result from calling SnmpRequestV3::send or SnmpRequest::process_trap
The documentation for this class was generated from the following file: