jist.swans.route
Class RouteAodv

java.lang.Object
  extended by jist.swans.route.RouteAodv
All Implemented Interfaces:
JistAPI.Proxiable, JistAPI.Timeless, Protocol, NetInterface.NetHandler, RouteInterface, RouteInterface.Aodv

public class RouteAodv
extends java.lang.Object
implements RouteInterface.Aodv

Ad-hoc On-demand Distance Vector (AODV) Routing Protocol Implementation.

Since:
SWANS1.0

Nested Class Summary
static class RouteAodv.AodvPacketStats
          Packet stats.
static class RouteAodv.AodvStats
          Data structure to collect AODV statistics.
 
Nested classes/interfaces inherited from interface jist.swans.route.RouteInterface
RouteInterface.Aodv, RouteInterface.BezierRouting, RouteInterface.Dsr, RouteInterface.ECGRIDRouting, RouteInterface.GenericRouting, RouteInterface.HeartbeatProtocol, RouteInterface.MultiTreeRouting, RouteInterface.RandomPathRouting, RouteInterface.ShortestPathRouting, RouteInterface.Zrp
 
Field Summary
static long AODV_TIMEOUT
          Period of time after which the AODV timeout event gets called.
static boolean DEBUG_MODE
          debug mode.
static long HELLO_ALLOWED_LOSS
          Number of timeout periods that must pass before this node can determine an outgoing link unreachable.
static long HELLO_INTERVAL
          Duration of inactivity after which a HELLO message should be sent to a precursor.
static boolean HELLO_MESSAGES_ON
          Hello Messages setting.
static int MAX_RREQ_BUFFER_SIZE
          The maximum number of entries allowed in the RREQ buffer.
static long RREQ_BUFFER_EXPIRE_TIME
          The maximum duration of time a RREQ buffer entry can remain in the RREQ buffer.
static int RREQ_ID_SEQUENCE_NUMBER_START
          Starting value for RREQ ID sequence numbers.
static long RREQ_TIMEOUT_BASE
          Constant term of the RREQ Timeout duration.
static long RREQ_TIMEOUT_PER_TTL
          Variable term of the RREQ Timeout duration, dependant on the RREQ's TTL.
static int SEQUENCE_NUMBER_START
          Starting value for node sequence numbers.
static long TRANSMISSION_JITTER
          The maximum amount of jitter before sending a packet.
static byte TTL_INCREMENT
          The amount added to current TTL upon successive broadcasts of a RREQ message.
static byte TTL_START
          The initial TTL value for any Route Request instance.
static byte TTL_THRESHOLD
          The maximum TTL for any RREQ message.
 
Constructor Summary
RouteAodv(NetAddress addr)
          Constructs new RouteAodv instance.
 
Method Summary
 void dropNotify(Message msg, MacAddress nextHopMac, Reason reason)
          Notification mechanism for packet dropped due to various "Reasons"
 NetAddress getLocalAddr()
          Gets node's local address.
 RouteInterface.Aodv getProxy()
          Returns self-referencing proxy entity.
 void peek(NetMessage msg, MacAddress lastHop)
          Called by the network layer for every incoming packet.
 void printOutgoing()
          Prints the node's outgoing set.
 void printPrecursors()
          Prints the node's precusor set.
 void receive(Message msg, NetAddress src, MacAddress lastHop, byte macId, NetAddress dst, byte priority, byte ttl)
          Receive a message from network layer.
 void RREQtimeout(java.lang.Object rreqObj)
          This event is called periodically after a route request is originated, until a route has been found.
 void send(NetMessage msg)
          Called by the network layer to request transmission of a packet that requires routing.
 void sendIpMsg(NetMessage.Ip ipMsg, MacAddress destMacAddr)
          Sends IP message after transmission delay, and renews precursor list entry.
 void setNetEntity(NetInterface netEntity)
          Sets network entity.
 void setStats(RouteAodv.AodvStats stats)
          Sets aodv statistics object.
 void start()
          Start running protocol.
 void timeout()
          AODV Timeout event, which gets called periodically at fixed intervals.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG_MODE

public static final boolean DEBUG_MODE
debug mode.

See Also:
Constant Field Values

HELLO_MESSAGES_ON

public static final boolean HELLO_MESSAGES_ON
Hello Messages setting. Should always be true, except possibly for debugging purposes.

See Also:
Constant Field Values

SEQUENCE_NUMBER_START

public static final int SEQUENCE_NUMBER_START
Starting value for node sequence numbers.

See Also:
Constant Field Values

RREQ_ID_SEQUENCE_NUMBER_START

public static final int RREQ_ID_SEQUENCE_NUMBER_START
Starting value for RREQ ID sequence numbers.

See Also:
Constant Field Values

RREQ_BUFFER_EXPIRE_TIME

public static final long RREQ_BUFFER_EXPIRE_TIME
The maximum duration of time a RREQ buffer entry can remain in the RREQ buffer.

See Also:
Constant Field Values

