| Home · All Classes · All Namespaces · Modules · Functions · Files

Signals | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions
Tp::StreamTubeChannel Class Reference
Channel proxies

The StreamTubeChannel class represents a Telepathy channel of type StreamTube. More...

`#include <TelepathyQt/StreamTubeChannel>`

Inherits Tp::TubeChannel.

Inherited by Tp::IncomingStreamTubeChannel, and Tp::OutgoingStreamTubeChannel.

List of all members.

## Signals

- void newConnection (uint connectionId)
- void connectionClosed (uint connectionId, const QString &errorName, const QString &errorMessage)

## Public Member Functions

- 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

## Static Public Member Functions

- static StreamTubeChannelPtr create (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties)

## Static Public Attributes

- static const Feature FeatureCore
- static const Feature FeatureConnectionMonitoring

## Protected Member Functions

- 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

## Detailed Description

The StreamTubeChannel class represents a Telepathy channel of type StreamTube.

It provides a transport for reliable and ordered data transfer, similar to SOCK_STREAM sockets.

StreamTubeChannel is an intermediate base class; OutgoingStreamTubeChannel and IncomingStreamTubeChannel are the specialized classes used for locally and remotely initiated tubes respectively.

For more details, please refer to Telepathy specification.

See Asynchronous Object Model, Shared Pointer Usage

## Constructor & Destructor Documentation

Tp::StreamTubeChannel::~StreamTubeChannel | ( |  | ) | `[virtual]`

Class destructor.

Tp::StreamTubeChannel::StreamTubeChannel | ( | const ConnectionPtr & | connection,
|  | const QString & | objectPath,
|  | const QVariantMap & | immutableProperties,
|  | const Feature & | coreFeature = `StreamTubeChannel::FeatureCore`
| ) |  | `[protected]`

Construct a new StreamTubeChannel object.

Parameters:

  connection | Connection owning this channel, and specifying the service.
  objectPath | The channel object path.
  immutableProperties | The channel immutable properties.
  coreFeature | The core feature of the channel type, if any. The corresponding introspectable should depend on StreamTubeChannel::FeatureCore.

## Member Function Documentation

StreamTubeChannelPtr Tp::StreamTubeChannel::create | ( | const ConnectionPtr & | connection,
|  | const QString & | objectPath,
|  | const QVariantMap & | immutableProperties
| ) |  | `[static]`

Create a new StreamTubeChannel channel.

Parameters:

  connection | Connection owning this channel, and specifying the service.
  objectPath | The channel object path.
  immutableProperties | The channel immutable properties.

Returns:
  A StreamTubeChannelPtr object pointing to the newly created StreamTubeChannel object.

Reimplemented from Tp::TubeChannel.

Reimplemented in Tp::IncomingStreamTubeChannel, and Tp::OutgoingStreamTubeChannel.

QString Tp::StreamTubeChannel::service | ( |  | ) | const

Return the service name which will be used over this stream tube. This should be a well-known TCP service name, for instance "rsync" or "daap".

This method requires StreamTubeChannel::FeatureCore to be ready.

Returns:
  The service name.

bool Tp::StreamTubeChannel::supportsIPv4SocketsOnLocalhost | ( |  | ) | const

Return whether this stream tube is capable to accept or offer an IPv4 socket accepting all incoming connections coming from localhost.

Note that the Telepathy specification implies that any connection manager, if capable of providing stream tubes, must at least support IPv4 sockets with localhost access control. For this reason, this method should always return `true`.

This method requires StreamTubeChannel::FeatureCore to be ready.

Returns:
  `true` if the stream tube is capable to accept or offer an IPv4 socket accepting all incoming connections coming from localhost, `false` otherwise.

See also:
  IncomingStreamTubeChannel::acceptTubeAsTcpSocket(), OutgoingStreamTubeChannel::offerTcpSocket(), supportsIPv4SocketsWithSpecifiedAddress()

bool Tp::StreamTubeChannel::supportsIPv4SocketsWithSpecifiedAddress | ( |  | ) | const

Return whether this stream tube is capable to accept an IPv4 socket accepting all incoming connections coming from a specific address for incoming tubes or whether this stream tube is capable of mapping connections to the socket's source address for outgoing tubes.

