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

A static class that provides methods to convert header data to string. More...

#include <headerutil.h>

Static Public Member Functions

static QString getMacAddress (const Package &data, bool src)
 Extracts the MAC Address from a given package.
 
static QString getEtherType (const Package &data)
 Extracts the EtherType from a given package.
 
static QString getIPHeaderLength (const Package &data)
 Extracts the IP header length from a given package.
 
static QString getIPTOS (const Package &data)
 Extracts the IP Type of Service from a given package.
 
static QString getIPTotalLength (const Package &data)
 Extracts the IP Total Length from a given package.
 
static QString getIPIdentification (const Package &data)
 Extracts the IP Identification from a given package.
 
static QString getIPTTL (const Package &data)
 Extracts the IP TTL from a given package.
 
static QString getIPAddress (const Package &data, bool src)
 Extracts the IP Protocol from a given package.
 
static QString getIPFlags (const Package &data)
 Extracts the IP Flags from a given package.
 
static QString getIPFlag (const Package &data, const IPFlag &flagName)
 Extracts a specific IP Flag from a given package.
 
static QString getIPNextProtocol (const Package &data)
 Extracts the IP Next Protocol from a given package.
 
static QString getIPChecksum (const Package &data)
 Extracts the IP Checksum from a given package.
 
static QString getIPFragmentOffset (const Package &data)
 Extracts the IP Fragment Offset from a given package.
 
static QString getPort (const Package &data, bool src)
 Extracts the Port from a given package.
 
static QString getTCPFlags (const Package &data)
 Extracts the TCP Flags from a given package.
 
static QString getTCPFlag (const Package &data, const TCPFlag &flagName)
 Extracts a specific TCP Flag from a given package.
 
static QString getTCPSequenceNumber (const Package &data)
 Extracts the TCP Sequence Number from a given package.
 
static QString getTCPAcknowledgementNumber (const Package &data)
 Extracts the TCP Acknowledgement Number from a given package.
 
static QString getTCPHeaderLength (const Package &data)
 Extracts the TCP Header Length from a given package.
 
static QString getTCPWindow (const Package &data)
 Extracts the TCP Window from a given package.
 
static QString getTCPChecksum (const Package &data)
 Extracts the TCP Checksum from a given package.
 
static QString getTCPUrgentPointer (const Package &data)
 Extracts the TCP Urgent Pointer from a given package.
 
static QString getUDPChecksum (const Package &data)
 Extracts the UDP Checksum from a given package.
 
static QString getUDPLength (const Package &data)
 Extracts the UDP Length from a given package.
 
static QString getHTTPAttribute (const Package &data, const QString &attributeName)
 Extracts a specific HTTP Attribute from a given package.
 
static bool getHTTPIsResponse (const Package &data)
 Extracts if the package is a response or request.
 
static bool getHTTPIsRequest (const Package &data)
 Extracts if the package is a request or response.
 
static QString getDNSID (const Package &data)
 Extracts the DNS ID from a given package.
 
static QString getDNSFlags (const Package &data)
 Extracts the DNS Flags from a given package.
 
static QString getDNSFlag (const Package &data, const DNSFlag &flagName)
 Extracts a specific DNS Flag from a given package.
 
static QString getDNSQuestions (const Package &data)
 Extracts the DNS Question Count from a given package.
 
static QString getDNSAnswerRRs (const Package &data)
 Extracts the DNS Answer Count from a given package.
 
static QString getDNSQuery (const Package &data, int index, const RRAttribute &attr=RRAttribute::FULL_DATA)
 Extracts the DNS Query at the given index from a given package.
 
static QString getDNSAnswer (const Package &data, int index, const RRAttribute &attr=RRAttribute::FULL_DATA)
 Extracts the DNS Answer at the given index from a given package.
 
static IPAddress getDNSAnswerIPAddress (const Package &data, int index)
 Extracts the IP Address of the DNS Answer at the given index from a given package.
 
