SSF.Net
Class TERoutingInfo

java.lang.Object
  |
  +--SSF.Net.TERoutingInfo

public class TERoutingInfo
extends java.lang.Object

Forwarding data stored in a node in a RoutingTable


Field Summary
protected  double COST
          Cost metric -- unused for the moment
private  java.lang.String DEST_IP
          destination IP address
protected  TEInterface INTERFACE
          Reference to the network interface that gets us to the next hop
protected  int NEXT_HOP_IP
          IP address of the node that's the next hop
protected  TERoutingInfo nextRoute
          Linked list of routes to the same destination IP address
protected  java.lang.String PROTOCOL
          Name of the routing protocol where this route originated.
 
Constructor Summary
TERoutingInfo(int destaddr, TEInterface iface, double cost1)
           
TERoutingInfo(java.lang.String dest_ip, int next_hop, TEInterface iface, double cost)
           
 
Method Summary
 TERoutingInfo addRoute(TERoutingInfo newRoute)
          Insert one or more new routes into the linked list, sorted by COST; return the new head route (either the new route, or this route, whichever is lower-cost).
static int approxBytes()
          Returns an estimate of the number of bytes that would be produced by the conversion performed in toBytes.
static int bytes2info(java.lang.StringBuffer info, byte[] bytes, int bindex, boolean usenhi)
          Converts a series of bytes to routing info in string format.
 TEInterface next_hop_interface()
           
 int next_hop_ip()
           
 TERoutingInfo removeRoute(TERoutingInfo oldRoute)
          Remove the given route, and return the new head route (either this route, or if this route was removed, the next route).
 int toBytes(byte[] bytes, int bindex, boolean usenhi, Net topnet)
          Converts this routing info into a series of bytes and inserts them into a given byte array.
 java.lang.String toString()
          Returns the routing information as a string.
 java.lang.String toString(boolean usenhi, Net topnet)
          Returns the routing information as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEST_IP

private java.lang.String DEST_IP
destination IP address


NEXT_HOP_IP

protected int NEXT_HOP_IP
IP address of the node that's the next hop


INTERFACE

protected TEInterface INTERFACE
Reference to the network interface that gets us to the next hop


COST

protected double COST
Cost metric -- unused for the moment


nextRoute

protected TERoutingInfo nextRoute
Linked list of routes to the same destination IP address


PROTOCOL

protected java.lang.String PROTOCOL
Name of the routing protocol where this route originated.

Constructor Detail

TERoutingInfo

public TERoutingInfo(int destaddr,
                     TEInterface iface,
                     double cost1)

TERoutingInfo

public TERoutingInfo(java.lang.String dest_ip,
                     int next_hop,
                     TEInterface iface,
                     double cost)
Method Detail

next_hop_ip

public final int next_hop_ip()

addRoute

public TERoutingInfo addRoute(TERoutingInfo newRoute)
Insert one or more new routes into the linked list, sorted by COST; return the new head route (either the new route, or this route, whichever is lower-cost).


removeRoute

public TERoutingInfo removeRoute(TERoutingInfo oldRoute)
Remove the given route, and return the new head route (either this route, or if this route was removed, the next route).


next_hop_interface

public final TEInterface next_hop_interface()

toString

public java.lang.String toString()
Returns the routing information as a string.

Overrides:
toString in class java.lang.Object
Returns:
the routing information as a string

toString

public java.lang.String toString(boolean usenhi,
                                 Net topnet)
Returns the routing information as a string.

Parameters:
usenhi - Whether to use the NHI or IP prefix address format.
topnet - The top-level Net in the simulation.
Returns:
the routing information as a string

toBytes

public int toBytes(byte[] bytes,
                   int bindex,
                   boolean usenhi,
                   Net topnet)
Converts this routing info into a series of bytes and inserts them into a given byte array.

Parameters:
bytes - A byte array in which to place the results.
bindex - The index into the given byte array at which to begin placing the results.
usenhi - Whether or not to use NHI addressing.
topnet - The top-level Net in the simulation.
Returns:
the total number of bytes produced by the conversion

approxBytes

public static int approxBytes()
Returns an estimate of the number of bytes that would be produced by the conversion performed in toBytes. Whether or not NHI addressing is used can make a difference, so there's a parameter for that option.

Returns:
an estimate of the number of bytes produced by toBytes

bytes2info

public static int bytes2info(java.lang.StringBuffer info,
                             byte[] bytes,
                             int bindex,
                             boolean usenhi)
Converts a series of bytes to routing info in string format.

Parameters:
info - A StringBuffer into which the results will be placed. It must be initialized to the empty string.
bytes - The byte array to convert to routing info.
bindex - The index into the given byte array from which to begin converting.
usenhi - Whether or not to use NHI addressing.
Returns:
the total number of bytes used in the conversion