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