Sim.Routing.Champ
Class ChampAlgorithm
java.lang.Object
Sim.Routing.AbstractRoutingAlgorithm
Sim.Routing.Champ.ChampAlgorithm
- All Implemented Interfaces:
- RoutingAlgorithm
public class ChampAlgorithm
- extends AbstractRoutingAlgorithm
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. |
HardwareFrame |
forwardDataPacket(NormalPacketHeader toForward,
HardwareFrame in)
|
int |
getAddress()
getAddress() |
java.util.LinkedList<HardwareFrame> |
getDataCache()
|
RouteCache |
getRouteCache()
|
void |
newPacket(Node dest,
Packet packet)
Event when a Node wants to send a new Packet. |
void |
routeRepair(int source,
int destination,
int sequenceNumber,
int forwardCount,
int lastKnownDistance,
Packet packetTryingToSend)
routeRepair() will send out RREQ to see if it can get a new path for
the packet. |
void |
sendRERR(int source,
int destination,
int sequenceNumber,
int previousHop)
|
void |
terminated(HardwareFrame in)
terminated will basically sent an ack back it it receives a packet |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
lastRouteRequest
public double lastRouteRequest
ChampAlgorithm
public ChampAlgorithm()
forwardDataPacket
public HardwareFrame forwardDataPacket(NormalPacketHeader toForward,
HardwareFrame in)
sendRERR
public void sendRERR(int source,
int destination,
int sequenceNumber,
int previousHop)
terminated
public void terminated(HardwareFrame in)
- terminated will basically sent an ack back it it receives a packet
- Specified by:
terminated
in interface RoutingAlgorithm
- Overrides:
terminated
in class AbstractRoutingAlgorithm
- Parameters:
in
- non-null HardwareFrame received
arrived
public void arrived(HardwareFrame in)
- Description copied from class:
AbstractRoutingAlgorithm
- 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
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.
routeRepair
public void routeRepair(int source,
int destination,
int sequenceNumber,
int forwardCount,
int lastKnownDistance,
Packet packetTryingToSend)
- routeRepair() will send out RREQ to see if it can get a new path for
the packet.
- Parameters:
source,
- destination
- sequenceNumber
- forwardCount
- lastKnownDistance
- propagationRange
- packetTryingToSend
-
getAddress
public int getAddress()
- getAddress()
- Returns:
- address of node
getRouteCache
public RouteCache getRouteCache()
getDataCache
public java.util.LinkedList<HardwareFrame> getDataCache()