23 #ifndef _TelepathyQt_stream_tube_client_h_HEADER_GUARD_ 24 #define _TelepathyQt_stream_tube_client_h_HEADER_GUARD_ 26 #include <TelepathyQt/AccountFactory> 27 #include <TelepathyQt/ChannelFactory> 28 #include <TelepathyQt/ConnectionFactory> 29 #include <TelepathyQt/ContactFactory> 30 #include <TelepathyQt/RefCounted> 31 #include <TelepathyQt/Types> 38 class PendingStreamTubeConnection;
52 virtual QPair<QHostAddress, quint16>
53 nextSourceAddress(
const AccountPtr &account,
const IncomingStreamTubeChannelPtr &tube) = 0;
59 class Tube :
public QPair<AccountPtr, IncomingStreamTubeChannelPtr>
63 Tube(
const AccountPtr &account,
const IncomingStreamTubeChannelPtr &channel);
67 bool isValid()
const {
return mPriv.constData() != 0; }
76 const IncomingStreamTubeChannelPtr &
channel()
const 83 friend struct Private;
84 QSharedDataPointer<Private> mPriv;
87 static StreamTubeClientPtr create(
88 const QStringList &p2pServices,
89 const QStringList &roomServices = QStringList(),
90 const QString &clientName = QString(),
91 bool monitorConnections =
false,
92 bool bypassApproval =
false,
93 const AccountFactoryConstPtr &accountFactory =
95 const ConnectionFactoryConstPtr &connectionFactory =
97 const ChannelFactoryConstPtr &channelFactory =
99 const ContactFactoryConstPtr &contactFactory =
102 static StreamTubeClientPtr create(
103 const QDBusConnection &bus,
104 const AccountFactoryConstPtr &accountFactory,
105 const ConnectionFactoryConstPtr &connectionFactory,
106 const ChannelFactoryConstPtr &channelFactory,
107 const ContactFactoryConstPtr &contactFactory,
108 const QStringList &p2pServices,
109 const QStringList &roomServices = QStringList(),
110 const QString &clientName = QString(),
111 bool monitorConnections =
false,
112 bool bypassApproval =
false);
114 static StreamTubeClientPtr create(
115 const AccountManagerPtr &accountManager,
116 const QStringList &p2pServices,
117 const QStringList &roomServices = QStringList(),
118 const QString &clientName = QString(),
119 bool monitorConnections =
false,
120 bool bypassApproval =
false);
122 static StreamTubeClientPtr create(
123 const ClientRegistrarPtr ®istrar,
124 const QStringList &p2pServices,
125 const QStringList &roomServices = QStringList(),
126 const QString &clientName = QString(),
127 bool monitorConnections =
false,
128 bool bypassApproval =
false);
132 ClientRegistrarPtr registrar()
const;
133 QString clientName()
const;
134 bool isRegistered()
const;
135 bool monitorsConnections()
const;
137 bool acceptsAsTcp()
const;
139 bool acceptsAsUnix()
const;
142 void setToAcceptAsUnix(
bool requireCredentials =
false);
144 QList<Tube> tubes()
const;
145 QHash<Tube, QSet<uint> > connections()
const;
149 const Tp::AccountPtr &account,
150 const Tp::IncomingStreamTubeChannelPtr &tube);
152 const Tp::AccountPtr &account,
153 const Tp::IncomingStreamTubeChannelPtr &tube,
154 const QString &error,
155 const QString &message);
157 void tubeAcceptedAsTcp(
158 const QHostAddress &listenAddress,
160 const QHostAddress &sourceAddress,
162 const Tp::AccountPtr &account,
163 const Tp::IncomingStreamTubeChannelPtr &tube);
164 void tubeAcceptedAsUnix(
165 const QString &listenAddress,
166 bool requiresCredentials,
167 uchar credentialByte,
168 const Tp::AccountPtr &account,
169 const Tp::IncomingStreamTubeChannelPtr &tube);
172 const Tp::AccountPtr &account,
173 const Tp::IncomingStreamTubeChannelPtr &tube,
175 void connectionClosed(
176 const Tp::AccountPtr &account,
177 const Tp::IncomingStreamTubeChannelPtr &tube,
179 const QString &error,
180 const QString &message);
184 TP_QT_NO_EXPORT
void onInvokedForTube(
185 const Tp::AccountPtr &account,
186 const Tp::StreamTubeChannelPtr &tube,
187 const QDateTime &userActionTime,
191 TP_QT_NO_EXPORT
void onTubeInvalidated(
Tp::DBusProxy *,
const QString &,
const QString &);
193 TP_QT_NO_EXPORT
void onNewConnection(
194 TubeWrapper *wrapper,
196 TP_QT_NO_EXPORT
void onConnectionClosed(
197 TubeWrapper *wrapper,
199 const QString &error,
200 const QString &message);
204 const ClientRegistrarPtr ®istrar,
205 const QStringList &p2pServices,
206 const QStringList &roomServices,
207 const QString &clientName,
208 bool monitorConnections,
209 bool bypassApproval);
The RefCounted class is a base class for shared objects used by SharedPtr.
Definition: shared-ptr.h:42
static ConnectionFactoryPtr create(const QDBusConnection &bus, const Features &features=Features())
Definition: connection-factory.cpp:57
virtual ~TcpSourceAddressGenerator()
Definition: stream-tube-client.h:56
The PendingStreamTubeConnection class represents an asynchronous operation for accepting an incoming ...
Definition: pending-stream-tube-connection.h:43
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
const AccountPtr & account() const
Definition: stream-tube-client.h:71
The StreamTubeClient::TcpSourceAddressGenerator abstract interface allows using socket source address...
Definition: stream-tube-client.h:49
const IncomingStreamTubeChannelPtr & channel() const
Definition: stream-tube-client.h:76
Definition: abstract-adaptor.cpp:31
The StreamTubeClient class is a Handler implementation for incoming Stream Tube channels, allowing an application to easily get notified about services they can connect to offered to them over Telepathy Tubes without worrying about the channel dispatching details.
Definition: stream-tube-client.h:40
bool isValid() const
Definition: stream-tube-client.h:67
The DBusProxy class is a base class representing a remote object available over D-Bus.
Definition: dbus-proxy.h:42
The StreamTubeClient::Tube class represents a tube being handled by the client.
Definition: stream-tube-client.h:59
The ChannelRequestHints class represents a dictionary of metadata provided by the channel requester w...
Definition: channel-request.h:121