jist.swans.route
Class RouteZrpIerp

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

public class RouteZrpIerp
extends java.lang.Object
implements RouteInterface.Zrp.Ierp, Timer

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

Since:
SWANS1.0
Version:
$Id: RouteZrpIerp.java,v 1.12 2005/03/13 16:11:55 barr Exp $
Author:
Rimon Barr <barr+jist@cs.cornell.edu>

Nested Class Summary
private static class RouteZrpIerp.MessageIerp
          IERP (IntErzone Routing Protocol) packet.
static class RouteZrpIerp.MessageQueue
          Queue of message waiting for route replies.
private static class RouteZrpIerp.QueuedPacket
          Packet queued and waiting to be sent.
private static class RouteZrpIerp.RouteEntry
          IERP routing entry.
 
Field Summary
static org.apache.log4j.Logger logIERP
          logger for IERP events.
private  RouteZrpIerp.MessageQueue mq
          outgoing message queue.
static long QUEUE_LIFETIME
          packet queue expiration.
static long QUEUE_REFRESH
          packet queue refresh timer (check for expiration).
private  java.util.HashMap routes
          inter-zone routes: NetAddress - RouteEntry.
private  short routeSeq
          ierp identifier.
private  RouteZrp zrp
          reference to zrp routing framework.
 
Constructor Summary
RouteZrpIerp(RouteZrp zrp)
          Create new "default" IERP (ZRP sub-protocol) handler.
RouteZrpIerp(RouteZrp zrp, java.lang.String config)
          Create new "default" IERP (ZRP sub-protocol) handler.
 
Method Summary
private  NetAddress[] getRoute(NetAddress dst)
          Return IERP route.
private  boolean hasRoute(NetAddress dst)
          Return whether IERP table has a route.
private  short incSeq()
          Return new IERP sequence number.
 void receive(RouteInterface.Zrp.MessageIerp msg)
          Process incoming IERP packet.
 void send(NetMessage.Ip ip)
          Route and send given network message.
 void start()
          Start running protocol.
 void timeout()
          Timer expiration processing.
 void zoneChanged()
          Process IARP signal to IERP that zone information has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logIERP

public static final org.apache.log4j.Logger logIERP
logger for IERP events.


QUEUE_LIFETIME

public static final long QUEUE_LIFETIME
packet queue expiration.

See Also:
Constant Field Values

QUEUE_REFRESH

public static final long QUEUE_REFRESH
packet queue refresh timer (check for expiration).

See Also:
Constant Field Values

zrp

private RouteZrp zrp
reference to zrp routing framework.


routes

private java.util.HashMap routes
inter-zone routes: NetAddress - RouteEntry.


routeSeq

private short routeSeq
ierp identifier.


mq

private RouteZrpIerp.MessageQueue mq
outgoing message queue.

Constructor Detail

RouteZrpIerp

public RouteZrpIerp(RouteZrp zrp)
Create new "default" IERP (ZRP sub-protocol) handler.

Parameters:
zrp - object reference to zrp routing framework

RouteZrpIerp

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

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

incSeq

private short incSeq()
Return new IERP sequence number.

Returns:
new IERP sequence number.

hasRoute

private boolean hasRoute(NetAddress dst)
Return whether IERP table has a route.

Parameters:
dst - destination node
Returns:
whether IERP knows route to given destination

getRoute

private NetAddress[] getRoute(NetAddress dst)
Return IERP route.

Parameters:
dst - destination node
Returns:
IERP route to given destination, nor NullPointerException if it does not exist

start

public void start()
Start running protocol.

Specified by:
start in interface Protocol

zoneChanged

public void zoneChanged()
Process IARP signal to IERP that zone information has changed.

Specified by:
zoneChanged in interface RouteInterface.Zrp.Ierp

receive

public void receive(RouteInterface.Zrp.MessageIerp msg)
Process incoming IERP packet.

Specified by:
receive in interface RouteInterface.Zrp.Ierp
Parameters:
msg - ierp packet

send

public void send(NetMessage.Ip ip)
Route and send given network message.

Specified by:
send in interface RouteInterface.Zrp.Ierp
Parameters:
ip - network message to route and send

timeout

public void timeout()
Timer expiration processing.

Specified by:
timeout in interface Timer