summaryrefslogtreecommitdiffstats
path: root/examples/network/dnslookup/dnslookup.h
blob: 6f692537f9179019076f7ca67f269ca5f6f18e43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (C) 2016 Jeremy Lainé <jeremy.laine@m4x.org>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#include <QDnsLookup>
#include <QHostAddress>

//! [0]

struct DnsQuery
{
    DnsQuery() : type(QDnsLookup::A) {}

    QDnsLookup::Type type;
    QHostAddress nameServer;
    QString name;
};

//! [0]

class DnsManager : public QObject
{
    Q_OBJECT

public:
    DnsManager();
    void setQuery(const DnsQuery &q) { query = q; }

public slots:
    void execute();
    void showResults();

private:
    QDnsLookup *dns;
    DnsQuery query;
};