2
* Copyright (C) 2006 Justin Karneges
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.
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.
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
21
#ifndef IRISNETPLUGIN_H
22
#define IRISNETPLUGIN_H
24
#include "irisnetglobal.h"
25
#include "netinterface.h"
30
class NetInterfaceProvider;
32
class ServiceProvider;
34
class IRISNET_EXPORT IrisNetProvider : public QObject
38
virtual ~IrisNetProvider();
40
virtual NetInterfaceProvider *createNetInterfaceProvider();
41
virtual NameProvider *createNameProviderInternet();
42
virtual NameProvider *createNameProviderLocal();
43
virtual ServiceProvider *createServiceProvider();
46
class IRISNET_EXPORT NetInterfaceProvider : public QObject
55
QList<QHostAddress> addresses;
59
NetInterfaceProvider(QObject *parent = 0) : QObject(parent) {}
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;
70
class IRISNET_EXPORT NameProvider : public QObject
74
NameProvider(QObject *parent = 0) : QObject(parent) {}
76
virtual int resolve_start(const QByteArray &name, int qType, bool longLived) = 0;
77
virtual void resolve_stop(int id) = 0;
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;
84
void resolve_resultsReady(int id, const QList<XMPP::NameRecord> &results);
85
void resolve_error(int id, XMPP::NameResolver::Error e);
87
// transfer from internet to local provider
88
void resolve_useLocal(int id, const QByteArray &name);
91
class IRISNET_EXPORT ServiceProvider : public QObject
95
ServiceProvider(QObject *parent = 0) : QObject(parent) {}
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;
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);
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")