For incoming tubes, when this capability is available, the stream tube can be accepted specifying an IPv4 address. Every connection coming from any other address than the specified one will be rejected.

For outgoing tubes, when this capability is available, one can keep track of incoming connections by enabling StreamTubeChannel::FeatureConnectionMonitoring (possibly before opening the stream tube itself), and checking OutgoingStreamTubeChannel::contactsForConnections() or OutgoingStreamTubeChannel::connectionsForSourceAddresses().

Note that it is strongly advised to call this method before attempting to call IncomingStreamTubeChannel::acceptTubeAsTcpSocket() or OutgoingStreamTubeChannel::offerTcpSocket() with a specified address to prevent failures, as the spec implies this feature is not compulsory for connection managers.

This method requires StreamTubeChannel::FeatureCore to be ready.

Returns:
  `true` if the stream tube is capable to accept an IPv4 socket accepting all incoming connections coming from a specific address for incoming tubes or the stream tube is capable of mapping connections to the socket's source address for outgoing tubes, `false` otherwise.

See also:
  IncomingStreamTubeChannel::acceptTubeAsTcpSocket(), OutgoingStreamTubeChannel::offerTcpSocket(), OutgoingStreamTubeChannel::connectionsForSourceAddresses(), OutgoingStreamTubeChannel::contactsForConnections(), supportsIPv4SocketsOnLocalhost()

bool Tp::StreamTubeChannel::supportsIPv6SocketsOnLocalhost | ( |  | ) | const

Return whether this stream tube is capable to accept or offer an IPv6 socket accepting all incoming connections coming from localhost.

Note that it is strongly advised to call this method before attempting to call IncomingStreamTubeChannel::acceptTubeAsTcpSocket() or OutgoingStreamTubeChannel::offerTcpSocket() with a specified address to prevent failures, as the spec implies this feature is not compulsory for connection managers.

This method requires StreamTubeChannel::FeatureCore to be ready.

Returns:
  `true` if the stream tube is capable to accept or offer an IPv6 socket accepting all incoming connections coming from localhost, `false` otherwise.

See also:
  IncomingStreamTubeChannel::acceptTubeAsTcpSocket(), OutgoingStreamTubeChannel::offerTcpSocket(), supportsIPv6SocketsWithSpecifiedAddress()

bool Tp::StreamTubeChannel::supportsIPv6SocketsWithSpecifiedAddress | ( |  | ) | const

Return whether this stream tube is capable to accept an IPv6 socket accepting all incoming connections coming from a specific address for incoming tubes or whether this stream tube is capable of mapping connections to the socket's source address for outgoing tubes.

For incoming tubes, when this capability is available, the stream tube can be accepted specifying an IPv6 address. Every connection coming from any other address than the specified one will be rejected.

For outgoing tubes, when this capability is available, one can keep track of incoming connections by enabling StreamTubeChannel::FeatureConnectionMonitoring (possibly before opening the stream tube itself), and checking OutgoingStreamTubeChannel::contactsForConnections() or OutgoingStreamTubeChannel::connectionsForSourceAddresses().

Note that it is strongly advised to call this method before attempting to call IncomingStreamTubeChannel::acceptTubeAsTcpSocket() or OutgoingStreamTubeChannel::offerTcpSocket() with a specified address to prevent failures, as the spec implies this feature is not compulsory for connection managers.

This method requires StreamTubeChannel::FeatureCore to be ready.

Returns:
  `true` if the stream tube is capable to accept an IPv6 socket accepting all incoming connections coming from a specific address for incoming tubes or the stream tube is capable of mapping connections to the socket's source address for outgoing tubes, `false` otherwise.

See also:
  IncomingStreamTubeChannel::acceptTubeAsTcpSocket(), OutgoingStreamTubeChannel::offerTcpSocket(), OutgoingStreamTubeChannel::connectionsForSourceAddresses(), OutgoingStreamTubeChannel::contactsForConnections(), supportsIPv6SocketsOnLocalhost()

bool Tp::StreamTubeChannel::supportsUnixSocketsOnLocalhost | ( |  | ) | const

Return whether this stream tube is capable to accept or offer an Unix socket accepting all incoming connections coming from localhost.

