Package org.opennms.netmgt.icmp.jna
Class JnaPingRequest
- java.lang.Object
-
- org.opennms.netmgt.icmp.jna.JnaPingRequest
-
- All Implemented Interfaces:
java.lang.Comparable<java.util.concurrent.Delayed>
,java.util.concurrent.Delayed
,EchoPacket
,org.opennms.protocols.rt.Request<JnaPingRequestId,JnaPingRequest,JnaPingReply>
public class JnaPingRequest extends java.lang.Object implements org.opennms.protocols.rt.Request<JnaPingRequestId,JnaPingRequest,JnaPingReply>, EchoPacket
This class is used to encapsulate a ping request. A request consist of the pingable address and a signaled state.- Author:
- Ben Reed, Mathew Brozowski
-
-
Constructor Summary
Constructors Constructor Description JnaPingRequest(java.net.InetAddress addr, int identifier, int sequenceId, long timeout, int retries, int packetsize, PingResponseCallback cb)
JnaPingRequest(java.net.InetAddress addr, int identifier, int sequenceId, long threadId, long timeout, int retries, int packetsize, PingResponseCallback cb)
JnaPingRequest(JnaPingRequestId id, long timeout, int retries, int packetsize, PingResponseCallback cb)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(java.util.concurrent.Delayed request)
compareTodouble
elapsedTime(java.util.concurrent.TimeUnit timeUnit)
Returns the round trip time in the requested TimeUnit (note that a fractional value will be returned if necessary)java.net.InetAddress
getAddress()
long
getDelay(java.util.concurrent.TimeUnit unit)
JnaPingRequestId
getId()
getIdint
getIdentifier()
static long
getNextTID()
long
getReceivedTimeNanos()
long
getSentTimeNanos()
int
getSequenceNumber()
long
getThreadId()
boolean
isEchoReply()
boolean
isExpired()
isExpiredboolean
isProcessed()
isProcessedvoid
processError(java.lang.Throwable t)
boolean
processResponse(JnaPingReply reply)
processResponseJnaPingRequest
processTimeout()
processTimeoutvoid
send(V4Pinger v4, java.net.Inet4Address addr4)
void
send(V4Pinger v4, V6Pinger v6)
Send this V4PingRequest through the given icmpSocketvoid
send(V6Pinger v6, java.net.Inet6Address addr6)
java.lang.String
toString()
toString
-
-
-
Constructor Detail
-
JnaPingRequest
public JnaPingRequest(JnaPingRequestId id, long timeout, int retries, int packetsize, PingResponseCallback cb)
-
JnaPingRequest
public JnaPingRequest(java.net.InetAddress addr, int identifier, int sequenceId, long threadId, long timeout, int retries, int packetsize, PingResponseCallback cb)
-
JnaPingRequest
public JnaPingRequest(java.net.InetAddress addr, int identifier, int sequenceId, long timeout, int retries, int packetsize, PingResponseCallback cb)
-
-
Method Detail
-
getNextTID
public static final long getNextTID()
-
processResponse
public boolean processResponse(JnaPingReply reply)
processResponse
- Specified by:
processResponse
in interfaceorg.opennms.protocols.rt.Request<JnaPingRequestId,JnaPingRequest,JnaPingReply>
- Parameters:
reply
- aorg.opennms.netmgt.icmp.spi.JnaPingReply.PingReply
object.- Returns:
- a boolean.
-
processTimeout
public JnaPingRequest processTimeout()
processTimeout
- Specified by:
processTimeout
in interfaceorg.opennms.protocols.rt.Request<JnaPingRequestId,JnaPingRequest,JnaPingReply>
- Returns:
- a
org.opennms.netmgt.JnaPingRequest.AbstractPingRequest
object.
-
isExpired
public boolean isExpired()
isExpired
- Returns:
- a boolean.
-
getDelay
public long getDelay(java.util.concurrent.TimeUnit unit)
- Specified by:
getDelay
in interfacejava.util.concurrent.Delayed
- Specified by:
getDelay
in interfaceorg.opennms.protocols.rt.Request<JnaPingRequestId,JnaPingRequest,JnaPingReply>
-
compareTo
public int compareTo(java.util.concurrent.Delayed request)
compareTo
- Specified by:
compareTo
in interfacejava.lang.Comparable<java.util.concurrent.Delayed>
- Parameters:
request
- aDelayed
object.- Returns:
- a int.
-
getId
public JnaPingRequestId getId()
getId
- Specified by:
getId
in interfaceorg.opennms.protocols.rt.Request<JnaPingRequestId,JnaPingRequest,JnaPingReply>
- Returns:
- a
org.opennms.netmgt.icmp.spi.JnaPingRequestId.PingRequestId
object.
-
processError
public void processError(java.lang.Throwable t)
- Specified by:
processError
in interfaceorg.opennms.protocols.rt.Request<JnaPingRequestId,JnaPingRequest,JnaPingReply>
-
isProcessed
public boolean isProcessed()
isProcessed
- Specified by:
isProcessed
in interfaceorg.opennms.protocols.rt.Request<JnaPingRequestId,JnaPingRequest,JnaPingReply>
- Returns:
- a boolean.
-
send
public void send(V4Pinger v4, V6Pinger v6)
Send this V4PingRequest through the given icmpSocket- Parameters:
icmpSocket
- aIcmpSocket
object.
-
getAddress
public java.net.InetAddress getAddress()
-
send
public void send(V6Pinger v6, java.net.Inet6Address addr6)
-
send
public void send(V4Pinger v4, java.net.Inet4Address addr4)
-
toString
public java.lang.String toString()
toString
- Overrides:
toString
in classjava.lang.Object
- Returns:
- a
String
object.
-
isEchoReply
public boolean isEchoReply()
- Specified by:
isEchoReply
in interfaceEchoPacket
-
getIdentifier
public int getIdentifier()
- Specified by:
getIdentifier
in interfaceEchoPacket
-
getSequenceNumber
public int getSequenceNumber()
- Specified by:
getSequenceNumber
in interfaceEchoPacket
-
getThreadId
public long getThreadId()
- Specified by:
getThreadId
in interfaceEchoPacket
-
getReceivedTimeNanos
public long getReceivedTimeNanos()
- Specified by:
getReceivedTimeNanos
in interfaceEchoPacket
-
getSentTimeNanos
public long getSentTimeNanos()
- Specified by:
getSentTimeNanos
in interfaceEchoPacket
-
elapsedTime
public double elapsedTime(java.util.concurrent.TimeUnit timeUnit)
Description copied from interface:EchoPacket
Returns the round trip time in the requested TimeUnit (note that a fractional value will be returned if necessary)- Specified by:
elapsedTime
in interfaceEchoPacket
-
-