static QString getPackageLength (const Package &data)
 Extracts the Port of the DNS Answer at the given index from a given package.
 
static HeaderType getTopProtocol (const Package &data)
 Extracts the Package Top Protocol.
 
static IPAddress getIPAddressAsIPAddress (const Package &data, bool src)
 Extracts the IP Address of the IP Protocol from the given package.
 
static Port getPortAsPort (const Package &data, bool src)
 Extracts the Port of the TCP Protocol from the given package.
 

Detailed Description

A static class that provides methods to convert header data to string.

The HeaderUtil class contains static methods that can convert header data to string representations to be displayed in the UI.

Member Function Documentation

◆ getDNSAnswer()

QString HeaderUtil::getDNSAnswer ( const Package data,
int  index,
const RRAttribute attr = RRAttribute::FULL_DATA 
)
static

Extracts the DNS Answer at the given index from a given package.

This method extacts the DNS Answer at the given index from a given package and converts it to a string representation. It is possible to request specific data, in this case only this data will be returned. As default full data will be returned.

Parameters
dataThe package to extract the DNS Answer from.
indexThe index of the DNS Answer to extract.
attrThe RRAttribute to extract.
Returns
QString The string representation of the DNS Answer.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDNSAnswerIPAddress()

IPAddress HeaderUtil::getDNSAnswerIPAddress ( const Package data,
int  index 
)
static

Extracts the IP Address of the DNS Answer at the given index from a given package.

This method extracts the IP Address of the DNS Answer at the given index from a given package and converts it to a reusable format.

Parameters
dataThe package to extract the IP Address from.
indexThe index of the DNS Answer to extract.
Returns
IPAddress The IP Address of the DNS Answer.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDNSAnswerRRs()

QString HeaderUtil::getDNSAnswerRRs ( const Package data)
static

Extracts the DNS Answer Count from a given package.

This method extracts the DNS Answer Count from a given package and converts it to a string representation.

Parameters
dataThe package to extract the DNS Answer Count from.
Returns
QString The string representation of the DNS Answer Count.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDNSFlag()

QString HeaderUtil::getDNSFlag ( const Package data,
const DNSFlag flagName 
)
static

Extracts a specific DNS Flag from a given package.

This method extracts a specific DNS Flag from a given package and converts it to a string representation.

Parameters
dataThe package to extract the DNS Flag from.
flagNameThe name of the DNS Flag to extract.
Returns
QString The string representation of the DNS Flag.
Here is the call graph for this function:

◆ getDNSFlags()

QString HeaderUtil::getDNSFlags ( const Package data)
static

Extracts the DNS Flags from a given package.

This method extracts the DNS Flags from a given package and converts it to a string representation.

Parameters
dataThe package to extract the DNS Flags from.
Returns
QString The string representation of the DNS Flags.
Here is the call graph for this function:

◆ getDNSID()

QString HeaderUtil::getDNSID ( const Package data)
static

Extracts the DNS ID from a given package.

This method extracts the DNS ID from a given package and converts it to a string representation.

Parameters
dataThe package to extract the DNS ID from.
Returns
QString The string representation of the DNS ID.
Here is the call graph for this function:

◆ getDNSQuery()

QString HeaderUtil::getDNSQuery ( const Package data,
int  index,
const RRAttribute attr = RRAttribute::FULL_DATA 
)
static

Extracts the DNS Query at the given index from a given package.

This method extacts the DNS Query at the given index from a given package and converts it to a string representation. It is possible to request specific data, in this case only this data will be returned. As default full data will be returned.

Parameters
dataThe package to extract the DNS Query from.
indexThe index of the DNS Query to extract.
attrThe RRAttribute to extract.
Returns
QString The string representation of the DNS Query.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDNSQuestions()

QString HeaderUtil::getDNSQuestions ( const Package data)
static

Extracts the DNS Question Count from a given package.

