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

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

#include <TelepathyQt4/StreamTubeChannel>

Inherits Tp::TubeChannel.

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

List of all members.

Signals

Public Member Functions

Static Public Member Functions

Static Public Attributes

Protected Member Functions


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:
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 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:
connectionConnection owning this channel, and specifying the service.
objectPathThe channel object path.
immutablePropertiesThe 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()
UIntList 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()

Reimplemented in Tp::IncomingStreamTubeChannel.

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()

Reimplemented in Tp::IncomingStreamTubeChannel.

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:
connectionIdThe unique ID associated with the connection that was closed.
errorNameThe name of a D-Bus error describing the error that occurred.
errorMessageA debugging message associated with the error.
See also:
newConnection(), connections()
void Tp::StreamTubeChannel::setBaseTubeType ( uint  type) [protected]

This method never did anything useful when called from outside, and now does nothing at all. It will be removed in the next API/ABI break.

void Tp::StreamTubeChannel::setConnections ( UIntList  connections) [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]

Member Data Documentation

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.

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

See connection monitoring specific methods' documentation for more details.

See also:
newConnection(), connectionClosed()


Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation
Telepathy-Qt4 0.6.5