Package org.opennms.netmgt.icmp
Interface Pinger
-
- All Known Implementing Classes:
BestMatchPinger,JnaPinger,Jni6Pinger,JniPinger,NullPinger,TestPinger
public interface PingerPinger class.
- Author:
- Ben Reed, Mathew Brozowski
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidinitialize4()Initialize IPv4 in this Pinger implementation.voidinitialize6()Initialize IPv6 in this Pinger implementation.booleanisV4Available()Whether or not IPv4 is initialized and available for this implementation.booleanisV6Available()Whether or not IPv6 is initialized and available for this implementation.List<Number>parallelPing(InetAddress host, int count, long timeout, long pingInterval)Ping a remote host, sending 1 or more packets at the given interval, and then return the response times as a list.List<Number>parallelPing(InetAddress host, int count, long timeout, long pingInterval, int size)Ping a remote host, sending 1 or more packets at the given interval, and then return the response times as a list.Numberping(InetAddress host)Ping a remote host, using the default number of retries and timeouts.Numberping(InetAddress host, long timeout, int retries)This method is used to ping a remote host to test for ICMP support.Numberping(InetAddress host, long timeout, int retries, int packetsize)This method is used to ping a remote host to test for ICMP support.voidping(InetAddress host, long timeout, int retries, int packetsize, int sequenceId, PingResponseCallback cb)This method is used to ping a remote host to test for ICMP support.voidping(InetAddress host, long timeout, int retries, int sequenceId, PingResponseCallback cb)This method is used to ping a remote host to test for ICMP support.voidsetAllowFragmentation(boolean allow)voidsetTrafficClass(int tc)
-
-
-
Method Detail
-
ping
void ping(InetAddress host, long timeout, int retries, int packetsize, int sequenceId, PingResponseCallback cb) throws Exception
This method is used to ping a remote host to test for ICMP support. Calls the callback method upon success or error.- Parameters:
host- TheInetAddressaddress to poll.timeout- The time to wait between each retry.retries- The number of times to retry.packetsize- The size in byte of the ICMP packet.sequenceId- an ID representing the pingcb- theorg.opennms.netmgt.ping.PingResponseCallbackcallback to call upon success or error- Throws:
Exception
-
ping
void ping(InetAddress host, long timeout, int retries, int sequenceId, PingResponseCallback cb) throws Exception
This method is used to ping a remote host to test for ICMP support. Calls the callback method upon success or error.- Parameters:
host- TheInetAddressaddress to poll.timeout- The time to wait between each retry.retries- The number of times to retry.sequenceId- an ID representing the pingcb- theorg.opennms.netmgt.ping.PingResponseCallbackcallback to call upon success or error- Throws:
Exception
-
ping
Number ping(InetAddress host, long timeout, int retries, int packetsize) throws Exception
This method is used to ping a remote host to test for ICMP support. If the remote host responds within the specified period, defined by retries and timeouts, then the response time is returned.- Parameters:
host- TheInetAddressaddress to poll.timeout- The time to wait between each retry.retries- The number of times to retry.packetsize- The size in byte of the ICMP packet.- Returns:
- The response time in microseconds if the host is reachable and has responded with an echo reply, otherwise a null value.
- Throws:
Exception
-
ping
Number ping(InetAddress host, long timeout, int retries) throws Exception
This method is used to ping a remote host to test for ICMP support. If the remote host responds within the specified period, defined by retries and timeouts, then the response time is returned.- Parameters:
host- TheInetAddressaddress to poll.timeout- The time to wait between each retry.retries- The number of times to retry.- Returns:
- The response time in microseconds if the host is reachable and has responded with an echo reply, otherwise a null value.
- Throws:
Exception
-
ping
Number ping(InetAddress host) throws Exception
Ping a remote host, using the default number of retries and timeouts.- Parameters:
host- TheInetAddressaddress to poll.- Returns:
- The response time in microseconds if the host is reachable and has responded with an echo reply, otherwise a null value.
- Throws:
IOException- if any.InterruptedException- if any.Exception- if any.
-
parallelPing
List<Number> parallelPing(InetAddress host, int count, long timeout, long pingInterval, int size) throws Exception
Ping a remote host, sending 1 or more packets at the given interval, and then return the response times as a list.- Parameters:
host- TheInetAddressaddress to poll.count- The number of packets to send.timeout- The time to wait between each retry.pingInterval- The interval at which packets will be sent.size- The size of the packet to send.- Returns:
- a
Listof response times in microseconds. If, for a given ping request, the host is reachable and has responded with an echo reply, it will contain a number, otherwise a null value. - Throws:
Exception
-
parallelPing
List<Number> parallelPing(InetAddress host, int count, long timeout, long pingInterval) throws Exception
Ping a remote host, sending 1 or more packets at the given interval, and then return the response times as a list.- Parameters:
host- TheInetAddressaddress to poll.count- The number of packets to send.timeout- The time to wait between each retry.pingInterval- The interval at which packets will be sent.- Returns:
- a
Listof response times in microseconds. If, for a given ping request, the host is reachable and has responded with an echo reply, it will contain a number, otherwise a null value. - Throws:
Exception
-
initialize4
void initialize4() throws ExceptionInitialize IPv4 in this Pinger implementation. If unable to do so, implementations should throw an exception.- Throws:
Exception
-
initialize6
void initialize6() throws ExceptionInitialize IPv6 in this Pinger implementation. If unable to do so, implementations should throw an exception.- Throws:
Exception
-
isV4Available
boolean isV4Available()
Whether or not IPv4 is initialized and available for this implementation.
-
isV6Available
boolean isV6Available()
Whether or not IPv6 is initialized and available for this implementation.- Returns:
-
-