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

#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

A class representing a Stream Tube

StreamTubeChannel is an high level wrapper for managing Telepathy interface TELEPATHY_INTERFACE_CHANNEL_TYPE_STREAM_TUBE. It provides a transport for reliable and ordered data transfer, similar to SOCK_STREAM sockets.

This class provides high level methods for managing both incoming and outgoing tubes - however, you probably want to use one of its subclasses, OutgoingStreamTubeChannel or IncomingStreamTubeChannel, which both provide higher level methods for accepting or offering tubes.

For more details, please refer to Telepathy spec.


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::FeatureStreamTube 
) [protected]

Construct a new StreamTubeChannel object.

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

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 object path of this channel.
immutableProperties The immutable properties of this channel.
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

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

This method requires StreamTubeChannel::FeatureStreamTube to be enabled.

Returns:
the service name that will be used over the tube
bool Tp::StreamTubeChannel::supportsIPv4SocketsOnLocalhost (  )  const

Checks if this tube is capable to accept or offer an IPv4 socket accepting all incoming connections coming from localhost. When this capability is available, the tube can be accepted or offered without any restriction on the access control on the other end.

This method requires StreamTubeChannel::FeatureStreamTube to be enabled.

Note:
Please note that the spec 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.
Returns:
Whether this stream tube is capable to accept or offer an IPv4 socket accepting all incoming connections coming from localhost.
See also:
IncomingStreamTubeChannel::acceptTubeAsTcpSocket
OutgoingStreamTubeChannel::offerTcpSocket
supportsIPv4SocketsWithSpecifiedAddress
bool Tp::StreamTubeChannel::supportsIPv4SocketsWithSpecifiedAddress (  )  const

In case of an incoming tube, checks if this tube is capable to accept or offer an IPv4 socket accepting all incoming connections coming from a specific address only. When this capability is available, the tube can be accepted specifying an IPv4 address. Every connection coming from any other address than the specified one will be rejected.

In case of an outgoing tube, checks if this tube is capable of mapping connections to the socket's source address. If this is the case, to keep track of incoming connections you should enable StreamTubeChannel::FeatureConnectionMonitoring (possibly before opening the tube itself), and call either OutgoingStreamTubeChannel::contactsForConnections or OutgoingStreamTubeChannel::connectionsForSourceAddresses.

This method requires StreamTubeChannel::FeatureStreamTube to be enabled.

Note:
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.
Returns:
When dealing with an incoming tube, whether this tube is capable to accept or offer an IPv4 socket when specifying an allowed address for connecting to the socket. When dealing with an outgoing tube, whether this tube will be able to map connections to the socket's source address.
See also:
IncomingStreamTubeChannel::acceptTubeAsTcpSocket
OutgoingStreamTubeChannel::offerTcpSocket
OutgoingStreamTubeChannel::connectionsForSourceAddresses
OutgoingStreamTubeChannel::contactsForConnections
supportsIPv4SocketsOnLocalhost
bool Tp::StreamTubeChannel::supportsIPv6SocketsOnLocalhost (  )  const

Checks if this tube is capable to accept or offer an IPv6 socket accepting all incoming connections coming from localhost. When this capability is available, the tube can be accepted or offered without any restriction on the access control on the other end.

This method requires StreamTubeChannel::FeatureStreamTube to be enabled.

Note:
It is strongly advised to call this method before attempting to call IncomingStreamTubeChannel::acceptTubeAsTcpSocket or OutgoingStreamTubeChannel::offerTcpSocket with an IPv6 socket to prevent failures, as the spec implies this feature is not compulsory for connection managers.
Returns:
Whether this stream tube is capable to accept or offer an IPv6 socket accepting all incoming connections coming from localhost.
See also:
IncomingStreamTubeChannel::acceptTubeAsTcpSocket
OutgoingStreamTubeChannel::offerTcpSocket
supportsIPv6SocketsWithSpecifiedAddress
bool Tp::StreamTubeChannel::supportsIPv6SocketsWithSpecifiedAddress (  )  const

In case of an incoming tube, checks if this tube is capable to accept or offer an IPv6 socket accepting all incoming connections coming from a specific address only. When this capability is available, the tube can be accepted specifying an IPv6 address. Every connection coming from any other address than the specified one will be rejected.

In case of an outgoing tube, checks if this tube is capable of mapping connections to the socket's source address. If this is the case, to keep track of incoming connections you should enable StreamTubeChannel::FeatureConnectionMonitoring (possibly before opening the tube itself), and call either OutgoingStreamTubeChannel::contactsForConnections or OutgoingStreamTubeChannel::connectionsForSourceAddresses.

This method requires StreamTubeChannel::FeatureStreamTube to be enabled.

Note:
It is strongly advised to call this method before attempting to call IncomingStreamTubeChannel::acceptTubeAsTcpSocket or OutgoingStreamTubeChannel::offerTcpSocket with an IPv6 socket and a specified address to prevent failures, as the spec implies this feature is not compulsory for connection managers.
Returns:
When dealing with an incoming tube, whether this tube is capable to accept or offer an IPv6 socket when specifying an allowed address for connecting to the socket. When dealing with an outgoing tube, whether this tube will be able to map connections to the socket's source address.
See also:
IncomingStreamTubeChannel::acceptTubeAsTcpSocket
OutgoingStreamTubeChannel::offerTcpSocket
OutgoingStreamTubeChannel::connectionsForSourceAddresses
OutgoingStreamTubeChannel::contactsForConnections
supportsIPv6SocketsOnLocalhost
bool Tp::StreamTubeChannel::supportsUnixSocketsOnLocalhost (  )  const

Checks if this tube is capable to accept or offer an Unix socket accepting all incoming connections coming from localhost. When this capability is available, the tube can be accepted or offered without any restriction on the access control on the other end.

