Package org.cloudbus.cloudsim.network
Class HostPacket
java.lang.Object
org.cloudbus.cloudsim.network.HostPacket
- All Implemented Interfaces:
NetworkPacket<NetworkHost>
Represents a packet which travels from one
Host
to another.
Each packet contains: IDs of the sender VM into the source Host and receiver VM into the destination Host which are
communicating; the time at which it is sent and received; type and virtual IDs of tasks.
Please refer to following publication for more details:
- Since:
- CloudSim Toolkit 1.0
- Author:
- Saurabh Kumar Garg, Manoel Campos da Silva Filho
-
Constructor Summary
ConstructorDescriptionHostPacket
(NetworkHost sourceHost, VmPacket vmPacket) Creates a packet to be sent through the network between two hosts. -
Method Summary
Modifier and TypeMethodDescriptionGets theHost
that the packet is going to.double
Gets the time (in seconds) when the packet was received.double
Gets the time (in seconds) when the packet was sent.long
getSize()
Gets the size of the packet in bytes.Gets theHost
that this packet is coming from (the sender).Gets theEdgeSwitch
that the Host where the VM receiving a packet is connected to.Gets information about the virtual sender and receiver entities of the packet (the sender and receiver Cloudlet and their respective VMs).void
setDestination
(NetworkHost destinationHost) Sets theHost
that the packet is going to (the receiver).void
setReceiveTime
(double receiveTime) Sets the time when the packet was received.void
setSendTime
(double sendTime) Sets the time when the packet was sent.final void
setSource
(NetworkHost sourceHost) Sets theHost
that this packet is coming from (the sender).
-
Constructor Details
-
HostPacket
Creates a packet to be sent through the network between two hosts.- Parameters:
sourceHost
- host sending the packetvmPacket
- vm packet containing information of sender and receiver Cloudlets and their VMs.
-
-
Method Details
-
getSize
public long getSize()Gets the size of the packet in bytes. It is the size of the enclosingVmPacket
.- Specified by:
getSize
in interfaceNetworkPacket<NetworkHost>
- Returns:
- size of the packet in bytes.
-
getSource
Gets theHost
that this packet is coming from (the sender).- Specified by:
getSource
in interfaceNetworkPacket<NetworkHost>
- Returns:
-
setSource
Sets theHost
that this packet is coming from (the sender).- Specified by:
setSource
in interfaceNetworkPacket<NetworkHost>
- Parameters:
sourceHost
- the source Host id to set
-
getDestination
Gets theHost
that the packet is going to.- Specified by:
getDestination
in interfaceNetworkPacket<NetworkHost>
- Returns:
-
setDestination
Sets theHost
that the packet is going to (the receiver).- Specified by:
setDestination
in interfaceNetworkPacket<NetworkHost>
- Parameters:
destinationHost
- the receiver Host id to set
-
getSendTime
public double getSendTime()Description copied from interface:NetworkPacket
Gets the time (in seconds) when the packet was sent.- Specified by:
getSendTime
in interfaceNetworkPacket<NetworkHost>
- Returns:
-
setSendTime
public void setSendTime(double sendTime) Description copied from interface:NetworkPacket
Sets the time when the packet was sent.- Specified by:
setSendTime
in interfaceNetworkPacket<NetworkHost>
- Parameters:
sendTime
- the time to set (in seconds)
-
getReceiveTime
public double getReceiveTime()Description copied from interface:NetworkPacket
Gets the time (in seconds) when the packet was received.- Specified by:
getReceiveTime
in interfaceNetworkPacket<NetworkHost>
- Returns:
-
setReceiveTime
public void setReceiveTime(double receiveTime) Description copied from interface:NetworkPacket
Sets the time when the packet was received.- Specified by:
setReceiveTime
in interfaceNetworkPacket<NetworkHost>
- Parameters:
receiveTime
- the time to set (in seconds)
-
getVmPacket
Gets information about the virtual sender and receiver entities of the packet (the sender and receiver Cloudlet and their respective VMs).- Returns:
-
getVmEdgeSwitch
Gets theEdgeSwitch
that the Host where the VM receiving a packet is connected to.- Returns:
- the Edge Switch connected to the Host where the targeting VM is placed
-