Packets

This module contains all packet definitions.

Packet(destination, source, timestamp) Representation of a quantum of information
DataPacket(destination, source, timestamp, ...) A packet used for transferring data
RouterPacket(source, timestamp, ...) A packet used to update routing tables

Packet

class cs143sim.packets.Packet(destination, source, timestamp)[source]

Representation of a quantum of information

Packets carry information along the network, between Hosts or Routers.

Parameters:
  • destination – destination Host or Router
  • source – source Host or Router
  • timestamp (str) – time at which the packet was created
Variables:
  • destination – destination Host or Router
  • source – source Host or Router
  • timestamp (float) – time at which the packet was created
  • size (int) – size of the packet

DataPacket

class cs143sim.packets.DataPacket(destination, source, timestamp, acknowledgement, number)[source]

A packet used for transferring data

DataPackets transmit data along the network, between Hosts or Routers.

Parameters:
  • destination – destination Host or Router
  • source – source Host or Router
  • timestamp (float) – time at which the packet was created
  • acknowledgement (bool) – indicate whether the packet is an AckPacket
  • number (int) – the number of the packet in a flow
Variables:
  • number (int) – the number of the packet in a flow
  • acknowledgement (bool) – indicate whether the packet is an AckPacket

RouterPacket

class cs143sim.packets.RouterPacket(source, timestamp, router_table, acknowledgement)[source]

A packet used to update routing tables

RouterPackets carry information of routing tables along the network, between Routers.

Parameters:
  • source – source Host or Router
  • timestamp (float) – time at which the packet was created
  • router_table (dict) – the routing table
  • acknowledgement (bool) – indicate whether the packet is an AckPacket
Variables:
  • router_table (dict) – the routing table of the RouterPacket
  • number (int) – the number of the RouterPacket, which is always 0
  • acknowledgement (bool) – indicate whether the packet is an AckPacket