SSF.Net
Class RoutingInfoIC

java.lang.Object
  |
  +--SSF.Net.RoutingInfo
        |
        +--SSF.Net.RoutingInfoIC

public class RoutingInfoIC
extends RoutingInfo

Forwarding data stored in a node in a RoutingTable (in core).


Field Summary
protected  int ADIST
          Administrative Distance -- for tiebreaking among routing protocols
protected  int COST
          Cost metric -- unused for the moment
protected  java.lang.String DEST_IP
          Destination IP address prefix.
protected  NIC 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  RoutingInfoIC 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.
 
Fields inherited from class SSF.Net.RoutingInfo
UNDEFINED_ADMINISTRATIVE_DISTANCE
 
Constructor Summary
RoutingInfoIC(java.lang.String dest_ip, int next_hop, NIC iface, int cost, int adist, java.lang.String src)
           
 
Method Summary
 RoutingInfo addRoute(RoutingInfo newRte)
          Insert one or more new routes into the linked list, sorted primarily by administrative distance and secondarily by cost.
 int adist()
          Returns the administrative distance.
 int cost()
          Returns the cost.
 java.lang.String dest_ip()
          Returns the destination IP address.
 RoutingInfo findRouteFrom(java.lang.String protocol)
          Find the first (best) route inserted by the named protocol.
 RoutingInfo[] findRoutesFrom(java.lang.String protocol)
          Return the list of routes inserted by the given protocol.
 java.lang.String getProtocol()
           
 NIC next_hop_interface()
          Return the next hop inteface (NIC) object.
 int next_hop_ip()
          Returns the next hop IP address.
 RoutingInfo nextRoute()
          Returns the next route info entry for the same IP address (if any).
 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).
 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).
 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 SSF.Net.RoutingInfo
approxBytes, bytes2info, decodeSource, encodeSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEST_IP

protected java.lang.String DEST_IP
Destination IP address prefix.


NEXT_HOP_IP

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


INTERFACE

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


COST

protected int COST
Cost metric -- unused for the moment


ADIST

protected int ADIST
Administrative Distance -- for tiebreaking among routing protocols


nextRoute

protected RoutingInfoIC 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

RoutingInfoIC

public RoutingInfoIC(java.lang.String dest_ip,
                     int next_hop,
                     NIC iface,
                     int cost,
                     int adist,
                     java.lang.String src)
Method Detail

next_hop_interface

public final NIC next_hop_interface()
Description copied from class: RoutingInfo
Return the next hop inteface (NIC) object.

Specified by:
next_hop_interface in class RoutingInfo

dest_ip

public final java.lang.String dest_ip()
Description copied from class: RoutingInfo
Returns the destination IP address.

Specified by:
dest_ip in class RoutingInfo

next_hop_ip

public final int next_hop_ip()
Description copied from class: RoutingInfo
Returns the next hop IP address.

Specified by:
next_hop_ip in class RoutingInfo

cost

public int cost()
Returns the cost.

Specified by:
cost in class RoutingInfo

adist

public int adist()
Returns the administrative distance.

Specified by:
adist in class RoutingInfo

getProtocol

public final java.lang.String getProtocol()
Specified by:
getProtocol in class RoutingInfo

nextRoute

public RoutingInfo nextRoute()
Description copied from class: RoutingInfo
Returns the next route info entry for the same IP address (if any).

Specified by:
nextRoute in class RoutingInfo

addRoute

public RoutingInfo addRoute(RoutingInfo newRte)
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).

Specified by:
addRoute in class RoutingInfo

removeRoute

public 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).

Specified by:
removeRoute in class RoutingInfo

removeRoutesFrom

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

Specified by:
removeRoutesFrom in class RoutingInfo

findRoutesFrom

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

Specified by:
findRoutesFrom in class RoutingInfo

findRouteFrom

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

Specified by:
findRouteFrom in class RoutingInfo

toString

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

Specified by:
toString in class RoutingInfo
Returns:
the routing information as a string

toString

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

Specified by:
toString in class RoutingInfo
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.

Specified by:
toBytes in class RoutingInfo
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