Note that it is strongly advised to call this method before attempting to call IncomingStreamTubeChannel::acceptTubeAsUnixSocket() or OutgoingStreamTubeChannel::offerUnixSocket() without credentials enabled, as the spec implies this feature is not compulsory for connection managers.

This method requires StreamTubeChannel::FeatureCore to be ready.

Returns:
  `true` if the stream tube is capable to accept or offer an Unix socket accepting all incoming connections coming from localhost, `false` otherwise.

See also:
  IncomingStreamTubeChannel::acceptTubeAsUnixSocket(), OutgoingStreamTubeChannel::offerUnixSocket(), supportsUnixSocketsWithCredentials() supportsAbstractUnixSocketsOnLocalhost(), supportsAbstractUnixSocketsWithCredentials(),

bool Tp::StreamTubeChannel::supportsUnixSocketsWithCredentials | ( |  | ) | const

Return whether this stream tube is capable to accept or offer an Unix socket which will require credentials upon connection.

When this capability is available and enabled, the connecting process must send a byte when it first connects, which is not considered to be part of the data stream. If the operating system uses sendmsg() with SCM_CREDS or SCM_CREDENTIALS to pass credentials over sockets, the connecting process must do so if possible; if not, it must still send the byte.

The listening process will disconnect the connection unless it can determine by OS-specific means that the connecting process has the same user ID as the listening process.

Note that it is strongly advised to call this method before attempting to call IncomingStreamTubeChannel::acceptTubeAsUnixSocket() or OutgoingStreamTubeChannel::offerUnixSocket() with credentials enabled, as the spec implies this feature is not compulsory for connection managers.

This method requires StreamTubeChannel::FeatureCore to be ready.

Returns:
  `true` if the stream tube is capable to accept or offer an Unix socket which will require credentials upon connection, `false` otherwise.

See also:
  IncomingStreamTubeChannel::acceptTubeAsUnixSocket(), OutgoingStreamTubeChannel::offerUnixSocket(), supportsUnixSocketsOnLocalhost(), supportsAbstractUnixSocketsOnLocalhost(), supportsAbstractUnixSocketsWithCredentials(),

bool Tp::StreamTubeChannel::supportsAbstractUnixSocketsOnLocalhost | ( |  | ) | const

Return whether this stream tube is capable to accept or offer an abstract Unix socket accepting all incoming connections coming from localhost.

Note that it is strongly advised to call this method before attempting to call IncomingStreamTubeChannel::acceptTubeAsUnixSocket() or OutgoingStreamTubeChannel::offerUnixSocket() without credentials enabled, as the spec implies this feature is not compulsory for connection managers.

This method requires StreamTubeChannel::FeatureCore to be ready.

Returns:
  `true` if the stream tube is capable to accept or offer an abstract Unix socket accepting all incoming connections coming from localhost, `false` otherwise.

See also:
  IncomingStreamTubeChannel::acceptTubeAsUnixSocket(), OutgoingStreamTubeChannel::offerUnixSocket(), supportsUnixSocketsOnLocalhost(), supportsUnixSocketsWithCredentials(), supportsAbstractUnixSocketsWithCredentials()

bool Tp::StreamTubeChannel::supportsAbstractUnixSocketsWithCredentials | ( |  | ) | const

Return whether this stream tube is capable to accept or offer an abstract Unix socket which will require credentials upon connection.

When this capability is available and enabled, the connecting process must send a byte when it first connects, which is not considered to be part of the data stream. If the operating system uses sendmsg() with SCM_CREDS or SCM_CREDENTIALS to pass credentials over sockets, the connecting process must do so if possible; if not, it must still send the byte.

The listening process will disconnect the connection unless it can determine by OS-specific means that the connecting process has the same user ID as the listening process.

Note that it is strongly advised to call this method before attempting to call IncomingStreamTubeChannel::acceptTubeAsUnixSocket() or OutgoingStreamTubeChannel::offerUnixSocket() with credentials enabled, as the spec implies this feature is not compulsory for connection managers.

This method requires StreamTubeChannel::FeatureCore to be ready.

Returns:
  `true` if the stream tube is capable to accept or offer an abstract Unix socket which will require credentials upon connection, `false` otherwise.

See also:
  IncomingStreamTubeChannel::acceptTubeAsUnixSocket(), OutgoingStreamTubeChannel::offerUnixSocket(), supportsUnixSocketsOnLocalhost(), supportsUnixSocketsWithCredentials(), supportsAbstractUnixSocketsOnLocalhost()

