NetSim 1.0.0
An educational network simulation software for students
Loading...
Searching...
No Matches
headerutil.h
Go to the documentation of this file.
1#ifndef HEADERUTIL_H
2#define HEADERUTIL_H
3
4#include "dns.h"
5#include "ipv4.h"
7#include "tcp.h"
8#include <QString>
9
13
14namespace NetSim {
15
19
29public:
42 static QString getMacAddress(const Package &data, bool src);
43
53 static QString getEtherType(const Package &data);
54
64 static QString getIPHeaderLength(const Package &data);
65
75 static QString getIPTOS(const Package &data);
76
86 static QString getIPTotalLength(const Package &data);
87
97 static QString getIPIdentification(const Package &data);
98
108 static QString getIPTTL(const Package &data);
109
119 static QString getIPAddress(const Package &data, bool src);
120
130 static QString getIPFlags(const Package &data);
131
142 static QString getIPFlag(const Package &data, const IPFlag &flagName);
143
153 static QString getIPNextProtocol(const Package &data);
154
164 static QString getIPChecksum(const Package &data);
165
175 static QString getIPFragmentOffset(const Package &data);
176
189 static QString getPort(const Package &data, bool src);
190
200 static QString getTCPFlags(const Package &data);
201
212 static QString getTCPFlag(const Package &data, const TCPFlag &flagName);
213
223 static QString getTCPSequenceNumber(const Package &data);
224
235 static QString getTCPAcknowledgementNumber(const Package &data);
236
246 static QString getTCPHeaderLength(const Package &data);
247
257 static QString getTCPWindow(const Package &data);
258
268 static QString getTCPChecksum(const Package &data);
269
279 static QString getTCPUrgentPointer(const Package &data);
280
290 static QString getUDPChecksum(const Package &data);
291
301 static QString getUDPLength(const Package &data);
302
313 static QString getHTTPAttribute(const Package &data,
314 const QString &attributeName);
315
325 static bool getHTTPIsResponse(const Package &data);
326
336 static bool getHTTPIsRequest(const Package &data);
337
347 static QString getDNSID(const Package &data);
348
358 static QString getDNSFlags(const Package &data);
359
370 static QString getDNSFlag(const Package &data, const DNSFlag &flagName);
371
381 static QString getDNSQuestions(const Package &data);
382
392 static QString getDNSAnswerRRs(const Package &data);
393
407 static QString getDNSQuery(const Package &data, int index,
408 const RRAttribute &attr = RRAttribute::FULL_DATA);
409
423 static QString getDNSAnswer(const Package &data, int index,
424 const RRAttribute &attr = RRAttribute::FULL_DATA);
425
437 static IPAddress getDNSAnswerIPAddress(const Package &data, int index);
438
450 static QString getPackageLength(const Package &data);
451
460 static HeaderType getTopProtocol(const Package &data);
461
473 static IPAddress getIPAddressAsIPAddress(const Package &data, bool src);
474
486 static Port getPortAsPort(const Package &data, bool src);
487};
488} // namespace NetSim
489
490#endif // HEADERUTIL_H
A static class that provides methods to convert header data to string.
Definition headerutil.h:28
static QString getTCPAcknowledgementNumber(const Package &data)
Extracts the TCP Acknowledgement Number from a given package.
Definition headerutil.cpp:500
static QString getIPNextProtocol(const Package &data)
Extracts the IP Next Protocol from a given package.
Definition headerutil.cpp:166
static QString getUDPChecksum(const Package &data)
Extracts the UDP Checksum from a given package.
Definition headerutil.cpp:616
static QString getTCPChecksum(const Package &data)
Extracts the TCP Checksum from a given package.
Definition headerutil.cpp:569
static IPAddress getIPAddressAsIPAddress(const Package &data, bool src)
Extracts the IP Address of the IP Protocol from the given package.
Definition headerutil.cpp:1114
static QString getTCPFlag(const Package &data, const TCPFlag &flagName)
Extracts a specific TCP Flag from a given package.
Definition headerutil.cpp:417
static QString getIPIdentification(const Package &data)
Extracts the IP Identification from a given package.
Definition headerutil.cpp:265
static bool getHTTPIsResponse(const Package &data)
Extracts if the package is a response or request.
Definition headerutil.cpp:691
static QString getDNSAnswerRRs(const Package &data)
Extracts the DNS Answer Count from a given package.
Definition headerutil.cpp:871
static QString getPort(const Package &data, bool src)
Extracts the Port from a given package.
Definition headerutil.cpp:357
static QString getIPFragmentOffset(const Package &data)
Extracts the IP Fragment Offset from a given package.
Definition headerutil.cpp:332
static QString getIPFlag(const Package &data, const IPFlag &flagName)
Extracts a specific IP Flag from a given package.
Definition headerutil.cpp:130
static IPAddress getDNSAnswerIPAddress(const Package &data, int index)
Extracts the IP Address of the DNS Answer at the given index from a given package.
Definition headerutil.cpp:1071
static bool getHTTPIsRequest(const Package &data)
Extracts if the package is a request or response.
Definition headerutil.cpp:704
static QString getTCPHeaderLength(const Package &data)
Extracts the TCP Header Length from a given package.
Definition headerutil.cpp:524
static QString getIPChecksum(const Package &data)
Extracts the IP Checksum from a given package.
Definition headerutil.cpp:309
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.
Definition headerutil.cpp:968
static QString getIPTTL(const Package &data)
Extracts the IP TTL from a given package.
Definition headerutil.cpp:288
static QString getIPHeaderLength(const Package &data)
Extracts the IP header length from a given package.
Definition headerutil.cpp:199
static QString getMacAddress(const Package &data, bool src)
Extracts the MAC Address from a given package.
Definition headerutil.cpp:13
static QString getIPAddress(const Package &data, bool src)
Extracts the IP Protocol from a given package.
Definition headerutil.cpp:77
static QString getDNSQuestions(const Package &data)
Extracts the DNS Question Count from a given package.
Definition headerutil.cpp:849
static QString getDNSFlags(const Package &data)
Extracts the DNS Flags from a given package.
Definition headerutil.cpp:742
static QString getTCPSequenceNumber(const Package &data)
Extracts the TCP Sequence Number from a given package.
Definition headerutil.cpp:476
static Port getPortAsPort(const Package &data, bool src)
Extracts the Port of the TCP Protocol from the given package.
Definition headerutil.cpp:1148
static QString getDNSID(const Package &data)
Extracts the DNS ID from a given package.
Definition headerutil.cpp:719
static QString getIPFlags(const Package &data)
Extracts the IP Flags from a given package.
Definition headerutil.cpp:109
static QString getEtherType(const Package &data)
Extracts the EtherType from a given package.
Definition headerutil.cpp:45
static HeaderType getTopProtocol(const Package &data)
Extracts the Package Top Protocol.
Definition headerutil.cpp:1110
static QString getDNSFlag(const Package &data, const DNSFlag &flagName)
Extracts a specific DNS Flag from a given package.
Definition headerutil.cpp:764
static QString getIPTOS(const Package &data)
Extracts the IP Type of Service from a given package.
Definition headerutil.cpp:220
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.
Definition headerutil.cpp:893
static QString getUDPLength(const Package &data)
Extracts the UDP Length from a given package.
Definition headerutil.cpp:639
static QString getTCPWindow(const Package &data)
Extracts the TCP Window from a given package.
Definition headerutil.cpp:546
static QString getTCPUrgentPointer(const Package &data)
Extracts the TCP Urgent Pointer from a given package.
Definition headerutil.cpp:592
static QString getIPTotalLength(const Package &data)
Extracts the IP Total Length from a given package.
Definition headerutil.cpp:242
static QString getPackageLength(const Package &data)
Extracts the Port of the DNS Answer at the given index from a given package.
Definition headerutil.cpp:1106
static QString getTCPFlags(const Package &data)
Extracts the TCP Flags from a given package.
Definition headerutil.cpp:394
static QString getHTTPAttribute(const Package &data, const QString &attributeName)
Extracts a specific HTTP Attribute from a given package.
Definition headerutil.cpp:663
Represents an IPv4 address.
Definition ipaddress.h:27
Represents a network package.
Definition package.h:28
Represents a network port.
Definition port.h:24
Contains the DNS class definition and related enumerations.
Contains the IPv4 class definition.
Definition logger.h:12
TCPFlag
TCP Flags used for the TCP header.
Definition tcp.h:19
HeaderType
Definition header.h:23
IPFlag
Enumeration representing IP Flags.
Definition ipv4.h:21
RRAttribute
Enumeration to represent various Resource Record attributes.
Definition dnsentry.h:14
@ FULL_DATA
Definition dnsentry.h:14
DNSFlag
Definition dns.h:21
Contains the Package class definition.
Contains the TCP class definition.