NotificationOriginator Class Reference

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>

Inheritance diagram for NotificationOriginator:

NotificationSender

List of all members.

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


Detailed Description

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

Constructor & Destructor Documentation

NotificationOriginator::NotificationOriginator (  ) 

Constructs a notification originator instance.

virtual NotificationOriginator::~NotificationOriginator (  )  [virtual]

Destructor.


Member Function Documentation

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.

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.

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.

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.
Returns:
TRUE if the operation has been successful, FALSE otherwise.

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.

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.

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).

Parameters:
cur the selected entry in the snmpTargetAddrTable
nop the notification originator parameters
Returns:
TRUE if access is okay, FALSE otherwise

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.

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:

Generated on Fri May 29 22:36:55 2009 for AGENT++ by  doxygen 1.5.6