Home · Modules · All Classes · All Namespaces
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Tp::IncomingStreamTubeChannel Class Reference

The IncomingStreamTubeChannel class represents an incoming Telepathy channel of type StreamTube. More...

#include <TelepathyQt/IncomingStreamTubeChannel>

Inherits Tp::StreamTubeChannel.

Public Member Functions

virtual ~IncomingStreamTubeChannel ()
 
PendingStreamTubeConnectionacceptTubeAsTcpSocket ()
 
PendingStreamTubeConnectionacceptTubeAsTcpSocket (const QHostAddress &allowedAddress, quint16 allowedPort)
 
PendingStreamTubeConnectionacceptTubeAsUnixSocket (bool requireCredentials=false)
 
- Public Member Functions inherited from Tp::StreamTubeChannel
virtual ~StreamTubeChannel ()
 
QString service () const
 
bool supportsIPv4SocketsOnLocalhost () const
 
bool supportsIPv4SocketsWithSpecifiedAddress () const
 
bool supportsIPv6SocketsOnLocalhost () const
 
bool supportsIPv6SocketsWithSpecifiedAddress () const
 
bool supportsUnixSocketsOnLocalhost () const
 
bool supportsUnixSocketsWithCredentials () const
 
bool supportsAbstractUnixSocketsOnLocalhost () const
 
bool supportsAbstractUnixSocketsWithCredentials () const
 
QSet< uint > connections () const
 
SocketAddressType addressType () const
 
QPair< QHostAddress, quint16 > ipAddress () const
 
QString localAddress () const
 
- Public Member Functions inherited from Tp::TubeChannel
virtual ~TubeChannel ()
 
TubeChannelState state () const
 
QVariantMap parameters () const
 
- Public Member Functions inherited from Tp::Channel
virtual ~Channel ()
 
ConnectionPtr connection () const
 
QVariantMap immutableProperties () const
 
QString channelType () const
 
HandleType targetHandleType () const
 
uint targetHandle () const
 
QString targetId () const
 
ContactPtr targetContact () const
 
bool isRequested () const
 
ContactPtr initiatorContact () const
 
PendingOperationrequestClose ()
 
PendingOperationrequestLeave (const QString &message=QString(), ChannelGroupChangeReason reason=ChannelGroupChangeReasonNone)
 
bool isConference () const
 
Contacts conferenceInitialInviteeContacts () const
 
QList< ChannelPtr > conferenceChannels () const
 
QList< ChannelPtr > conferenceInitialChannels () const
 
QHash< uint, ChannelPtr > conferenceOriginalChannels () const
 
bool supportsConferenceMerging () const
 
PendingOperationconferenceMergeChannel (const ChannelPtr &channel)
 
bool supportsConferenceSplitting () const
 
PendingOperationconferenceSplitChannel ()
 
ChannelGroupFlags groupFlags () const
 
bool groupCanAddContacts () const
 
bool groupCanAddContactsWithMessage () const
 
bool groupCanAcceptContactsWithMessage () const
 
PendingOperationgroupAddContacts (const QList< ContactPtr > &contacts, const QString &message=QString())
 
bool groupCanRescindContacts () const
 
bool groupCanRescindContactsWithMessage () const
 
bool groupCanRemoveContacts () const
 
bool groupCanRemoveContactsWithMessage () const
 
bool groupCanRejectContactsWithMessage () const
 
bool groupCanDepartWithMessage () const
 
PendingOperationgroupRemoveContacts (const QList< ContactPtr > &contacts, const QString &message=QString(), ChannelGroupChangeReason reason=ChannelGroupChangeReasonNone)
 
Contacts groupContacts (bool includeSelfContact=true) const
 
Contacts groupLocalPendingContacts (bool includeSelfContact=true) const
 
Contacts groupRemotePendingContacts (bool includeSelfContact=true) const
 
GroupMemberChangeDetails groupLocalPendingContactChangeInfo (const ContactPtr &contact) const
 
GroupMemberChangeDetails groupSelfContactRemoveInfo () const
 
bool groupAreHandleOwnersAvailable () const
 
HandleOwnerMap groupHandleOwners () const
 
bool groupIsSelfContactTracked () const
 
ContactPtr groupSelfContact () const
 
- Public Member Functions inherited from Tp::StatefulDBusProxy
 StatefulDBusProxy (const QDBusConnection &dbusConnection, const QString &busName, const QString &objectPath, const Feature &featureCore)
 