MAX_RREQ_BUFFER_SIZE

public static final int MAX_RREQ_BUFFER_SIZE
The maximum number of entries allowed in the RREQ buffer.

See Also:
Constant Field Values

AODV_TIMEOUT

public static final long AODV_TIMEOUT
Period of time after which the AODV timeout event gets called.

See Also:
Constant Field Values

HELLO_INTERVAL

public static final long HELLO_INTERVAL
Duration of inactivity after which a HELLO message should be sent to a precursor.

See Also:
Constant Field Values

HELLO_ALLOWED_LOSS

public static final long HELLO_ALLOWED_LOSS
Number of timeout periods that must pass before this node can determine an outgoing link unreachable.

See Also:
Constant Field Values

TTL_START

public static final byte TTL_START
The initial TTL value for any Route Request instance.

See Also:
Constant Field Values

TTL_INCREMENT

public static final byte TTL_INCREMENT
The amount added to current TTL upon successive broadcasts of a RREQ message.

See Also:
Constant Field Values

TTL_THRESHOLD

public static final byte TTL_THRESHOLD
The maximum TTL for any RREQ message.

See Also:
Constant Field Values

RREQ_TIMEOUT_BASE

public static final long RREQ_TIMEOUT_BASE
Constant term of the RREQ Timeout duration.

See Also:
Constant Field Values

RREQ_TIMEOUT_PER_TTL

public static final long RREQ_TIMEOUT_PER_TTL
Variable term of the RREQ Timeout duration, dependant on the RREQ's TTL.

See Also:
Constant Field Values

TRANSMISSION_JITTER

public static final long TRANSMISSION_JITTER
The maximum amount of jitter before sending a packet.

See Also:
Constant Field Values
Constructor Detail

RouteAodv

public RouteAodv(NetAddress addr)
Constructs new RouteAodv instance.

Parameters:
addr - node's network address
Method Detail

dropNotify

public void dropNotify(Message msg,
                       MacAddress nextHopMac,
                       Reason reason)
Description copied from interface: NetInterface.NetHandler
Notification mechanism for packet dropped due to various "Reasons"

Specified by:
dropNotify in interface NetInterface.NetHandler

RREQtimeout

public void RREQtimeout(java.lang.Object rreqObj)
This event is called periodically after a route request is originated, until a route has been found. Each time it is called, it rebroadcasts the route request message with a new rreq id and incremented TTL.

Specified by:
RREQtimeout in interface RouteInterface.Aodv
Parameters:
rreqObj - RouteRequest object

timeout

public void timeout()
AODV Timeout event, which gets called periodically at fixed intervals. Clears expired RREQ buffer entries. Sends hello messages. Updates wait counters, and checks for idle outgoing-nodes

Specified by:
timeout in interface RouteInterface.Aodv

sendIpMsg

public void sendIpMsg(NetMessage.Ip ipMsg,
                      MacAddress destMacAddr)
Sends IP message after transmission delay, and renews precursor list entry.

Specified by:
sendIpMsg in interface RouteInterface.Aodv
Parameters:
ipMsg - IP message to send
destMacAddr - next hop mac address

start

public void start()
Start running protocol.

Specified by:
start in interface Protocol

peek

public void peek(NetMessage msg,
                 MacAddress lastHop)
Called by the network layer for every incoming packet. A routing implementation may wish to look at these packets for informational purposes, but should not change their contents.

Specified by:
peek in interface RouteInterface
Parameters:
msg - incoming packet
lastHop - last link-level hop of incoming packet

send

public void send(NetMessage msg)
Called by the network layer to request transmission of a packet that requires routing. It is the responsibility of the routing layer to provide a best-effort transmission of this packet to an appropriate next hop by calling the network slayer sending routines once this routing information becomes available.

Specified by:
send in interface NetInterface.NetHandler
Specified by:
send in interface RouteInterface
Parameters:
msg - outgoing packet

receive

public void receive(Message msg,
                    NetAddress src,
                    MacAddress lastHop,
                    byte macId,
                    NetAddress dst,
                    byte priority,
                    byte ttl)
Receive a message from network layer.

Specified by:
receive in interface NetInterface.NetHandler
Parameters:
msg - message received
src - source network address
lastHop - source link address
macId - mac identifier
dst - destination network address
priority - packet priority
ttl - packet time-to-live

setStats

public void setStats(RouteAodv.AodvStats stats)
Sets aodv statistics object.

Parameters:
stats - aodv statistics object

getLocalAddr

public NetAddress getLocalAddr()
Gets node's local address.

Returns:
local address

getProxy

public RouteInterface.Aodv getProxy()
Returns self-referencing proxy entity.

Returns:
self-referencing proxy entity

setNetEntity

public void setNetEntity(NetInterface netEntity)
Sets network entity.

Parameters:
netEntity - network entity

printPrecursors

public void printPrecursors()
Prints the node's precusor set.


printOutgoing

public void printOutgoing()
Prints the node's outgoing set.