|
NetSim 1.0.0
An educational network simulation software for students
|
Represents a virtual router with capability to forward packages. More...
#include <router.h>
Public Member Functions | |
| Router ()=default | |
| Default constructor. | |
| void | receivePackage (Package data) |
| Receives a package and forwards it accordingly. | |
| IPAddress | globalIpAddress () const |
| Returns the global IP address of the router. | |
| NetworkCard | networkCard () const |
| Returns the network card associated with the router. | |
| QMap< IPAddress, MACAddress > | macTable () const |
| Returns the MAC address table mapping IP addresses to MAC addresses. | |
| QMap< MACAddress, Router * > | routerCable () const |
| Returns the mapping between MAC addresses and connected routers. | |
| QMap< MACAddress, Host * > | hostCable () const |
| Returns the mapping between MAC addresses and connected hosts. | |
| QMap< Port, NATEntry > | NAT () const |
| Returns the mapping of NAT entries and associated ports. | |
| void | addIPAddress (const IPAddress &ipAddress, const MACAddress &macaddress) |
| Adds an IP address and its associated MAC address to the router's table. | |
| void | addMACAddress (const MACAddress &macAddress, Router *router) |
| Adds a MAC address and its associated router to the router's table. | |
| void | addMACAddress (const MACAddress &macAddress, Host *host) |
| Adds a MAC address and its associated host to the router's table. | |
| void | addNATEntry (const NATEntry &entry, const Port &port) |
| Adds a NAT entry and its associated port to the router's NAT table. | |
Represents a virtual router with capability to forward packages.
The Router class is responsible for simulating the behavior of a network router. It holds information about connected devices and routes packages accordingly.
|
default |
Default constructor.
| void Router::addIPAddress | ( | const IPAddress & | ipAddress, |
| const MACAddress & | macaddress | ||
| ) |
| void Router::addMACAddress | ( | const MACAddress & | macAddress, |
| Host * | host | ||
| ) |
| void Router::addMACAddress | ( | const MACAddress & | macAddress, |
| Router * | router | ||
| ) |
Adds a NAT entry and its associated port to the router's NAT table.
| entry | The NAT entry to be added. |
| port | The associated port. |
| IPAddress Router::globalIpAddress | ( | ) | const |
Returns the global IP address of the router.
| QMap< MACAddress, Host * > Router::hostCable | ( | ) | const |
Returns the mapping between MAC addresses and connected hosts.
| QMap< IPAddress, MACAddress > Router::macTable | ( | ) | const |
Returns the mapping of NAT entries and associated ports.
| NetworkCard Router::networkCard | ( | ) | const |
Returns the network card associated with the router.

| void Router::receivePackage | ( | Package | data | ) |
Receives a package and forwards it accordingly.
| data | The data package to be processed and forwarded. |


| QMap< MACAddress, Router * > Router::routerCable | ( | ) | const |
Returns the mapping between MAC addresses and connected routers.