Class HostPacket

java.lang.Object
org.cloudbus.cloudsim.network.HostPacket
All Implemented Interfaces:
NetworkPacket<NetworkHost>

public class HostPacket extends Object implements 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 Details

    • HostPacket

      public HostPacket(NetworkHost sourceHost, VmPacket vmPacket)
      Creates a packet to be sent through the network between two hosts.
      Parameters:
      sourceHost - host sending the packet
      vmPacket - 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 enclosing VmPacket.
      Specified by:
      getSize in interface NetworkPacket<NetworkHost>
      Returns:
      size of the packet in bytes.
    • getSource

      public NetworkHost getSource()
      Gets the Host that this packet is coming from (the sender).
      Specified by:
      getSource in interface NetworkPacket<NetworkHost>
      Returns:
    • setSource

      public final void setSource(NetworkHost sourceHost)
      Sets the Host that this packet is coming from (the sender).
      Specified by:
      setSource in interface NetworkPacket<NetworkHost>
      Parameters:
      sourceHost - the source Host id to set
    • getDestination

      public NetworkHost getDestination()
      Gets the Host that the packet is going to.
      Specified by:
      getDestination in interface NetworkPacket<NetworkHost>
      Returns:
    • setDestination

      public void setDestination(NetworkHost destinationHost)
      Sets the Host that the packet is going to (the receiver).
      Specified by:
      setDestination in interface NetworkPacket<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 interface NetworkPacket<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 interface NetworkPacket<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 interface NetworkPacket<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 interface NetworkPacket<NetworkHost>
      Parameters:
      receiveTime - the time to set (in seconds)
    • getVmPacket

      public VmPacket getVmPacket()
      Gets information about the virtual sender and receiver entities of the packet (the sender and receiver Cloudlet and their respective VMs).
      Returns:
    • getVmEdgeSwitch

      public EdgeSwitch getVmEdgeSwitch()
      Gets the EdgeSwitch 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