#include <notification_originator.h>
Public Member Functions | |
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 boolean | 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 boolean | 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 boolean | add_v3_trap_destination (const NS_SNMP UdpAddress &addr, const NS_SNMP OctetStr &name, const NS_SNMP OctetStr &tag, const NS_SNMP OctetStr &secName) |
Protected Member Functions | |
int | generate (Vbx *, int, const Oidx &, unsigned int, const Oidx &, const NS_SNMP OctetStr &) |
Generate a notification message. | |
boolean | check_access (ListCursor< MibTableRow > &cur, NotificationOriginatorParams &nop) |
Check notification access for a management target. | |
int | send_notify (ListCursor< MibTableRow > &cur, NotificationOriginatorParams &nop, int notify) |
Send a notification to a valid target. | |
Classes | |
class | NotificationOriginatorParams |
NotificationOriginator is typically used outside the main loop of an agent's request handling.
NotificationOriginator::NotificationOriginator | ( | ) |
Constructs a notification originator instance.
virtual NotificationOriginator::~NotificationOriginator | ( | ) | [virtual] |
Destructor.
void NotificationOriginator::generate | ( | Vbx * | , | |
int | , | |||
const Oidx & | , | |||
const Oidx & | , | |||
const NS_SNMP OctetStr & | ||||
) |
Generate a notification message.
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.
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. |
virtual int NotificationOriginator::notify | ( | const NS_SNMP OctetStr & | , | |
const Oidx & | , | |||
Vbx * | , | |||
int | , | |||
unsigned | int = 0 | |||
) | [virtual] |
Send a notification.
This implements the NotificationSender interface.
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. |
Implements NotificationSender.
virtual boolean 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.
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. |
virtual boolean 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 boolean 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 | |||
) | [virtual] |
int NotificationOriginator::generate | ( | Vbx * | , | |
int | , | |||
const Oidx & | , | |||
unsigned | int, | |||
const Oidx & | , | |||
const NS_SNMP OctetStr & | ||||
) | [protected] |
Generate a notification message.
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. |
boolean NotificationOriginator::check_access | ( | ListCursor< MibTableRow > & | cur, | |
NotificationOriginatorParams & | nop | |||
) | [protected] |
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).
cur | the selected entry in the snmpTargetAddrTable | |
nop | the notification originator parameters |
int NotificationOriginator::send_notify | ( | ListCursor< MibTableRow > & | cur, | |
NotificationOriginatorParams & | nop, | |||
int | notify | |||
) | [protected] |
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.
cur | the selected entry in the snmpTargetAddrTable | |
nop | the notification originator parameters | |
notify | specifies the notification type (trap or inform) |