Class DefaultTrapContext

java.lang.Object
uk.co.westhawk.snmp.stack.ListeningContext
uk.co.westhawk.snmp.stack.DefaultTrapContext
All Implemented Interfaces:
Runnable, ListeningContextFace

public class DefaultTrapContext extends ListeningContext
Deprecated.
As of 4_14, replaced by ListeningContext and ListeningContextPool
The DefaultTrapContext class will enable this stack to receive traps. Only one (1) instance of the DefaultTrapContext can exist. The context will only start receiving (or listen for) traps when there is at least one listener registered. Two kind of listeners can be added; the normal and unhandled trap listeners. The normal trap listeners are added via the addTrapListener() method, the unhandled trap listeners are added via the addUnhandledTrapListener().

Use one of the getInstance() methods to get the instance and add a trap listener. This class will fire undecoded trap events, i.e. the raw data is sent and no attempt is made to decode the data into a pdu.

The SnmpContext classes provide functionality for decoded trap events. These classes will register themselves to the DefaultTrapContext object and only pass the event on if it matches their configuration.

Note that because only one instance of this class can exist, the first call of getInstance() will define the settings (i.e. port number and socket type) for the lifetime of the stack. All the subsequent calls of getInstance() will return the existing instance, irrespective of the arguments.

On UNIX and Linux operating systems the default port where trap are sent (i.e. 162) can only be opened as root.

Note, this class is now deprecated. We are (very) slowly trying to move to a more general way of receiving packets and adding agent functionality. ListeningContext and ListeningContextPool allow the stack to listen to more than one port.

Version:
$Revision: 3.12 $ $Date: 2009/03/05 13:12:50 $
Author:
Birgit Arkesteijn
See Also: