OpenNMS API 1.2.3

org.opennms.netmgt.capsd
Class DhcpPlugin

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

public final class DhcpPlugin
extends AbstractPlugin

This class is designed to be used by the capabilities daemon to test if a remote interface is running a functional DHCP server as defined by RFC 2131. This class relies on the DHCP API provided by JDHCP v1.1.1. (please refer to http://www.dhcp.org/javadhcp). The class implements the Plugin interface that allows it to be used along with other plugins by the daemon.

Author:
Mike , Weave , OpenNMS

Field Summary
private static int DEFAULT_RETRY
          Default number of retries for DHCP requests
private static int DEFAULT_TIMEOUT
          Default timeout (in milliseconds) for DHCP requests
private static java.lang.Integer PORT_NUMBER
          The port where the DHCP server is detected.
private static java.lang.String PROTOCOL_NAME
           The protocol name of the plugin.
 
Constructor Summary
DhcpPlugin()
           
 
Method Summary
 java.lang.String getProtocolName()
          This method returns the name of the protocol supported by this plugin.
 boolean isProtocolSupported(java.net.InetAddress host)
          This method is used to test the passed host for DHCP server support.
 boolean isProtocolSupported(java.net.InetAddress host, java.util.Map qualifiers)
          This method is used to test the passed host for DHCP server support.
private  boolean isServer(java.net.InetAddress host, int retries, int timeout)
          This method is used to test a passed address for DHCP server support.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PORT_NUMBER

private static final java.lang.Integer PORT_NUMBER
The port where the DHCP server is detected. This is a well known port and this integer is always returned in the qualifier map.


PROTOCOL_NAME

private static final java.lang.String PROTOCOL_NAME

The protocol name of the plugin.

See Also:
Constant Field Values

DEFAULT_RETRY

private static final int DEFAULT_RETRY
Default number of retries for DHCP requests

See Also:
Constant Field Values

DEFAULT_TIMEOUT

private static final int DEFAULT_TIMEOUT
Default timeout (in milliseconds) for DHCP requests

See Also:
Constant Field Values
Constructor Detail

DhcpPlugin

public DhcpPlugin()
Method Detail

isServer

private boolean isServer(java.net.InetAddress host,
                         int retries,
                         int timeout)
This method is used to test a passed address for DHCP server support. If the target system is running a DHCP server and responds to the request then a value of true is returned.

Parameters:
host - The host address to check
retries - The maximum number of attempts to try.
timeout - The time to wait for a response to each request.
Returns:
True if the remote host supports DHCP.

getProtocolName

public java.lang.String getProtocolName()
This method returns the name of the protocol supported by this plugin.

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

isProtocolSupported

public boolean isProtocolSupported(java.net.InetAddress host)
This method is used to test the passed host for DHCP server support. The remote host is queried using the DHCP protocol by sending a formatted datagram to the DHCP server port. If a response is received by the DHCP listenter that matches our original request then a value of true is returned to the caller.

Specified by:
isProtocolSupported in interface Plugin
Specified by:
isProtocolSupported in class AbstractPlugin
Parameters:
host - The remote host to test.
Returns:
True if the remote interface responds to the DHCP request, false otherwise

isProtocolSupported

public boolean isProtocolSupported(java.net.InetAddress host,
                                   java.util.Map qualifiers)
This method is used to test the passed host for DHCP server support. The remote host is queried using the DHCP protocol by sending a formatted datagram to the DHCP server port. If a response is received by the DHCP listenter that matches our original request then a value of true is returned to the caller.

Specified by:
isProtocolSupported in interface Plugin
Specified by:
isProtocolSupported in class AbstractPlugin
Parameters:
host - The remote host to test.
qualifiers - The location where qualifier parameters are read and written.
Returns:
True if the remote interface responds to the DHCP request, false otherwise

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.