jist.swans.route
Class RouteZrpNdp

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

public class RouteZrpNdp
extends java.lang.Object
implements RouteInterface.Zrp.Ndp, Timer

Zone Routing Protocol: Node Discovery (sub)Protocol: Default implementation.

Since:
SWANS1.0
Version:
$Id: RouteZrpNdp.java,v 1.14 2004/04/06 16:07:51 barr Exp $
Author:
Rimon Barr <barr+jist@cs.cornell.edu>

Nested Class Summary
private static class RouteZrpNdp.MessageNdp
          NDP (Node Discovery Protocol) packet.
private static class RouteZrpNdp.NeighbourState
          NDP neighbour entry.
 
Field Summary
static long JITTER
          jitter.
static short LIFETIME_BEATS
          heartbeats until link expiration.
static org.apache.log4j.Logger logNDP
          logger for NDP events.
private  java.util.HashMap neighbours
          list of neighbours: NetAddress - NeighbourState.
static long PERIOD
          heartbeat period.
private  RouteZrp zrp
          reference to zrp routing framework.
 
Constructor Summary
RouteZrpNdp(RouteZrp zrp)
          Create new "default" NDP (ZRP sub-protocol) handler.
RouteZrpNdp(RouteZrp zrp, java.lang.String config)
          Create new "default" NDP (ZRP sub-protocol) handler.
 
Method Summary
 MacAddress getMacAddress(NetAddress addr)
          Return mac address of neighbour.
 byte getMacId(NetAddress addr)
          Return mac entity for neighbour.
 NetAddress[] getNeighbours()
          Return neighbours.
 int getNumNeighbours()
          Return number of neighbours.
 boolean isNeighbour(NetAddress addr)
          Whether given address is a neighbour.
 void receive(RouteInterface.Zrp.MessageNdp msg, NetAddress src, MacAddress macAddr, byte macId)
          Process incoming NDP packet.
 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

logNDP

public static final org.apache.log4j.Logger logNDP
logger for NDP events.


PERIOD

public static final long PERIOD
heartbeat period.

See Also:
Constant Field Values

JITTER

public static final long JITTER
jitter.

See Also:
Constant Field Values

LIFETIME_BEATS

public static final short LIFETIME_BEATS
heartbeats until link expiration.

See Also:
Constant Field Values

zrp

private RouteZrp zrp
reference to zrp routing framework.


neighbours

private java.util.HashMap neighbours
list of neighbours: NetAddress - NeighbourState.

Constructor Detail

RouteZrpNdp

public RouteZrpNdp(RouteZrp zrp)
Create new "default" NDP (ZRP sub-protocol) handler.

Parameters:
zrp - object reference to zrp routing framework

RouteZrpNdp

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

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

start

public void start()
Start running protocol.

Specified by:
start in interface Protocol

receive

public void receive(RouteInterface.Zrp.MessageNdp msg,
                    NetAddress src,
                    MacAddress macAddr,
                    byte macId)
Process incoming NDP packet.

Specified by:
receive in interface RouteInterface.Zrp.Ndp
Parameters:
msg - ndp packet
src - network address of incoming packet
macAddr - link source address of incoming packet
macId - interface of incoming packet

getMacAddress

public MacAddress getMacAddress(NetAddress addr)
Return mac address of neighbour.

Specified by:
getMacAddress in interface RouteInterface.Zrp.Ndp
Parameters:
addr - ip address of neighbour
Returns:
mac address of neighbour, or null if unknown

getMacId

public byte getMacId(NetAddress addr)
Return mac entity for neighbour.

Specified by:
getMacId in interface RouteInterface.Zrp.Ndp
Parameters:
addr - ip address of neighbour
Returns:
mac interface id for neighbour, or null if unknown

getNeighbours

public NetAddress[] getNeighbours()
Return neighbours.

Specified by:
getNeighbours in interface RouteInterface.Zrp.Ndp
Returns:
array of neighbours

getNumNeighbours

public int getNumNeighbours()
Return number of neighbours.

Specified by:
getNumNeighbours in interface RouteInterface.Zrp.Ndp
Returns:
number of neighbours

isNeighbour

public boolean isNeighbour(NetAddress addr)
Whether given address is a neighbour.

Specified by:
isNeighbour in interface RouteInterface.Zrp.Ndp
Parameters:
addr - address to check
Returns:
whether given address is a neighbour

timeout

public void timeout()
Timer expiration processing.

Specified by:
timeout in interface Timer