|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjist.swans.route.RouteAodv
public class RouteAodv
Ad-hoc On-demand Distance Vector (AODV) Routing Protocol Implementation.
Nested Class Summary | |
---|---|
static class |
RouteAodv.AodvPacketStats
Packet stats. |
static class |
RouteAodv.AodvStats
Data structure to collect AODV statistics. |
private static class |
RouteAodv.HelloMessage
Represents a HELLO message. |
private static class |
RouteAodv.MessageQueue
A MessageQueue object temporarily stores transport-layer messages while routes are being determined. |
private static class |
RouteAodv.OutgoingInfo
Information for each node in the outgoing node set. |
private static class |
RouteAodv.OutgoingSet
Represents the set of neighboring nodes through which this node routes messages. |
private static class |
RouteAodv.PrecursorInfo
Information stored for each precursor node. |
private static class |
RouteAodv.PrecursorSet
Represents the set of neighboring nodes which (likely) route through this node. |
private static class |
RouteAodv.RouteErrorMessage
Represents a Route Error (RERR) message class. |
private static class |
RouteAodv.RouteReplyMessage
Represents a Route Reply (RREP) message. |
private static class |
RouteAodv.RouteRequest
Represents a request for a route by a node. |
private static class |
RouteAodv.RouteRequestMessage
Represents a Route Request (RREQ) message. |
private static class |
RouteAodv.RouteTable
A routing table contains a hash map, consisting of NetAddress->RouteTableEntry mappings. |
private static class |
RouteAodv.RouteTableEntry
Information to be stored for each destination in routing table. |
private static class |
RouteAodv.RreqBuffer
Buffer for keeping track of recently sent RREQ messages (so they are not resent). |
private static class |
RouteAodv.RreqBufferEntry
A single entry of the RREQ Buffer. |
Nested classes/interfaces inherited from interface jist.swans.route.RouteInterface |
---|
RouteInterface.Aodv, RouteInterface.Dsr, 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. |
private RouteAodv.MessageQueue |
msgQueue
buffer for storing messages that need routes. |
private NetAddress |
netAddr
local network address. |
private NetInterface |
netEntity
Network entity. |
private RouteAodv.OutgoingSet |
outgoingSet
set of nodes that this node routes through. |
private RouteAodv.PrecursorSet |
precursorSet
set of nodes that route through this node. |
private RouteAodv.RouteTable |
routeTable
routing table. |
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. |
private RouteAodv.RreqBuffer |
rreqBuffer
buffer for storing info about previously sent RREQ messages. |
private int |
rreqIdSeqNum
sequence number for RREQ id's. |
private java.util.LinkedList |
rreqList
list of pending route requests (originated by this node). |
private RouteInterface.Aodv |
self
Self-referencing proxy entity. |
private int |
seqNum
node sequence number. |
static int |
SEQUENCE_NUMBER_START
Starting value for node sequence numbers. |
private RouteAodv.AodvStats |
stats
statistics accumulator. |
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 | |
---|---|
private long |
computeRREQTimeout(byte ttl)
Computes the RREQ Timeout period, given a TTL value. |
private void |
forwardRouteRequestMessage(RouteAodv.RouteRequestMessage rreqMsg,
byte newTtl,
RouteAodv.RouteTableEntry destRouteEntry)
Forwards a RREQ message to all neighbors. |
private void |
generateRouteReplyMessage(RouteAodv.RouteRequestMessage rreqMsg,
boolean isDest,
RouteAodv.RouteTableEntry destRouteEntry)
Generates and sends a RREP message. |
NetAddress |
getLocalAddr()
Gets node's local address. |
RouteInterface.Aodv |
getProxy()
Returns self-referencing proxy entity. |
private void |
helloSendEvent()
Send hello messages to any precursors to which we have not sent a message in the past HELLO_INTERVAL time. |
private void |
helloWaitEvent()
Increments the HELLO_wait counter for each outgoing node. |
void |
peek(NetMessage msg,
MacAddress lastHop)
Called by the network layer for every incoming packet. |
private static void |
printDebug_plain(java.lang.String s)
Print given string only if debug mode on. |
private void |
printDebug(java.lang.String s)
Print given string with JiST time and local net address, if debug mode on. |
private static void |
printDebug(java.lang.String s,
NetAddress addr)
Print given string with JiST time and given net address, if debug mode on. |
private static void |
printlnDebug_plain(java.lang.String s)
Println given string only if debug mode on. |
private void |
printlnDebug(java.lang.String s)
Println given string with JiST time and local net address, if debug mode on. |
private static void |
printlnDebug(java.lang.String s,
NetAddress addr)
Println given string with JiST time and given net address, if debug mode on. |
void |
printOutgoing()
Prints the node's outgoing set. |
void |
printPrecursors()
Prints the node's precusor set. |
private static void |
randomSleep(long time)
Sleep for a random time. |
void |
receive(Message msg,
NetAddress src,
MacAddress lastHop,
byte macId,
NetAddress dst,
byte priority,
byte ttl)
Receive a message from network layer. |
private void |
receiveHelloMessage(RouteAodv.HelloMessage helloMsg)
Process an incoming HELLO message. |
private void |
receiveRouteErrorMessage(RouteAodv.RouteErrorMessage rerrMsg,
MacAddress lastHop,
byte ttl)
Process an incoming RERR message. |
private void |
receiveRouteReplyMessage(RouteAodv.RouteReplyMessage rrepMsg,
NetAddress src,
MacAddress lastHop,
NetAddress dst,
byte priority,
byte ttl)
Process an incoming RREP message. |
private void |
receiveRouteRequestMessage(RouteAodv.RouteRequestMessage rreqMsg,
NetAddress src,
MacAddress lastHop,
NetAddress dst,
byte priority,
byte ttl)
Process an incoming RREQ message. |
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. |
private boolean |
shouldUpdateRouteToOrigin(RouteAodv.RouteRequestMessage rreqMsg,
RouteAodv.RouteTableEntry origRouteEntry)
Decides whether a node receiving a RREQ message should update its route to the RREQ originator. |
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 |
---|
public static final boolean DEBUG_MODE
public static final boolean HELLO_MESSAGES_ON
public static final int SEQUENCE_NUMBER_START
public static final int RREQ_ID_SEQUENCE_NUMBER_START
public static final long RREQ_BUFFER_EXPIRE_TIME
public static final int MAX_RREQ_BUFFER_SIZE
public static final long AODV_TIMEOUT
public static final long HELLO_INTERVAL
public static final long HELLO_ALLOWED_LOSS
public static final byte TTL_START
public static final byte TTL_INCREMENT
public static final byte TTL_THRESHOLD
public static final long RREQ_TIMEOUT_BASE
public static final long RREQ_TIMEOUT_PER_TTL
public static final long TRANSMISSION_JITTER
private NetInterface netEntity
private RouteInterface.Aodv self
private NetAddress netAddr
private int seqNum
private int rreqIdSeqNum
private RouteAodv.RouteTable routeTable
private java.util.LinkedList rreqList
private RouteAodv.RreqBuffer rreqBuffer
private RouteAodv.MessageQueue msgQueue
private RouteAodv.PrecursorSet precursorSet
private RouteAodv.OutgoingSet outgoingSet
private RouteAodv.AodvStats stats
Constructor Detail |
---|
public RouteAodv(NetAddress addr)
addr
- node's network addressMethod Detail |
---|
public void RREQtimeout(java.lang.Object rreqObj)
RREQtimeout
in interface RouteInterface.Aodv
rreqObj
- RouteRequest objectpublic void timeout()
timeout
in interface RouteInterface.Aodv
private void helloSendEvent()
private void helloWaitEvent()
public void sendIpMsg(NetMessage.Ip ipMsg, MacAddress destMacAddr)
sendIpMsg
in interface RouteInterface.Aodv
ipMsg
- IP message to senddestMacAddr
- next hop mac addresspublic void start()
start
in interface Protocol
public void peek(NetMessage msg, MacAddress lastHop)
peek
in interface RouteInterface
msg
- incoming packetlastHop
- last link-level hop of incoming packetpublic void send(NetMessage msg)
send
in interface RouteInterface
msg
- outgoing packetpublic void receive(Message msg, NetAddress src, MacAddress lastHop, byte macId, NetAddress dst, byte priority, byte ttl)
receive
in interface NetInterface.NetHandler
msg
- message receivedsrc
- source network addresslastHop
- source link addressmacId
- mac identifierdst
- destination network addresspriority
- packet priorityttl
- packet time-to-liveprivate void receiveRouteRequestMessage(RouteAodv.RouteRequestMessage rreqMsg, NetAddress src, MacAddress lastHop, NetAddress dst, byte priority, byte ttl)
rreqMsg
- incoming route request messagesrc
- source of messagelastHop
- last hop of messagedst
- destination of messagepriority
- message priorityttl
- message TTLprivate void receiveRouteReplyMessage(RouteAodv.RouteReplyMessage rrepMsg, NetAddress src, MacAddress lastHop, NetAddress dst, byte priority, byte ttl)
rrepMsg
- incoming route reply messagesrc
- source of messagelastHop
- last hop of messagedst
- destination of messagepriority
- message priorityttl
- message TTL valueprivate void receiveRouteErrorMessage(RouteAodv.RouteErrorMessage rerrMsg, MacAddress lastHop, byte ttl)
rerrMsg
- incoming route error messagelastHop
- last hop of messagettl
- message TTL valueprivate void receiveHelloMessage(RouteAodv.HelloMessage helloMsg)
helloMsg
- incoming hello messageprivate void forwardRouteRequestMessage(RouteAodv.RouteRequestMessage rreqMsg, byte newTtl, RouteAodv.RouteTableEntry destRouteEntry)
rreqMsg
- incoming route request messagenewTtl
- TTL value for the (new) RREQ message to be forwardeddestRouteEntry
- route table entry for destination nodeprivate void generateRouteReplyMessage(RouteAodv.RouteRequestMessage rreqMsg, boolean isDest, RouteAodv.RouteTableEntry destRouteEntry)
rreqMsg
- RREQ message that this RREP message is responding toisDest
- true if this node is the destination of the RREQ messagedestRouteEntry
- route table entry for the destination node, if this is not dest. (otherwise, null)private boolean shouldUpdateRouteToOrigin(RouteAodv.RouteRequestMessage rreqMsg, RouteAodv.RouteTableEntry origRouteEntry)
rreqMsg
- incoming route request messageorigRouteEntry
- existing routing table entry for the RREQ-originating node
private long computeRREQTimeout(byte ttl)
ttl
- TTL value
private static void randomSleep(long time)
time
- max sleep timepublic void setStats(RouteAodv.AodvStats stats)
stats
- aodv statistics objectpublic NetAddress getLocalAddr()
public RouteInterface.Aodv getProxy()
public void setNetEntity(NetInterface netEntity)
netEntity
- network entityprivate void printlnDebug(java.lang.String s)
s
- string to printprivate void printDebug(java.lang.String s)
s
- string to printprivate static void printlnDebug(java.lang.String s, NetAddress addr)
s
- string to printaddr
- node addressprivate static void printDebug(java.lang.String s, NetAddress addr)
s
- string to printaddr
- node addressprivate static void printlnDebug_plain(java.lang.String s)
s
- string to printprivate static void printDebug_plain(java.lang.String s)
s
- string to printpublic void printPrecursors()
public void printOutgoing()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |