Eneboo - Documentación para desarrolladores
src/qt/include/qdns.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qdns.h   3.3.8   edited Jan 11 14:46 $
00003 **
00004 ** Definition of QDns class.
00005 **
00006 ** Created : 991122
00007 **
00008 ** Copyright (C) 1999-2007 Trolltech ASA.  All rights reserved.
00009 **
00010 ** This file is part of the network module of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech ASA of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition licenses may use this
00022 ** file in accordance with the Qt Commercial License Agreement provided
00023 ** with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 #ifndef QDNS_H
00039 #define QDNS_H
00040 
00041 #ifndef QT_H
00042 #include "qobject.h"
00043 #include "qhostaddress.h"
00044 #include "qsocketnotifier.h"
00045 #include "qstringlist.h"
00046 #endif // QT_H
00047 
00048 #if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK )
00049 #define QM_EXPORT_DNS
00050 #else
00051 #define QM_EXPORT_DNS Q_EXPORT
00052 #endif
00053 
00054 #ifndef QT_NO_DNS
00055 
00056 //#define Q_DNS_SYNCHRONOUS
00057 
00058 class QDnsPrivate;
00059 
00060 class QM_EXPORT_DNS QDns: public QObject {
00061     Q_OBJECT
00062 public:
00063     enum RecordType {
00064         None,
00065         A, Aaaa,
00066         Mx, Srv,
00067         Cname,
00068         Ptr,
00069         Txt
00070     };
00071 
00072     QDns();
00073     QDns( const QString & label, RecordType rr = A );
00074     QDns( const QHostAddress & address, RecordType rr = Ptr );
00075     virtual ~QDns();
00076 
00077     // to set/change the query
00078     virtual void setLabel( const QString & label );
00079     virtual void setLabel( const QHostAddress & address );
00080     QString label() const { return l; }
00081 
00082     virtual void setRecordType( RecordType rr = A );
00083     RecordType recordType() const { return t; }
00084 
00085     // whether something is happening behind the scenes
00086     bool isWorking() const;
00087 
00088     // to query for replies
00089     QValueList<QHostAddress> addresses() const;
00090 
00091     class QM_EXPORT_DNS MailServer {
00092     public:
00093         MailServer( const QString & n=QString::null, Q_UINT16 p=0 )
00094             :name(n), priority(p) {}
00095         QString name;
00096         Q_UINT16 priority;
00097         Q_DUMMY_COMPARISON_OPERATOR(MailServer)
00098     };
00099     QValueList<MailServer> mailServers() const;
00100 
00101     class QM_EXPORT_DNS Server {
00102     public:
00103         Server(const QString & n=QString::null, Q_UINT16 p=0, Q_UINT16 w=0, Q_UINT16 po=0 )
00104             : name(n), priority(p), weight(w), port(po) {}
00105         QString name;
00106         Q_UINT16 priority;
00107         Q_UINT16 weight;
00108         Q_UINT16 port;
00109         Q_DUMMY_COMPARISON_OPERATOR(Server)
00110     };
00111     QValueList<Server> servers() const;
00112 
00113     QStringList hostNames() const;
00114 
00115     QStringList texts() const;
00116 
00117     QString canonicalName() const; // ### real-world but uncommon: QStringList
00118 
00119     QStringList qualifiedNames() const { return n; }
00120 
00121 #if defined(Q_DNS_SYNCHRONOUS)
00122 protected:
00123     void connectNotify( const char *signal );
00124 #endif
00125 
00126 signals:
00127     void resultsReady();
00128 
00129 private slots:
00130     void startQuery();
00131 
00132 private:
00133     static void doResInit();
00134     void setStartQueryTimer();
00135     static QString toInAddrArpaDomain( const QHostAddress &address );
00136 #if defined(Q_DNS_SYNCHRONOUS)
00137     void doSynchronousLookup();
00138 #endif
00139 
00140     QString l;
00141     QStringList n;
00142     RecordType t;
00143     QDnsPrivate * d;
00144 
00145     friend class QDnsAnswer;
00146     friend class QDnsManager;
00147 };
00148 
00149 
00150 // QDnsSocket are sockets that are used for DNS lookup
00151 
00152 class QDnsSocket: public QObject {
00153     Q_OBJECT
00154     // note: Private not public.  This class contains NO public API.
00155 protected:
00156     QDnsSocket( QObject *, const char * );
00157     virtual ~QDnsSocket();
00158 
00159 private slots:
00160     virtual void cleanCache();
00161     virtual void retransmit();
00162     virtual void answer();
00163 };
00164 
00165 #endif // QT_NO_DNS
00166 
00167 #endif // QDNS_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'