|
|||||||||
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") |
static java.lang.String |
NROF_COPIES
identifier for the intial number of copies setting ("nrofCopies") |
static java.lang.String |
SPRAYANDWAIT_NS
SprayAndWait router's settins namespace ("SprayAndWaitRouter") |
Fields inherited from class routing.ActiveRouter |
---|
RESPONSE_PREFIX, TTL_CHECK_INTERVAL |
Fields inherited from class routing.MessageRouter |
---|
B_SIZE, DENIED_NO_SPACE, DENIED_OLD, MSG_TTL, msgTtl, RCV_OK, TRY_LATER_BUSY |
Constructor Summary | |
---|---|
|
SprayAndWaitRouter(Settings s)
|
protected |
SprayAndWaitRouter(SprayAndWaitRouter r)
Copyconstructor. |
Method Summary | |
---|---|
boolean |
createNewMessage(DTNHost to,
java.lang.String id,
int size,
int responseSize)
Creates a new message to the router. |
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 routing.MessageRouter |
---|
addToMessages, deleteMessage, getBufferSize, getFreeBufferSize, getHost, getMessage, getMessageCollection, getNrofMessages, getRoutingInfo, hasMessage, isDeliveredMessage, messageAborted, putToIncomingBuffer, removeFromIncomingBuffer, sendMessage, toString |
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
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(DTNHost to, java.lang.String id, int size, int responseSize)
MessageRouter
createNewMessage
in class ActiveRouter
to
- The host the message is toid
- Identifier of the message (should be unique). A message
with non-unique ID will replace an old message with the same ID
in this node's buffer and other nodes may reject the message because
they have "seen" a message with that ID before.size
- Size of the message (in bytes)responseSize
- Size of the requested response message or 0 if no
response is requested
public void update()
ActiveRouter
update
in class ActiveRouter
ActiveRouter.addToSendingConnections(Connection)
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 |