1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the Qt 3 compatibility classes of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
33
#include "QtCore/qobject.h"
34
#include "QtNetwork/qhostaddress.h"
35
#include "QtCore/qsocketnotifier.h"
36
#include "QtCore/qstringlist.h"
37
#include "Qt3Support/q3valuelist.h"
42
//#define Q_DNS_SYNCHRONOUS
46
class Q_COMPAT_EXPORT Q3Dns: public QObject {
59
Q3Dns( const QString & label, RecordType rr = A );
60
Q3Dns( const QHostAddress & address, RecordType rr = Ptr );
63
// to set/change the query
64
virtual void setLabel( const QString & label );
65
virtual void setLabel( const QHostAddress & address );
66
QString label() const { return l; }
68
virtual void setRecordType( RecordType rr = A );
69
RecordType recordType() const { return t; }
71
// whether something is happening behind the scenes
72
bool isWorking() const;
74
// to query for replies
75
Q3ValueList<QHostAddress> addresses() const;
77
class Q_COMPAT_EXPORT MailServer {
79
MailServer( const QString & n=QString(), Q_UINT16 p=0 )
80
:name(n), priority(p) {}
83
Q_DUMMY_COMPARISON_OPERATOR(MailServer)
85
Q3ValueList<MailServer> mailServers() const;
87
class Q_COMPAT_EXPORT Server {
89
Server(const QString & n=QString(), Q_UINT16 p=0, Q_UINT16 w=0, Q_UINT16 po=0 )
90
: name(n), priority(p), weight(w), port(po) {}
95
Q_DUMMY_COMPARISON_OPERATOR(Server)
97
Q3ValueList<Server> servers() const;
99
QStringList hostNames() const;
101
QStringList texts() const;
103
QString canonicalName() const; // ### real-world but uncommon: QStringList
105
QStringList qualifiedNames() const { return n; }
107
#if defined(Q_DNS_SYNCHRONOUS)
109
void connectNotify( const char *signal );
119
static void doResInit();
120
void setStartQueryTimer();
121
static QString toInAddrArpaDomain( const QHostAddress &address );
122
#if defined(Q_DNS_SYNCHRONOUS)
123
void doSynchronousLookup();
131
friend class Q3DnsAnswer;
132
friend class Q3DnsManager;
136
// Q3DnsSocket are sockets that are used for DNS lookup
138
class Q3DnsSocket: public QObject {
140
// note: Private not public. This class contains NO public API.
142
Q3DnsSocket( QObject *, const char * );
143
virtual ~Q3DnsSocket();
146
virtual void cleanCache();
147
virtual void retransmit();
148
virtual void answer();