OpenNMS API 1.2.9

## org.opennms.protocols.snmp
Interface SnmpPacketHandler

All Known Implementing Classes:
  SnmpSession.SessionHandler, SnmpTrapSession.TrapHandler

interface SnmpPacketHandler

The SnmpPacketHandler is implemented by an object that wishes to be notified when SNMP data is received from an agent. In addition, if an exception occurs or an agent fails to respond then the object must handle those error conditions.

Version:
  1.1.1.1 2001/11/11 17:27:22
Author:
  OpenNMS , Brian Weaver , Sowmya
See Also:
  `SnmpPortal`, `SnmpSession`, `SnmpTrapSession`

Method Summary
`void` `processBadDatagram(java.net.DatagramPacket pkt)` 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.

Method Detail

### processSnmpMessage

    public void processSnmpMessage(java.net.InetAddress agent,
                                   int port,
                                   SnmpInt32 version,
                                   SnmpOctetString community,
                                   int pduType,
                                   SnmpPduPacket pdu)
                            throws SnmpPduEncodingException

  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.

  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

  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.

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

  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.

  Parameters:
    `pkt` - The datagram packet that failed to parse.

### processException

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

  Parameters:
    `e` - The caught exception.
  See Also:
    `SnmpPortal`

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.