This method extracts the DNS Question Count from a given package and converts it to a string representation.

Parameters
dataThe package to extract the DNS Question Count from.
Returns
QString The string representation of the DNS Question Count.
Here is the call graph for this function:

◆ getEtherType()

QString HeaderUtil::getEtherType ( const Package data)
static

Extracts the EtherType from a given package.

This method extracts the EtherType from a given package and converts it to a string representation.

Parameters
dataThe package to extract the EtherType from.
Returns
QString The string representation of the EtherType.
Here is the call graph for this function:

◆ getHTTPAttribute()

QString HeaderUtil::getHTTPAttribute ( const Package data,
const QString &  attributeName 
)
static

Extracts a specific HTTP Attribute from a given package.

This method extracts a specific HTTP Attribute from a given package and converts it to a string representation.

Parameters
dataThe package to extract the HTTP Attribute from.
attributeNameThe name of the HTTP Attribute to extract.
Returns
QString The string representation of the HTTP Attribute.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHTTPIsRequest()

bool HeaderUtil::getHTTPIsRequest ( const Package data)
static

Extracts if the package is a request or response.

This method extracts if the package is a request or response and returns the specific boolean.

Parameters
dataThe package to analyze.
Returns
bool Returns true if the given package is a http request.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHTTPIsResponse()

bool HeaderUtil::getHTTPIsResponse ( const Package data)
static

Extracts if the package is a response or request.

This method extracts if the package is a response or request and returns the specific boolean.

Parameters
dataThe package to analyze.
Returns
bool Returns true if the given package is a http response.
Here is the call graph for this function:

◆ getIPAddress()

QString HeaderUtil::getIPAddress ( const Package data,
bool  src 
)
static

Extracts the IP Protocol from a given package.

This method extracts the IP Protocol from a given package and converts it to a string representation.

Parameters
dataThe package to extract the IP Protocol from.
Returns
QString The string representation of the IP Protocol.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIPAddressAsIPAddress()

IPAddress HeaderUtil::getIPAddressAsIPAddress ( const Package data,
bool  src 
)
static

Extracts the IP Address of the IP Protocol from the given package.

This method extracts the IP Address of the IP Protocol from the given package and converts it to a reusable format.

Parameters
dataThe package to extract the IP Address from.
srcTrue if the source IP Address should be extracted, false if the destination IP Address should be extracted.
Returns
IPAddress The IP Address of the IP Protocol.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIPChecksum()

QString HeaderUtil::getIPChecksum ( const Package data)
static

Extracts the IP Checksum from a given package.

This method extracts the IP Checksum from a given package and converts it to a string representation.

Parameters
dataThe package to extract the IP Checksum from.
Returns
QString The string representation of the IP Checksum.
Here is the call graph for this function:

◆ getIPFlag()

QString HeaderUtil::getIPFlag ( const Package data,
const IPFlag flagName 
)
static

Extracts a specific IP Flag from a given package.

This method extracts a specific IP Flag from a given package and converts it to a string representation.

Parameters
dataThe package to extract the IP Flag from.
flagNameThe name of the IP Flag to extract.
Returns
QString The string representation of the IP Flag.
Here is the call graph for this function:

◆ getIPFlags()

QString HeaderUtil::getIPFlags ( const Package data)
static

Extracts the IP Flags from a given package.

This method extracts the IP Flags from a given package and converts it to a string representation.

Parameters
dataThe package to extract the IP Flags from.
Returns
QString The string representation of the IP Flags.
Here is the call graph for this function:

◆ getIPFragmentOffset()

QString HeaderUtil::getIPFragmentOffset ( const Package data)
static

Extracts the IP Fragment Offset from a given package.

This method extacts the IP Fragment Offset from a given package and converts it to a string representation.

Parameters
dataThe package to extract the IP Fragment Offset from.
Returns
QString The string representation of the IP Fragment Offset.
Here is the call graph for this function:

◆ getIPHeaderLength()

