|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcore.Application
applications.PingApplication
public class PingApplication
Simple ping application to demonstrate the application support. The
application can be configured to send pings with a fixed interval or to only
answer to pings it receives. When the application receives a ping it sends
a pong message in response.
The corresponding PingAppReporter
class can be used to record
information about the application behavior.
PingAppReporter
Field Summary | |
---|---|
static java.lang.String |
APP_ID
Application ID |
static java.lang.String |
PING_DEST_RANGE
Destination address range - inclusive lower, exclusive upper |
static java.lang.String |
PING_INTERVAL
Ping generation interval |
static java.lang.String |
PING_OFFSET
Ping interval offset - avoids synchronization of ping sending |
static java.lang.String |
PING_PASSIVE
Run in passive mode - don't generate pings but respond |
static java.lang.String |
PING_PING_SIZE
Size of the ping message |
static java.lang.String |
PING_PONG_SIZE
Size of the pong message |
static java.lang.String |
PING_SEED
Seed for the app's random number generator |
Fields inherited from class core.Application |
---|
appID |
Constructor Summary | |
---|---|
PingApplication(PingApplication a)
Copy-constructor |
|
PingApplication(Settings s)
Creates a new ping application with the given settings. |
Method Summary | |
---|---|
int |
getDestMax()
|
int |
getDestMin()
|
double |
getInterval()
|
double |
getLastPing()
|
int |
getPingSize()
|
int |
getPongSize()
|
int |
getSeed()
|
Message |
handle(Message msg,
DTNHost host)
Handles an incoming message. |
boolean |
isPassive()
|
Application |
replicate()
|
void |
setDestMax(int destMax)
|
void |
setDestMin(int destMin)
|
void |
setInterval(double interval)
|
void |
setLastPing(double lastPing)
|
void |
setPassive(boolean passive)
|
void |
setPingSize(int pingSize)
|
void |
setPongSize(int pongSize)
|
void |
setSeed(int seed)
|
void |
update(DTNHost host)
Sends a ping packet if this is an active application instance. |
Methods inherited from class core.Application |
---|
getAppID, getAppListeners, sendEventToListeners, setAppID, setAppListeners |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PING_PASSIVE
public static final java.lang.String PING_INTERVAL
public static final java.lang.String PING_OFFSET
public static final java.lang.String PING_DEST_RANGE
public static final java.lang.String PING_SEED
public static final java.lang.String PING_PING_SIZE
public static final java.lang.String PING_PONG_SIZE
public static final java.lang.String APP_ID
Constructor Detail |
---|
public PingApplication(Settings s)
s
- Settings to use for initializing the application.public PingApplication(PingApplication a)
a
- Method Detail |
---|
public Message handle(Message msg, DTNHost host)
handle
in class Application
msg
- message received by the routerhost
- host to which the application instance is attached
null
if the application wants the router to stop forwarding the
message.public Application replicate()
replicate
in class Application
public void update(DTNHost host)
update
in class Application
host
- to which the application instance is attachedpublic double getLastPing()
public void setLastPing(double lastPing)
lastPing
- the lastPing to setpublic double getInterval()
public void setInterval(double interval)
interval
- the interval to setpublic boolean isPassive()
public void setPassive(boolean passive)
passive
- the passive to setpublic int getDestMin()
public void setDestMin(int destMin)
destMin
- the destMin to setpublic int getDestMax()
public void setDestMax(int destMax)
destMax
- the destMax to setpublic int getSeed()
public void setSeed(int seed)
seed
- the seed to setpublic int getPongSize()
public void setPongSize(int pongSize)
pongSize
- the pongSize to setpublic int getPingSize()
public void setPingSize(int pingSize)
pingSize
- the pingSize to set
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |