|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcore.DTNHost
public class DTNHost
A DTN capable host.
Constructor Summary | |
---|---|
DTNHost(java.util.List<MessageListener> msgLs,
java.util.List<MovementListener> movLs,
java.lang.String groupId,
java.util.List<NetworkInterface> interf,
ModuleCommunicationBus comBus,
MovementModel mmProto,
MessageRouter mRouterProto)
Creates a new DTNHost. |
Method Summary | |
---|---|
int |
compareTo(DTNHost h)
Compares two DTNHosts by their addresses. |
void |
connect(DTNHost h)
for tests only --- do not use!!! |
void |
connectionDown(Connection con)
|
void |
connectionUp(Connection con)
Informs the router of this host about state change in a connection object. |
void |
createNewMessage(Message m)
Creates a new message to this host's router |
void |
deleteMessage(java.lang.String id,
boolean drop)
Deletes a message from this host |
boolean |
equals(DTNHost otherHost)
Checks if a host is the same as this host by comparing the object reference |
void |
forceConnection(DTNHost anotherHost,
java.lang.String interfaceId,
boolean up)
Force a connection event |
int |
getAddress()
Returns the network-layer address of this host. |
double |
getBufferOccupancy()
Returns the buffer occupancy percentage. |
ModuleCommunicationBus |
getComBus()
Returns this hosts's ModuleCommunicationBus |
java.util.List<Connection> |
getConnections()
Returns a copy of the list of connections this host has with other hosts |
protected NetworkInterface |
getInterface(int interfaceNo)
Find the network interface based on the index |
protected NetworkInterface |
getInterface(java.lang.String interfacetype)
Find the network interface based on the interfacetype |
java.util.List<NetworkInterface> |
getInterfaces()
Returns the interface objects of the node |
Coord |
getLocation()
Returns the current location of this host. |
java.util.Collection<Message> |
getMessageCollection()
Returns the messages in a collection. |
int |
getNrofMessages()
Returns the number of messages this node is carrying. |
Path |
getPath()
Returns the Path this node is currently traveling or null if no path is in use at the moment. |
MessageRouter |
getRouter()
Returns the router of this host |
RoutingInfo |
getRoutingInfo()
Returns routing info of this host's router. |
boolean |
isActive()
Returns true if this node is active (false if not) |
void |
messageAborted(java.lang.String id,
DTNHost from,
int bytesRemaining)
Informs the host that a message transfer was aborted. |
void |
messageTransferred(java.lang.String id,
DTNHost from)
Informs the host that a message was successfully transferred. |
void |
move(double timeIncrement)
Moves the node towards the next waypoint or waits if it is not time to move yet |
int |
receiveMessage(Message m,
DTNHost from)
Start receiving a message from another host |
boolean |
requestDeliverableMessages(Connection con)
Requests for deliverable message from this host to be sent trough a connection. |
static void |
reset()
Reset the host and its interfaces |
void |
sendMessage(java.lang.String id,
DTNHost to)
Sends a message from this host to another host |
void |
setLocation(Coord location)
Sets the Node's location overriding any location set by movement model |
void |
setName(java.lang.String name)
Sets the Node's name overriding the default name (groupId + netAddress) |
java.lang.String |
toString()
Returns a string presentation of the host. |
void |
update(boolean simulateConnections)
Updates node's network layer and router. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DTNHost(java.util.List<MessageListener> msgLs, java.util.List<MovementListener> movLs, java.lang.String groupId, java.util.List<NetworkInterface> interf, ModuleCommunicationBus comBus, MovementModel mmProto, MessageRouter mRouterProto)
msgLs
- Message listenersmovLs
- Movement listenersgroupId
- GroupID of this hostinterf
- List of NetworkInterfaces for the classcomBus
- Module communication bus objectmmProto
- Prototype of the movement model of this hostmRouterProto
- Prototype of the message router of this hostMethod Detail |
---|
public static void reset()
public boolean isActive()
public MessageRouter getRouter()
public int getAddress()
public ModuleCommunicationBus getComBus()
public void connectionUp(Connection con)
con
- The connection object whose state changedpublic void connectionDown(Connection con)
public java.util.List<Connection> getConnections()
public Coord getLocation()
public Path getPath()
public void setLocation(Coord location)
location
- The location to setpublic void setName(java.lang.String name)
name
- The name to setpublic java.util.Collection<Message> getMessageCollection()
public int getNrofMessages()
public double getBufferOccupancy()
public RoutingInfo getRoutingInfo()
public java.util.List<NetworkInterface> getInterfaces()
protected NetworkInterface getInterface(int interfaceNo)
protected NetworkInterface getInterface(java.lang.String interfacetype)
public void forceConnection(DTNHost anotherHost, java.lang.String interfaceId, boolean up)
public void connect(DTNHost h)
public void update(boolean simulateConnections)
simulateConnections
- Should network layer be updated toopublic void move(double timeIncrement)
timeIncrement
- How long time the node movespublic void sendMessage(java.lang.String id, DTNHost to)
id
- Identifier of the messageto
- Host the message should be sent topublic int receiveMessage(Message m, DTNHost from)
m
- The messagefrom
- Who the message is from
MessageRouter.receiveMessage(Message, DTNHost)
public boolean requestDeliverableMessages(Connection con)
con
- The connection to send the messages trough
public void messageTransferred(java.lang.String id, DTNHost from)
id
- Identifier of the messagefrom
- From who the message was frompublic void messageAborted(java.lang.String id, DTNHost from, int bytesRemaining)
id
- Identifier of the messagefrom
- From who the message was frombytesRemaining
- Nrof bytes that were left before the transfer
would have been ready; or -1 if the number of bytes is not knownpublic void createNewMessage(Message m)
m
- The message to createpublic void deleteMessage(java.lang.String id, boolean drop)
id
- Identifier of the messagedrop
- True if the message is deleted because of "dropping"
(e.g. buffer is full) or false if it was deleted for some other reason
(e.g. the message got delivered to final destination). This effects the
way the removing is reported to the message listeners.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(DTNHost otherHost)
otherHost
- The other host
public int compareTo(DTNHost h)
compareTo
in interface java.lang.Comparable<DTNHost>
Comparable.compareTo(Object)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |