verinec.importer.analysis.traceroute
Class TRJPcap.TRJPcapObject

java.lang.Object
  extended by java.lang.Thread
      extended by verinec.importer.analysis.traceroute.ATraceRoute
          extended by verinec.importer.analysis.traceroute.TRJPcap.TRJPcapObject
All Implemented Interfaces:
Runnable
Enclosing class:
TRJPcap

private static class TRJPcap.TRJPcapObject
extends ATraceRoute

This class provides a traceroute and encapsulates the algorithm. To send an receive packages, the JPCap library is used.

Author:
martial.seifriz at unifr.ch

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  jpcap.JpcapCaptor captor
          The packet captor
private  long endTime
           
private  byte id
          The identifier of this traceroute.
private  Logger log
          The logger for this object
private  jpcap.JpcapSender sender
          The packet sender
private  long startTime
           
private  long startTimeTotal
           
private  String statusMessage
          For logging purposes.
private  InetAddress targetIP
          The ip adress of the target host
private  InetAddress thisHostIP
          The ip adress of this host
private  short ttl
           
private  int unreachableHosts
           
 
Fields inherited from class verinec.importer.analysis.traceroute.ATraceRoute
logger, MAX_RETRIES, MAX_UNREACHABLE_HOSTS, maxHops, targetHost, timeOut, UNREACHABLE_HOST_IP, UNREACHABLE_HOST_NAME
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected TRJPcap.TRJPcapObject(jpcap.JpcapSender sender, jpcap.JpcapCaptor captor, InetAddress thisHost)
          The constructor needs a sender and a captor for the packages and the ip of the host, which calls the traceroute method.
 
Method Summary
protected  void abort()
          Make the implementation abort traceroute.
protected  Vector traceRoute(int maxHops, int timeOut, String target)
          This method implements a classical traceroute algorithm with increasing ttl.
private  String treatTimxceed(jpcap.packet.ICMPPacket p)
           
private  String waitForResponse(jpcap.packet.ICMPPacket icmp)
          Wait for an ICMP response to our request.
 
Methods inherited from class verinec.importer.analysis.traceroute.ATraceRoute
isCancled
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

private Logger log
The logger for this object


sender

private jpcap.JpcapSender sender
The packet sender


captor

private jpcap.JpcapCaptor captor
The packet captor


thisHostIP

private InetAddress thisHostIP
The ip adress of this host


targetIP

private InetAddress targetIP
The ip adress of the target host


id

private byte id
The identifier of this traceroute. It identifies a package for this instance.


startTimeTotal

private long startTimeTotal

startTime

private long startTime

endTime

private long endTime

unreachableHosts

private int unreachableHosts

ttl

private short ttl

statusMessage

private String statusMessage
For logging purposes.

Constructor Detail

TRJPcap.TRJPcapObject

protected TRJPcap.TRJPcapObject(jpcap.JpcapSender sender,
                                jpcap.JpcapCaptor captor,
                                InetAddress thisHost)
The constructor needs a sender and a captor for the packages and the ip of the host, which calls the traceroute method.

Parameters:
sender -
captor -
thisHost -
Method Detail

traceRoute

protected Vector traceRoute(int maxHops,
                            int timeOut,
                            String target)
                     throws TraceRouteException
This method implements a classical traceroute algorithm with increasing ttl. To send and receive of the icmp packages, the JPcap library is used. To use JPcap, super user rights are required. The method is not reentrant, that is for several traces, we must wait for each to finish before starting the next.

Specified by:
traceRoute in class ATraceRoute
Parameters:
maxHops - The maximum number of hops between the source and targed host
timeOut - The time in ms between sending and receiving of a request
target - The target host IP in string representation (xxx.xxx.xxx.xxx)
Returns:
a Vector containing the IPs as strins
Throws:
TraceRouteException

waitForResponse

private String waitForResponse(jpcap.packet.ICMPPacket icmp)
Wait for an ICMP response to our request.

Parameters:
icmp - The request packet. (For resend after time out)
Returns:
The IP the answer came from. If timed out to many times, this is ATraceRoute.UNREACHABLE_HOST_IP.

treatTimxceed

private String treatTimxceed(jpcap.packet.ICMPPacket p)

abort

protected void abort()
Make the implementation abort traceroute.

Overrides:
abort in class ATraceRoute

Copyright © 2005 Verinec, DIUF