This method requires StreamTubeChannel::FeatureStreamTube to be enabled.

Note:
It is strongly advised to call this method before attempting to call IncomingStreamTubeChannel::acceptTubeAsTcpSocket or OutgoingStreamTubeChannel::offerTcpSocket with an Unix socket to prevent failures, as the spec implies this feature is not compulsory for connection managers.
Returns:
Whether this stream tube is capable to accept or offer an Unix socket accepting all incoming connections coming from localhost.
See also:
IncomingStreamTubeChannel::acceptTubeAsUnixSocket
OutgoingStreamTubeChannel::offerUnixSocket
supportsUnixSocketsWithCredentials
bool Tp::StreamTubeChannel::supportsUnixSocketsWithCredentials (  )  const

Checks if this 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.

This method requires StreamTubeChannel::FeatureStreamTube to be enabled.

Note:
It is strongly advised to call this method before attempting to call IncomingStreamTubeChannel::acceptTubeAsTcpSocket or OutgoingStreamTubeChannel::offerTcpSocket with an Unix socket with credentials to prevent failures, as the spec implies this feature is not compulsory for connection managers.
Returns:
Whether this stream tube is capable to accept or offer an Unix socket requiring credentials for connecting to it.
See also:
IncomingStreamTubeChannel::acceptTubeAsUnixSocket
OutgoingStreamTubeChannel::offerUnixSocket
supportsUnixSocketsOnLocalhost
bool Tp::StreamTubeChannel::supportsAbstractUnixSocketsOnLocalhost (  )  const

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

When this capability is available, the tube can be accepted or offered without any restriction on the access control on the other end.

This method requires StreamTubeChannel::FeatureStreamTube to be enabled.

Note:
It is strongly advised to call this method before attempting to call IncomingStreamTubeChannel::acceptTubeAsTcpSocket or OutgoingStreamTubeChannel::offerTcpSocket with an abstract Unix socket to prevent failures, as the spec implies this feature is not compulsory for connection managers.
Returns:
Whether this stream tube is capable to accept or offer an Abstract Unix socket accepting all incoming connections coming from localhost.
See also:
IncomingStreamTubeChannel::acceptTubeAsUnixSocket
OutgoingStreamTubeChannel::offerUnixSocket
supportsUnixSocketsWithCredentials
bool Tp::StreamTubeChannel::supportsAbstractUnixSocketsWithCredentials (  )  const

Checks if this 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.

This method requires StreamTubeChannel::FeatureStreamTube to be enabled.

Note:
It is strongly advised to call this method before attempting to call IncomingStreamTubeChannel::acceptTubeAsTcpSocket or OutgoingStreamTubeChannel::offerTcpSocket with an abstract Unix socket with credentials to prevent failures, as the spec implies this feature is not compulsory for connection managers.
Returns:
Whether this Stream tube supports offering or accepting it as an abstract Unix socket and requiring credentials for connecting to it.
See also:
IncomingStreamTubeChannel::acceptTubeAsUnixSocket
OutgoingStreamTubeChannel::offerUnixSocket
supportsUnixSockets
UIntList Tp::StreamTubeChannel::connections (  )  const

This function returns all the known active connections since FeatureConnectionMonitoring has been enabled. For this method to return all known connections, you need to make FeatureConnectionMonitoring ready before accepting or offering the tube.

Returns:
A list of active connection ids known to this tube
Note:
This method requires StreamTubeChannel::FeatureConnectionMonitoring to be enabled.
SocketAddressType Tp::StreamTubeChannel::addressType (  )  const

Return the type of socket this StreamTube is using.

Returns:
The type of socket this StreamTube is using
Note:
This function will return a valid value only after the tube has been opened
See also:
localAddress
tcpAddress
QPair< QHostAddress, quint16 > Tp::StreamTubeChannel::ipAddress (  )  const

Return the IP address/port combination used by this StreamTube as a QHostAddress.

This method will return a meaningful value only if the socket is an IP socket, hence when addressType returns either SocketAddressTypeIPv4 or SocketAddressTypeIPv6.

Returns:
The IP address and port used by this StreamTube as a QHostAddress, if this tube is using a SocketAddressTypeIPv4 or SocketAddressTypeIPv6.
Note:
This function will return a valid value only after the tube has been opened
See also:
addressType

Reimplemented in Tp::IncomingStreamTubeChannel.

QString Tp::StreamTubeChannel::localAddress (  )  const

Return the local address used by this StreamTube as a QString.

This method will return a meaningful value only if the socket is local, hence when addressType returns either SocketAddressTypeUnix or SocketAddressTypeAbstractUnix.

Returns:
The local address used by this StreamTube as a QString, if this tube is using a SocketAddressTypeUnix or SocketAddressTypeAbstractUnix.
Note:
This function will return a valid value only after the tube has been opened
See also:
addressType

Reimplemented in Tp::IncomingStreamTubeChannel.

void Tp::StreamTubeChannel::newConnection ( uint  connectionId  )  [signal]
void Tp::StreamTubeChannel::connectionClosed ( uint  connectionId,
const QString &  error,
const QString &  message 
) [signal]

Emitted when a connection has been closed.

Parameters:
connectionId The unique ID associated with this connection.
error The error occurred
message A debug message
void Tp::StreamTubeChannel::setBaseTubeType ( uint  type  )  [protected]
void Tp::StreamTubeChannel::setAddressType ( SocketAddressType  type  )  [protected]
void Tp::StreamTubeChannel::setConnections ( UIntList  connections  )  [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.

Feature used in order to monitor connections to this tube.

newConnection will be emitted upon a new connection connectionClosed will be emitted when an existing connection gets closed


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