virtual ~StatefulDBusProxy ()
 
- Public Member Functions inherited from Tp::DBusProxy
 DBusProxy (const QDBusConnection &dbusConnection, const QString &busName, const QString &objectPath, const Feature &featureCore)
 
virtual ~DBusProxy ()
 
QDBusConnection dbusConnection () const
 
QString busName () const
 
QString objectPath () const
 
bool isValid () const
 
QString invalidationReason () const
 
QString invalidationMessage () const
 
- Public Member Functions inherited from Tp::Object
virtual ~Object ()
 
- Public Member Functions inherited from Tp::RefCounted
 RefCounted ()
 
virtual ~RefCounted ()
 
- Public Member Functions inherited from Tp::ReadyObject
 ReadyObject (RefCounted *object, const Feature &featureCore)
 
 ReadyObject (DBusProxy *proxy, const Feature &featureCore)
 
virtual ~ReadyObject ()
 
virtual bool isReady (const Features &features=Features()) const
 
virtual PendingReadybecomeReady (const Features &requestedFeatures=Features())
 
virtual Features requestedFeatures () const
 
virtual Features actualFeatures () const
 
virtual Features missingFeatures () const
 
- Public Member Functions inherited from Tp::OptionalInterfaceFactory< Channel >
 OptionalInterfaceFactory (Channel *this_)
 
 ~OptionalInterfaceFactory ()
 
QStringList interfaces () const
 
bool hasInterface (const QString &name) const
 
Interface * optionalInterface (InterfaceSupportedChecking check=CheckInterfaceSupported) const
 
Interface * interface () const
 

Static Public Member Functions

static IncomingStreamTubeChannelPtr create (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties)
 
- Static Public Member Functions inherited from Tp::StreamTubeChannel
static StreamTubeChannelPtr create (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties)
 
- Static Public Member Functions inherited from Tp::TubeChannel
static TubeChannelPtr create (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties)
 
- Static Public Member Functions inherited from Tp::Channel
static ChannelPtr create (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties)
 
- Static Public Member Functions inherited from Tp::StatefulDBusProxy
static QString uniqueNameFrom (const QDBusConnection &bus, const QString &wellKnownOrUnique)
 
static QString uniqueNameFrom (const QDBusConnection &bus, const QString &wellKnownOrUnique, QString &error, QString &message)
 

Static Public Attributes

static const Feature FeatureCore
 
- Static Public Attributes inherited from Tp::StreamTubeChannel
static const Feature FeatureCore
 
static const Feature FeatureConnectionMonitoring
 
- Static Public Attributes inherited from Tp::TubeChannel
static const Feature FeatureCore
 
- Static Public Attributes inherited from Tp::Channel
static const Feature FeatureCore
 
static const Feature FeatureConferenceInitialInviteeContacts
 

Protected Member Functions

 IncomingStreamTubeChannel (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties, const Feature &coreFeature=IncomingStreamTubeChannel::FeatureCore)
 
- Protected Member Functions inherited from Tp::StreamTubeChannel
 StreamTubeChannel (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties, const Feature &coreFeature=StreamTubeChannel::FeatureCore)
 
void addConnection (uint connection)
 
void removeConnection (uint connection, const QString &error, const QString &message)
 
void setAddressType (SocketAddressType type)
 
SocketAccessControl accessControl () const
 
void setAccessControl (SocketAccessControl accessControl)
 
void setIpAddress (const QPair< QHostAddress, quint16 > &address)
 
void setLocalAddress (const QString &address)
 
bool isDroppingConnections () const
 
- Protected Member Functions inherited from Tp::TubeChannel
 TubeChannel (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties, const Feature &coreFeature=TubeChannel::FeatureCore)
 
void setParameters (const QVariantMap &parameters)
 
- Protected Member Functions inherited from Tp::Channel
 Channel (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties, const Feature &coreFeature)
 
Client::ChannelInterfacebaseInterface () const
 
bool groupSelfHandleIsLocalPending () const
 
- Protected Member Functions inherited from Tp::DBusProxy
void setBusName (const QString &busName)
 
void invalidate (const QString &reason, const QString &message)
 
void invalidate (const QDBusError &error)
 
- Protected Member Functions inherited from Tp::Object
 Object ()
 
void notify (const char *propertyName)
 
- Protected Member Functions inherited from Tp::ReadyObject
ReadinessHelperreadinessHelper () const
 
