|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.opennms.netmgt.ping.ReplyReceiver
public final class ReplyReceiver
This class is designed to be a single point of reciept for all ICMP messages
received by an org.opennms.protocols.icmp.IcmpSocketIcmpSocket
instance. The class implements the
PausableFiberinterface as a
means to control the operation of the receiver.
Once the receiver is started it will process all recieved datagrams and filter them based upon their ICMP code and the filter identifier used to construct the reciever. All ICMP messages, except for Echo Replies, are discared by the reciever. In addition, only those echo replies that have their identifier set to the passed filter identifier are also discarded.
Received datagrams that pass the requirement of the receiver are added to the
reply queue for processing by the application. Only instances of the
Replyclass are added to the queue for processing.
| Field Summary |
|---|
| 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 | |
|---|---|
ReplyReceiver(org.opennms.protocols.icmp.IcmpSocket portal,
org.opennms.core.queue.FifoQueue<Reply> replyQ,
short filterID)
Constructs a ping reciever thread that reads datagrams from the connection and adds them to the queue. |
|
| Method Summary | |
|---|---|
String |
getName()
Returns the name of this fiber. |
int |
getStatus()
Returns the status of the fiber. |
void |
pause()
Pauses the reciever. |
protected void |
process(DatagramPacket pkt)
Processes the received datagram and adds a new Reply
instance to the reply queue. |
void |
resume()
Resumes the recipt and processing of ICMP messages. |
void |
run()
The run() method does the actual work of reading messages from the daemon and placing those messages in the appropriate queue for use by other threads. |
void |
start()
Starts the ICMP receiver. |
void |
stop()
Stops the current receiver. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReplyReceiver(org.opennms.protocols.icmp.IcmpSocket portal,
org.opennms.core.queue.FifoQueue<Reply> replyQ,
short filterID)
Constructs a ping reciever thread that reads datagrams from the
connection and adds them to the queue. As each datagram is received and
processed by the receiver, replies matching the criteria are added to the
queue. Each reply must be of type ICMP Echo Reply, its identity must
match the filterID, and its length must be equal to the
ping packet'slength.
portal - The ICMP socketreplyQ - The reply queue for matching messages.filterID - The ICMP Identity for matching.| Method Detail |
|---|
protected void process(DatagramPacket pkt)
throws InterruptedException,
org.opennms.core.queue.FifoQueueException
Processes the received datagram and adds a new Reply
instance to the reply queue. The recieved packet must pass the following
criteria:
Packet.getNetworkSize()
pkt - The datagram to process.
InterruptedException - Thrown if the thread is interrupted.
org.opennms.core.fiber.FifoQueueException - Thrown if a queue exception occurs adding a new reply.
org.opennms.core.queue.FifoQueueExceptionpublic final void start()
start in interface org.opennms.core.fiber.FiberIllegalStateException - Thrown if the receiver has already been started.public final void stop()
stop in interface org.opennms.core.fiber.FiberIllegalStateException - Thrown if the receiver was never started.public final void pause()
pause in interface org.opennms.core.fiber.PausableFiberpublic final void resume()
resume in interface org.opennms.core.fiber.PausableFiberpublic final String getName()
getName in interface org.opennms.core.fiber.Fiberpublic final int getStatus()
getStatus in interface org.opennms.core.fiber.Fiberpublic final void run()
run in interface Runnable
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||