Sim.Routing.DSR
Class RouteRequest

java.lang.Object
  extended by Sim.Routing.DSR.FloodingHeader
      extended by Sim.Routing.DSR.RouteRequest
All Implemented Interfaces:
ProtocolFrame

public class RouteRequest
extends FloodingHeader

RouteRequest is a flooded protocol header to request a route from the originator to a target.


Constructor Summary
RouteRequest(PacketId id, int hopsRemaining, int originator, int target)
           
RouteRequest(PacketId id, int hopsRemaining, int originator, int target, RouteError error)
           
RouteRequest(PacketId id, int hopsRemaining, Route pathTaken, int target, RouteError error)
           
 
Method Summary
 RouteError getError()
          Returns the RouteError associated with this RouteRequest, if there is one, or null if there is not.
 PacketId getId()
           
 int getOriginator()
           
 Route getPathTaken()
           
 Route getPathToSource()
           
 int getSize()
          Returns the "serialized" size of this portion of the packet.
 int getTarget()
           
 RouteRequest makeRepeat(int myAddress)
          Constructs a new RouteRequest with the address given appended to the path, suitable for forwarding.
 boolean shouldRepeat(int myAddress)
           
 Route terminate()
          Terminates the RouteRequest, returning the complete route obtained.
 java.lang.String toString()
           
 
Methods inherited from class Sim.Routing.DSR.FloodingHeader
getHopsRemaining
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RouteRequest

public RouteRequest(PacketId id,
                    int hopsRemaining,
                    int originator,
                    int target,
                    RouteError error)

RouteRequest

public RouteRequest(PacketId id,
                    int hopsRemaining,
                    int originator,
                    int target)

RouteRequest

public RouteRequest(PacketId id,
                    int hopsRemaining,
                    Route pathTaken,
                    int target,
                    RouteError error)
Method Detail

getOriginator

public int getOriginator()

getId

public PacketId getId()

getTarget

public int getTarget()

shouldRepeat

public boolean shouldRepeat(int myAddress)

makeRepeat

public RouteRequest makeRepeat(int myAddress)
Constructs a new RouteRequest with the address given appended to the path, suitable for forwarding.


getPathToSource

public Route getPathToSource()

terminate

public Route terminate()
Terminates the RouteRequest, returning the complete route obtained.

Returns:
non-null Route

getPathTaken

public Route getPathTaken()

getError

public RouteError getError()
Returns the RouteError associated with this RouteRequest, if there is one, or null if there is not. Nodes should not respond to a RouteRequest with a route from their cache that contains a link found in this RouteError.

TODO: currently this is not used.


getSize

public int getSize()
Returns the "serialized" size of this portion of the packet.

Specified by:
getSize in interface ProtocolFrame
Overrides:
getSize in class FloodingHeader

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object