|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.netmgt.dhcpd.Poller
Establishes a TCP socket connection with the DHCP daemon and formats and sends request messages.
Field Summary | |
(package private) static short |
BROADCAST_FLAG
Broadcast flag...when set in the 'flags' portion of the DHCP query packet, it forces the DHCP server to broadcast the DHCP response. |
private static byte[] |
DEFAULT_MAC_ADDRESS
The hardware address (ex: 00:06:0D:BE:9C:B2) |
(package private) static int |
DEFAULT_RETRIES
Default retries |
(package private) static long |
DEFAULT_TIMEOUT
Default timeout |
private java.net.Socket |
m_connection
TCP Socket connection with DHCP Daemon |
private java.io.ObjectInputStream |
m_ins
Objects from the server. |
private static int |
m_nextXid
Holds the value for the next identifier sent to the DHCP server. |
private java.io.ObjectOutputStream |
m_outs
Output Object stream |
private static int |
MESSAGE_TYPE
The message type option for the DHCP request. |
private static boolean |
paramsChecked
|
private static boolean |
relayMode
|
private static boolean |
reqTargetIp
|
private static int |
REQUESTED_IP
The requested ip option for the DHCP request. |
private static java.lang.String |
s_extendedMode
|
private static byte[] |
s_hwAddress
|
private static byte[] |
s_myIpAddress
|
private static byte[] |
s_requestIpAddress
|
private static boolean |
targetOffset
|
Constructor Summary | |
private |
Poller(long timeout)
Constructor. |
Method Summary | |
void |
close()
Closes the client's socket connection to the DHCP daemon. |
protected void |
finalize()
Ensures that during garbage collection the resources used by this object are released! |
private static Message |
getDisconnectRequest()
Returns a disconnection request message that can be sent to the server. |
private static Message |
getPollingRequest(java.net.InetAddress addr,
byte mType)
Returns a DHCP DISCOVER, INFORM, or REQUEST message that can be sent to the DHCP server. |
(package private) static long |
isServer(java.net.InetAddress host,
long timeout,
int retries)
This method actually tests the remote host to determine if it is running a functional DHCP server. |
private static void |
setHwAddress(java.lang.String hwAddressStr)
|
private static byte[] |
setIpAddress(java.lang.String ipAddressStr)
|
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final byte[] DEFAULT_MAC_ADDRESS
private static byte[] s_hwAddress
private static byte[] s_myIpAddress
private static java.lang.String s_extendedMode
private static byte[] s_requestIpAddress
private static boolean reqTargetIp
private static boolean targetOffset
private static boolean relayMode
private static boolean paramsChecked
static final short BROADCAST_FLAG
static final int DEFAULT_RETRIES
static final long DEFAULT_TIMEOUT
private static final int MESSAGE_TYPE
private static final int REQUESTED_IP
private static int m_nextXid
private java.net.Socket m_connection
private java.io.ObjectOutputStream m_outs
private java.io.ObjectInputStream m_ins
Constructor Detail |
private Poller(long timeout) throws java.io.IOException
java.io.IOException
- if unable to establish the connection with the DHCP client
daemon.Method Detail |
private static Message getDisconnectRequest() throws java.net.UnknownHostException
java.net.UnknownHostException
private static Message getPollingRequest(java.net.InetAddress addr, byte mType)
protected void finalize() throws java.lang.Throwable
java.lang.Throwable
public void close()
java.io.IOException
- if the socket close() method fails.static long isServer(java.net.InetAddress host, long timeout, int retries) throws java.io.IOException
This method actually tests the remote host to determine if it is running a functional DHCP server.
Formats a DHCP query and encodes it in a client request message which is sent to the DHCP daemon over the established TCP socket connection. If a matching DHCP response packet is not received from the DHCP daemon within the specified timeout the client request message will be re-sent up to the specified number of retries.
If a response is received from the DHCP daemon it is validated to ensure that:
If the response validates 'true' is returned. Otherwise the request is resent until max retry count is exceeded.
Before returning, a client disconnect message (remote host field set to zero) is sent to the DHCP daemon.
java.io.IOException
private static void setHwAddress(java.lang.String hwAddressStr)
private static byte[] setIpAddress(java.lang.String ipAddressStr)
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |