OpenNMS API 1.2.3

org.opennms.netmgt.capsd
Class IcmpPlugin

java.lang.Object
  extended byorg.opennms.netmgt.capsd.AbstractPlugin
      extended byorg.opennms.netmgt.capsd.IcmpPlugin
All Implemented Interfaces:
Plugin

public final class IcmpPlugin
extends AbstractPlugin

This class provides Capsd with the ability to check for ICMP support on new interfaces as them are passed into the system. In order to minimize the number of sockets and threads, this class creates a daemon thread to handle all responses and a single socket for sending echo request to various hosts.

Author:
Weave , OpenNMS

Nested Class Summary
private static class IcmpPlugin.Ping
          This class is used to encapsulate a ping request.
 
Field Summary
private static int DEFAULT_RETRY
          Default retries.
private static int DEFAULT_TIMEOUT
          Default timeout.
private static short FILTER_ID
          The filter identifier for the ping reply receiver
private static IcmpSocket m_icmpSock
          The ICMP socket used to send/receive replies
private static ReplyReceiver m_receiver
          The singular reply receiver
private static short m_seqid
          The sequence number for pings
private static java.util.Map m_waiting
          The set used to lookup thread identifiers The map of long thread identifiers to Packets that must be signaled.
private static java.lang.Thread m_worker
          The thread used to receive and process replies.
private static java.lang.String PROTOCOL_NAME
          The name of the protocol that is supported by this plugin
 
Constructor Summary
IcmpPlugin()
          Construts a new monitor.
 
Method Summary
private static java.net.DatagramPacket getDatagram(java.net.InetAddress addr, long tid)
          Builds a datagram compatable with the ping ReplyReceiver class.
 java.lang.String getProtocolName()
          Returns the name of the protocol that this plugin checks on the target system for support.
private  boolean isPingable(java.net.InetAddress ipv4Addr, int retries, long timeout)
          This method is used to ping a remote host to test for ICMP support.
 boolean isProtocolSupported(java.net.InetAddress address)
          Returns true if the protocol defined by this plugin is supported.
 boolean isProtocolSupported(java.net.InetAddress address, java.util.Map qualifiers)
          Returns true if the protocol defined by this plugin is supported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROTOCOL_NAME

private static final java.lang.String PROTOCOL_NAME
The name of the protocol that is supported by this plugin

See Also:
Constant Field Values

DEFAULT_RETRY

private static final int DEFAULT_RETRY
Default retries.

See Also:
Constant Field Values

DEFAULT_TIMEOUT

private static final int DEFAULT_TIMEOUT
Default timeout. Specifies how long (in milliseconds) to block waiting for data from the monitored interface.

See Also:
Constant Field Values

FILTER_ID

private static final short FILTER_ID
The filter identifier for the ping reply receiver


m_seqid

private static short m_seqid
The sequence number for pings


m_receiver

private static ReplyReceiver m_receiver
The singular reply receiver


m_icmpSock

private static IcmpSocket m_icmpSock
The ICMP socket used to send/receive replies


m_waiting

private static java.util.Map m_waiting
The set used to lookup thread identifiers The map of long thread identifiers to Packets that must be signaled. The mapped objects are instances of the Replyclass.


m_worker

private static java.lang.Thread m_worker
The thread used to receive and process replies.

Constructor Detail

IcmpPlugin

public IcmpPlugin()
           throws java.io.IOException
Construts a new monitor.

Method Detail

getDatagram

private static java.net.DatagramPacket getDatagram(java.net.InetAddress addr,
                                                   long tid)
Builds a datagram compatable with the ping ReplyReceiver class.


isPingable

private boolean isPingable(java.net.InetAddress ipv4Addr,
                           int retries,
                           long timeout)
This method is used to ping a remote host to test for ICMP support. If the remote host responds within the specified period, defined by retries and timeouts, then a value of true is returned to the caller.

Parameters:
ipv4Addr - The address to poll.
retries - The number of times to retry
timeout - The time to wait between each retry.
Returns:
True if the host is reachable and responsed with an echo reply.

getProtocolName

public java.lang.String getProtocolName()
Returns the name of the protocol that this plugin checks on the target system for support.

Specified by:
getProtocolName in interface Plugin
Specified by:
getProtocolName in class AbstractPlugin
Returns:
The protocol name for this plugin.

isProtocolSupported

public boolean isProtocolSupported(java.net.InetAddress address)
Returns true if the protocol defined by this plugin is supported. If the protocol is not supported then a false value is returned to the caller.

Specified by:
isProtocolSupported in interface Plugin
Specified by:
isProtocolSupported in class AbstractPlugin
Parameters:
address - The address to check for support.
Returns:
True if the protocol is supported by the address.

isProtocolSupported

public boolean isProtocolSupported(java.net.InetAddress address,
                                   java.util.Map qualifiers)
Returns true if the protocol defined by this plugin is supported. If the protocol is not supported then a false value is returned to the caller. The qualifier map passed to the method is used by the plugin to return additional information by key-name. These key-value pairs can be added to service events if needed.

Specified by:
isProtocolSupported in interface Plugin
Specified by:
isProtocolSupported in class AbstractPlugin
Parameters:
address - The address to check for support.
qualifiers - The map where qualification are set by the plugin.
Returns:
True if the protocol is supported by the address.

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.