QString HeaderUtil::getIPHeaderLength ( const Package data)
static

Extracts the IP header length from a given package.

This method extracts the IP version from a given package and converts it to a string representation.

Parameters
dataThe package to extract the IP header length from.
Returns
QString The string representation of the IP header length.
Here is the call graph for this function:

◆ getIPIdentification()

QString HeaderUtil::getIPIdentification ( const Package data)
static

Extracts the IP Identification from a given package.

This method extracts the IP Identification from a given package and converts it to a string representation.

Parameters
dataThe package to extract the IP Identification from.
Returns
QString The string representation of the IP Identification.
Here is the call graph for this function:

◆ getIPNextProtocol()

QString HeaderUtil::getIPNextProtocol ( const Package data)
static

Extracts the IP Next Protocol from a given package.

This method extracts the IP next protocol from a given package and converts it to a string representation.

Parameters
dataThe package to extract the IP next protocol from.
Returns
QString The string representation of the IP next protocol.
Here is the call graph for this function:

◆ getIPTOS()

QString HeaderUtil::getIPTOS ( const Package data)
static

Extracts the IP Type of Service from a given package.

This method extracts the IP Type of Service from a given package and converts it to a string representation.

Parameters
dataThe package to extract the IP Type of Service from.
Returns
QString The string representation of the IP Type of Service.
Here is the call graph for this function:

◆ getIPTotalLength()

QString HeaderUtil::getIPTotalLength ( const Package data)
static

Extracts the IP Total Length from a given package.

This method extracts the IP Total Length from a given package and converts it to a string representation.

Parameters
dataThe package to extract the IP Total Length from.
Returns
QString The string representation of the IP Total Length.
Here is the call graph for this function:

◆ getIPTTL()

QString HeaderUtil::getIPTTL ( const Package data)
static

Extracts the IP TTL from a given package.

This method extracts the IP TTL from a given package and converts it to a string representation.

Parameters
dataThe package to extract the IP TTL from.
Returns
QString The string representation of the IP TTL.
Here is the call graph for this function:

◆ getMacAddress()

QString HeaderUtil::getMacAddress ( const Package data,
bool  src 
)
static

Extracts the MAC Address from a given package.

This method extracts the MAC address from a given package and converts it to a string representation. The MAC address can be either the source or the destination address.

Parameters
dataThe package to extract the MAC address from.
srcWhether the source or the destination MAC address should be extracted.
Returns
QString The string representation of the MAC address.
Here is the call graph for this function:

◆ getPackageLength()

QString HeaderUtil::getPackageLength ( const Package data)
static

Extracts the Port of the DNS Answer at the given index from a given package.

This method extracts the Port of the DNS Answer at the given index from a given package and converts it to a reusable format.

Parameters
dataThe package to extract the Port from.
indexThe index of the DNS Answer to extract.
Returns
Port The Port of the DNS Answer.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPort()

QString HeaderUtil::getPort ( const Package data,
bool  src 
)
static

Extracts the Port from a given package.

This method extracts the Port from a given package and converts it to a string representation. The method automatically checks if the package is send by UDP or TCP and returns the correct port. The port can either be the source or the destination port.

Parameters
dataThe package to extract the port from.
srcWhether the source or the destination port should be extracted.
Returns
QString The string representation of the port.
Here is the call graph for this function:

◆ getPortAsPort()

Port HeaderUtil::getPortAsPort ( const Package data,
bool  src 
)
static

Extracts the Port of the TCP Protocol from the given package.

This method extracts the Port of the TCP Protocol from the given package and converts it to a reusable format.

Parameters
dataThe package to extract the Port from.
srcTrue if the source Port should be extracted, false if the destination Port should be extracted.
Returns
Port The Port of the TCP Protocol.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTCPAcknowledgementNumber()

QString HeaderUtil::getTCPAcknowledgementNumber ( const Package data)
static

