Logo Search packages:      
Sourcecode: qt4-x11 version File versions

Q3Dns Class Reference

#include <q3dns.h>

Inheritance diagram for Q3Dns:


List of all members.

Detailed Description

The Q3Dns class provides asynchronous DNS lookups.

Both Windows and Unix provide synchronous DNS lookups; Windows provides some asynchronous support too. At the time of writing neither operating system provides asynchronous support for anything other than hostname-to-address mapping.

Q3Dns rectifies this shortcoming, by providing asynchronous caching lookups for the record types that we expect modern GUI applications to need in the near future.

The class is not straightforward to use (although it is much simpler than the native APIs); Q3Socket provides much easier to use TCP connection facilities. The aim of Q3Dns is to provide a correct and small API to the DNS and nothing more. (We use "correctness" to mean that the DNS information is correctly cached, and correctly timed out.)

The API comprises a constructor, functions to set the DNS node (the domain in DNS terminology) and record type (setLabel() and setRecordType()), the corresponding get functions, an isWorking() function to determine whether Q3Dns is working or reading, a resultsReady() signal and query functions for the result.

There is one query function for each RecordType, namely addresses(), mailServers(), servers(), hostNames() and texts(). There are also two generic query functions: canonicalName() returns the name you'll presumably end up using (the exact meaning of this depends on the record type) and qualifiedNames() returns a list of the fully qualified names label() maps to.

See also:

Definition at line 43 of file q3dns.h.

Public Types

enum  RecordType {
  None, A, Aaaa, Mx,
  Srv, Cname, Ptr, Txt

Public Slots

void deleteLater ()


void destroyed (QObject *=0)
void resultsReady ()

Public Member Functions

Q3ValueList< QHostAddressaddresses () const
bool blockSignals (bool b)
QString canonicalName () const
const QObjectListchildren () const
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
bool disconnect (const QObject *receiver, const char *member=0)
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
void dumpObjectInfo ()
void dumpObjectTree ()
QList< QByteArraydynamicPropertyNames () const
virtual bool event (QEvent *)
virtual bool eventFilter (QObject *, QEvent *)
template<typename T>
findChild (const QString &name=QString()) const
template<typename T>
QList< T > findChildren (const QRegExp &re) const
template<typename T>
QList< T > findChildren (const QString &name=QString()) const
QStringList hostNames () const
bool inherits (const char *classname) const
void installEventFilter (QObject *)
bool isWidgetType () const
bool isWorking () const
void killTimer (int id)
QString label () const
Q3ValueList< MailServermailServers () const
void moveToThread (QThread *thread)
QString objectName () const
QObjectparent () const
QVariant property (const char *name) const
 Q3Dns (const QHostAddress &address, RecordType rr=Ptr)
 Q3Dns (const QString &label, RecordType rr=A)
 Q3Dns ()
QStringList qualifiedNames () const
RecordType recordType () const
void removeEventFilter (QObject *)
Q3ValueList< Serverservers () const
virtual void setLabel (const QHostAddress &address)
virtual void setLabel (const QString &label)
void setObjectName (const QString &name)
void setParent (QObject *)
bool setProperty (const char *name, const QVariant &value)
virtual void setRecordType (RecordType rr=A)
void setUserData (uint id, QObjectUserData *data)
bool signalsBlocked () const
int startTimer (int interval)
QStringList texts () const
QThreadthread () const
QObjectUserData * userData (uint id) const
virtual ~Q3Dns ()

Static Public Member Functions

static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
static uint registerUserData ()

Protected Member Functions

virtual void childEvent (QChildEvent *)
virtual void connectNotify (const char *signal)
virtual void customEvent (QEvent *)
virtual void disconnectNotify (const char *signal)
int receivers (const char *signal) const
QObjectsender () const
virtual void timerEvent (QTimerEvent *)

Protected Attributes

QObjectData * d_ptr

Static Protected Attributes

static const QMetaObject staticQtMetaObject


QString objectName
 the name of this object

Private Slots

void startQuery ()

Private Member Functions

void setStartQueryTimer ()

Static Private Member Functions

static void doResInit ()
static QString toInAddrArpaDomain (const QHostAddress &address)

Private Attributes

Q3DnsPrivate * d
QString l
QStringList n
RecordType t


class Q3DnsAnswer
class Q3DnsManager
class QApplication
class QApplicationPrivate
class QCoreApplication
class QCoreApplicationPrivate
struct QMetaObject
class QThreadData
class QWidget

Related Functions

(Note that these are not member functions.)

qFindChild (const QObject *obj, const QString &name=QString(), T dummy=0)
qFindChild (const QObject *obj, const QString &name)
QList< T > qFindChildren (const QObject *obj, const QString &name=QString(), T dummy=0)
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
QList< T > qFindChildren (const QObject *obj, const QString &name)
T * qobject_cast (QObject *object)
void * qt_find_obj_child (QObject *parent, const char *type, const QString &name)


class  MailServer
 The Q3Dns::MailServer class is described in Q3Dns::mailServers(). More...
class  Server
 The Q3Dns::Server class is described in Q3Dns::servers(). More...

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index