00001
00022 #ifndef _TelepathyQt4_outgoing_stream_tube_channel_h_HEADER_GUARD_
00023 #define _TelepathyQt4_outgoing_stream_tube_channel_h_HEADER_GUARD_
00024
00025 #ifndef IN_TELEPATHY_QT4_HEADER
00026 #error IN_TELEPATHY_QT4_HEADER
00027 #endif
00028
00029 #include <TelepathyQt4/StreamTubeChannel>
00030 #include <TelepathyQt4/PendingOperation>
00031
00032 class QHostAddress;
00033 class QTcpServer;
00034 class QLocalServer;
00035
00036 namespace Tp
00037 {
00038
00039 class TELEPATHY_QT4_EXPORT OutgoingStreamTubeChannel : public StreamTubeChannel
00040 {
00041 Q_OBJECT
00042 Q_DISABLE_COPY(OutgoingStreamTubeChannel)
00043
00044 public:
00045 static const Feature FeatureCore;
00046
00047 static OutgoingStreamTubeChannelPtr create(const ConnectionPtr &connection,
00048 const QString &objectPath, const QVariantMap &immutableProperties);
00049
00050 virtual ~OutgoingStreamTubeChannel();
00051
00052 PendingOperation *offerTcpSocket(const QHostAddress &address, quint16 port,
00053 const QVariantMap ¶meters = QVariantMap());
00054 PendingOperation *offerTcpSocket(const QTcpServer *server,
00055 const QVariantMap ¶meters = QVariantMap());
00056
00057 PendingOperation *offerUnixSocket(const QString &socketAddress,
00058 const QVariantMap ¶meters = QVariantMap(), bool requireCredentials = false);
00059 PendingOperation *offerUnixSocket(const QLocalServer *server,
00060 const QVariantMap ¶meters = QVariantMap(), bool requireCredentials = false);
00061
00062 QHash<uint, Tp::ContactPtr> contactsForConnections() const;
00063
00064 QHash<QPair<QHostAddress,quint16>, uint> connectionsForSourceAddresses() const;
00065 QHash<uchar, uint> connectionsForCredentials() const;
00066
00067 protected:
00068 OutgoingStreamTubeChannel(const ConnectionPtr &connection, const QString &objectPath,
00069 const QVariantMap &immutableProperties,
00070 const Feature &coreFeature = OutgoingStreamTubeChannel::FeatureCore);
00071
00072 private Q_SLOTS:
00073 TELEPATHY_QT4_NO_EXPORT void onNewRemoteConnection(uint contactId,
00074 const QDBusVariant ¶meter, uint connectionId);
00075 TELEPATHY_QT4_NO_EXPORT void onContactsRetrieved(const QUuid &uuid,
00076 const QList<Tp::ContactPtr> &contacts);
00077 TELEPATHY_QT4_NO_EXPORT void onConnectionClosed(uint connectionId,
00078 const QString &errorName, const QString &errorMessage);
00079
00080 private:
00081 struct Private;
00082 friend struct PendingOpenTube;
00083 friend struct Private;
00084 Private *mPriv;
00085 };
00086
00087 }
00088
00089 #endif