Extracts the TCP Acknowledgement Number from a given package.

This method extracts the TCP Acknowledgement Number from a given package and converts it to a string representation.

Parameters
dataThe package to extract the TCP Acknowledgement Number from.
Returns
QString The string representation of the TCP Acknowledgement Number.
Here is the call graph for this function:

◆ getTCPChecksum()

QString HeaderUtil::getTCPChecksum ( const Package data)
static

Extracts the TCP Checksum from a given package.

This method extracts the TCP Checksum from a given package and converts it to a string representation.

Parameters
dataThe package to extract the TCP Checksum from.
Returns
QString The string representation of the TCP Checksum.
Here is the call graph for this function:

◆ getTCPFlag()

QString HeaderUtil::getTCPFlag ( const Package data,
const TCPFlag flagName 
)
static

Extracts a specific TCP Flag from a given package.

This method extracts a specific TCP Flag from a given package and converts it to a string representation.

Parameters
dataThe package to extract the TCP Flag from.
flagNameThe name of the TCP Flag to extract.
Returns
QString The string representation of the TCP Flag.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTCPFlags()

QString HeaderUtil::getTCPFlags ( const Package data)
static

Extracts the TCP Flags from a given package.

This method extracts the TCP Flags from a given package and converts it to a string representation.

Parameters
dataThe package to extract the TCP Flags from.
Returns
QString The string representation of the TCP Flags.
Here is the call graph for this function:

◆ getTCPHeaderLength()

QString HeaderUtil::getTCPHeaderLength ( const Package data)
static

Extracts the TCP Header Length from a given package.

This method extracts the TCP Header Length from a given package and converts it to a string representation.

Parameters
dataThe package to extract the TCP Header Length from.
Returns
QString The string representation of the TCP Header Length.
Here is the call graph for this function:

◆ getTCPSequenceNumber()

QString HeaderUtil::getTCPSequenceNumber ( const Package data)
static

Extracts the TCP Sequence Number from a given package.

This method extracts the TCP Sequence Number from a given package and converts it to a string representation.

Parameters
dataThe package to extract the TCP Sequence Number from.
Returns
QString The string representation of the TCP Sequence Number.
Here is the call graph for this function:

◆ getTCPUrgentPointer()

QString HeaderUtil::getTCPUrgentPointer ( const Package data)
static

Extracts the TCP Urgent Pointer from a given package.

This method extracts the TCP Urgent Pointer from a given package and converts it to a string representation.

Parameters
dataThe package to extract the TCP Urgent Pointer from.
Returns
QString The string representation of the TCP Urgent Pointer.
Here is the call graph for this function:

◆ getTCPWindow()

QString HeaderUtil::getTCPWindow ( const Package data)
static

Extracts the TCP Window from a given package.

This method extracts the TCP Window from a given package and converts it to a string representation.

Parameters
dataThe package to extract the TCP Window from.
Returns
QString The string representation of the TCP Window.
Here is the call graph for this function:

◆ getTopProtocol()

HeaderType HeaderUtil::getTopProtocol ( const Package data)
static

Extracts the Package Top Protocol.

This method analyzes the given package and extracts the top level protocol.

Parameters
dataThe package to analyze.
Returns
HeaderType The top level protocol.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getUDPChecksum()

QString HeaderUtil::getUDPChecksum ( const Package data)
static

Extracts the UDP Checksum from a given package.

This method extracts the UDP Checksum from a given package and converts it to a string representation.

Parameters
dataThe package to extract the UDP Checksum from.
Returns
QString The string representation of the UDP Checksum.
Here is the call graph for this function:

◆ getUDPLength()

QString HeaderUtil::getUDPLength ( const Package data)
static

Extracts the UDP Length from a given package.

This method extracts the UDP Length from a given package and converts it to a string representation.

Parameters
dataThe package to extract the UDP Length from.
Returns
QString The string representation of the UDP Length.
Here is the call graph for this function:

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