public final class JniPingResponse extends Object implements org.opennms.protocols.rt.ResponseWithId<JniPingRequestId>, EchoPacket
This class is use to encapsulate an ICMP reply that conforms to the
packet
class. The reply must be of type ICMP Echo Reply and be
the correct length.
When constructed by the create
method the returned reply
encapsulates the sender's address and the received packet as final,
non-mutable values for the instance.
Constructor and Description |
---|
JniPingResponse(InetAddress addr,
org.opennms.protocols.icmp.ICMPEchoPacket pkt)
Constructs a new reply with the passed address and packet as the contents
of the reply.
|
Modifier and Type | Method and Description |
---|---|
double |
elapsedTime(TimeUnit timeUnit)
Returns the round trip time in the requested TimeUnit
(note that a fractional value will be returned if necessary)
|
InetAddress |
getAddress()
Returns the internet address of the host that sent the reply.
|
int |
getIdentifier() |
long |
getReceivedTimeNanos() |
JniPingRequestId |
getRequestId()
getRequestId
|
long |
getSentTimeNanos() |
int |
getSequenceNumber() |
long |
getThreadId() |
boolean |
isEchoReply()
Returns true if the recovered packet is an echo reply.
|
String |
toString() |
public JniPingResponse(InetAddress addr, org.opennms.protocols.icmp.ICMPEchoPacket pkt)
addr
- The address of the ICMP sender.pkt
- The received packet.public InetAddress getAddress()
InetAddress
object.public JniPingRequestId getRequestId()
getRequestId
getRequestId
in interface org.opennms.protocols.rt.ResponseWithId<JniPingRequestId>
org.opennms.netmgt.icmp.spi.PingRequestId
object.public boolean isEchoReply()
isEchoReply
in interface EchoPacket
public int getIdentifier()
getIdentifier
in interface EchoPacket
public int getSequenceNumber()
getSequenceNumber
in interface EchoPacket
public long getThreadId()
getThreadId
in interface EchoPacket
public long getSentTimeNanos()
getSentTimeNanos
in interface EchoPacket
public long getReceivedTimeNanos()
getReceivedTimeNanos
in interface EchoPacket
public double elapsedTime(TimeUnit timeUnit)
EchoPacket
elapsedTime
in interface EchoPacket
Copyright © 2021. All rights reserved.