routing
Class EpidemicOracleRouter

java.lang.Object
  extended by routing.MessageRouter
      extended by routing.ActiveRouter
          extended by routing.EpidemicOracleRouter

public class EpidemicOracleRouter
extends ActiveRouter

Epidemic message router with an oracle that tells when a message is delivered and that message is then removed from all nodes that use this routing module. This router also ignores message size and all messages are delivered immediately.

Note: This router module also bypasses ActiveRouter.update()


Field Summary
 
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
protected EpidemicOracleRouter(EpidemicOracleRouter r)
          Copy constructor.
  EpidemicOracleRouter(Settings s)
          Constructor.
 
Method Summary
 void changedConnection(Connection con)
          Called when a connection's state changes.
protected  int checkReceiving(Message m)
          Checks if router "wants" to start receiving message (i.e.
 boolean createNewMessage(Message m)
          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.
 void removeDeliveredMessage(java.lang.String id)
          Removes the message with the given ID from this router, if the router has that message; otherwise does nothing.
 EpidemicOracleRouter replicate()
          Creates a replicate of this router.
static void reset()
          Resets the static router list
protected  void transferDone(Connection con)
          Method is called just before a transfer is finalized at 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.ActiveRouter
addToSendingConnections, canStartTransfer, dropExpiredMessages, exchangeDeliverableMessages, getConnections, getMessagesForConnected, getOldestMessage, init, isSending, isTransferring, makeRoomForMessage, makeRoomForNewMessage, receiveMessage, requestDeliverableMessages, shuffleMessages, startTransfer, transferAborted, tryAllMessages, tryAllMessagesToAllConnections, tryMessagesForConnected, tryMessagesToConnections
 
Methods inherited from class routing.MessageRouter
addApplication, addToMessages, compareByQueueMode, deleteMessage, getApplications, getBufferSize, getFreeBufferSize, getHost, getMessage, getMessageCollection, getNrofMessages, getRoutingInfo, hasMessage, isDeliveredMessage, isIncomingMessage, messageAborted, putToIncomingBuffer, removeFromIncomingBuffer, removeFromMessages, sendMessage, sortByQueueMode, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EpidemicOracleRouter

public EpidemicOracleRouter(Settings s)
Constructor. Creates a new message router based on the settings in the given Settings object.

Parameters:
s - The settings object

EpidemicOracleRouter

protected EpidemicOracleRouter(EpidemicOracleRouter r)
Copy constructor.

Parameters:
r - The router prototype where setting values are copied from
Method Detail

changedConnection

public void changedConnection(Connection con)
Description copied from class: ActiveRouter
Called when a connection's state changes. This version doesn't do anything but subclasses may want to override this.

Overrides:
changedConnection in class ActiveRouter
Parameters:
con - The connection that changed

createNewMessage

public boolean createNewMessage(Message m)
Description copied from class: MessageRouter
Creates a new message to the router.

Overrides:
createNewMessage in class ActiveRouter
Parameters:
m - The message to create
Returns:
True if the creation succeeded, false if not (e.g. the message was too big for the buffer)

removeDeliveredMessage

public void removeDeliveredMessage(java.lang.String id)
Removes the message with the given ID from this router, if the router has that message; otherwise does nothing. If the router was transferring the message, the transfer is aborted.

Parameters:
id - ID of the message to be removed

messageTransferred

public Message messageTransferred(java.lang.String id,
                                  DTNHost from)
Description copied from class: MessageRouter
This method should be called (on the receiving host) after a message was successfully transferred. The transferred message is put to the message buffer unless this host is the final recipient of the message.

Overrides:
messageTransferred in class ActiveRouter
Parameters:
id - Id of the transferred message
from - Host the message was from (previous hop)
Returns:
The message that this host received

checkReceiving

protected int checkReceiving(Message m)
Description copied from class: ActiveRouter
Checks if router "wants" to start receiving message (i.e. router isn't transferring, doesn't have the message and has room for it).

Overrides:
checkReceiving in class ActiveRouter
Parameters:
m - The message to check
Returns:
A return code similar to MessageRouter.receiveMessage(Message, DTNHost), i.e. MessageRouter.RCV_OK if receiving seems to be OK, TRY_LATER_BUSY if router is transferring, DENIED_OLD if the router is already carrying the message or it has been delivered to this router (as final recipient), or DENIED_NO_SPACE if the message does not fit into buffer

transferDone

protected void transferDone(Connection con)
Description copied from class: ActiveRouter
Method is called just before a transfer is finalized at ActiveRouter.update(). Subclasses that are interested of the event may want to override this.

Overrides:
transferDone in class ActiveRouter
Parameters:
con - The connection whose transfer was finalized

update

public void update()
Description copied from class: ActiveRouter
Checks out all sending connections to finalize the ready ones and abort those whose connection went down. Also drops messages whose TTL <= 0 (checking every one simulated minute).

Overrides:
update in class ActiveRouter
See Also:
ActiveRouter.addToSendingConnections(Connection)

replicate

public EpidemicOracleRouter replicate()
Description copied from class: MessageRouter
Creates a replicate of this router. The replicate has the same settings as this router but empty buffers and routing tables.

Specified by:
replicate in class MessageRouter
Returns:
The replicate

reset

public static void reset()
Resets the static router list