NetSim 1.0.0
An educational network simulation software for students
Loading...
Searching...
No Matches
Public Member Functions | List of all members
NetSim::NetworkCard Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ NetworkCard() [1/2]

NetSim::NetworkCard::NetworkCard ( )
default

Default constructor.

◆ NetworkCard() [2/2]

NetworkCard::NetworkCard ( const IPAddress networkAddress,
const MACAddress physicalAddress 
)
explicit

Constructs a NetworkCard object with the given network and physical addresses.

Parameters
networkAddressIP address of the network card.
physicalAddressMAC address of the network card.

Member Function Documentation

◆ addIPHeader()

void NetworkCard::addIPHeader ( Package data,
quint8  protocol,
const IPAddress destinationAddress 
)

Adds an IP header to the provided data package.

Parameters
dataData package to which the IP header should be added.
protocolProtocol number (e.g., TCP, UDP).
destinationAddressIP address of the destination.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addMACHeader()

void NetworkCard::addMACHeader ( Package data,
MACAddress  destinationMACAddress,
quint16  etherType 
)

Adds a MAC header to the provided data package.

Parameters
dataData package to which the MAC header should be added.
destinationMACAddressMAC address of the destination.
etherTypeEthertype value that indicates which protocol is encapsulated in the payload.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ networkAddress()

IPAddress NetworkCard::networkAddress ( ) const

Returns the network (IP) address of the network card.

Here is the caller graph for this function:

◆ physicalAddress()

MACAddress NetworkCard::physicalAddress ( ) const

Returns the physical (MAC) address of the network card.

Here is the caller graph for this function:

The documentation for this class was generated from the following files: