Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qdnslookup.h
Go to the documentation of this file.
1// Copyright (C) 2012 Jeremy Lainé <jeremy.laine@m4x.org>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QDNSLOOKUP_H
5#define QDNSLOOKUP_H
6
7#include <QtNetwork/qtnetworkglobal.h>
8#include <QtCore/qlist.h>
9#include <QtCore/qobject.h>
10#include <QtCore/qshareddata.h>
11#include <QtCore/qstring.h>
12#include <QtCore/qproperty.h>
13
15
17
18class QHostAddress;
25
26class Q_NETWORK_EXPORT QDnsDomainNameRecord
27{
28public:
34
35 void swap(QDnsDomainNameRecord &other) noexcept { d.swap(other.d); }
36
37 QString name() const;
38 quint32 timeToLive() const;
39 QString value() const;
40
41private:
43 friend class QDnsLookupRunnable;
44};
45
46Q_DECLARE_SHARED(QDnsDomainNameRecord)
47
48class Q_NETWORK_EXPORT QDnsHostAddressRecord
49{
50public:
56
57 void swap(QDnsHostAddressRecord &other) noexcept { d.swap(other.d); }
58
59 QString name() const;
60 quint32 timeToLive() const;
61 QHostAddress value() const;
62
63private:
65 friend class QDnsLookupRunnable;
66};
67
68Q_DECLARE_SHARED(QDnsHostAddressRecord)
69
70class Q_NETWORK_EXPORT QDnsMailExchangeRecord
71{
72public:
78
79 void swap(QDnsMailExchangeRecord &other) noexcept { d.swap(other.d); }
80
81 QString exchange() const;
82 QString name() const;
83 quint16 preference() const;
84 quint32 timeToLive() const;
85
86private:
88 friend class QDnsLookupRunnable;
89};
90
91Q_DECLARE_SHARED(QDnsMailExchangeRecord)
92
93class Q_NETWORK_EXPORT QDnsServiceRecord
94{
95public:
99 QDnsServiceRecord &operator=(const QDnsServiceRecord &other);
101
102 void swap(QDnsServiceRecord &other) noexcept { d.swap(other.d); }
103
104 QString name() const;
105 quint16 port() const;
106 quint16 priority() const;
107 QString target() const;
108 quint32 timeToLive() const;
109 quint16 weight() const;
110
111private:
113 friend class QDnsLookupRunnable;
114};
115
116Q_DECLARE_SHARED(QDnsServiceRecord)
117
118class Q_NETWORK_EXPORT QDnsTextRecord
119{
120public:
123 QDnsTextRecord &operator=(QDnsTextRecord &&other) noexcept { swap(other); return *this; }
124 QDnsTextRecord &operator=(const QDnsTextRecord &other);
126
127 void swap(QDnsTextRecord &other) noexcept { d.swap(other.d); }
128
129 QString name() const;
130 quint32 timeToLive() const;
132
133private:
135 friend class QDnsLookupRunnable;
136};
137
138Q_DECLARE_SHARED(QDnsTextRecord)
139
140class Q_NETWORK_EXPORT QDnsLookup : public QObject
141{
143 Q_PROPERTY(Error error READ error NOTIFY finished)
144 Q_PROPERTY(QString errorString READ errorString NOTIFY finished)
145 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged BINDABLE bindableName)
146 Q_PROPERTY(Type type READ type WRITE setType NOTIFY typeChanged BINDABLE bindableType)
147 Q_PROPERTY(QHostAddress nameserver READ nameserver WRITE setNameserver NOTIFY nameserverChanged
148 BINDABLE bindableNameserver)
149 Q_PROPERTY(quint16 nameserverPort READ nameserverPort WRITE setNameserverPort
150 NOTIFY nameserverPortChanged BINDABLE bindableNameserverPort)
151
152public:
153 enum Error
154 {
164 };
166
167 enum Type
168 {
169 A = 1,
170 AAAA = 28,
171 ANY = 255,
172 CNAME = 5,
173 MX = 15,
174 NS = 2,
175 PTR = 12,
176 SRV = 33,
177 TXT = 16
178 };
179 Q_ENUM(Type)
180
181 explicit QDnsLookup(QObject *parent = nullptr);
182 QDnsLookup(Type type, const QString &name, QObject *parent = nullptr);
183 QDnsLookup(Type type, const QString &name, const QHostAddress &nameserver, QObject *parent = nullptr);
184 QDnsLookup(Type type, const QString &name, const QHostAddress &nameserver, quint16 port,
185 QObject *parent = nullptr);
186 ~QDnsLookup();
187
188 Error error() const;
189 QString errorString() const;
190 bool isFinished() const;
191
192 QString name() const;
193 void setName(const QString &name);
194 QBindable<QString> bindableName();
195
196 Type type() const;
198 QBindable<Type> bindableType();
199
200 QHostAddress nameserver() const;
201 void setNameserver(const QHostAddress &nameserver);
202 QBindable<QHostAddress> bindableNameserver();
203 quint16 nameserverPort() const;
204 void setNameserverPort(quint16 port);
205 QBindable<quint16> bindableNameserverPort();
206 void setNameserver(const QHostAddress &nameserver, quint16 port);
207
208 QList<QDnsDomainNameRecord> canonicalNameRecords() const;
209 QList<QDnsHostAddressRecord> hostAddressRecords() const;
210 QList<QDnsMailExchangeRecord> mailExchangeRecords() const;
211 QList<QDnsDomainNameRecord> nameServerRecords() const;
212 QList<QDnsDomainNameRecord> pointerRecords() const;
213 QList<QDnsServiceRecord> serviceRecords() const;
214 QList<QDnsTextRecord> textRecords() const;
215
216
217public Q_SLOTS:
218 void abort();
219 void lookup();
220
222 void finished();
225 void nameserverChanged(const QHostAddress &nameserver);
227
228private:
229 Q_DECLARE_PRIVATE(QDnsLookup)
230};
231
233
234#endif // QDNSLOOKUP_H
\inmodule QtCore
Definition qproperty.h:809
The QDnsDomainNameRecord class stores information about a domain name record.
Definition qdnslookup.h:27
void swap(QDnsDomainNameRecord &other) noexcept
Swaps this domain-name record instance with other.
Definition qdnslookup.h:35
QDnsDomainNameRecord & operator=(QDnsDomainNameRecord &&other) noexcept
Definition qdnslookup.h:31
The QDnsHostAddressRecord class stores information about a host address record.
Definition qdnslookup.h:49
void swap(QDnsHostAddressRecord &other) noexcept
Swaps this host address record instance with other.
Definition qdnslookup.h:57
QDnsHostAddressRecord & operator=(QDnsHostAddressRecord &&other) noexcept
Definition qdnslookup.h:53
void finished(const QDnsLookupReply &reply)
The QDnsLookup class represents a DNS lookup.
Definition qdnslookup.h:141
Type
Indicates the type of DNS lookup that was performed.
Definition qdnslookup.h:168
void nameserverPortChanged(quint16 port)
void typeChanged(Type type)
This signal is emitted when the lookup \l type changes.
Error
Indicates all possible error conditions found during the processing of the DNS lookup.
Definition qdnslookup.h:154
@ InvalidReplyError
Definition qdnslookup.h:159
@ OperationCancelledError
Definition qdnslookup.h:157
@ ServerRefusedError
Definition qdnslookup.h:161
@ ServerFailureError
Definition qdnslookup.h:160
@ InvalidRequestError
Definition qdnslookup.h:158
void finished()
This signal is emitted when the reply has finished processing.
void nameChanged(const QString &name)
This signal is emitted when the lookup \l name changes.
void nameserverChanged(const QHostAddress &nameserver)
The QDnsMailExchangeRecord class stores information about a DNS MX record.
Definition qdnslookup.h:71
void swap(QDnsMailExchangeRecord &other) noexcept
Swaps this mail exchange record with other.
Definition qdnslookup.h:79
QDnsMailExchangeRecord & operator=(QDnsMailExchangeRecord &&other) noexcept
Definition qdnslookup.h:75
The QDnsServiceRecord class stores information about a DNS SRV record.
Definition qdnslookup.h:94
void swap(QDnsServiceRecord &other) noexcept
Swaps this service record instance with other.
Definition qdnslookup.h:102
QDnsServiceRecord & operator=(QDnsServiceRecord &&other) noexcept
Definition qdnslookup.h:98
The QDnsTextRecord class stores information about a DNS TXT record.
Definition qdnslookup.h:119
void swap(QDnsTextRecord &other) noexcept
Swaps this text record instance with other.
Definition qdnslookup.h:127
QDnsTextRecord & operator=(QDnsTextRecord &&other) noexcept
Definition qdnslookup.h:123
The QHostAddress class provides an IP address.
Definition qlist.h:74
\inmodule QtCore
Definition qobject.h:90
\inmodule QtCore
Definition qshareddata.h:35
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
employee setName("Richard Schmit")
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
EGLOutputPortEXT port
#define NS(x)
Definition qmetatype.cpp:65
n varying highp vec2 A
GLenum GLsizei GLsizei GLint * values
[15]
GLuint GLuint GLfloat weight
GLenum type
GLenum target
GLuint name
@ NoError
Definition main.cpp:34
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
unsigned int quint32
Definition qtypes.h:45
unsigned short quint16
Definition qtypes.h:43
QSharedPointer< T > other(t)
[5]
this swap(other)
proxy setType(QNetworkProxy::Socks5Proxy)
Definition moc.h:24
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent