JoeSNMP API 0.3.4

org.opennms.protocols.snmp
Interface SnmpAgentHandler


public interface SnmpAgentHandler

The SnmpAgentHandler interface is implemented by an object that wishs to receive callbacks when an SNMP protocol data unit is received from a manager.

Author:
OpenNMS, Bob Snider

Method Summary
 void SnmpAgentSessionError(SnmpAgentSession session, int error, java.lang.Object ref)
          This method is invoked if an error occurs in the session.
 SnmpPduRequest snmpReceivedGet(SnmpPduPacket pdu, boolean getNext)
          This method is defined to handle SNMP Get requests that are received by the session.
 void snmpReceivedPdu(SnmpAgentSession session, java.net.InetAddress manager, int port, SnmpOctetString community, SnmpPduPacket pdu)
          This method is defined to handle SNMP requests that are received by the session.
 SnmpPduRequest snmpReceivedSet(SnmpPduPacket pdu)
          This method is defined to handle SNMP Set requests that are received by the session.
 

Method Detail

snmpReceivedPdu

void snmpReceivedPdu(SnmpAgentSession session,
                     java.net.InetAddress manager,
                     int port,
                     SnmpOctetString community,
                     SnmpPduPacket pdu)

This method is defined to handle SNMP requests that are received by the session. The parameters allow the handler to determine the host, port, and community string of the received PDU

Parameters:
session - The SNMP session
manager - The remote sender
port - The remote senders port
community - The community string
pdu - The SNMP pdu

snmpReceivedGet

SnmpPduRequest snmpReceivedGet(SnmpPduPacket pdu,
                               boolean getNext)

This method is defined to handle SNMP Get requests that are received by the session. The request has already been validated by the system. This routine will build a response and pass it back to the caller.

Parameters:
pdu - The SNMP pdu
getNext - The agent is requesting the lexically NEXT item after each item in the pdu.
Returns:
SnmpPduRequest filled in with the proper response, or null if cannot process NOTE: this might be changed to throw an exception.

snmpReceivedSet

SnmpPduRequest snmpReceivedSet(SnmpPduPacket pdu)

This method is defined to handle SNMP Set requests that are received by the session. The request has already been validated by the system. This routine will build a response and pass it back to the caller.

Parameters:
pdu - The SNMP pdu
Returns:
SnmpPduRequest filled in with the proper response, or null if cannot process NOTE: this might be changed to throw an exception.

SnmpAgentSessionError

void SnmpAgentSessionError(SnmpAgentSession session,
                           int error,
                           java.lang.Object ref)

This method is invoked if an error occurs in the session. The error code that represents the failure will be passed in the second parameter, 'error'. The error codes can be found in the class SnmpAgentSession class.

If a particular PDU is part of the error condition it will be passed in the third parameter, 'pdu'. The pdu will be of the type SnmpPduRequest or SnmpPduTrap object. The handler should use the "instanceof" operator to determine which type the object is. Also, the object may be null if the error condition is not associated with a particular PDU.

Parameters:
session - The SNMP Session
error - The error condition value.
ref - The PDU reference, or potentially null. It may also be an exception.

JoeSNMP API 0.3.4

Generated by iurt on 2011.