interface SnmpPacketHandler
SnmpPortal
,
SnmpSession
,
SnmpTrapSession
Modifier and Type | Method and Description |
---|---|
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.
|
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.
agent
- The remote sender of the messageport
- The port of the remote agentversion
- 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).SnmpPduEncodingException
SnmpPortal.Receiver.run()
,
SnmpPortal.handlePkt(java.net.DatagramPacket)
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.
agent
- The remote sender of the messageport
- The port of the remote agent.community
- The community string in the message.pdu
- The SNMP trap Protocol Data Unit.SnmpPduEncodingException
SnmpPduTrap
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.
pkt
- The datagram packet that failed to parse.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.
e
- The caught exception.SnmpPortal
Generated by iurt on 2015.