- Protected Member Functions inherited from Tp::OptionalInterfaceFactory< Channel >
void setInterfaces (const QStringList &interfaces)
 

Additional Inherited Members

- Public Types inherited from Tp::OptionalInterfaceFactory< Channel >
enum  InterfaceSupportedChecking
 
- Signals inherited from Tp::StreamTubeChannel
void newConnection (uint connectionId)
 
void connectionClosed (uint connectionId, const QString &errorName, const QString &errorMessage)
 
- Signals inherited from Tp::TubeChannel
void stateChanged (Tp::TubeChannelState state)
 
- Signals inherited from Tp::Channel
void groupFlagsChanged (Tp::ChannelGroupFlags flags, Tp::ChannelGroupFlags added, Tp::ChannelGroupFlags removed)
 
void groupCanAddContactsChanged (bool canAddContacts)
 
void groupCanRemoveContactsChanged (bool canRemoveContacts)
 
void groupCanRescindContactsChanged (bool canRescindContacts)
 
void groupMembersChanged (const Tp::Contacts &groupMembersAdded, const Tp::Contacts &groupLocalPendingMembersAdded, const Tp::Contacts &groupRemotePendingMembersAdded, const Tp::Contacts &groupMembersRemoved, const Tp::Channel::GroupMemberChangeDetails &details)
 
void groupHandleOwnersChanged (const Tp::HandleOwnerMap &owners, const Tp::UIntList &added, const Tp::UIntList &removed)
 
void groupSelfContactChanged ()
 
void conferenceChannelMerged (const Tp::ChannelPtr &channel)
 
void conferenceChannelRemoved (const Tp::ChannelPtr &channel, const Tp::Channel::GroupMemberChangeDetails &details)
 
- Signals inherited from Tp::DBusProxy
void invalidated (Tp::DBusProxy *proxy, const QString &errorName, const QString &errorMessage)
 
- Signals inherited from Tp::Object
void propertyChanged (const QString &propertyName)
 
- Protected Slots inherited from Tp::Channel
PendingOperationgroupAddSelfHandle ()
 

Detailed Description

The IncomingStreamTubeChannel class represents an incoming Telepathy channel of type StreamTube.

In particular, this class is meant to be used as a comfortable way for accepting incoming stream tubes. Tubes can be accepted as TCP and/or Unix sockets with various access control methods depending on what the service supports using the various overloads of acceptTubeAsTcpSocket() and acceptTubeAsUnixSocket().

Once a tube is successfully accepted and open (the PendingStreamTubeConnection returned from the accepting methods has finished), the application can connect to the socket the address of which can be retrieved from PendingStreamTubeConnection::ipAddress() and/or PendingStreamTubeConnection::localAddress() depending on which accepting method was used. Connecting to this socket will open a tunneled connection to the service listening at the offering end of the tube.

For more details, please refer to Telepathy specification.

See Asynchronous Object Model, Shared Pointer Usage

Constructor & Destructor Documentation

◆ ~IncomingStreamTubeChannel()

Tp::IncomingStreamTubeChannel::~IncomingStreamTubeChannel ( )
virtual

Class destructor.

◆ IncomingStreamTubeChannel()

Tp::IncomingStreamTubeChannel::IncomingStreamTubeChannel ( const ConnectionPtr &  connection,
const QString &  objectPath,
const QVariantMap &  immutableProperties,
const Feature coreFeature = IncomingStreamTubeChannel::FeatureCore 
)
protected

Construct a new IncomingStreamTubeChannel object.

Parameters
connectionConnection owning this channel, and specifying the service.
objectPathThe channel object path.
immutablePropertiesThe channel immutable properties.
coreFeatureThe core feature of the channel type, if any. The corresponding introspectable should depend on IncomingStreamTubeChannel::FeatureCore.

Member Function Documentation

◆ create()

IncomingStreamTubeChannelPtr Tp::IncomingStreamTubeChannel::create ( const ConnectionPtr &  connection,
const QString &  objectPath,
const QVariantMap &  immutableProperties 
)
static

Create a new IncomingStreamTubeChannel object.

Parameters
connectionConnection owning this channel, and specifying the service.
objectPathThe channel object path.
immutablePropertiesThe channel immutable properties.
Returns
A IncomingStreamTubeChannelPtr object pointing to the newly created IncomingStreamTubeChannel object.

◆ acceptTubeAsTcpSocket() [1/2]

