org.opennms.bb.dp.capsd.snmp
Class IpAddrTable

java.lang.Object
  |
  +--org.opennms.bb.dp.capsd.snmp.IpAddrTable
All Implemented Interfaces:
SnmpHandler

public class IpAddrTable
extends Object
implements SnmpHandler

IpAddrTable uses a SnmpSession to collect the ipAddrTable entries It implements the SnmpHandler to receive notifications when a reply is received/error occurs in the SnmpSession used to send requests /recieve replies.

Version:
$Revision: 1.10 $
Author:
Sowmya, Weave, OpenNMS
See Also:
RFC1213

Field Summary
private  List m_entries
          The list of collected IpAddrTableEntries built from the infomation collected from the remote agent.
private  boolean m_error
          Flag indicating if query was successful.
private  Signaler m_signal
          Used to synchronize the class to ensure that the session has finished collecting data before the value of success or failure is set, and control is returned to the caller.
 
Constructor Summary
private IpAddrTable()
          The default constructor is marked as private and will always throw an exception.
  IpAddrTable(SnmpSession session, Signaler signaler)
          Constructs an IpAddrTable object that is used to collect the address elements from the remote agent.
 
Method Summary
 boolean failed()
          Returns the success or failure code for collection of the data.
 List getEntries()
          Returns the list of entry maps that can be used to access all the information about the interface table.
 void snmpInternalError(SnmpSession session, int error, SnmpSyntax pdu)
          This method is part of the SnmpHandler interface and called when an internal error happens in a session.
 void snmpReceivedPdu(SnmpSession session, int command, SnmpPduPacket pdu)
          This method is used to process received SNMP PDU packets from the remote agent.
 void snmpTimeoutError(SnmpSession session, SnmpSyntax pdu)
          This method is part of the SnmpHandler interface and is invoked when the SnmpSession does not receive a reply after exhausting the retransmission attempts.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

m_entries

private List m_entries

The list of collected IpAddrTableEntries built from the infomation collected from the remote agent.


m_error

private boolean m_error

Flag indicating if query was successful.


m_signal

private Signaler m_signal

Used to synchronize the class to ensure that the session has finished collecting data before the value of success or failure is set, and control is returned to the caller.

Constructor Detail

IpAddrTable

private IpAddrTable()
             throws UnsupportedOperationException

The default constructor is marked as private and will always throw an exception. This is done to disallow the constructor to be called. Since any instance of this class must have an SnmpSession and Signaler to properly work, the correct constructor must be used.

Throws:
UnsupportedOperationException - Always thrown from this method since it is not supported.
See Also:
IpAddrTable(SnmpSession, Signaler)

IpAddrTable

public IpAddrTable(SnmpSession session,
                   Signaler signaler)

Constructs an IpAddrTable object that is used to collect the address elements from the remote agent. Once all the elements are collected, or there is an error in the collection the signaler object is notified to inform other threads.

Parameters:
session - The session with the remote agent.
signaler - The object to notify waiters.
See Also:
IpAddrTableEntry
Method Detail

failed

public boolean failed()

Returns the success or failure code for collection of the data.


getEntries

public List getEntries()

Returns the list of entry maps that can be used to access all the information about the interface table.

Returns:
The list of ifTableEntry maps.

snmpReceivedPdu

public void snmpReceivedPdu(SnmpSession session,
                            int command,
                            SnmpPduPacket pdu)

This method is used to process received SNMP PDU packets from the remote agent. The method is part of the SnmpHandler interface and will be invoked when a PDU is successfully decoded. The method is passed the receiving session, the PDU command, and the actual PDU packet.

When all the data has been received from the session the signaler object, initialized in the constructor, is signaled. In addition, the receiving instance will call notifyAll() on itself at the same time.

Specified by:
snmpReceivedPdu in interface SnmpHandler
Parameters:
session - The SNMP Session that received the PDU
command - The command contained in the received pdu
pdu - The actual received PDU.

snmpInternalError

public void snmpInternalError(SnmpSession session,
                              int error,
                              SnmpSyntax pdu)

This method is part of the SnmpHandler interface and called when an internal error happens in a session. This is usually the result of an I/O error. This method will not be called if the session times out sending a packet, see snmpTimeoutError for timeout handling.

Specified by:
snmpInternalError in interface SnmpHandler
Parameters:
session - The session that had an unexpected error
error - The error condition
pdu - The PDU being sent when the error occured
See Also:
snmpTimeoutError(org.opennms.protocols.snmp.SnmpSession, org.opennms.protocols.snmp.SnmpSyntax), SnmpHandler

snmpTimeoutError

public void snmpTimeoutError(SnmpSession session,
                             SnmpSyntax pdu)

This method is part of the SnmpHandler interface and is invoked when the SnmpSession does not receive a reply after exhausting the retransmission attempts.

Specified by:
snmpTimeoutError in interface SnmpHandler
Parameters:
session - The session invoking the error handler
pdu - The PDU that the remote failed to respond to.
See Also:
SnmpHandler