NetSim 1.0.0
An educational network simulation software for students
|
Represents a virtual network card with network and physical address capabilities. More...
#include <networkcard.h>
Public Member Functions | |
NetworkCard ()=default | |
Default constructor. | |
NetworkCard (const IPAddress &networkAddress, const MACAddress &physicalAddress) | |
Constructs a NetworkCard object with the given network and physical addresses. | |
void | addIPHeader (Package &data, quint8 protocol, const IPAddress &destinationAddress) |
Adds an IP header to the provided data package. | |
void | addMACHeader (Package &data, MACAddress destinationMACAddress, quint16 etherType) |
Adds a MAC header to the provided data package. | |
IPAddress | networkAddress () const |
Returns the network (IP) address of the network card. | |
MACAddress | physicalAddress () const |
Returns the physical (MAC) address of the network card. | |
Represents a virtual network card with network and physical address capabilities.
The NetworkCard class is responsible for simulating the behavior of a network interface card. It can add IP and MAC headers to a data package and provides functionalities related to the network and physical addresses of the card.
|
default |
Default constructor.
|
explicit |
Constructs a NetworkCard object with the given network and physical addresses.
networkAddress | IP address of the network card. |
physicalAddress | MAC address of the network card. |
void NetworkCard::addMACHeader | ( | Package & | data, |
MACAddress | destinationMACAddress, | ||
quint16 | etherType | ||
) |
Adds a MAC header to the provided data package.
data | Data package to which the MAC header should be added. |
destinationMACAddress | MAC address of the destination. |
etherType | Ethertype value that indicates which protocol is encapsulated in the payload. |
IPAddress NetworkCard::networkAddress | ( | ) | const |
Returns the network (IP) address of the network card.
MACAddress NetworkCard::physicalAddress | ( | ) | const |