verinec.importer.analysis.traceroute
Class TraceRoute

java.lang.Object
  extended by verinec.importer.analysis.traceroute.TraceRoute

public class TraceRoute
extends Object

This class manages several different possibilities to do a traceroute and allows to use them in a general, common way.

Author:
martial.seifriz at unifr.ch

Field Summary
private  int algorithm
          with algorithm the algorithm of the traceroute can be choosen.
static int DEFAULT_MAX_HOPS
          default parameter for maximum hops
static int DEFAULT_MODUS
          Default mode uses the shell command.
static int DEFAULT_TIMEOUT
          default parameter for the time out
static int JPCAP
          Algorithm: Use our own implementation with JPCAP.
private  Logger logger
          The logger for this object
static int OS_SHELL_COMMAND
          Algorithm: Use the OS shell command
static int TCP_TRACEROUTE
          Algorithm: Use the TCP traceroute executable
private  ATraceRoute tr
          the object, where the specific traceroute algorithm is implemented
 
Constructor Summary
TraceRoute()
          the defalt constructor, it sets the algorithm to a default value.
TraceRoute(int algorithm)
          the constructor, it sets the algorithm
 
Method Summary
 void abort()
          Abort the executions as soon as possible.
 int getAlgorithm()
          Fetch the used algorithm.
 String getUnreachableHostIP()
          get the representation of an unreachable host
 void setModus(int algorithm)
          sets the algorithm. ie the algorithm, which should be used and initialisize the AtraceRoute object
 Vector traceRoute(int maxHops, int timeOut, String target)
          public traceroute command
 Vector traceRoute(int maxHops, int timeOut, String target, int modus)
          the traceRoute function. all parameter are checked here, the algorithm is set and if everything is ok, the traceroute method is called.
 Vector traceRoute(String target)
          public traceroute command with Default parameters for maxHops, timeOut and Modus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OS_SHELL_COMMAND

public static final int OS_SHELL_COMMAND
Algorithm: Use the OS shell command

See Also:
Constant Field Values

JPCAP

public static final int JPCAP
Algorithm: Use our own implementation with JPCAP.

See Also:
Constant Field Values

TCP_TRACEROUTE

public static final int TCP_TRACEROUTE
Algorithm: Use the TCP traceroute executable

See Also:
Constant Field Values

DEFAULT_MODUS

public static final int DEFAULT_MODUS
Default mode uses the shell command.

See Also:
Constant Field Values

logger

private Logger logger
The logger for this object


DEFAULT_MAX_HOPS

public static final int DEFAULT_MAX_HOPS
default parameter for maximum hops

See Also:
Constant Field Values

DEFAULT_TIMEOUT

public static final int DEFAULT_TIMEOUT
default parameter for the time out

See Also:
Constant Field Values

tr

private ATraceRoute tr
the object, where the specific traceroute algorithm is implemented


algorithm

private int algorithm
with algorithm the algorithm of the traceroute can be choosen. eg. OS_SHELL_COMMAND to use the shell command or JPCAP for the Jpcap implemetation

Constructor Detail

TraceRoute

public TraceRoute(int algorithm)
           throws TraceRouteException
the constructor, it sets the algorithm

Parameters:
algorithm - The used algorithm ie. traceroute algorithm
Throws:
TraceRouteException

TraceRoute

public TraceRoute()
           throws TraceRouteException
the defalt constructor, it sets the algorithm to a default value. this one is specified in DEFAULT_MODUS

Throws:
TraceRouteException
Method Detail

traceRoute

public Vector traceRoute(int maxHops,
                         int timeOut,
                         String target)
                  throws TraceRouteException
public traceroute command

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
Throws:
TraceRouteException

traceRoute

public Vector traceRoute(String target)
                  throws TraceRouteException
public traceroute command with Default parameters for maxHops, timeOut and Modus

Parameters:
target - The target host IP in string representation (xxx.xxx.xxx.xxx)
Returns:
a vector containing the IPs
Throws:
TraceRouteException

traceRoute

public Vector traceRoute(int maxHops,
                         int timeOut,
                         String target,
                         int modus)
                  throws TraceRouteException
the traceRoute function. all parameter are checked here, the algorithm is set and if everything is ok, the traceroute method is called.

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)
modus - the used algorithm ie. traceroute algorithm
Returns:
a vector containing the IPs
Throws:
TraceRouteException

setModus

public void setModus(int algorithm)
              throws TraceRouteException
sets the algorithm. ie the algorithm, which should be used and initialisize the AtraceRoute object

Parameters:
algorithm - The new algorithm.
Throws:
TraceRouteException

getUnreachableHostIP

public String getUnreachableHostIP()
get the representation of an unreachable host

Returns:
string representation of an unreachable host

abort

public void abort()
Abort the executions as soon as possible.


getAlgorithm

public int getAlgorithm()
Fetch the used algorithm.

Returns:
The algorithm.

Copyright © 2005 Verinec, DIUF