public class JniIcmpMessenger extends Object implements org.opennms.protocols.rt.Messenger<JniPingRequest,JniPingResponse>
| Constructor and Description |
|---|
JniIcmpMessenger(int pingerId)
Constructor for JniIcmpMessenger.
|
| Modifier and Type | Method and Description |
|---|---|
static JniPingResponse |
createPingResponse(DatagramPacket packet)
Creates a new instance of the class using the passed datagram as the data
source.
|
void |
sendRequest(JniPingRequest request)
sendRequest
|
void |
setAllowFragmentation(boolean allow) |
void |
setTrafficClass(int tc) |
void |
start(org.opennms.protocols.rt.ReplyHandler<JniPingResponse> callback) |
public JniIcmpMessenger(int pingerId)
throws IOException
Constructor for JniIcmpMessenger.
pingerId - IOException - if any.public void sendRequest(JniPingRequest request)
sendRequest
sendRequest in interface org.opennms.protocols.rt.Messenger<JniPingRequest,JniPingResponse>request - a JniPingRequest object.public void start(org.opennms.protocols.rt.ReplyHandler<JniPingResponse> callback)
start in interface org.opennms.protocols.rt.Messenger<JniPingRequest,JniPingResponse>public static JniPingResponse createPingResponse(DatagramPacket packet)
Creates a new instance of the class using the passed datagram as the data source. The address and ping packet are extracted from the datagram and returned as a new instance of the class. In addition to extracting the packet, the packet's received time is updated to the current time.
If the received datagram is not an echo reply or an incorrect length then an exception is generated to alert the caller.
packet - The packet with the ICMP datagram.org.opennms.netmgt.icmp.spi.PingReply object.IllegalArgumentException - Throw if the datagram is not the correct length or type.IndexOutOfBoundsException - Thrown if the datagram does not contain sufficient data.public void setTrafficClass(int tc)
throws IOException
IOExceptionpublic void setAllowFragmentation(boolean allow)
throws IOException
IOExceptionCopyright © 2020. All rights reserved.