| 
    NetSim 1.0.0
    
   An educational network simulation software for students 
   | 
 
Represents a client in the network simulation. More...
#include <client.h>


Public Member Functions | |
| Client ()=default | |
| Default constructor.   | |
| Client (const NetworkCard &networkCard) | |
| Constructs a client with the provided network card.   | |
| void | execDomainResolution (const QString &domain) | 
| Initiates a domain name resolution.   | |
| void | execHandShake (const IPAddress &address) | 
| Initiates a TCP handshake to the specified IP address.   | |
| void | execHTTPRequest (const IPAddress &address, const QString &uri) | 
| Sends an HTTP request to the specified IP address and URI.   | |
| void | execCloseConnection (const IPAddress &address) | 
| Closes the connection to the specified IP address.   | |
| void | receivePackage (Package data) override | 
| Receives a package and processes based on its type.   | |
  Public Member Functions inherited from NetSim::Host | |
| Host ()=default | |
| The default constructor.   | |
| Host (const NetworkCard &networkCard) | |
| Constructor that initializes a host with a network card.   | |
| QMap< Port, Process > | processTable () const | 
| Retrieve the process table.   | |
| QMap< IPAddress, MACAddress > | hostTable () const | 
| Retrieve the host table.   | |
| QMap< QString, IPAddress > | domainTable () const | 
| Retrieve the domain table.   | |
| QMap< MACAddress, Router * > | cables () const | 
| Retrieve the cables table.   | |
| NetworkCard | networkCard () const | 
| Retrieve the network card.   | |
| Router * | getRouterByMACAddress (const MACAddress &destinationAddress) | 
| Retrieves the router by its MAC address.   | |
| void | sendPackage (Package &data, const MACAddress &destinationAddress) | 
| Send a package to a destination MAC address.   | |
| virtual void | receivePackage (Package data)=0 | 
| Pure virtual function to receive a package. Must be implemented in derived classes.   | |
| void | addProcess (const Process &process) | 
| Adds a process to the process table.   | |
| void | addIPAddress (const IPAddress &ipAddress, const MACAddress &macAddress) | 
| Adds an IP address to MAC address resolution to the ARP table.   | |
| void | addMACAddress (const MACAddress &macAddress, Router *router) | 
| Adds a MAC address to router pointer to the cables table.   | |
| void | addDomain (const QString &domain, const IPAddress &ipAddress) | 
| Adds a domain to IP address resolution to the DNS table.   | |
| PackageTableModel * | packages () const | 
| Get all the packages associated with this host.   | |
| void | setPackages (PackageTableModel *packages) | 
| Set the packages for this host.   | |
| Process & | getProcessByName (const QString &name) | 
| Retrieves a process by its name.   | |
| void | setHostOfProcesses (Host *host) | 
| Set the host for all processes.   | |
Represents a client in the network simulation.
The Client class is responsible for initiating network requests such as DNS resolution, establishing TCP handshakes, making HTTP requests, and closing connections.
      
  | 
  default | 
Default constructor.
| Client::Client | ( | const NetworkCard & | networkCard | ) | 
Constructs a client with the provided network card.
| networkCard | Network interface card of the client. | 
| void Client::execCloseConnection | ( | const IPAddress & | address | ) | 
Closes the connection to the specified IP address.
| address | IP address to close the connection. | 

| void Client::execDomainResolution | ( | const QString & | domain | ) | 
Initiates a domain name resolution.
| domain | Domain name to be resolved. | 

| void Client::execHandShake | ( | const IPAddress & | address | ) | 
Initiates a TCP handshake to the specified IP address.
| address | IP address to establish a connection. | 

| void Client::execHTTPRequest | ( | const IPAddress & | address, | 
| const QString & | uri | ||
| ) | 
Sends an HTTP request to the specified IP address and URI.
| address | IP address of the server to send the request. | 
| uri | Requested Uniform Resource Identifier. | 

      
  | 
  overridevirtual | 
Receives a package and processes based on its type.
The client can receive and process DNS Response, TCP Handshake, and TCP closing packages.
| data | Package data received by the client. | 
Implements NetSim::Host.
