Package org.opennms.netmgt.icmp.jna
Class JnaPingRequest
- java.lang.Object
-
- org.opennms.netmgt.icmp.jna.JnaPingRequest
-
- All Implemented Interfaces:
Comparable<Delayed>,Delayed,EchoPacket,org.opennms.protocols.rt.Request<JnaPingRequestId,JnaPingRequest,JnaPingReply>
public class JnaPingRequest extends 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(InetAddress addr, int identifier, int sequenceId, long timeout, int retries, int packetsize, PingResponseCallback cb)JnaPingRequest(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 intcompareTo(Delayed request)compareTodoubleelapsedTime(TimeUnit timeUnit)Returns the round trip time in the requested TimeUnit (note that a fractional value will be returned if necessary)InetAddressgetAddress()longgetDelay(TimeUnit unit)JnaPingRequestIdgetId()getIdintgetIdentifier()static longgetNextTID()longgetReceivedTimeNanos()longgetSentTimeNanos()intgetSequenceNumber()longgetThreadId()booleanisEchoReply()booleanisExpired()isExpiredbooleanisProcessed()isProcessedvoidprocessError(Throwable t)booleanprocessResponse(JnaPingReply reply)processResponseJnaPingRequestprocessTimeout()processTimeoutvoidsend(V4Pinger v4, Inet4Address addr4)voidsend(V4Pinger v4, V6Pinger v6)Send this V4PingRequest through the given icmpSocketvoidsend(V6Pinger v6, Inet6Address addr6)StringtoString()toString
-
-
-
Constructor Detail
-
JnaPingRequest
public JnaPingRequest(JnaPingRequestId id, long timeout, int retries, int packetsize, PingResponseCallback cb)
-
JnaPingRequest
public JnaPingRequest(InetAddress addr, int identifier, int sequenceId, long threadId, long timeout, int retries, int packetsize, PingResponseCallback cb)
-
JnaPingRequest
public JnaPingRequest(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:
processResponsein interfaceorg.opennms.protocols.rt.Request<JnaPingRequestId,JnaPingRequest,JnaPingReply>- Parameters:
reply- aorg.opennms.netmgt.icmp.spi.JnaPingReply.PingReplyobject.- Returns:
- a boolean.
-
processTimeout
public JnaPingRequest processTimeout()
processTimeout
- Specified by:
processTimeoutin interfaceorg.opennms.protocols.rt.Request<JnaPingRequestId,JnaPingRequest,JnaPingReply>- Returns:
- a
org.opennms.netmgt.JnaPingRequest.AbstractPingRequestobject.
-
isExpired
public boolean isExpired()
isExpired
- Returns:
- a boolean.
-
getDelay
public long getDelay(TimeUnit unit)
- Specified by:
getDelayin interfaceDelayed- Specified by:
getDelayin interfaceorg.opennms.protocols.rt.Request<JnaPingRequestId,JnaPingRequest,JnaPingReply>
-
compareTo
public int compareTo(Delayed request)
compareTo
- Specified by:
compareToin interfaceComparable<Delayed>- Parameters:
request- aDelayedobject.- Returns:
- a int.
-
getId
public JnaPingRequestId getId()
getId
- Specified by:
getIdin interfaceorg.opennms.protocols.rt.Request<JnaPingRequestId,JnaPingRequest,JnaPingReply>- Returns:
- a
org.opennms.netmgt.icmp.spi.JnaPingRequestId.PingRequestIdobject.
-
processError
public void processError(Throwable t)
- Specified by:
processErrorin interfaceorg.opennms.protocols.rt.Request<JnaPingRequestId,JnaPingRequest,JnaPingReply>
-
isProcessed
public boolean isProcessed()
isProcessed
- Specified by:
isProcessedin 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- aIcmpSocketobject.
-
getAddress
public InetAddress getAddress()
-
send
public void send(V6Pinger v6, Inet6Address addr6)
-
send
public void send(V4Pinger v4, Inet4Address addr4)
-
toString
public String toString()
toString
-
isEchoReply
public boolean isEchoReply()
- Specified by:
isEchoReplyin interfaceEchoPacket
-
getIdentifier
public int getIdentifier()
- Specified by:
getIdentifierin interfaceEchoPacket
-
getSequenceNumber
public int getSequenceNumber()
- Specified by:
getSequenceNumberin interfaceEchoPacket
-
getThreadId
public long getThreadId()
- Specified by:
getThreadIdin interfaceEchoPacket
-
getReceivedTimeNanos
public long getReceivedTimeNanos()
- Specified by:
getReceivedTimeNanosin interfaceEchoPacket
-
getSentTimeNanos
public long getSentTimeNanos()
- Specified by:
getSentTimeNanosin interfaceEchoPacket
-
elapsedTime
public double elapsedTime(TimeUnit timeUnit)
Description copied from interface:EchoPacketReturns the round trip time in the requested TimeUnit (note that a fractional value will be returned if necessary)- Specified by:
elapsedTimein interfaceEchoPacket
-
-