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

Represents a network package. More...

#include <package.h>

Public Member Functions

 Package ()=default
 Default constructor.
 
 Package (const QString &info)
 Constructs a package with information.
 
 Package (const QString &info, const QString &content)
 Constructs a package with information and content.
 
QString content () const
 Returns the package's content.
 
QList< Headerheaders () const
 Returns the list of headers.
 
QString info () const
 Returns the package's information.
 
quint16 size () const
 Returns the total size of the package.
 
void addHeader (const Header &header)
 Adds a new header to the package.
 
void setContent (const QString &content)
 Sets the package's content.
 
void changePortAndIP (const Port &number, const IPAddress &address, bool src)
 Modifies the IP and port headers.
 
void changeEthernetHeader (const MACAddress &srcAddress, const MACAddress &destAddress)
 Modifies the Ethernet header.
 
Headeroperator[] (const NetSim::HeaderType &type)
 Returns a reference to a specific header.
 
Header operator[] (const NetSim::HeaderType &type) const
 Returns a specific header.
 

Detailed Description

Represents a network package.

This class provides functionalities to represent a network package, which can contain multiple headers and a payload. The package can be modified by adding/removing headers or changing its content.

Constructor & Destructor Documentation

◆ Package() [1/3]

NetSim::Package::Package ( )
default

Default constructor.

◆ Package() [2/3]

Package::Package ( const QString &  info)
explicit

Constructs a package with information.

◆ Package() [3/3]

Package::Package ( const QString &  info,
const QString &  content 
)

Constructs a package with information and content.

Member Function Documentation

◆ addHeader()

void Package::addHeader ( const Header header)

Adds a new header to the package.

Here is the caller graph for this function:

◆ changeEthernetHeader()

void Package::changeEthernetHeader ( const MACAddress srcAddress,
const MACAddress destAddress 
)

Modifies the Ethernet header.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ changePortAndIP()

void Package::changePortAndIP ( const Port number,
const IPAddress address,
bool  src 
)

Modifies the IP and port headers.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content()

QString Package::content ( ) const

Returns the package's content.

Here is the caller graph for this function:

◆ headers()

QList< Header > Package::headers ( ) const

Returns the list of headers.

Here is the caller graph for this function:

◆ info()

QString Package::info ( ) const

Returns the package's information.

Here is the caller graph for this function:

◆ operator[]() [1/2]

Header & Package::operator[] ( const NetSim::HeaderType type)

Returns a reference to a specific header.

◆ operator[]() [2/2]

Header Package::operator[] ( const NetSim::HeaderType type) const

Returns a specific header.

◆ setContent()

void Package::setContent ( const QString &  content)

Sets the package's content.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

quint16 Package::size ( ) const

Returns the total size of the package.

Here is the call graph for this function:
Here is the caller graph for this function:

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