Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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;
27
29
30class Q_NETWORK_EXPORT QDnsDomainNameRecord
31{
32public:
38
39 void swap(QDnsDomainNameRecord &other) noexcept { d.swap(other.d); }
40
41 QString name() const;
42 quint32 timeToLive() const;
43 QString value() const;
44
45private:
46 QSharedDataPointer<QDnsDomainNameRecordPrivate> d;
47 friend class QDnsLookupRunnable;
48};
49
50Q_DECLARE_SHARED(QDnsDomainNameRecord)
51
52class Q_NETWORK_EXPORT QDnsHostAddressRecord
53{
54public:
60
61 void swap(QDnsHostAddressRecord &other) noexcept { d.swap(other.d); }
62
63 QString name() const;
64 quint32 timeToLive() const;
65 QHostAddress value() const;
66
67private:
68 QSharedDataPointer<QDnsHostAddressRecordPrivate> d;
69 friend class QDnsLookupRunnable;
70};
71
72Q_DECLARE_SHARED(QDnsHostAddressRecord)
73
74class Q_NETWORK_EXPORT QDnsMailExchangeRecord
75{
76public:
82
83 void swap(QDnsMailExchangeRecord &other) noexcept { d.swap(other.d); }
84
85 QString exchange() const;
86 QString name() const;
87 quint16 preference() const;
88 quint32 timeToLive() const;
89
90private:
91 QSharedDataPointer<QDnsMailExchangeRecordPrivate> d;
92 friend class QDnsLookupRunnable;
93};
94
95Q_DECLARE_SHARED(QDnsMailExchangeRecord)
96
97class Q_NETWORK_EXPORT QDnsServiceRecord
98{
99public:
103 QDnsServiceRecord &operator=(const QDnsServiceRecord &other);
105
106 void swap(QDnsServiceRecord &other) noexcept { d.swap(other.d); }
107
108 QString name() const;
109 quint16 port() const;
110 quint16 priority() const;
111 QString target() const;
112 quint32 timeToLive() const;
113 quint16 weight() const;
114
115private:
116 QSharedDataPointer<QDnsServiceRecordPrivate> d;
117 friend class QDnsLookupRunnable;
118};
119
120Q_DECLARE_SHARED(QDnsServiceRecord)
121
122class Q_NETWORK_EXPORT QDnsTextRecord
123{
124public:
127 QDnsTextRecord &operator=(QDnsTextRecord &&other) noexcept { swap(other); return *this; }
128 QDnsTextRecord &operator=(const QDnsTextRecord &other);
130
131 void swap(QDnsTextRecord &other) noexcept { d.swap(other.d); }
132
133 QString name() const;
134 quint32 timeToLive() const;
135 QList<QByteArray> values() const;
136
137private:
138 QSharedDataPointer<QDnsTextRecordPrivate> d;
139 friend class QDnsLookupRunnable;
140};
141
142Q_DECLARE_SHARED(QDnsTextRecord)
143
144class Q_NETWORK_EXPORT QDnsTlsAssociationRecord
145{
147public:
149 // https://www.iana.org/assignments/dane-parameters/dane-parameters.xhtml#certificate-usages
150 // RFC 6698
151 CertificateAuthorityConstrait = 0,
152 ServiceCertificateConstraint = 1,
153 TrustAnchorAssertion = 2,
154 DomainIssuedCertificate = 3,
155 PrivateUse = 255,
156
157 // Aliases by RFC 7218
158 PKIX_TA = 0,
159 PKIX_EE = 1,
160 DANE_TA = 2,
161 DANE_EE = 3,
162 PrivCert = 255,
163 };
164 Q_ENUM(CertificateUsage)
165
166 enum class Selector : quint8 {
167 // https://www.iana.org/assignments/dane-parameters/dane-parameters.xhtml#selectors
168 // RFC 6698
169 FullCertificate = 0,
170 SubjectPublicKeyInfo = 1,
171 PrivateUse = 255,
172
173 // Aliases by RFC 7218
174 Cert = FullCertificate,
175 SPKI = SubjectPublicKeyInfo,
176 PrivSel = PrivateUse,
177 };
178 Q_ENUM(Selector)
179
180 enum class MatchingType : quint8 {
181 // https://www.iana.org/assignments/dane-parameters/dane-parameters.xhtml#matching-types
182 // RFC 6698
183 Exact = 0,
184 Sha256 = 1,
185 Sha512 = 2,
186 PrivateUse = 255,
187 PrivMatch = PrivateUse,
188 };
189 Q_ENUM(MatchingType)
190
199
200 void swap(QDnsTlsAssociationRecord &other) noexcept { d.swap(other.d); }
201
202 QString name() const;
203 quint32 timeToLive() const;
204 CertificateUsage usage() const;
205 Selector selector() const;
206 MatchingType matchType() const;
207 QByteArray value() const;
208
209private:
210 QSharedDataPointer<QDnsTlsAssociationRecordPrivate> d;
211 friend class QDnsLookupRunnable;
212};
213
214Q_DECLARE_SHARED(QDnsTlsAssociationRecord)
215
216class Q_NETWORK_EXPORT QDnsLookup : public QObject
217{
220 Q_PROPERTY(bool authenticData READ isAuthenticData NOTIFY finished)
221 Q_PROPERTY(QString errorString READ errorString NOTIFY finished)
222 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged BINDABLE bindableName)
223 Q_PROPERTY(Type type READ type WRITE setType NOTIFY typeChanged BINDABLE bindableType)
224 Q_PROPERTY(QHostAddress nameserver READ nameserver WRITE setNameserver NOTIFY nameserverChanged
225 BINDABLE bindableNameserver)
226 Q_PROPERTY(quint16 nameserverPort READ nameserverPort WRITE setNameserverPort
227 NOTIFY nameserverPortChanged BINDABLE bindableNameserverPort)
228 Q_PROPERTY(Protocol nameserverProtocol READ nameserverProtocol WRITE setNameserverProtocol
229 NOTIFY nameserverProtocolChanged BINDABLE bindableNameserverProtocol)
230
231public:
245
246 enum Type
247 {
248 A = 1,
249 AAAA = 28,
250 ANY = 255,
251 CNAME = 5,
252 MX = 15,
253 NS = 2,
254 PTR = 12,
255 SRV = 33,
256 TLSA = 52,
257 TXT = 16
258 };
259 Q_ENUM(Type)
260
262 Standard = 0,
264 };
265 Q_ENUM(Protocol)
266
267 explicit QDnsLookup(QObject *parent = nullptr);
268 QDnsLookup(Type type, const QString &name, QObject *parent = nullptr);
269 QDnsLookup(Type type, const QString &name, const QHostAddress &nameserver, QObject *parent = nullptr);
270 QDnsLookup(Type type, const QString &name, const QHostAddress &nameserver, quint16 port,
271 QObject *parent = nullptr);
272 QDnsLookup(Type type, const QString &name, Protocol protocol, const QHostAddress &nameserver,
273 quint16 port = 0, QObject *parent = nullptr);
274 ~QDnsLookup();
275
276 bool isAuthenticData() const;
277 Error error() const;
278 QString errorString() const;
279 bool isFinished() const;
280
281 QString name() const;
282 void setName(const QString &name);
283 QBindable<QString> bindableName();
284
285 Type type() const;
287 QBindable<Type> bindableType();
288
289 QHostAddress nameserver() const;
290 void setNameserver(const QHostAddress &nameserver);
291 QBindable<QHostAddress> bindableNameserver();
292 quint16 nameserverPort() const;
293 void setNameserverPort(quint16 port);
294 QBindable<quint16> bindableNameserverPort();
295 Protocol nameserverProtocol() const;
296 void setNameserverProtocol(Protocol protocol);
297 QBindable<Protocol> bindableNameserverProtocol();
298 void setNameserver(Protocol protocol, const QHostAddress &nameserver, quint16 port = 0);
299 QT_NETWORK_INLINE_SINCE(6, 8)
300 void setNameserver(const QHostAddress &nameserver, quint16 port);
301
302 QList<QDnsDomainNameRecord> canonicalNameRecords() const;
303 QList<QDnsHostAddressRecord> hostAddressRecords() const;
304 QList<QDnsMailExchangeRecord> mailExchangeRecords() const;
305 QList<QDnsDomainNameRecord> nameServerRecords() const;
306 QList<QDnsDomainNameRecord> pointerRecords() const;
307 QList<QDnsServiceRecord> serviceRecords() const;
308 QList<QDnsTextRecord> textRecords() const;
309 QList<QDnsTlsAssociationRecord> tlsAssociationRecords() const;
310
311#if QT_CONFIG(ssl)
312 void setSslConfiguration(const QSslConfiguration &sslConfiguration);
313 QSslConfiguration sslConfiguration() const;
314#endif
315
316 static bool isProtocolSupported(Protocol protocol);
317 static quint16 defaultPortForProtocol(Protocol protocol) noexcept Q_DECL_CONST_FUNCTION;
318
319public Q_SLOTS:
320 void abort();
321 void lookup();
322
324 void finished();
327 void nameserverChanged(const QHostAddress &nameserver);
330
331private:
332 Q_DECLARE_PRIVATE(QDnsLookup)
333};
334
335#if QT_NETWORK_INLINE_IMPL_SINCE(6, 8)
336void QDnsLookup::setNameserver(const QHostAddress &nameserver, quint16 port)
337{
339}
340#endif
341
343
344#endif // QDNSLOOKUP_H
\inmodule QtCore
Definition qbytearray.h:57
The QDnsDomainNameRecord class stores information about a domain name record.
Definition qdnslookup.h:31
void swap(QDnsDomainNameRecord &other) noexcept
Swaps this domain-name record instance with other.
Definition qdnslookup.h:39
QDnsDomainNameRecord & operator=(QDnsDomainNameRecord &&other) noexcept
Definition qdnslookup.h:35
The QDnsHostAddressRecord class stores information about a host address record.
Definition qdnslookup.h:53
void swap(QDnsHostAddressRecord &other) noexcept
Swaps this host address record instance with other.
Definition qdnslookup.h:61
QDnsHostAddressRecord & operator=(QDnsHostAddressRecord &&other) noexcept
Definition qdnslookup.h:57
void finished(const QDnsLookupReply &reply)
The QDnsLookup class represents a DNS lookup.
Definition qdnslookup.h:217
Type
Indicates the type of DNS lookup that was performed.
Definition qdnslookup.h:247
QHostAddress nameserver
the nameserver to use for DNS lookup.
Definition qdnslookup.h:225
void nameserverProtocolChanged(Protocol protocol)
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:233
@ InvalidReplyError
Definition qdnslookup.h:238
@ OperationCancelledError
Definition qdnslookup.h:236
@ ServerRefusedError
Definition qdnslookup.h:240
@ ServerFailureError
Definition qdnslookup.h:239
@ InvalidRequestError
Definition qdnslookup.h:237
void finished()
This signal is emitted when the reply has finished processing.
Protocol
Indicates the type of DNS server that is being queried.
Definition qdnslookup.h:261
void setNameserver(const QHostAddress &nameserver)
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:75
void swap(QDnsMailExchangeRecord &other) noexcept
Swaps this mail exchange record with other.
Definition qdnslookup.h:83
QDnsMailExchangeRecord & operator=(QDnsMailExchangeRecord &&other) noexcept
Definition qdnslookup.h:79
The QDnsServiceRecord class stores information about a DNS SRV record.
Definition qdnslookup.h:98
void swap(QDnsServiceRecord &other) noexcept
Swaps this service record instance with other.
Definition qdnslookup.h:106
QDnsServiceRecord & operator=(QDnsServiceRecord &&other) noexcept
Definition qdnslookup.h:102
The QDnsTextRecord class stores information about a DNS TXT record.
Definition qdnslookup.h:123
void swap(QDnsTextRecord &other) noexcept
Swaps this text record instance with other.
Definition qdnslookup.h:131
QDnsTextRecord & operator=(QDnsTextRecord &&other) noexcept
Definition qdnslookup.h:127
The QDnsTlsAssociationRecord class stores information about a DNS TLSA record.
Definition qdnslookup.h:145
QDnsTlsAssociationRecord & operator=(QDnsTlsAssociationRecord &&other) noexcept
Definition qdnslookup.h:196
QDnsTlsAssociationRecord & operator=(const QDnsTlsAssociationRecord &other)
Moves the content of other into this object.
void swap(QDnsTlsAssociationRecord &other) noexcept
Definition qdnslookup.h:200
CertificateUsage
This enumeration contains valid values for the certificate usage field of TLS Association queries.
Definition qdnslookup.h:148
Selector
This enumeration contains valid values for the selector field of TLS Association queries.
Definition qdnslookup.h:166
QDnsTlsAssociationRecord(QDnsTlsAssociationRecord &&other)
Definition qdnslookup.h:193
~QDnsTlsAssociationRecord()
Destroys this TLS Association record object.
MatchingType
This enumeration contains valid values for the matching type field of TLS Association queries.
Definition qdnslookup.h:180
QDnsTlsAssociationRecord(const QDnsTlsAssociationRecord &other)
Constructs a copy of other.
The QHostAddress class provides an IP address.
Definition qlist.h:75
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
The QSslConfiguration class holds the configuration and state of an SSL connection.
QSslConfiguration & operator=(QSslConfiguration &&other) noexcept
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
employee setName("Richard Schmit")
Combined button and popup list for selecting options.
#define Q_DECL_CONST_FUNCTION
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
DBusConnection const char DBusError * error
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
EGLOutputPortEXT port
#define NS(x)
Definition qmetatype.cpp:64
n varying highp vec2 A
GLenum GLsizei GLsizei GLint * values
[15]
GLuint GLuint GLfloat weight
GLenum type
GLenum target
GLuint name
GLsizeiptr const void GLenum usage
Definition qopenglext.h:543
#define QT_DECLARE_QSDP_SPECIALIZATION_DTOR(Class)
@ 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_GADGET
#define Q_SIGNALS
unsigned int quint32
Definition qtypes.h:50
unsigned short quint16
Definition qtypes.h:48
unsigned char quint8
Definition qtypes.h:46
QFileSelector selector
[1]
QSharedPointer< T > other(t)
[5]
this swap(other)
proxy setType(QNetworkProxy::Socks5Proxy)
sslSocket setSslConfiguration(config)
Definition moc.h:23