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

« back to all changes in this revision

Viewing changes to iris/irisnet/irisnetplugin.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
 
 * Copyright (C) 2006  Justin Karneges
3
 
 *
4
 
 * This library is free software; you can redistribute it and/or
5
 
 * modify it under the terms of the GNU Lesser General Public
6
 
 * License as published by the Free Software Foundation; either
7
 
 * version 2.1 of the License, or (at your option) any later version.
8
 
 *
9
 
 * This library is distributed in the hope that it will be useful,
10
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 
 * Lesser General Public License for more details.
13
 
 *
14
 
 * You should have received a copy of the GNU Lesser General Public
15
 
 * License along with this library; if not, write to the Free Software
16
 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17
 
 * 02110-1301  USA
18
 
 *
19
 
 */
20
 
 
21
 
#ifndef IRISNETPLUGIN_H
22
 
#define IRISNETPLUGIN_H
23
 
 
24
 
#include "irisnetglobal.h"
25
 
#include "netinterface.h"
26
 
#include "netnames.h"
27
 
 
28
 
namespace XMPP {
29
 
 
30
 
class NetInterfaceProvider;
31
 
class NameProvider;
32
 
class ServiceProvider;
33
 
 
34
 
class IRISNET_EXPORT IrisNetProvider : public QObject
35
 
{
36
 
        Q_OBJECT
37
 
public:
38
 
        virtual ~IrisNetProvider();
39
 
 
40
 
        virtual NetInterfaceProvider *createNetInterfaceProvider();
41
 
        virtual NameProvider *createNameProviderInternet();
42
 
        virtual NameProvider *createNameProviderLocal();
43
 
        virtual ServiceProvider *createServiceProvider();
44
 
};
45
 
 
46
 
class IRISNET_EXPORT NetInterfaceProvider : public QObject
47
 
{
48
 
        Q_OBJECT
49
 
public:
50
 
        class Info
51
 
        {
52
 
        public:
53
 
                QString id, name;
54
 
                bool isLoopback;
55
 
                QList<QHostAddress> addresses;
56
 
                QHostAddress gateway;
57
 
        };
58
 
 
59
 
        NetInterfaceProvider(QObject *parent = 0) : QObject(parent) {}
60
 
 
61
 
        // calling start should populate an initial list that can be
62
 
        //   immediately fetched.  do not signal updated() for this.
63
 
        virtual void start() = 0;
64
 
        virtual QList<Info> interfaces() const = 0;
65
 
 
66
 
signals:
67
 
        void updated();
68
 
};
69
 
 
70
 
class IRISNET_EXPORT NameProvider : public QObject
71
 
{
72
 
        Q_OBJECT
73
 
public:
74
 
        NameProvider(QObject *parent = 0) : QObject(parent) {}
75
 
 
76
 
        virtual int resolve_start(const QByteArray &name, int qType, bool longLived) = 0;
77
 
        virtual void resolve_stop(int id) = 0;
78
 
 
79
 
        // transfer from local back to internet
80
 
        virtual void resolve_localResultsReady(int id, const QList<XMPP::NameRecord> &results) = 0;
81
 
        virtual void resolve_localError(int id, XMPP::NameResolver::Error e) = 0;
82
 
 
83
 
signals:
84
 
        void resolve_resultsReady(int id, const QList<XMPP::NameRecord> &results);
85
 
        void resolve_error(int id, XMPP::NameResolver::Error e);
86
 
 
87
 
        // transfer from internet to local provider
88
 
        void resolve_useLocal(int id, const QByteArray &name);
89
 
};
90
 
 
91
 
class IRISNET_EXPORT ServiceProvider : public QObject
92
 
{
93
 
        Q_OBJECT
94
 
public:
95
 
        ServiceProvider(QObject *parent = 0) : QObject(parent) {}
96
 
 
97
 
        virtual int browse_start(const QString &type, const QString &domain) = 0;
98
 
        virtual void browse_stop(int id) = 0;
99
 
        virtual int resolve_start(const QByteArray &name) = 0;
100
 
        virtual void resolve_stop(int id) = 0;
101
 
        virtual int publish_start(const QString &instance, const QString &type, int port, const QMap<QString,QByteArray> &attributes) = 0;
102
 
        virtual int publish_update(const QMap<QString,QByteArray> &attributes) = 0;
103
 
        virtual void publish_cancel(int id) = 0;
104
 
        virtual int publish_extra_start(int pub_id, const NameRecord &name) = 0;
105
 
        virtual int publish_extra_update(int id, const NameRecord &name) = 0;
106
 
        virtual void publish_extra_cancel(int id) = 0;
107
 
 
108
 
signals:
109
 
        void browse_instanceAvailable(int id, const XMPP::ServiceInstance &instance);
110
 
        void browse_instanceUnavailable(int id, const XMPP::ServiceInstance &instance);
111
 
        void browse_error(int id);
112
 
        void resolve_resultsReady(int id, const QHostAddress &address, int port);
113
 
        void resolve_error(int id);
114
 
        void publish_published(int id);
115
 
        void publish_error(int id, XMPP::ServiceLocalPublisher::Error e);
116
 
        void publish_extra_published(int id);
117
 
        void publish_extra_error(int id, XMPP::ServiceLocalPublisher::Error e);
118
 
};
119
 
 
120
 
}
121
 
 
122
 
Q_DECLARE_INTERFACE(XMPP::IrisNetProvider,      "com.affinix.irisnet.IrisNetProvider/1.0")
123
 
Q_DECLARE_INTERFACE(XMPP::NetInterfaceProvider, "com.affinix.irisnet.NetInterfaceProvider/1.0")
124
 
Q_DECLARE_INTERFACE(XMPP::NameProvider,         "com.affinix.irisnet.NameProvider/1.0")
125
 
Q_DECLARE_INTERFACE(XMPP::ServiceProvider,      "com.affinix.irisnet.ServiceProvider/1.0")
126
 
 
127
 
#endif