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.cpp
Go to the documentation of this file.
1// Copyright (C) 2012 Jeremy Lainé <jeremy.laine@m4x.org>
2// Copyright (C) 2023 Intel Corporation.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#include "qdnslookup.h"
6#include "qdnslookup_p.h"
7
9#include <qcoreapplication.h>
10#include <qdatetime.h>
11#include <qendian.h>
12#include <qloggingcategory.h>
13#include <qrandom.h>
14#include <qspan.h>
15#include <qurl.h>
16
17#if QT_CONFIG(ssl)
18# include <qsslsocket.h>
19#endif
20
21#include <algorithm>
22
24
25using namespace Qt::StringLiterals;
26
27static Q_LOGGING_CATEGORY(lcDnsLookup, "qt.network.dnslookup", QtCriticalMsg)
28
29namespace {
30struct QDnsLookupThreadPool : QThreadPool
31{
32 QDnsLookupThreadPool()
33 {
34 // Run up to 5 lookups in parallel.
35 setMaxThreadCount(5);
36 }
37};
38}
39
40Q_APPLICATION_STATIC(QDnsLookupThreadPool, theDnsLookupThreadPool);
41
43{
44 // Lower numbers are more preferred than higher ones.
45 return r1.preference() < r2.preference();
46}
47
48/*
49 Sorts a list of QDnsMailExchangeRecord objects according to RFC 5321.
50*/
51
52static void qt_qdnsmailexchangerecord_sort(QList<QDnsMailExchangeRecord> &records)
53{
54 // If we have no more than one result, we are done.
55 if (records.size() <= 1)
56 return;
57
58 // Order the records by preference.
59 std::sort(records.begin(), records.end(), qt_qdnsmailexchangerecord_less_than);
60
61 int i = 0;
62 while (i < records.size()) {
63
64 // Determine the slice of records with the current preference.
65 QList<QDnsMailExchangeRecord> slice;
66 const quint16 slicePreference = records.at(i).preference();
67 for (int j = i; j < records.size(); ++j) {
68 if (records.at(j).preference() != slicePreference)
69 break;
70 slice << records.at(j);
71 }
72
73 // Randomize the slice of records.
74 while (!slice.isEmpty()) {
75 const unsigned int pos = QRandomGenerator::global()->bounded(slice.size());
76 records[i++] = slice.takeAt(pos);
77 }
78 }
79}
80
82{
83 // Order by priority, or if the priorities are equal,
84 // put zero weight records first.
85 return r1.priority() < r2.priority()
86 || (r1.priority() == r2.priority()
87 && r1.weight() == 0 && r2.weight() > 0);
88}
89
90/*
91 Sorts a list of QDnsServiceRecord objects according to RFC 2782.
92*/
93
94static void qt_qdnsservicerecord_sort(QList<QDnsServiceRecord> &records)
95{
96 // If we have no more than one result, we are done.
97 if (records.size() <= 1)
98 return;
99
100 // Order the records by priority, and for records with an equal
101 // priority, put records with a zero weight first.
102 std::sort(records.begin(), records.end(), qt_qdnsservicerecord_less_than);
103
104 int i = 0;
105 while (i < records.size()) {
106
107 // Determine the slice of records with the current priority.
108 QList<QDnsServiceRecord> slice;
109 const quint16 slicePriority = records.at(i).priority();
110 unsigned int sliceWeight = 0;
111 for (int j = i; j < records.size(); ++j) {
112 if (records.at(j).priority() != slicePriority)
113 break;
114 sliceWeight += records.at(j).weight();
115 slice << records.at(j);
116 }
117#ifdef QDNSLOOKUP_DEBUG
118 qDebug("qt_qdnsservicerecord_sort() : priority %i (size: %i, total weight: %i)",
119 slicePriority, slice.size(), sliceWeight);
120#endif
121
122 // Order the slice of records.
123 while (!slice.isEmpty()) {
124 const unsigned int weightThreshold = QRandomGenerator::global()->bounded(sliceWeight + 1);
125 unsigned int summedWeight = 0;
126 for (int j = 0; j < slice.size(); ++j) {
127 summedWeight += slice.at(j).weight();
128 if (summedWeight >= weightThreshold) {
129#ifdef QDNSLOOKUP_DEBUG
130 qDebug("qt_qdnsservicerecord_sort() : adding %s %i (weight: %i)",
131 qPrintable(slice.at(j).target()), slice.at(j).port(),
132 slice.at(j).weight());
133#endif
134 // Adjust the slice weight and take the current record.
135 sliceWeight -= slice.at(j).weight();
136 records[i++] = slice.takeAt(j);
137 break;
138 }
139 }
140 }
141 }
142}
143
289{
290#if QT_CONFIG(libresolv) || defined(Q_OS_WIN)
291 switch (protocol) {
293 return true;
295# if QT_CONFIG(ssl)
297 return true;
298# endif
299 return false;
300 }
301#else
302 Q_UNUSED(protocol)
303#endif
304 return false;
305}
306
315{
316 switch (protocol) {
318 return DnsPort;
320 return DnsOverTlsPort;
321 }
322 return 0; // will probably fail somewhere
323}
324
352 : QObject(*new QDnsLookupPrivate, parent)
353{
354}
355
362 : QObject(*new QDnsLookupPrivate, parent)
363{
364 Q_D(QDnsLookup);
365 d->name = name;
366 d->type = type;
367}
368
378QDnsLookup::QDnsLookup(Type type, const QString &name, const QHostAddress &nameserver, QObject *parent)
379 : QDnsLookup(type, name, nameserver, 0, parent)
380{
381}
382
392
398
400 : QObject(*new QDnsLookupPrivate, parent)
401{
402 Q_D(QDnsLookup);
403 d->name = name;
404 d->type = type;
405 d->port = port;
406 d->nameserver = nameserver;
407}
408
422 const QHostAddress &nameserver, quint16 port, QObject *parent)
423 : QObject(*new QDnsLookupPrivate, parent)
424{
425 Q_D(QDnsLookup);
426 d->name = name;
427 d->type = type;
428 d->nameserver = nameserver;
429 d->port = port;
430 d->protocol = protocol;
431}
432
443
462{
463 return d_func()->reply.authenticData;
464}
465
472{
473 return d_func()->reply.error;
474}
475
482{
483 return d_func()->reply.errorString;
484}
485
491{
492 return d_func()->isFinished;
493}
494
508{
509 return d_func()->name;
510}
511
513{
514 Q_D(QDnsLookup);
515 d->name = name;
516}
517
518QBindable<QString> QDnsLookup::bindableName()
519{
520 Q_D(QDnsLookup);
521 return &d->name;
522}
523
530{
531 return d_func()->type;
532}
533
535{
536 Q_D(QDnsLookup);
537 d->type = type;
538}
539
540QBindable<QDnsLookup::Type> QDnsLookup::bindableType()
541{
542 Q_D(QDnsLookup);
543 return &d->type;
544}
545
552{
553 return d_func()->nameserver;
554}
555
557{
558 Q_D(QDnsLookup);
559 d->nameserver = nameserver;
560}
561
562QBindable<QHostAddress> QDnsLookup::bindableNameserver()
563{
564 Q_D(QDnsLookup);
565 return &d->nameserver;
566}
567
580{
581 return d_func()->port;
582}
583
585{
586 Q_D(QDnsLookup);
587 d->port = nameserverPort;
588}
589
591{
592 Q_D(QDnsLookup);
593 return &d->port;
594}
595
604{
605 return d_func()->protocol;
606}
607
609{
610 d_func()->protocol = protocol;
611}
612
613QBindable<QDnsLookup::Protocol> QDnsLookup::bindableNameserverProtocol()
614{
615 return &d_func()->protocol;
616}
617
637
642QList<QDnsDomainNameRecord> QDnsLookup::canonicalNameRecords() const
643{
644 return d_func()->reply.canonicalNameRecords;
645}
646
651QList<QDnsHostAddressRecord> QDnsLookup::hostAddressRecords() const
652{
653 return d_func()->reply.hostAddressRecords;
654}
655
664QList<QDnsMailExchangeRecord> QDnsLookup::mailExchangeRecords() const
665{
666 return d_func()->reply.mailExchangeRecords;
667}
668
673QList<QDnsDomainNameRecord> QDnsLookup::nameServerRecords() const
674{
675 return d_func()->reply.nameServerRecords;
676}
677
682QList<QDnsDomainNameRecord> QDnsLookup::pointerRecords() const
683{
684 return d_func()->reply.pointerRecords;
685}
686
695QList<QDnsServiceRecord> QDnsLookup::serviceRecords() const
696{
697 return d_func()->reply.serviceRecords;
698}
699
704QList<QDnsTextRecord> QDnsLookup::textRecords() const
705{
706 return d_func()->reply.textRecords;
707}
708
719QList<QDnsTlsAssociationRecord> QDnsLookup::tlsAssociationRecords() const
720{
721 return d_func()->reply.tlsAssociationRecords;
722}
723
724#if QT_CONFIG(ssl)
731void QDnsLookup::setSslConfiguration(const QSslConfiguration &sslConfiguration)
732{
733 Q_D(QDnsLookup);
734 d->sslConfiguration.emplace(sslConfiguration);
735}
736
742QSslConfiguration QDnsLookup::sslConfiguration() const
743{
744 const Q_D(QDnsLookup);
745 return d->sslConfiguration.value_or(QSslConfiguration::defaultConfiguration());
746}
747#endif
748
756{
757 Q_D(QDnsLookup);
758 if (d->runnable) {
759 d->runnable = nullptr;
760 d->reply = QDnsLookupReply();
762 d->reply.errorString = tr("Operation cancelled");
763 d->isFinished = true;
764 emit finished();
765 }
766}
767
775{
776 Q_D(QDnsLookup);
777 d->isFinished = false;
778 d->reply = QDnsLookupReply();
780 // NOT qCWarning because this isn't a result of the lookup
781 qWarning("QDnsLookup requires a QCoreApplication");
782 return;
783 }
784
785 auto l = [this](const QDnsLookupReply &reply) {
786 Q_D(QDnsLookup);
787 if (d->runnable == sender()) {
788#ifdef QDNSLOOKUP_DEBUG
789 qDebug("DNS reply for %s: %i (%s)", qPrintable(d->name), reply.error, qPrintable(reply.errorString));
790#endif
791#if QT_CONFIG(ssl)
792 d->sslConfiguration = std::move(reply.sslConfiguration);
793#endif
794 d->reply = reply;
795 d->runnable = nullptr;
796 d->isFinished = true;
797 emit finished();
798 }
799 };
800
801 d->runnable = new QDnsLookupRunnable(d);
802 connect(d->runnable, &QDnsLookupRunnable::finished, this, l,
804 theDnsLookupThreadPool->start(d->runnable);
805}
806
830
839
847
853{
854 return d->name;
855}
856
862{
863 return d->timeToLive;
864}
865
871{
872 return d->value;
873}
874
915
924
932
938{
939 return d->name;
940}
941
947{
948 return d->timeToLive;
949}
950
956{
957 return d->value;
958}
959
1002
1011
1019
1025{
1026 return d->exchange;
1027}
1028
1034{
1035 return d->name;
1036}
1037
1043{
1044 return d->preference;
1045}
1046
1052{
1053 return d->timeToLive;
1054}
1055
1098
1107
1115
1121{
1122 return d->name;
1123}
1124
1130{
1131 return d->port;
1132}
1133
1142{
1143 return d->priority;
1144}
1145
1151{
1152 return d->target;
1153}
1154
1160{
1161 return d->timeToLive;
1162}
1163
1173{
1174 return d->weight;
1175}
1176
1183{
1184 d = other.d;
1185 return *this;
1186}
1219
1228
1236
1242{
1243 return d->name;
1244}
1245
1251{
1252 return d->timeToLive;
1253}
1254
1259QList<QByteArray> QDnsTextRecord::values() const
1260{
1261 return d->values;
1262}
1263
1270{
1271 d = other.d;
1272 return *this;
1273}
1299
1300
1428
1433
1439
1444
1449{
1450 return d->name;
1451}
1452
1457{
1458 return d->timeToLive;
1459}
1460
1468
1476
1484
1494{
1495 return d->value;
1496}
1497
1499{
1501 if (label.isEmpty())
1502 return QDnsLookupRunnable::EncodedLabel(1, rootDomain);
1503
1505#ifdef Q_OS_WIN
1506 return encodedLabel;
1507#else
1508 return std::move(encodedLabel).toLatin1();
1509#endif
1510}
1511
1513 : requestName(encodeLabel(d->name)),
1514 nameserver(d->nameserver),
1515 requestType(d->type),
1516 port(d->port),
1517 protocol(d->protocol)
1518{
1519 if (port == 0)
1521#if QT_CONFIG(ssl)
1522 sslConfiguration = d->sslConfiguration;
1523#endif
1524}
1525
1527{
1529
1530 // Validate input.
1531 if (qsizetype n = requestName.size(); n > MaxDomainNameLength || n == 0) {
1533 reply.errorString = QDnsLookup::tr("Invalid domain name");
1534 } else {
1535 // Perform request.
1536 query(&reply);
1537
1538 // Sort results.
1539 qt_qdnsmailexchangerecord_sort(reply.mailExchangeRecords);
1540 qt_qdnsservicerecord_sort(reply.serviceRecords);
1541 }
1542
1544
1545 // maybe print the lookup error as warning
1546 switch (reply.error) {
1553 break; // no warning for these
1554
1558 qCWarning(lcDnsLookup()).nospace()
1559 << "DNS lookup failed (" << reply.error << "): "
1561 << "; request was " << this; // continues below
1562 }
1563}
1564
1566{
1567 // continued: print the information about the request
1568 d << r->requestName.left(MaxDomainNameLength);
1569 if (r->requestName.size() > MaxDomainNameLength)
1570 d << "... (truncated)";
1571 d << " type " << r->requestType;
1572 if (!r->nameserver.isNull()) {
1573 d << " to nameserver " << qUtf16Printable(r->nameserver.toString())
1574 << " port " << (r->port ? r->port : QDnsLookup::defaultPortForProtocol(r->protocol));
1575 switch (r->protocol) {
1577 break;
1579 d << " (TLS)";
1580 }
1581 }
1582 return d;
1583}
1584
1585#if QT_CONFIG(ssl)
1586static constexpr std::chrono::milliseconds DnsOverTlsConnectTimeout(15'000);
1587static constexpr std::chrono::milliseconds DnsOverTlsTimeout(120'000);
1588static constexpr quint8 DnsAuthenticDataBit = 0x20;
1589
1590static int makeReplyErrorFromSocket(QDnsLookupReply *reply, const QAbstractSocket *socket)
1591{
1592 QDnsLookup::Error error = [&] {
1593 switch (socket->error()) {
1597 default:
1599 }
1600 }();
1602 return false;
1603}
1604
1606 ReplyBuffer &response)
1607{
1609 socket.setSslConfiguration(sslConfiguration.value_or(QSslConfiguration::defaultConfiguration()));
1610
1611# if QT_CONFIG(networkproxy)
1612 socket.setProtocolTag("domain-s"_L1);
1613# endif
1614
1615 // Request the name server attempt to authenticate the reply.
1616 query[3] |= DnsAuthenticDataBit;
1617
1618 do {
1619 quint16 size = qToBigEndian<quint16>(query.size());
1620 QDeadlineTimer timeout(DnsOverTlsTimeout);
1621
1622 socket.connectToHostEncrypted(nameserver.toString(), port);
1623 socket.write(reinterpret_cast<const char *>(&size), sizeof(size));
1624 socket.write(reinterpret_cast<const char *>(query.data()), query.size());
1625 if (!socket.waitForEncrypted(DnsOverTlsConnectTimeout.count()))
1626 break;
1627
1628 reply->sslConfiguration = socket.sslConfiguration();
1629
1630 // accumulate reply
1631 auto waitForBytes = [&](void *buffer, int count) {
1632 int remaining = timeout.remainingTime();
1633 while (remaining >= 0 && socket.bytesAvailable() < count) {
1634 if (!socket.waitForReadyRead(remaining))
1635 return false;
1636 }
1637 return socket.read(static_cast<char *>(buffer), count) == count;
1638 };
1639 if (!waitForBytes(&size, sizeof(size)))
1640 break;
1641
1642 // note: strictly speaking, we're allocating memory based on untrusted data
1643 // but in practice, due to limited range of the data type (16 bits),
1644 // the maximum allocation is small.
1646 response.resize(size);
1647 if (waitForBytes(response.data(), size)) {
1648 // check if the AD bit is set; we'll trust it over TLS requests
1649 if (size >= 4)
1650 reply->authenticData = response[3] & DnsAuthenticDataBit;
1651 return true;
1652 }
1653 } while (false);
1654
1655 // handle errors
1656 return makeReplyErrorFromSocket(reply, &socket);
1657}
1658#else
1660 ReplyBuffer &response)
1661{
1663 Q_UNUSED(response)
1664 reply->setError(QDnsLookup::ResolverError, QDnsLookup::tr("SSL/TLS support not present"));
1665 return false;
1666}
1667#endif
1668
1670
1671#include "moc_qdnslookup.cpp"
1672#include "moc_qdnslookup_p.cpp"
The QAbstractSocket class provides the base functionality common to all socket types.
bool waitForReadyRead(int msecs=30000) override
This function blocks until new data is available for reading and the \l{QIODevice::}{readyRead()} sig...
qint64 bytesAvailable() const override
Returns the number of incoming bytes that are waiting to be read.
void setProtocolTag(const QString &tag)
SocketError error() const
Returns the type of error that last occurred.
\inmodule QtCore
Definition qbytearray.h:57
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
Definition qbytearray.h:494
char value_type
Definition qbytearray.h:465
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
\inmodule QtCore
\inmodule QtCore
The QDnsDomainNameRecord class stores information about a domain name record.
Definition qdnslookup.h:31
QString name() const
Returns the name for this record.
QString value() const
Returns the value for this domain name record.
QDnsDomainNameRecord & operator=(QDnsDomainNameRecord &&other) noexcept
Definition qdnslookup.h:35
QDnsDomainNameRecord()
Constructs an empty domain name record object.
quint32 timeToLive() const
Returns the duration in seconds for which this record is valid.
~QDnsDomainNameRecord()
Destroys a domain name record.
The QDnsHostAddressRecord class stores information about a host address record.
Definition qdnslookup.h:53
QHostAddress value() const
Returns the value for this host address record.
~QDnsHostAddressRecord()
Destroys a host address record.
QDnsHostAddressRecord()
Constructs an empty host address record object.
quint32 timeToLive() const
Returns the duration in seconds for which this record is valid.
QDnsHostAddressRecord & operator=(QDnsHostAddressRecord &&other) noexcept
Definition qdnslookup.h:57
QString name() const
Returns the name for this record.
void finished(const QDnsLookupReply &reply)
QDnsLookupRunnable(const QDnsLookupPrivate *d)
void run() override
Implement this pure virtual function in your subclass.
QByteArray EncodedLabel
bool sendDnsOverTls(QDnsLookupReply *reply, QSpan< unsigned char > query, ReplyBuffer &response)
The QDnsLookup class represents a DNS lookup.
Definition qdnslookup.h:217
quint16 nameserverPort
the port number of nameserver to use for DNS lookup.
Definition qdnslookup.h:227
Protocol nameserverProtocol
the protocol to use when sending the DNS query
Definition qdnslookup.h:229
Type
Indicates the type of DNS lookup that was performed.
Definition qdnslookup.h:247
QBindable< QString > bindableName()
QString errorString
a human-readable description of the error if the DNS lookup failed.
Definition qdnslookup.h:221
static quint16 defaultPortForProtocol(Protocol protocol) noexcept Q_DECL_CONST_FUNCTION
QHostAddress nameserver
the nameserver to use for DNS lookup.
Definition qdnslookup.h:225
QList< QDnsServiceRecord > serviceRecords() const
Returns the list of service records associated with this lookup.
bool isFinished() const
Returns whether the reply has finished or was aborted.
QList< QDnsMailExchangeRecord > mailExchangeRecords() const
Returns the list of mail exchange records associated with this lookup.
QBindable< Protocol > bindableNameserverProtocol()
void setName(const QString &name)
QList< QDnsDomainNameRecord > nameServerRecords() const
Returns the list of name server records associated with this lookup.
QList< QDnsTlsAssociationRecord > tlsAssociationRecords() const
void setNameserverProtocol(Protocol protocol)
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 abort()
Aborts the DNS lookup operation.
bool isAuthenticData() const
QBindable< quint16 > bindableNameserverPort()
void finished()
This signal is emitted when the reply has finished processing.
Error error
the type of error that occurred if the DNS lookup failed, or NoError.
Definition qdnslookup.h:219
void setType(QDnsLookup::Type)
static bool isProtocolSupported(Protocol protocol)
Protocol
Indicates the type of DNS server that is being queried.
Definition qdnslookup.h:261
QDnsLookup(QObject *parent=nullptr)
Constructs a QDnsLookup object and sets parent as the parent object.
QList< QDnsDomainNameRecord > canonicalNameRecords() const
Returns the list of canonical name records associated with this lookup.
void lookup()
Performs the DNS lookup.
void setNameserver(const QHostAddress &nameserver)
~QDnsLookup()
Destroys the QDnsLookup object.
QBindable< QHostAddress > bindableNameserver()
QList< QDnsDomainNameRecord > pointerRecords() const
Returns the list of pointer records associated with this lookup.
QBindable< Type > bindableType()
void setNameserverPort(quint16 port)
QList< QDnsHostAddressRecord > hostAddressRecords() const
Returns the list of host address records associated with this lookup.
Type type
the type of DNS lookup.
Definition qdnslookup.h:223
QString name
the name to lookup.
Definition qdnslookup.h:222
QList< QDnsTextRecord > textRecords() const
Returns the list of text records associated with this lookup.
The QDnsMailExchangeRecord class stores information about a DNS MX record.
Definition qdnslookup.h:75
~QDnsMailExchangeRecord()
Destroys a mail exchange record.
quint16 preference() const
Returns the preference for this record.
quint32 timeToLive() const
Returns the duration in seconds for which this record is valid.
QString name() const
Returns the name for this record.
QDnsMailExchangeRecord()
Constructs an empty mail exchange record object.
QDnsMailExchangeRecord & operator=(QDnsMailExchangeRecord &&other) noexcept
Definition qdnslookup.h:79
QString exchange() const
Returns the domain name of the mail exchange for this record.
The QDnsServiceRecord class stores information about a DNS SRV record.
Definition qdnslookup.h:98
QString target() const
Returns the domain name of the target host for this service record.
QDnsServiceRecord & operator=(QDnsServiceRecord &&other) noexcept
Definition qdnslookup.h:102
quint16 weight() const
Returns the weight for this service record.
quint32 timeToLive() const
Returns the duration in seconds for which this record is valid.
~QDnsServiceRecord()
Destroys a service record.
quint16 priority() const
Returns the priority for this service record.
QString name() const
Returns the name for this record.
quint16 port() const
Returns the port on the target host for this service record.
QDnsServiceRecord()
Constructs an empty service record object.
QList< QByteArray > values
The QDnsTextRecord class stores information about a DNS TXT record.
Definition qdnslookup.h:123
quint32 timeToLive() const
Returns the duration in seconds for which this record is valid.
QDnsTextRecord & operator=(QDnsTextRecord &&other) noexcept
Definition qdnslookup.h:127
QDnsTextRecord()
Constructs an empty text record object.
~QDnsTextRecord()
Destroys a text record.
QList< QByteArray > values() const
Returns the values for this text record.
QString name() const
Returns the name for this text record.
QDnsTlsAssociationRecord::CertificateUsage usage
QDnsTlsAssociationRecord::MatchingType matchType
QDnsTlsAssociationRecord::Selector selector
The QDnsTlsAssociationRecord class stores information about a DNS TLSA record.
Definition qdnslookup.h:145
QDnsTlsAssociationRecord & operator=(QDnsTlsAssociationRecord &&other) noexcept
Definition qdnslookup.h:196
QDnsTlsAssociationRecord()
Constructs an empty TLS Association record.
Selector selector() const
Returns the selector field for this record.
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
quint32 timeToLive() const
Returns the duration in seconds for which this record is valid.
MatchingType matchType() const
Returns the match type field for this record.
QByteArray value() const
Returns the binary data field for this record.
QString name() const
Returns the name of this record.
~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
CertificateUsage usage() const
Returns the certificate usage field for this record.
The QHostAddress class provides an IP address.
QString toString() const
Returns the address as a string.
NetworkLayerProtocol protocol() const
Returns the network layer protocol of the host address.
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
QString errorString() const
Returns a human-readable description of the last device error that occurred.
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read.
void setError(NetworkError errorCode, const QString &errorString)
Sets the error condition to be errorCode.
bool isFinished() const
NetworkError error() const
Returns the error that was found during the processing of this request.
\inmodule QtCore
Definition qobject.h:103
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
Definition qobject.cpp:2658
static Q_DECL_CONST_FUNCTION QRandomGenerator * global()
\threadsafe
Definition qrandom.h:275
The QSslConfiguration class holds the configuration and state of an SSL connection.
static QSslConfiguration defaultConfiguration()
Returns the default SSL configuration to be used in new SSL connections.
The QSslSocket class provides an SSL encrypted socket for both clients and servers.
Definition qsslsocket.h:29
static bool supportsSsl()
Returns true if this platform supports SSL; otherwise, returns false.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qthreadpool.h:22
void resize(qsizetype sz)
T * data() noexcept
Combined button and popup list for selecting options.
Q_CORE_EXPORT void beginPropertyUpdateGroup()
@ BlockingQueuedConnection
Q_CORE_EXPORT void endPropertyUpdateGroup()
#define Q_APPLICATION_STATIC(TYPE, NAME,...)
DBusConnection const char DBusError * error
static void qt_qdnsmailexchangerecord_sort(QList< QDnsMailExchangeRecord > &records)
static void qt_qdnsservicerecord_sort(QList< QDnsServiceRecord > &records)
QDebug operator<<(QDebug &d, QDnsLookupRunnable *r)
static bool qt_qdnsmailexchangerecord_less_than(const QDnsMailExchangeRecord &r1, const QDnsMailExchangeRecord &r2)
static bool qt_qdnsservicerecord_less_than(const QDnsServiceRecord &r1, const QDnsServiceRecord &r2)
static QDnsLookupRunnable::EncodedLabel encodeLabel(const QString &label)
constexpr quint16 DnsPort
constexpr quint16 DnsOverTlsPort
QT_BEGIN_NAMESPACE constexpr qsizetype MaxDomainNameLength
EGLOutputPortEXT port
constexpr T qFromBigEndian(T source)
Definition qendian.h:174
#define qDebug
[1]
Definition qlogging.h:164
@ QtCriticalMsg
Definition qlogging.h:32
#define qWarning
Definition qlogging.h:166
#define Q_LOGGING_CATEGORY(name,...)
#define qCWarning(category,...)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLboolean r
[2]
GLenum GLenum GLsizei count
GLbitfield GLuint64 timeout
[4]
GLenum GLuint buffer
GLenum type
GLuint GLsizei const GLchar * label
[43]
GLuint name
GLfloat n
GLenum query
#define QT_DEFINE_QSDP_SPECIALIZATION_DTOR(Class)
#define qPrintable(string)
Definition qstring.h:1531
#define qUtf16Printable(string)
Definition qstring.h:1543
#define tr(X)
#define emit
#define Q_UNUSED(x)
unsigned int quint32
Definition qtypes.h:50
unsigned short quint16
Definition qtypes.h:48
ptrdiff_t qsizetype
Definition qtypes.h:165
unsigned char quint8
Definition qtypes.h:46
@ ForbidLeadingDot
Definition qurl_p.h:30
QString Q_CORE_EXPORT qt_ACE_do(const QString &domain, AceOperation op, AceLeadingDot dot, QUrl::AceProcessingOptions options={})
Definition qurlidna.cpp:920
@ ToAceOnly
Definition qurl_p.h:31
QTcpSocket * socket
[1]
QRect r1(100, 200, 11, 16)
[0]
QRect r2(QPoint(100, 200), QSize(11, 16))
QSharedPointer< T > other(t)
[5]
QNetworkReply * reply
Definition moc.h:23