jist.swans.route
Class RouteZrpIarp

java.lang.Object
  extended by jist.swans.route.RouteZrpIarp
All Implemented Interfaces:
Protocol, Timer, RouteInterface.Zrp.Iarp

public class RouteZrpIarp
extends java.lang.Object
implements RouteInterface.Zrp.Iarp, Timer

Zone Routing Protocol: IntrAzone Routing (sub)Protocol: Default implementation.

Since:
SWANS1.0

Nested Class Summary
static class RouteZrpIarp.RouteEntry
          IARP route entry.
 
Field Summary
static byte COMPRESS_INFINITE
          compression constant: inifinite.
static byte COMPRESS_NONE
          compression constant: no aggregation.
static long JITTER
          iarp transmission jitter.
static long LINK_LIFETIME
          link state expiration time.
static org.apache.log4j.Logger logIARP
          logger for IARP events.
 
Constructor Summary
RouteZrpIarp(RouteZrp zrp)
          Create a new "default" IARP (ZRP sub-protocol) handler.
RouteZrpIarp(RouteZrp zrp, java.lang.String config)
          Create a new "default" IARP (ZRP sub-protocol) handler.
 
Method Summary
 java.util.Set computeCoverage(NetAddress src, int depth)
          Find the set of nodes within a given distance of source.
 java.util.Enumeration getLinks(NetAddress src)
          Return iterator of links from given source address.
 int getNumLinks()
          Return number of intra-zone links.
 int getNumRoutes()
          Return number of intra-zone routes.
 java.util.Collection getPeripheral()
          Return all peripheral nodes.
 NetAddress[] getRoute(NetAddress dst)
          Return intra-zone route.
 boolean hasRoute(NetAddress dst)
          Return whether node is within zone (if IARP has route to it).
 void linkinfo(Link link, boolean drop)
          Notify IARP of link state change.
 void receive(RouteInterface.Zrp.MessageIarp msg, NetAddress from)
          Process incoming IARP packet.
 void setCompress(byte compress)
          Set packet compression mode.
 void showLinks()
          Display link state.
 void showRoutes()
          Display in-zone routing table.
 void start()
          Start running protocol.
 void timeout()
          Timer expiration processing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logIARP

public static final org.apache.log4j.Logger logIARP
logger for IARP events.


LINK_LIFETIME

public static final long LINK_LIFETIME
link state expiration time.

See Also:
Constant Field Values

JITTER

public static final long JITTER
iarp transmission jitter.

See Also:
Constant Field Values

COMPRESS_NONE

public static final byte COMPRESS_NONE
compression constant: no aggregation.

See Also:
Constant Field Values

COMPRESS_INFINITE

public static final byte COMPRESS_INFINITE
compression constant: inifinite.

See Also:
Constant Field Values
Constructor Detail

RouteZrpIarp

public RouteZrpIarp(RouteZrp zrp)
Create a new "default" IARP (ZRP sub-protocol) handler.

Parameters:
zrp - object reference to zrp routing framework

RouteZrpIarp

public RouteZrpIarp(RouteZrp zrp,
                    java.lang.String config)
Create a new "default" IARP (ZRP sub-protocol) handler.

Parameters:
zrp - object reference to zrp routing framework
config - configuration string
Method Detail

setCompress

public void setCompress(byte compress)
Set packet compression mode.

Parameters:
compress - packet compression mode

showLinks

public void showLinks()
Display link state.

Specified by:
showLinks in interface RouteInterface.Zrp.Iarp

showRoutes

public void showRoutes()
Display in-zone routing table.

Specified by:
showRoutes in interface RouteInterface.Zrp.Iarp

start

public void start()
Start running protocol.

Specified by:
start in interface Protocol

receive

public void receive(RouteInterface.Zrp.MessageIarp msg,
                    NetAddress from)
Process incoming IARP packet.

Specified by:
receive in interface RouteInterface.Zrp.Iarp
Parameters:
msg - iarp packet
from - source of iarp packet

linkinfo

public void linkinfo(Link link,
                     boolean drop)
Notify IARP of link state change.

Specified by:
linkinfo in interface RouteInterface.Zrp.Iarp
Parameters:
link - link that has changed
drop - whether link has failed (or been created)

getNumLinks

public int getNumLinks()
Return number of intra-zone links.

Specified by:
getNumLinks in interface RouteInterface.Zrp.Iarp
Returns:
number of intra-zone links

getLinks

public java.util.Enumeration getLinks(NetAddress src)
Return iterator of links from given source address.

Specified by:
getLinks in interface RouteInterface.Zrp.Iarp
Parameters:
src - link source address
Returns:
iterator of known link destination addresses

hasRoute

public boolean hasRoute(NetAddress dst)
Return whether node is within zone (if IARP has route to it).

Specified by:
hasRoute in interface RouteInterface.Zrp.Iarp
Parameters:
dst - destination node
Returns:
whether node is within zone

getRoute

public NetAddress[] getRoute(NetAddress dst)
Return intra-zone route.

Specified by:
getRoute in interface RouteInterface.Zrp.Iarp
Parameters:
dst - destination node
Returns:
route to node, or NullPointerException if dst not in zone

getNumRoutes

public int getNumRoutes()
Return number of intra-zone routes.

Specified by:
getNumRoutes in interface RouteInterface.Zrp.Iarp
Returns:
number of intra-zone routes

getPeripheral

public java.util.Collection getPeripheral()
Return all peripheral nodes.

Specified by:
getPeripheral in interface RouteInterface.Zrp.Iarp
Returns:
set of peripheral nodes

computeCoverage

public java.util.Set computeCoverage(NetAddress src,
                                     int depth)
Find the set of nodes within a given distance of source.

Specified by:
computeCoverage in interface RouteInterface.Zrp.Iarp
Parameters:
src - source node
depth - radius
Returns:
set of node addresses within distance of source

timeout

public void timeout()
Timer expiration processing.

Specified by:
timeout in interface Timer