Sim.Routing
Class FloodingRoutingAlgorithm

java.lang.Object
  extended by Sim.Routing.AbstractRoutingAlgorithm
      extended by Sim.Routing.FloodingRoutingAlgorithm
All Implemented Interfaces:
RoutingAlgorithm

public class FloodingRoutingAlgorithm
extends AbstractRoutingAlgorithm

FloodingRoutingAlgorithm implements a simple routing algorithm where every user data packet is flooded to all nodes. A cache of seen packets prevents reflooding of the same packet (which prevents loops in the routing).


Field Summary
 
Fields inherited from class Sim.Routing.AbstractRoutingAlgorithm
myNode
 
Constructor Summary
FloodingRoutingAlgorithm()
           
 
Method Summary
 void arrived(HardwareFrame in)
          Event when a HardwareFrame arrives destined for this Node that does not have a user Packet, or has a Packet not for this Node.
 void newPacket(Node dest, Packet packet)
          Event when a Node wants to send a new Packet.
 
Methods inherited from class Sim.Routing.AbstractRoutingAlgorithm
attached, getTime, loopback, overheard, scheduleEvent, setSimulation, terminated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FloodingRoutingAlgorithm

public FloodingRoutingAlgorithm()
Method Detail

newPacket

public void newPacket(Node dest,
                      Packet packet)
Event when a Node wants to send a new Packet. The RoutingAlgorithm should bundle the Packet in a HardwareFrame and send it through the Node.

Specified by:
newPacket in interface RoutingAlgorithm
Overrides:
newPacket in class AbstractRoutingAlgorithm
Parameters:
dest - non-null Node as the destination (packet.getDest() == dest.getAddress())
packet - user packet data to send, with a destination address not equal to the address for the sending Node.

arrived

public void arrived(HardwareFrame in)
Event when a HardwareFrame arrives destined for this Node that does not have a user Packet, or has a Packet not for this Node. The data in the frame may need to be routed.

Specified by:
arrived in interface RoutingAlgorithm
Overrides:
arrived in class AbstractRoutingAlgorithm
Parameters:
in - non-null HardwareFrame received