routing
Class ProfileCastRouter

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

public class ProfileCastRouter
extends routing.ActiveRouter

CSI: T message router that delivers messages based on the similiraty two nodes and a message. If the similarity of the destination node with the Target Profile of the message is bigger than the one of the sender the message is exchanged. under the GroupSpread Threshold there is one copy of the message. iF a node similarity to the message destination trace is over the GroupSpread thresold he doesn't delete the message after having realyed. The CSI: T algorith is descibed in Hsu,Dutta,Helmy - A paradigm for behavior-oriented profile-cast services in mobile networks @ Ad Hoc Networks 10, 2011 This router also ignores message size and all messages are delivered immediately.

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

Author:
Andrea Campanella, NPTLab, Public university of Milan, 2014

Field Summary
static java.lang.String DAYS
           
static java.lang.String PROFILECAST_ROUTER_NS
          ProfileCast router settings namespace ("ProfileCast")
 
Fields inherited from class routing.ActiveRouter
DELETE_DELIVERED_S, RESPONSE_PREFIX, TTL_CHECK_INTERVAL
 
Fields inherited from class routing.MessageRouter
B_SIZE_S, DENIED_NO_SPACE, DENIED_OLD, DENIED_TTL, DENIED_UNSPECIFIED, MSG_TTL_S, Q_MODE_FIFO, Q_MODE_RANDOM, RCV_OK, SEND_QUEUE_MODE_S, TRY_LATER_BUSY
 
Constructor Summary
ProfileCastRouter(core.Settings s)
          Constructor.
 
Method Summary
 void changedConnection(core.Connection con)
          Tries to deliver the message when the connection is up beetween two nodes.
 boolean createNewMessage(core.Message m)
          Creates a message, sets a random target trace to reach and computes the target trace similarity.
 core.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.
 ProfileCastRouter replicate()
          Creates a replicate of this router.
static void reset()
          Resets the static router list
 void update()
          Nothing to do; all transfers are started only when new connections are created or new messages are created or received, and transfers are finalized immediately
 
Methods inherited from class routing.ActiveRouter
init, isSending, isTransferring, receiveMessage, requestDeliverableMessages
 
Methods inherited from class routing.MessageRouter
addApplication, deleteMessage, getApplications, getBufferSize, getFreeBufferSize, getMessageCollection, getNrofMessages, getRoutingInfo, messageAborted, sendMessage, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROFILECAST_ROUTER_NS

public static final java.lang.String PROFILECAST_ROUTER_NS
ProfileCast router settings namespace ("ProfileCast")

See Also:
Constant Field Values

DAYS

public static final java.lang.String DAYS
See Also:
Constant Field Values
Constructor Detail

ProfileCastRouter

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

Parameters:
s - The settings object
Method Detail

changedConnection

public void changedConnection(core.Connection con)
Tries to deliver the message when the connection is up beetween two nodes. first gets all the messages that the reciver does not have form the set of the sender, then transfers the ones where this host has > similarity that the sender. If the message hs expired its TTL it's deleted.

Overrides:
changedConnection in class routing.ActiveRouter
Parameters:
con - The connection that has changed between two nodes

createNewMessage

public boolean createNewMessage(core.Message m)
Creates a message, sets a random target trace to reach and computes the target trace similarity. adds the message and his similarity to the the similarity map of the node that create the message.

Overrides:
createNewMessage in class routing.ActiveRouter
Parameters:
m - Message form the super.createNewMessage()
Returns:
Boolean true if the message is created correctly else false.

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 core.Message messageTransferred(java.lang.String id,
                                       DTNHost from)
Description copied from class: routing.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 routing.ActiveRouter
Parameters:
id - Id of the transferred message
from - Host the message was from (previous hop)
Returns:
The message that this host received

update

public void update()
Nothing to do; all transfers are started only when new connections are created or new messages are created or received, and transfers are finalized immediately

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

replicate

public ProfileCastRouter replicate()
Description copied from class: routing.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 routing.MessageRouter
Returns:
The replicate

reset

public static void reset()
Resets the static router list