NetSim 1.0.0
An educational network simulation software for students
|
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< Header > | headers () 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. | |
Header & | operator[] (const NetSim::HeaderType &type) |
Returns a reference to a specific header. | |
Header | operator[] (const NetSim::HeaderType &type) const |
Returns a specific header. | |
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.
|
default |
Default constructor.
|
explicit |
Constructs a package with information.
Package::Package | ( | const QString & | info, |
const QString & | content | ||
) |
Constructs a package with information and content.
void Package::addHeader | ( | const Header & | header | ) |
Adds a new header to the package.
void Package::changeEthernetHeader | ( | const MACAddress & | srcAddress, |
const MACAddress & | destAddress | ||
) |
Modifies the Ethernet header.
Modifies the IP and port headers.
QString Package::content | ( | ) | const |
Returns the package's content.
QList< Header > Package::headers | ( | ) | const |
Returns the list of headers.
QString Package::info | ( | ) | const |
Returns the package's information.
Header & Package::operator[] | ( | const NetSim::HeaderType & | type | ) |
Returns a reference to a specific header.
Header Package::operator[] | ( | const NetSim::HeaderType & | type | ) | const |
Returns a specific header.
void Package::setContent | ( | const QString & | content | ) |
Sets the package's content.
quint16 Package::size | ( | ) | const |
Returns the total size of the package.