NetSim 1.0.0
An educational network simulation software for students
Loading...
Searching...
No Matches
dns.h
Go to the documentation of this file.
1#ifndef DNS_H
2#define DNS_H
3
6
10
11namespace NetSim {
12
15
21enum DNSFlag {
29 OPCODE = 11,
30 RESPONSE = 15
31};
32
39class DNS {
40public:
47 static void initDNSRequest(Package &data, const QList<DNSEntry> queries);
48
58 static void initDNSResponse(Package &data, const QList<DNSEntry> queries,
59 const QList<DNSEntry> answers, bool nxDomain);
60
61private:
70 static void setFlag(quint16 *flags, bool set, quint8 position);
71
78 static QVector<quint8> stringToArray(const QString &string);
79};
80
81} // namespace NetSim
82
83#endif // DNS_H
Provides utility methods to initialize DNS request and response data in packages.
Definition dns.h:39
static void initDNSResponse(Package &data, const QList< DNSEntry > queries, const QList< DNSEntry > answers, bool nxDomain)
Initializes a DNS response package with the given queries and answers.
Definition dns.cpp:45
static void initDNSRequest(Package &data, const QList< DNSEntry > queries)
Initializes a DNS request package with the given queries.
Definition dns.cpp:5
Represents a network package.
Definition package.h:28
Contains the DNSEntry class definition.
Definition logger.h:12
DNSFlag
Definition dns.h:21
@ TRUNCATED
Definition dns.h:27
@ REPLY_CODE
Definition dns.h:22
@ ANSWER_AUTHENTICATED
Definition dns.h:24
@ RESPONSE
Definition dns.h:30
@ NON_AUTHENTICATED_DATA
Definition dns.h:23
@ OPCODE
Definition dns.h:29
@ RECURSION_DESIRED
Definition dns.h:26
@ RECURSION_AVAILABLE
Definition dns.h:25
@ AUTHORITATIVE
Definition dns.h:28
Contains the Package class definition.