|
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.Dhcpd
The DHCP client daemon serves as a multiplexor for DHCP requests and responses. The Bootp/DHCP protocol specifies that a DHCP server listens for requests on local UDP/67 and will either send/broadcast responses to UDP/68 or UDP/67 or will unicast responses back to the client's UDP port on from which the request originated.
The DHCP daemon accepts client connections on TCP/5818. Once a client is connected it can begin forwarding requests. A list of all currently connected clients is maintained. Requests have the following format:
The client indicates that it is finished by sending a request with the remote host IP address set to zero (0).
Incoming requests are sent to UDP/67 on specified remote host. If the remote host is runnning a DHCP server it will send/broadcast an appropriate response to UDP/68 or UDP/67 (or will unicast the response).
The DHCP daemon includes a listener thread which binds to UDP/68 or UDP/67 and simply listens for any incoming DHCP responses. In extended mode, threads are started on both ports. When a datagram is received by the listener thread(s) it loops through the list of currently connected clients and forwards the DHCP response packet to each client. It is the responsibility of the client to validate that the datagram is in response to a DHCP request packet that it generated.
Field Summary | |
private static java.lang.String |
LOG4J_CATEGORY
Log4J prefix |
private static java.util.List |
m_clients
List of clients currently connected to the DHCP daemon |
private Receiver |
m_listener
DHCP response port 67 listener. |
private Receiver2 |
m_listener2
DHCP response port 68 listener. |
private java.net.ServerSocket |
m_server
Socket over which the daemon actively listens for new client connection requests. |
private static Dhcpd |
m_singleton
The singular instance of the DHCP server. |
private int |
m_status
The current status of the fiber. |
private java.lang.Thread |
m_worker
The working thread |
Fields inherited from interface org.opennms.core.fiber.PausableFiber |
PAUSE_PENDING, PAUSED, RESUME_PENDING |
Fields inherited from interface org.opennms.core.fiber.Fiber |
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED |
Constructor Summary | |
private |
Dhcpd()
Constructs a new DHCP server instance. |
Method Summary | |
static Dhcpd |
getInstance()
Returns the singular instance of the DHCP server. |
java.lang.String |
getName()
Returns the current name of the fiber. |
int |
getStatus()
Returns the current status of the fiber. |
static long |
isServer(java.net.InetAddress address)
Contacts the public server and checks to see if the the passed address is a DHCP server. |
static long |
isServer(java.net.InetAddress address,
long timeout,
int retries)
Contacts the public server and checks to see if the the passed address is a DHCP server. |
void |
pause()
Pauses Dhcpd |
void |
resume()
Resumes Trapd |
void |
run()
The main routine of the DHCP server. |
void |
start()
Starts the server instance. |
void |
stop()
Stops the currently running instance of the DHCP server. |
void |
update(java.util.Observable inst,
java.lang.Object ignored)
This method is called by the observable instances that the server has registered to receive. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String LOG4J_CATEGORY
private static final Dhcpd m_singleton
private static java.util.List m_clients
private java.net.ServerSocket m_server
private Receiver m_listener
private Receiver2 m_listener2
private int m_status
private java.lang.Thread m_worker
Constructor Detail |
private Dhcpd()
null
.
Method Detail |
public void start()
throwable
.
start
in interface Fiber
java.lang.IllegalStateException
- Thrown if the server is already running.
java.lang.reflect.UndeclaredThrowableException
- Thrown if a non-runtime exception is genereated during
startup.public void stop()
stop
in interface Fiber
public int getStatus()
getStatus
in interface Fiber
Fiber
.public java.lang.String getName()
getName
in interface Fiber
Fiber
.public void pause()
pause
in interface PausableFiber
public void resume()
resume
in interface PausableFiber
public void run()
run
in interface java.lang.Runnable
public void update(java.util.Observable inst, java.lang.Object ignored)
update
in interface java.util.Observer
inst
- The observable object that has changed.ignored
- Thsi parameter is ignored by this method.public static Dhcpd getInstance()
public static long isServer(java.net.InetAddress address, long timeout, int retries) throws java.io.IOException
address
- The address to query.timeout
- The time to wait between retries.retries
- The maximum number of attempts.
java.io.IOException
- Thrown if an error occurs.public static long isServer(java.net.InetAddress address) throws java.io.IOException
address
- The address to query.
java.io.IOException
- Thrown if an error occurs.
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |