OpenNMS API 1.2.3

org.opennms.protocols.snmp
Class SnmpSession.SessionHandler

java.lang.Object
  extended byorg.opennms.protocols.snmp.SnmpSession.SessionHandler
All Implemented Interfaces:
SnmpPacketHandler
Enclosing class:
SnmpSession

private class SnmpSession.SessionHandler
extends java.lang.Object
implements SnmpPacketHandler

Inner class SessionHandler implements the interface SnmpPacketHandler to handle callbacks from the SnmpPortal


Constructor Summary
private SnmpSession.SessionHandler()
           
 
Method Summary
 void processBadDatagram(java.net.DatagramPacket p)
           Any messages received that are not properly formatted are passed to this handler.
 void processException(java.lang.Exception e)
           Any exception that is caught by the SnmpPortal class during the receipt of an SNMP message is handled by this method.
 void processSnmpMessage(java.net.InetAddress agent, int port, SnmpInt32 version, SnmpOctetString community, int pduType, SnmpPduPacket pdu)
           This method is used to process received SNMP messages in the standard V1 & V2 format.
 void processSnmpTrap(java.net.InetAddress agent, int port, SnmpOctetString community, SnmpPduTrap pdu)
           This method is use to handle SNMPv1 trap exclusively.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SnmpSession.SessionHandler

private SnmpSession.SessionHandler()
Method Detail

processSnmpMessage

public void processSnmpMessage(java.net.InetAddress agent,
                               int port,
                               SnmpInt32 version,
                               SnmpOctetString community,
                               int pduType,
                               SnmpPduPacket pdu)
                        throws SnmpPduEncodingException
Description copied from interface: SnmpPacketHandler

This method is used to process received SNMP messages in the standard V1 & V2 format. The only SNMP message not processed by this callback is an SNMPv1 Trap message.

For any class that implements this interface the processing time should be kept as small as possible. Any time spent in the handler method is time that the SnmpPortal class is not receiveing datagrams. This can result in lost packets during a high traffic time.

Specified by:
processSnmpMessage in interface SnmpPacketHandler
Parameters:
agent - The remote sender of the message
port - The port of the remote agent
version - The SNMP version of the received message.
community - The community string in the message.
pduType - The PDU implicit command value.
pdu - The Protocol Data Unit (PDU).
Throws:
SnmpPduEncodingException
See Also:
SnmpPortal.Receiver.run(), SnmpPortal.handlePkt(java.net.DatagramPacket)

processSnmpTrap

public void processSnmpTrap(java.net.InetAddress agent,
                            int port,
                            SnmpOctetString community,
                            SnmpPduTrap pdu)
                     throws SnmpPduEncodingException
Description copied from interface: SnmpPacketHandler

This method is use to handle SNMPv1 trap exclusively. Since the SnmpPduRequest & SnmpPduTrap do not share a common base class, a separate method is used to handle the v1 traps.

Since this method only handles SNMPv1 traps the version and pdu type are not passed as parameters to the object.

Specified by:
processSnmpTrap in interface SnmpPacketHandler
Parameters:
agent - The remote sender of the message
port - The port of the remote agent.
community - The community string in the message.
pdu - The SNMP trap Protocol Data Unit.
Throws:
SnmpPduEncodingException
See Also:
SnmpPduTrap

processBadDatagram

public void processBadDatagram(java.net.DatagramPacket p)
Description copied from interface: SnmpPacketHandler

Any messages received that are not properly formatted are passed to this handler. The handler can choose to ignore the messages or to do further processing to determine if it is encoded using a different encoder.

Specified by:
processBadDatagram in interface SnmpPacketHandler
Parameters:
p - The datagram packet that failed to parse.

processException

public void processException(java.lang.Exception e)
Description copied from interface: SnmpPacketHandler

Any exception that is caught by the SnmpPortal class during the receipt of an SNMP message is handled by this method. Methods that are not forwarded are SnmpPduEncodingExceptions and AsnDecodingExceptions.

Exceptions that may need to be processed by the handler include IOExceptions or other socket related errors.

Specified by:
processException in interface SnmpPacketHandler
Parameters:
e - The caught exception.
See Also:
SnmpPortal

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.