|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrouting.MessageRouter
routing.ActiveRouter
routing.SprayAndWaitRouter
public class SprayAndWaitRouter
Implementation of Spray and wait router as depicted in Spray and Wait: An Efficient Routing Scheme for Intermittently Connected Mobile Networks by Thrasyvoulos Spyropoulus et al.
Field Summary | |
---|---|
static java.lang.String |
BINARY_MODE
identifier for the binary-mode setting ("binaryMode") |
protected int |
initialNrofCopies
|
protected boolean |
isBinary
|
static java.lang.String |
MSG_COUNT_PROPERTY
Message property key |
static java.lang.String |
NROF_COPIES
identifier for the initial number of copies setting ("nrofCopies") |
static java.lang.String |
SPRAYANDWAIT_NS
SprayAndWait router's settings name space ("SprayAndWaitRouter") |
Fields inherited from class routing.ActiveRouter |
---|
DELETE_DELIVERED_S, deleteDelivered, RESPONSE_PREFIX, sendingConnections, TTL_CHECK_INTERVAL |
Fields inherited from class routing.MessageRouter |
---|
B_SIZE_S, DENIED_NO_SPACE, DENIED_OLD, DENIED_TTL, DENIED_UNSPECIFIED, MSG_TTL_S, msgTtl, Q_MODE_FIFO, Q_MODE_RANDOM, RCV_OK, SEND_QUEUE_MODE_S, TRY_LATER_BUSY |
Constructor Summary | |
---|---|
|
SprayAndWaitRouter(Settings s)
|
protected |
SprayAndWaitRouter(SprayAndWaitRouter r)
Copy constructor. |
Method Summary | |
---|---|
boolean |
createNewMessage(Message msg)
Creates a new message to the router. |
protected java.util.List<Message> |
getMessagesWithCopiesLeft()
Creates and returns a list of messages this router is currently carrying and still has copies left to distribute (nrof copies > 1). |
Message |
messageTransferred(java.lang.String id,
DTNHost from)
This method should be called (on the receiving host) after a message was successfully transferred. |
int |
receiveMessage(Message m,
DTNHost from)
Try to start receiving a message from another host. |
SprayAndWaitRouter |
replicate()
Creates a replicate of this router. |
protected void |
transferDone(Connection con)
Called just before a transfer is finalized (by ActiveRouter.update() ). |
void |
update()
Checks out all sending connections to finalize the ready ones and abort those whose connection went down. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String NROF_COPIES
public static final java.lang.String BINARY_MODE
public static final java.lang.String SPRAYANDWAIT_NS
public static final java.lang.String MSG_COUNT_PROPERTY
protected int initialNrofCopies
protected boolean isBinary
Constructor Detail |
---|
public SprayAndWaitRouter(Settings s)
protected SprayAndWaitRouter(SprayAndWaitRouter r)
r
- The router prototype where setting values are copied fromMethod Detail |
---|
public int receiveMessage(Message m, DTNHost from)
MessageRouter
receiveMessage
in class ActiveRouter
m
- Message to put in the receiving bufferfrom
- Who the message is from
public Message messageTransferred(java.lang.String id, DTNHost from)
MessageRouter
messageTransferred
in class ActiveRouter
id
- Id of the transferred messagefrom
- Host the message was from (previous hop)
public boolean createNewMessage(Message msg)
MessageRouter
createNewMessage
in class ActiveRouter
msg
- The message to create
public void update()
ActiveRouter
update
in class ActiveRouter
ActiveRouter.addToSendingConnections(Connection)
protected java.util.List<Message> getMessagesWithCopiesLeft()
protected void transferDone(Connection con)
ActiveRouter.update()
).
Reduces the number of copies we have left for a message.
In binary Spray and Wait, sending host is left with floor(n/2) copies,
but in standard mode, nrof copies left is reduced by one.
transferDone
in class ActiveRouter
con
- The connection whose transfer was finalizedpublic SprayAndWaitRouter replicate()
MessageRouter
replicate
in class MessageRouter
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |