00001
00022 #ifndef _TelepathyQt_stream_tube_channel_h_HEADER_GUARD_
00023 #define _TelepathyQt_stream_tube_channel_h_HEADER_GUARD_
00024
00025 #ifndef IN_TP_QT_HEADER
00026 #error IN_TP_QT_HEADER
00027 #endif
00028
00029 #include <TelepathyQt/TubeChannel>
00030
00031 class QHostAddress;
00032
00033 namespace Tp
00034 {
00035
00036 class TP_QT_EXPORT StreamTubeChannel : public TubeChannel
00037 {
00038 Q_OBJECT
00039 Q_DISABLE_COPY(StreamTubeChannel)
00040
00041 public:
00042 static const Feature FeatureCore;
00043 static const Feature FeatureConnectionMonitoring;
00044
00045 static StreamTubeChannelPtr create(const ConnectionPtr &connection,
00046 const QString &objectPath, const QVariantMap &immutableProperties);
00047
00048 virtual ~StreamTubeChannel();
00049
00050 QString service() const;
00051
00052 bool supportsIPv4SocketsOnLocalhost() const;
00053 bool supportsIPv4SocketsWithSpecifiedAddress() const;
00054
00055 bool supportsIPv6SocketsOnLocalhost() const;
00056 bool supportsIPv6SocketsWithSpecifiedAddress() const;
00057
00058 bool supportsUnixSocketsOnLocalhost() const;
00059 bool supportsUnixSocketsWithCredentials() const;
00060
00061 bool supportsAbstractUnixSocketsOnLocalhost() const;
00062 bool supportsAbstractUnixSocketsWithCredentials() const;
00063
00064 QSet<uint> connections() const;
00065
00066 SocketAddressType addressType() const;
00067
00068 QPair< QHostAddress, quint16 > ipAddress() const;
00069 QString localAddress() const;
00070
00071 Q_SIGNALS:
00072 void newConnection(uint connectionId);
00073 void connectionClosed(uint connectionId, const QString &errorName,
00074 const QString &errorMessage);
00075
00076 protected:
00077 StreamTubeChannel(const ConnectionPtr &connection, const QString &objectPath,
00078 const QVariantMap &immutableProperties,
00079 const Feature &coreFeature = StreamTubeChannel::FeatureCore);
00080
00081 void addConnection(uint connection);
00082 void removeConnection(uint connection, const QString &error, const QString &message);
00083 void setAddressType(SocketAddressType type);
00084 SocketAccessControl accessControl() const;
00085 void setAccessControl(SocketAccessControl accessControl);
00086 void setIpAddress(const QPair<QHostAddress, quint16> &address);
00087 void setLocalAddress(const QString &address);
00088 bool isDroppingConnections() const;
00089
00090 private Q_SLOTS:
00091 TP_QT_NO_EXPORT void gotStreamTubeProperties(Tp::PendingOperation *op);
00092 TP_QT_NO_EXPORT void onConnectionClosed(uint, const QString &, const QString &);
00093 TP_QT_NO_EXPORT void dropConnections();
00094
00095 private:
00096 struct Private;
00097 friend struct Private;
00098 Private *mPriv;
00099 };
00100
00101 }
00102
00103 #endif