53 QMap<IPAddress, MACAddress>
macTable()
const;
59 QMap<MACAddress, Host *>
hostCable()
const;
62 QMap<Port, NATEntry>
NAT()
const;
99 QMap<IPAddress, MACAddress> m_macTable{};
102 QMap<MACAddress, Router *> m_routerCable{};
105 QMap<MACAddress, Host *> m_hostCable{};
108 QMap<Port, NATEntry> m_portToNAT{};
111 QMap<NATEntry, Port> m_natToPort{};
Represents a network host that can communicate through routers.
Definition host.h:32
Represents an IPv4 address.
Definition ipaddress.h:27
static IPAddress getRandomAddress(bool isLocal=false)
Generates a random IP address.
Definition ipaddress.cpp:28
Represents a Media Access Control (MAC) address.
Definition macaddress.h:26
static MACAddress getRandomAddress()
Generates a random MAC address.
Definition macaddress.cpp:33
Represents an entry in the NAT table with an IP address and associated port.
Definition natentry.h:27
Represents a virtual network card with network and physical address capabilities.
Definition networkcard.h:27
Represents a network package.
Definition package.h:28
Represents a network port.
Definition port.h:24
Represents a virtual router with capability to forward packages.
Definition router.h:32
void addIPAddress(const IPAddress &ipAddress, const MACAddress &macaddress)
Adds an IP address and its associated MAC address to the router's table.
Definition router.cpp:19
Router()=default
Default constructor.
void addNATEntry(const NATEntry &entry, const Port &port)
Adds a NAT entry and its associated port to the router's NAT table.
Definition router.cpp:32
QMap< MACAddress, Router * > routerCable() const
Returns the mapping between MAC addresses and connected routers.
Definition router.cpp:13
NetworkCard networkCard() const
Returns the network card associated with the router.
Definition router.cpp:9
QMap< IPAddress, MACAddress > macTable() const
Returns the MAC address table mapping IP addresses to MAC addresses.
Definition router.cpp:11
QMap< Port, NATEntry > NAT() const
Returns the mapping of NAT entries and associated ports.
Definition router.cpp:17
QMap< MACAddress, Host * > hostCable() const
Returns the mapping between MAC addresses and connected hosts.
Definition router.cpp:15
void addMACAddress(const MACAddress &macAddress, Router *router)
Adds a MAC address and its associated router to the router's table.
Definition router.cpp:24
void receivePackage(Package data)
Receives a package and forwards it accordingly.
Definition router.cpp:37
IPAddress globalIpAddress() const
Returns the global IP address of the router.
Definition router.cpp:7
The Host class implements a host in the network.
Contains the IPAddress class definition.
Contains the NAT Entry class definition.
Contains the Network Card class definition.