File indexing completed on 2024-06-16 03:57:07

0001 /*
0002  * ndns.h - native DNS resolution
0003  * Copyright (C) 2001, 2002  Justin Karneges
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Lesser General Public
0007  * License as published by the Free Software Foundation; either
0008  * either version 2
0009    of the License, or (at your option) any later version.1 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Lesser General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Lesser General Public
0017  * License along with this library; if not, write to the Free Software
0018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
0019  *
0020  */
0021 
0022 #ifndef CS_NDNS_H
0023 #define CS_NDNS_H
0024 
0025 #include <QtCore>
0026 #include <QtNetwork>
0027 #include "netnames.h"
0028 
0029 // CS_NAMESPACE_BEGIN
0030 
0031 class NDns : public QObject
0032 {
0033     Q_OBJECT
0034 public:
0035     NDns(QObject *parent=0);
0036     ~NDns() override;
0037 
0038     void resolve(const QString &);
0039     void stop();
0040     bool isBusy() const;
0041 
0042     QHostAddress result() const;
0043     QString resultString() const;
0044 
0045 signals:
0046     void resultsReady();
0047 
0048 private slots:
0049     void dns_resultsReady(const QList<XMPP::NameRecord> &);
0050     void dns_error(XMPP::NameResolver::Error);
0051 
0052 private:
0053     XMPP::NameResolver dns;
0054     bool busy;
0055     QHostAddress addr;
0056 };
0057 
0058 // CS_NAMESPACE_END
0059 
0060 #endif