~ubuntu-branches/ubuntu/quantal/psi/quantal

« back to all changes in this revision

Viewing changes to iris/irisnet/legacy/srvresolver.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2009-09-25 17:49:51 UTC
  • mfrom: (6.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090925174951-lvm7kdap82o8xhn3
Tags: 0.13-1
* Updated to upstream version 0.13
* Set Standards-Version to 3.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * srvresolver.h - class to simplify SRV lookups
3
 
 * Copyright (C) 2003  Justin Karneges
4
 
 *
5
 
 * This library is free software; you can redistribute it and/or
6
 
 * modify it under the terms of the GNU Lesser General Public
7
 
 * License as published by the Free Software Foundation; either
8
 
 * version 2.1 of the License, or (at your option) any later version.
9
 
 *
10
 
 * This library is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
 * Lesser General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU Lesser General Public
16
 
 * License along with this library; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 
 *
19
 
 */
20
 
 
21
 
#ifndef CS_SRVRESOLVER_H
22
 
#define CS_SRVRESOLVER_H
23
 
 
24
 
#include <QtCore>
25
 
#include <QtNetwork>
26
 
#include "netnames.h"
27
 
 
28
 
// CS_NAMESPACE_BEGIN
29
 
 
30
 
class INQ3Dns
31
 
{
32
 
public:
33
 
        class Server
34
 
        {
35
 
        public:
36
 
                Server(const QString &n = QString(), quint16 p = 0, quint16 w = 0, quint16 po = 0)
37
 
                :name(n), priority(p), weight(w), port(po) {}
38
 
 
39
 
                QString name;
40
 
                quint16 priority;
41
 
                quint16 weight;
42
 
                quint16 port;
43
 
        };
44
 
};
45
 
 
46
 
#define Q3Dns INQ3Dns
47
 
 
48
 
 
49
 
class SrvResolver : public QObject
50
 
{
51
 
        Q_OBJECT
52
 
public:
53
 
        SrvResolver(QObject *parent=0);
54
 
        ~SrvResolver();
55
 
 
56
 
        void resolve(const QString &server, const QString &type, const QString &proto);
57
 
        void resolveSrvOnly(const QString &server, const QString &type, const QString &proto);
58
 
        void next();
59
 
        void stop();
60
 
        bool isBusy() const;
61
 
 
62
 
        QList<Q3Dns::Server> servers() const;
63
 
 
64
 
        bool failed() const;
65
 
        QHostAddress resultAddress() const;
66
 
        quint16 resultPort() const;
67
 
 
68
 
signals:
69
 
        void resultsReady();
70
 
 
71
 
private slots:
72
 
        void nndns_resultsReady(const QList<XMPP::NameRecord> &);
73
 
        void nndns_error(XMPP::NameResolver::Error);
74
 
        void ndns_done();
75
 
        void t_timeout();
76
 
 
77
 
private:
78
 
        class Private;
79
 
        Private *d;
80
 
 
81
 
        void tryNext();
82
 
        void resolve(const QString &server, const QString &type, const QString &proto, bool srvOnly);
83
 
};
84
 
 
85
 
// CS_NAMESPACE_END
86
 
 
87
 
#endif