SSF.Net
Class RoutingInfo

java.lang.Object
  |
  +--SSF.Net.RoutingInfo
Direct Known Subclasses:
RoutingInfoIC, RoutingInfoOOC

public abstract class RoutingInfo
extends java.lang.Object

Forwarding data stored in a node in a RoutingTable.


Field Summary
static int UNDEFINED_ADMINISTRATIVE_DISTANCE
           
 
Constructor Summary
RoutingInfo()
           
 
Method Summary
abstract  RoutingInfo addRoute(RoutingInfo newRoute)
          Insert one or more new routes into the linked list, sorted primarily by administrative distance and secondarily by cost.
abstract  int adist()
          Returns the administrative distance.
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.
abstract  int cost()
          Returns the cost.
protected static java.lang.String decodeSource(byte srcid)
          Returns the string representation of a protocol name given the byte code for the protocol.
abstract  java.lang.String dest_ip()
          Returns the destination IP address.
protected static byte encodeSource(java.lang.String name)
          Returns the byte value of a protocol given the string representation of the protocol name.
abstract  RoutingInfo findRouteFrom(java.lang.String protocol)
          Find the first (best) route inserted by the named protocol.
abstract  RoutingInfo[] findRoutesFrom(java.lang.String protocol)
          Return the list of routes inserted by the given protocol.
abstract  java.lang.String getProtocol()
           
abstract  NIC next_hop_interface()
          Return the next hop inteface (NIC) object.
abstract  int next_hop_ip()
          Returns the next hop IP address.
abstract  RoutingInfo nextRoute()
          Returns the next route info entry for the same IP address (if any).
abstract  RoutingInfo removeRoute(RoutingInfo oldRoute)
          Remove the given route, and return the new head route (either this route, or if this route was removed, the next route).
abstract  RoutingInfo removeRoutesFrom(java.lang.String protocol)
          Remove routes from the given protocol, and return the new head route (either this route, or if this route was removed, the next route).
abstract  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.
abstract  java.lang.String toString()
          Returns the routing information as a string.
abstract  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

UNDEFINED_ADMINISTRATIVE_DISTANCE

public static final int UNDEFINED_ADMINISTRATIVE_DISTANCE
See Also:
Constant Field Values
Constructor Detail

RoutingInfo

public RoutingInfo()
Method Detail

next_hop_interface

public abstract NIC next_hop_interface()
Return the next hop inteface (NIC) object.


dest_ip

public abstract java.lang.String dest_ip()
Returns the destination IP address.


next_hop_ip

public abstract int next_hop_ip()
Returns the next hop IP address.


cost

public abstract int cost()
Returns the cost.


adist

public abstract int adist()
Returns the administrative distance.


getProtocol

public abstract java.lang.String getProtocol()

nextRoute

public abstract RoutingInfo nextRoute()
Returns the next route info entry for the same IP address (if any).


addRoute

public abstract RoutingInfo addRoute(RoutingInfo newRoute)
Insert one or more new routes into the linked list, sorted primarily by administrative distance and secondarily by cost. Return the new head route (either the new route, or this route, whichever is lower-cost).


removeRoute

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


removeRoutesFrom

public abstract RoutingInfo removeRoutesFrom(java.lang.String protocol)
Remove routes from the given protocol, and return the new head route (either this route, or if this route was removed, the next route). The special protocol name "*" matches all protocols. If the list argument is non-null, insert deleted routes into the list.


findRoutesFrom

public abstract RoutingInfo[] findRoutesFrom(java.lang.String protocol)
Return the list of routes inserted by the given protocol. The special protocol name "*" matches all protocols.


findRouteFrom

public abstract RoutingInfo findRouteFrom(java.lang.String protocol)
Find the first (best) route inserted by the named protocol.


toString

public abstract 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 abstract 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 abstract 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

decodeSource

protected static java.lang.String decodeSource(byte srcid)
Returns the string representation of a protocol name given the byte code for the protocol.

Parameters:
srcid - The byte code of the protocol.
Returns:
the string representation of the protocol

encodeSource

protected static byte encodeSource(java.lang.String name)
Returns the byte value of a protocol given the string representation of the protocol name.

Parameters:
name - The name of the protocol.
Returns:
the byte value of the protocol