jist.swans.route
Class RouteZrpZdp

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

public class RouteZrpZdp
extends java.lang.Object
implements RouteInterface.Zrp.Iarp

Zone Routing Protocol: Zone Discovery (sub)Protocol - an alternate IARP.

Since:
SWANS1.0

Nested Class Summary
static class RouteZrpZdp.MessageZdp
          ZDP (Zone Discovery Protocol) packet.
 
Field Summary
static byte COMPRESS_INFINITE
          compression constant: inifinite.
static byte COMPRESS_NODE
          compression constant: aggregate across single node.
static byte COMPRESS_NONE
          compression constant: no aggregation.
static byte COMPRESS_ZONE
          compression constant: aggregate across zone.
static byte COMPRESS_ZONE_REVERSE
          compression constant: aggregate across zone.
 long DELAY
          zdp delay time.
 long FLUSH
          zdp flush time.
 long JITTER
          zdp update jitter.
static org.apache.log4j.Logger logZDP
          logger for ZDP events.
 
Constructor Summary
RouteZrpZdp(RouteZrp zrp)
          Create a new "default" IARP (ZRP sub-protocol) handler.
RouteZrpZdp(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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logZDP

public static final org.apache.log4j.Logger logZDP
logger for ZDP events.


JITTER

public final long JITTER
zdp update jitter.

See Also:
Constant Field Values

DELAY

public final long DELAY
zdp delay time.

See Also:
Constant Field Values

FLUSH

public final long FLUSH
zdp flush time.

See Also:
Constant Field Values

COMPRESS_NONE

public static final byte COMPRESS_NONE
compression constant: no aggregation.

See Also:
Constant Field Values

COMPRESS_NODE

public static final byte COMPRESS_NODE
compression constant: aggregate across single node.

See Also:
Constant Field Values

COMPRESS_ZONE

public static final byte COMPRESS_ZONE
compression constant: aggregate across zone.

See Also:
Constant Field Values

COMPRESS_ZONE_REVERSE

public static final byte COMPRESS_ZONE_REVERSE
compression constant: aggregate across zone.

See Also:
Constant Field Values

COMPRESS_INFINITE

public static final byte COMPRESS_INFINITE
compression constant: inifinite.

See Also:
Constant Field Values
Constructor Detail

RouteZrpZdp

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

Parameters:
zrp - object reference to zrp routing framework

RouteZrpZdp

public RouteZrpZdp(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

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

start

public void start()
Start running protocol.

Specified by:
start in interface Protocol