jist.swans.app
Class AppHeartbeat

java.lang.Object
  extended by jist.swans.app.AppHeartbeat
All Implemented Interfaces:
JistAPI.Proxiable, JistAPI.Timeless, AppInterface, NetInterface.NetHandler

public class AppHeartbeat
extends java.lang.Object
implements AppInterface, NetInterface.NetHandler

Heartbeat application.

Since:
SWANS1.0

Nested Class Summary
 
Nested classes/interfaces inherited from interface jist.swans.app.AppInterface
AppInterface.TcpApp, AppInterface.ThreadedApp, AppInterface.UdpApp
 
Field Summary
static short FRESHNESS
          throw out information older than FRESHNESS beats.
static long HEARTBEAT_MAX
          maximum heartbeat period.
static long HEARTBEAT_MIN
          minimum heartbeat period.
 
Constructor Summary
AppHeartbeat(int nodenum, boolean display)
          Create new heartbeat application instance.
 
Method Summary
 void dropNotify(Message msg, MacAddress nextHopMac, Reason reason)
          Notification mechanism for packet dropped due to various "Reasons"
 AppInterface getAppProxy()
          Return self-referencing APPLICATION proxy entity.
 NetInterface.NetHandler getNetProxy()
          Return self-referencing NETWORK proxy entity.
 void receive(Message msg, NetAddress src, MacAddress lastHop, byte macId, NetAddress dst, byte priority, byte ttl)
          Receive a message from network layer.
 void run()
          Run application.
 void run(java.lang.String[] args)
          Run application.
 void send(NetMessage msg)
          Send a message through the routing protocol
 void setNetEntity(NetInterface netEntity)
          Set network entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HEARTBEAT_MIN

public static final long HEARTBEAT_MIN
minimum heartbeat period.

See Also:
Constant Field Values

HEARTBEAT_MAX

public static final long HEARTBEAT_MAX
maximum heartbeat period.

See Also:
Constant Field Values

FRESHNESS

public static final short FRESHNESS
throw out information older than FRESHNESS beats.

See Also:
Constant Field Values
Constructor Detail

AppHeartbeat

public AppHeartbeat(int nodenum,
                    boolean display)
Create new heartbeat application instance.

Parameters:
nodenum - node identifier
display - whether to display application output
Method Detail

setNetEntity

public void setNetEntity(NetInterface netEntity)
Set network entity.

Parameters:
netEntity - network entity

getNetProxy

public NetInterface.NetHandler getNetProxy()
Return self-referencing NETWORK proxy entity.

Returns:
self-referencing NETWORK proxy entity

getAppProxy

public AppInterface getAppProxy()
Return self-referencing APPLICATION proxy entity.

Returns:
self-referencing APPLICATION proxy entity

dropNotify

public void dropNotify(Message msg,
                       MacAddress nextHopMac,
                       Reason reason)
Description copied from interface: NetInterface.NetHandler
Notification mechanism for packet dropped due to various "Reasons"

Specified by:
dropNotify in interface NetInterface.NetHandler

receive

public void receive(Message msg,
                    NetAddress src,
                    MacAddress lastHop,
                    byte macId,
                    NetAddress dst,
                    byte priority,
                    byte ttl)
Receive a message from network layer.

Specified by:
receive in interface AppInterface
Specified by:
receive in interface NetInterface.NetHandler
Parameters:
msg - message received
src - source network address
lastHop - source link address
macId - incoming interface
dst - destination network address
priority - packet priority
ttl - packet time-to-live

send

public void send(NetMessage msg)
Description copied from interface: NetInterface.NetHandler
Send a message through the routing protocol

Specified by:
send in interface NetInterface.NetHandler

run

public void run(java.lang.String[] args)
Run application.

Specified by:
run in interface AppInterface
Parameters:
args - command-line parameters

run

public void run()
Run application.

Specified by:
run in interface AppInterface