Package org.opennms.netmgt.icmp.jni
Class JniIcmpMessenger
- java.lang.Object
-
- org.opennms.netmgt.icmp.jni.JniIcmpMessenger
-
- All Implemented Interfaces:
org.opennms.protocols.rt.Messenger<JniPingRequest,JniPingResponse>
public class JniIcmpMessenger extends java.lang.Object implements org.opennms.protocols.rt.Messenger<JniPingRequest,JniPingResponse>
JniIcmpMessenger- Version:
- $Id: $
- Author:
- brozow
-
-
Constructor Summary
Constructors Constructor Description JniIcmpMessenger(int pingerId)
Constructor for JniIcmpMessenger.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JniPingResponse
createPingResponse(java.net.DatagramPacket packet)
Creates a new instance of the class using the passed datagram as the data source.void
sendRequest(JniPingRequest request)
sendRequestvoid
setAllowFragmentation(boolean allow)
void
setTrafficClass(int tc)
void
start(org.opennms.protocols.rt.ReplyHandler<JniPingResponse> callback)
-
-
-
Method Detail
-
sendRequest
public void sendRequest(JniPingRequest request)
sendRequest
- Specified by:
sendRequest
in interfaceorg.opennms.protocols.rt.Messenger<JniPingRequest,JniPingResponse>
- Parameters:
request
- aJniPingRequest
object.
-
start
public void start(org.opennms.protocols.rt.ReplyHandler<JniPingResponse> callback)
- Specified by:
start
in interfaceorg.opennms.protocols.rt.Messenger<JniPingRequest,JniPingResponse>
-
createPingResponse
public static JniPingResponse createPingResponse(java.net.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.
- Parameters:
packet
- The packet with the ICMP datagram.- Returns:
- a
org.opennms.netmgt.icmp.spi.PingReply
object. - Throws:
java.lang.IllegalArgumentException
- Throw if the datagram is not the correct length or type.java.lang.IndexOutOfBoundsException
- Thrown if the datagram does not contain sufficient data.
-
setTrafficClass
public void setTrafficClass(int tc) throws java.io.IOException
- Throws:
java.io.IOException
-
setAllowFragmentation
public void setAllowFragmentation(boolean allow) throws java.io.IOException
- Throws:
java.io.IOException
-
-