|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjist.swans.app.AppHeartbeat
public class AppHeartbeat
Heartbeat application.
| Nested Class Summary | |
|---|---|
private static class |
AppHeartbeat.MessageHeartbeat
Heartbeat packet. |
private static class |
AppHeartbeat.NeighbourEntry
Neighbour entry information. |
| Nested classes/interfaces inherited from interface jist.swans.app.AppInterface |
|---|
AppInterface.TcpApp, AppInterface.ThreadedApp, AppInterface.UdpApp |
| Field Summary | |
|---|---|
private boolean |
display
whether to display application output. |
static short |
FRESHNESS
throw out information older than FRESHNESS beats. |
static long |
HEARTBEAT_MAX
maximum heartbeat period. |
static long |
HEARTBEAT_MIN
minimum heartbeat period. |
private java.util.HashMap |
neighbours
list of neighbours. |
private NetInterface |
netEntity
network entity. |
private int |
nodenum
node identifier. |
private java.lang.Object |
self
self-referencing proxy entity. |
| Constructor Summary | |
|---|---|
AppHeartbeat(int nodenum,
boolean display)
Create new heartbeat application instance. |
|
| Method Summary | |
|---|---|
private long |
calcDelay()
Compute random heartbeat delay. |
AppInterface |
getAppProxy()
Return self-referencing APPLICATION proxy entity. |
NetInterface.NetHandler |
getNetProxy()
Return self-referencing NETWORK proxy entity. |
private void |
neighbourDiscovered(MacAddress mac)
Neighbour discovered. |
private void |
neighbourLost(MacAddress mac)
Neighbour lost. |
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 |
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 |
|---|
public static final long HEARTBEAT_MIN
public static final long HEARTBEAT_MAX
public static final short FRESHNESS
private NetInterface netEntity
private java.lang.Object self
private java.util.HashMap neighbours
private int nodenum
private boolean display
| Constructor Detail |
|---|
public AppHeartbeat(int nodenum,
boolean display)
nodenum - node identifierdisplay - whether to display application output| Method Detail |
|---|
public void setNetEntity(NetInterface netEntity)
netEntity - network entitypublic NetInterface.NetHandler getNetProxy()
public AppInterface getAppProxy()
private void neighbourLost(MacAddress mac)
mac - mac adddress of neighbour lostprivate void neighbourDiscovered(MacAddress mac)
mac - mac address of neighbour discovered
public void receive(Message msg,
NetAddress src,
MacAddress lastHop,
byte macId,
NetAddress dst,
byte priority,
byte ttl)
receive in interface NetInterface.NetHandlermsg - message receivedsrc - source network addresslastHop - source link addressmacId - incoming interfacedst - destination network addresspriority - packet priorityttl - packet time-to-liveprivate long calcDelay()
public void run(java.lang.String[] args)
run in interface AppInterfaceargs - command-line parameterspublic void run()
run in interface AppInterface
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||