QSet< uint > Tp::StreamTubeChannel::connections | ( |  | ) | const

Return all the known active connections since StreamTubeChannel::FeatureConnectionMonitoring has been enabled.

For this method to return all known connections, you need to make StreamTubeChannel::FeatureConnectionMonitoring ready before accepting or offering the stream tube.

This method requires StreamTubeChannel::FeatureConnectionMonitoring to be ready.

Returns:
  The list of active connection ids.

See also:
  newConnection(), connectionClosed()

SocketAddressType Tp::StreamTubeChannel::addressType | ( |  | ) | const

Return the type of the tube's local endpoint socket.

Note that this function will return a valid value only after state() has gone TubeStateOpen.

Returns:
  The socket type as SocketAddressType.

See also:
  localAddress(), ipAddress()

QPair< QHostAddress, quint16 > Tp::StreamTubeChannel::ipAddress | ( |  | ) | const

Return the IP address/port combination used by this stream tube.

This method will return a meaningful value only if the local endpoint socket for the tube is a TCP socket, i.e. addressType() is SocketAddressTypeIPv4 or SocketAddressTypeIPv6.

Note that this function will return a valid value only after state() has gone TubeStateOpen.

Returns:
  Pair of IP address as QHostAddress and port if using a TCP socket, or an undefined value otherwise.

See also:
  localAddress()

QString Tp::StreamTubeChannel::localAddress | ( |  | ) | const

Return the local address used by this stream tube.

This method will return a meaningful value only if the local endpoint socket for the tube is an UNIX socket, i.e. addressType() is SocketAddressTypeUnix or SocketAddressTypeAbstractUnix.

Note that this function will return a valid value only after state() has gone TubeStateOpen.

Returns:
  Unix socket address if using an Unix socket, or an undefined value otherwise.

See also:
  ipAddress()

void Tp::StreamTubeChannel::newConnection | ( | uint | connectionId | ) | `[signal]`

void Tp::StreamTubeChannel::connectionClosed | ( | uint | connectionId,
|  | const QString & | errorName,
|  | const QString & | errorMessage
| ) |  | `[signal]`

Emitted when a connection on this stream tube has been closed.

Parameters:

  connectionId | The unique ID associated with the connection that was closed.
  errorName | The name of a D-Bus error describing the error that occurred.
  errorMessage | A debugging message associated with the error.

See also:
  newConnection(), connections()

void Tp::StreamTubeChannel::addConnection | ( | uint | connection | ) | `[protected]`

void Tp::StreamTubeChannel::removeConnection | ( | uint | connection,
|  | const QString & | error,
|  | const QString & | message
| ) |  | `[protected]`

void Tp::StreamTubeChannel::setAddressType | ( | SocketAddressType | type | ) | `[protected]`

SocketAccessControl Tp::StreamTubeChannel::accessControl | ( |  | ) | const`[protected]`

Return the access control used by this stream tube.

Note that this function will only return a valid value after state() has gone TubeStateOpen.

Returns:
  The access control as SocketAccessControl.

See also:
  addressType()

void Tp::StreamTubeChannel::setAccessControl | ( | SocketAccessControl | accessControl | ) | `[protected]`

void Tp::StreamTubeChannel::setIpAddress | ( | const QPair< QHostAddress, quint16 > & | address | ) | `[protected]`

void Tp::StreamTubeChannel::setLocalAddress | ( | const QString & | address | ) | `[protected]`

bool Tp::StreamTubeChannel::isDroppingConnections | ( |  | ) | const`[protected]`

## Member Data Documentation

const Feature Tp::StreamTubeChannel::FeatureCore`[static]`

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

Note that this feature must be enabled in order to use most StreamTubeChannel methods. See specific methods documentation for more details.

Reimplemented from Tp::TubeChannel.

Reimplemented in Tp::IncomingStreamTubeChannel, and Tp::OutgoingStreamTubeChannel.

const Feature Tp::StreamTubeChannel::FeatureConnectionMonitoring`[static]`

Feature used in order to monitor connections to this stream tube.

See connection monitoring specific methods' documentation for more details.

See also:
  newConnection(), connectionClosed()