simnet
Class SimpleINetParser

java.lang.Object
  extended bysimnet.TopologyParser
      extended bysimnet.SimpleINetParser
All Implemented Interfaces:
Pluggable

public class SimpleINetParser
extends TopologyParser
implements Pluggable

A TopologyParser that works with IP addresses.


Field Summary
private static java.lang.String BI_LINK
           
protected  int current_line
           
protected  java.util.Hashtable hosts
           
protected  java.util.Hashtable links
           
private  java.util.Hashtable nattedNodes
           
private  java.util.Hashtable nattedRouters
           
protected  int next_link_id
          The ID of the next link to create.
private static java.lang.String NODE_UNKNOWN
           
static java.lang.String OTTER_TEMP_FILE
           
protected  java.util.Hashtable routers
           
protected  Simulator sim
           
private static java.lang.String UNI_LINK
           
 
Constructor Summary
SimpleINetParser()
           
 
Method Summary
protected  void finalize()
          For debugging
 void initialize(java.util.Hashtable router_table, java.util.Hashtable host_table, java.util.Hashtable link_table)
          Initialize this Topology Parser.
 void load(java.lang.String filename)
          Loads file into a char array and ignores commented lines
 void loadElement(java.lang.String line)
          Public wrapper to parse(line).
private  void parse(java.lang.String line)
          Parses a single line and creates network objects accordingly.
 boolean prePlugout(java.lang.Object replacement)
          We don't need to do anything special for cleanup, but we cannot be removed without replacement.
 void save(java.lang.String filename)
          Saves the current topology to a file.
 void view()
          View the current topology.
 void view(boolean showIPAddresses)
          View the current topology using Otter (writing out to a temp file).
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODE_UNKNOWN

private static final java.lang.String NODE_UNKNOWN
See Also:
Constant Field Values

BI_LINK

private static final java.lang.String BI_LINK
See Also:
Constant Field Values

UNI_LINK

private static final java.lang.String UNI_LINK
See Also:
Constant Field Values

routers

protected java.util.Hashtable routers

hosts

protected java.util.Hashtable hosts

links

protected java.util.Hashtable links

sim

protected Simulator sim

nattedNodes

private java.util.Hashtable nattedNodes

nattedRouters

private java.util.Hashtable nattedRouters

current_line

protected transient int current_line

OTTER_TEMP_FILE

public static final java.lang.String OTTER_TEMP_FILE
See Also:
Constant Field Values

next_link_id

protected int next_link_id
The ID of the next link to create. This needs to be shared between topology parsers so that new links can be added without destroying links in the simulator's hash table after a new topology parser is plugged in.

Constructor Detail

SimpleINetParser

public SimpleINetParser()
Method Detail

initialize

public void initialize(java.util.Hashtable router_table,
                       java.util.Hashtable host_table,
                       java.util.Hashtable link_table)
Initialize this Topology Parser.

Specified by:
initialize in class TopologyParser

load

public void load(java.lang.String filename)
Loads file into a char array and ignores commented lines

Specified by:
load in class TopologyParser
Parameters:
filename - name loaded file

loadElement

public void loadElement(java.lang.String line)
Public wrapper to parse(line).

Specified by:
loadElement in class TopologyParser

parse

private void parse(java.lang.String line)
Parses a single line and creates network objects accordingly.

Parameters:
line - parsed line

save

public void save(java.lang.String filename)
Saves the current topology to a file.

Specified by:
save in class TopologyParser
Parameters:
filename - name to save topology to

view

public void view()
Description copied from class: TopologyParser
View the current topology.

Specified by:
view in class TopologyParser

view

public void view(boolean showIPAddresses)
View the current topology using Otter (writing out to a temp file).

Specified by:
view in class TopologyParser
Parameters:
showIPAddresses - whether or not to show the IP addresses of the nodes

prePlugout

public boolean prePlugout(java.lang.Object replacement)
We don't need to do anything special for cleanup, but we cannot be removed without replacement.

Specified by:
prePlugout in interface Pluggable
Returns:
if this object can now be removed (was the operation sucessful)

finalize

protected void finalize()
For debugging