PendingStreamTubeConnection * Tp::IncomingStreamTubeChannel::acceptTubeAsTcpSocket ( )

Accept an incoming stream tube as a TCP socket.

This method accepts an incoming connection request for a stream tube. It can be called only if the tube is in the TubeStateLocalPending state.

The connection manager will open a TCP socket for the application to connect to. The address of the socket will be returned in PendingStreamTubeConnection::ipAddress() once the operation has finished successfully.

Using this overload, the connection manager will accept every incoming connection from localhost.

This accept method must be supported by all connection managers adhering to the Telepathy specification.

This method requires IncomingStreamTubeChannel::FeatureCore to be ready.

Returns
A PendingStreamTubeConnection which will emit PendingStreamTubeConnection::finished when the stream tube is ready to be used (hence in the TubeStateOpen state).

◆ acceptTubeAsTcpSocket() [2/2]

PendingStreamTubeConnection * Tp::IncomingStreamTubeChannel::acceptTubeAsTcpSocket ( const QHostAddress &  allowedAddress,
quint16  allowedPort 
)

Accept an incoming stream tube as a TCP socket.

This method accepts an incoming connection request for a stream tube. It can be called only if the tube is in the TubeStateLocalPending state.

The connection manager will open a TCP socket for the application to connect to. The address of the socket will be returned in PendingStreamTubeConnection::ipAddress() once the operation has finished successfully.

This overload lets you specify an allowed address/port combination for connecting to the CM socket. Connections with other source addresses won't be accepted. The accessors supportsIPv4SocketsWithSpecifiedAddress() and supportsIPv6SocketsWithSpecifiedAddress() can be used to verify that the connection manager supports this kind of access control; otherwise, this method will always fail unless QHostAddress::Any (or QHostAddress::AnyIPv4 in Qt5) or QHostAddress::AnyIPv6 is passed, in which case the behavior is identical to the always supported acceptTubeAsTcpSocket() overload.

Note that when using QHostAddress::Any (or QHostAddress::AnyIPv4 in Qt5) or QHostAddress::AnyIPv6, allowedPort is ignored.

This method requires IncomingStreamTubeChannel::FeatureCore to be ready.

Parameters
allowedAddressAn allowed address for connecting to the socket.
allowedPortAn allowed port for connecting to the socket.
Returns
A PendingStreamTubeConnection which will emit PendingStreamTubeConnection::finished when the stream tube is ready to be used (hence in the TubeStateOpen state).

◆ acceptTubeAsUnixSocket()

PendingStreamTubeConnection * Tp::IncomingStreamTubeChannel::acceptTubeAsUnixSocket ( bool  requireCredentials = false)

Accept an incoming stream tube as a Unix socket.

This method accepts an incoming connection request for a stream tube. It can be called only if the tube is in the TubeStateLocalPending state.

An Unix socket (can be used with QLocalSocket or alike) will be opened by the connection manager as the local tube endpoint. This is only supported if supportsUnixSocketsOnLocalhost() is true.

You can also specify whether the CM should require an SCM_CREDS or SCM_CREDENTIALS message upon connection instead of accepting every incoming connection from localhost. This provides additional security, but requires sending the byte retrieved from PendingStreamTubeConnection::credentialByte() in-line in the socket byte stream (in a credentials message if available on the platform), which might not be compatible with all protocols or libraries. Also, only connection managers for which supportsUnixSocketsWithCredentials() is true support this type of access control.

This method requires IncomingStreamTubeChannel::FeatureCore to be ready.

Parameters
requireCredentialsWhether the CM should require an SCM_CREDS or SCM_CREDENTIALS message upon connection.
Returns
A PendingStreamTubeConnection which will emit PendingStreamTubeConnection::finished when the stream tube is ready to be used (hence in the TubeStateOpen state).
See also
StreamTubeChannel::supportsUnixSocketsOnLocalhost(), StreamTubeChannel::supportsUnixSocketsWithCredentials(), StreamTubeChannel::supportsAbstractUnixSocketsOnLocalhost(), StreamTubeChannel::supportsAbstractUnixSocketsWithCredentials()

Member Data Documentation

◆ FeatureCore

const Feature Tp::IncomingStreamTubeChannel::FeatureCore
static

Feature representing the core that needs to become ready to make the IncomingStreamTubeChannel object usable.

This is currently the same as StreamTubeChannel::FeatureCore, but may change to include more.

When calling isReady(), becomeReady(), this feature is implicitly added to the requested features.