23 #ifndef _TelepathyQt_stream_tube_server_h_HEADER_GUARD_ 24 #define _TelepathyQt_stream_tube_server_h_HEADER_GUARD_ 27 #include <QSharedDataPointer> 29 #include <TelepathyQt/AccountFactory> 30 #include <TelepathyQt/ChannelFactory> 31 #include <TelepathyQt/ConnectionFactory> 32 #include <TelepathyQt/ContactFactory> 33 #include <TelepathyQt/RefCounted> 34 #include <TelepathyQt/Types> 55 nextParameters(
const AccountPtr &account,
const OutgoingStreamTubeChannelPtr &tube,
66 RemoteContact(
const AccountPtr &account,
const ContactPtr &contact);
70 bool isValid()
const {
return mPriv.constData() != 0; }
86 friend struct Private;
87 QSharedDataPointer<Private> mPriv;
90 class Tube :
public QPair<AccountPtr, OutgoingStreamTubeChannelPtr>
94 Tube(
const AccountPtr &account,
const OutgoingStreamTubeChannelPtr &channel);
98 bool isValid()
const {
return mPriv.constData() != 0; }
107 const OutgoingStreamTubeChannelPtr &
channel()
const 114 friend struct Private;
115 QSharedDataPointer<Private> mPriv;
118 static StreamTubeServerPtr create(
119 const QStringList &p2pServices,
120 const QStringList &roomServices = QStringList(),
121 const QString &clientName = QString(),
122 bool monitorConnections =
false,
123 const AccountFactoryConstPtr &accountFactory =
125 const ConnectionFactoryConstPtr &connectionFactory =
127 const ChannelFactoryConstPtr &channelFactory =
129 const ContactFactoryConstPtr &contactFactory =
132 static StreamTubeServerPtr create(
133 const QDBusConnection &bus,
134 const AccountFactoryConstPtr &accountFactory,
135 const ConnectionFactoryConstPtr &connectionFactory,
136 const ChannelFactoryConstPtr &channelFactory,
137 const ContactFactoryConstPtr &contactFactory,
138 const QStringList &p2pServices,
139 const QStringList &roomServices = QStringList(),
140 const QString &clientName = QString(),
141 bool monitorConnections =
false);
143 static StreamTubeServerPtr create(
144 const AccountManagerPtr &accountManager,
145 const QStringList &p2pServices,
146 const QStringList &roomServices = QStringList(),
147 const QString &clientName = QString(),
148 bool monitorConnections =
false);
150 static StreamTubeServerPtr create(
151 const ClientRegistrarPtr ®istrar,
152 const QStringList &p2pServices,
153 const QStringList &roomServices = QStringList(),
154 const QString &clientName = QString(),
155 bool monitorConnections =
false);
159 ClientRegistrarPtr registrar()
const;
160 QString clientName()
const;
161 bool isRegistered()
const;
162 bool monitorsConnections()
const;
164 QPair<QHostAddress, quint16> exportedTcpSocketAddress()
const;
165 QVariantMap exportedParameters()
const;
167 void exportTcpSocket(
168 const QHostAddress &address,
170 const QVariantMap ¶meters = QVariantMap());
171 void exportTcpSocket(
172 const QTcpServer *server,
173 const QVariantMap ¶meters = QVariantMap());
175 void exportTcpSocket(
176 const QHostAddress &address,
179 void exportTcpSocket(
180 const QTcpServer *server,
183 QList<Tube> tubes()
const;
185 QHash<QPair<QHostAddress, quint16>,
RemoteContact> tcpConnections()
const;
190 const Tp::AccountPtr &account,
191 const Tp::OutgoingStreamTubeChannelPtr &tube,
192 const QDateTime &userActionTime,
195 const Tp::AccountPtr &account,
196 const Tp::OutgoingStreamTubeChannelPtr &tube,
197 const QString &error,
198 const QString &message);
200 void newTcpConnection(
201 const QHostAddress &sourceAddress,
203 const Tp::AccountPtr &account,
204 const Tp::ContactPtr &contact,
205 const Tp::OutgoingStreamTubeChannelPtr &tube);
206 void tcpConnectionClosed(
207 const QHostAddress &sourceAddress,
209 const Tp::AccountPtr &account,
210 const Tp::ContactPtr &contact,
211 const QString &error,
212 const QString &message,
213 const Tp::OutgoingStreamTubeChannelPtr &tube);
216 TP_QT_NO_EXPORT
void onInvokedForTube(
217 const Tp::AccountPtr &account,
218 const Tp::StreamTubeChannelPtr &tube,
219 const QDateTime &userActionTime,
222 TP_QT_NO_EXPORT
void onOfferFinished(
223 TubeWrapper *wrapper,
225 TP_QT_NO_EXPORT
void onTubeInvalidated(
227 const QString &error,
228 const QString &message);
230 TP_QT_NO_EXPORT
void onNewConnection(
231 TubeWrapper *wrapper,
233 TP_QT_NO_EXPORT
void onConnectionClosed(
234 TubeWrapper *wrapper,
236 const QString &error,
237 const QString &message);
241 const ClientRegistrarPtr ®istrar,
242 const QStringList &p2pServices,
243 const QStringList &roomServices,
244 const QString &clientName,
245 bool monitorConnections);
The PendingOperation class is a base class for pending asynchronous operations.
Definition: pending-operation.h:45
The RefCounted class is a base class for shared objects used by SharedPtr.
Definition: shared-ptr.h:42
bool isValid() const
Definition: stream-tube-server.h:70
static ConnectionFactoryPtr create(const QDBusConnection &bus, const Features &features=Features())
Definition: connection-factory.cpp:57
The StreamTubeServer::RemoteContact class represents a contact from which a socket connection to our ...
Definition: stream-tube-server.h:62
const OutgoingStreamTubeChannelPtr & channel() const
Definition: stream-tube-server.h:107
The StreamTubeServer class is a Handler implementation for outgoing Stream Tube channels, allowing an application to easily export a TCP network server over Telepathy Tubes without worrying about the channel dispatching details.
Definition: stream-tube-server.h:42
bool isValid() const
Definition: stream-tube-server.h:98
const ContactPtr & contact() const
Definition: stream-tube-server.h:79
The StreamTubeServer::Tube class represents a tube being handled by the server.
Definition: stream-tube-server.h:90
const AccountPtr & account() const
Definition: stream-tube-server.h:74
static AccountFactoryPtr create(const QDBusConnection &bus, const Features &features=Features())
Definition: account-factory.cpp:58
static ChannelFactoryPtr create(const QDBusConnection &bus)
Definition: channel-factory.cpp:86
static ContactFactoryPtr create(const Features &features=Features())
Definition: contact-factory.cpp:48
Definition: abstract-adaptor.cpp:31
The DBusProxy class is a base class representing a remote object available over D-Bus.
Definition: dbus-proxy.h:42
virtual ~ParametersGenerator()
Definition: stream-tube-server.h:59
The StreamTubeServer::ParametersGenerator abstract interface allows sending a different set of parame...
Definition: stream-tube-server.h:51
const AccountPtr & account() const
Definition: stream-tube-server.h:102
The ChannelRequestHints class represents a dictionary of metadata provided by the channel requester w...
Definition: channel-request.h:121