/** * <p>ping</p> * * @param host a {@link java.net.InetAddress} object. * @param timeout a long. * @param retries a int. * @param sequenceId a short. * @param cb a {@link org.opennms.netmgt.ping.PingResponseCallback} object. * @throws java.lang.Exception if any. */ public void ping(InetAddress host, long timeout, int retries, short sequenceId, PingResponseCallback cb) throws Exception { initialize(); s_pingTracker.sendRequest(new org.opennms.netmgt.ping.PingRequest(host, sequenceId, timeout, retries, cb)); }
/** * <p>ping</p> * * @param host a {@link java.net.InetAddress} object. * @param timeout a long. * @param retries a int. * @param sequenceId a short. * @param cb a {@link org.opennms.netmgt.ping.PingResponseCallback} object. * @throws java.lang.Exception if any. */ @Override public void ping(final InetAddress host, final long timeout, final int retries, final int sequenceId, final PingResponseCallback cb) throws Exception { initialize(); m_pingTracker.sendRequest(new JnaPingRequest(host, m_pingerId, sequenceId, timeout, retries, DEFAULT_PACKET_SIZE, cb)); }
/** * <p>ping</p> * * @param host a {@link java.net.InetAddress} object. * @param timeout a long. * @param retries a int. * @param packetsize The size in byte of the ICMP packet. * @param sequenceId a short. * @param cb a {@link org.opennms.netmgt.ping.PingResponseCallback} object. * @throws java.lang.Exception if any. */ @Override public void ping(final InetAddress host, final long timeout, final int retries, final int packetsize, final int sequenceId, final PingResponseCallback cb) throws Exception { initialize(); m_pingTracker.sendRequest(new JnaPingRequest(host, m_pingerId, sequenceId, timeout, retries, packetsize, cb)); }
/** * <p>ping</p> * * @param host a {@link java.net.InetAddress} object. * @param timeout a long. * @param retries a int. * @param packetsize The size in byte of the ICMP packet. * @param sequenceId a short. * @param cb a {@link org.opennms.netmgt.icmp.jni.PingResponseCallback} object. * @throws java.lang.Exception if any. */ @Override public void ping(final InetAddress host, final long timeout, final int retries, final int packetsize, final int sequenceId, final PingResponseCallback cb) throws Exception { initialize(); s_pingTracker.sendRequest(new JniPingRequest(host, m_pingerId, sequenceId, timeout, retries, packetsize, new LogPrefixPreservingPingResponseCallback(cb))); }
/** * <p>ping</p> * * @param host a {@link java.net.InetAddress} object. * @param timeout a long. * @param retries a int. * @param packetsize The size in byte of the ICMP packet. * @param sequenceId a short. * @param cb a {@link org.opennms.netmgt.icmp.jni.PingResponseCallback} object. * @throws java.lang.Exception if any. */ @Override public void ping(final InetAddress host, final long timeout, final int retries, final int sequenceId, final PingResponseCallback cb) throws Exception { initialize(); s_pingTracker.sendRequest(new JniPingRequest(host, m_pingerId, sequenceId, timeout, retries, DEFAULT_PACKET_SIZE, new LogPrefixPreservingPingResponseCallback(cb))); }
/** * <p>parallelPing</p> * * @param host a {@link java.net.InetAddress} object. * @param count a int. * @param timeout a long. * @param pingInterval a long. * @return a {@link java.util.List} object. * @throws java.lang.Exception if any. */ public List<Number> parallelPing(InetAddress host, int count, long timeout, long pingInterval) throws Exception { initialize(); ParallelPingResponseCallback cb = new ParallelPingResponseCallback(count); if (timeout == 0) { timeout = DEFAULT_TIMEOUT; } for (int i = 0; i < count; i++) { PingRequest<IcmpSocket> request = new org.opennms.netmgt.ping.PingRequest(host, (short) i, timeout, 0, cb); s_pingTracker.sendRequest(request); Thread.sleep(pingInterval); } cb.waitFor(); return cb.getResponseTimes(); }
/** * Ping a remote host, sending 1 or more packets at the given interval, and then * return the response times as a list. * * @param host The {@link java.net.InetAddress} address to poll. * @param count The number of packets to send. * @param timeout The time to wait between each retry. * @param pingInterval The interval at which packets will be sent. * @param size The size of the packet to send. * @return a {@link java.util.List} of 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. */ @Override public List<Number> parallelPing(final InetAddress host, final int count, final long timeout, final long pingInterval, final int size) throws Exception { initialize(); final ParallelPingResponseCallback cb = new ParallelPingResponseCallback(count); final long threadId = JniPingRequest.getNextTID(); for (int seqNum = 0; seqNum < count; seqNum++) { final JniPingRequest request = new JniPingRequest(host, m_pingerId, seqNum, threadId, timeout == 0? DEFAULT_TIMEOUT : timeout, 0, size, cb); s_pingTracker.sendRequest(request); Thread.sleep(pingInterval); } cb.waitFor(); return cb.getResponseTimes(); }
/** * Ping a remote host, sending 1 or more packets at the given interval, and then * return the response times as a list. * * @param host The {@link java.net.InetAddress} address to poll. * @param count The number of packets to send. * @param timeout The time to wait between each retry. * @param pingInterval The interval at which packets will be sent. * @param size The size of the packet to send. * @return a {@link java.util.List} of 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. */ @Override public List<Number> parallelPing(final InetAddress host, final int count, final long timeout, final long pingInterval, final int size) throws Exception { initialize(); final ParallelPingResponseCallback cb = new ParallelPingResponseCallback(count); final long threadId = JnaPingRequest.getNextTID(); for (int seqNum = 0; seqNum < count; seqNum++) { final JnaPingRequest request = new JnaPingRequest(host, m_pingerId, seqNum, threadId, timeout == 0? DEFAULT_TIMEOUT : timeout, 0, size, cb); m_pingTracker.sendRequest(request); Thread.sleep(pingInterval); } cb.waitFor(); return cb.getResponseTimes(); }
/** * <p>ping</p> * * @param host a {@link java.net.InetAddress} object. * @param timeout a long. * @param retries a int. * @param packetsize The size in byte of the ICMP packet. * @param sequenceId a short. * @param cb a {@link org.opennms.netmgt.icmp.jni.PingResponseCallback} object. * @throws java.lang.Exception if any. */ @Override public void ping(final InetAddress host, final long timeout, final int retries, final int sequenceId, final PingResponseCallback cb) throws Exception { if (host instanceof Inet4Address) { initialize4(); m_jniPinger.ping(host, timeout, retries, DEFAULT_PACKET_SIZE, sequenceId, cb); } else { initialize6(); s_pingTracker.sendRequest(new Jni6PingRequest((Inet6Address)host, m_pingerId, sequenceId, timeout, retries, DEFAULT_PACKET_SIZE, new LogPrefixPreservingPingResponseCallback(cb))); } }
/** * <p>ping</p> * * @param host a {@link java.net.InetAddress} object. * @param timeout a long. * @param retries a int. * @param packetsize The size in byte of the ICMP packet. * @param sequenceId a short. * @param cb a {@link org.opennms.netmgt.icmp.jni.PingResponseCallback} object. * @throws java.lang.Exception if any. */ @Override public void ping(final InetAddress host, final long timeout, final int retries, final int packetsize, final int sequenceId, final PingResponseCallback cb) throws Exception { if (host instanceof Inet4Address) { initialize4(); m_jniPinger.ping(host, timeout, retries, packetsize, sequenceId, cb); } else { initialize6(); s_pingTracker.sendRequest(new Jni6PingRequest((Inet6Address)host, m_pingerId, sequenceId, timeout, retries, packetsize, new LogPrefixPreservingPingResponseCallback(cb))); } }
/** * <p>ping</p> * * @param host a {@link java.net.InetAddress} object. * @param timeout a long. * @param retries a int. * @param packetsize The size in byte of the ICMP packet. * @param sequenceId a short. * @param cb a {@link org.opennms.netmgt.icmp.jni.PingResponseCallback} object. * @throws java.lang.Exception if any. */ @Override public void ping(final InetAddress host, final long timeout, final int retries, final int packetsize, final int sequenceId, final PingResponseCallback cb) throws Exception { if (host instanceof Inet4Address) { initialize4(); m_jniPinger.ping(host, timeout, retries, packetsize, sequenceId, cb); } else { initialize6(); s_pingTracker.sendRequest(new Jni6PingRequest((Inet6Address)host, m_pingerId, sequenceId, timeout, retries, packetsize, new LogPrefixPreservingPingResponseCallback(cb))); } }
/** * <p>ping</p> * * @param host a {@link java.net.InetAddress} object. * @param timeout a long. * @param retries a int. * @param packetsize The size in byte of the ICMP packet. * @param sequenceId a short. * @param cb a {@link org.opennms.netmgt.icmp.jni.PingResponseCallback} object. * @throws java.lang.Exception if any. */ @Override public void ping(final InetAddress host, final long timeout, final int retries, final int sequenceId, final PingResponseCallback cb) throws Exception { if (host instanceof Inet4Address) { initialize4(); m_jniPinger.ping(host, timeout, retries, DEFAULT_PACKET_SIZE, sequenceId, cb); } else { initialize6(); s_pingTracker.sendRequest(new Jni6PingRequest((Inet6Address)host, m_pingerId, sequenceId, timeout, retries, DEFAULT_PACKET_SIZE, new LogPrefixPreservingPingResponseCallback(cb))); } }
for (int seqNum = 0; seqNum < count; seqNum++) { final Jni6PingRequest request = new Jni6PingRequest((Inet6Address)host, m_pingerId, seqNum, threadId, timeout == 0? DEFAULT_TIMEOUT : timeout, 0 , size, cb); s_pingTracker.sendRequest(request); Thread.sleep(pingInterval);
for (int seqNum = 0; seqNum < count; seqNum++) { final Jni6PingRequest request = new Jni6PingRequest((Inet6Address)host, m_pingerId, seqNum, threadId, timeout == 0? DEFAULT_TIMEOUT : timeout, 0 , size, cb); s_pingTracker.sendRequest(request); Thread.sleep(pingInterval);